diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-02-02 00:13:30 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2023-02-02 00:13:30 +0100 |
| commit | 562538479916452a89fdda0bb77aa68a676b7f47 (patch) | |
| tree | 3d728812431f8875697f098b5283bc98ad8e97ad /go/game/state.go | |
| parent | be9251c159c1679fa6e6ebb4914b5ace2237d491 (diff) | |
| download | muhqs-game-562538479916452a89fdda0bb77aa68a676b7f47.tar.gz muhqs-game-562538479916452a89fdda0bb77aa68a676b7f47.zip | |
change unit attack representation and implement sword
Diffstat (limited to 'go/game/state.go')
| -rw-r--r-- | go/game/state.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/go/game/state.go b/go/game/state.go index 1d4b644f..6ca100c8 100644 --- a/go/game/state.go +++ b/go/game/state.go @@ -139,14 +139,14 @@ func (s *State) IsValidAttack(a *AttackAction) error { } unit := a.Source().(Unit) - if unit.Attack == INVALID_ATTACK() { + if INVALID_ATTACK(unit.Attack) { return fmt.Errorf("%s can not attack", unit.card.Name) } target := a.Targets().sel[0].(Permanent) - if !IsPositionInRange(unit.tile.Position, target.Tile().Position, unit.Attack.Range) { + if !IsPositionInRange(unit.tile.Position, target.Tile().Position, unit.Attack.MaxRange()) { return fmt.Errorf("Attack target on %s is not in attack range %d of %s on %s", - target.Tile().Position.String(), unit.Attack.Range, unit.card.Name, + target.Tile().Position.String(), unit.Attack.MaxRange(), unit.card.Name, unit.tile.Position.String()) } |
