diff --git a/Mage.Sets/src/mage/sets/returntoravnica/DesecrationDemon.java b/Mage.Sets/src/mage/sets/returntoravnica/DesecrationDemon.java index d5945dc669..f65d50ff58 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/DesecrationDemon.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/DesecrationDemon.java @@ -32,10 +32,9 @@ 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.TriggeredAbilityImpl; +import mage.abilities.common.BeginningOfCombatTriggeredAbility; import mage.abilities.effects.OneShotEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; @@ -44,7 +43,6 @@ import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.permanent.ControllerPredicate; import mage.game.Game; -import mage.game.events.GameEvent; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.common.TargetControlledPermanent; @@ -68,8 +66,7 @@ public class DesecrationDemon extends CardImpl { this.addAbility(FlyingAbility.getInstance()); // At the beginning of each combat, any opponent may sacrifice a creature. If a player does, tap Desecration Demon and put a +1/+1 counter on it. - this.addAbility(new DesecrationDemonTriggeredAbility()); - + this.addAbility(new BeginningOfCombatTriggeredAbility(new DesecrationDemonEffect(), Constants.TargetController.ANY, false)); } public DesecrationDemon(final DesecrationDemon card) { @@ -82,39 +79,10 @@ public class DesecrationDemon extends CardImpl { } } -class DesecrationDemonTriggeredAbility extends TriggeredAbilityImpl { - - public DesecrationDemonTriggeredAbility() { - super(Zone.BATTLEFIELD, new DesecrationDemonEffect()); - } - - public DesecrationDemonTriggeredAbility(final DesecrationDemonTriggeredAbility ability) { - super(ability); - } - - @Override - public DesecrationDemonTriggeredAbility copy() { - return new DesecrationDemonTriggeredAbility(this); - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.COMBAT_PHASE_PRE) { - return true; - } - return false; - } - - @Override - public String getRule() { - return "At the beginning of each combat, any opponent may sacrifice a creature. If a player does, tap Desecration Demon and put a +1/+1 counter on it"; - } -} - - class DesecrationDemonEffect extends OneShotEffect { DesecrationDemonEffect() { super(Constants.Outcome.BoostCreature); + staticText = "any opponent may sacrifice a creature. If a player does, tap {this} and put a +1/+1 counter on it"; } DesecrationDemonEffect(final DesecrationDemonEffect effect) { @@ -134,13 +102,13 @@ class DesecrationDemonEffect extends OneShotEffect { filter.add(new ControllerPredicate(Constants.TargetController.YOU)); TargetControlledPermanent target = new TargetControlledPermanent(1, 1, filter, false); if (target.canChoose(opponent.getId(), game)) { - if (opponent.chooseUse(Outcome.Detriment, "Sacrifice a creature to tap Desecration Demon and put a +1/+1 counter on it?", game)) + if (opponent.chooseUse(Outcome.Detriment, new StringBuilder("Sacrifice a creature to tap ").append(descrationDemon.getName()).append("and put a +1/+1 counter on it?").toString(), game)) { opponent.choose(Outcome.Sacrifice, target, source.getSourceId(), game); Permanent permanent = game.getPermanent(target.getFirstTarget()); if (permanent != null) { permanent.sacrifice(source.getId(), game); - game.informPlayers(opponent.getName() + " sacrifices " + permanent.getName() + " to tap Desecration Demon and put a +1/+1 counter on it"); + game.informPlayers(new StringBuilder(opponent.getName()).append(" sacrifices ").append(permanent.getName()).append(" to tap ").append(descrationDemon.getName()).append(". A +1/+1 counter was put on it").toString()); if (descrationDemon != null) { descrationDemon.tap(game); descrationDemon.addCounters(CounterType.P1P1.createInstance(), game); @@ -159,4 +127,4 @@ class DesecrationDemonEffect extends OneShotEffect { public DesecrationDemonEffect copy() { return new DesecrationDemonEffect(this); } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/BattleRattleShaman.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/BattleRattleShaman.java index ee71c409e9..d525fa48d0 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/BattleRattleShaman.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/BattleRattleShaman.java @@ -55,7 +55,7 @@ public class BattleRattleShaman extends CardImpl { this.toughness = new MageInt(2); // At the beginning of combat on your turn, you may have target creature get +2/+0 until end of turn. - Ability ability = new BeginningOfCombatTriggeredAbility(Constants.Zone.BATTLEFIELD, new BoostTargetEffect(2, 0, Constants.Duration.EndOfTurn), Constants.TargetController.YOU, true); + Ability ability = new BeginningOfCombatTriggeredAbility(Constants.Zone.BATTLEFIELD, new BoostTargetEffect(2, 0, Constants.Duration.EndOfTurn), Constants.TargetController.YOU, true, false); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); diff --git a/Mage/src/mage/abilities/common/BeginningOfCombatTriggeredAbility.java b/Mage/src/mage/abilities/common/BeginningOfCombatTriggeredAbility.java index 83c03c76ec..c1947e7690 100644 --- a/Mage/src/mage/abilities/common/BeginningOfCombatTriggeredAbility.java +++ b/Mage/src/mage/abilities/common/BeginningOfCombatTriggeredAbility.java @@ -8,20 +8,24 @@ import mage.game.events.GameEvent; import mage.target.targetpointer.FixedTarget; public class BeginningOfCombatTriggeredAbility extends TriggeredAbilityImpl { + private Constants.TargetController targetController; + private boolean setTargetPointer; public BeginningOfCombatTriggeredAbility(Effect effect, Constants.TargetController targetController, boolean isOptional) { - this(Constants.Zone.BATTLEFIELD, effect, targetController, isOptional); + this(Constants.Zone.BATTLEFIELD, effect, targetController, isOptional, false); } - public BeginningOfCombatTriggeredAbility(Constants.Zone zone, Effect effect, Constants.TargetController targetController, boolean isOptional) { + public BeginningOfCombatTriggeredAbility(Constants.Zone zone, Effect effect, Constants.TargetController targetController, boolean isOptional, boolean setTargetPointer) { super(zone, effect, isOptional); this.targetController = targetController; + this.setTargetPointer = setTargetPointer; } public BeginningOfCombatTriggeredAbility(final BeginningOfCombatTriggeredAbility ability) { super(ability); this.targetController = ability.targetController; + this.setTargetPointer = ability.setTargetPointer; } @Override @@ -35,7 +39,7 @@ public class BeginningOfCombatTriggeredAbility extends TriggeredAbilityImpl