From ad12c75c20527736371550ce4a7b1f82e596c928 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Mon, 31 Jul 2017 20:55:29 +0200 Subject: [PATCH] * Cinder cloud - Fixed the check for "dies this way". --- Mage.Sets/src/mage/cards/c/CinderCloud.java | 25 +++++++++++-------- .../mage/game/permanent/PermanentImpl.java | 4 +-- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/Mage.Sets/src/mage/cards/c/CinderCloud.java b/Mage.Sets/src/mage/cards/c/CinderCloud.java index f1c18346504..dab5bca111d 100644 --- a/Mage.Sets/src/mage/cards/c/CinderCloud.java +++ b/Mage.Sets/src/mage/cards/c/CinderCloud.java @@ -27,6 +27,7 @@ */ package mage.cards.c; +import java.util.UUID; import mage.ObjectColor; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; @@ -34,13 +35,12 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Zone; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.common.TargetCreaturePermanent; -import java.util.UUID; - /** * * @author ciaccona007 @@ -49,7 +49,6 @@ public class CinderCloud extends CardImpl { public CinderCloud(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{R}{R}"); - // Destroy target creature. If a white creature dies this way, Cinder Cloud deals damage to that creature's controller equal to the creature's power. this.getSpellAbility().addEffect(new CinderCloudEffect()); @@ -85,13 +84,19 @@ class CinderCloudEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); - if(permanent != null && permanent.destroy(source.getSourceId(), game, false) && permanent.getColor(game).equals(ObjectColor.WHITE)) { - int damage = permanent.getPower().getValue(); - Player player = game.getPlayer(permanent.getControllerId()); - if(player != null) { - player.damage(damage, source.getSourceId(), game, false, true); + if (permanent != null && permanent.destroy(source.getSourceId(), game, false) && permanent.getColor(game).equals(ObjectColor.WHITE)) { + game.applyEffects(); + if (permanent.getZoneChangeCounter(game) + 1 == game.getState().getZoneChangeCounter(permanent.getId()) + && !game.getState().getZone(permanent.getId()).equals(Zone.GRAVEYARD)) { + // A replacement effect has moved the card to another zone as grvayard + return true; + } + Player permanentController = game.getPlayer(permanent.getControllerId()); + if (permanentController != null) { + int damage = permanent.getPower().getValue(); + permanentController.damage(damage, source.getSourceId(), game, false, true); } } - return false; + return true; } -} \ No newline at end of file +} diff --git a/Mage/src/main/java/mage/game/permanent/PermanentImpl.java b/Mage/src/main/java/mage/game/permanent/PermanentImpl.java index 86ed0b59fdf..f6c67594c07 100644 --- a/Mage/src/main/java/mage/game/permanent/PermanentImpl.java +++ b/Mage/src/main/java/mage/game/permanent/PermanentImpl.java @@ -953,8 +953,8 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { } if (!game.replaceEvent(GameEvent.getEvent(EventType.DESTROY_PERMANENT, objectId, sourceId, controllerId, noRegen ? 1 : 0))) { - // this means destroy was successful, if object movement to graveyard will be replaced (e.g. commander to command zone) does not count for - // successful destroying. + // this means destroy was successful, if object movement to graveyard will be replaced (e.g. commander to command zone) its still + // is handled as successful destroying (but not as sucessful "dies this way" for destroying). if (moveToZone(Zone.GRAVEYARD, sourceId, game, false)) { if (!game.isSimulation()) { String logName;