aboutsummaryrefslogtreecommitdiff
path: root/go/game/cardImplementations.go
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2023-02-15 15:49:50 +0100
committerFlorian Fischer <florian.fischer@muhq.space>2025-08-20 15:50:10 +0200
commitb810c024c301fdbe3d0833422bd18449d66d276a (patch)
tree9fe207e1dc0c74c8670a9a86d9bda0eb88ed6b07 /go/game/cardImplementations.go
parent259b2f2b2af8f23bc2fe193838e7f7ecfc61c23a (diff)
downloadmuhqs-game-b810c024c301fdbe3d0833422bd18449d66d276a.tar.gz
muhqs-game-b810c024c301fdbe3d0833422bd18449d66d276a.zip
implement the basics of the rest of the base cards
* Add more TODOs * Implement permanents granting more spawn tiles
Diffstat (limited to 'go/game/cardImplementations.go')
-rw-r--r--go/game/cardImplementations.go102
1 files changed, 102 insertions, 0 deletions
diff --git a/go/game/cardImplementations.go b/go/game/cardImplementations.go
index 038ce2d6..32208f09 100644
--- a/go/game/cardImplementations.go
+++ b/go/game/cardImplementations.go
@@ -10,6 +10,12 @@ func adjustMelee(p Permanent, damage int) {
}
}
+func adjustHealth(p Permanent, delta int) {
+ if u, ok := p.(*Unit); ok {
+ u.Health += delta
+ }
+}
+
// ====== Base Set ======
type advisorImpl struct{ cardImplementationBase }
@@ -64,6 +70,96 @@ func (*misinformationImpl) onPlay(s *State, c *Card, _ *Player, _ *Targets) {
s.Exile.AddCard(c)
}
+type pioneerImpl struct{ cardImplementationBase }
+
+func (*pioneerImpl) fullActions(u *Unit) []*FullAction {
+ resolvePrototype := func(a Action) ActionResolveFunc {
+ return func(s *State) {
+ target := a.Target().sel[0]
+ if artifact, ok := target.(*Artifact); ok {
+ s.DestroyPermanent(artifact)
+ } else {
+ tile := target.(*Tile)
+ tile.neutralize()
+ }
+ }
+ }
+
+ s := u.Controller().gameState
+ a := NewFullAction(u, resolvePrototype, "neutralize tile or artifact")
+ // TODO: add target disjunktion 'or'
+ a.targets = newTargets(newTarget(s, newTargetDesc("adjacent tile or artifcat"), a))
+ return []*FullAction{a}
+}
+
+type recruiterImpl struct{ cardImplementationBase }
+
+func (*recruiterImpl) fullActions(u *Unit) []*FullAction {
+ resolvePrototype := func(a Action) ActionResolveFunc {
+ u := a.Source().(*Unit)
+ return func(s *State) {
+ t := a.Target().sel[0].(*Tile)
+ s.AddNewUnit(NewCard("base/recruit"), t.Position, u.Controller())
+ }
+ }
+
+ s := u.Controller().gameState
+ a := NewFullAction(u, resolvePrototype, "create recruit")
+ a.targets = newTargets(newTarget(s, newTargetDesc("adjacent tile"), a))
+ return []*FullAction{a}
+}
+
+func (*recruiterImpl) additionalSpawnsFor(p Permanent, ct CardType) []*Tile {
+ if ct != CardTypes.Unit {
+ return nil
+ }
+
+ s := p.Controller().gameState
+ return TilesInRange(s.Map, p, 1)
+}
+
+type shieldImpl struct{ cardImplementationBase }
+
+func (*shieldImpl) onPile(p Permanent) { adjustHealth(p, 1) }
+func (*shieldImpl) onUnpile(p Permanent) { adjustHealth(p, -1) }
+
+type taxCollectorImpl struct{ cardImplementationBase }
+
+func (*taxCollectorImpl) fullActions(u *Unit) []*FullAction {
+ resolvePrototype := func(a Action) ActionResolveFunc {
+ u := a.Source().(*Unit)
+ return func(s *State) {
+ controller := u.Controller()
+ controller.gainResource(2)
+ }
+ }
+
+ a := NewFullAction(u, resolvePrototype, "gain 2")
+ return []*FullAction{a}
+}
+
+type towerShieldImpl struct{ cardImplementationBase }
+
+func (*towerShieldImpl) onPile(p Permanent) { adjustHealth(p, 2) }
+func (*towerShieldImpl) onUnpile(p Permanent) { adjustHealth(p, -2) }
+
+type wormtongueImpl struct{ cardImplementationBase }
+
+func (*wormtongueImpl) fullActions(u *Unit) []*FullAction {
+ resolvePrototype := func(a Action) ActionResolveFunc {
+ return func(s *State) {
+ t := a.Target().sel[0].(*Player)
+ t.DiscardPile.AddCard(NewCard("base/misinformation"))
+ }
+ }
+
+ s := u.Controller().gameState
+ a := NewFullAction(u, resolvePrototype, "misinform")
+ // TODO: implement player targeting
+ a.targets = newTargets(newTarget(s, newTargetDesc("opponent"), a))
+ return []*FullAction{a}
+}
+
// ====== Nautics Set ======
var fishTrapAoE areaEffect = newGrantFullActionEffect("nautics/fisher",
@@ -316,6 +412,12 @@ func init() {
"base/sword": &swordImpl{},
"base/greatsword": &greatSwordImpl{},
"base/misinformation": &misinformationImpl{},
+ "base/pioneer": &pioneerImpl{},
+ "base/recruiter": &recruiterImpl{},
+ "base/shield": &shieldImpl{},
+ "base/tax_collector": &taxCollectorImpl{},
+ "base/tower_shield": &towerShieldImpl{},
+ "base/wormtongue": &wormtongueImpl{},
"nautics/captain": &captainImpl{},
"nautics/fish_trap": &fishTrapImpl{aoe: fishTrapAoE},