Search in sources :

Example 1 with EntersBattlefieldTriggeredAbility

use of mage.abilities.common.EntersBattlefieldTriggeredAbility in project mage by magefree.

the class GaleaKindlerOfHopeEffect method makeAbility.

private static Ability makeAbility() {
    Ability ability = new EntersBattlefieldTriggeredAbility(new AttachEffect(Outcome.BoostCreature, "attach it to target creature you control"), false).setTriggerPhrase("When this Equipment enters the battlefield, ");
    ability.addTarget(new TargetControlledCreaturePermanent());
    return ability;
}
Also used : SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) EntersBattlefieldTriggeredAbility(mage.abilities.common.EntersBattlefieldTriggeredAbility) VigilanceAbility(mage.abilities.keyword.VigilanceAbility) Ability(mage.abilities.Ability) EntersBattlefieldTriggeredAbility(mage.abilities.common.EntersBattlefieldTriggeredAbility) TargetControlledCreaturePermanent(mage.target.common.TargetControlledCreaturePermanent) AttachEffect(mage.abilities.effects.common.AttachEffect)

Example 2 with EntersBattlefieldTriggeredAbility

use of mage.abilities.common.EntersBattlefieldTriggeredAbility in project mage by magefree.

the class TargetPriorityTest method test_targetAmount_BadCase.

@Test
public void test_targetAmount_BadCase() {
    // choose targets as enters battlefield (e.g. can't be canceled)
    SpellAbility spell = new SpellAbility(new ManaCostsImpl("R"), "damage 3", Zone.HAND);
    Ability ability = new EntersBattlefieldTriggeredAbility(new DamageMultiEffect(3));
    ability.addTarget(new TargetCreaturePermanentAmount(3));
    addCustomCardWithSpell(playerA, spell, ability, CardType.ENCHANTMENT);
    addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
    // 
    // 1/1
    addCard(Zone.BATTLEFIELD, playerA, "Memnite", 3);
    // 2/2
    addCard(Zone.BATTLEFIELD, playerA, "Balduvian Bears", 3);
    // 2/2 with ability
    addCard(Zone.BATTLEFIELD, playerA, "Ashcoat Bear", 3);
    // 4/3
    addCard(Zone.BATTLEFIELD, playerA, "Golden Bear", 3);
    // 4/4 with ability
    addCard(Zone.BATTLEFIELD, playerA, "Battering Sliver", 3);
    castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "damage 3");
    // must damage x3 Balduvian Bears by -1 to keep alive
    checkDamage("pt after", 1, PhaseStep.BEGIN_COMBAT, playerA, "Balduvian Bears", 1);
    // showBattlefield("after", 1, PhaseStep.BEGIN_COMBAT, playerA);
    setStopAt(1, PhaseStep.BEGIN_COMBAT);
    execute();
    assertAllCommandsUsed();
    assertPermanentCount(playerA, "damage 3", 1);
    assertPermanentCount(playerA, "Memnite", 3);
    assertPermanentCount(playerA, "Balduvian Bears", 3);
    assertPermanentCount(playerA, "Ashcoat Bear", 3);
    assertPermanentCount(playerA, "Golden Bear", 3);
    assertPermanentCount(playerA, "Battering Sliver", 3);
}
Also used : SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) EntersBattlefieldTriggeredAbility(mage.abilities.common.EntersBattlefieldTriggeredAbility) SpellAbility(mage.abilities.SpellAbility) Ability(mage.abilities.Ability) TargetCreaturePermanentAmount(mage.target.common.TargetCreaturePermanentAmount) DamageMultiEffect(mage.abilities.effects.common.DamageMultiEffect) SpellAbility(mage.abilities.SpellAbility) EntersBattlefieldTriggeredAbility(mage.abilities.common.EntersBattlefieldTriggeredAbility) ManaCostsImpl(mage.abilities.costs.mana.ManaCostsImpl) Test(org.junit.Test)

Example 3 with EntersBattlefieldTriggeredAbility

use of mage.abilities.common.EntersBattlefieldTriggeredAbility 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)

Example 4 with EntersBattlefieldTriggeredAbility

use of mage.abilities.common.EntersBattlefieldTriggeredAbility in project mage by magefree.

the class CherishedHatchlingTriggeredAbility method getEffectToAdd.

private static Effect getEffectToAdd() {
    Ability abilityToAdd = new EntersBattlefieldTriggeredAbility(new FightTargetSourceEffect().setText("you may have it fight another target creature"), true);
    abilityToAdd.addTarget(new TargetCreaturePermanent(filter));
    Effect effect = new GainAbilityTargetEffect(abilityToAdd, Duration.EndOfTurn, "it gains \"When this creature enters the battlefield, you may have it fight another target creature.\"", true);
    return effect;
}
Also used : EntersBattlefieldTriggeredAbility(mage.abilities.common.EntersBattlefieldTriggeredAbility) DiesSourceTriggeredAbility(mage.abilities.common.DiesSourceTriggeredAbility) DelayedTriggeredAbility(mage.abilities.DelayedTriggeredAbility) Ability(mage.abilities.Ability) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) GainAbilityTargetEffect(mage.abilities.effects.common.continuous.GainAbilityTargetEffect) CastAsThoughItHadFlashAllEffect(mage.abilities.effects.common.continuous.CastAsThoughItHadFlashAllEffect) Effect(mage.abilities.effects.Effect) CreateDelayedTriggeredAbilityEffect(mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect) FightTargetSourceEffect(mage.abilities.effects.common.FightTargetSourceEffect) GainAbilityTargetEffect(mage.abilities.effects.common.continuous.GainAbilityTargetEffect) EntersBattlefieldTriggeredAbility(mage.abilities.common.EntersBattlefieldTriggeredAbility) FightTargetSourceEffect(mage.abilities.effects.common.FightTargetSourceEffect)

Aggregations

Ability (mage.abilities.Ability)4 EntersBattlefieldTriggeredAbility (mage.abilities.common.EntersBattlefieldTriggeredAbility)4 FightTargetSourceEffect (mage.abilities.effects.common.FightTargetSourceEffect)2 DelayedTriggeredAbility (mage.abilities.DelayedTriggeredAbility)1 SpellAbility (mage.abilities.SpellAbility)1 DiesSourceTriggeredAbility (mage.abilities.common.DiesSourceTriggeredAbility)1 SimpleActivatedAbility (mage.abilities.common.SimpleActivatedAbility)1 SimpleStaticAbility (mage.abilities.common.SimpleStaticAbility)1 ManaCostsImpl (mage.abilities.costs.mana.ManaCostsImpl)1 ConditionalInterveningIfTriggeredAbility (mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility)1 Effect (mage.abilities.effects.Effect)1 AttachEffect (mage.abilities.effects.common.AttachEffect)1 CreateDelayedTriggeredAbilityEffect (mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect)1 CreateTokenCopyTargetEffect (mage.abilities.effects.common.CreateTokenCopyTargetEffect)1 DamageMultiEffect (mage.abilities.effects.common.DamageMultiEffect)1 CastAsThoughItHadFlashAllEffect (mage.abilities.effects.common.continuous.CastAsThoughItHadFlashAllEffect)1 GainAbilityTargetEffect (mage.abilities.effects.common.continuous.GainAbilityTargetEffect)1 VigilanceAbility (mage.abilities.keyword.VigilanceAbility)1 Permanent (mage.game.permanent.Permanent)1 TargetPermanent (mage.target.TargetPermanent)1