unit

package
v0.0.0-...-54eea7a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 11, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bullet

type Bullet struct {
	UUID      string         `json:"uuid"`
	Weapon    *detail.Weapon `json:"-"`
	Ammo      *ammo.Ammo     `json:"ammo"`
	Rotate    int            `json:"rotate"`
	Artillery bool           `json:"artillery"`
	X         int            `json:"x"`
	Y         int            `json:"y"`
	Z         float64        `json:"z"` // определяет "высоту" пули (сильнее отдалять тени)
	Speed     int            `json:"speed"`
	Target    *Target        `json:"target"`
	OwnerID   int            `json:"owner_id"` // какой игрок стрелял
	MaxRange  int            `json:"max_range"`
	FirePos   int            `json:"-"`
	// состояние юнита на момент выстрела т.к. его состояние может изменится за время полету пути, а урон считать надо
	Unit *Unit `json:"-"`
}

type PathUnit

type PathUnit struct {
	X           int `json:"x"`
	Y           int `json:"y"`
	Rotate      int `json:"rotate"`
	RotateGun   int `json:"rotate_gun"`
	Millisecond int `json:"millisecond"`
	Speed       float64
	Traversed   bool `json:"traversed"`
	Animate     bool `json:"animate"` // включить или нет анимацию движения гусениц
}

type ReloadAction

type ReloadAction struct {
	AmmoID        int
	InventorySlot int
}

type ShortUnitInfo

type ShortUnitInfo struct {
	ID int `json:"id"`
	/* позиция */
	GunRotate int `json:"gun_rotate"`
	Rotate    int `json:"rotate"`
	X         int `json:"x"`
	Y         int `json:"y"`

	/*видимый фит*/
	Body *detail.Body `json:"body"`

	/* покраска юнитов */
	BodyColor1   string `json:"body_color_1"`
	BodyColor2   string `json:"body_color_2"`
	WeaponColor1 string `json:"weapon_color_1"`
	WeaponColor2 string `json:"weapon_color_2"`

	/* путь к файлу готовой покраске, пока не реализовано */
	BodyTexture   string `json:"body_texture"`
	WeaponTexture string `json:"weapon_texture"`

	/*ид владелдьца*/
	OwnerID         int       `json:"owner_id"`
	Owner           string    `json:"owner"`
	MapID           int       `json:"map_id"`
	Evacuation      bool      `json:"evacuation"`
	ForceEvacuation bool      `json:"force_evacuation"`
	InSky           bool      `json:"in_sky"` /* отряд по той или иной причине летит Оо */
	MoveChecker     bool      `json:"move_checker"`
	ActualPathCell  *PathUnit `json:"actual_path_cell"`

	HP int `json:"hp"` // TODO хп видно только тогда когда юнит в радаре
}

type Slot

type Slot struct {
	Unit       *Unit `json:"unit"`
	NumberSlot int   `json:"number_slot"`
}

type Target

type Target struct {
	Type   string `json:"type"` // box, unit, map
	ID     int    `json:"id"`
	X      int    `json:"x"`
	Y      int    `json:"y"`
	Follow bool   `json:"follow"`
}

type Unit

