diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/ShireiShizosCaretaker.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/ShireiShizosCaretaker.java new file mode 100644 index 0000000000..1daafb9627 --- /dev/null +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/ShireiShizosCaretaker.java @@ -0,0 +1,187 @@ +/* + * 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.betrayersofkamigawa; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.DelayedTriggeredAbility; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.delayed.AtEndOfTurnDelayedTriggeredAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ReturnToBattlefieldUnderYourControlTargetEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; +import mage.game.events.ZoneChangeEvent; +import mage.game.permanent.Permanent; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author emerald000 + */ +public class ShireiShizosCaretaker extends CardImpl { + + public ShireiShizosCaretaker(UUID ownerId) { + super(ownerId, 81, "Shirei, Shizo's Caretaker", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{4}{B}"); + this.expansionSetCode = "BOK"; + this.supertype.add("Legendary"); + this.subtype.add("Spirit"); + + this.color.setBlack(true); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Whenever a creature with power 1 or less is put into your graveyard from the battlefield, you may return that card to the battlefield under your control at the beginning of the next end step if Shirei, Shizo's Caretaker is still on the battlefield. + this.addAbility(new ShireiShizosCaretakerTriggeredAbility(this.getId())); + } + + public ShireiShizosCaretaker(final ShireiShizosCaretaker card) { + super(card); + } + + @Override + public ShireiShizosCaretaker copy() { + return new ShireiShizosCaretaker(this); + } +} + +class ShireiShizosCaretakerTriggeredAbility extends TriggeredAbilityImpl { + + ShireiShizosCaretakerTriggeredAbility(UUID shireiId) { + super(Zone.BATTLEFIELD, new ShireiShizosCaretakerEffect(shireiId), false); + } + + ShireiShizosCaretakerTriggeredAbility(final ShireiShizosCaretakerTriggeredAbility ability) { + super(ability); + } + + @Override + public ShireiShizosCaretakerTriggeredAbility copy() { + return new ShireiShizosCaretakerTriggeredAbility(this); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getType() == EventType.ZONE_CHANGE) { + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + Permanent LKIpermanent = game.getPermanentOrLKIBattlefield(zEvent.getTargetId()); + Card card = game.getCard(zEvent.getTargetId()); + + if (card != null && LKIpermanent != null && + card.getOwnerId().equals(this.controllerId) && + zEvent.getToZone() == Zone.GRAVEYARD && + zEvent.getFromZone() == Zone.BATTLEFIELD && + card.getCardType().contains(CardType.CREATURE) && + LKIpermanent.getPower().getValue() <= 1) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(zEvent.getTargetId())); + } + return true; + } + } + return false; + } + + @Override + public String getRule() { + return "Whenever a creature with power 1 or less is put into your graveyard from the battlefield, you may return that card to the battlefield under your control at the beginning of the next end step if Shirei, Shizo's Caretaker is still on the battlefield."; + } +} + +class ShireiShizosCaretakerEffect extends OneShotEffect { + + protected final UUID shireiId; + + ShireiShizosCaretakerEffect(UUID shireiId) { + super(Outcome.PutCreatureInPlay); + this.staticText = "you may return that card to the battlefield under your control at the beginning of the next end step if Shirei, Shizo's Caretaker is still on the battlefield."; + this.shireiId = shireiId; + } + + ShireiShizosCaretakerEffect(final ShireiShizosCaretakerEffect effect) { + super(effect); + this.shireiId = effect.shireiId; + } + + @Override + public ShireiShizosCaretakerEffect copy() { + return new ShireiShizosCaretakerEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Card card = game.getCard(this.getTargetPointer().getFirst(game, source)); + if (card != null) { + Effect effect = new ShireiShizosCaretakerReturnEffect(shireiId); + effect.setText("return that card to the battlefield under your control if Shirei, Shizo's Caretaker is still on the battlefield"); + DelayedTriggeredAbility delayedAbility = new AtEndOfTurnDelayedTriggeredAbility(effect); + delayedAbility.setSourceId(source.getSourceId()); + delayedAbility.setControllerId(source.getControllerId()); + delayedAbility.getEffects().get(0).setTargetPointer(new FixedTarget(card.getId())); + game.addDelayedTriggeredAbility(delayedAbility); + return true; + } + return false; + } +} + +class ShireiShizosCaretakerReturnEffect extends ReturnToBattlefieldUnderYourControlTargetEffect { + + protected final UUID shireiId; + + ShireiShizosCaretakerReturnEffect(UUID shireiId) { + this.shireiId = shireiId; + } + + ShireiShizosCaretakerReturnEffect(final ShireiShizosCaretakerReturnEffect effect) { + super(effect); + this.shireiId = effect.shireiId; + } + + @Override + public ShireiShizosCaretakerReturnEffect copy() { + return new ShireiShizosCaretakerReturnEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + if (game.getBattlefield().containsPermanent(shireiId)) { + return super.apply(game, source); + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/invasion/KangeeAerieKeeper.java b/Mage.Sets/src/mage/sets/invasion/KangeeAerieKeeper.java index f6d657b6b3..5eae6065e7 100644 --- a/Mage.Sets/src/mage/sets/invasion/KangeeAerieKeeper.java +++ b/Mage.Sets/src/mage/sets/invasion/KangeeAerieKeeper.java @@ -82,10 +82,10 @@ public class KangeeAerieKeeper extends CardImpl { // When Kangee, Aerie Keeper enters the battlefield, if it was kicked, put X feather counters on it. TriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new AddCountersSourceEffect(CounterType.FEATHER.createInstance(), new GetKickerXValue(), true)); - this.addAbility(new ConditionalTriggeredAbility(ability, KickedCondition.getInstance(), "When Kangee, Aerie Keeper enters the battlefield, if it was kicked, put X feather counters on it.")); + this.addAbility(new ConditionalTriggeredAbility(ability, KickedCondition.getInstance(), "When {this} enters the battlefield, if it was kicked, put X feather counters on it.")); // Other Bird creatures get +1/+1 for each feather counter on Kangee, Aerie Keeper. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(new CountersCount(CounterType.FEATHER), new CountersCount(CounterType.FEATHER), Duration.WhileOnBattlefield, filter, true, "Other Bird creatures get +1/+1 for each feather counter on Kangee, Aerie Keeper."))); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(new CountersCount(CounterType.FEATHER), new CountersCount(CounterType.FEATHER), Duration.WhileOnBattlefield, filter, true, "Other Bird creatures get +1/+1 for each feather counter on {this}."))); } public KangeeAerieKeeper(final KangeeAerieKeeper card) { diff --git a/Mage.Sets/src/mage/sets/scourge/KaronaFalseGod.java b/Mage.Sets/src/mage/sets/scourge/KaronaFalseGod.java index 96a85dda77..1a9f103602 100644 --- a/Mage.Sets/src/mage/sets/scourge/KaronaFalseGod.java +++ b/Mage.Sets/src/mage/sets/scourge/KaronaFalseGod.java @@ -78,7 +78,7 @@ public class KaronaFalseGod extends CardImpl { this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new KaronaFalseGodControlEffect(), TargetController.ANY, false)); // Whenever Karona attacks, creatures of the creature type of your choice get +3/+3 until end of turn. - this.addAbility(new AttacksTriggeredAbility(new KaronaFalseGodBoostEffect(), false, "Whenever Karona attacks, creatures of the creature type of your choice get +3/+3 until end of turn.")); + this.addAbility(new AttacksTriggeredAbility(new KaronaFalseGodBoostEffect(), false, "Whenever {this} attacks, creatures of the creature type of your choice get +3/+3 until end of turn.")); } public KaronaFalseGod(final KaronaFalseGod card) { @@ -95,7 +95,7 @@ class KaronaFalseGodControlEffect extends ContinuousEffectImpl { KaronaFalseGodControlEffect() { super(Duration.Custom, Layer.ControlChangingEffects_2, SubLayer.NA, Outcome.GainControl); - this.staticText = "that player untaps Karona, False God and gains control of it."; + this.staticText = "that player untaps {this} and gains control of it."; } KaronaFalseGodControlEffect(final KaronaFalseGodControlEffect effect) { diff --git a/Mage.Sets/src/mage/sets/urzasdestiny/RayneAcademyChancellor.java b/Mage.Sets/src/mage/sets/urzasdestiny/RayneAcademyChancellor.java new file mode 100644 index 0000000000..5bba7db806 --- /dev/null +++ b/Mage.Sets/src/mage/sets/urzasdestiny/RayneAcademyChancellor.java @@ -0,0 +1,114 @@ +/* + * 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.urzasdestiny; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.condition.common.EnchantedCondition; +import mage.abilities.decorator.ConditionalOneShotEffect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; +import mage.game.permanent.Permanent; +import mage.players.Player; + +/** + * + * @author emerald000 + */ +public class RayneAcademyChancellor extends CardImpl { + + public RayneAcademyChancellor(UUID ownerId) { + super(ownerId, 43, "Rayne, Academy Chancellor", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{U}"); + this.expansionSetCode = "UDS"; + this.supertype.add("Legendary"); + this.subtype.add("Human"); + this.subtype.add("Wizard"); + + this.color.setBlue(true); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Whenever you or a permanent you control becomes the target of a spell or ability an opponent controls, you may draw a card. You may draw an additional card if Rayne, Academy Chancellor is enchanted. + this.addAbility(new RayneAcademyChancellorTriggeredAbility()); + } + + public RayneAcademyChancellor(final RayneAcademyChancellor card) { + super(card); + } + + @Override + public RayneAcademyChancellor copy() { + return new RayneAcademyChancellor(this); + } +} + +class RayneAcademyChancellorTriggeredAbility extends TriggeredAbilityImpl { + + RayneAcademyChancellorTriggeredAbility() { + super(Zone.BATTLEFIELD, new ConditionalOneShotEffect(new DrawCardSourceControllerEffect(2), new DrawCardSourceControllerEffect(1), new EnchantedCondition(), "you may draw a card. You may draw an additional card if {this} is enchanted."), true); + } + + RayneAcademyChancellorTriggeredAbility(final RayneAcademyChancellorTriggeredAbility ability) { + super(ability); + } + + @Override + public RayneAcademyChancellorTriggeredAbility copy() { + return new RayneAcademyChancellorTriggeredAbility(this); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getType() == EventType.TARGETED) { + Player controller = game.getPlayer(this.getControllerId()); + Player targetter = game.getPlayer(event.getPlayerId()); + if (controller != null && targetter != null && !controller.getId().equals(targetter.getId())) { + if (event.getTargetId().equals(controller.getId())) { + return true; + } + Permanent permanent = game.getPermanentOrLKIBattlefield(event.getTargetId()); + if (permanent != null && this.getControllerId().equals(permanent.getControllerId())) { + return true; + } + } + } + return false; + } + + @Override + public String getRule() { + return "Whenever you or a permanent you control becomes the target of a spell or ability an opponent controls, you may draw a card. You may draw an additional card if {this} is enchanted."; + } +}