diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/IcefallRegent.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/IcefallRegent.java index 9ad9275495..7a5b141836 100644 --- a/Mage.Sets/src/mage/sets/dragonsoftarkir/IcefallRegent.java +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/IcefallRegent.java @@ -30,6 +30,7 @@ package mage.sets.dragonsoftarkir; import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; +import mage.abilities.Mode; import mage.abilities.SpellAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; @@ -63,7 +64,7 @@ import mage.watchers.Watcher; * @author fireshoes */ public class IcefallRegent extends CardImpl { - + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature an opponent controls"); static { @@ -79,17 +80,17 @@ public class IcefallRegent extends CardImpl { // Flying this.addAbility(FlyingAbility.getInstance()); - + // When Icefall Regent enters the battlefield, tap target creature an opponent controls. That creature doesn't untap during its controller's untap step for as long as you control Icefall Regent. Ability ability = new EntersBattlefieldTriggeredAbility(new TapTargetEffect(), false); ability.addEffect(new IcefallRegentEffect()); Target target = new TargetCreaturePermanent(filter); ability.addTarget(target); this.addAbility(ability, new IcefallRegentWatcher()); - + // Spells your opponents cast that target Icefall Regent cost {2} more to cast. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new IcefallRegentCostIncreaseEffect())); - + } public IcefallRegent(final IcefallRegent card) { @@ -122,14 +123,14 @@ class IcefallRegentEffect extends ContinuousRuleModifyingEffectImpl { public boolean apply(Game game, Ability source) { return false; } - + @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.LOST_CONTROL || - event.getType() == GameEvent.EventType.ZONE_CHANGE || - event.getType() == GameEvent.EventType.UNTAP; + return event.getType() == GameEvent.EventType.LOST_CONTROL + || event.getType() == GameEvent.EventType.ZONE_CHANGE + || event.getType() == GameEvent.EventType.UNTAP; } - + @Override public boolean applies(GameEvent event, Ability source, Game game) { // Source must be on the battlefield (it's neccessary to check here because if as response to the enter @@ -147,7 +148,7 @@ class IcefallRegentEffect extends ContinuousRuleModifyingEffectImpl { } } if (event.getType() == GameEvent.EventType.ZONE_CHANGE && event.getTargetId().equals(source.getSourceId())) { - ZoneChangeEvent zEvent = (ZoneChangeEvent)event; + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; if (zEvent.getFromZone() == Zone.BATTLEFIELD) { discard(); return false; @@ -167,7 +168,7 @@ class IcefallRegentEffect extends ContinuousRuleModifyingEffectImpl { class IcefallRegentWatcher extends Watcher { - IcefallRegentWatcher () { + IcefallRegentWatcher() { super("ControlLost", WatcherScope.CARD); } @@ -183,7 +184,7 @@ class IcefallRegentWatcher extends Watcher { return; } if (event.getType() == GameEvent.EventType.ZONE_CHANGE && event.getTargetId().equals(sourceId)) { - ZoneChangeEvent zEvent = (ZoneChangeEvent)event; + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; if (zEvent.getFromZone() == Zone.BATTLEFIELD) { condition = true; game.replaceEvent(event); @@ -226,10 +227,12 @@ class IcefallRegentCostIncreaseEffect extends CostModificationEffectImpl { public boolean applies(Ability abilityToModify, Ability source, Game game) { if (abilityToModify instanceof SpellAbility) { if (game.getOpponents(source.getControllerId()).contains(abilityToModify.getControllerId())) { - for (Target target :abilityToModify.getTargets()) { - for (UUID targetUUID :target.getTargets()) { - if (targetUUID.equals(source.getSourceId())) { - return true; + for (Mode mode : abilityToModify.getModes().getSelectedModes()) { + for (Target target : mode.getTargets()) { + for (UUID targetUUID : target.getTargets()) { + if (targetUUID.equals(source.getSourceId())) { + return true; + } } } } @@ -243,4 +246,4 @@ class IcefallRegentCostIncreaseEffect extends CostModificationEffectImpl { return new IcefallRegentCostIncreaseEffect(this); } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/fatereforged/MonasterySiege.java b/Mage.Sets/src/mage/sets/fatereforged/MonasterySiege.java index 72a0a59c41..77e9e768e4 100644 --- a/Mage.Sets/src/mage/sets/fatereforged/MonasterySiege.java +++ b/Mage.Sets/src/mage/sets/fatereforged/MonasterySiege.java @@ -29,6 +29,7 @@ package mage.sets.fatereforged; import java.util.UUID; import mage.abilities.Ability; +import mage.abilities.Mode; import mage.abilities.SpellAbility; import mage.abilities.common.BeginningOfDrawTriggeredAbility; import mage.abilities.common.EntersBattlefieldAbility; @@ -64,13 +65,13 @@ public class MonasterySiege extends CardImpl { // As Monastery 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.", "")); - + // * Khans - At the beginning of your draw step, draw an additional card, then discard a card. this.addAbility(new ConditionalTriggeredAbility( new BeginningOfDrawTriggeredAbility(new DrawDiscardControllerEffect(1, 1), TargetController.YOU, false), new ModeChoiceSourceCondition("Khans"), "• Khans — At the beginning of your draw step, draw an additional card, then discard a card.")); - + // * Dragons - Spells your opponents cast that target you or a permanent you control cost {2} more to cast. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new MonasterySiegeCostIncreaseEffect())); } @@ -108,14 +109,16 @@ class MonasterySiegeCostIncreaseEffect extends CostModificationEffectImpl { if (new ModeChoiceSourceCondition("Dragons").apply(game, source)) { if (abilityToModify instanceof SpellAbility) { if (game.getOpponents(source.getControllerId()).contains(abilityToModify.getControllerId())) { - for (Target target : abilityToModify.getTargets()) { - for (UUID targetUUID : target.getTargets()) { - if (targetUUID.equals(source.getControllerId())) { - return true; - } - Permanent permanent = game.getPermanent(targetUUID); - if (permanent != null && permanent.getControllerId().equals(source.getControllerId())) { - return true; + for (Mode mode : abilityToModify.getModes().getSelectedModes()) { + for (Target target : mode.getTargets()) { + for (UUID targetUUID : target.getTargets()) { + if (targetUUID.equals(source.getControllerId())) { + return true; + } + Permanent permanent = game.getPermanent(targetUUID); + if (permanent != null && permanent.getControllerId().equals(source.getControllerId())) { + return true; + } } } } diff --git a/Mage.Sets/src/mage/sets/planechase2012/ElderwoodScion.java b/Mage.Sets/src/mage/sets/planechase2012/ElderwoodScion.java index c73a350de5..efa8fb3efe 100644 --- a/Mage.Sets/src/mage/sets/planechase2012/ElderwoodScion.java +++ b/Mage.Sets/src/mage/sets/planechase2012/ElderwoodScion.java @@ -27,11 +27,10 @@ */ package mage.sets.planechase2012; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; +import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; +import mage.abilities.Mode; import mage.abilities.SpellAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.common.cost.CostModificationEffectImpl; @@ -39,15 +38,16 @@ import mage.abilities.keyword.FlashbackAbility; import mage.abilities.keyword.LifelinkAbility; import mage.abilities.keyword.TrampleAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.CostModificationType; import mage.constants.Duration; import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.target.Target; import mage.util.CardUtil; -import java.util.UUID; -import mage.constants.CostModificationType; - /** * * @author LevelX2 @@ -106,10 +106,12 @@ class ElderwoodScionCostReductionEffect extends CostModificationEffectImpl { public boolean applies(Ability abilityToModify, Ability source, Game game) { if (abilityToModify instanceof SpellAbility || abilityToModify instanceof FlashbackAbility) { if (abilityToModify.getControllerId().equals(source.getControllerId())) { - for (Target target :abilityToModify.getTargets()) { - for (UUID targetUUID :target.getTargets()) { - if (targetUUID.equals(source.getSourceId())) { - return true; + for (Mode mode : abilityToModify.getModes().getSelectedModes()) { + for (Target target : mode.getTargets()) { + for (UUID targetUUID : target.getTargets()) { + if (targetUUID.equals(source.getSourceId())) { + return true; + } } } } @@ -149,8 +151,8 @@ class ElderwoodScionCostReductionEffect2 extends CostModificationEffectImpl { public boolean applies(Ability abilityToModify, Ability source, Game game) { if (abilityToModify instanceof SpellAbility) { if (game.getOpponents(source.getControllerId()).contains(abilityToModify.getControllerId())) { - for (Target target :abilityToModify.getTargets()) { - for (UUID targetUUID :target.getTargets()) { + for (Target target : abilityToModify.getTargets()) { + for (UUID targetUUID : target.getTargets()) { if (targetUUID.equals(source.getSourceId())) { return true; } diff --git a/Mage.Sets/src/mage/sets/shadowsoverinnistrad/AccursedWitch.java b/Mage.Sets/src/mage/sets/shadowsoverinnistrad/AccursedWitch.java index 090d8f1efe..bc42294c7f 100644 --- a/Mage.Sets/src/mage/sets/shadowsoverinnistrad/AccursedWitch.java +++ b/Mage.Sets/src/mage/sets/shadowsoverinnistrad/AccursedWitch.java @@ -30,6 +30,7 @@ package mage.sets.shadowsoverinnistrad; import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; +import mage.abilities.Mode; import mage.abilities.SpellAbility; import mage.abilities.common.DiesTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; @@ -138,12 +139,14 @@ class AccursedWitchSpellsCostReductionEffect extends CostModificationEffectImpl @Override public boolean applies(Ability abilityToModify, Ability source, Game game) { if (abilityToModify instanceof SpellAbility) { - if(game.getOpponents(source.getControllerId()).contains(abilityToModify.getControllerId())) { - for (Target target : abilityToModify.getTargets()) { - for (UUID targetUUID : target.getTargets()) { - Permanent permanent = game.getPermanent(targetUUID); - if(permanent != null && permanent.getId().equals(source.getSourceId())) { - return true; + if (game.getOpponents(source.getControllerId()).contains(abilityToModify.getControllerId())) { + for (Mode mode : abilityToModify.getModes().getSelectedModes()) { + for (Target target : mode.getTargets()) { + for (UUID targetUUID : target.getTargets()) { + Permanent permanent = game.getPermanent(targetUUID); + if (permanent != null && permanent.getId().equals(source.getSourceId())) { + return true; + } } } } @@ -157,5 +160,3 @@ class AccursedWitchSpellsCostReductionEffect extends CostModificationEffectImpl return new AccursedWitchSpellsCostReductionEffect(this); } } - - diff --git a/Mage.Sets/src/mage/sets/shadowsoverinnistrad/InfectiousCurse.java b/Mage.Sets/src/mage/sets/shadowsoverinnistrad/InfectiousCurse.java index cf60a505bc..2cc858e4bb 100644 --- a/Mage.Sets/src/mage/sets/shadowsoverinnistrad/InfectiousCurse.java +++ b/Mage.Sets/src/mage/sets/shadowsoverinnistrad/InfectiousCurse.java @@ -29,6 +29,7 @@ package mage.sets.shadowsoverinnistrad; import java.util.UUID; import mage.abilities.Ability; +import mage.abilities.Mode; import mage.abilities.SpellAbility; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.SimpleStaticAbility; @@ -154,12 +155,14 @@ class InfectiousCurseCostReductionEffect extends CostModificationEffectImpl { public boolean applies(Ability abilityToModify, Ability source, Game game) { if (abilityToModify instanceof SpellAbility) { if (source.getControllerId().equals(abilityToModify.getControllerId())) { - for (Target target : abilityToModify.getTargets()) { - for (UUID targetUUID : target.getTargets()) { - Permanent enchantment = game.getPermanent(source.getSourceId()); - UUID attachedTo = enchantment.getAttachedTo(); - if (targetUUID.equals(attachedTo)) { - return true; + for (Mode mode : abilityToModify.getModes().getSelectedModes()) { + for (Target target : mode.getTargets()) { + for (UUID targetUUID : target.getTargets()) { + Permanent enchantment = game.getPermanent(source.getSourceId()); + UUID attachedTo = enchantment.getAttachedTo(); + if (targetUUID.equals(attachedTo)) { + return true; + } } } }