Fixed Issue#35. All tests pass now.

This commit is contained in:
magenoxx 2012-08-22 22:36:19 +04:00
parent aa071912cb
commit c61e4f2b32
13 changed files with 230 additions and 18 deletions

View file

@ -44,6 +44,7 @@ import mage.cards.Card;
import mage.choices.Choice;
import mage.choices.Choices;
import mage.game.Game;
import mage.game.permanent.PermanentCard;
import mage.target.Target;
import mage.target.Targets;
import org.apache.log4j.Logger;
@ -478,6 +479,19 @@ public abstract class AbilityImpl<T extends AbilityImpl<T>> implements Ability {
}
}
MageObject object = game.getObject(getSourceId());
if (object != null && !object.getAbilities().contains(this)) {
boolean found = false;
// unfortunately we need to handle double faced cards separately and only this way
if (object instanceof PermanentCard && ((PermanentCard)object).canTransform()) {
PermanentCard permanent = (PermanentCard)object;
found = permanent.getSecondCardFace().getAbilities().contains(this) || permanent.getCard().getAbilities().contains(this);
}
if (!found) {
return false;
}
}
// check against current state
Zone test = game.getState().getZone(sourceId);
return test != null && zone.match(test);