mirror of
https://github.com/magefree/mage.git
synced 2026-01-18 09:19:56 -08:00
Fixed Issue#35. All tests pass now.
This commit is contained in:
parent
aa071912cb
commit
c61e4f2b32
13 changed files with 230 additions and 18 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue