aboutsummaryrefslogtreecommitdiff
path: root/go/game/cardImplementations.go
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2025-08-15 20:52:55 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2025-08-20 15:57:38 +0200
commit488f6377e6f6fd3099bb927a986d548fbc1eb63f (patch)
tree6cf6a3daed56b279a1f708cc03e551a387810640 /go/game/cardImplementations.go
parent139ad01740eba2ff1e0a9d46593d2278b32310ce (diff)
downloadmuhqs-game-488f6377e6f6fd3099bb927a986d548fbc1eb63f.tar.gz
muhqs-game-488f6377e6f6fd3099bb927a986d548fbc1eb63f.zip
implement mace and add damage dealt events/triggers
Diffstat (limited to 'go/game/cardImplementations.go')
-rw-r--r--go/game/cardImplementations.go56
1 files changed, 48 insertions, 8 deletions
diff --git a/go/game/cardImplementations.go b/go/game/cardImplementations.go
index 2a627a94..dcd11808 100644
--- a/go/game/cardImplementations.go
+++ b/go/game/cardImplementations.go
@@ -189,7 +189,7 @@ func (*pikemanImpl) onETB(s *LocalState, p Permanent) {
type spearImpl struct{ cardImplementationBase }
func (*spearImpl) onPile(p Permanent) {
- // FIXME: add
+ // FIXME: support multiple flexAttacks
p.(*Unit).Attack.flexAttack = pikeAttack()
}
@@ -198,6 +198,40 @@ func (*spearImpl) onUnpile(p Permanent) {
p.(*Unit).Attack.flexAttack = nil
}
+type maceImpl struct {
+ cardImplementationBase
+ triggers map[Permanent]Trigger
+}
+
+func (i *maceImpl) onPile(p Permanent) {
+ s := p.Controller().gameState
+ t := newDamageDealtByTrigger(p, false, func(s *LocalState, e Event) ActionResolveFunc {
+ return func(*LocalState) {
+ for _, a := range e.affected {
+ if u, ok := a.(*Unit); ok {
+ u.adjustMarks(UnitStates.Paralysis, 1)
+ }
+ }
+ }
+ }, "afflict paralysis on damage")
+ s.addTrigger(t)
+ // Remember trigger
+ i.triggers[p] = t
+}
+
+func (i *maceImpl) onUnpile(p Permanent) {
+ s := p.Controller().gameState
+ s.removeTrigger(i.triggers[p])
+}
+
+type poisonDaggerImpl struct{ cardImplementationBase }
+
+func (*poisonDaggerImpl) onPile(p Permanent) {
+}
+
+func (*poisonDaggerImpl) onUnpile(p Permanent) {
+}
+
// ====== Magic Set ======
type attackImpl struct{ cardImplementationBase }
@@ -511,10 +545,12 @@ func (*drownedSailorImpl) onDrop(sailor Permanent) {
type flyingDutchmenImpl struct{ cardImplementationBase }
func (*flyingDutchmenImpl) onETB(s *LocalState, p Permanent) {
- s.addTrigger(newEnemyDeathTrigger(p, func(s *LocalState) {
- sailor := NewCard("kraken/drowned_sailor")
- if p.Tile().IsAvailableForCard(sailor) {
- addPermanentToPile(p, NewUnit(sailor, nil, p.Controller()))
+ s.addTrigger(newEnemyDeathTrigger(p, func(*LocalState, Event) ActionResolveFunc {
+ return func(s *LocalState) {
+ sailor := NewCard("kraken/drowned_sailor")
+ if p.Tile().IsAvailableForCard(sailor) {
+ addPermanentToPile(p, NewUnit(sailor, nil, p.Controller()))
+ }
}
}, p.Card().getEffects()[1]))
}
@@ -685,8 +721,10 @@ func (*illusionistImpl) fullActions(u *Unit) []*FullAction {
type illusionImpl struct{ cardImplementationBase }
func (*illusionImpl) onETB(s *LocalState, p Permanent) {
- s.addTrigger(newTargetedTrigger(p, true, func(s *LocalState) {
- s.destroyPermanent(p)
+ s.addTrigger(newTargetedTrigger(p, true, func(*LocalState, Event) ActionResolveFunc {
+ return func(s *LocalState) {
+ s.destroyPermanent(p)
+ }
}, p.Card().getEffects()[0]))
}
@@ -701,7 +739,9 @@ func init() {
"base/wormtongue": &wormtongueImpl{},
"base/pikeman": &pikemanImpl{},
- "equipment/spear": &spearImpl{},
+ "equipments/mace": &maceImpl{triggers: make(map[Permanent]Trigger)},
+ "equipments/poison_dagger": &poisonDaggerImpl{},
+ "equipments/spear": &spearImpl{},
"magic/attack!": &attackImpl{},
"magic/appear!": &appearImpl{},