use of mage.abilities.LoyaltyAbility in project mage by magefree.
the class ActivatePlaneswalkerLoyaltyAbilityTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (!event.getPlayerId().equals(getControllerId())) {
return false;
}
StackAbility stackAbility = (StackAbility) game.getStack().getStackObject(event.getSourceId());
if (stackAbility == null || !(stackAbility.getStackAbility() instanceof LoyaltyAbility)) {
return false;
}
Permanent permanent = stackAbility.getSourcePermanentOrLKI(game);
if (permanent == null || !permanent.isPlaneswalker(game) || !permanent.hasSubtype(planeswalkerSubType, game)) {
return false;
}
this.getEffects().setValue("stackAbility", stackAbility);
return true;
}
Aggregations