Skip to content

Commit

Permalink
Merge pull request #271 from DanieloV/add-AquaAgent-dm07
Browse files Browse the repository at this point in the history
Add aqua agent dm07
  • Loading branch information
sindreslungaard authored Sep 29, 2024
2 parents c2d3b56 + d868ca3 commit 751205c
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 17 deletions.
2 changes: 1 addition & 1 deletion game/cards/dm01/light_bringer.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func ChiliasTheOracle(c *match.Card) {
c.ManaCost = 4
c.ManaRequirement = []string{civ.Light}

c.Use(fx.Creature, fx.ReturnToHand)
c.Use(fx.Creature, fx.When(fx.WouldBeDestroyed, fx.ReturnToHand))

}

Expand Down
4 changes: 2 additions & 2 deletions game/cards/dm01/liquid_people.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func AquaKnight(c *match.Card) {
c.ManaCost = 5
c.ManaRequirement = []string{civ.Water}

c.Use(fx.Creature, fx.ReturnToHand)
c.Use(fx.Creature, fx.When(fx.WouldBeDestroyed, fx.ReturnToHand))

}

Expand Down Expand Up @@ -121,7 +121,7 @@ func AquaSoldier(c *match.Card) {
c.ManaCost = 3
c.ManaRequirement = []string{civ.Water}

c.Use(fx.Creature, fx.ReturnToHand)
c.Use(fx.Creature, fx.When(fx.WouldBeDestroyed, fx.ReturnToHand))

}

Expand Down
2 changes: 1 addition & 1 deletion game/cards/dm06/liquid_people.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func CrystalJouster(c *match.Card) {
c.ManaCost = 7
c.ManaRequirement = []string{civ.Water}

c.Use(fx.Creature, fx.Evolution, fx.Doublebreaker, fx.ReturnToHand)
c.Use(fx.Creature, fx.Evolution, fx.Doublebreaker, fx.When(fx.WouldBeDestroyed, fx.ReturnToHand))

}

Expand Down
20 changes: 20 additions & 0 deletions game/cards/dm07/liquid_people.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package dm07

import (
"duel-masters/game/civ"
"duel-masters/game/family"
"duel-masters/game/fx"
"duel-masters/game/match"
)

func AquaAgent(c *match.Card) {

c.Name = "Aqua Agent"
c.Power = 2000
c.Civ = civ.Water
c.Family = []string{family.LiquidPeople}
c.ManaCost = 6
c.ManaRequirement = []string{civ.Water}

c.Use(fx.Creature, fx.WaterStealth, fx.When(fx.WouldBeDestroyed, fx.MayReturnToHand))
}
2 changes: 1 addition & 1 deletion game/cards/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ var DM07 = map[string]match.CardConstructor{
"ae65d4d1-78aa-4711-ba49-eafd98b358e9": dm07.RodiGaleNightGuardian,
"7148214f-dc9c-4fb4-835c-cd6064e247df": nil,
"e5bb03ac-0f09-44de-8fbe-b0c7f2748e84": nil,
"0d273a22-1cf9-4f99-8321-e2282e855b57": nil,
"0d273a22-1cf9-4f99-8321-e2282e855b57": dm07.AquaAgent,
"7e4cdeee-0b47-4260-8ba8-3f1cf0b9ab36": nil,
"0735c257-6554-4aeb-9aca-f3bed4022752": nil,
"5ce98713-900d-4291-8dc4-889de1d68461": nil,
Expand Down
13 changes: 13 additions & 0 deletions game/fx/quality_of_life.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,19 @@ func AttackingCreature(card *match.Card, ctx *match.Context) bool {

}

// WouldBeDestroyed returns true if the card is about to be destroyed
func WouldBeDestroyed(card *match.Card, ctx *match.Context) bool {

if event, ok := ctx.Event.(*match.CreatureDestroyed); ok {
if event.Card == card {
return true
}
}

return false

}

// Destroyed returns true if the card was destroyed
func Destroyed(card *match.Card, ctx *match.Context) bool {

Expand Down
19 changes: 7 additions & 12 deletions game/fx/return_to.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,16 @@ import (

// ReturnToHand returns the card to the players hand instead of the graveyard
func ReturnToHand(card *match.Card, ctx *match.Context) {
ctx.InterruptFlow()

// When destroyed
if event, ok := ctx.Event.(*match.CreatureDestroyed); ok {

if event.Card == card {

ctx.InterruptFlow()

card.Player.MoveCard(card.ID, match.BATTLEZONE, match.HAND, card.ID)
ctx.Match.ReportActionInChat(card.Player, fmt.Sprintf("%s was destroyed by %s and returned to the hand", event.Card.Name, event.Source.Name))

}
card.Player.MoveCard(card.ID, match.BATTLEZONE, match.HAND, card.ID)
ctx.Match.ReportActionInChat(card.Player, fmt.Sprintf("%s was returned to the hand", card.Name))
}

func MayReturnToHand(card *match.Card, ctx *match.Context) {
if BinaryQuestion(card.Player, ctx.Match, fmt.Sprintf("%s was destroyed. Do you want to return it to hand", card.Name)) {
ReturnToHand(card, ctx)
}

}

// ReturnToMana returns the card to the players manazone instead of the graveyard
Expand Down

0 comments on commit 751205c

Please sign in to comment.