From 310627c92412c1c101ff001613041af6249bbaf5 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Tue, 15 Sep 2015 00:24:08 +0200 Subject: [PATCH] Some minor updates to the cards of the recently merged pull requests. --- .../sets/dissension/MagewrightsStone.java | 28 +++---- .../mage/sets/futuresight/GraveScrabbler.java | 57 +++++++------ .../src/mage/sets/iceage/AegisOfTheMeek.java | 9 ++- Mage.Sets/src/mage/sets/iceage/Aurochs.java | 4 +- .../masterseditioniv/SoldeviMachinist.java | 1 + .../mage/sets/onslaught/EbonbladeReaper.java | 45 +++++------ .../src/mage/sets/thedark/GoblinWizard.java | 23 +++--- .../sets/urzaslegacy/LastDitchEffort.java | 15 ++-- .../effects/common/LoseHalfLifeEffect.java | 4 +- .../abilities/keyword/MadnessAbility.java | 79 +++++++++---------- 10 files changed, 126 insertions(+), 139 deletions(-) diff --git a/Mage.Sets/src/mage/sets/dissension/MagewrightsStone.java b/Mage.Sets/src/mage/sets/dissension/MagewrightsStone.java index 04be3109a5..d6023e49db 100644 --- a/Mage.Sets/src/mage/sets/dissension/MagewrightsStone.java +++ b/Mage.Sets/src/mage/sets/dissension/MagewrightsStone.java @@ -31,7 +31,6 @@ import java.util.UUID; import mage.MageObject; import mage.abilities.Abilities; import mage.abilities.Ability; -import mage.abilities.ActivatedAbilityImpl; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.Cost; import mage.abilities.costs.common.TapSourceCost; @@ -39,6 +38,7 @@ import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.common.UntapTargetEffect; import mage.cards.Card; import mage.cards.CardImpl; +import mage.constants.AbilityType; import mage.constants.CardType; import mage.constants.Rarity; import mage.constants.Zone; @@ -52,18 +52,18 @@ import mage.target.common.TargetCreaturePermanent; * @author BursegSardaukar */ public class MagewrightsStone extends CardImpl { - + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature that has an ability with {T} in its cost"); - + static { filter.add(new HasAbilityWithTapSymbolPredicate()); } - + public MagewrightsStone(UUID ownerId) { super(ownerId, 162, "Magewright's Stone", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{2}"); this.expansionSetCode = "DIS"; - // {1}, {tap}: Untap target creature that has an activated ability with {T} in its cost. + // {1}, {T}: Untap target creature that has an activated ability with {T} in its cost. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new UntapTargetEffect(), new ManaCostsImpl("{1}")); ability.addCost(new TapSourceCost()); ability.addTarget(new TargetCreaturePermanent(filter)); @@ -80,27 +80,19 @@ public class MagewrightsStone extends CardImpl { } } -/** - * - * @author North - */ class HasAbilityWithTapSymbolPredicate implements Predicate { - public HasAbilityWithTapSymbolPredicate() { - - } - @Override public boolean apply(MageObject input, Game game) { Abilities abilities; - if (input instanceof Card){ - abilities = ((Card)input).getAbilities(game); + if (input instanceof Card) { + abilities = ((Card) input).getAbilities(game); } else { abilities = input.getAbilities(); } - + for (Ability ability : abilities) { - if((ability instanceof ActivatedAbilityImpl) && ability.getCosts().size() > 0){ + if (ability.getAbilityType().equals(AbilityType.ACTIVATED) && !ability.getCosts().isEmpty()) { for (Cost cost : ability.getCosts()) { if (cost instanceof TapSourceCost) { return true; @@ -113,6 +105,6 @@ class HasAbilityWithTapSymbolPredicate implements Predicate { @Override public String toString() { - return "Ability contains {T} symbol."; + return "activated ability with {T} in its cost"; } } diff --git a/Mage.Sets/src/mage/sets/futuresight/GraveScrabbler.java b/Mage.Sets/src/mage/sets/futuresight/GraveScrabbler.java index 4ddd2c8dee..44e7ee27ac 100644 --- a/Mage.Sets/src/mage/sets/futuresight/GraveScrabbler.java +++ b/Mage.Sets/src/mage/sets/futuresight/GraveScrabbler.java @@ -1,7 +1,7 @@ package mage.sets.futuresight; import java.util.UUID; - +import mage.MageInt; import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.decorator.ConditionalTriggeredAbility; @@ -12,37 +12,36 @@ import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; import mage.filter.common.FilterCreatureCard; -import mage.MageInt; import mage.target.common.TargetCardInGraveyard; -public class GraveScrabbler extends CardImpl{ +public class GraveScrabbler extends CardImpl { - public GraveScrabbler(UUID ownerId) { - super(ownerId, 86, "Grave Scrabbler", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{3}{B}"); - this.expansionSetCode = "FUT"; - this.subtype.add("Zombie"); - - this.power = new MageInt(2); - this.toughness = new MageInt(2); - - //Madness {1}{B} - this.addAbility(new MadnessAbility(this, new ManaCostsImpl("{1}{B}"))); - - //When Grave Scrabbler enters the battlefield, if its madness cost was paid, - //you may return target creature card from a graveyard to its owner's hand. - EntersBattlefieldTriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new ReturnToHandTargetEffect(), true); - ability.addTarget(new TargetCardInGraveyard(new FilterCreatureCard("creature card in a graveyard"))); - this.addAbility(new ConditionalTriggeredAbility(ability, MadnessAbility.GetCondition(), - "When {this} enters the battlefield, if its madness cost was paid, you may return target creature card from a graveyard to its owner's hand.")); - } - - public GraveScrabbler(final GraveScrabbler card){ - super(card); - } + public GraveScrabbler(UUID ownerId) { + super(ownerId, 86, "Grave Scrabbler", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{3}{B}"); + this.expansionSetCode = "FUT"; + this.subtype.add("Zombie"); - @Override - public Card copy() { - return new GraveScrabbler(this); - } + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + //Madness {1}{B} + this.addAbility(new MadnessAbility(this, new ManaCostsImpl("{1}{B}"))); + + //When Grave Scrabbler enters the battlefield, if its madness cost was paid, + //you may return target creature card from a graveyard to its owner's hand. + EntersBattlefieldTriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new ReturnToHandTargetEffect(), true); + ability.addTarget(new TargetCardInGraveyard(new FilterCreatureCard("creature card in a graveyard"))); + this.addAbility(new ConditionalTriggeredAbility(ability, MadnessAbility.GetCondition(), + "When {this} enters the battlefield, if its madness cost was paid, you may return target creature card from a graveyard to its owner's hand.")); + } + + public GraveScrabbler(final GraveScrabbler card) { + super(card); + } + + @Override + public Card copy() { + return new GraveScrabbler(this); + } } diff --git a/Mage.Sets/src/mage/sets/iceage/AegisOfTheMeek.java b/Mage.Sets/src/mage/sets/iceage/AegisOfTheMeek.java index 88fe16de93..e6173c3bda 100644 --- a/Mage.Sets/src/mage/sets/iceage/AegisOfTheMeek.java +++ b/Mage.Sets/src/mage/sets/iceage/AegisOfTheMeek.java @@ -49,18 +49,19 @@ import mage.target.common.TargetCreaturePermanent; * @author Leathios */ public class AegisOfTheMeek extends CardImpl { + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("1/1 creature"); - - static { + + static { filter.add(new PowerPredicate(Filter.ComparisonType.Equal, 1)); filter.add(new ToughnessPredicate(Filter.ComparisonType.Equal, 1)); } - + public AegisOfTheMeek(UUID ownerId) { super(ownerId, 282, "Aegis of the Meek", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{3}"); this.expansionSetCode = "ICE"; - // {1}, {tap}: Target 1/1 creature gets +1/+2 until end of turn. + // {1}, {T}: Target 1/1 creature gets +1/+2 until end of turn. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostTargetEffect(1, 2, Duration.EndOfTurn), new ManaCostsImpl("{1}")); ability.addCost(new TapSourceCost()); ability.addTarget(new TargetCreaturePermanent(filter)); diff --git a/Mage.Sets/src/mage/sets/iceage/Aurochs.java b/Mage.Sets/src/mage/sets/iceage/Aurochs.java index 3c74d0c793..109a175ff2 100644 --- a/Mage.Sets/src/mage/sets/iceage/Aurochs.java +++ b/Mage.Sets/src/mage/sets/iceage/Aurochs.java @@ -49,12 +49,12 @@ import mage.filter.predicate.permanent.AnotherPredicate; public class Aurochs extends CardImpl { private static final FilterAttackingCreature filter1 = new FilterAttackingCreature("other attacking Aurochs"); - + static { filter1.add(new SubtypePredicate("Aurochs")); filter1.add(new AnotherPredicate()); } - + public Aurochs(UUID ownerId) { super(ownerId, 113, "Aurochs", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{3}{G}"); this.expansionSetCode = "ICE"; diff --git a/Mage.Sets/src/mage/sets/masterseditioniv/SoldeviMachinist.java b/Mage.Sets/src/mage/sets/masterseditioniv/SoldeviMachinist.java index ece060a430..f9680a67e5 100644 --- a/Mage.Sets/src/mage/sets/masterseditioniv/SoldeviMachinist.java +++ b/Mage.Sets/src/mage/sets/masterseditioniv/SoldeviMachinist.java @@ -68,6 +68,7 @@ public class SoldeviMachinist extends CardImpl { } class SoldeviMachinistManaBuilder extends ConditionalManaBuilder { + @Override public ConditionalMana build(Object... options) { return new ArtifactCastConditionalMana(this.mana); diff --git a/Mage.Sets/src/mage/sets/onslaught/EbonbladeReaper.java b/Mage.Sets/src/mage/sets/onslaught/EbonbladeReaper.java index d350ec8dc3..12b22f0ff1 100644 --- a/Mage.Sets/src/mage/sets/onslaught/EbonbladeReaper.java +++ b/Mage.Sets/src/mage/sets/onslaught/EbonbladeReaper.java @@ -28,20 +28,20 @@ package mage.sets.onslaught; import java.util.UUID; +import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.AttacksTriggeredAbility; import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.Effect; -import mage.abilities.effects.common.LoseHalfLifeEffect; import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.LoseHalfLifeEffect; import mage.abilities.keyword.MorphAbility; import mage.cards.Card; import mage.cards.CardImpl; import mage.constants.CardType; -import mage.constants.Rarity; -import mage.MageInt; import mage.constants.Outcome; +import mage.constants.Rarity; import mage.game.Game; import mage.players.Player; @@ -49,30 +49,28 @@ import mage.players.Player; * * @author BijanT */ -public class EbonbladeReaper extends CardImpl{ - - public EbonbladeReaper(UUID ownerId) - { +public class EbonbladeReaper extends CardImpl { + + public EbonbladeReaper(UUID ownerId) { super(ownerId, 141, "Ebonblade Reaper", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{B}"); this.expansionSetCode = "ONS"; this.subtype.add("Human"); this.subtype.add("Cleric"); - + this.power = new MageInt(1); this.toughness = new MageInt(1); - + //Whenever Ebonblade Reaper attacks, you lose half your life, rounded up. this.addAbility(new AttacksTriggeredAbility(new LoseHalfLifeEffect(), false)); - + //Whenever Ebonblade Reaper deals combat damage to a player, that player loses half his or her life, rounded up. this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new EbonbladeReaperEffect(), false, true)); - + //Morph {3}{B}{B} this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{3}{B}{B}"))); } - - public EbonbladeReaper(final EbonbladeReaper card) - { + + public EbonbladeReaper(final EbonbladeReaper card) { super(card); } @@ -82,25 +80,22 @@ public class EbonbladeReaper extends CardImpl{ } } -class EbonbladeReaperEffect extends OneShotEffect -{ +class EbonbladeReaperEffect extends OneShotEffect { - public EbonbladeReaperEffect() - { + public EbonbladeReaperEffect() { super(Outcome.Damage); - this.staticText = "that player loses half his or her life, rounded up."; + this.staticText = "that player loses half his or her life, rounded up"; } - - public EbonbladeReaperEffect(final EbonbladeReaperEffect effect) - { + + public EbonbladeReaperEffect(final EbonbladeReaperEffect effect) { super(effect); } - + @Override public Effect copy() { - return new EbonbladeReaperEffect(this); + return new EbonbladeReaperEffect(this); } - + @Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(getTargetPointer().getFirst(game, source)); diff --git a/Mage.Sets/src/mage/sets/thedark/GoblinWizard.java b/Mage.Sets/src/mage/sets/thedark/GoblinWizard.java index 93478b3364..32f51bfeab 100644 --- a/Mage.Sets/src/mage/sets/thedark/GoblinWizard.java +++ b/Mage.Sets/src/mage/sets/thedark/GoblinWizard.java @@ -31,11 +31,11 @@ import java.util.UUID; import mage.MageInt; import mage.ObjectColor; import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; -import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.effects.common.PutPermanentOnBattlefieldEffect; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; import mage.abilities.keyword.ProtectionAbility; import mage.cards.CardImpl; import mage.constants.CardType; @@ -58,36 +58,37 @@ public class GoblinWizard extends CardImpl { private static final FilterPermanentCard filter = new FilterPermanentCard("Goblin"); private static final FilterCard protectionFilter = new FilterCard("white"); - private static final FilterPermanent goblinCard = new FilterPermanent("Goblin"); + private static final FilterPermanent goblinPermanent = new FilterPermanent("Goblin"); static { filter.add(new SubtypePredicate("Goblin")); - goblinCard.add(new SubtypePredicate("Goblin")); + goblinPermanent.add(new SubtypePredicate("Goblin")); protectionFilter.add(new ColorPredicate(ObjectColor.WHITE)); } - + public GoblinWizard(UUID ownerId) { super(ownerId, 68, "Goblin Wizard", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{R}{R}"); this.expansionSetCode = "DRK"; this.rarity = Rarity.RARE; - + this.subtype.add("Goblin"); this.subtype.add("Wizard"); this.power = new MageInt(1); this.toughness = new MageInt(1); - + // {tap}: You may put a Goblin permanent card from your hand onto the battlefield. this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new PutPermanentOnBattlefieldEffect(filter), new TapSourceCost())); - + // {R}: Target Goblin gains protection from white until end of turn. - Ability ability = new mage.abilities.common.SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilityTargetEffect(new ProtectionAbility(protectionFilter), Duration.EndOfTurn), new ManaCostsImpl("{R}")); - Target target = new TargetPermanent(goblinCard); + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, + new GainAbilityTargetEffect(new ProtectionAbility(protectionFilter), Duration.EndOfTurn), new ManaCostsImpl("{R}")); + Target target = new TargetPermanent(goblinPermanent); ability.addTarget(target); this.addAbility(ability); - + } public GoblinWizard(final GoblinWizard card) { diff --git a/Mage.Sets/src/mage/sets/urzaslegacy/LastDitchEffort.java b/Mage.Sets/src/mage/sets/urzaslegacy/LastDitchEffort.java index c35e356b0c..cba7cd00b5 100644 --- a/Mage.Sets/src/mage/sets/urzaslegacy/LastDitchEffort.java +++ b/Mage.Sets/src/mage/sets/urzaslegacy/LastDitchEffort.java @@ -54,7 +54,7 @@ public class LastDitchEffort extends CardImpl { // Sacrifice any number of creatures. Last-Ditch Effort deals that much damage to target creature or player. this.getSpellAbility().addEffect(new LastDitchEffortEffect()); - this.getSpellAbility().addTarget(new TargetCreatureOrPlayer(1)); + this.getSpellAbility().addTarget(new TargetCreatureOrPlayer()); } public LastDitchEffort(final LastDitchEffort card) { @@ -68,21 +68,21 @@ public class LastDitchEffort extends CardImpl { } class LastDitchEffortEffect extends OneShotEffect { - + LastDitchEffortEffect() { super(Outcome.Damage); - this.staticText = "Sacrifice any number of creatures. Last-Ditch Effort deals that much damage to target creature or player."; + this.staticText = "Sacrifice any number of creatures. {this} deals that much damage to target creature or player"; } - + LastDitchEffortEffect(final LastDitchEffortEffect effect) { super(effect); } - + @Override public LastDitchEffortEffect copy() { return new LastDitchEffortEffect(this); } - + @Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); @@ -109,10 +109,9 @@ class LastDitchEffortEffect extends OneShotEffect { if (opponent != null) { opponent.damage(damage, source.getSourceId(), game, false, true); } - return true; } return true; } return false; } -} \ No newline at end of file +} diff --git a/Mage/src/mage/abilities/effects/common/LoseHalfLifeEffect.java b/Mage/src/mage/abilities/effects/common/LoseHalfLifeEffect.java index 90d6b58930..939b59b90c 100644 --- a/Mage/src/mage/abilities/effects/common/LoseHalfLifeEffect.java +++ b/Mage/src/mage/abilities/effects/common/LoseHalfLifeEffect.java @@ -13,7 +13,7 @@ public class LoseHalfLifeEffect extends OneShotEffect { public LoseHalfLifeEffect() { super(Outcome.LoseLife); - staticText = "You lose half your life, rounded up"; + staticText = "you lose half your life, rounded up"; } public LoseHalfLifeEffect(final LoseHalfLifeEffect effect) { @@ -37,4 +37,4 @@ public class LoseHalfLifeEffect extends OneShotEffect { } return false; } -} \ No newline at end of file +} diff --git a/Mage/src/mage/abilities/keyword/MadnessAbility.java b/Mage/src/mage/abilities/keyword/MadnessAbility.java index 6547165bd3..e679fd72d0 100644 --- a/Mage/src/mage/abilities/keyword/MadnessAbility.java +++ b/Mage/src/mage/abilities/keyword/MadnessAbility.java @@ -24,27 +24,30 @@ import mage.players.Player; * * 702.33a. Madness is a keyword that represents two abilities. * - * The first is a static ability that functions while the card with madness is in a player's hand. - * The second is a triggered ability that functions when the first ability is applied. + * The first is a static ability that functions while the card with madness is + * in a player's hand. The second is a triggered ability that functions when the + * first ability is applied. * - * "Madness [cost]" means "If a player would discard this card, that player discards it, but may exile it instead of putting it into his or her graveyard" and - * "When this card is exiled this way, its owner may cast it by paying [cost] rather than paying its mana cost. - * If that player doesn't, he or she puts this card into his or her graveyard. + * "Madness [cost]" means "If a player would discard this card, that player + * discards it, but may exile it instead of putting it into his or her + * graveyard" and "When this card is exiled this way, its owner may cast it by + * paying [cost] rather than paying its mana cost. If that player doesn't, he or + * she puts this card into his or her graveyard. * - * 702.33b. Casting a spell using its madness ability follows the rules for paying alternative costs in rules 601.2b and 601.2e-g. + * 702.33b. Casting a spell using its madness ability follows the rules for + * paying alternative costs in rules 601.2b and 601.2e-g. * * @author LevelX2 */ - public class MadnessAbility extends StaticAbility { private String rule; - + @SuppressWarnings("unchecked") public MadnessAbility(Card card, ManaCosts madnessCost) { - super(Zone.HAND, new MadnessReplacementEffect((ManaCosts)madnessCost)); - addSubAbility(new MadnessTriggeredAbility((ManaCosts)madnessCost)); - rule = "Madness " + madnessCost.getText() + " (If you discard this card, you may cast it for its madness cost instead of putting it into your graveyard.)"; + super(Zone.HAND, new MadnessReplacementEffect((ManaCosts) madnessCost)); + addSubAbility(new MadnessTriggeredAbility((ManaCosts) madnessCost)); + rule = "Madness " + madnessCost.getText() + " (If you discard this card, you may cast it for its madness cost instead of putting it into your graveyard.)"; } public MadnessAbility(final MadnessAbility ability) { @@ -55,9 +58,8 @@ public class MadnessAbility extends StaticAbility { public MadnessAbility copy() { return new MadnessAbility(this); } - - public static Condition GetCondition() - { + + public static Condition GetCondition() { return MadnessCondition.getInstance(); } @@ -67,11 +69,10 @@ public class MadnessAbility extends StaticAbility { } } - class MadnessReplacementEffect extends ReplacementEffectImpl { - + public MadnessReplacementEffect(ManaCosts madnessCost) { - super(Duration.EndOfGame, Outcome.Benefit); + super(Duration.EndOfGame, Outcome.Benefit); staticText = "Madness " + madnessCost.getText() + " (If you discard this card, you may cast it for its madness cost instead of putting it into your graveyard.)"; } @@ -97,14 +98,14 @@ class MadnessReplacementEffect extends ReplacementEffectImpl { if (card != null) { if (controller.chooseUse(outcome, "Move " + card.getLogName() + " to exile to cast it by Madness?", source, game)) { controller.moveCardToExileWithInfo(card, source.getSourceId(), "Madness", source.getSourceId(), game, ((ZoneChangeEvent) event).getFromZone(), true); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.MADNESS_CARD_EXILED, card.getId(), card.getId(),controller.getId())); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.MADNESS_CARD_EXILED, card.getId(), card.getId(), controller.getId())); return true; } } } return false; } - + @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.ZONE_CHANGE; @@ -112,23 +113,24 @@ class MadnessReplacementEffect extends ReplacementEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { - return event.getTargetId().equals(source.getSourceId()) && - ((ZoneChangeEvent) event).getFromZone() == Zone.HAND && ((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD; + return event.getTargetId().equals(source.getSourceId()) + && ((ZoneChangeEvent) event).getFromZone() == Zone.HAND && ((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD; } } /** - * Checks for the MADNESS_CARD_EXILED event to ask the player - * if he wants to cast the card by it's Madness costs. - * If not, the card goes to the graveyard. + * Checks for the MADNESS_CARD_EXILED event to ask the player if he wants to + * cast the card by it's Madness costs. If not, the card goes to the graveyard. */ class MadnessTriggeredAbility extends TriggeredAbilityImpl { + //This array holds the Id's of all of the cards that activated madness - private static ArrayList activatedIds = new ArrayList(); - MadnessTriggeredAbility(ManaCosts madnessCost ) { + private static ArrayList activatedIds = new ArrayList<>(); + + MadnessTriggeredAbility(ManaCosts madnessCost) { super(Zone.EXILED, new MadnessCastEffect(madnessCost), true); - this.setRuleVisible(false); + this.setRuleVisible(false); } MadnessTriggeredAbility(final MadnessTriggeredAbility ability) { @@ -155,12 +157,12 @@ class MadnessTriggeredAbility extends TriggeredAbilityImpl { if (!super.resolve(game)) { Card card = game.getCard(getSourceId()); if (card != null) { - Player owner = game.getPlayer(card.getOwnerId()); + Player owner = game.getPlayer(card.getOwnerId()); if (owner != null) { // if cast was not successfull, the card is moved to graveyard owner.moveCards(card, Zone.EXILED, Zone.GRAVEYARD, this, game); } - } + } return false; } activatedIds.add(getSourceId()); @@ -168,13 +170,10 @@ class MadnessTriggeredAbility extends TriggeredAbilityImpl { } @Override - public boolean isActivated() - { + public boolean isActivated() { //Look through the list of activated Ids and see if the current source's Id is one of them - for(UUID currentId : activatedIds) - { - if(currentId.equals(getSourceId())) - { + for (UUID currentId : activatedIds) { + if (currentId.equals(getSourceId())) { //Remove the current source from the list, so if the card is somehow recast without //paying the madness cost, this will return false activatedIds.remove(currentId); @@ -184,7 +183,7 @@ class MadnessTriggeredAbility extends TriggeredAbilityImpl { //If the current source's Id was not found, return false return false; } - + @Override public String getRule() { return "When this card is exiled this way, " + super.getRule(); @@ -192,13 +191,13 @@ class MadnessTriggeredAbility extends TriggeredAbilityImpl { } class MadnessCastEffect extends OneShotEffect { - + private final ManaCosts madnessCost; - + public MadnessCastEffect(ManaCosts madnessCost) { super(Outcome.Benefit); this.madnessCost = madnessCost; - staticText = "cast it by paying " + madnessCost.getText() + " rather than paying its mana cost. If that player doesn’t, he or she puts this card into his or her graveyard."; + staticText = "cast it by paying " + madnessCost.getText() + " rather than paying its mana cost. If that player doesn’t, he or she puts this card into his or her graveyard."; } public MadnessCastEffect(final MadnessCastEffect effect) { @@ -212,7 +211,7 @@ class MadnessCastEffect extends OneShotEffect { Card card = game.getCard(source.getSourceId()); if (card != null) { owner = game.getPlayer(card.getOwnerId()); - } + } if (owner != null && card != null) { ManaCosts costRef = card.getSpellAbility().getManaCostsToPay(); // replace with the new cost