diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2025-08-06 09:34:33 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-08-20 15:57:34 +0200 |
| commit | 6eb0cde9c815527db2059a006ec9bbd664b6f65d (patch) | |
| tree | 18ef881ee8ef07713421c53d319780494f2e4124 /go/game/attack_test.go | |
| parent | deee4b76b6ab1a94e5578818aba4b94e22e6ac89 (diff) | |
| download | muhqs-game-6eb0cde9c815527db2059a006ec9bbd664b6f65d.tar.gz muhqs-game-6eb0cde9c815527db2059a006ec9bbd664b6f65d.zip | |
consider houses when determining damage for a tile
Diffstat (limited to 'go/game/attack_test.go')
| -rw-r--r-- | go/game/attack_test.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/go/game/attack_test.go b/go/game/attack_test.go index a13b4795..52ba41a0 100644 --- a/go/game/attack_test.go +++ b/go/game/attack_test.go @@ -75,6 +75,9 @@ func TestPikeAttack(t *testing.T) { tile := &Tile{Position: Position{1, 2}} enterTile(NewUnitFromPath("base/cavalry", tile, NewMockPlayer()), tile) + house := &Tile{Position: Position{2, 1}, Type: TileTypes.House, Raw: "house"} + enterTile(NewUnitFromPath("base/cavalry", house, NewMockPlayer()), house) + // This test is crooked because the attack of the attacking unit is checked in flexAttack and not a. d, ok := a.DamageForTile(u, tile) if !ok { @@ -83,4 +86,9 @@ func TestPikeAttack(t *testing.T) { if d != u.Attack.DamageInRange(u.Attack.MaxRange()) { t.Fatal("unexpected damage: amount", d) } + + d, ok = a.DamageForTile(u, house) + if ok || d != 0 { + t.Fatal("protected cavalry in range for pike attack") + } } |
