diff --git a/Mage.Sets/src/mage/sets/conflux/Esperzoa.java b/Mage.Sets/src/mage/sets/conflux/Esperzoa.java index 914298fcbc..c7d002b591 100644 --- a/Mage.Sets/src/mage/sets/conflux/Esperzoa.java +++ b/Mage.Sets/src/mage/sets/conflux/Esperzoa.java @@ -29,19 +29,18 @@ package mage.sets.conflux; import java.util.UUID; + +import mage.Constants; import mage.Constants.CardType; -import mage.Constants.Duration; import mage.Constants.Rarity; -import mage.Constants.Zone; import mage.MageInt; import mage.abilities.Ability; -import mage.abilities.common.BeginningOfControllerUpkeepTriggeredAbility; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.effects.common.ReturnToHandTargetEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; import mage.filter.Filter; import mage.filter.common.FilterControlledPermanent; -import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledPermanent; /** @@ -64,7 +63,7 @@ public class Esperzoa extends CardImpl { this.power = new MageInt(4); this.toughness = new MageInt(3); this.addAbility(FlyingAbility.getInstance()); - Ability ability = new BeginningOfControllerUpkeepTriggeredAbility(new ReturnToHandTargetEffect(), false); + Ability ability = new BeginningOfUpkeepTriggeredAbility(new ReturnToHandTargetEffect(), Constants.TargetController.YOU, false); TargetControlledPermanent t = new TargetControlledPermanent(filter); t.setRequired(true); ability.addTarget(t); diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/VedalkenInfuser.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/VedalkenInfuser.java index af3fcfe0e0..a1b5076481 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/VedalkenInfuser.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/VedalkenInfuser.java @@ -29,11 +29,13 @@ package mage.sets.mirrodinbesieged; import java.util.UUID; + +import mage.Constants; import mage.Constants.CardType; import mage.Constants.Rarity; import mage.MageInt; import mage.abilities.Ability; -import mage.abilities.common.BeginningOfControllerUpkeepTriggeredAbility; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.effects.common.counter.AddCountersTargetEffect; import mage.cards.CardImpl; import mage.counters.CounterType; @@ -53,7 +55,7 @@ public class VedalkenInfuser extends CardImpl { this.color.setBlue(true); this.power = new MageInt(1); this.toughness = new MageInt(4); - Ability ability = new BeginningOfControllerUpkeepTriggeredAbility(new AddCountersTargetEffect(CounterType.CHARGE.createInstance()), true); + Ability ability = new BeginningOfUpkeepTriggeredAbility(new AddCountersTargetEffect(CounterType.CHARGE.createInstance()), Constants.TargetController.YOU, true); ability.addTarget(new TargetArtifactPermanent()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/newphyrexia/SheoldredWhisperingOne.java b/Mage.Sets/src/mage/sets/newphyrexia/SheoldredWhisperingOne.java new file mode 100644 index 0000000000..2df7fd7d25 --- /dev/null +++ b/Mage.Sets/src/mage/sets/newphyrexia/SheoldredWhisperingOne.java @@ -0,0 +1,80 @@ +/* + * 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.newphyrexia; + +import java.util.UUID; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect; +import mage.abilities.effects.common.SacrificeEffect; +import mage.abilities.keyword.SwampwalkAbility; +import mage.cards.CardImpl; +import mage.filter.common.FilterCreatureCard; +import mage.filter.common.FilterCreaturePermanent; +import mage.target.TargetPlayer; +import mage.target.common.TargetCardInYourGraveyard; + +/** + * + * @author Loki + */ +public class SheoldredWhisperingOne extends CardImpl { + + public SheoldredWhisperingOne (UUID ownerId) { + super(ownerId, 73, "Sheoldred, Whispering One", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{5}{B}{B}"); + this.expansionSetCode = "NPH"; + this.supertype.add("Legendary"); + this.subtype.add("Praetor"); + this.color.setBlack(true); + this.power = new MageInt(6); + this.toughness = new MageInt(6); + this.addAbility(new SwampwalkAbility()); + Ability ability = new BeginningOfUpkeepTriggeredAbility(new ReturnFromGraveyardToBattlefieldTargetEffect(false), Constants.TargetController.YOU, false); + ability.addTarget(new TargetCardInYourGraveyard(new FilterCreatureCard())); + this.addAbility(ability); + ability = new BeginningOfUpkeepTriggeredAbility(new SacrificeEffect(new FilterCreaturePermanent(), 1, ""), Constants.TargetController.OPPONENT, false); + ability.addTarget(new TargetPlayer()); + this.addAbility(ability); + } + + public SheoldredWhisperingOne (final SheoldredWhisperingOne card) { + super(card); + } + + @Override + public SheoldredWhisperingOne copy() { + return new SheoldredWhisperingOne(this); + } + +} diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/DemonicAppetite.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/DemonicAppetite.java index 8c7c0ab08e..8e8cdb234c 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/DemonicAppetite.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/DemonicAppetite.java @@ -34,7 +34,7 @@ import mage.Constants; import mage.Constants.CardType; import mage.Constants.Rarity; import mage.abilities.Ability; -import mage.abilities.common.BeginningOfControllerUpkeepTriggeredAbility; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.SacrificeTargetEffect; @@ -63,7 +63,7 @@ public class DemonicAppetite extends CardImpl { Ability ability = new EnchantAbility(auraTarget.getTargetName()); this.addAbility(ability); this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new BoostEnchantedEffect(3, 3, Constants.Duration.WhileOnBattlefield))); - ability = new BeginningOfControllerUpkeepTriggeredAbility(new SacrificeTargetEffect(), false); + ability = new BeginningOfUpkeepTriggeredAbility(new SacrificeTargetEffect(), Constants.TargetController.YOU, false); ability.addTarget(new TargetControlledCreaturePermanent()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/GoldenUrn.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/GoldenUrn.java index 7c34f33414..dd852cb4f0 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/GoldenUrn.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/GoldenUrn.java @@ -35,7 +35,7 @@ import mage.Constants.CardType; import mage.Constants.Rarity; import mage.Constants.Zone; import mage.abilities.Ability; -import mage.abilities.common.BeginningOfControllerUpkeepTriggeredAbility; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.SacrificeSourceCost; import mage.abilities.costs.common.TapSourceCost; @@ -56,7 +56,7 @@ public class GoldenUrn extends CardImpl { public GoldenUrn (UUID ownerId) { super(ownerId, 158, "Golden Urn", Rarity.COMMON, new CardType[]{CardType.ARTIFACT}, "{1}"); this.expansionSetCode = "SOM"; - this.addAbility(new BeginningOfControllerUpkeepTriggeredAbility(new AddCountersSourceEffect(CounterType.CHARGE.createInstance()), true)); + this.addAbility(new BeginningOfUpkeepTriggeredAbility(new AddCountersSourceEffect(CounterType.CHARGE.createInstance()), Constants.TargetController.YOU, true)); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GoldenUrnEffect(), new TapSourceCost()); ability.addCost(new SacrificeSourceCost()); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/KembaKhaRegent.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/KembaKhaRegent.java index 590b03b681..9fbd1e0d9e 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/KembaKhaRegent.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/KembaKhaRegent.java @@ -33,16 +33,13 @@ import java.util.UUID; import mage.Constants; import mage.Constants.CardType; import mage.Constants.Rarity; -import mage.Constants.Zone; import mage.MageInt; import mage.ObjectColor; import mage.abilities.Ability; -import mage.abilities.TriggeredAbilityImpl; -import mage.abilities.common.BeginningOfControllerUpkeepTriggeredAbility; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; import mage.game.Game; -import mage.game.events.GameEvent; import mage.game.permanent.Permanent; import mage.game.permanent.token.Token; @@ -61,7 +58,7 @@ public class KembaKhaRegent extends CardImpl { this.color.setWhite(true); this.power = new MageInt(2); this.toughness = new MageInt(4); - this.addAbility(new BeginningOfControllerUpkeepTriggeredAbility(new KembaKhaRegentEffect(), false)); + this.addAbility(new BeginningOfUpkeepTriggeredAbility(new KembaKhaRegentEffect(), Constants.TargetController.YOU, false)); } public KembaKhaRegent (final KembaKhaRegent card) { diff --git a/Mage.Sets/src/mage/sets/zendikar/VampireLacerator.java b/Mage.Sets/src/mage/sets/zendikar/VampireLacerator.java index 839b7c1b6d..603085ffa0 100644 --- a/Mage.Sets/src/mage/sets/zendikar/VampireLacerator.java +++ b/Mage.Sets/src/mage/sets/zendikar/VampireLacerator.java @@ -27,7 +27,8 @@ */ package mage.sets.zendikar; -import mage.abilities.common.BeginningOfControllerUpkeepTriggeredAbility; +import mage.Constants; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import java.util.UUID; import mage.Constants.CardType; import mage.Constants.Rarity; @@ -55,11 +56,11 @@ public class VampireLacerator extends CardImpl { this.power = new MageInt(2); this.toughness = new MageInt(2); - this.addAbility(new BeginningOfControllerUpkeepTriggeredAbility( + this.addAbility(new BeginningOfUpkeepTriggeredAbility( new ConditionalOneShotEffect( new LoseLifeSourceEffect(1), new Unless( new TenOrLessLife(AN_OPPONENT) ), - "you lose 1 life unless an opponent has 10 or less life"), false)); + "you lose 1 life unless an opponent has 10 or less life"), Constants.TargetController.YOU, false)); } public VampireLacerator(final VampireLacerator card) { diff --git a/Mage/src/mage/abilities/common/BeginningOfControllerUpkeepTriggeredAbility.java b/Mage/src/mage/abilities/common/BeginningOfControllerUpkeepTriggeredAbility.java deleted file mode 100644 index 446d1f786c..0000000000 --- a/Mage/src/mage/abilities/common/BeginningOfControllerUpkeepTriggeredAbility.java +++ /dev/null @@ -1,36 +0,0 @@ -package mage.abilities.common; - -import mage.Constants; -import mage.abilities.TriggeredAbilityImpl; -import mage.abilities.effects.Effect; -import mage.game.Game; -import mage.game.events.GameEvent; - -public class BeginningOfControllerUpkeepTriggeredAbility extends TriggeredAbilityImpl { - - public BeginningOfControllerUpkeepTriggeredAbility(Effect effect, boolean isOptional) { - super(Constants.Zone.BATTLEFIELD, effect, isOptional); - } - - public BeginningOfControllerUpkeepTriggeredAbility(final BeginningOfControllerUpkeepTriggeredAbility ability) { - super(ability); - } - - @Override - public BeginningOfControllerUpkeepTriggeredAbility copy() { - return new BeginningOfControllerUpkeepTriggeredAbility(this); - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE && event.getPlayerId().equals(this.controllerId)) { - return true; - } - return false; - } - - @Override - public String getRule() { - return "At the beginning of your upkeep, " + effects.getText(this); - } -} diff --git a/Mage/src/mage/abilities/common/BeginningOfUpkeepTriggeredAbility.java b/Mage/src/mage/abilities/common/BeginningOfUpkeepTriggeredAbility.java new file mode 100644 index 0000000000..4e603ec07a --- /dev/null +++ b/Mage/src/mage/abilities/common/BeginningOfUpkeepTriggeredAbility.java @@ -0,0 +1,54 @@ +package mage.abilities.common; + +import com.sun.org.apache.bcel.internal.generic.CASTORE; +import mage.Constants; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.Effect; +import mage.game.Game; +import mage.game.events.GameEvent; + +public class BeginningOfUpkeepTriggeredAbility extends TriggeredAbilityImpl { + private Constants.TargetController targetController; + + public BeginningOfUpkeepTriggeredAbility(Effect effect, Constants.TargetController targetController, boolean isOptional) { + super(Constants.Zone.BATTLEFIELD, effect, isOptional); + this.targetController = targetController; + } + + public BeginningOfUpkeepTriggeredAbility(final BeginningOfUpkeepTriggeredAbility ability) { + super(ability); + this.targetController = ability.targetController; + } + + @Override + public BeginningOfUpkeepTriggeredAbility copy() { + return new BeginningOfUpkeepTriggeredAbility(this); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE) { + switch (targetController) { + case YOU: + return event.getPlayerId().equals(this.controllerId); + case OPPONENT: + if (game.getOpponents(this.controllerId).contains(event.getPlayerId())) { + this.getTargets().get(0).add(event.getPlayerId(), game); //TODO add target pushing checking to constructor + return true; + } + } + } + return false; + } + + @Override + public String getRule() { + switch (targetController) { + case YOU: + return "At the beginning of your upkeep, " + effects.getText(this); + case OPPONENT: + return "At the beginning of each opponent's upkeep, " + effects.getText(this); + } + return ""; + } +}