diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-02-08 17:50:10 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2023-02-08 17:50:10 +0100 |
| commit | 23ecef83b28e9b51187fe34032e9558cf0eb5e05 (patch) | |
| tree | c55d54dd209509e376a4965782b9161243c1fd7d /go/game/unit.go | |
| parent | bd558df11dbe60c0bd310b95b26bf17ba06cab35 (diff) | |
| download | muhqs-game-rework-targets.tar.gz muhqs-game-rework-targets.zip | |
intermediate commitrework-targets
Diffstat (limited to 'go/game/unit.go')
| -rw-r--r-- | go/game/unit.go | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/go/game/unit.go b/go/game/unit.go index 8b57b0ae..94458c07 100644 --- a/go/game/unit.go +++ b/go/game/unit.go @@ -1,6 +1,7 @@ package game import ( + "fmt" "log" ) @@ -14,7 +15,7 @@ type Unit struct { Health int Movement Movement Attack Attack - Upkeep int + upkeep int FullActions []*FullAction FreeActions []*FreeAction // Effects []Effects @@ -48,7 +49,7 @@ func NewUnit(card *Card, tile *Tile, owner *Player) *Unit { Health: card.Values["health"].(int), Movement: movement, Attack: attack, - Upkeep: upkeep, + upkeep: upkeep, AvailMoveActions: DEFAULT_AVAIL_MOVE_ACTIONS, AvailAttackActions: DEFAULT_AVAIL_ATTACK_ACTIONS, } @@ -61,10 +62,22 @@ func NewUnit(card *Card, tile *Tile, owner *Player) *Unit { return u } +func (u *Unit) Fmt() string { + return fmt.Sprintf("%s@%v", u.Card().Name, u.TileOrContainingPermTile()) +} + +func (u *Unit) FmtWController() string { + return fmt.Sprintf("%s's %s@%v", u.Controller().Name, u.Card().Name, u.TileOrContainingPermTile()) +} + func NewUnitFromPath(cardPath string, tile *Tile, owner *Player) *Unit { return NewUnit(NewCard(cardPath), tile, owner) } +func (u *Unit) UpkeepCost() int { + return u.upkeep +} + func (u *Unit) resetBaseActions() { u.AvailMoveActions = DEFAULT_AVAIL_MOVE_ACTIONS + u.additionalMoveActions u.AvailAttackActions = DEFAULT_AVAIL_ATTACK_ACTIONS + u.additionalAttackActions |
