From 410b31665ad620be50b97da2c1220df848ba388c Mon Sep 17 00:00:00 2001 From: Sloth Date: Thu, 11 Oct 2012 18:35:57 +0000 Subject: [PATCH] - Converted Dunerider Outlaw and Whirling Dervish to script. --- res/cardsfolder/d/dunerider_outlaw.txt | 4 +- res/cardsfolder/w/whirling_dervish.txt | 4 +- src/main/java/forge/Card.java | 4 + src/main/java/forge/GameActionUtil.java | 185 ------------------------ 4 files changed, 10 insertions(+), 187 deletions(-) diff --git a/res/cardsfolder/d/dunerider_outlaw.txt b/res/cardsfolder/d/dunerider_outlaw.txt index 1650d2174d7..c2eecaad458 100644 --- a/res/cardsfolder/d/dunerider_outlaw.txt +++ b/res/cardsfolder/d/dunerider_outlaw.txt @@ -1,9 +1,11 @@ Name:Dunerider Outlaw ManaCost:B B Types:Creature Human Rebel Rogue -Text:At the beginning of the end step, if Dunerider Outlaw dealt damage to an opponent this turn, put a +1/+1 counter on it. +Text:no text PT:1/1 K:Protection from green +T:Mode$ Phase | Phase$ End of Turn | TriggerZones$ Battlefield | Execute$ TrigPutCounter | IsPresent$ Card.Self+dealtDamageToOppThisTurn | TriggerDescription$ At the beginning of each end step, if CARDNAME dealt damage to an opponent this turn, put a +1/+1 counter on it. +SVar:TrigPutCounter:AB$ PutCounter | Cost$ 0 | Defined$ Self | CounterType$ P1P1 | CounterNum$ 1 SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/dunerider_outlaw.jpg SetInfo:PLC|Uncommon|http://magiccards.info/scans/en/pc/86.jpg diff --git a/res/cardsfolder/w/whirling_dervish.txt b/res/cardsfolder/w/whirling_dervish.txt index d9c4ffa9e6d..c352d323347 100644 --- a/res/cardsfolder/w/whirling_dervish.txt +++ b/res/cardsfolder/w/whirling_dervish.txt @@ -1,9 +1,11 @@ Name:Whirling Dervish ManaCost:G G Types:Creature Human Monk -Text:At the beginning of the end step, if Whirling Dervish dealt damage to an opponent this turn, put a +1/+1 counter on it. +Text:no text PT:1/1 K:Protection from black +T:Mode$ Phase | Phase$ End of Turn | TriggerZones$ Battlefield | Execute$ TrigPutCounter | IsPresent$ Card.Self+dealtDamageToOppThisTurn | TriggerDescription$ At the beginning of each end step, if CARDNAME dealt damage to an opponent this turn, put a +1/+1 counter on it. +SVar:TrigPutCounter:AB$ PutCounter | Cost$ 0 | Defined$ Self | CounterType$ P1P1 | CounterNum$ 1 SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/whirling_dervish.jpg SetInfo:5ED|Uncommon|http://magiccards.info/scans/en/5e/203.jpg diff --git a/src/main/java/forge/Card.java b/src/main/java/forge/Card.java index add7e082ad2..7d88d0ada50 100644 --- a/src/main/java/forge/Card.java +++ b/src/main/java/forge/Card.java @@ -6922,6 +6922,10 @@ public class Card extends GameEntity implements Comparable { if ( !this.getDamageHistory().getThisTurnDamaged().contains(sourceController) ) { return false; } + } else if (property.startsWith("dealtDamageToOppThisTurn")) { + if ( !this.getDamageHistory().getThisTurnDamaged().contains(sourceController.getOpponent()) ) { + return false; + } } else if (property.startsWith("controllerWasDealtCombatDamageByThisTurn")) { if ( !this.getDamageHistory().getThisTurnCombatDamaged().contains(sourceController) ) { return false; diff --git a/src/main/java/forge/GameActionUtil.java b/src/main/java/forge/GameActionUtil.java index 141063ce2ca..1875c7a2abf 100644 --- a/src/main/java/forge/GameActionUtil.java +++ b/src/main/java/forge/GameActionUtil.java @@ -350,76 +350,6 @@ public final class GameActionUtil { AllZone.getStack().setResolving(bResolving); } - /** - *

- * payCostDuringAbilityResolve. - *