type Unit struct {
	ID      int    `json:"id"`
	SquadID int    `json:"squad_id"`
	Owner   string `json:"owner"`
	OwnerID int    `json:"owner_id"`

	Body *detail.Body `json:"body"`

	GunRotate int  `json:"gun_rotate"`
	FreezeGun bool `json:"-"`

	Rotate int  `json:"rotate"`
	OnMap  bool `json:"on_map"`
	Leave  bool `json:"leave"`
	GameID int  `json:"game_id"`

	Defend bool `json:"defend"`

	HP           int  `json:"hp"`
	Power        int  `json:"power"`
	ActionPoints int  `json:"action_points"`
	Move         bool `json:"move"`
	FindHostile  bool `json:"find_hostile"`

	//-- боевые характиристики живучести/нацигации
	Speed           int  `json:"speed"`
	MinSpeed        int  `json:"min_speed"`
	Initiative      int  `json:"initiative"`
	MaxHP           int  `json:"max_hp"`
	Armor           int  `json:"armor"`
	EvasionCritical int  `json:"evasion_critical"`
	VulToKinetics   int  `json:"vul_to_kinetics"`
	VulToThermo     int  `json:"vul_to_thermo"`
	VulToExplosion  int  `json:"vul_to_explosion"`
	RangeView       int  `json:"range_view"`
	RangeRadar      int  `json:"range_radar"`
	Accuracy        int  `json:"accuracy"`
	MaxPower        int  `json:"max_power"`
	RecoveryPower   int  `json:"recovery_power"`
	RecoveryHP      int  `json:"recovery_HP"`
	WallHack        bool `json:"wall_hack"`

	Effects []*effect.Effect `json:"effects"`
	MS      bool             `json:"ms"`
	Units   map[int]*Slot    `json:"units"` // в роли ключей карты выступают

	Reload *ReloadAction `json:"reload"`

	/* покраска юнитов */
	BodyColor1   string `json:"body_color_1"`
	BodyColor2   string `json:"body_color_2"`
	WeaponColor1 string `json:"weapon_color_1"`
	WeaponColor2 string `json:"weapon_color_2"`

	/* путь к файлу готовой покраске, пока не реализовано */
	BodyTexture   string `json:"body_texture"`
	WeaponTexture string `json:"weapon_texture"`

	/* очередь глобальных коодинат по которому юнит еще будет идти */
	PointsPath []*coordinate.Coordinate

	/* путь по которому идет юнит */
	ActualPath     *[]*PathUnit `json:"actual_path"`
	ActualPathCell *PathUnit    `json:"actual_path_cell"`
	LastPathCell   *PathUnit    `json:"actual_path"`

	CurrentSpeed float64 `json:"current_speed"`
	HighGravity  bool    `json:"high_gravity"`
	Afterburner  bool    `json:"afterburner"`

	X   int     `json:"x"`    /* текущая координата на пиксельной сетке */
	Y   int     `json:"y"`    /* текущая координата на пиксельной сетке */
	ToX float64 `json:"to_x"` /* куда юнит двигается */
	ToY float64 `json:"to_y"` /* куда юнит двигается */
	// у мс мап ид ставится сразу как создается отряд, тоесть ситуация что отряд на глобалке без мап ид крайне мала, а юниты получают мап ид как выйдут из трюма
	MapID int `json:"map_id"`

	Evacuation      bool `json:"evacuation"`
	ForceEvacuation bool `json:"force_evacuation"`
	InSky           bool `json:"in_sky"` /* отряд по той или иной причине летит Оо */

	MoveChecker bool   `json:"move_checker"`
	MoveUUID    string `json:"-"`

	Inventory *inventory.Inventory `json:"inventory"` // в роли ключей карты выступают номера слотов где содержиться итем

	FollowUnitID int  `json:"follow_unit_id"`
	Return       bool `json:"returning"`

	FormationPos *coordinate.Coordinate `json:"formation_pos"`
	Formation    bool                   `json:"formation"`
	// contains filtered or unexported fields
}

func (*Unit) CalculateParams

func (unit *Unit) CalculateParams()

func (*Unit) CheckViewCoordinate

func (unit *Unit) CheckViewCoordinate(x, y int) (bool, bool)

func (*Unit) DelAmmo

func (unit *Unit) DelAmmo()

func (*Unit) DelBody

func (unit *Unit) DelBody()

func (*Unit) DelEquip

func (unit *Unit) DelEquip()

func (*Unit) GetAmmoCount

func (unit *Unit) GetAmmoCount() int

func (*Unit) GetBody

func (unit *Unit) GetBody() *detail.Body

func (*Unit) GetDamage

func (unit *Unit) GetDamage() (int, int)

возарщает урон простой и урон по снаряжению

func (*Unit) GetDistWeaponToTarget

func (unit *Unit) GetDistWeaponToTarget() int

func (*Unit) GetID

func (unit *Unit) GetID() int

func (*Unit) GetOnMap

func (unit *Unit) GetOnMap() bool

func (*Unit) GetOwnerUser

func (unit *Unit) GetOwnerUser() string

func (*Unit) GetReactorEfficiency

func (unit *Unit) GetReactorEfficiency() int

func (*Unit) GetShortInfo

func (unit *Unit) GetShortInfo() *ShortUnitInfo

func (*Unit) GetTarget

func (unit *Unit) GetTarget() *Target

func (*Unit) GetWallHack

func (unit *Unit) GetWallHack() bool

func (*Unit) GetWatchZone

func (unit *Unit) GetWatchZone() int

func (*Unit) GetWeaponFirePos

func (unit *Unit) GetWeaponFirePos() []*coordinate.Coordinate

func (*Unit) GetWeaponMinRange

func (unit *Unit) GetWeaponMinRange() int

func (*Unit) GetWeaponPos

func (unit *Unit) GetWeaponPos() (int, int)

func (*Unit) GetWeaponRange

func (unit *Unit) GetWeaponRange() int

func (*Unit) GetWeaponSlot

func (unit *Unit) GetWeaponSlot() *detail.BodyWeaponSlot

func (*Unit) SetAmmo

func (unit *Unit) SetAmmo()

func (*Unit) SetBody

func (unit *Unit) SetBody(body *detail.Body)

func (*Unit) SetEquip

func (unit *Unit) SetEquip()

func (*Unit) SetFollowTarget

func (unit *Unit) SetFollowTarget(follow bool)

func (*Unit) SetOnMap

func (unit *Unit) SetOnMap(bool bool)

func (*Unit) SetTarget

func (unit *Unit) SetTarget(target *Target)

func (*Unit) SetWeaponSlot

func (unit *Unit) SetWeaponSlot(newWeaponSlot *detail.BodyWeaponSlot)

func (*Unit) WorkOutMovePower

func (unit *Unit) WorkOutMovePower()

func (*Unit) WorkOutPower

func (unit *Unit) WorkOutPower(count float32)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL