diff --git a/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java b/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java index 3609687e0d..ae21ed49ac 100644 --- a/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java @@ -1244,7 +1244,7 @@ public class ComputerPlayer> extends PlayerImpl i } @Override - public int chooseEffect(List rEffects, Game game) { + public int chooseEffect(List rEffects, Game game) { log.debug("chooseEffect"); //TODO: implement this return 0; diff --git a/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/SimulatedPlayerMCTS.java b/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/SimulatedPlayerMCTS.java index 64f0401fcf..bc63811200 100644 --- a/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/SimulatedPlayerMCTS.java +++ b/Mage.Server.Plugins/Mage.Player.AIMCTS/src/mage/player/ai/SimulatedPlayerMCTS.java @@ -374,7 +374,7 @@ public class SimulatedPlayerMCTS extends MCTSPlayer { } @Override - public int chooseEffect(List rEffects, Game game) { + public int chooseEffect(List rEffects, Game game) { if (this.isHuman()) return rnd.nextInt(rEffects.size()); return super.chooseEffect(rEffects, game); diff --git a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java index 6a5d52f81f..70820a49fa 100644 --- a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java +++ b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java @@ -155,12 +155,12 @@ public class HumanPlayer extends PlayerImpl { } @Override - public int chooseEffect(List rEffects, Game game) { + public int chooseEffect(List rEffects, Game game) { updateGameStatePriority("chooseEffect", game); replacementEffectChoice.getChoices().clear(); int count = 1; - for (ReplacementEffect effect: rEffects) { - replacementEffectChoice.getChoices().add(count + ". " + effect.getText(null)); + for (String effectText: rEffects) { + replacementEffectChoice.getChoices().add(count + ". " + effectText); count++; } if (replacementEffectChoice.getChoices().size() == 1) @@ -173,7 +173,7 @@ public class HumanPlayer extends PlayerImpl { replacementEffectChoice.setChoice(response.getString()); count = 1; for (int i = 0; i < rEffects.size(); i++) { - if (replacementEffectChoice.getChoice().equals(count + ". " + rEffects.get(i).getText(null))) + if (replacementEffectChoice.getChoice().equals(count + ". " + rEffects.get(i))) return i; count++; } diff --git a/Mage.Sets/src/mage/sets/antiquities/HurkylsRecall.java b/Mage.Sets/src/mage/sets/antiquities/HurkylsRecall.java new file mode 100644 index 0000000000..a0ff54f745 --- /dev/null +++ b/Mage.Sets/src/mage/sets/antiquities/HurkylsRecall.java @@ -0,0 +1,52 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.antiquities; + +import java.util.UUID; + +/** + * + * @author LevelX2 + */ +public class HurkylsRecall extends mage.sets.fifthedition.HurkylsRecall { + + public HurkylsRecall(UUID ownerId) { + super(ownerId); + this.cardNumber = 54; + this.expansionSetCode = "ATQ"; + } + + public HurkylsRecall(final HurkylsRecall card) { + super(card); + } + + @Override + public HurkylsRecall copy() { + return new HurkylsRecall(this); + } +} diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/GenjuOfTheCedars.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/GenjuOfTheCedars.java index 821c8a03b0..1e46401562 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/GenjuOfTheCedars.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/GenjuOfTheCedars.java @@ -79,7 +79,7 @@ public class GenjuOfTheCedars extends CardImpl { this.addAbility(ability2); // When enchanted Forest is put into a graveyard, you may return Genju of the Cedars from your graveyard to your hand. - Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandSourceEffect(), "enchanted Forest", true); + Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandSourceEffect(), "enchanted Forest", true, false); this.addAbility(ability3); } diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/GenjuOfTheFalls.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/GenjuOfTheFalls.java index e461340c1e..3c7b404d25 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/GenjuOfTheFalls.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/GenjuOfTheFalls.java @@ -80,7 +80,7 @@ public class GenjuOfTheFalls extends CardImpl { this.addAbility(ability2); // When enchanted Island is put into a graveyard, you may return Genju of the Falls from your graveyard to your hand. TargetPermanent auraTarget = new TargetLandPermanent(filter); - Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandSourceEffect(), "enchanted Island", true); + Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandSourceEffect(), "enchanted Island", true, false); this.addAbility(ability3); } diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/GenjuOfTheFens.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/GenjuOfTheFens.java index 505af0093f..638ccbcac7 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/GenjuOfTheFens.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/GenjuOfTheFens.java @@ -84,7 +84,7 @@ public class GenjuOfTheFens extends CardImpl { this.addAbility(ability2); // When enchanted Swamp is put into a graveyard, you may return Genju of the Fens from your graveyard to your hand. - Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandSourceEffect(), "enchanted Swamp", true); + Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandSourceEffect(), "enchanted Swamp", true, false); this.addAbility(ability3); } diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/GenjuOfTheFields.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/GenjuOfTheFields.java index 4f13f3f200..884dec6997 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/GenjuOfTheFields.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/GenjuOfTheFields.java @@ -82,7 +82,7 @@ public class GenjuOfTheFields extends CardImpl { this.addAbility(ability2); // When enchanted Plains is put into a graveyard, you may return Genju of the Fields from your graveyard to your hand. - Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandSourceEffect(), "enchanted Plains", true); + Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandSourceEffect(), "enchanted Plains", true, false); this.addAbility(ability3); } diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/GenjuOfTheRealm.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/GenjuOfTheRealm.java index 464342d21b..5ad1e49595 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/GenjuOfTheRealm.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/GenjuOfTheRealm.java @@ -80,7 +80,7 @@ public class GenjuOfTheRealm extends CardImpl { this.addAbility(ability2); // When enchanted land is put into a graveyard, you may return Genju of the Realm from your graveyard to your hand. - Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandSourceEffect(), "enchanted land", true); + Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandSourceEffect(), "enchanted land", true, false); this.addAbility(ability3); } diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/GenjuOfTheSpires.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/GenjuOfTheSpires.java index fe46718b7f..ee3df66693 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/GenjuOfTheSpires.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/GenjuOfTheSpires.java @@ -79,7 +79,7 @@ public class GenjuOfTheSpires extends CardImpl { this.addAbility(ability2); // When enchanted Mountain is put into a graveyard, you may return Genju of the Spires from your graveyard to your hand. - Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandSourceEffect(), "enchanted Mountain", true); + Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandSourceEffect(), "enchanted Mountain", true, false); this.addAbility(ability3); } diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/GodsEyeGateToTheReikai.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/GodsEyeGateToTheReikai.java index 59a06039e2..af159c7749 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/GodsEyeGateToTheReikai.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/GodsEyeGateToTheReikai.java @@ -31,6 +31,7 @@ import java.util.UUID; import mage.Constants.CardType; import mage.Constants.Rarity; import mage.abilities.common.DiesTriggeredAbility; +import mage.abilities.common.PutIntoGraveFromBattlefieldTriggeredAbility; import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.mana.ColorlessManaAbility; import mage.cards.CardImpl; @@ -49,7 +50,7 @@ public class GodsEyeGateToTheReikai extends CardImpl { // {tap}: Add {1} to your mana pool. this.addAbility(new ColorlessManaAbility()); // When Gods' Eye, Gate to the Reikai is put into a graveyard from the battlefield, put a 1/1 colorless Spirit creature token onto the battlefield. - this.addAbility(new DiesTriggeredAbility(new CreateTokenEffect(new SpiritToken(), 1), false)); + this.addAbility(new PutIntoGraveFromBattlefieldTriggeredAbility(new CreateTokenEffect(new SpiritToken(), 1), false)); } public GodsEyeGateToTheReikai(final GodsEyeGateToTheReikai card) { diff --git a/Mage.Sets/src/mage/sets/coldsnap/MartyrOfSands.java b/Mage.Sets/src/mage/sets/coldsnap/MartyrOfSands.java new file mode 100644 index 0000000000..5291c9ecca --- /dev/null +++ b/Mage.Sets/src/mage/sets/coldsnap/MartyrOfSands.java @@ -0,0 +1,130 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.coldsnap; + +import java.util.UUID; +import mage.Constants.CardType; +import mage.Constants.Outcome; +import mage.Constants.Rarity; +import mage.Constants.Zone; +import mage.MageInt; +import mage.ObjectColor; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.Cost; +import mage.abilities.costs.common.RevealTargetFromHandCost; +import mage.abilities.costs.common.SacrificeSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.filter.FilterCard; +import mage.filter.predicate.mageobject.ColorPredicate; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetCardInHand; + +/** + * + * @author LevelX2 + */ +public class MartyrOfSands extends CardImpl { + + private static final FilterCard filter = new FilterCard("X white cards from your hand"); + static { + filter.add(new ColorPredicate(ObjectColor.WHITE)); + } + + public MartyrOfSands(UUID ownerId) { + super(ownerId, 15, "Martyr of Sands", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{W}"); + this.expansionSetCode = "CSP"; + this.subtype.add("Human"); + this.subtype.add("Cleric"); + + this.color.setWhite(true); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // {1}, Reveal X white cards from your hand, Sacrifice Martyr of Sands: You gain three times X life. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new MartyrOfSandsEffect(), new ManaCostsImpl("{1}")); + ability.addCost(new RevealTargetFromHandCost(new TargetCardInHand(0,Integer.MAX_VALUE, filter))); + ability.addCost(new SacrificeSourceCost()); + this.addAbility(ability); + } + + public MartyrOfSands(final MartyrOfSands card) { + super(card); + } + + @Override + public MartyrOfSands copy() { + return new MartyrOfSands(this); + } +} + +class MartyrOfSandsEffect extends OneShotEffect { + + public MartyrOfSandsEffect() { + super(Outcome.GainLife); + this.staticText = "You gain three times X life"; + } + + public MartyrOfSandsEffect(final MartyrOfSandsEffect effect) { + super(effect); + } + + @Override + public MartyrOfSandsEffect copy() { + return new MartyrOfSandsEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + RevealTargetFromHandCost revealCost = null; + for (Cost cost : source.getCosts()) { + if (cost instanceof RevealTargetFromHandCost) { + revealCost = (RevealTargetFromHandCost) cost; + } + } + + Player controller = game.getPlayer(source.getControllerId()); + Card sourceCard = game.getCard(source.getSourceId()); + if (controller != null && sourceCard != null && revealCost != null) { + int live = revealCost.getNumberRevealedCards() * 3; + if (live > 0) { + controller.gainLife(live, game); + } + game.informPlayers(new StringBuilder(sourceCard.getName()) + .append(": ").append(controller.getName()).append(" revealed ") + .append(revealCost.getNumberRevealedCards()).append(revealCost.getNumberRevealedCards() == 1 ?"white card":"white cards") + .append(" and gained ").append(live).append(" live").toString()); + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/fifthedition/HurkylsRecall.java b/Mage.Sets/src/mage/sets/fifthedition/HurkylsRecall.java new file mode 100644 index 0000000000..8c83cc8f28 --- /dev/null +++ b/Mage.Sets/src/mage/sets/fifthedition/HurkylsRecall.java @@ -0,0 +1,99 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.fifthedition; + +import java.util.UUID; +import mage.Constants.CardType; +import mage.Constants.Outcome; +import mage.Constants.Rarity; +import mage.Constants.Zone; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.filter.common.FilterArtifactPermanent; +import mage.filter.predicate.permanent.ControllerIdPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.TargetPlayer; + +/** + * + * @author LevelX2 + */ +public class HurkylsRecall extends CardImpl { + + public HurkylsRecall(UUID ownerId) { + super(ownerId, 93, "Hurkyl's Recall", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{1}{U}"); + this.expansionSetCode = "5ED"; + + this.color.setBlue(true); + + // Return all artifacts target player owns to his or her hand. + this.getSpellAbility().addEffect(new HurkylsRecallReturnToHandEffect()); + this.getSpellAbility().addTarget(new TargetPlayer(true)); + } + + public HurkylsRecall(final HurkylsRecall card) { + super(card); + } + + @Override + public HurkylsRecall copy() { + return new HurkylsRecall(this); + } +} + +class HurkylsRecallReturnToHandEffect extends OneShotEffect { + + public HurkylsRecallReturnToHandEffect() { + super(Outcome.ReturnToHand); + staticText = "Return all artifacts target player owns to his or her hand"; + } + + public HurkylsRecallReturnToHandEffect(final HurkylsRecallReturnToHandEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + if (targetPointer.getFirst(game, source) != null) { + FilterArtifactPermanent filter = new FilterArtifactPermanent(); + filter.add(new ControllerIdPredicate(targetPointer.getFirst(game, source))); + for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { + permanent.moveToZone(Zone.HAND, source.getSourceId(), game, true); + } + return true; + } + return false; + } + + @Override + public HurkylsRecallReturnToHandEffect copy() { + return new HurkylsRecallReturnToHandEffect(this); + } +} diff --git a/Mage.Sets/src/mage/sets/fourthedition/HurkylsRecall.java b/Mage.Sets/src/mage/sets/fourthedition/HurkylsRecall.java new file mode 100644 index 0000000000..d20ec81488 --- /dev/null +++ b/Mage.Sets/src/mage/sets/fourthedition/HurkylsRecall.java @@ -0,0 +1,52 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.fourthedition; + +import java.util.UUID; + +/** + * + * @author LevelX2 + */ +public class HurkylsRecall extends mage.sets.fifthedition.HurkylsRecall { + + public HurkylsRecall(UUID ownerId) { + super(ownerId); + this.cardNumber = 77; + this.expansionSetCode = "4ED"; + } + + public HurkylsRecall(final HurkylsRecall card) { + super(card); + } + + @Override + public HurkylsRecall copy() { + return new HurkylsRecall(this); + } +} diff --git a/Mage.Sets/src/mage/sets/guildpact/HatchingPlans.java b/Mage.Sets/src/mage/sets/guildpact/HatchingPlans.java index 0622c951ec..288a9fc580 100644 --- a/Mage.Sets/src/mage/sets/guildpact/HatchingPlans.java +++ b/Mage.Sets/src/mage/sets/guildpact/HatchingPlans.java @@ -32,6 +32,7 @@ import java.util.UUID; import mage.Constants.CardType; import mage.Constants.Rarity; import mage.abilities.common.DiesTriggeredAbility; +import mage.abilities.common.PutIntoGraveFromBattlefieldTriggeredAbility; import mage.abilities.effects.common.DrawCardControllerEffect; import mage.cards.CardImpl; @@ -45,7 +46,7 @@ public class HatchingPlans extends CardImpl { super(ownerId, 27, "Hatching Plans", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}"); this.expansionSetCode = "GPT"; this.color.setBlue(true); - this.addAbility(new DiesTriggeredAbility(new DrawCardControllerEffect(3))); + this.addAbility(new PutIntoGraveFromBattlefieldTriggeredAbility(new DrawCardControllerEffect(3))); } public HatchingPlans (final HatchingPlans card) { diff --git a/Mage.Sets/src/mage/sets/innistrad/EssenceOfTheWild.java b/Mage.Sets/src/mage/sets/innistrad/EssenceOfTheWild.java index eaac62921f..5652af3495 100644 --- a/Mage.Sets/src/mage/sets/innistrad/EssenceOfTheWild.java +++ b/Mage.Sets/src/mage/sets/innistrad/EssenceOfTheWild.java @@ -78,7 +78,7 @@ public class EssenceOfTheWild extends CardImpl { class EssenceOfTheWildEffect extends ReplacementEffectImpl { public EssenceOfTheWildEffect() { - super(Duration.WhileOnBattlefield, Outcome.Copy); + super(Duration.WhileOnBattlefield, Outcome.Copy, false); staticText = "Creatures you control enter the battlefield as a copy of {this}"; } diff --git a/Mage.Sets/src/mage/sets/innistrad/EvilTwin.java b/Mage.Sets/src/mage/sets/innistrad/EvilTwin.java index 743f8740c8..ef626d119c 100644 --- a/Mage.Sets/src/mage/sets/innistrad/EvilTwin.java +++ b/Mage.Sets/src/mage/sets/innistrad/EvilTwin.java @@ -71,7 +71,8 @@ public class EvilTwin extends CardImpl { this.addAbility(new SimpleStaticAbility( Zone.BATTLEFIELD, new EntersBattlefieldEffect(new CopyPermanentEffect(new EvilTwinApplyToPermanent()), - "You may have {this} enter the battlefield as a copy of any creature on the battlefield except it gains \"{U}{B}, {T}: Destroy target creature with the same name as this creature\""))); + "You may have {this} enter the battlefield as a copy of any creature on the battlefield except it gains \"{U}{B}, {T}: Destroy target creature with the same name as this creature\"", + true))); } public EvilTwin(final EvilTwin card) { diff --git a/Mage.Sets/src/mage/sets/lorwyn/DoranTheSiegeTower.java b/Mage.Sets/src/mage/sets/lorwyn/DoranTheSiegeTower.java new file mode 100644 index 0000000000..10912677ed --- /dev/null +++ b/Mage.Sets/src/mage/sets/lorwyn/DoranTheSiegeTower.java @@ -0,0 +1,140 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.lorwyn; + +import java.util.UUID; +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Outcome; +import mage.Constants.Rarity; +import mage.Constants.Zone; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ReplacementEffectImpl; +import mage.cards.CardImpl; +import mage.game.Game; +import mage.game.events.DamageCreatureEvent; +import mage.game.events.DamagePlaneswalkerEvent; +import mage.game.events.DamagePlayerEvent; +import mage.game.events.GameEvent; +import static mage.game.events.GameEvent.EventType.DAMAGE_PLANESWALKER; +import mage.game.permanent.Permanent; + +/** + * + * @author LevelX2 + */ +public class DoranTheSiegeTower extends CardImpl { + + public DoranTheSiegeTower(UUID ownerId) { + super(ownerId, 247, "Doran, the Siege Tower", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{B}{G}{W}"); + this.expansionSetCode = "LRW"; + this.supertype.add("Legendary"); + this.subtype.add("Treefolk"); + this.subtype.add("Shaman"); + + this.color.setGreen(true); + this.color.setBlack(true); + this.color.setWhite(true); + this.power = new MageInt(0); + this.toughness = new MageInt(5); + + // Each creature assigns combat damage equal to its toughness rather than its power. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new DoranTheSiegeTowerEffect())); + } + + public DoranTheSiegeTower(final DoranTheSiegeTower card) { + super(card); + } + + @Override + public DoranTheSiegeTower copy() { + return new DoranTheSiegeTower(this); + } +} + +class DoranTheSiegeTowerEffect extends ReplacementEffectImpl { + + public DoranTheSiegeTowerEffect() { + super(Constants.Duration.WhileOnBattlefield, Outcome.Damage); + staticText = "Each creature assigns combat damage equal to its toughness rather than its power"; + } + + public DoranTheSiegeTowerEffect(final DoranTheSiegeTowerEffect effect) { + super(effect); + } + + @Override + public DoranTheSiegeTowerEffect copy() { + return new DoranTheSiegeTowerEffect(this); + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + switch (event.getType()) { + case DAMAGE_PLAYER: + if (((DamagePlayerEvent) event).isCombatDamage() && + (event.getAppliedEffects() == null || !event.getAppliedEffects().contains(this.getId()))) { + event.getAppliedEffects().add(this.getId()); + return true; + } + break; + case DAMAGE_PLANESWALKER: + if (((DamagePlaneswalkerEvent) event).isCombatDamage() && + (event.getAppliedEffects() == null || !event.getAppliedEffects().contains(this.getId()))) { + event.getAppliedEffects().add(this.getId()); + return true; + } + break; + case DAMAGE_CREATURE: + if (((DamageCreatureEvent) event).isCombatDamage() && + (event.getAppliedEffects() == null || !event.getAppliedEffects().contains(this.getId()))) { + event.getAppliedEffects().add(this.getId()); + return true; + } + break; + } + return false; + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + Permanent permanent = game.getPermanent(event.getSourceId()); + if (permanent != null) { + event.setAmount(permanent.getToughness().getValue()); + } + return false; + } + +} diff --git a/Mage.Sets/src/mage/sets/magic2012/PhantasmalImage.java b/Mage.Sets/src/mage/sets/magic2012/PhantasmalImage.java index 6058c8ae47..332a23446e 100644 --- a/Mage.Sets/src/mage/sets/magic2012/PhantasmalImage.java +++ b/Mage.Sets/src/mage/sets/magic2012/PhantasmalImage.java @@ -65,7 +65,8 @@ public class PhantasmalImage extends CardImpl { this.power = new MageInt(0); this.toughness = new MageInt(0); - Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new EntersBattlefieldEffect(new PhantasmalImageCopyEffect(), abilityText)); + Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new EntersBattlefieldEffect( + new PhantasmalImageCopyEffect(), abilityText, true)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/newphyrexia/GlisteningOil.java b/Mage.Sets/src/mage/sets/newphyrexia/GlisteningOil.java index 01860ac995..21b659946c 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/GlisteningOil.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/GlisteningOil.java @@ -35,6 +35,7 @@ import mage.Constants.Rarity; import mage.abilities.Ability; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.DiesTriggeredAbility; +import mage.abilities.common.PutIntoGraveFromBattlefieldTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.AttachEffect; @@ -67,7 +68,7 @@ public class GlisteningOil extends CardImpl { this.addAbility(ability); this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityAttachedEffect(InfectAbility.getInstance(), Constants.AttachmentType.AURA))); this.addAbility(new BeginningOfUpkeepTriggeredAbility(new GlisteningOilEffect(), Constants.TargetController.YOU, false)); - this.addAbility(new DiesTriggeredAbility(new ReturnToHandSourceEffect())); + this.addAbility(new PutIntoGraveFromBattlefieldTriggeredAbility(new ReturnToHandSourceEffect())); } public GlisteningOil(final GlisteningOil card) { diff --git a/Mage.Sets/src/mage/sets/newphyrexia/PhyrexianMetamorph.java b/Mage.Sets/src/mage/sets/newphyrexia/PhyrexianMetamorph.java index 929c73c2f9..3bb96fe576 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/PhyrexianMetamorph.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/PhyrexianMetamorph.java @@ -62,7 +62,11 @@ public class PhyrexianMetamorph extends CardImpl { this.color.setBlue(true); this.power = new MageInt(0); this.toughness = new MageInt(0); - Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new EntersBattlefieldEffect(new PhyrexianMetamorphEffect(), "You may have {this} enter the battlefield as a copy of any artifact or creature on the battlefield, except it's an artifact in addition to its other types")); + + Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new EntersBattlefieldEffect( + new PhyrexianMetamorphEffect(), + "You may have {this} enter the battlefield as a copy of any artifact or creature on the battlefield, except it's an artifact in addition to its other types", + true)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/newphyrexia/TorporOrb.java b/Mage.Sets/src/mage/sets/newphyrexia/TorporOrb.java index 4b5de3c87c..b6cae658c0 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/TorporOrb.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/TorporOrb.java @@ -67,7 +67,7 @@ public class TorporOrb extends CardImpl { class TorporOrbEffect extends ReplacementEffectImpl { TorporOrbEffect() { - super(Duration.WhileOnBattlefield, Outcome.Detriment); + super(Duration.WhileOnBattlefield, Outcome.Detriment, false); staticText = "Creatures entering the battlefield don't cause abilities to trigger"; } diff --git a/Mage.Sets/src/mage/sets/newphyrexia/ViridianHarvest.java b/Mage.Sets/src/mage/sets/newphyrexia/ViridianHarvest.java index 12c2db2bdc..adff24c7df 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/ViridianHarvest.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/ViridianHarvest.java @@ -60,7 +60,7 @@ public class ViridianHarvest extends CardImpl { Ability ability = new EnchantAbility(auraTarget.getTargetName()); this.addAbility(ability); - this.addAbility(new DiesAttachedTriggeredAbility(new GainLifeEffect(6), "enchanted artifact")); + this.addAbility(new DiesAttachedTriggeredAbility(new GainLifeEffect(6), "enchanted artifact", false, false)); } public ViridianHarvest(final ViridianHarvest card) { diff --git a/Mage.Sets/src/mage/sets/planechase2012/SakashimasStudent.java b/Mage.Sets/src/mage/sets/planechase2012/SakashimasStudent.java index fa7104defd..984394eef5 100644 --- a/Mage.Sets/src/mage/sets/planechase2012/SakashimasStudent.java +++ b/Mage.Sets/src/mage/sets/planechase2012/SakashimasStudent.java @@ -28,9 +28,9 @@ package mage.sets.planechase2012; import java.util.UUID; -import mage.Constants; import mage.Constants.CardType; import mage.Constants.Rarity; +import mage.Constants.Zone; import mage.MageInt; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.mana.ManaCostsImpl; @@ -61,10 +61,10 @@ public class SakashimasStudent extends CardImpl { // Ninjutsu {1}{U} this.addAbility(new NinjutsuAbility(new ManaCostsImpl("{1}{U}"))); // You may have Sakashima's Student enter the battlefield as a copy of any creature on the battlefield, except it's still a Ninja in addition to its other creature types. - this.addAbility(new SimpleStaticAbility( - Constants.Zone.BATTLEFIELD, - new EntersBattlefieldEffect(new CopyPermanentEffect(new SakashimasStudentApplyToPermanent()), - "You may have {this} enter the battlefield as a copy of any creature on the battlefield, except it's still a Ninja in addition to its other creature types"))); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,new EntersBattlefieldEffect( + new CopyPermanentEffect(new SakashimasStudentApplyToPermanent()), + "You may have {this} enter the battlefield as a copy of any creature on the battlefield, except it's still a Ninja in addition to its other creature types", + true))); } diff --git a/Mage.Sets/src/mage/sets/revisededition/HurkylsRecall.java b/Mage.Sets/src/mage/sets/revisededition/HurkylsRecall.java new file mode 100644 index 0000000000..a5061b7757 --- /dev/null +++ b/Mage.Sets/src/mage/sets/revisededition/HurkylsRecall.java @@ -0,0 +1,52 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.revisededition; + +import java.util.UUID; + +/** + * + * @author LevelX2 + */ +public class HurkylsRecall extends mage.sets.fifthedition.HurkylsRecall { + + public HurkylsRecall(UUID ownerId) { + super(ownerId); + this.cardNumber = 60; + this.expansionSetCode = "3ED"; + } + + public HurkylsRecall(final HurkylsRecall card) { + super(card); + } + + @Override + public HurkylsRecall copy() { + return new HurkylsRecall(this); + } +} diff --git a/Mage.Sets/src/mage/sets/shadowmoor/AuguryAdept.java b/Mage.Sets/src/mage/sets/shadowmoor/AuguryAdept.java new file mode 100644 index 0000000000..177510c7df --- /dev/null +++ b/Mage.Sets/src/mage/sets/shadowmoor/AuguryAdept.java @@ -0,0 +1,115 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.shadowmoor; + +import java.util.UUID; +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Outcome; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.game.Game; +import mage.players.Player; + +/** + * + * @author LevelX2 + */ +public class AuguryAdept extends CardImpl { + + public AuguryAdept(UUID ownerId) { + super(ownerId, 137, "Augury Adept", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{1}{W/U}{W/U}"); + this.expansionSetCode = "SHM"; + this.subtype.add("Kithkin"); + this.subtype.add("Wizard"); + + this.color.setBlue(true); + this.color.setWhite(true); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Whenever Augury Adept deals combat damage to a player, reveal the top card of your library and put that card into your hand. You gain life equal to its converted mana cost. + this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new AuguryAdeptEffect(), false)); + } + + public AuguryAdept(final AuguryAdept card) { + super(card); + } + + @Override + public AuguryAdept copy() { + return new AuguryAdept(this); + } +} + +class AuguryAdeptEffect extends OneShotEffect { + + public AuguryAdeptEffect() { + super(Outcome.GainLife); + this.staticText = "reveal the top card of your library and put that card into your hand. You gain life equal to its converted mana cost"; + } + + public AuguryAdeptEffect(final AuguryAdeptEffect effect) { + super(effect); + } + + @Override + public AuguryAdeptEffect copy() { + return new AuguryAdeptEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Card sourceCard = game.getCard(source.getSourceId()); + Player player = game.getPlayer(source.getControllerId()); + if (player == null || sourceCard == null) { + return false; + } + Cards cards = new CardsImpl(); + Card card = player.getLibrary().removeFromTop(game); + if (card != null) { + card.moveToZone(Constants.Zone.HAND, source.getSourceId(), game, true); + + int cmc = card.getManaCost().convertedManaCost(); + if (cmc > 0) { + player.gainLife(cmc, game); + } + cards.add(card); + player.revealCards(sourceCard.getName(), cards, game); + game.informPlayers(sourceCard.getName() + ": "+ player.getName() + " revealed " +card.getName() + " and gained " + cmc + " live"); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/shardsofalara/SigilOfDistinction.java b/Mage.Sets/src/mage/sets/shardsofalara/SigilOfDistinction.java index ec4cfbe1fa..1baf6c11e4 100644 --- a/Mage.Sets/src/mage/sets/shardsofalara/SigilOfDistinction.java +++ b/Mage.Sets/src/mage/sets/shardsofalara/SigilOfDistinction.java @@ -28,6 +28,7 @@ package mage.sets.shardsofalara; +import java.util.UUID; import mage.Constants.CardType; import mage.Constants.Outcome; import mage.Constants.Rarity; @@ -47,7 +48,6 @@ import mage.counters.CounterType; import mage.game.Game; import mage.game.permanent.Permanent; -import java.util.UUID; /** * @author Loki @@ -58,10 +58,17 @@ public class SigilOfDistinction extends CardImpl { super(ownerId, 219, "Sigil of Distinction", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{X}"); this.expansionSetCode = "ALA"; this.subtype.add("Equipment"); + + // Sigil of Distinction enters the battlefield with X charge counters on it. this.addAbility(new EntersBattlefieldAbility(new SigilOfDistinctionEffect(), "{this} enters the battlefield with X charge counters on it")); - this.addAbility(new EquipAbility(Outcome.AddAbility, new RemoveCountersSourceCost(CounterType.CHARGE.createInstance()))); + + // Equipped creature gets +1/+1 for each charge counter on Sigil of Distinction. BoostEquippedEffect effect = new BoostEquippedEffect(new CountersCount(CounterType.CHARGE), new CountersCount(CounterType.CHARGE)); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); + + // Equip—Remove a charge counter from Sigil of Distinction. + this.addAbility(new EquipAbility(Outcome.AddAbility, new RemoveCountersSourceCost(CounterType.CHARGE.createInstance()))); + } public SigilOfDistinction(final SigilOfDistinction card) { @@ -103,4 +110,4 @@ class SigilOfDistinctionEffect extends OneShotEffect { public SigilOfDistinctionEffect copy() { return new SigilOfDistinctionEffect(this); } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/tenth/Clone.java b/Mage.Sets/src/mage/sets/tenth/Clone.java index 3107d0d7f5..3b130f692c 100644 --- a/Mage.Sets/src/mage/sets/tenth/Clone.java +++ b/Mage.Sets/src/mage/sets/tenth/Clone.java @@ -53,7 +53,10 @@ public class Clone extends CardImpl { this.power = new MageInt(0); this.toughness = new MageInt(0); - Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new EntersBattlefieldEffect(new CopyPermanentEffect(), "You may have {this} enter the battlefield as a copy of any creature on the battlefield")); + Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new EntersBattlefieldEffect( + new CopyPermanentEffect(), + "You may have {this} enter the battlefield as a copy of any creature on the battlefield", + true)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/tenth/HurkylsRecall.java b/Mage.Sets/src/mage/sets/tenth/HurkylsRecall.java new file mode 100644 index 0000000000..6bfa57bc43 --- /dev/null +++ b/Mage.Sets/src/mage/sets/tenth/HurkylsRecall.java @@ -0,0 +1,52 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.tenth; + +import java.util.UUID; + +/** + * + * @author LevelX2 + */ +public class HurkylsRecall extends mage.sets.fifthedition.HurkylsRecall { + + public HurkylsRecall(UUID ownerId) { + super(ownerId); + this.cardNumber = 88; + this.expansionSetCode = "10E"; + } + + public HurkylsRecall(final HurkylsRecall card) { + super(card); + } + + @Override + public HurkylsRecall copy() { + return new HurkylsRecall(this); + } +} diff --git a/Mage.Sets/src/mage/sets/tenth/SculptingSteel.java b/Mage.Sets/src/mage/sets/tenth/SculptingSteel.java index cf57c76d90..100a4482d7 100644 --- a/Mage.Sets/src/mage/sets/tenth/SculptingSteel.java +++ b/Mage.Sets/src/mage/sets/tenth/SculptingSteel.java @@ -56,7 +56,10 @@ public class SculptingSteel extends CardImpl { this.expansionSetCode = "10E"; // You may have Sculpting Steel enter the battlefield as a copy of any artifact on the battlefield. - Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new EntersBattlefieldEffect(new CopyPermanentEffect(filter), "You may have {this} enter the battlefield as a copy of any artifact on the battlefield")); + Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new EntersBattlefieldEffect( + new CopyPermanentEffect(filter), + "You may have {this} enter the battlefield as a copy of any artifact on the battlefield", + true)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/timespiral/FlagstonesOfTrokair.java b/Mage.Sets/src/mage/sets/timespiral/FlagstonesOfTrokair.java new file mode 100644 index 0000000000..325ce7c119 --- /dev/null +++ b/Mage.Sets/src/mage/sets/timespiral/FlagstonesOfTrokair.java @@ -0,0 +1,74 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.timespiral; + +import java.util.UUID; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.abilities.common.DiesTriggeredAbility; +import mage.abilities.common.PutIntoGraveFromBattlefieldTriggeredAbility; +import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect; +import mage.abilities.mana.WhiteManaAbility; +import mage.cards.CardImpl; +import mage.filter.common.FilterBasicLandCard; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.target.common.TargetCardInLibrary; + +/** + * + * @author LevelX2 + */ +public class FlagstonesOfTrokair extends CardImpl { + + private static final FilterBasicLandCard filter = new FilterBasicLandCard(); + + static { + filter.add(new SubtypePredicate("Plains")); + } + + public FlagstonesOfTrokair(UUID ownerId) { + super(ownerId, 272, "Flagstones of Trokair", Rarity.RARE, new CardType[]{CardType.LAND}, ""); + this.expansionSetCode = "TSP"; + this.supertype.add("Legendary"); + + // {tap}: Add {W} to your mana pool. + this.addAbility(new WhiteManaAbility()); + + // When Flagstones of Trokair is put into a graveyard from the battlefield, you may search your library for a Plains card and put it onto the battlefield tapped. If you do, shuffle your library. + this.addAbility(new PutIntoGraveFromBattlefieldTriggeredAbility(new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter), true, true), true)); + } + + public FlagstonesOfTrokair(final FlagstonesOfTrokair card) { + super(card); + } + + @Override + public FlagstonesOfTrokair copy() { + return new FlagstonesOfTrokair(this); + } +} diff --git a/Mage.Sets/src/mage/sets/timespiral/Vesuva.java b/Mage.Sets/src/mage/sets/timespiral/Vesuva.java index 3617786d9d..9e06877aa6 100644 --- a/Mage.Sets/src/mage/sets/timespiral/Vesuva.java +++ b/Mage.Sets/src/mage/sets/timespiral/Vesuva.java @@ -56,7 +56,10 @@ public class Vesuva extends CardImpl { this.expansionSetCode = "TSP"; // You may have Vesuva enter the battlefield tapped as a copy of any land on the battlefield. - EntersBattlefieldEffect effect = new EntersBattlefieldEffect(new TapSourceEffect(true), "You may have {this} enter the battlefield tapped as a copy of any land on the battlefield"); + EntersBattlefieldEffect effect = new EntersBattlefieldEffect( + new TapSourceEffect(true), + "You may have {this} enter the battlefield tapped as a copy of any land on the battlefield", + true); effect.addEffect(new CopyPermanentEffect(filter)); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); } diff --git a/Mage.Sets/src/mage/sets/urzaslegacy/Cessation.java b/Mage.Sets/src/mage/sets/urzaslegacy/Cessation.java index 4f5bc00c02..17122a3356 100644 --- a/Mage.Sets/src/mage/sets/urzaslegacy/Cessation.java +++ b/Mage.Sets/src/mage/sets/urzaslegacy/Cessation.java @@ -34,6 +34,7 @@ import mage.Constants.CardType; import mage.Constants.Rarity; import mage.abilities.Ability; import mage.abilities.common.DiesTriggeredAbility; +import mage.abilities.common.PutIntoGraveFromBattlefieldTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.RestrictionEffect; import mage.abilities.effects.common.AttachEffect; @@ -66,7 +67,7 @@ public class Cessation extends CardImpl { this.addAbility(ability); this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new CessationEffect())); //When Cessation is put into a graveyard from the battlefield, return Cessation to its owner's hand. - this.addAbility(new DiesTriggeredAbility(new ReturnToHandSourceEffect())); + this.addAbility(new PutIntoGraveFromBattlefieldTriggeredAbility(new ReturnToHandSourceEffect())); } public Cessation(final Cessation card) { diff --git a/Mage.Sets/src/mage/sets/worldwake/CorruptedZendikon.java b/Mage.Sets/src/mage/sets/worldwake/CorruptedZendikon.java index 6ef6f90b8b..88b3b333d4 100644 --- a/Mage.Sets/src/mage/sets/worldwake/CorruptedZendikon.java +++ b/Mage.Sets/src/mage/sets/worldwake/CorruptedZendikon.java @@ -70,7 +70,7 @@ public class CorruptedZendikon extends CardImpl { Ability ability2 = new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new BecomesCreatureAttachedEffect(new OozeToken(), "Enchanted land is a 3/3 black Ooze creature. It's still a land.", Constants.Duration.Custom)); this.addAbility(ability2); - Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandAttachedEffect(), "enchanted land"); + Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandAttachedEffect(), "enchanted land", false, false); this.addAbility(ability3); } diff --git a/Mage.Sets/src/mage/sets/worldwake/CrusherZendikon.java b/Mage.Sets/src/mage/sets/worldwake/CrusherZendikon.java index 5b0986a273..caf0b13282 100644 --- a/Mage.Sets/src/mage/sets/worldwake/CrusherZendikon.java +++ b/Mage.Sets/src/mage/sets/worldwake/CrusherZendikon.java @@ -71,7 +71,7 @@ public class CrusherZendikon extends CardImpl { Ability ability2 = new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new BecomesCreatureAttachedEffect(new BeastToken(), "Enchanted land is a 4/2 red Beast creature with trample. It's still a land.", Constants.Duration.Custom)); this.addAbility(ability2); - Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandAttachedEffect(), "enchanted land"); + Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandAttachedEffect(), "enchanted land", false, false); this.addAbility(ability3); } diff --git a/Mage.Sets/src/mage/sets/worldwake/GuardianZendikon.java b/Mage.Sets/src/mage/sets/worldwake/GuardianZendikon.java index a9f215b0e8..88f315f64a 100644 --- a/Mage.Sets/src/mage/sets/worldwake/GuardianZendikon.java +++ b/Mage.Sets/src/mage/sets/worldwake/GuardianZendikon.java @@ -71,7 +71,7 @@ public class GuardianZendikon extends CardImpl { Ability ability2 = new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new BecomesCreatureAttachedEffect(new WallToken(), "Enchanted land is a 2/6 white wall creature with defender. It's still a land", Constants.Duration.Custom)); this.addAbility(ability2); - Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandAttachedEffect(), "enchanted land"); + Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandAttachedEffect(), "enchanted land", false, false); this.addAbility(ability3); } diff --git a/Mage.Sets/src/mage/sets/worldwake/JwariShapeshifter.java b/Mage.Sets/src/mage/sets/worldwake/JwariShapeshifter.java index 840d2b0263..84f80566f6 100644 --- a/Mage.Sets/src/mage/sets/worldwake/JwariShapeshifter.java +++ b/Mage.Sets/src/mage/sets/worldwake/JwariShapeshifter.java @@ -28,9 +28,9 @@ package mage.sets.worldwake; import java.util.UUID; -import mage.Constants; import mage.Constants.CardType; import mage.Constants.Rarity; +import mage.Constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; @@ -40,6 +40,7 @@ import mage.cards.CardImpl; import mage.filter.FilterPermanent; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.filter.predicate.permanent.AnotherPredicate; /** * @@ -52,6 +53,7 @@ public class JwariShapeshifter extends CardImpl { static { filter.add(new SubtypePredicate("Ally")); filter.add(new CardTypePredicate(CardType.CREATURE)); + filter.add(new AnotherPredicate()); // needed because during enters_the_battlefield event the creature is already targetable although it shouldn't } public JwariShapeshifter(UUID ownerId) { @@ -65,7 +67,10 @@ public class JwariShapeshifter extends CardImpl { this.toughness = new MageInt(0); // You may have Jwari Shapeshifter enter the battlefield as a copy of any Ally creature on the battlefield. - Ability ability = new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new EntersBattlefieldEffect(new CopyPermanentEffect(filter), "You may have {this} enter the battlefield as a copy of any Ally creature on the battlefield")); + Ability ability = new SimpleStaticAbility( + Zone.BATTLEFIELD, + new EntersBattlefieldEffect(new CopyPermanentEffect(filter), null, + "You may have {this} enter the battlefield as a copy of any Ally creature on the battlefield", true, true)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/worldwake/VastwoodZendikon.java b/Mage.Sets/src/mage/sets/worldwake/VastwoodZendikon.java index 3b79595431..9824748e5a 100644 --- a/Mage.Sets/src/mage/sets/worldwake/VastwoodZendikon.java +++ b/Mage.Sets/src/mage/sets/worldwake/VastwoodZendikon.java @@ -70,7 +70,7 @@ public class VastwoodZendikon extends CardImpl { Ability ability2 = new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new BecomesCreatureAttachedEffect(new VastwoodElementalToken(), "Enchanted land is a 6/4 green Elemental creature. It's still a land", Constants.Duration.Custom)); this.addAbility(ability2); - Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandAttachedEffect(), "enchanted land"); + Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandAttachedEffect(), "enchanted land", false, false); this.addAbility(ability3); } diff --git a/Mage.Sets/src/mage/sets/worldwake/WindZendikon.java b/Mage.Sets/src/mage/sets/worldwake/WindZendikon.java index 0df1d3ec73..a525a34a4e 100644 --- a/Mage.Sets/src/mage/sets/worldwake/WindZendikon.java +++ b/Mage.Sets/src/mage/sets/worldwake/WindZendikon.java @@ -71,7 +71,7 @@ public class WindZendikon extends CardImpl { Ability ability2 = new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new BecomesCreatureAttachedEffect(new ElementalToken(), "Enchanted land is a 2/2 blue Elemental creature with flying. It's still a land", Constants.Duration.Custom)); this.addAbility(ability2); - Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandAttachedEffect(), "enchanted land"); + Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandAttachedEffect(), "enchanted land", false, false); this.addAbility(ability3); } diff --git a/Mage.Sets/src/mage/sets/zendikar/KabiraEvangel.java b/Mage.Sets/src/mage/sets/zendikar/KabiraEvangel.java index 15c17dab91..836cc3cbd2 100644 --- a/Mage.Sets/src/mage/sets/zendikar/KabiraEvangel.java +++ b/Mage.Sets/src/mage/sets/zendikar/KabiraEvangel.java @@ -109,8 +109,7 @@ class ChooseColorEffect extends OneShotEffect { ChoiceColor colorChoice = new ChoiceColor(); if (player.choose(Constants.Outcome.Benefit, colorChoice, game)) { game.informPlayers(perm.getName() + ": " + player.getName() + " has chosen " + colorChoice.getChoice()); - game.getState().setValue(perm.getId() + "_color", colorChoice.getColor()); - game.addEffect(new GainProtectionFromChosenColorEffect(), source); + game.addEffect(new GainProtectionFromChosenColorEffect(colorChoice.getColor()), source); } } return false; @@ -131,15 +130,18 @@ class GainProtectionFromChosenColorEffect extends GainAbilityControlledEffect { filter1.add(new SubtypePredicate("Ally")); } private FilterCard filter2; + private ObjectColor chosenColor; - public GainProtectionFromChosenColorEffect() { + public GainProtectionFromChosenColorEffect(ObjectColor chosenColor) { super(new ProtectionAbility(new FilterCard()), Duration.EndOfTurn, filter1); filter2 = (FilterCard) ((ProtectionAbility) getFirstAbility()).getFilter(); + this.chosenColor = chosenColor; } public GainProtectionFromChosenColorEffect(final GainProtectionFromChosenColorEffect effect) { super(effect); this.filter2 = effect.filter2.copy(); + this.chosenColor = effect.chosenColor; } @Override @@ -149,7 +151,6 @@ class GainProtectionFromChosenColorEffect extends GainAbilityControlledEffect { @Override public boolean apply(Game game, Ability source) { - ObjectColor chosenColor = (ObjectColor) game.getState().getValue(source.getSourceId() + "_color"); filter2.add(new ColorPredicate(chosenColor)); filter2.setMessage(chosenColor.getDescription()); setAbility(new ProtectionAbility(new FilterCard(filter2))); diff --git a/Mage/src/mage/abilities/common/DiesAttachedTriggeredAbility.java b/Mage/src/mage/abilities/common/DiesAttachedTriggeredAbility.java index dc0ff8882c..a311200399 100644 --- a/Mage/src/mage/abilities/common/DiesAttachedTriggeredAbility.java +++ b/Mage/src/mage/abilities/common/DiesAttachedTriggeredAbility.java @@ -1,6 +1,6 @@ package mage.abilities.common; -import mage.Constants; +import mage.Constants.Zone; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; import mage.game.Game; @@ -13,21 +13,29 @@ import mage.game.permanent.Permanent; * @author Loki */ public class DiesAttachedTriggeredAbility extends TriggeredAbilityImpl { + private String attachedDescription; + private boolean diesRuleText; public DiesAttachedTriggeredAbility(Effect effect, String attachedDescription) { this(effect, attachedDescription, false); } - + public DiesAttachedTriggeredAbility(Effect effect, String attachedDescription, boolean optional) { - super(Constants.Zone.BATTLEFIELD, effect, optional); + this(effect, attachedDescription, optional, true); + } + + public DiesAttachedTriggeredAbility(Effect effect, String attachedDescription, boolean optional, boolean diesRuleText) { + super(Zone.BATTLEFIELD, effect, optional); this.attachedDescription = attachedDescription; + this.diesRuleText = diesRuleText; } public DiesAttachedTriggeredAbility(final DiesAttachedTriggeredAbility ability) { super(ability); this.attachedDescription = ability.attachedDescription; + this.diesRuleText = ability.diesRuleText; } @Override @@ -38,7 +46,7 @@ public class DiesAttachedTriggeredAbility extends TriggeredAbilityImpl { public int convertedManaCosts = 0; + protected int numberCardsRevealed = 0; public RevealTargetFromHandCost(TargetCardInHand target) { this.addTarget(target); @@ -52,23 +54,28 @@ public class RevealTargetFromHandCost extends CostImpl public RevealTargetFromHandCost(RevealTargetFromHandCost cost) { super(cost); + this.convertedManaCosts = cost.convertedManaCosts; + this.numberCardsRevealed = cost.numberCardsRevealed; } @Override public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { - if (targets.choose(Constants.Outcome.Benefit, controllerId, sourceId, game)) { + if (targets.choose(Outcome.Benefit, controllerId, sourceId, game)) { + convertedManaCosts = 0; + numberCardsRevealed = 0; Player player = game.getPlayer(controllerId); Cards cards = new CardsImpl(); for (UUID targetId: targets.get(0).getTargets()) { Card card = player.getHand().get(targetId, game); if (card == null) return false; - convertedManaCosts = card.getManaCost().convertedManaCost(); - cards.add(card); - player.revealCards("Revealed card", cards, game); // this is not a boolean + convertedManaCosts += card.getManaCost().convertedManaCost(); + numberCardsRevealed++; + cards.add(card); paid = true; - return paid; } + player.revealCards("Revealed card", cards, game); // this is not a boolean + return paid; } paid = false; return paid; @@ -78,6 +85,10 @@ public class RevealTargetFromHandCost extends CostImpl return convertedManaCosts; } + public int getNumberRevealedCards() { + return numberCardsRevealed; + } + @Override public boolean canPay(UUID sourceId, UUID controllerId, Game game) { return targets.canChoose(controllerId, game); @@ -87,4 +98,4 @@ public class RevealTargetFromHandCost extends CostImpl public RevealTargetFromHandCost copy() { return new RevealTargetFromHandCost(this); } -} \ No newline at end of file +} diff --git a/Mage/src/mage/abilities/effects/ContinuousEffects.java b/Mage/src/mage/abilities/effects/ContinuousEffects.java index 3d537405f2..8fc330de1b 100644 --- a/Mage/src/mage/abilities/effects/ContinuousEffects.java +++ b/Mage/src/mage/abilities/effects/ContinuousEffects.java @@ -34,6 +34,7 @@ import mage.Constants.AsThoughEffectType; import mage.Constants.Duration; import mage.Constants.Layer; import mage.Constants.SubLayer; +import mage.MageObject; import mage.abilities.Ability; import mage.abilities.StaticAbility; import mage.game.Game; @@ -376,7 +377,7 @@ public class ContinuousEffects implements Serializable { else { //20100716 - 616.1c Player player = game.getPlayer(event.getPlayerId()); - index = player.chooseEffect(rEffects, game); + index = player.chooseEffect(getReplacementEffectsTexts(rEffects, game), game); } ReplacementEffect rEffect = rEffects.get(index); caught = rEffect.replaceEvent(event, this.getAbility(rEffect.getId()), game); @@ -541,6 +542,20 @@ public class ContinuousEffects implements Serializable { return effects; } + public List getReplacementEffectsTexts(List rEffects, Game game) { + List texts = new ArrayList(); + for (ReplacementEffect effect: rEffects) { + Ability ability = replacementEffects.getAbility(effect.getId()); + MageObject object = game.getObject(ability.getSourceId()); + if (object != null) { + texts.add(ability.getRule(object.getName())); + } else { + texts.add(effect.getText(null)); + } + } + return texts; + } + } class TimestampSorter implements Comparator { @Override diff --git a/Mage/src/mage/abilities/effects/EntersBattlefieldEffect.java b/Mage/src/mage/abilities/effects/EntersBattlefieldEffect.java index 689cfc2cbf..0da6c93177 100644 --- a/Mage/src/mage/abilities/effects/EntersBattlefieldEffect.java +++ b/Mage/src/mage/abilities/effects/EntersBattlefieldEffect.java @@ -29,6 +29,7 @@ package mage.abilities.effects; import mage.Constants.Duration; +import mage.MageObject; import mage.abilities.Ability; import mage.abilities.Mode; import mage.abilities.condition.Condition; @@ -36,6 +37,7 @@ import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.game.stack.Spell; +import mage.players.Player; /** * @@ -46,6 +48,7 @@ public class EntersBattlefieldEffect extends ReplacementEffectImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) { - ZoneChangeEvent zEvent = (ZoneChangeEvent)event; + EntersTheBattlefieldEvent zEvent = (EntersTheBattlefieldEvent)event; if(zEvent.getFromZone() == null && this.echoPaid) { this.echoPaid = false; } diff --git a/Mage/src/mage/game/permanent/PermanentImpl.java b/Mage/src/mage/game/permanent/PermanentImpl.java index 6bf0192f14..21fe11d522 100644 --- a/Mage/src/mage/game/permanent/PermanentImpl.java +++ b/Mage/src/mage/game/permanent/PermanentImpl.java @@ -607,7 +607,7 @@ public abstract class PermanentImpl> extends CardImpl */ private int damage(int damageAmount, UUID sourceId, Game game, boolean preventable, boolean combat, boolean markDamage, ArrayList appliedEffects) { int damageDone = 0; - if (damageAmount > 0 && canDamage(game.getObject(sourceId), game)) { + if (canDamage(game.getObject(sourceId), game)) { if (cardType.contains(CardType.PLANESWALKER)) { damageDone = damagePlaneswalker(damageAmount, sourceId, game, preventable, combat, markDamage, appliedEffects); } else { diff --git a/Mage/src/mage/players/Player.java b/Mage/src/mage/players/Player.java index 41aaf02c74..c3ee7c572e 100644 --- a/Mage/src/mage/players/Player.java +++ b/Mage/src/mage/players/Player.java @@ -231,7 +231,7 @@ public interface Player extends MageItem, Copyable { // set the value for X spells and abilities int announceXMana(int min, int max, String message, Game game, Ability ability); - int chooseEffect(List rEffects, Game game); + int chooseEffect(List rEffects, Game game); TriggeredAbility chooseTriggeredAbility(List abilities, Game game); Mode chooseMode(Modes modes, Ability source, Game game); void selectAttackers(Game game, UUID attackingPlayerId);