- * - * @param message - * a {@link java.lang.String} object. - * @param hostCard - * a Card object. - * @param manaCost - * a {@link java.lang.String} object. - * @param paid - * a {@link forge.Command} object. - * @param unpaid - * a {@link forge.Command} object. - */ - /*public static void payCostDuringAbilityResolve(final String message, Card hostCard, final String manaCost, - final Command paid, final Command unpaid) { - if (manaCost.startsWith("PayLife")) { - String amountString = manaCost.split("<")[1].split(">")[0]; - int amount = amountString.matches("[0-9][0-9]?") ? Integer.parseInt(amountString) - : CardFactoryUtil.xCount(hostCard, hostCard.getSVar(amountString)); - if (AllZone.getHumanPlayer().canPayLife(amount) && showYesNoDialog(hostCard, "Do you want to pay " - + amount + " life?")) { - AllZone.getHumanPlayer().payLife(amount, null); - paid.execute(); - } else { - unpaid.execute(); - } - return; - } - else if (manaCost.startsWith("AddCounter")) { - String amountString = manaCost.split("<")[1].split("\\/")[0]; - String counterName = manaCost.split("<")[1].split("\\/")[1].split(">")[0]; - Counters counterType = Counters.valueOf(counterName); - int amount = amountString.matches("[0-9][0-9]?") ? Integer.parseInt(amountString) - : CardFactoryUtil.xCount(hostCard, hostCard.getSVar(amountString)); - String plural = amount > 1 ? "s" : ""; - if (showYesNoDialog(hostCard, "Do you want to put " + amount + " " + counterType.getName() - + " counter" + plural + " on " + hostCard + "?")) { - if (hostCard.canHaveCountersPlacedOnIt(counterType)) { - hostCard.addCounterFromNonEffect(counterType, amount); - paid.execute(); - } else { - unpaid.execute(); - AllZone.getGameLog().add("ResolveStack", "Trying to pay upkeep for " + hostCard + " but it can't have " - + counterType.getName() + " counters put on it.", 2); - } - } else { - unpaid.execute(); - } - return; - } - if (manaCost.equals("0")) { - if (showYesNoDialog(hostCard, "Do you want to pay 0?")) { - paid.execute(); - } else { - unpaid.execute(); - } - return; - } - - // temporarily disable the Resolve flag, so the user can payMana for the - // resolving Ability - final boolean bResolving = AllZone.getStack().getResolving(); - AllZone.getStack().setResolving(false); - AllZone.getInputControl().setInput(new InputPayManaCostAbility(message, manaCost, paid, unpaid)); - AllZone.getStack().setResolving(bResolving); - }*/ - /** *

* payCostDuringAbilityResolve. @@ -626,78 +556,6 @@ public final class GameActionUtil { return winFlip; } - /** - *

- * executeLandfallEffects. - *

- * - * @param c - * a {@link forge.Card} object. - *//* - public static void executeLandfallEffects(final Card c) { - if (c.getName().equals("Lotus Cobra")) { - GameActionUtil.landfallLotusCobra(c); - } - } - - *//** - *

- * showLandfallDialog. - *

- * - * @param c - * a {@link forge.Card} object. - * @return a boolean. - *//* - private static boolean showLandfallDialog(final Card c) { - CMatchUI.SINGLETON_INSTANCE.setCard(c); - final String[] choices = { "Yes", "No" }; - - Object q = null; - - q = GuiUtils.chooseOneOrNone("Use " + c + " Landfall?", choices); - - return (q != null) && q.equals("Yes"); - } - - *//** - *

- * landfallLotusCobra. - *

- * - * @param c - * a {@link forge.Card} object. - *//* - private static void landfallLotusCobra(final Card c) { - final Ability ability = new Ability(c, "0") { - @Override - public void resolve() { - String color = ""; - - final String o = GuiUtils.chooseOne("Choose mana color", Constant.Color.ONLY_COLORS); - color = InputPayManaCostUtil.getShortColorString(o); - - final AbilityMana abMana = new AbilityMana(c, "0", color) { - private static final long serialVersionUID = -2182129023960978132L; - }; - abMana.produceMana(); - } - }; - - final StringBuilder sb = new StringBuilder(); - sb.append(c.getName()).append(" - add one mana of any color to your mana pool."); - ability.setStackDescription(sb.toString()); - - if (c.getController().isHuman()) { - if (GameActionUtil.showLandfallDialog(c)) { - AllZone.getStack().addSimultaneousStackEntry(ability); - } - } else { - // TODO once AI has a mana pool he should choose add Ability and - // choose a mana as appropriate - } - }*/ - // not restricted to combat damage, not restricted to dealing damage to // creatures/players /** @@ -867,11 +725,6 @@ public final class GameActionUtil { AllZone.getStack().addSimultaneousStackEntry(ability); } - - - if (c.getName().equals("Whirling Dervish") || c.getName().equals("Dunerider Outlaw")) { - GameActionUtil.playerCombatDamageWhirlingDervish(c); - } c.getDamageHistory().registerDamage(player); } @@ -989,44 +842,6 @@ public final class GameActionUtil { } } - /** - *

- * playerCombatDamageWhirlingDervish. - *

- * - * @param c - * a {@link forge.Card} object. - */ - private static void playerCombatDamageWhirlingDervish(final Card c) { - final int power = c.getNetAttack(); - final Card card = c; - - if (power > 0) { - final Ability ability2 = new Ability(c, "0") { - @Override - public void resolve() { - card.addCounter(Counters.P1P1, 1); - } - }; // ability2 - - final StringBuilder sb = new StringBuilder(); - sb.append(c.getName()).append(" - gets a +1/+1 counter."); - ability2.setStackDescription(sb.toString()); - - final Command dealtDmg = new Command() { - private static final long serialVersionUID = 2200679209414069339L; - - @Override - public void execute() { - AllZone.getStack().addSimultaneousStackEntry(ability2); - - } - }; - AllZone.getEndOfTurn().addAt(dealtDmg); - - } // if - } - /** *

* playerCombatDamageScalpelexis.