diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2025-08-22 12:22:09 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-08-22 12:22:09 +0200 |
| commit | 3e6e9bbc9fdd171b0eeb32ea1e2767a118825bb7 (patch) | |
| tree | 83e2376c32c732e09152abaa1738ba8c5a589a5b | |
| parent | 351d670db4fdc6d642dcb58aa21ae733bad5c196 (diff) | |
| download | muhqs-game-3e6e9bbc9fdd171b0eeb32ea1e2767a118825bb7.tar.gz muhqs-game-3e6e9bbc9fdd171b0eeb32ea1e2767a118825bb7.zip | |
fix and test the banner implementation
Fixes: 0667db9e5a765cbd1eec90b63fb8cd0a6e0a2dc7
| -rw-r--r-- | go/game/cardImplementations.go | 2 | ||||
| -rw-r--r-- | go/game/cardImplementations_test.go | 29 | ||||
| -rw-r--r-- | go/game/state.go | 4 |
3 files changed, 32 insertions, 3 deletions
diff --git a/go/game/cardImplementations.go b/go/game/cardImplementations.go index 16205ca5..58bbc75e 100644 --- a/go/game/cardImplementations.go +++ b/go/game/cardImplementations.go @@ -766,7 +766,7 @@ func init() { "base/tax_collector": &taxCollectorImpl{}, "base/wormtongue": &wormtongueImpl{}, - "equipments/banner": &bannerImpl{}, + "equipments/banner": &bannerImpl{aoe: bannerAoE}, "equipments/mace": &maceImpl{triggers: make(map[Permanent]Trigger)}, "equipments/poison_dagger": &poisonDaggerImpl{}, "equipments/spear": &spearImpl{}, diff --git a/go/game/cardImplementations_test.go b/go/game/cardImplementations_test.go index 6b63b049..96164203 100644 --- a/go/game/cardImplementations_test.go +++ b/go/game/cardImplementations_test.go @@ -253,3 +253,32 @@ func TestArmor(t *testing.T) { t.Fatal("pioneer received damage") } } + +func TestBanner(t *testing.T) { + s := NewLocalState() + m := newEmpty2x2Map() + s.SetMap(m) + + player := s.AddNewPlayer("p", NewDeck()) + opo := s.AddNewPlayer("o", NewDeck()) + + s.addNewArtifact(NewCard("equipments/banner"), Position{0, 0}, player) + w := s.addNewUnit(NewCard("base/wormtongue"), Position{1, 0}, player) + a := s.addNewUnit(NewCard("base/archer"), Position{0, 1}, opo) + + if a.Attack.DamageInRange(1) != 2 { + t.Fatal("archer not buffed by banner") + } + + if a.Movement.Range != 3 { + t.Fatal("archer not sped up by banner") + } + + if w.Attack.DamageInRange(1) != 1 { + t.Fatal("wormtongue not buffed by banner") + } + + if w.Movement.Range != 3 { + t.Fatal("wormtongue not sped up by banner") + } +} diff --git a/go/game/state.go b/go/game/state.go index 912d88f3..76133498 100644 --- a/go/game/state.go +++ b/go/game/state.go @@ -519,8 +519,8 @@ func (s *LocalState) addPermanent(perm Permanent) { s.units = append(s.units, p) } - if perm.Tile() != nil { - enterTile(perm, perm.Tile()) + if t := perm.Tile(); t != nil { + enterTile(perm, t) } perm.Card().Impl.onETB(s, perm) |
