diff options
Diffstat (limited to 'go/game/unit.go')
| -rw-r--r-- | go/game/unit.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/go/game/unit.go b/go/game/unit.go index 5b071d7b..99c7c28d 100644 --- a/go/game/unit.go +++ b/go/game/unit.go @@ -200,6 +200,24 @@ func (u *Unit) AvailSlowActions() (actions []Action) { } } + if u.AvailAttackActions > 0 || u.AvailMoveActions > 0 { + for _, tile := range TilesInRange(m, u, 1) { + if tile.Permanent == nil { + continue + } + + if equipment, ok := tile.Permanent.(*Equipment); ok { + actions = append(actions, NewEquipAction(u, equipment)) + } + + for _, perm := range tile.Permanent.Pile() { + if equipment, ok := perm.(*Equipment); ok { + actions = append(actions, NewEquipAction(u, equipment)) + } + } + } + } + return actions } @@ -278,3 +296,12 @@ func (u *Unit) addDamage(damage int) { u.permanentBase.addDamage(damage) } + +func (u *Unit) equip(e *Equipment) { + if e.containingPerm != nil { + removePermanentFromPile(e.containingPerm, e) + } else { + leaveTile(e) + } + addPermanentToPile(u, e) +} |
