Search in sources :

Example 1 with TapSourceCost

use of mage.abilities.costs.common.TapSourceCost in project mage by magefree.

the class HeliodsPunishmentEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent sourceEnchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
    if (sourceEnchantment != null && sourceEnchantment.getAttachedTo() != null) {
        Permanent attachedTo = game.getPermanent(sourceEnchantment.getAttachedTo());
        if (attachedTo != null) {
            attachedTo.removeAllAbilities(source.getSourceId(), game);
            HeliodsPunishmentEffect effect = new HeliodsPunishmentEffect(sourceEnchantment.getName());
            Ability ability = new SimpleActivatedAbility(effect, new TapSourceCost());
            effect.setSourceEnchantment(sourceEnchantment.getId());
            attachedTo.addAbility(ability, source.getSourceId(), game);
        }
    }
    return true;
}
Also used : SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) EntersBattlefieldAbility(mage.abilities.common.EntersBattlefieldAbility) EnchantAbility(mage.abilities.keyword.EnchantAbility) Ability(mage.abilities.Ability) Permanent(mage.game.permanent.Permanent) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) TargetPermanent(mage.target.TargetPermanent) SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) TapSourceCost(mage.abilities.costs.common.TapSourceCost)

Example 2 with TapSourceCost

use of mage.abilities.costs.common.TapSourceCost in project mage by magefree.

the class EvilTwinPredicate method apply.

@Override
public boolean apply(Game game, MageObject blueprint, Ability source, UUID copyToObjectId) {
    Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ManaCostsImpl("{U}{B}"));
    ability.addCost(new TapSourceCost());
    ability.addTarget(new TargetCreaturePermanent(filter));
    blueprint.getAbilities().add(ability);
    return true;
}
Also used : SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) EntersBattlefieldAbility(mage.abilities.common.EntersBattlefieldAbility) Ability(mage.abilities.Ability) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) DestroyTargetEffect(mage.abilities.effects.common.DestroyTargetEffect) SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) ManaCostsImpl(mage.abilities.costs.mana.ManaCostsImpl) TapSourceCost(mage.abilities.costs.common.TapSourceCost)

Example 3 with TapSourceCost

use of mage.abilities.costs.common.TapSourceCost in project mage by magefree.

the class HankyuCost method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent permanent = source.getSourcePermanentIfItStillExists(game);
    if (permanent == null) {
        return false;
    }
    Permanent creature = game.getPermanent(permanent.getAttachedTo());
    if (creature == null) {
        return false;
    }
    creature.addAbility(new SimpleActivatedAbility(new AddCountersTargetEffect(CounterType.AIM.createInstance()).setTargetPointer(new FixedTarget(permanent, game)).setText("put an aim counter on " + permanent.getName()), new TapSourceCost()), source.getSourceId(), game);
    Ability ability = new SimpleActivatedAbility(new DamageTargetEffect(HankyuValue.instance).setText("this creature deals damage to any target equal " + "to the number of aim counters removed this way"), new TapSourceCost());
    ability.addCost(new HankyuCost().setMageObjectReference(source, game));
    ability.addTarget(new TargetAnyTarget());
    creature.addAbility(ability, source.getSourceId(), game);
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) EquipAbility(mage.abilities.keyword.EquipAbility) Ability(mage.abilities.Ability) Permanent(mage.game.permanent.Permanent) SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) DamageTargetEffect(mage.abilities.effects.common.DamageTargetEffect) AddCountersTargetEffect(mage.abilities.effects.common.counter.AddCountersTargetEffect) TapSourceCost(mage.abilities.costs.common.TapSourceCost) TargetAnyTarget(mage.target.common.TargetAnyTarget)

Example 4 with TapSourceCost

use of mage.abilities.costs.common.TapSourceCost in project mage by magefree.

the class ThespiansStageCopyEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent sourcePermanent = game.getPermanent(source.getSourceId());
    Permanent copyFromPermanent = game.getPermanent(getTargetPointer().getFirst(game, source));
    if (sourcePermanent != null && copyFromPermanent != null) {
        Permanent newPermanent = game.copyPermanent(copyFromPermanent, sourcePermanent.getId(), source, new EmptyCopyApplier());
        Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ThespiansStageCopyEffect(), new GenericManaCost(2));
        ability.addCost(new TapSourceCost());
        ability.addTarget(new TargetLandPermanent());
        newPermanent.addAbility(ability, source.getSourceId(), game);
        return true;
    }
    return false;
}
Also used : SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) ColorlessManaAbility(mage.abilities.mana.ColorlessManaAbility) Ability(mage.abilities.Ability) TargetLandPermanent(mage.target.common.TargetLandPermanent) Permanent(mage.game.permanent.Permanent) EmptyCopyApplier(mage.util.functions.EmptyCopyApplier) GenericManaCost(mage.abilities.costs.mana.GenericManaCost) SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) TargetLandPermanent(mage.target.common.TargetLandPermanent) TapSourceCost(mage.abilities.costs.common.TapSourceCost)

