diff options
Diffstat (limited to 'go/game/cardImplementations.go')
| -rw-r--r-- | go/game/cardImplementations.go | 56 |
1 files changed, 36 insertions, 20 deletions
diff --git a/go/game/cardImplementations.go b/go/game/cardImplementations.go index 63c97ca7..3a7a729a 100644 --- a/go/game/cardImplementations.go +++ b/go/game/cardImplementations.go @@ -4,6 +4,14 @@ import ( "log" ) +func adjustMelee(p Permanent, damage int) { + if u, ok := p.(*Unit); ok && !INVALID_ATTACK(u.Attack) { + u.Attack.attacks[0] += damage + } +} + +// ====== Base Set ====== + type advisorImpl struct{ cardImplementationBase } func (*advisorImpl) fullActions(u *Unit) []*FullAction { @@ -39,18 +47,22 @@ func (*missionaryImpl) fullActions(u *Unit) []*FullAction { type swordImpl struct{ cardImplementationBase } -func (*swordImpl) onPile(p Permanent) { - if u, ok := p.(*Unit); ok && !INVALID_ATTACK(u.Attack) { - u.Attack.attacks[0] += 1 - } -} +func (*swordImpl) onPile(p Permanent) { adjustMelee(p, 1) } +func (*swordImpl) onUnpile(p Permanent) { adjustMelee(p, -1) } -func (*swordImpl) onUnpile(p Permanent) { - if u, ok := p.(*Unit); ok && !INVALID_ATTACK(u.Attack) { - u.Attack.attacks[0] -= 1 - } +type greatSwordImpl struct{ cardImplementationBase } + +func (*greatSwordImpl) onPile(p Permanent) { adjustMelee(p, 2) } +func (*greatSwordImpl) onUnpile(p Permanent) { adjustMelee(p, -2) } + +type misinformationImpl struct{ cardImplementation } + +func (*misinformationImpl) onPlay(s *State, c *Card, _ *Player, _ *Targets) { + s.Exile.AddCard(c) } +// ====== Nautics Set ====== + type fishTrapAoE struct{} func (*fishTrapAoE) onEntering(p Permanent) { @@ -147,15 +159,17 @@ func (*sailorImpl) onUnpile(containing Permanent) { } } +// ====== Kraken Set ====== + type tidesChangeImpl struct{ cardImplementation } -func (*tidesChangeImpl) onPlay(s *State, _ *Player, _ *Targets) { +func (*tidesChangeImpl) onPlay(s *State, _ *Card, _ *Player, _ *Targets) { s.Map.redistributeStoreCards(s.Rand) } type dejaVuImpl struct{ cardImplementation } -func (*dejaVuImpl) onPlay(s *State, _ *Player, _ *Targets) { +func (*dejaVuImpl) onPlay(s *State, _ *Card, _ *Player, _ *Targets) { for _, p := range s.Players { if !p.IsKraken() { p.Resource = s.Map.ResourceGain @@ -165,7 +179,7 @@ func (*dejaVuImpl) onPlay(s *State, _ *Player, _ *Targets) { type devourThePoorImpl struct{ cardImplementation } -func (*devourThePoorImpl) onPlay(s *State, kraken *Player, _ *Targets) { +func (*devourThePoorImpl) onPlay(s *State, _ *Card, kraken *Player, _ *Targets) { for _, u := range s.EnemyUnits(kraken) { if u.Card().BuyCost < 7 { s.DestroyPermanent(u) @@ -233,7 +247,7 @@ func (i *frostPylonImpl) onLeaving(t *Tile) { type giganticHailImpl struct{ cardImplementation } -func (*giganticHailImpl) onPlay(s *State, kraken *Player, _ *Targets) { +func (*giganticHailImpl) onPlay(s *State, _ *Card, kraken *Player, _ *Targets) { emptyTiles := s.Map.FreeTiles() choices := len(emptyTiles) for i := 0; i < 3; i++ { @@ -250,7 +264,7 @@ func (*giganticHailImpl) onPlay(s *State, kraken *Player, _ *Targets) { type soldOutImpl struct{ cardImplementation } -func (*soldOutImpl) onPlay(s *State, kraken *Player, _ *Targets) { +func (*soldOutImpl) onPlay(s *State, _ *Card, kraken *Player, _ *Targets) { nStores := len(s.Map.Stores) storePositions := make([]Position, 0, nStores) for pos := range s.Map.Stores { @@ -266,13 +280,13 @@ func (*soldOutImpl) onPlay(s *State, kraken *Player, _ *Targets) { type supriseImpl struct{ cardImplementation } -func (*supriseImpl) onPlay(s *State, kraken *Player, _ *Targets) { +func (*supriseImpl) onPlay(s *State, _ *Card, kraken *Player, _ *Targets) { kraken.Ctrl.(*KrakenControl).activeSuprise = true } type tentacleSlapImpl struct{ cardImplementation } -func (*tentacleSlapImpl) onPlay(s *State, kraken *Player, _ *Targets) { +func (*tentacleSlapImpl) onPlay(s *State, _ *Card, kraken *Player, _ *Targets) { x := 0 for _, p := range s.Players { if p.IsKraken() { @@ -291,7 +305,7 @@ func (*tentacleSlapImpl) onPlay(s *State, kraken *Player, _ *Targets) { type unholyCannonballImpl struct{ cardImplementation } -func (*unholyCannonballImpl) onPlay(s *State, kraken *Player, _ *Targets) { +func (*unholyCannonballImpl) onPlay(s *State, _ *Card, kraken *Player, _ *Targets) { krakenTiles := s.Map.FilterTiles(func(t *Tile) bool { return t.Raw == "the kraken" }) if len(krakenTiles) != 1 { log.Fatal("No kraken tile found in Map") @@ -320,9 +334,11 @@ func (*unholyCannonballImpl) onPlay(s *State, kraken *Player, _ *Targets) { func init() { cardImplementations = map[string]cardImplementation{ - "base/advisor": &advisorImpl{}, - "base/missionary": &missionaryImpl{}, - "base/sword": &swordImpl{}, + "base/advisor": &advisorImpl{}, + "base/missionary": &missionaryImpl{}, + "base/sword": &swordImpl{}, + "base/greatsword": &greatSwordImpl{}, + "base/misinformation": &misinformationImpl{}, "nautics/captain": &captainImpl{}, "nautics/fish_trap": &fishTrapImpl{}, |
