From b4ac21f1c74e62261834d648b36898e3aeeca62c Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Wed, 25 Mar 2015 21:46:55 +0100 Subject: [PATCH] Minor updates to Gerrard Capashen and Darigaaz, the Igniter. --- .../mage/sets/apocalypse/GerrardCapashen.java | 12 +++--- .../DarigaazTheIgniter.java | 42 ++++++++++--------- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/Mage.Sets/src/mage/sets/apocalypse/GerrardCapashen.java b/Mage.Sets/src/mage/sets/apocalypse/GerrardCapashen.java index b811b68104..dd7ace963e 100644 --- a/Mage.Sets/src/mage/sets/apocalypse/GerrardCapashen.java +++ b/Mage.Sets/src/mage/sets/apocalypse/GerrardCapashen.java @@ -37,7 +37,6 @@ import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.TapTargetEffect; import mage.cards.CardImpl; -import mage.cards.Cards; import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.Rarity; @@ -68,7 +67,7 @@ public class GerrardCapashen extends CardImpl { TargetController.YOU, false, true); ability1.addTarget(new TargetOpponent()); this.addAbility(ability1); - + // {3}{W}: Tap target creature. Activate this ability only if {this} is attacking. Ability ability2 = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, new TapTargetEffect(), new ManaCostsImpl("{3}{W}"), new SourceAttackingCondition()); @@ -106,11 +105,12 @@ class GerrardCapashenEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Player targetOpponent = game.getPlayer(this.getTargetPointer().getFirst(game, source)); - if(controller != null && targetOpponent != null) { - Cards cardsInHand = targetOpponent.getHand(); - if(cardsInHand.size() > 0) { - controller.gainLife(cardsInHand.size(), game); + if (controller != null && targetOpponent != null) { + int cardsInHand = targetOpponent.getHand().size(); + if (cardsInHand > 0) { + controller.gainLife(cardsInHand, game); } + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/phyrexiavsthecoalition/DarigaazTheIgniter.java b/Mage.Sets/src/mage/sets/phyrexiavsthecoalition/DarigaazTheIgniter.java index f7ba16cfec..e15861e977 100644 --- a/Mage.Sets/src/mage/sets/phyrexiavsthecoalition/DarigaazTheIgniter.java +++ b/Mage.Sets/src/mage/sets/phyrexiavsthecoalition/DarigaazTheIgniter.java @@ -27,7 +27,6 @@ */ package mage.sets.phyrexiavsthecoalition; -import java.util.Set; import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; @@ -36,9 +35,7 @@ import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DoIfCostPaid; import mage.abilities.keyword.FlyingAbility; -import mage.cards.Card; import mage.cards.CardImpl; -import mage.cards.Cards; import mage.choices.ChoiceColor; import mage.constants.CardType; import mage.constants.Outcome; @@ -64,7 +61,8 @@ public class DarigaazTheIgniter extends CardImpl { // Flying this.addAbility(FlyingAbility.getInstance()); - // Whenever {this} deals combat damage to a player, you may pay {2}{R}. If you do, choose a color, then that player reveals his or her hand and Darigaaz deals damage to the player equal to the number of cards of that color revealed this way. + + // Whenever Darigaaz, the Igniter deals combat damage to a player, you may pay {2}{R}. If you do, choose a color, then that player reveals his or her hand and Darigaaz deals damage to the player equal to the number of cards of that color revealed this way. this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new DoIfCostPaid( new DarigaazTheIgniterEffect(), new ManaCostsImpl("{2}{R}")), false, true)); } @@ -99,27 +97,31 @@ class DarigaazTheIgniterEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); - if(controller != null) { - ChoiceColor choice = new ChoiceColor(); - controller.choose(outcome, choice, game); - if(choice.getColor() != null) { - game.informPlayers(new StringBuilder(controller.getName()).append(" chooses ").append(choice.getColor()).toString()); + if (controller != null) { + ChoiceColor choice = new ChoiceColor(true); + while (!choice.isChosen()) { + controller.choose(outcome, choice, game); + if (!controller.isInGame()) { + return false; + } + } + + if (choice.getColor() != null) { + game.informPlayers(controller.getName() + " chooses " + choice.getColor()); Player damagedPlayer = game.getPlayer(this.getTargetPointer().getFirst(game, source)); - if(damagedPlayer != null) { + if (damagedPlayer != null) { damagedPlayer.revealCards("hand of " + damagedPlayer.getName(), damagedPlayer.getHand(), game); - Cards cardsInHand = damagedPlayer.getHand(); - if(cardsInHand.size() > 0) { - FilterCard filter = new FilterCard(); - filter.add(new ColorPredicate(choice.getColor())); - Set damage = cardsInHand.getCards(filter, game); - if(damage.size() > 0) { - damagedPlayer.damage(damage.size(), source.getSourceId(), game, false, true); - return true; - } + FilterCard filter = new FilterCard(); + filter.add(new ColorPredicate(choice.getColor())); + int damage = damagedPlayer.getHand().count(filter, source.getSourceId(), source.getControllerId(), game); + if (damage > 0) { + damagedPlayer.damage(damage, source.getSourceId(), game, false, true); } } } + return true; + } return false; } -} \ No newline at end of file +}