diff --git a/Mage.Sets/src/mage/sets/avacynrestored/TreacherousPitDweller.java b/Mage.Sets/src/mage/sets/avacynrestored/TreacherousPitDweller.java index 8d7b923b578..337d893d1aa 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/TreacherousPitDweller.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/TreacherousPitDweller.java @@ -109,9 +109,11 @@ class TreacherousPitDwellerEffect extends ContinuousEffectImpl { @Override public boolean apply(Game game, Ability source) { - Permanent permanent = game.getPermanent(source.getSourceId()); + Permanent permanent = (Permanent) source.getSourceObjectIfItStillExists(game); if (permanent != null) { return permanent.changeControllerId(source.getFirstTarget(), game); + } else { + discard(); } return false; } diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/Shuriken.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/Shuriken.java index 5f8314ef1bf..3ba3e2f8117 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/Shuriken.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/Shuriken.java @@ -199,7 +199,7 @@ class ShurikenControlEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Permanent equipment = null; + Permanent equipment = null; // TODO: Meanwhile blinked object would be found regardless for(Cost cost : source.getCosts()) { if (cost instanceof ShurikenUnattachCost) { equipment = ((ShurikenUnattachCost) cost).getEquipment(); diff --git a/Mage.Sets/src/mage/sets/magic2011/JinxedIdol.java b/Mage.Sets/src/mage/sets/magic2011/JinxedIdol.java index 9ca81ab7c45..5f38adf25a1 100644 --- a/Mage.Sets/src/mage/sets/magic2011/JinxedIdol.java +++ b/Mage.Sets/src/mage/sets/magic2011/JinxedIdol.java @@ -53,7 +53,11 @@ public class JinxedIdol extends CardImpl { public JinxedIdol(UUID ownerId) { super(ownerId, 208, "Jinxed Idol", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{2}"); this.expansionSetCode = "M11"; + + // At the beginning of your upkeep, Jinxed Idol deals 2 damage to you. this.addAbility(new OnEventTriggeredAbility(EventType.UPKEEP_STEP_PRE, "beginning of your upkeep", new DamageControllerEffect(2))); + + // Sacrifice a creature: Target opponent gains control of Jinxed Idol. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new JinxedIdolEffect(), new SacrificeTargetCost(new TargetControlledCreaturePermanent())); ability.addTarget(new TargetOpponent()); this.addAbility(ability); @@ -88,9 +92,11 @@ class JinxedIdolEffect extends ContinuousEffectImpl { @Override public boolean apply(Game game, Ability source) { - Permanent permanent = game.getPermanent(source.getSourceId()); + Permanent permanent = (Permanent) source.getSourceObjectIfItStillExists(game); if (permanent != null) { return permanent.changeControllerId(source.getFirstTarget(), game); + } else { + discard(); } return false; } diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/ContestedWarZone.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/ContestedWarZone.java index f538f300c1a..18aa0237fd6 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/ContestedWarZone.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/ContestedWarZone.java @@ -132,7 +132,7 @@ class ContestedWarZoneAbility extends TriggeredAbilityImpl { class ContestedWarZoneEffect extends ContinuousEffectImpl { public ContestedWarZoneEffect() { - super(Duration.EndOfGame, Layer.ControlChangingEffects_2, SubLayer.NA, Outcome.GainControl); + super(Duration.Custom, Layer.ControlChangingEffects_2, SubLayer.NA, Outcome.GainControl); } public ContestedWarZoneEffect(final ContestedWarZoneEffect effect) { @@ -146,10 +146,12 @@ class ContestedWarZoneEffect extends ContinuousEffectImpl { @Override public boolean apply(Game game, Ability source) { - Permanent permanent = game.getPermanent(source.getSourceId()); + Permanent permanent = (Permanent) source.getSourceObjectIfItStillExists(game); UUID controllerId = (UUID) game.getState().getValue(source.getSourceId().toString()); if (permanent != null && controllerId != null) { return permanent.changeControllerId(controllerId, game); + } else { + discard(); } return false; } diff --git a/Mage.Sets/src/mage/sets/saviorsofkamigawa/MeasureOfWickedness.java b/Mage.Sets/src/mage/sets/saviorsofkamigawa/MeasureOfWickedness.java index 5a6262208de..695767fa0ce 100644 --- a/Mage.Sets/src/mage/sets/saviorsofkamigawa/MeasureOfWickedness.java +++ b/Mage.Sets/src/mage/sets/saviorsofkamigawa/MeasureOfWickedness.java @@ -113,7 +113,7 @@ class MeasureOfWickednessControlSourceEffect extends ContinuousEffectImpl { @Override public boolean apply(Game game, Ability source) { Player targetOpponent = game.getPlayer(source.getFirstTarget()); - Permanent permanent = game.getPermanent(source.getSourceId()); + Permanent permanent = (Permanent) source.getSourceObjectIfItStillExists(game); if (permanent != null && targetOpponent != null) { permanent.changeControllerId(targetOpponent.getId(), game); } else { diff --git a/Mage.Sets/src/mage/sets/urzassaga/GoblinCadets.java b/Mage.Sets/src/mage/sets/urzassaga/GoblinCadets.java index b8b5d85b82f..a45be6b518f 100644 --- a/Mage.Sets/src/mage/sets/urzassaga/GoblinCadets.java +++ b/Mage.Sets/src/mage/sets/urzassaga/GoblinCadets.java @@ -93,9 +93,11 @@ class GoblinCadetsChangeControlEffect extends ContinuousEffectImpl { @Override public boolean apply(Game game, Ability source) { - Permanent permanent = game.getPermanent(source.getSourceId()); + Permanent permanent = (Permanent) source.getSourceObjectIfItStillExists(game); if (permanent != null) { return permanent.changeControllerId(source.getFirstTarget(), game); + } else { + discard(); } return false; }