* Kalitas, Bloodchief of Ghet - Fixed that the token was not created for destroyed tokens.

This commit is contained in:
LevelX2 2014-10-06 14:37:09 +02:00
parent 804f8528e7
commit 522e71a4af

View file

@ -33,14 +33,12 @@ import mage.constants.Outcome;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.Zone; import mage.constants.Zone;
import mage.MageInt; import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
@ -98,21 +96,11 @@ class KalitasDestroyEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
for (UUID permanentId : targetPointer.getTargets(game, source)) { Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
Permanent permanent = game.getPermanent(permanentId); if (permanent != null && permanent.destroy(source.getSourceId(), game, false)) { // if not destroyed or moved to other zone (replacement effect) it returns false
if (permanent != null) { new CreateTokenEffect(new VampireToken(permanent.getPower().getValue(), permanent.getToughness().getValue())).apply(game, source);
Card card = game.getCard(permanent.getId());
int zoneChangeCounter = card.getZoneChangeCounter();
if (permanent.destroy(source.getSourceId(), game, false)) {
if (card != null && game.getPlayer(permanent.getOwnerId()).getGraveyard().contains(card.getId()) &&
card.getZoneChangeCounter() == zoneChangeCounter)
{
return new CreateTokenEffect(new VampireToken(permanent.getPower().getValue(), permanent.getToughness().getValue())).apply(game, source);
}
}
}
} }
return false; return true;
} }
} }