diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-02-02 00:13:30 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-08-20 15:46:38 +0200 |
| commit | e8f44219976edf8cf57cbd9e964f66fe9d145a9c (patch) | |
| tree | 8618f3b22d94ff443227d7ebbc84014e2a786fae /go/game/state.go | |
| parent | e64e268155c4398a82245626cf36bc39f3bea6a8 (diff) | |
| download | muhqs-game-e8f44219976edf8cf57cbd9e964f66fe9d145a9c.tar.gz muhqs-game-e8f44219976edf8cf57cbd9e964f66fe9d145a9c.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()) } |
