diff options
Diffstat (limited to 'go/game/targets.go')
| -rw-r--r-- | go/game/targets.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/go/game/targets.go b/go/game/targets.go index e9f227e0..0ab61cbc 100644 --- a/go/game/targets.go +++ b/go/game/targets.go @@ -13,16 +13,16 @@ import ( type ( TargetConstraintFunc func(interface{}) error TargetConstraint struct { - desc string + desc string constraint TargetConstraintFunc } ) type Targets struct { - s *State - action Action + s *State + action Action constraints []*TargetConstraint - sel []interface{} + sel []interface{} } func fmtSel(sel interface{}) string { @@ -153,7 +153,7 @@ func enemyPermanentTargetConstraint(action Action) TargetConstraintFunc { return func(t interface{}) (err error) { p, _ := t.(Permanent) if !p.Controller().IsEnemy(sourceController) { - err = fmt.Errorf("Controller %s of target %t is not an enemy of %s", + err = fmt.Errorf("Controller %v of target %v is not an enemy of %v", p.Controller(), t, sourceController) } return @@ -164,13 +164,13 @@ func attackableTargetConstraint(action Action) TargetConstraintFunc { return func(t interface{}) (err error) { p, _ := t.(Permanent) if !p.Attackable() { - err = fmt.Errorf("Permanent %s isnot attackable", p) + err = fmt.Errorf("Permanent %v is not attackable", p) } if attackAction, ok := action.(*AttackAction); ok { attacker := attackAction.Source().(*Unit) if !IsPositionInRange(attacker.Tile().Position, p.Tile().Position, attacker.Attack.MaxRange()) { - err = fmt.Errorf("Position %s of target %s not in attack range %d of source's position %s", + err = fmt.Errorf("Position %v of target %v not in attack range %d of source's position %v", p.Tile().Position, p, attacker.Attack.MaxRange(), attacker.Tile().Position) } } @@ -192,7 +192,7 @@ func rangeTargetConstraint(source interface{}, r int) TargetConstraintFunc { return func(t interface{}) (err error) { p, _ := t.(Permanent) if !IsPositionInRange(sourcePos, p.Tile().Position, r) { - err = fmt.Errorf("Position %s of target %s not in range %d of source's position %s", + err = fmt.Errorf("Position %v of target %v not in range %d of source's position %v", p.Tile().Position, t, r, sourcePos) } return @@ -290,7 +290,7 @@ func parseTileTargetConstraint(desc string, s *State, action Action) []TargetCon if slices.Contains(u.MoveRangeTiles(s.Map), tile) { return nil } - return fmt.Errorf("tile %s is not in %d movement range", tile) + return fmt.Errorf("tile %v is not in %v's movement range", tile, u) }) } |
