diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-02-07 00:32:39 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2023-02-07 00:32:39 +0100 |
| commit | 6bd6936e1aae2fb8d2f5fc95d3c8dcdbe799242d (patch) | |
| tree | 861f7a977c2cd3f015c65c14b5257013650ca71e /go/game/unit.go | |
| parent | 7ebfd783e9b2fbc788dc54b57185f7f41b257f2a (diff) | |
| download | muhqs-game-6bd6936e1aae2fb8d2f5fc95d3c8dcdbe799242d.tar.gz muhqs-game-6bd6936e1aae2fb8d2f5fc95d3c8dcdbe799242d.zip | |
intermediate commit
adding area effects and hooks for permanents entering and leaving tiles
Diffstat (limited to 'go/game/unit.go')
| -rw-r--r-- | go/game/unit.go | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/go/game/unit.go b/go/game/unit.go index d38d156d..82aa8528 100644 --- a/go/game/unit.go +++ b/go/game/unit.go @@ -107,7 +107,6 @@ func NewUnit(card *Card, tile *Tile, owner *Player) *Unit { u.FullActions = card.Impl.fullActions(u) u.FreeActions = card.Impl.freeActions(u) - tile.Permanent = u return u } @@ -126,20 +125,17 @@ func (u *Unit) onUpkeep() { func (u *Unit) move(s *State, tile *Tile) { if !u.IsAvailableTile(tile) { - log.Fatalf("moveing to not available tile %v", tile) + log.Fatalf("moving to not available tile %v", tile) } - if u.tile != nil { - u.tile.Permanent = nil - } else if u.containingPerm != nil { + if u.containingPerm != nil { RemovePermanentFromPile(u.containingPerm, u) } else { - log.Fatalf("unit has no current location") + leaveTile(u) } if tile.Permanent == nil { - tile.Permanent = u - u.tile = tile + enterTile(u, tile) } else { // crew permanent at tile AddPermanentToPile(tile.Permanent, u) u.tile = nil |
