From 6eb0cde9c815527db2059a006ec9bbd664b6f65d Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Wed, 6 Aug 2025 09:34:33 +0200 Subject: consider houses when determining damage for a tile --- go/game/attack_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'go/game/attack_test.go') 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") + } } -- cgit v1.2.3