diff --git a/Mage.Sets/src/mage/cards/c/CitadelSiege.java b/Mage.Sets/src/mage/cards/c/CitadelSiege.java index 86093720e5..99948a4706 100644 --- a/Mage.Sets/src/mage/cards/c/CitadelSiege.java +++ b/Mage.Sets/src/mage/cards/c/CitadelSiege.java @@ -15,28 +15,33 @@ import mage.constants.CardType; import mage.constants.TargetController; import mage.counters.CounterType; import mage.filter.common.FilterCreaturePermanent; -import mage.filter.predicate.permanent.ControllerIdPredicate; +import mage.filter.predicate.Predicate; import mage.game.Game; +import mage.game.permanent.Permanent; import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetCreaturePermanent; import java.util.UUID; /** - * * @author LevelX2 */ public final class CitadelSiege extends CardImpl { private final static String ruleTrigger1 = "&bull Khans — At the beginning of combat on your turn, put two +1/+1 counters on target creature you control."; private final static String ruleTrigger2 = "&bull Dragons — At the beginning of combat on each opponent's turn, tap target creature that player controls."; + private final static FilterCreaturePermanent filter = new FilterCreaturePermanent("creature controlled by the active player"); + + static { + filter.add(CitadelSiegePredicate.instance); + } public CitadelSiege(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{W}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}{W}"); // As Citadel Siege enters the battlefield, choose Khans or Dragons. - this.addAbility(new EntersBattlefieldAbility(new ChooseModeEffect("Khans or Dragons?","Khans", "Dragons"),null, - "As {this} enters the battlefield, choose Khans or Dragons.","")); + this.addAbility(new EntersBattlefieldAbility(new ChooseModeEffect("Khans or Dragons?", "Khans", "Dragons"), null, + "As {this} enters the battlefield, choose Khans or Dragons.", "")); // * Khans - At the beginning of combat on your turn, put two +1/+1 counters on target creature you control. Ability ability = new ConditionalTriggeredAbility( @@ -51,21 +56,10 @@ public final class CitadelSiege extends CardImpl { new BeginningOfCombatTriggeredAbility(new TapTargetEffect(), TargetController.OPPONENT, false), new ModeChoiceSourceCondition("Dragons"), ruleTrigger2); - ability.addTarget(new TargetCreaturePermanent()); + ability.addTarget(new TargetCreaturePermanent(filter)); this.addAbility(ability); } - @Override - public void adjustTargets(Ability ability, Game game) { - if (this.getAbilities().contains(ability) && ability.getRule().startsWith("&bull Dragons")) { - FilterCreaturePermanent filter = new FilterCreaturePermanent("creature that player controls"); - filter.add(new ControllerIdPredicate(game.getCombat().getAttackingPlayerId())); - ability.getTargets().clear(); - ability.addTarget(new TargetCreaturePermanent(filter)); - } - } - - public CitadelSiege(final CitadelSiege card) { super(card); } @@ -75,3 +69,12 @@ public final class CitadelSiege extends CardImpl { return new CitadelSiege(this); } } + +enum CitadelSiegePredicate implements Predicate { + instance; + + @Override + public boolean apply(Permanent input, Game game) { + return input.getControllerId().equals(game.getActivePlayerId()); + } +} \ No newline at end of file