Aura replacement effect fix

This commit is contained in:
magenoxx 2012-05-20 17:41:09 +04:00
parent 02a21c6311
commit 41006a822a

View file

@ -27,7 +27,6 @@
*/ */
package mage.abilities.effects; package mage.abilities.effects;
import java.util.UUID;
import mage.Constants.CardType; import mage.Constants.CardType;
import mage.Constants.Duration; import mage.Constants.Duration;
import mage.Constants.Outcome; import mage.Constants.Outcome;
@ -44,6 +43,8 @@ import mage.game.stack.StackAbility;
import mage.players.Player; import mage.players.Player;
import mage.target.Target; import mage.target.Target;
import java.util.UUID;
/** /**
* *
* @author North * @author North
@ -75,6 +76,12 @@ public class AuraReplacementEffect extends ReplacementEffectImpl<AuraReplacement
UUID sourceId = event.getSourceId(); UUID sourceId = event.getSourceId();
UUID controllerId = event.getPlayerId(); UUID controllerId = event.getPlayerId();
// Aura enters the battlefield attached
Object object = game.getState().getValue("attachTo:"+card.getId());
if (object != null && object instanceof PermanentCard) {
return false;
}
UUID targetId = null; UUID targetId = null;
MageObject sourceObject = game.getObject(sourceId); MageObject sourceObject = game.getObject(sourceId);
if (sourceObject instanceof StackAbility) { if (sourceObject instanceof StackAbility) {
@ -113,6 +120,7 @@ public class AuraReplacementEffect extends ReplacementEffectImpl<AuraReplacement
game.setZone(card.getId(), Zone.BATTLEFIELD); game.setZone(card.getId(), Zone.BATTLEFIELD);
game.applyEffects(); game.applyEffects();
permanent.entersBattlefield(event.getSourceId(), game); permanent.entersBattlefield(event.getSourceId(), game);
game.applyEffects();
game.fireEvent(new ZoneChangeEvent(permanent, controllerId, fromZone, Zone.BATTLEFIELD)); game.fireEvent(new ZoneChangeEvent(permanent, controllerId, fromZone, Zone.BATTLEFIELD));
if (targetPermanent != null) { if (targetPermanent != null) {