diff --git a/Mage.Sets/src/mage/sets/mirrodin/ClockworkCondor.java b/Mage.Sets/src/mage/sets/mirrodin/ClockworkCondor.java index f71b970fe9..3277a308ed 100644 --- a/Mage.Sets/src/mage/sets/mirrodin/ClockworkCondor.java +++ b/Mage.Sets/src/mage/sets/mirrodin/ClockworkCondor.java @@ -38,6 +38,7 @@ import mage.abilities.Ability; import mage.abilities.DelayedTriggeredAbility; import mage.abilities.common.AttacksOrBlocksTriggeredAbility; import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.effects.common.counter.RemoveCounterSourceEffect; @@ -88,10 +89,10 @@ class ClockworkCondorEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent p = game.getPermanent(source.getSourceId()); if (p != null) { - ClockworkDragonDelayedTriggeredAbility delayedAbility = new ClockworkDragonDelayedTriggeredAbility(); - delayedAbility.setSourceId(source.getSourceId()); - delayedAbility.setControllerId(source.getControllerId()); - game.addDelayedTriggeredAbility(delayedAbility); + AtTheEndOfCombatDelayedTriggeredAbility ability = new AtTheEndOfCombatDelayedTriggeredAbility(new RemoveCounterSourceEffect(CounterType.P1P1.createInstance())); + ability.setSourceId(source.getSourceId()); + ability.setControllerId(source.getControllerId()); + game.addDelayedTriggeredAbility(ability); } return false; } @@ -106,26 +107,3 @@ class ClockworkCondorEffect extends OneShotEffect { return "remove a +1/+1 counter from Clockwork Condor at end of combat"; } } - -class ClockworkCondorDelayedTriggeredAbility extends DelayedTriggeredAbility { - ClockworkCondorDelayedTriggeredAbility() { - super(new RemoveCounterSourceEffect(CounterType.P1P1.createInstance())); - } - - ClockworkCondorDelayedTriggeredAbility(final ClockworkCondorDelayedTriggeredAbility ability) { - super(ability); - } - - @Override - public ClockworkCondorDelayedTriggeredAbility copy() { - return new ClockworkCondorDelayedTriggeredAbility(this); - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.COMBAT_PHASE_POST) { - return true; - } - return false; - } -} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/mirrodin/ClockworkDragon.java b/Mage.Sets/src/mage/sets/mirrodin/ClockworkDragon.java index 4586d88abc..54962b8e4e 100644 --- a/Mage.Sets/src/mage/sets/mirrodin/ClockworkDragon.java +++ b/Mage.Sets/src/mage/sets/mirrodin/ClockworkDragon.java @@ -40,6 +40,7 @@ import mage.abilities.DelayedTriggeredAbility; import mage.abilities.common.AttacksOrBlocksTriggeredAbility; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; @@ -92,10 +93,10 @@ class ClockworkDragonEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Permanent p = game.getPermanent(source.getSourceId()); if (p != null) { - ClockworkDragonDelayedTriggeredAbility delayedAbility = new ClockworkDragonDelayedTriggeredAbility(); - delayedAbility.setSourceId(source.getSourceId()); - delayedAbility.setControllerId(source.getControllerId()); - game.addDelayedTriggeredAbility(delayedAbility); + AtTheEndOfCombatDelayedTriggeredAbility ability = new AtTheEndOfCombatDelayedTriggeredAbility(new RemoveCounterSourceEffect(CounterType.P1P1.createInstance())); + ability.setSourceId(source.getSourceId()); + ability.setControllerId(source.getControllerId()); + game.addDelayedTriggeredAbility(ability); } return false; } @@ -110,26 +111,3 @@ class ClockworkDragonEffect extends OneShotEffect { return "remove a +1/+1 counter from Clockwork Dragon at end of combat"; } } - -class ClockworkDragonDelayedTriggeredAbility extends DelayedTriggeredAbility { - ClockworkDragonDelayedTriggeredAbility() { - super(new RemoveCounterSourceEffect(CounterType.P1P1.createInstance())); - } - - ClockworkDragonDelayedTriggeredAbility(final ClockworkDragonDelayedTriggeredAbility ability) { - super(ability); - } - - @Override - public ClockworkDragonDelayedTriggeredAbility copy() { - return new ClockworkDragonDelayedTriggeredAbility(this); - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.COMBAT_PHASE_POST) { - return true; - } - return false; - } -} \ No newline at end of file diff --git a/Mage/src/mage/abilities/common/delayed/AtTheEndOfCombatDelayedTriggeredAbility.java b/Mage/src/mage/abilities/common/delayed/AtTheEndOfCombatDelayedTriggeredAbility.java new file mode 100644 index 0000000000..8358572f89 --- /dev/null +++ b/Mage/src/mage/abilities/common/delayed/AtTheEndOfCombatDelayedTriggeredAbility.java @@ -0,0 +1,34 @@ +package mage.abilities.common.delayed; + +import mage.abilities.DelayedTriggeredAbility; +import mage.abilities.effects.Effect; +import mage.game.Game; +import mage.game.events.GameEvent; + +public class AtTheEndOfCombatDelayedTriggeredAbility extends DelayedTriggeredAbility { + public AtTheEndOfCombatDelayedTriggeredAbility(Effect effect) { + super(effect); + } + + public AtTheEndOfCombatDelayedTriggeredAbility(AtTheEndOfCombatDelayedTriggeredAbility ability) { + super(ability); + } + + @Override + public AtTheEndOfCombatDelayedTriggeredAbility copy() { + return new AtTheEndOfCombatDelayedTriggeredAbility(this); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getType() == GameEvent.EventType.COMBAT_PHASE_POST) { + return true; + } + return false; + } + + @Override + public String getRule() { + return "At end of combat, " + effects.getText(this); + } +} diff --git a/Mage/src/mage/abilities/effects/common/counter/RemoveCounterSourceEffect.java b/Mage/src/mage/abilities/effects/common/counter/RemoveCounterSourceEffect.java index 0e859746e8..c62a5707d5 100644 --- a/Mage/src/mage/abilities/effects/common/counter/RemoveCounterSourceEffect.java +++ b/Mage/src/mage/abilities/effects/common/counter/RemoveCounterSourceEffect.java @@ -34,4 +34,14 @@ public class RemoveCounterSourceEffect extends OneShotEffect 1) { + StringBuilder sb = new StringBuilder(); + sb.append("remove ").append(Integer.toString(counter.getCount())).append(" ").append(counter.getName()).append(" counters from {this}"); + return sb.toString(); + } else + return "remove a " + counter.getName() + " counter from {this}"; + } }