* Cinder cloud - Fixed the check for "dies this way".

This commit is contained in:
LevelX2 2017-07-31 20:55:29 +02:00
parent 7a1245e2fe
commit ad12c75c20
2 changed files with 17 additions and 12 deletions

View file

@ -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
@ -50,7 +50,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());
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
@ -86,12 +85,18 @@ class CinderCloudEffect extends OneShotEffect {
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)) {
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();
Player player = game.getPlayer(permanent.getControllerId());
if(player != null) {
player.damage(damage, source.getSourceId(), game, false, true);
permanentController.damage(damage, source.getSourceId(), game, false, true);
}
}
return false;
return true;
}
}

View file

@ -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;