aboutsummaryrefslogtreecommitdiff
path: root/go/game/state.go
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2023-02-02 00:13:30 +0100
committerFlorian Fischer <florian.fischer@muhq.space>2025-08-20 15:46:38 +0200
commite8f44219976edf8cf57cbd9e964f66fe9d145a9c (patch)
tree8618f3b22d94ff443227d7ebbc84014e2a786fae /go/game/state.go
parente64e268155c4398a82245626cf36bc39f3bea6a8 (diff)
downloadmuhqs-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.go6
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())
}