diff --git a/Mage.Sets/src/mage/sets/conflux/GoblinRazerunners.java b/Mage.Sets/src/mage/sets/conflux/GoblinRazerunners.java index bbbcb8da79..ab5af9c60c 100644 --- a/Mage.Sets/src/mage/sets/conflux/GoblinRazerunners.java +++ b/Mage.Sets/src/mage/sets/conflux/GoblinRazerunners.java @@ -36,6 +36,7 @@ import mage.Constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.BeginningOfYourEndStepTriggeredAbility; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.SacrificeTargetCost; import mage.abilities.costs.mana.ManaCostsImpl; @@ -75,7 +76,9 @@ public class GoblinRazerunners extends CardImpl { Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance()), new ManaCostsImpl("{1}{R}")); ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(filter))); this.addAbility(ability); - this.addAbility(new GoblinRazerunnersTriggeredAbility()); + ability = new BeginningOfYourEndStepTriggeredAbility(new DamageTargetEffect(new CountersCount(CounterType.P1P1)), true); + ability.addTarget(new TargetPlayer()); + this.addAbility(ability); } public GoblinRazerunners (final GoblinRazerunners card) { @@ -87,32 +90,3 @@ public class GoblinRazerunners extends CardImpl { return new GoblinRazerunners(this); } } - -class GoblinRazerunnersTriggeredAbility extends TriggeredAbilityImpl { - GoblinRazerunnersTriggeredAbility() { - super(Constants.Zone.BATTLEFIELD, new DamageTargetEffect(new CountersCount(CounterType.P1P1)), true); - this.addTarget(new TargetPlayer()); - } - - GoblinRazerunnersTriggeredAbility(final GoblinRazerunnersTriggeredAbility ability) { - super(ability); - } - - @Override - public GoblinRazerunnersTriggeredAbility copy() { - return new GoblinRazerunnersTriggeredAbility(this); - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.END_TURN_STEP_PRE && event.getPlayerId().equals(this.controllerId)) { - return true; - } - return false; - } - - @Override - public String getRule() { - return "At the beginning of your end step, you may have {this} deal damage equal to the number of +1/+1 counters on it to target player."; - } -} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/conflux/WallOfReverence.java b/Mage.Sets/src/mage/sets/conflux/WallOfReverence.java index b69122c8c8..e90b1c997c 100644 --- a/Mage.Sets/src/mage/sets/conflux/WallOfReverence.java +++ b/Mage.Sets/src/mage/sets/conflux/WallOfReverence.java @@ -37,6 +37,7 @@ import mage.Constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.BeginningOfYourEndStepTriggeredAbility; import mage.abilities.effects.OneShotEffect; import mage.abilities.keyword.DefenderAbility; import mage.abilities.keyword.FlyingAbility; @@ -63,7 +64,9 @@ public class WallOfReverence extends CardImpl { this.toughness = new MageInt(6); this.addAbility(DefenderAbility.getInstance()); this.addAbility(FlyingAbility.getInstance()); - this.addAbility(new WallOfReverenceTriggeredAbility()); + Ability ability = new BeginningOfYourEndStepTriggeredAbility(new WallOfReverenceTriggeredEffect(), true); + ability.addTarget(new TargetControlledCreaturePermanent()); + this.addAbility(ability); } public WallOfReverence (final WallOfReverence card) { @@ -76,35 +79,6 @@ public class WallOfReverence extends CardImpl { } } -class WallOfReverenceTriggeredAbility extends TriggeredAbilityImpl { - WallOfReverenceTriggeredAbility() { - super(Zone.BATTLEFIELD, new WallOfReverenceTriggeredEffect(), true); - this.addTarget(new TargetControlledCreaturePermanent()); - } - - WallOfReverenceTriggeredAbility(final WallOfReverenceTriggeredAbility ability) { - super(ability); - } - - @Override - public WallOfReverenceTriggeredAbility copy() { - return new WallOfReverenceTriggeredAbility(this); - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.END_PHASE_PRE && event.getPlayerId().equals(this.controllerId)) { - return true; - } - return false; - } - - @Override - public String getRule() { - return "At the beginning of your end step, " + modes.getText(); - } -} - class WallOfReverenceTriggeredEffect extends OneShotEffect { WallOfReverenceTriggeredEffect() { super(Outcome.GainLife); diff --git a/Mage.Sets/src/mage/sets/newphyrexia/JinGitaxiasCoreAugur.java b/Mage.Sets/src/mage/sets/newphyrexia/JinGitaxiasCoreAugur.java new file mode 100644 index 0000000000..80bfe08d68 --- /dev/null +++ b/Mage.Sets/src/mage/sets/newphyrexia/JinGitaxiasCoreAugur.java @@ -0,0 +1,102 @@ +/* + * 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.BeginningOfYourEndStepTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ContinuousEffectImpl; +import mage.abilities.effects.common.DrawCardControllerEffect; +import mage.abilities.keyword.FlashAbility; +import mage.cards.CardImpl; +import mage.game.Game; +import mage.players.Player; + +/** + * + * @author Loki + */ +public class JinGitaxiasCoreAugur extends CardImpl { + + public JinGitaxiasCoreAugur(UUID ownerId) { + super(ownerId, 37, "Jin-Gitaxias, Core Augur", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{8}{U}{U}"); + this.expansionSetCode = "NPH"; + this.supertype.add("Legendary"); + this.subtype.add("Praetor"); + + this.color.setBlue(true); + this.power = new MageInt(5); + this.toughness = new MageInt(4); + + this.addAbility(FlashAbility.getInstance()); + this.addAbility(new BeginningOfYourEndStepTriggeredAbility(new DrawCardControllerEffect(7), false)); + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new JinGitaxiasCoreAugurEffect())); + } + + public JinGitaxiasCoreAugur(final JinGitaxiasCoreAugur card) { + super(card); + } + + @Override + public JinGitaxiasCoreAugur copy() { + return new JinGitaxiasCoreAugur(this); + } +} + +class JinGitaxiasCoreAugurEffect extends ContinuousEffectImpl { + JinGitaxiasCoreAugurEffect() { + super(Constants.Duration.WhileOnBattlefield, Constants.Layer.PlayerEffects, Constants.SubLayer.NA, Constants.Outcome.Detriment); + staticText = "Each opponent's maximum hand size is reduced by seven"; + } + + JinGitaxiasCoreAugurEffect(final JinGitaxiasCoreAugurEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + for (UUID id : game.getOpponents(source.getControllerId())) { + Player player = game.getPlayer(id); + if (player != null) { + player.setMaxHandSize(player.getMaxHandSize() - 7); + } + } + return true; + } + + @Override + public JinGitaxiasCoreAugurEffect copy() { + return new JinGitaxiasCoreAugurEffect(this); + } +} \ No newline at end of file diff --git a/Mage/src/mage/abilities/common/BeginningOfYourEndStepTriggeredAbility.java b/Mage/src/mage/abilities/common/BeginningOfYourEndStepTriggeredAbility.java new file mode 100644 index 0000000000..788817c78b --- /dev/null +++ b/Mage/src/mage/abilities/common/BeginningOfYourEndStepTriggeredAbility.java @@ -0,0 +1,40 @@ +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; + +/** + * Beginning of controlled end step triggered ability + * @author Loki + */ +public class BeginningOfYourEndStepTriggeredAbility extends TriggeredAbilityImpl { + public BeginningOfYourEndStepTriggeredAbility(Effect effect, boolean optional) { + super(Constants.Zone.BATTLEFIELD, effect, optional); + } + + public BeginningOfYourEndStepTriggeredAbility(final BeginningOfYourEndStepTriggeredAbility ability) { + super(ability); + } + + + @Override + public BeginningOfYourEndStepTriggeredAbility copy() { + return new BeginningOfYourEndStepTriggeredAbility(this); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getType() == GameEvent.EventType.END_PHASE_PRE && event.getPlayerId().equals(this.controllerId)) { + return true; + } + return false; + } + + @Override + public String getRule() { + return "At the beginning of your end step, " + modes.getText(); + } +}