- Candidate fix for Lazav, Dimir Mastermind. Worked well in my tests. Now we just need the trigger identification stamp deal and things should be in good shape.

This commit is contained in:
jeffwadsworth 2013-02-08 14:21:32 -06:00
parent 2ce260a664
commit ec75e92c7d

View file

@ -33,6 +33,7 @@ import mage.Constants.CardType;
import mage.Constants.Rarity; import mage.Constants.Rarity;
import mage.Constants.Zone; import mage.Constants.Zone;
import mage.MageInt; import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.ContinuousEffectImpl; import mage.abilities.effects.ContinuousEffectImpl;
@ -45,6 +46,7 @@ import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType; import mage.game.events.GameEvent.EventType;
import mage.game.events.ZoneChangeEvent; import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.game.permanent.PermanentToken;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
/** /**
@ -98,15 +100,17 @@ class CreatureCardPutOpponentGraveyardTriggeredAbility extends TriggeredAbilityI
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.ZONE_CHANGE) { if (event.getType() == EventType.ZONE_CHANGE
ZoneChangeEvent zEvent = (ZoneChangeEvent) event; && ((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD) {
UUID cardId = event.getTargetId(); MageObject object = game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD);
Card card = game.getCard(cardId); if (object == null) {
if (zEvent.getToZone() == Zone.GRAVEYARD return false;
&& game.getOpponents(controllerId).contains(card.getOwnerId()) }
&& card.getCardType().contains(CardType.CREATURE)) { if (game.getOpponents(controllerId).contains(event.getPlayerId())
&& object.getCardType().contains(CardType.CREATURE)
&& (!(object instanceof PermanentToken))) {
for (Effect effect : this.getEffects()) { for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(cardId)); effect.setTargetPointer(new FixedTarget(object.getId()));
} }
return true; return true;
} }
@ -148,17 +152,25 @@ class LazavDimirEffect extends ContinuousEffectImpl<LazavDimirEffect> {
permanent.getManaCost().clear(); permanent.getManaCost().clear();
permanent.getManaCost().add(card.getManaCost()); permanent.getManaCost().add(card.getManaCost());
for (CardType type : card.getCardType()) { for (CardType type : card.getCardType()) {
permanent.getCardType().add(type); if (!permanent.getCardType().contains(type)) {
permanent.getCardType().add(type);
}
} }
for (String type : card.getSubtype()) { for (String type : card.getSubtype()) {
permanent.getSubtype().add(type); if (!permanent.getSubtype().contains(type)) {
permanent.getSubtype().add(type);
}
} }
for (String type : card.getSupertype()) { for (String type : card.getSupertype()) {
permanent.getSupertype().add(type); if (!permanent.getSupertype().contains(type)) {
permanent.getSupertype().add(type);
}
} }
permanent.setExpansionSetCode(card.getExpansionSetCode()); permanent.setExpansionSetCode(card.getExpansionSetCode());
for (Ability ability : card.getAbilities()) { for (Ability ability : card.getAbilities()) {
permanent.addAbility(ability, source.getId(), game); if (!permanent.getAbilities().contains(ability)) {
permanent.addAbility(ability, source.getId(), game);
}
} }
return true; return true;
} }