From 03a95d04cd1d14e8f3f8927be3555ae49c8f57c6 Mon Sep 17 00:00:00 2001 From: Sloth Date: Thu, 18 Oct 2012 15:51:58 +0000 Subject: [PATCH] - Added Glittering Lynx and Glittering Lion. --- .gitattributes | 2 ++ res/cardsfolder/g/glittering_lion.txt | 12 +++++++++ res/cardsfolder/g/glittering_lynx.txt | 12 +++++++++ .../abilityfactory/AbilityFactoryDebuff.java | 25 ++++++++++++++++--- 4 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 res/cardsfolder/g/glittering_lion.txt create mode 100644 res/cardsfolder/g/glittering_lynx.txt diff --git a/.gitattributes b/.gitattributes index eed9c3d47e9..5e2e7e62273 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3899,6 +3899,8 @@ res/cardsfolder/g/glissas_scorn.txt svneol=native#text/plain res/cardsfolder/g/glistener_elf.txt svneol=native#text/plain res/cardsfolder/g/glistening_oil.txt svneol=native#text/plain res/cardsfolder/g/glitterfang.txt svneol=native#text/plain +res/cardsfolder/g/glittering_lion.txt -text +res/cardsfolder/g/glittering_lynx.txt -text res/cardsfolder/g/global_ruin.txt svneol=native#text/plain res/cardsfolder/g/gloom.txt svneol=native#text/plain res/cardsfolder/g/gloom_surgeon.txt -text diff --git a/res/cardsfolder/g/glittering_lion.txt b/res/cardsfolder/g/glittering_lion.txt new file mode 100644 index 00000000000..f380487cef6 --- /dev/null +++ b/res/cardsfolder/g/glittering_lion.txt @@ -0,0 +1,12 @@ +Name:Glittering Lion +ManaCost:2 W +Types:Creature Cat +Text:no text +PT:2/2 +K:Prevent all damage that would be dealt to CARDNAME. +A:AB$ Debuff | Cost$ 3 | Defined$ Self | Keywords$ Prevent all damage that would be dealt to CARDNAME. | AnyPlayer$ True | SpellDescription$ Until end of turn, CARDNAME loses "Prevent all damage that would be dealt to CARDNAME." Any player may activate this ability. +SVar:Rarity:Uncommon +SVar:Picture:http://www.wizards.com/global/images/magic/general/glittering_lion.jpg +SetInfo:PCY|Uncommon|http://magiccards.info/scans/en/pr/9.jpg +Oracle:Prevent all damage that would be dealt to Glittering Lion.\n{3}: Until end of turn, Glittering Lion loses "Prevent all damage that would be dealt to Glittering Lion." Any player may activate this ability. +End \ No newline at end of file diff --git a/res/cardsfolder/g/glittering_lynx.txt b/res/cardsfolder/g/glittering_lynx.txt new file mode 100644 index 00000000000..3ce5a5cebb8 --- /dev/null +++ b/res/cardsfolder/g/glittering_lynx.txt @@ -0,0 +1,12 @@ +Name:Glittering Lynx +ManaCost:W +Types:Creature Cat +Text:no text +PT:1/1 +K:Prevent all damage that would be dealt to CARDNAME. +A:AB$ Debuff | Cost$ 2 | Defined$ Self | Keywords$ Prevent all damage that would be dealt to CARDNAME. | AnyPlayer$ True | SpellDescription$ Until end of turn, CARDNAME loses "Prevent all damage that would be dealt to CARDNAME." Any player may activate this ability. +SVar:Rarity:Common +SVar:Picture:http://www.wizards.com/global/images/magic/general/glittering_lynx.jpg +SetInfo:PCY|Common|http://magiccards.info/scans/en/pr/10.jpg +Oracle:Prevent all damage that would be dealt to Glittering Lynx.\n{2}: Until end of turn, Glittering Lion loses "Prevent all damage that would be dealt to Glittering Lynx." Any player may activate this ability. +End \ No newline at end of file diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryDebuff.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryDebuff.java index d22696755c0..a5166f169b0 100644 --- a/src/main/java/forge/card/abilityfactory/AbilityFactoryDebuff.java +++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryDebuff.java @@ -42,6 +42,7 @@ import forge.card.spellability.SpellAbilityRestriction; import forge.card.spellability.Target; import forge.game.GameState; import forge.game.phase.CombatUtil; +import forge.game.phase.PhaseHandler; import forge.game.phase.PhaseType; import forge.game.player.ComputerUtil; import forge.game.player.Player; @@ -317,9 +318,12 @@ public final class AbilityFactoryDebuff { final HashMap params = af.getMapParams(); final SpellAbilityRestriction restrict = sa.getRestrictions(); + final PhaseHandler ph = Singletons.getModel().getGameState().getPhaseHandler(); // Phase Restrictions - if ((Singletons.getModel().getGameState().getStack().size() == 0) && Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_BEGIN)) { + if (ph.getPhase().isBefore(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY) + || ph.getPhase().isAfter(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY) + || !Singletons.getModel().getGameState().getStack().isEmpty()) { // Instant-speed pumps should not be cast outside of combat when the // stack is empty if (!AbilityFactory.isSorcerySpeed(sa)) { @@ -335,15 +339,28 @@ public final class AbilityFactoryDebuff { } if ((sa.getTarget() == null) || !sa.getTarget().doesTarget()) { - final ArrayList cards = AbilityFactory.getDefinedCards(sa.getSourceCard(), params.get("Defined"), sa); - if (cards.size() == 0) { + List cards = AbilityFactory.getDefinedCards(sa.getSourceCard(), params.get("Defined"), sa); + + if (!cards.isEmpty()) { + cards = CardLists.filter(cards, new Predicate() { + @Override + public boolean apply(final Card c) { + if (!c.isBlocking() && !c.isAttacking()) { + return false; + } + // don't add duplicate negative keywords + return c.hasAnyKeyword(AbilityFactoryDebuff.getKeywords(params)); + } + }); + } + if (cards.isEmpty()) { return false; } } else { return AbilityFactoryDebuff.debuffTgtAI(ai, af, sa, AbilityFactoryDebuff.getKeywords(params), false); } - return false; + return true; } /**