diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2025-07-24 20:05:27 -0400 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-07-28 18:03:10 +0200 |
| commit | d4e04a8736adb91c84323608b67bfa67c28f09cb (patch) | |
| tree | a3159b0a5c89dd754e84658ff59e02e433aaea30 /go/game/marks_test.go | |
| parent | 76f79f077dbe3ccc7fe12d803231856396573e3a (diff) | |
| download | muhqs-game-d4e04a8736adb91c84323608b67bfa67c28f09cb.tar.gz muhqs-game-d4e04a8736adb91c84323608b67bfa67c28f09cb.zip | |
support unit state marks
Diffstat (limited to 'go/game/marks_test.go')
| -rw-r--r-- | go/game/marks_test.go | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/go/game/marks_test.go b/go/game/marks_test.go new file mode 100644 index 00000000..368d68b2 --- /dev/null +++ b/go/game/marks_test.go @@ -0,0 +1,49 @@ +package game + +import ( + "strings" + "testing" +) + +func TestParalysis(t *testing.T) { + mapDef := `map: |1- + H + +symbols: + H: house +` + s := NewLocalState() + m, _ := readMap(strings.NewReader(mapDef)) + s.SetMap(m) + + p := s.AddNewPlayer("player", NewDeck()) + + u := s.addNewUnit(NewCard("base/archer"), Position{0, 0}, p) + u.tap() + u.adjustMarks(UnitStates.Paralysis, 1) + u.onUpkeep() + as := u.AvailSlowActions() + if len(as) > 0 { + t.Fatal("unexpected slow actions available") + } + if u.Marks(UnitStates.Paralysis) > 0 { + t.Fatal("unit still paralysed") + } +} + +func TestPoison(t *testing.T) { + u := NewUnit(NewCard("base/pioneer"), NewMockTile(), NewMockPlayer()) + u.tap() + u.adjustMarks(UnitStates.Poison, 1) + u.onUpkeep() + if u.Marks(UnitStates.Poison) != 2 { + t.Fatal("poison marks did not spread") + } + if u.IsDestroyed() { + t.Fatal("destroyed by poison") + } + u.adjustMarks(UnitStates.Poison, 10) + if !u.IsDestroyed() { + t.Fatal("not destroyed by poison") + } +} |
