From e855c6c6801798788fab30bd187fbfc523791f56 Mon Sep 17 00:00:00 2001 From: Sindre Slungaard Date: Wed, 10 Jun 2020 00:04:31 +0200 Subject: [PATCH] New card: Xeno Mantis --- game/cards/dm02/giant_insect.go | 68 +++++++++++++++++++++++++++++++++ game/cards/repository.go | 1 + 2 files changed, 69 insertions(+) create mode 100644 game/cards/dm02/giant_insect.go diff --git a/game/cards/dm02/giant_insect.go b/game/cards/dm02/giant_insect.go new file mode 100644 index 00000000..25354782 --- /dev/null +++ b/game/cards/dm02/giant_insect.go @@ -0,0 +1,68 @@ +package dm02 + +import ( + "duel-masters/game/civ" + "duel-masters/game/family" + "duel-masters/game/fx" + "duel-masters/game/match" +) + +// XenoMantis ... +func XenoMantis(c *match.Card) { + + c.Name = "Xeno Mantis" + c.Power = 6000 + c.Civ = civ.Nature + c.Family = family.GiantInsect + c.ManaCost = 7 + c.ManaRequirement = []string{civ.Nature} + + c.Use(func(card *match.Card, ctx *match.Context) { + + if event, ok := ctx.Event.(*match.AttackPlayer); ok { + + if event.CardID != card.ID { + return + } + + ctx.ScheduleAfter(func() { + + blockers := make([]*match.Card, 0) + + for _, blocker := range event.Blockers { + if blocker.Power > 5000 { + blockers = append(blockers, blocker) + } + } + + event.Blockers = blockers + + }) + + } + + if event, ok := ctx.Event.(*match.AttackCreature); ok { + + if event.CardID != card.ID { + return + } + + ctx.ScheduleAfter(func() { + + blockers := make([]*match.Card, 0) + + for _, blocker := range event.Blockers { + if blocker.Power > 5000 { + blockers = append(blockers, blocker) + } + } + + event.Blockers = blockers + + }) + + } + + }, fx.Creature, fx.Doublebreaker) + +} diff --git a/game/cards/repository.go b/game/cards/repository.go index b2b3f5a4..fdd47f32 100644 --- a/game/cards/repository.go +++ b/game/cards/repository.go @@ -173,4 +173,5 @@ var DM02 = map[string]match.CardConstructor{ "99791f19-21ee-4ee3-a6b0-e26702c2a380": dm02.CriticalBlade, "5781986a-4ca8-48e1-a5a1-95e820455bce": dm02.HypersquidWalter, "6406411f-e9ae-4b55-8213-7e18c4cd9aee": dm02.StainedGlass, + "9275747d-f2bb-4298-9b70-7075b17d1e0d": dm02.XenoMantis, }