diff options
Diffstat (limited to 'go/game/unit.go')
| -rw-r--r-- | go/game/unit.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/go/game/unit.go b/go/game/unit.go index c7528224..1bf3afa1 100644 --- a/go/game/unit.go +++ b/go/game/unit.go @@ -112,12 +112,13 @@ func (u *Unit) MoveRangeTiles(m *Map) []*Tile { return tiles } -func (u *Unit) AttackableTiles(m *Map) []*Tile { +func (u *Unit) AttackableTiles() []*Tile { // Units not on the map can not attack if u.tile == nil { return nil } + m := u.controller.gameState.Map() tilesInRange := TilesInRange(m, u, u.Attack.MaxRange()) if u.Attack.MaxRange() == 1 { return tilesInRange @@ -134,9 +135,9 @@ func (u *Unit) AttackableTiles(m *Map) []*Tile { return aTiles } -func (u *Unit) AttackablePermanents(m *Map) []Permanent { +func (u *Unit) AttackablePermanents() []Permanent { permanents := []Permanent{} - for _, t := range u.AttackableTiles(m) { + for _, t := range u.AttackableTiles() { if t.Permanent != nil && t.Permanent.Attackable() { permanents = append(permanents, t.Permanent) } @@ -144,10 +145,10 @@ func (u *Unit) AttackablePermanents(m *Map) []Permanent { return permanents } -func (u *Unit) AttackableEnemyPermanents(m *Map) []Permanent { +func (u *Unit) AttackableEnemyPermanents() []Permanent { controller := u.Controller() permanents := []Permanent{} - for _, t := range u.AttackableTiles(m) { + for _, t := range u.AttackableTiles() { if t.Permanent != nil && t.Permanent.Attackable() && t.Permanent.Controller() != controller { @@ -182,7 +183,7 @@ func (u *Unit) AvailSlowActions() (actions []Action) { m := u.Controller().gameState.Map() if u.AvailAttackActions > 0 && !INVALID_ATTACK(u.Attack) && - len(u.AttackableEnemyPermanents(m)) > 0 { + len(u.AttackableEnemyPermanents()) > 0 { actions = append(actions, NewAttackAction(u)) } |
