aboutsummaryrefslogtreecommitdiff
path: root/go/game/marks_test.go
blob: 368d68b2f98c4fc113ead1cf40c63fe182926c27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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")
	}
}