Skip to content

Commit

Permalink
Use Safeguard effect for EX-era implementations (#1012)
Browse files Browse the repository at this point in the history
* Use Safeguard effect for EX-era implementations

The safeguard static is for BW-era EXs. The Safeguard effect already
    exists for EX-era exs, so we can use it for the relevant cards. I'm not
    sure if the existing pokeBody closure should be removed?

* Remove existing pokeBody closures for EX-era Safeguard mons
  • Loading branch information
flagrama authored Nov 26, 2020
1 parent f64e134 commit c94913e
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 108 deletions.
23 changes: 4 additions & 19 deletions src/tcgwars/logic/impl/gen3/CrystalGuardians.groovy
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package tcgwars.logic.impl.gen3

import tcgwars.logic.effect.ability.custom.Safeguard
import tcgwars.logic.impl.gen3.Deoxys;
import tcgwars.logic.impl.gen3.Emerald;
import tcgwars.logic.impl.gen3.FireRedLeafGreen;
Expand Down Expand Up @@ -203,25 +204,9 @@ public enum CrystalGuardians implements LogicCardInfo {
return evolution (this, from:"Shuppet", hp:HP070, type:P, retreatCost:1) {
weakness D
resistance F, MINUS30
pokeBody "Safeguard", {
text "Prevent all effects of attacks, including damage, done to Banette by your opponent's Pokémon-ex."
delayedA {
before null, self, Source.ATTACK, {
if (self.owner.opposite.pbg.active.EX && bg.currentTurn==self.owner.opposite && ef.effectType != DAMAGE) {
bc "Safeguard prevents effect"
prevent()
}
}
before APPLY_ATTACK_DAMAGES, {
bg.dm().each {
if(it.to == self && it.notNoEffect && it.from.EX ) {
it.dmg = hp(0)
bc "Safeguard prevents damage"
}
}
}
}
}

// TODO: Replace with a static for Pokémon-ex and/or change static safeguard so it's configurable.
thisCard.addAbility new Safeguard("Prevent all effects of attacks, including damage, done to Banette by your opponents Pokémon-ex.")
move "Night Murmurs", {
text "30 damage. If the Defending Pokémon is a Basic Pokémon, that Pokémon is now Confused."
energyCost P, C
Expand Down
27 changes: 6 additions & 21 deletions src/tcgwars/logic/impl/gen3/Deoxys.groovy
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
package tcgwars.logic.impl.gen3;
package tcgwars.logic.impl.gen3

import tcgwars.logic.effect.ability.custom.Safeguard;

import static tcgwars.logic.card.HP.*;
import static tcgwars.logic.card.Type.*;
Expand Down Expand Up @@ -191,26 +193,9 @@ public enum Deoxys implements LogicCardInfo {
return evolution (this, from:"Swablu", hp:HP070, type:COLORLESS, retreatCost:1) {
weakness LIGHTNING
resistance FIGHTING, MINUS30
pokeBody "Safeguard", {
text "Prevent all effects of attacks, including damage, done to Altaria by your opponent’s Pokémon-ex."
//TODO: Change static safeguard so it's configurable.
delayedA {
before null, self, Source.ATTACK, {
if (self.owner.opposite.pbg.active.EX && bg.currentTurn==self.owner.opposite && ef.effectType != DAMAGE) {
bc "Safeguard prevents effect"
prevent()
}
}
before APPLY_ATTACK_DAMAGES, {
bg.dm().each {
if(it.to == self && it.notNoEffect && it.from.EX ) {
it.dmg = hp(0)
bc "Safeguard prevents damage"
}
}
}
}
}

// TODO: Replace with a static for Pokémon-ex and/or change static safeguard so it's configurable.
thisCard.addAbility new Safeguard("Prevent all effects of attacks, including damage, done to Altaria by your opponents Pokémon-ex.")
move "Double Wing Attack", {
text "Does 20 Damage to each Defending Pokémon."
energyCost L
Expand Down
10 changes: 5 additions & 5 deletions src/tcgwars/logic/impl/gen3/FireRedLeafGreen.groovy
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package tcgwars.logic.impl.gen3;
package tcgwars.logic.impl.gen3

import tcgwars.logic.effect.ability.custom.Safeguard;
import tcgwars.logic.impl.gen2.Expedition;

import tcgwars.logic.effect.gm.Attack
Expand Down Expand Up @@ -259,10 +260,9 @@ public enum FireRedLeafGreen implements LogicCardInfo {
case DEWGONG_3:
return evolution (this, from:"Seel", hp:HP080, type:WATER, retreatCost:2) {
weakness METAL
pokeBody "Safeguard", {
text "Prevent all effects of attacks, including damage, done to Dewgong by your opponent’s Pokémon-ex."
safeguard(self,delegate)
}

// TODO: Replace with a static for Pokémon-ex and/or change static safeguard so it's configurable.
thisCard.addAbility new Safeguard("Prevent all effects of attacks, including damage, done to Dewgong by your opponents Pokémon-ex.")
move "Cold Breath", {
text "10 damage. The Defending Pokémon is now Asleep."
energyCost W
Expand Down
25 changes: 5 additions & 20 deletions src/tcgwars/logic/impl/gen3/LegendMaker.groovy
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package tcgwars.logic.impl.gen3;
package tcgwars.logic.impl.gen3

import tcgwars.logic.effect.ability.custom.Safeguard;
import tcgwars.logic.impl.gen1.FossilNG;
import tcgwars.logic.impl.gen6.Xy;
import tcgwars.logic.impl.gen7.CelestialStorm;
Expand Down Expand Up @@ -2615,25 +2616,9 @@ public enum LegendMaker implements LogicCardInfo {
return evolution (this, from:"Cascoon", hp:HP140, type:G, retreatCost:1) {
weakness R
weakness P
pokeBody "Safeguard", {
text "Prevent all effects of attacks, including damage, done to Dustox ex by your opponent's Pokémon-ex."
delayedA {
before null, self, Source.ATTACK, {
if (self.owner.opposite.pbg.active.EX && bg.currentTurn==self.owner.opposite && ef.effectType != DAMAGE) {
bc "Safeguard prevents effect"
prevent()
}
}
before APPLY_ATTACK_DAMAGES, {
bg.dm().each {
if(it.to == self && it.from.EX && it.notNoEffect && it.dmg.value ) {
it.dmg = hp(0)
bc "Safeguard prevents damage"
}
}
}
}
}

// TODO: Replace with a static for Pokémon-ex and/or change static safeguard so it's configurable.
thisCard.addAbility new Safeguard("Prevent all effects of attacks, including damage, done to Dustox by your opponents Pokémon-ex.")
move "Silver Wind", {
text "40 damage. During your next turn, if an attack does damage to the Defending Pokémon (after applying Weakness and Resistance), that attack does 30 more damage."
energyCost G, C
Expand Down
51 changes: 8 additions & 43 deletions src/tcgwars/logic/impl/gen3/PowerKeepers.groovy
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package tcgwars.logic.impl.gen3;
package tcgwars.logic.impl.gen3

import tcgwars.logic.effect.ability.custom.Safeguard;
import tcgwars.logic.impl.gen1.FossilNG;
import tcgwars.logic.impl.gen2.Expedition;
import tcgwars.logic.impl.gen2.Aquapolis;
Expand Down Expand Up @@ -722,27 +723,9 @@ public enum PowerKeepers implements LogicCardInfo {
case NINETALES_19:
return evolution (this, from:"Vulpix", hp:HP070, type:R, retreatCost:1) {
weakness W
pokeBody "Safeguard", {
text "Prevent all effects of attacks, including damage, done to Ninetales by your opponent's Pokémon-ex."
delayedA {
before null, self, Source.ATTACK, {
if (self.owner.opposite.pbg.active.EX && bg.currentTurn==self.owner.opposite && ef.effectType != DAMAGE) {
bc "Safeguard prevents effect"
prevent()
}
}
before APPLY_ATTACK_DAMAGES, {
if (ef.attacker.owner != self.owner && ef.attacker.EX) {
bg.dm().each {
if(it.to == self && it.notNoEffect && it.dmg.value) {
it.dmg = hp(0)
bc "Safeguard prevents damage"
}
}
}
}
}
}

// TODO: Replace with a static for Pokémon-ex and/or change static safeguard so it's configurable.
thisCard.addAbility new Safeguard("Prevent all effects of attacks, including damage, done to Ninetales by your opponents Pokémon-ex.")
move "Quick Attack", {
text "20+ damage. Flip a coin. If heads, this attack does 20 damage plus 20 more damage."
energyCost C, C
Expand Down Expand Up @@ -873,27 +856,9 @@ public enum PowerKeepers implements LogicCardInfo {
case WOBBUFFET_24:
return basic (this, hp:HP080, type:P, retreatCost:2) {
weakness P
pokeBody "Safeguard", {
text "Prevent all effects of attacks, including damage, done to Wobbuffet by your opponent's Pokémon-ex."
delayedA {
before null, self, Source.ATTACK, {
if (self.owner.opposite.pbg.active.EX && bg.currentTurn==self.owner.opposite && ef.effectType != DAMAGE) {
bc "Safeguard prevents effect"
prevent()
}
}
before APPLY_ATTACK_DAMAGES, {
if (ef.attacker.EX) {
bg.dm().each {
if(it.to == self && it.dmg.value && it.notNoEffect) {
it.dmg = hp(0)
bc "Safeguard prevents damage"
}
}
}
}
}
}

// TODO: Replace with a static for Pokémon-ex and/or change static safeguard so it's configurable.
thisCard.addAbility new Safeguard("Prevent all effects of attacks, including damage, done to Wobbuffet by your opponents Pokémon-ex.")
move "Flip Over", {
text "50 damage. Wobbuffet does 10 damage to itself, and don't apply Weakness and Resistance to this damage."
energyCost P, C, C
Expand Down

0 comments on commit c94913e

Please sign in to comment.