Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix shield selection #295

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion game/cards/dm02/giant_insect.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ func XenoMantis(c *match.Card) {
c.ManaCost = 7
c.ManaRequirement = []string{civ.Nature}

c.Use(fx.Creature, fx.Doublebreaker, fx.CantBeBlockedByPowerUpTo5000)
c.Use(fx.Creature, fx.Doublebreaker, fx.When(fx.Attacking, fx.CantBeBlockedByPowerUpTo5000))

}
54 changes: 3 additions & 51 deletions game/cards/dm05/gel_fish.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,56 +70,8 @@ func LurkingEel(c *match.Card) {
c.ManaCost = 6
c.ManaRequirement = []string{civ.Water}

c.Use(func(card *match.Card, ctx *match.Context) {

if event, ok := ctx.Event.(*match.AttackPlayer); ok {

blockers := make([]*match.Card, 0)

attacker, err := ctx.Match.Opponent(c.Player).GetCard(event.CardID, match.BATTLEZONE)

if err != nil {
return
}

if attacker.Civ == civ.Fire || attacker.Civ == civ.Nature {
return
}

for _, b := range event.Blockers {
if b.ID != card.ID {
blockers = append(blockers, b)
}
}

event.Blockers = blockers

}

if event, ok := ctx.Event.(*match.AttackCreature); ok {

blockers := make([]*match.Card, 0)

attacker, err := ctx.Match.Opponent(c.Player).GetCard(event.CardID, match.BATTLEZONE)

if err != nil {
return
}

if attacker.Civ == civ.Fire || attacker.Civ == civ.Nature {
return
}

for _, b := range event.Blockers {
if b.ID != card.ID {
blockers = append(blockers, b)
}
}

event.Blockers = blockers

}

}, fx.Creature, fx.Blocker)
c.Use(fx.Creature, fx.ConditionalBlocker(func(target *match.Card) bool {
return target.Civ == civ.Fire || target.Civ == civ.Nature
}))

}
8 changes: 1 addition & 7 deletions game/cards/dm06/demon_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,7 @@ func DaidalosGeneralOfFury(c *match.Card) {
creatures := fx.Select(card.Player, ctx.Match, card.Player, match.BATTLEZONE, "Daidalos, General Of Fury: Select 1 creature from your battlezone that will be sent to your graveyard", 1, 1, false)

for _, creature := range creatures {
if creature.ID == card.ID {
ctx.Match.Destroy(creature, card, match.DestroyedByMiscAbility)
ctx.InterruptFlow()
}
if creature.ID != card.ID {
ctx.Match.Destroy(creature, card, match.DestroyedByMiscAbility)
}
ctx.Match.Destroy(creature, card, match.DestroyedByMiscAbility)
}

}))
Expand Down
6 changes: 5 additions & 1 deletion game/cards/dm07/cyber_virus.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ func CosmicNebula(c *match.Card) {
c.ManaCost = 5
c.ManaRequirement = []string{civ.Water}

c.Use(fx.Creature, fx.Evolution, fx.When(fx.MyDrawStep, fx.MayDraw1))
c.Use(fx.Creature, fx.Evolution, fx.When(fx.MyDrawStep, func(card *match.Card, ctx *match.Context) {
if card.Zone == match.BATTLEZONE {
fx.MayDraw1(card, ctx)
}
}))

}

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

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

// AmnisHolyElemental ...
func AmnisHolyElemental(c *match.Card) {

c.Name = "Amnis, Holy Elemental"
c.Power = 5000
c.Civ = civ.Light
c.Family = []string{family.AngelCommand}
c.ManaCost = 7
c.ManaRequirement = []string{civ.Light}

c.Use(fx.Creature,
fx.ConditionalBlocker(func(target *match.Card) bool {
return target.Civ == civ.Darkness
}),
func(card *match.Card, ctx *match.Context) {

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

if event.Context == match.DestroyedInBattle && event.Source.Civ == civ.Darkness {
ctx.InterruptFlow()
}

}

})

}
34 changes: 34 additions & 0 deletions game/cards/promo/armored_dragon.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package promo

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

// StarCryDragon ...
func StarCryDragon(c *match.Card) {

c.Name = "Star-Cry Dragon"
c.Power = 8000
c.Civ = civ.Fire
c.Family = []string{family.ArmoredDragon}
c.ManaCost = 7
c.ManaRequirement = []string{civ.Fire}

c.Use(fx.Creature, fx.Doublebreaker, func(card *match.Card, ctx *match.Context) {

if card.Zone != match.BATTLEZONE {
return
}

if event, ok := ctx.Event.(*match.GetPowerEvent); ok && event.Card.ID != card.ID {

if event.Card.HasFamily(family.ArmoredDragon) {
event.Power += 3000
}
}

})
}
36 changes: 36 additions & 0 deletions game/cards/promo/chimera.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package promo

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