Example 5 with TapSourceCost

use of mage.abilities.costs.common.TapSourceCost in project mage by magefree.

the class OldGrowthTrollContinuousEffect method makeAbility.

private static final Ability makeAbility() {
    Ability activatedAbility = new SimpleActivatedAbility(new CreateTokenEffect(new TrollWarriorToken(), 1, true, false), new GenericManaCost(1));
    activatedAbility.addCost(new TapSourceCost());
    Cost cost = new SacrificeSourceCost();
    cost.setText("sacrifice this land");
    activatedAbility.addCost(cost);
    Ability ability = new SimpleStaticAbility(new GainAbilityAttachedEffect(new SimpleManaAbility(Zone.BATTLEFIELD, Mana.GreenMana(2), new TapSourceCost()), AttachmentType.AURA).setText("enchanted Forest has \"{T}: Add {G}{G}\""));
    ability.addEffect(new GainAbilityAttachedEffect(activatedAbility, AttachmentType.AURA).setText("and \"{1}, {T}, Sacrifice this land: Create a tapped 4/4 green Troll Warrior creature token with trample.\""));
    return ability;
}
Also used : SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) DiesSourceTriggeredAbility(mage.abilities.common.DiesSourceTriggeredAbility) EnchantAbility(mage.abilities.keyword.EnchantAbility) SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) SimpleManaAbility(mage.abilities.mana.SimpleManaAbility) SpellAbility(mage.abilities.SpellAbility) ConditionalInterveningIfTriggeredAbility(mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility) TrampleAbility(mage.abilities.keyword.TrampleAbility) Ability(mage.abilities.Ability) TrollWarriorToken(mage.game.permanent.token.TrollWarriorToken) GenericManaCost(mage.abilities.costs.mana.GenericManaCost) SacrificeSourceCost(mage.abilities.costs.common.SacrificeSourceCost) SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) GainAbilityAttachedEffect(mage.abilities.effects.common.continuous.GainAbilityAttachedEffect) CreateTokenEffect(mage.abilities.effects.common.CreateTokenEffect) SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) SimpleManaAbility(mage.abilities.mana.SimpleManaAbility) TapSourceCost(mage.abilities.costs.common.TapSourceCost) Cost(mage.abilities.costs.Cost) TapSourceCost(mage.abilities.costs.common.TapSourceCost) GenericManaCost(mage.abilities.costs.mana.GenericManaCost) SacrificeSourceCost(mage.abilities.costs.common.SacrificeSourceCost)

Aggregations

Ability (mage.abilities.Ability)8 SimpleActivatedAbility (mage.abilities.common.SimpleActivatedAbility)8 TapSourceCost (mage.abilities.costs.common.TapSourceCost)8 SimpleStaticAbility (mage.abilities.common.SimpleStaticAbility)6 Permanent (mage.game.permanent.Permanent)5 DamageTargetEffect (mage.abilities.effects.common.DamageTargetEffect)3 EnchantAbility (mage.abilities.keyword.EnchantAbility)3 TargetCreaturePermanent (mage.target.common.TargetCreaturePermanent)3 EntersBattlefieldAbility (mage.abilities.common.EntersBattlefieldAbility)2 GenericManaCost (mage.abilities.costs.mana.GenericManaCost)2 AddCountersTargetEffect (mage.abilities.effects.common.counter.AddCountersTargetEffect)2 EquipAbility (mage.abilities.keyword.EquipAbility)2 TargetPermanent (mage.target.TargetPermanent)2 TargetAnyTarget (mage.target.common.TargetAnyTarget)2 FixedTarget (mage.target.targetpointer.FixedTarget)2 SpellAbility (mage.abilities.SpellAbility)1 BeginningOfUpkeepTriggeredAbility (mage.abilities.common.BeginningOfUpkeepTriggeredAbility)1 DiesSourceTriggeredAbility (mage.abilities.common.DiesSourceTriggeredAbility)1 Cost (mage.abilities.costs.Cost)1 SacrificeSourceCost (mage.abilities.costs.common.SacrificeSourceCost)1