Search in sources :

Example 1 with ConditionalInterveningIfTriggeredAbility

use of mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility in project mage by magefree.

the class MythosOfIllunaEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent permanent = game.getPermanent(source.getFirstTarget());
    if (permanent == null) {
        return false;
    }
    CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(source.getControllerId());
    if (condition.apply(game, source)) {
        Ability ability = new ConditionalInterveningIfTriggeredAbility(new EntersBattlefieldTriggeredAbility(new FightTargetSourceEffect()), MythosOfIllunaCondition.instance, "When this permanent enters the battlefield, " + "if it's a creature, it fights up to one target creature you don't control.");
        ability.addTarget(new TargetPermanent(0, 1, StaticFilters.FILTER_CREATURE_YOU_DONT_CONTROL, false));
        effect.addAdditionalAbilities(ability);
    }
    return effect.apply(game, source);
}
Also used : EntersBattlefieldTriggeredAbility(mage.abilities.common.EntersBattlefieldTriggeredAbility) ConditionalInterveningIfTriggeredAbility(mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility) Ability(mage.abilities.Ability) Permanent(mage.game.permanent.Permanent) TargetPermanent(mage.target.TargetPermanent) TargetPermanent(mage.target.TargetPermanent) EntersBattlefieldTriggeredAbility(mage.abilities.common.EntersBattlefieldTriggeredAbility) CreateTokenCopyTargetEffect(mage.abilities.effects.common.CreateTokenCopyTargetEffect) FightTargetSourceEffect(mage.abilities.effects.common.FightTargetSourceEffect) ConditionalInterveningIfTriggeredAbility(mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility)

Aggregations

Ability (mage.abilities.Ability)1 EntersBattlefieldTriggeredAbility (mage.abilities.common.EntersBattlefieldTriggeredAbility)1 ConditionalInterveningIfTriggeredAbility (mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility)1 CreateTokenCopyTargetEffect (mage.abilities.effects.common.CreateTokenCopyTargetEffect)1 FightTargetSourceEffect (mage.abilities.effects.common.FightTargetSourceEffect)1 Permanent (mage.game.permanent.Permanent)1 TargetPermanent (mage.target.TargetPermanent)1