aboutsummaryrefslogtreecommitdiff
path: root/go/game/cardImplementations.go
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2023-02-02 00:13:30 +0100
committerFlorian Fischer <florian.fischer@muhq.space>2025-08-20 15:46:38 +0200
commite8f44219976edf8cf57cbd9e964f66fe9d145a9c (patch)
tree8618f3b22d94ff443227d7ebbc84014e2a786fae /go/game/cardImplementations.go
parente64e268155c4398a82245626cf36bc39f3bea6a8 (diff)
downloadmuhqs-game-e8f44219976edf8cf57cbd9e964f66fe9d145a9c.tar.gz
muhqs-game-e8f44219976edf8cf57cbd9e964f66fe9d145a9c.zip
change unit attack representation and implement sword
Diffstat (limited to 'go/game/cardImplementations.go')
-rw-r--r--go/game/cardImplementations.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/go/game/cardImplementations.go b/go/game/cardImplementations.go
index 8024e4fc..b20b46bc 100644
--- a/go/game/cardImplementations.go
+++ b/go/game/cardImplementations.go
@@ -46,10 +46,27 @@ func (impl *missionaryImplementation) fullAction(u *Unit) []*FullAction {
return []*FullAction{NewFullAction(u, resolvePrototype, "put faith ...")}
}
+type swordImplementation struct {
+ cardImplementationBase
+}
+
+func (*swordImplementation) onPile(p Permanent) {
+ if u, ok := p.(*Unit); ok && !INVALID_ATTACK(u.Attack) {
+ u.Attack.attacks[0] += 1
+ }
+}
+
+func (*swordImplementation) onDrop(p Permanent) {
+ if u, ok := p.(*Unit); ok && !INVALID_ATTACK(u.Attack) {
+ u.Attack.attacks[0] -= 1
+ }
+}
+
func init() {
cardImplementations = map[string]cardImplementation{
"base/advisor": &advisorImplementation{},
"base/missionary": &missionaryImplementation{},
+ "base/sword": &swordImplementation{},
"misc/farmer": &farmerImplementation{},
}