Fixed #209. Aura enchantments targeting controlled creatures go to graveyard as a stet based effect, if controller of the enchanted creature is another than enchantment's controller.

This commit is contained in:
LevelX2 2013-04-23 23:10:44 +02:00
parent c7bdc5719d
commit 9e9256cd82

View file

@ -88,6 +88,7 @@ import java.io.IOException;
import java.io.Serializable; import java.io.Serializable;
import java.util.*; import java.util.*;
import java.util.Map.Entry; import java.util.Map.Entry;
import mage.filter.common.FilterControlledCreaturePermanent;
public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializable { public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializable {
@ -1134,6 +1135,13 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
} }
else { else {
Filter auraFilter = perm.getSpellAbility().getTargets().get(0).getFilter(); Filter auraFilter = perm.getSpellAbility().getTargets().get(0).getFilter();
if (auraFilter instanceof FilterControlledCreaturePermanent) {
if (!((FilterControlledCreaturePermanent)auraFilter).match(attachedTo, perm.getId(), perm.getControllerId(), this) || attachedTo.hasProtectionFrom(perm, this)) {
if (perm.moveToZone(Zone.GRAVEYARD, null, this, false)) {
somethingHappened = true;
}
}
} else {
if (!auraFilter.match(attachedTo, this) || attachedTo.hasProtectionFrom(perm, this)) { if (!auraFilter.match(attachedTo, this) || attachedTo.hasProtectionFrom(perm, this)) {
if (perm.moveToZone(Zone.GRAVEYARD, null, this, false)) { if (perm.moveToZone(Zone.GRAVEYARD, null, this, false)) {
somethingHappened = true; somethingHappened = true;
@ -1141,6 +1149,7 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
} }
} }
} }
}
else if (target instanceof TargetPlayer) { else if (target instanceof TargetPlayer) {
Player attachedTo = getPlayer(perm.getAttachedTo()); Player attachedTo = getPlayer(perm.getAttachedTo());
if (attachedTo == null) { if (attachedTo == null) {