// Gigagrax ...
func Gigagrax(c *match.Card) {

c.Name = "Gigagrax"
c.Power = 5000
c.Civ = civ.Darkness
c.Family = []string{family.Chimera}
c.ManaCost = 8
c.ManaRequirement = []string{civ.Darkness}

c.Use(fx.Creature, fx.When(fx.Destroyed, func(card *match.Card, ctx *match.Context) {

fx.Select(
card.Player,
ctx.Match,
ctx.Match.Opponent(card.Player),
match.BATTLEZONE,
"Destroy one of your opponent's creatures",
1,
1,
true).Map(func(x *match.Card) {
ctx.Match.Destroy(x, card, match.DestroyedByMiscAbility)
})

}))

}
57 changes: 57 additions & 0 deletions game/cards/promo/colony_beetle.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package promo

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

// BrigadeShellQ ...
func BrigadeShellQ(c *match.Card) {

c.Name = "Brigade Shell Q"
c.Power = 1000
c.Civ = civ.Nature
c.Family = []string{family.ColonyBeetle, family.Survivor}
c.ManaCost = 3
c.ManaRequirement = []string{civ.Nature}

c.Use(fx.Creature, fx.Survivor, func(card *match.Card, ctx *match.Context) {

if !ctx.Match.IsPlayerTurn(card.Player) || card.Zone != match.BATTLEZONE {
return
}

event, ok := ctx.Event.(*match.AttackConfirmed)

if !ok {
return
}

creature, err := card.Player.GetCard(event.CardID, match.BATTLEZONE)

if err != nil {
return
}

if creature.HasCondition(cnd.Survivor) {

topCard := card.Player.PeekDeck(1)

for _, c := range topCard {
if c.HasFamily(family.Survivor) {
fx.Draw1(card, ctx)
ctx.Match.ReportActionInChat(card.Player, fmt.Sprintf("%s drew %s when %s attacked due to %s's survivor ability", card.Player.Username(), c.Name, creature.Name, card.Name))
} else {
c.Player.MoveCard(c.ID, match.DECK, match.GRAVEYARD, card.ID)
ctx.Match.ReportActionInChat(card.Player, fmt.Sprintf("%s put %s in graveyard from their deck when %s attacked due to %s's survivor ability", card.Player.Username(), c.Name, creature.Name, card.Name))
}
}
}

})

}
50 changes: 50 additions & 0 deletions game/cards/promo/demon_command.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package promo

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

// OlgateNightmareSamurai ...
func OlgateNightmareSamurai(c *match.Card) {

c.Name = "Olgate, Nightmare Samurai"
c.Power = 6000
c.Civ = civ.Darkness
c.Family = []string{family.DemonCommand}
c.ManaCost = 7
c.ManaRequirement = []string{civ.Darkness}

c.Use(fx.Creature, fx.Doublebreaker, fx.When(fx.AnotherOwnCreatureDestroyed, fx.MayUntapSelf))

}

// GiliamTheTormentor ...
func GiliamTheTormentor(c *match.Card) {

c.Name = "Giliam, the Tormentor"
c.Power = 5000
c.Civ = civ.Darkness
c.Family = []string{family.DemonCommand}
c.ManaCost = 7
c.ManaRequirement = []string{civ.Darkness}

c.Use(fx.Creature,
fx.ConditionalBlocker(func(target *match.Card) bool {
return target.Civ == civ.Light
}),
func(card *match.Card, ctx *match.Context) {

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

if event.Context == match.DestroyedInBattle && event.Source.Civ == civ.Light {
ctx.InterruptFlow()
}

}

})

}
21 changes: 21 additions & 0 deletions game/cards/promo/gel_fish.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package promo

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

// TwisterFish ...
func TwisterFish(c *match.Card) {

c.Name = "Twister Fish"
c.Power = 3000
c.Civ = civ.Water
c.Family = []string{family.GelFish}
c.ManaCost = 5
c.ManaRequirement = []string{civ.Water}

c.Use(fx.Creature, fx.ShieldTrigger)
}
22 changes: 22 additions & 0 deletions game/cards/promo/guardian.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package promo

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

// LothRix ...
func LothRix(c *match.Card) {

c.Name = "Loth Rix, the Iridescent"
c.Power = 4000
c.Civ = civ.Light
c.Family = []string{family.Guardian}
c.ManaCost = 6
c.ManaRequirement = []string{civ.Light}

c.Use(fx.Creature, fx.Evolution, fx.When(fx.Summoned, fx.TopCardToShield))

}
Loading
Loading