aboutsummaryrefslogtreecommitdiff
path: root/go/game/unit.go
diff options
context:
space:
mode:
Diffstat (limited to 'go/game/unit.go')
-rw-r--r--go/game/unit.go20
1 files changed, 17 insertions, 3 deletions
diff --git a/go/game/unit.go b/go/game/unit.go
index 75fddf3e..670f189b 100644
--- a/go/game/unit.go
+++ b/go/game/unit.go
@@ -85,8 +85,16 @@ func (u *Unit) resetBaseActions() {
}
func (u *Unit) onUpkeep() {
- // TODO: handle state marks
- u.resetBaseActions()
+ if u.Marks(UnitStates.Poison) > 0 {
+ u.adjustMarks(UnitStates.Poison, 1)
+ }
+
+ log.Println(u.Marks(UnitStates.Paralysis))
+ if u.Marks(UnitStates.Paralysis) > 0 {
+ u.adjustMarks(UnitStates.Paralysis, -1)
+ } else {
+ u.resetBaseActions()
+ }
}
func (u *Unit) MoveRangeTiles() []*Tile {
@@ -166,7 +174,7 @@ func (u *Unit) fight(p Permanent) {
}
func (u *Unit) IsDestroyed() bool {
- return u.damage >= u.Health
+ return u.damage >= u.Health || u.Marks(UnitStates.Poison) >= u.Health*2
}
func (u *Unit) HasFullAction() bool {
@@ -179,6 +187,12 @@ func (u *Unit) tap() {
}
func (u *Unit) AvailSlowActions() (actions []Action) {
+ // TODO: implement panic and rage marks
+ if u.Marks(UnitStates.Panic) > 0 {
+ }
+ if u.Marks(UnitStates.Rage) > 0 {
+ }
+
if u.AvailMoveActions > 0 && u.Movement != INVALID_MOVEMENT() {
actions = append(actions, NewMoveAction(u))
}