forked from External/mage
25 lines
650 B
Java
25 lines
650 B
Java
package mage.abilities.condition.common;
|
|
|
|
import mage.abilities.Ability;
|
|
import mage.abilities.condition.Condition;
|
|
import mage.game.Game;
|
|
import mage.game.permanent.Permanent;
|
|
|
|
/**
|
|
*
|
|
* @author Quercitron
|
|
*/
|
|
public enum AttachedCondition implements Condition {
|
|
|
|
instance;
|
|
|
|
@Override
|
|
public boolean apply(Game game, Ability source) {
|
|
Permanent attachment = game.getPermanent(source.getSourceId());
|
|
if (attachment == null || attachment.getAttachedTo() == null) {
|
|
return false;
|
|
}
|
|
Permanent attachedTo = game.getPermanent(attachment.getAttachedTo());
|
|
return (attachedTo != null);
|
|
}
|
|
}
|