From 29a8595752c30049b9a110b57a89ac7f61b054b5 Mon Sep 17 00:00:00 2001 From: Sloth Date: Sun, 19 Oct 2014 20:37:04 +0000 Subject: [PATCH] - Removed the Effect type DebuffAll. The 5 cards that used it were converted to AnimateAll. --- .gitattributes | 2 - .../src/main/java/forge/ai/SpellApiToAi.java | 1 - .../java/forge/ai/ability/DebuffAllAi.java | 64 -------------- .../main/java/forge/game/ability/ApiType.java | 1 - .../ability/effects/AnimateAllEffect.java | 7 +- .../game/ability/effects/DebuffAllEffect.java | 83 ------------------- forge-gui/res/cardsfolder/b/blind_fury.txt | 2 +- .../res/cardsfolder/i/invert_the_skies.txt | 2 +- .../cardsfolder/t/thundercloud_elemental.txt | 2 +- forge-gui/res/cardsfolder/w/whiteout.txt | 3 +- forge-gui/res/cardsfolder/w/wind_shear.txt | 2 +- 11 files changed, 12 insertions(+), 157 deletions(-) delete mode 100644 forge-ai/src/main/java/forge/ai/ability/DebuffAllAi.java delete mode 100644 forge-game/src/main/java/forge/game/ability/effects/DebuffAllEffect.java diff --git a/.gitattributes b/.gitattributes index ca9bfe929cc..881416d6517 100644 --- a/.gitattributes +++ b/.gitattributes @@ -76,7 +76,6 @@ forge-ai/src/main/java/forge/ai/ability/DamageEachAi.java -text forge-ai/src/main/java/forge/ai/ability/DamagePreventAi.java -text forge-ai/src/main/java/forge/ai/ability/DamagePreventAllAi.java -text forge-ai/src/main/java/forge/ai/ability/DebuffAi.java -text -forge-ai/src/main/java/forge/ai/ability/DebuffAllAi.java -text forge-ai/src/main/java/forge/ai/ability/DelayedTriggerAi.java -text forge-ai/src/main/java/forge/ai/ability/DestroyAi.java -text forge-ai/src/main/java/forge/ai/ability/DestroyAllAi.java -text @@ -354,7 +353,6 @@ forge-game/src/main/java/forge/game/ability/effects/DamageDealEffect.java -text forge-game/src/main/java/forge/game/ability/effects/DamageEachEffect.java -text forge-game/src/main/java/forge/game/ability/effects/DamagePreventAllEffect.java -text forge-game/src/main/java/forge/game/ability/effects/DamagePreventEffect.java -text -forge-game/src/main/java/forge/game/ability/effects/DebuffAllEffect.java -text forge-game/src/main/java/forge/game/ability/effects/DebuffEffect.java -text forge-game/src/main/java/forge/game/ability/effects/DeclareCombatantsEffect.java -text forge-game/src/main/java/forge/game/ability/effects/DelayedTriggerEffect.java -text diff --git a/forge-ai/src/main/java/forge/ai/SpellApiToAi.java b/forge-ai/src/main/java/forge/ai/SpellApiToAi.java index 832561e7e94..c34f95279e6 100644 --- a/forge-ai/src/main/java/forge/ai/SpellApiToAi.java +++ b/forge-ai/src/main/java/forge/ai/SpellApiToAi.java @@ -49,7 +49,6 @@ public enum SpellApiToAi { apiToClass.put(ApiType.DealDamage, DamageDealAi.class); apiToClass.put(ApiType.Debuff, DebuffAi.class); - apiToClass.put(ApiType.DebuffAll, DebuffAllAi.class); apiToClass.put(ApiType.DeclareCombatants, CannotPlayAi.class); apiToClass.put(ApiType.DelayedTrigger, DelayedTriggerAi.class); apiToClass.put(ApiType.Destroy, DestroyAi.class); diff --git a/forge-ai/src/main/java/forge/ai/ability/DebuffAllAi.java b/forge-ai/src/main/java/forge/ai/ability/DebuffAllAi.java deleted file mode 100644 index 45a2c76f03f..00000000000 --- a/forge-ai/src/main/java/forge/ai/ability/DebuffAllAi.java +++ /dev/null @@ -1,64 +0,0 @@ -package forge.ai.ability; - -import com.google.common.base.Predicate; -import forge.ai.SpellAbilityAi; -import forge.game.card.Card; -import forge.game.card.CardLists; -import forge.game.combat.CombatUtil; -import forge.game.phase.PhaseType; -import forge.game.player.Player; -import forge.game.spellability.SpellAbility; -import forge.game.zone.ZoneType; -import forge.util.MyRandom; - -import java.util.List; -import java.util.Random; - -public class DebuffAllAi extends SpellAbilityAi { - @Override - protected boolean canPlayAI(Player ai, SpellAbility sa) { - String valid = ""; - final Random r = MyRandom.getRandom(); - // final Card source = sa.getHostCard(); - final Card hostCard = sa.getHostCard(); - final Player opp = ai.getOpponent(); - - final boolean chance = r.nextFloat() <= Math.pow(.6667, sa.getActivationsThisTurn()); // to - // prevent - // runaway - // activations - - if (sa.hasParam("ValidCards")) { - valid = sa.getParam("ValidCards"); - } - - List comp = CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), valid, hostCard.getController(), hostCard); - List human = CardLists.getValidCards(opp.getCardsIn(ZoneType.Battlefield), valid, hostCard.getController(), hostCard); - - // TODO - add blocking situations here also - - // only count creatures that can attack - human = CardLists.filter(human, new Predicate() { - @Override - public boolean apply(final Card c) { - return CombatUtil.canAttack(c, opp); - } - }); - - // don't use DebuffAll after Combat_Begin until AI is improved - if (ai.getGame().getPhaseHandler().getPhase().isAfter(PhaseType.COMBAT_BEGIN)) { - return false; - } - - if (comp.size() > human.size()) { - return false; - } - - return (r.nextFloat() < .6667) && chance; - } // debuffAllCanPlayAI() - - @Override - protected boolean doTriggerAINoCost(Player aiPlayer, SpellAbility sa, boolean mandatory) { - return true; - } -} diff --git a/forge-game/src/main/java/forge/game/ability/ApiType.java b/forge-game/src/main/java/forge/game/ability/ApiType.java index 864f89ef219..c1136595ba4 100644 --- a/forge-game/src/main/java/forge/game/ability/ApiType.java +++ b/forge-game/src/main/java/forge/game/ability/ApiType.java @@ -47,7 +47,6 @@ public enum ApiType { DamageAll (DamageAllEffect.class), DealDamage (DamageDealEffect.class), Debuff (DebuffEffect.class), - DebuffAll (DebuffAllEffect.class), DeclareCombatants (DeclareCombatantsEffect.class), DelayedTrigger (DelayedTriggerEffect.class), Destroy (DestroyEffect.class), diff --git a/forge-game/src/main/java/forge/game/ability/effects/AnimateAllEffect.java b/forge-game/src/main/java/forge/game/ability/effects/AnimateAllEffect.java index cc6b976ca7c..90ae3fc7fa9 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/AnimateAllEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/AnimateAllEffect.java @@ -74,6 +74,11 @@ public class AnimateAllEffect extends AnimateEffectBase { keywords.addAll(Arrays.asList(sa.getParam("Keywords").split(" & "))); } + final ArrayList removeKeywords = new ArrayList(); + if (sa.hasParam("RemoveKeywords")) { + removeKeywords.addAll(Arrays.asList(sa.getParam("RemoveKeywords").split(" & "))); + } + final ArrayList hiddenKeywords = new ArrayList(); if (sa.hasParam("HiddenKeywords")) { hiddenKeywords.addAll(Arrays.asList(sa.getParam("HiddenKeywords").split(" & "))); @@ -141,7 +146,7 @@ public class AnimateAllEffect extends AnimateEffectBase { for (final Card c : list) { final long colorTimestamp = doAnimate(c, sa, power, toughness, types, removeTypes, - finalDesc, keywords, null, hiddenKeywords, timestamp); + finalDesc, keywords, removeKeywords, hiddenKeywords, timestamp); // give abilities final ArrayList addedAbilities = new ArrayList(); diff --git a/forge-game/src/main/java/forge/game/ability/effects/DebuffAllEffect.java b/forge-game/src/main/java/forge/game/ability/effects/DebuffAllEffect.java deleted file mode 100644 index b4b7bd77dea..00000000000 --- a/forge-game/src/main/java/forge/game/ability/effects/DebuffAllEffect.java +++ /dev/null @@ -1,83 +0,0 @@ -package forge.game.ability.effects; - -import forge.GameCommand; -import forge.game.Game; -import forge.game.ability.SpellAbilityEffect; -import forge.game.card.Card; -import forge.game.card.CardCollectionView; -import forge.game.card.CardLists; -import forge.game.spellability.SpellAbility; -import forge.game.zone.ZoneType; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -public class DebuffAllEffect extends SpellAbilityEffect { - - /* (non-Javadoc) - * @see forge.card.abilityfactory.SpellEffect#getStackDescription(java.util.Map, forge.card.spellability.SpellAbility) - */ - @Override - protected String getStackDescription(SpellAbility sa) { - if (sa.hasParam("DebuffAllDescription")) { - return sa.getParam("DebuffAllDescription"); - } - - return ""; - } // debuffAllStackDescription() - - /** - *

- * debuffAllResolve. - *

- * @param sa - * a {@link forge.game.spellability.SpellAbility} object. - * @param af - * a {@link forge.game.ability.AbilityFactory} object. - */ - - @Override - public void resolve(SpellAbility sa) { - final Card hostCard = sa.getHostCard(); - final List kws = sa.hasParam("Keywords") ? Arrays.asList(sa.getParam("Keywords").split(" & ")) : new ArrayList(); - final Game game = sa.getActivatingPlayer().getGame(); - - String valid = ""; - - if (sa.hasParam("ValidCards")) { - valid = sa.getParam("ValidCards"); - } - - CardCollectionView list = game.getCardsIn(ZoneType.Battlefield); - list = CardLists.getValidCards(list, valid.split(","), hostCard.getController(), hostCard); - - for (final Card tgtC : list) { - final ArrayList hadIntrinsic = new ArrayList(); - if (tgtC.isInPlay() && tgtC.canBeTargetedBy(sa)) { - for (final String kw : kws) { - if (tgtC.getCurrentState().hasIntrinsicKeyword(kw)) { - hadIntrinsic.add(kw); - } - tgtC.removeIntrinsicKeyword(kw); - tgtC.removeExtrinsicKeyword(kw); - } - } - if (!sa.hasParam("Permanent")) { - game.getEndOfTurn().addUntil(new GameCommand() { - private static final long serialVersionUID = 7486231071095628674L; - - @Override - public void run() { - if (tgtC.isInPlay()) { - for (final String kw : hadIntrinsic) { - tgtC.addIntrinsicKeyword(kw); - } - } - } - }); - } - } - } // debuffAllResolve() - -} diff --git a/forge-gui/res/cardsfolder/b/blind_fury.txt b/forge-gui/res/cardsfolder/b/blind_fury.txt index 77e26a36f0e..c3f3aa1ae62 100644 --- a/forge-gui/res/cardsfolder/b/blind_fury.txt +++ b/forge-gui/res/cardsfolder/b/blind_fury.txt @@ -1,7 +1,7 @@ Name:Blind Fury ManaCost:2 R R Types:Instant -A:SP$ DebuffAll | Cost$ 2 R R | ValidCards$ Creature | Keywords$ Trample | SubAbility$ BlindFuryEffect | SpellDescription$ All creatures lose trample until end of turn. If a creature would deal combat damage to a creature this turn, it deals double that damage to that creature instead. +A:SP$ AnimateAll | Cost$ 2 R R | ValidCards$ Creature | RemoveKeywords$ Trample | SubAbility$ BlindFuryEffect | SpellDescription$ All creatures lose trample until end of turn. If a creature would deal combat damage to a creature this turn, it deals double that damage to that creature instead. SVar:BlindFuryEffect:DB$ Effect | Name$ Blind Fury Effect | ReplacementEffects$ FuryCombatEvent | SVars$ DmgTwiceCombat,X SVar:FuryCombatEvent:Event$ DamageDone | ValidSource$ Creature | ValidTarget$ Creature | ReplaceWith$ DmgTwiceCombat | IsCombat$ True | Description$ If a creature would deal combat damage to a creature this turn, it deals double that damage to that creature instead. SVar:DmgTwiceCombat:AB$DealDamage | Cost$ 0 | CombatDamage$ True | Defined$ ReplacedTarget | DamageSource$ ReplacedSource | NumDmg$ X diff --git a/forge-gui/res/cardsfolder/i/invert_the_skies.txt b/forge-gui/res/cardsfolder/i/invert_the_skies.txt index 348cde23784..7abca11e66b 100644 --- a/forge-gui/res/cardsfolder/i/invert_the_skies.txt +++ b/forge-gui/res/cardsfolder/i/invert_the_skies.txt @@ -1,7 +1,7 @@ Name:Invert the Skies ManaCost:3 GU Types:Instant -A:SP$ DebuffAll | Cost$ 3 GU | ValidCards$ Creature.OppCtrl | Keywords$ Flying | ConditionManaSpent$ G | SubAbility$ UPaid | SpellDescription$ Creatures your opponents control lose flying until end of turn if {G} was spent to cast CARDNAME, and creatures you control gain flying until end of turn if {U} was spent to cast it. (Do both if {G}{U} was spent.) +A:SP$ AnimateAll | Cost$ 3 GU | ValidCards$ Creature.OppCtrl | RemoveKeywords$ Flying | ConditionManaSpent$ G | SubAbility$ UPaid | SpellDescription$ Creatures your opponents control lose flying until end of turn if {G} was spent to cast CARDNAME, and creatures you control gain flying until end of turn if {U} was spent to cast it. (Do both if {G}{U} was spent.) SVar:UPaid:DB$ PumpAll | ValidCards$ Creature.YouCtrl | KW$ Flying | ConditionManaSpent$ U SVar:RemAIDeck:True SVar:Picture:http://www.wizards.com/global/images/magic/general/invert_the_skies.jpg diff --git a/forge-gui/res/cardsfolder/t/thundercloud_elemental.txt b/forge-gui/res/cardsfolder/t/thundercloud_elemental.txt index 6484cb8c4e9..f15746baa45 100644 --- a/forge-gui/res/cardsfolder/t/thundercloud_elemental.txt +++ b/forge-gui/res/cardsfolder/t/thundercloud_elemental.txt @@ -4,6 +4,6 @@ Types:Creature Elemental PT:3/4 K:Flying A:AB$ TapAll | Cost$ 3 U | ValidCards$ Creature.toughnessLE2 | SpellDescription$ Tap all creatures with toughness 2 or less. -A:AB$ DebuffAll | Cost$ 3 U | ValidCards$ Creature.Other | Keywords$ Flying | SpellDescription$ All other creatures lose flying until end of turn. +A:AB$ AnimateAll | Cost$ 3 U | ValidCards$ Creature.Other | RemoveKeywords$ Flying | SpellDescription$ All other creatures lose flying until end of turn. SVar:Picture:http://www.wizards.com/global/images/magic/general/thundercloud_elemental.jpg Oracle:Flying\n{3}{U}: Tap all creatures with toughness 2 or less.\n{3}{U}: All other creatures lose flying until end of turn. diff --git a/forge-gui/res/cardsfolder/w/whiteout.txt b/forge-gui/res/cardsfolder/w/whiteout.txt index b27a5e0efd2..eb6df5080fc 100644 --- a/forge-gui/res/cardsfolder/w/whiteout.txt +++ b/forge-gui/res/cardsfolder/w/whiteout.txt @@ -1,8 +1,9 @@ Name:Whiteout ManaCost:1 G Types:Instant -A:SP$ DebuffAll | Cost$ 1 G | ValidCards$ Creature | Keywords$ Flying | SpellDescription$ All creatures lose flying until end of turn. +A:SP$ AnimateAll | Cost$ 1 G | ValidCards$ Creature | RemoveKeywords$ Flying | SpellDescription$ All creatures lose flying until end of turn. A:AB$ ChangeZone | Cost$ Sac<1/Land.Snow/snow land> | ActivationZone$ Graveyard | Defined$ Self | Origin$ Graveyard | Destination$ Hand | SpellDescription$ Return CARDNAME from your graveyard to your hand. SVar:RemAIDeck:True +SVar:RemRandomDeck:True SVar:Picture:http://www.wizards.com/global/images/magic/general/whiteout.jpg Oracle:All creatures lose flying until end of turn.\nSacrifice a snow land: Return Whiteout from your graveyard to your hand. diff --git a/forge-gui/res/cardsfolder/w/wind_shear.txt b/forge-gui/res/cardsfolder/w/wind_shear.txt index 48273cdbd63..59a2ae2afaf 100644 --- a/forge-gui/res/cardsfolder/w/wind_shear.txt +++ b/forge-gui/res/cardsfolder/w/wind_shear.txt @@ -2,6 +2,6 @@ Name:Wind Shear ManaCost:2 G Types:Instant A:SP$ PumpAll | Cost$ 2 G | ValidCards$ Creature.withFlying+attacking | NumAtt$ -2 | NumDef$ -2 | SubAbility$ DBDebuff | IsCurse$ True | SpellDescription$ Attacking creatures with flying get -2/-2 and lose flying until end of turn. -SVar:DBDebuff:DB$ DebuffAll | ValidCards$ Creature.withFlying+attacking | Keywords$ Flying +SVar:DBDebuff:DB$ AnimateAll | ValidCards$ Creature.withFlying+attacking | RemoveKeywords$ Flying SVar:Picture:http://www.wizards.com/global/images/magic/general/wind_shear.jpg Oracle:Attacking creatures with flying get -2/-2 and lose flying until end of turn.