aboutsummaryrefslogtreecommitdiff
path: root/go/game/unit.go
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2023-02-15 13:13:06 +0100
committerFlorian Fischer <florian.fischer@muhq.space>2025-01-27 16:43:49 +0100
commitf9ab2cfdb25eb3fcd85868a2e375326a9c8b6022 (patch)
treeb96f16e6cf4a6dcf93b9557a7219179ab2f46c8d /go/game/unit.go
parent805cbf397589e5cb861f866713c2eb4bec9ce40b (diff)
downloadmuhqs-game-f9ab2cfdb25eb3fcd85868a2e375326a9c8b6022.tar.gz
muhqs-game-f9ab2cfdb25eb3fcd85868a2e375326a9c8b6022.zip
intermediate commit
* fix a lot of target and action bugs * check target selection before adding it to the prompt * use the store view for stores on the map * fix card highlighting in CardGrid * Only prompt for Upkeep-/DiscardActions if appropriate * Add helper for areaEffects granting new FullActions * Add Target() helper selecting the first target to the Action interface * Fix BuyAction and DiscardAction targets * Remember the stores a player has seen
Diffstat (limited to 'go/game/unit.go')
-rw-r--r--go/game/unit.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/go/game/unit.go b/go/game/unit.go
index 94458c07..adb608ab 100644
--- a/go/game/unit.go
+++ b/go/game/unit.go
@@ -251,3 +251,23 @@ func (u *Unit) onUnpile(containing Permanent) {
func (u *Unit) onDrop(containing Permanent) {
u.onUnpile(containing)
}
+
+func (u *Unit) removeFullAction(tag string) {
+ for i, fa := range u.FullActions {
+ if fa.tag != tag {
+ continue
+ }
+ u.FullActions[i] = u.FullActions[len(u.FullActions)-1]
+ u.FullActions = u.FullActions[:len(u.FullActions)-1]
+ break
+ }
+}
+
+func (u *Unit) AddDamage(damage int) {
+ if u.Marks(UnitMarks.Ward) > 0 {
+ u.adjustMarks(UnitMarks.Ward, -1)
+ return
+ }
+
+ u.PermanentBase.AddDamage(damage)
+}