From 33dff8199d0879e887e562378ab5c6f55a6f4d80 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Fri, 20 Apr 2018 11:15:33 -0400 Subject: [PATCH] updated Searing Blaze et al --- .../src/mage/cards/r/RavagerOfTheFells.java | 36 ++++++++++++------- Mage.Sets/src/mage/cards/s/SearingBlaze.java | 30 +++++++++------- .../src/mage/cards/s/SoulOfShandalar.java | 30 ++++++++++------ 3 files changed, 59 insertions(+), 37 deletions(-) diff --git a/Mage.Sets/src/mage/cards/r/RavagerOfTheFells.java b/Mage.Sets/src/mage/cards/r/RavagerOfTheFells.java index 685218673c..beec2d52db 100644 --- a/Mage.Sets/src/mage/cards/r/RavagerOfTheFells.java +++ b/Mage.Sets/src/mage/cards/r/RavagerOfTheFells.java @@ -57,7 +57,7 @@ import mage.game.stack.StackObject; import mage.players.Player; import mage.target.Target; import mage.target.TargetPermanent; -import mage.target.common.TargetOpponent; +import mage.target.common.TargetOpponentOrPlaneswalker; /** * @@ -85,7 +85,11 @@ public class RavagerOfTheFells extends CardImpl { // At the beginning of each upkeep, if a player cast two or more spells last turn, transform Ravager of the Fells. TriggeredAbility ability = new BeginningOfUpkeepTriggeredAbility(new TransformSourceEffect(false), TargetController.ANY, false); - this.addAbility(new ConditionalTriggeredAbility(ability, TwoOrMoreSpellsWereCastLastTurnCondition.instance, TransformAbility.TWO_OR_MORE_SPELLS_TRANSFORM_RULE)); + this.addAbility(new ConditionalTriggeredAbility( + ability, + TwoOrMoreSpellsWereCastLastTurnCondition.instance, + TransformAbility.TWO_OR_MORE_SPELLS_TRANSFORM_RULE + )); } public RavagerOfTheFells(final RavagerOfTheFells card) { @@ -102,7 +106,7 @@ class RavagerOfTheFellsAbility extends TriggeredAbilityImpl { public RavagerOfTheFellsAbility() { super(Zone.BATTLEFIELD, new RavagerOfTheFellsEffect(), false); - Target target1 = new TargetOpponent(); + Target target1 = new TargetOpponentOrPlaneswalker(); this.addTarget(target1); this.addTarget(new RavagerOfTheFellsTarget()); } @@ -134,7 +138,9 @@ class RavagerOfTheFellsAbility extends TriggeredAbilityImpl { @Override public String getRule() { - return "Whenever this creature transforms into Ravager of the Fells, it deals 2 damage to target opponent and 2 damage to up to one target creature that player controls."; + return "Whenever this creature transforms into {this}, " + + "it deals 2 damage to target opponent or planeswalker " + + "and 2 damage to up to one target creature that player or that planeswalker’s controller controls."; } } @@ -156,10 +162,7 @@ class RavagerOfTheFellsEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(source.getTargets().get(0).getFirstTarget()); - if (player != null) { - player.damage(2, source.getSourceId(), game, false, true); - } + game.damagePlayerOrPlaneswalker(source.getTargets().get(0).getFirstTarget(), 2, source.getSourceId(), game, false, true); Permanent creature = game.getPermanent(source.getTargets().get(1).getFirstTarget()); if (creature != null) { creature.damage(2, source.getSourceId(), game, false, true); @@ -181,7 +184,11 @@ class RavagerOfTheFellsTarget extends TargetPermanent { @Override public boolean canTarget(UUID id, Ability source, Game game) { - UUID firstTarget = source.getFirstTarget(); + Player player = game.getPlayerOrPlaneswalkerController(source.getFirstTarget()); + if (player == null) { + return false; + } + UUID firstTarget = player.getId(); Permanent permanent = game.getPermanent(id); if (firstTarget != null && permanent != null && permanent.getControllerId().equals(firstTarget)) { return super.canTarget(id, source, game); @@ -206,10 +213,13 @@ class RavagerOfTheFellsTarget extends TargetPermanent { if (object instanceof StackObject) { UUID playerId = ((StackObject) object).getStackAbility().getFirstTarget(); - for (UUID targetId : availablePossibleTargets) { - Permanent permanent = game.getPermanent(targetId); - if (permanent != null && permanent.getControllerId().equals(playerId)) { - possibleTargets.add(targetId); + Player player = game.getPlayerOrPlaneswalkerController(playerId); + if (player != null) { + for (UUID targetId : availablePossibleTargets) { + Permanent permanent = game.getPermanent(targetId); + if (permanent != null && permanent.getControllerId().equals(player.getId())) { + possibleTargets.add(targetId); + } } } } diff --git a/Mage.Sets/src/mage/cards/s/SearingBlaze.java b/Mage.Sets/src/mage/cards/s/SearingBlaze.java index d06a022fae..e8639acc0f 100644 --- a/Mage.Sets/src/mage/cards/s/SearingBlaze.java +++ b/Mage.Sets/src/mage/cards/s/SearingBlaze.java @@ -43,7 +43,7 @@ import mage.game.permanent.Permanent; import mage.game.stack.StackObject; import mage.players.Player; import mage.target.TargetPermanent; -import mage.target.TargetPlayer; +import mage.target.common.TargetPlayerOrPlaneswalker; import mage.watchers.common.LandfallWatcher; /** @@ -54,11 +54,11 @@ import mage.watchers.common.LandfallWatcher; public class SearingBlaze extends CardImpl { public SearingBlaze(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{R}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{R}{R}"); // Searing Blaze deals 1 damage to target player and 1 damage to target creature that player controls. // Landfall - If you had a land enter the battlefield under your control this turn, Searing Blaze deals 3 damage to that player and 3 damage to that creature instead. - this.getSpellAbility().addTarget(new TargetPlayer()); + this.getSpellAbility().addTarget(new TargetPlayerOrPlaneswalker()); this.getSpellAbility().addTarget(new SearingBlazeTarget()); this.getSpellAbility().addEffect(new SearingBlazeEffect()); this.getSpellAbility().addWatcher(new LandfallWatcher()); @@ -79,7 +79,7 @@ class SearingBlazeEffect extends OneShotEffect { public SearingBlazeEffect() { super(Outcome.Damage); - staticText = "{this} deals 1 damage to target player and 1 damage to target creature that player controls. \nLandfall - If you had a land enter the battlefield under your control this turn, {this} deals 3 damage to that player and 3 damage to that creature instead"; + staticText = "{this} deals 1 damage to target player or planeswalker and 1 damage to target creature that player or that planeswalker’s controller controls. \nLandfall - If you had a land enter the battlefield under your control this turn, {this} deals 3 damage to that player or planeswalker and 3 damage to that creature instead."; } public SearingBlazeEffect(final SearingBlazeEffect effect) { @@ -94,15 +94,12 @@ class SearingBlazeEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { LandfallWatcher watcher = (LandfallWatcher) game.getState().getWatchers().get(LandfallWatcher.class.getSimpleName()); - Player player = game.getPlayer(source.getTargets().get(0).getFirstTarget()); Permanent creature = game.getPermanent(source.getTargets().get(1).getFirstTarget()); int damage = 1; if (watcher != null && watcher.landPlayed(source.getControllerId())) { damage = 3; } - if (player != null) { - player.damage(damage, source.getSourceId(), game, false, true); - } + game.damagePlayerOrPlaneswalker(source.getTargets().get(0).getFirstTarget(), damage, source.getSourceId(), game, false, true); if (creature != null) { creature.damage(damage, source.getSourceId(), game, false, true); } @@ -123,7 +120,11 @@ class SearingBlazeTarget extends TargetPermanent { @Override public boolean canTarget(UUID id, Ability source, Game game) { - UUID firstTarget = source.getFirstTarget(); + Player player = game.getPlayerOrPlaneswalkerController(source.getFirstTarget()); + if (player == null) { + return false; + } + UUID firstTarget = player.getId(); Permanent permanent = game.getPermanent(id); if (firstTarget != null && permanent != null && permanent.getControllerId().equals(firstTarget)) { return super.canTarget(id, source, game); @@ -138,10 +139,13 @@ class SearingBlazeTarget extends TargetPermanent { MageObject object = game.getObject(sourceId); if (object instanceof StackObject) { UUID playerId = ((StackObject) object).getStackAbility().getFirstTarget(); - for (UUID targetId : availablePossibleTargets) { - Permanent permanent = game.getPermanent(targetId); - if (permanent != null && permanent.getControllerId().equals(playerId)) { - possibleTargets.add(targetId); + Player player = game.getPlayerOrPlaneswalkerController(playerId); + if (player != null) { + for (UUID targetId : availablePossibleTargets) { + Permanent permanent = game.getPermanent(targetId); + if (permanent != null && permanent.getControllerId().equals(player.getId())) { + possibleTargets.add(targetId); + } } } } diff --git a/Mage.Sets/src/mage/cards/s/SoulOfShandalar.java b/Mage.Sets/src/mage/cards/s/SoulOfShandalar.java index 25e3d4e8fb..556d6b511c 100644 --- a/Mage.Sets/src/mage/cards/s/SoulOfShandalar.java +++ b/Mage.Sets/src/mage/cards/s/SoulOfShandalar.java @@ -50,7 +50,7 @@ import mage.game.permanent.Permanent; import mage.game.stack.StackObject; import mage.players.Player; import mage.target.TargetPermanent; -import mage.target.TargetPlayer; +import mage.target.common.TargetPlayerOrPlaneswalker; /** * @author noxx @@ -58,7 +58,7 @@ import mage.target.TargetPlayer; public class SoulOfShandalar extends CardImpl { public SoulOfShandalar(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{R}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{R}{R}"); this.subtype.add(SubType.AVATAR); this.power = new MageInt(6); @@ -69,14 +69,14 @@ public class SoulOfShandalar extends CardImpl { // {3}{R}{R}: Soul of Shandalar deals 3 damage to target player and 3 damage to up to one target creature that player controls. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SoulOfShandalarEffect(), new ManaCostsImpl("{3}{R}{R}")); - ability.addTarget(new TargetPlayer()); + ability.addTarget(new TargetPlayerOrPlaneswalker()); ability.addTarget(new SoulOfShandalarTarget()); this.addAbility(ability); // {3}{R}{R}, Exile Soul of Shandalar from your graveyard: Soul of Shandalar deals 3 damage to target player and 3 damage to up to one target creature that player controls. ability = new SimpleActivatedAbility(Zone.GRAVEYARD, new SoulOfShandalarEffect(), new ManaCostsImpl("{3}{R}{R}")); ability.addCost(new ExileSourceFromGraveCost()); - ability.addTarget(new TargetPlayer()); + ability.addTarget(new TargetPlayerOrPlaneswalker()); ability.addTarget(new SoulOfShandalarTarget()); this.addAbility(ability); } @@ -95,7 +95,8 @@ class SoulOfShandalarEffect extends OneShotEffect { public SoulOfShandalarEffect() { super(Outcome.Damage); - staticText = "Soul of Shandalar deals 3 damage to target player and 3 damage to up to one target creature that player controls"; + staticText = "{this} deals 3 damage to target player or planeswalker " + + "and 3 damage to up to one target creature that player or that planeswalker’s controller controls"; } public SoulOfShandalarEffect(final SoulOfShandalarEffect effect) { @@ -124,7 +125,7 @@ class SoulOfShandalarEffect extends OneShotEffect { class SoulOfShandalarTarget extends TargetPermanent { public SoulOfShandalarTarget() { - super(0, 1, new FilterCreaturePermanent("creature that the targeted player controls"), false); + super(0, 1, new FilterCreaturePermanent("creature that the targeted player or planeswalker's controller controls"), false); } public SoulOfShandalarTarget(final SoulOfShandalarTarget target) { @@ -133,7 +134,11 @@ class SoulOfShandalarTarget extends TargetPermanent { @Override public boolean canTarget(UUID id, Ability source, Game game) { - UUID firstTarget = source.getFirstTarget(); + Player player = game.getPlayerOrPlaneswalkerController(source.getFirstTarget()); + if (player == null) { + return false; + } + UUID firstTarget = player.getId(); Permanent permanent = game.getPermanent(id); if (firstTarget != null && permanent != null && permanent.getControllerId().equals(firstTarget)) { return super.canTarget(id, source, game); @@ -158,10 +163,13 @@ class SoulOfShandalarTarget extends TargetPermanent { if (object instanceof StackObject) { UUID playerId = ((StackObject) object).getStackAbility().getFirstTarget(); - for (UUID targetId : availablePossibleTargets) { - Permanent permanent = game.getPermanent(targetId); - if (permanent != null && permanent.getControllerId().equals(playerId)) { - possibleTargets.add(targetId); + Player player = game.getPlayerOrPlaneswalkerController(playerId); + if (player != null) { + for (UUID targetId : availablePossibleTargets) { + Permanent permanent = game.getPermanent(targetId); + if (permanent != null && permanent.getControllerId().equals(player.getId())) { + possibleTargets.add(targetId); + } } } }