Search in sources :

Example 61 with Ability

use of mage.abilities.Ability 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 62 with Ability

use of mage.abilities.Ability 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 63 with Ability

use of mage.abilities.Ability in project mage by magefree.

the class HonorTheFallenEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller == null) {
        return false;
    }
    Cards cards = new CardsImpl();
    for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
        Player player = game.getPlayer(playerId);
        if (player == null) {
            continue;
        }
        cards.addAll(player.getGraveyard().getCards(StaticFilters.FILTER_CARD_CREATURE, game));
    }
    controller.moveCards(cards, Zone.EXILED, source, game);
    int count = cards.stream().map(game.getState()::getZone).map(Zone.EXILED::equals).mapToInt(x -> x ? 1 : 0).sum();
    controller.gainLife(count, game, source);
    return true;
}
Also used : StaticFilters(mage.filter.StaticFilters) Zone(mage.constants.Zone) Cards(mage.cards.Cards) Outcome(mage.constants.Outcome) OneShotEffect(mage.abilities.effects.OneShotEffect) UUID(java.util.UUID) CardsImpl(mage.cards.CardsImpl) Player(mage.players.Player) CardSetInfo(mage.cards.CardSetInfo) Game(mage.game.Game) CardImpl(mage.cards.CardImpl) CardType(mage.constants.CardType) Ability(mage.abilities.Ability) Player(mage.players.Player) UUID(java.util.UUID) Cards(mage.cards.Cards) CardsImpl(mage.cards.CardsImpl)

Example 64 with Ability

use of mage.abilities.Ability in project mage by magefree.

the class NarsetTranscendentGainReboundEffect method addReboundAbility.

private void addReboundAbility(Card card, Game game) {
    boolean found = false;
    for (Ability ability : card.getAbilities(game)) {
        if (ability instanceof ReboundAbility) {
            found = true;
            break;
        }
    }
    if (!found) {
        Ability ability = new ReboundAbility();
        game.getState().addOtherAbility(card, ability);
    }
}
Also used : LoyaltyAbility(mage.abilities.LoyaltyAbility) DelayedTriggeredAbility(mage.abilities.DelayedTriggeredAbility) ReboundAbility(mage.abilities.keyword.ReboundAbility) Ability(mage.abilities.Ability) ReboundAbility(mage.abilities.keyword.ReboundAbility)

Example 65 with Ability

use of mage.abilities.Ability in project mage by magefree.

the class ProteanThaumaturgeCopyApplier method createAbility.

static Ability createAbility() {
    Ability ability = new ConstellationAbility(new CopyPermanentEffect(StaticFilters.FILTER_PERMANENT_CREATURE, new ProteanThaumaturgeCopyApplier(), true).setText("{this} become a copy of another target creature, except it has this ability"), true, false);
    ability.addTarget(new TargetPermanent(filter));
    return ability;
}
Also used : ConstellationAbility(mage.abilities.abilityword.ConstellationAbility) Ability(mage.abilities.Ability) ConstellationAbility(mage.abilities.abilityword.ConstellationAbility) CopyPermanentEffect(mage.abilities.effects.common.CopyPermanentEffect) TargetPermanent(mage.target.TargetPermanent)

Aggregations

Ability (mage.abilities.Ability)359 Player (mage.players.Player)173 Permanent (mage.game.permanent.Permanent)134 UUID (java.util.UUID)126 Game (mage.game.Game)123 OneShotEffect (mage.abilities.effects.OneShotEffect)98 SimpleStaticAbility (mage.abilities.common.SimpleStaticAbility)87 CardSetInfo (mage.cards.CardSetInfo)87 CardImpl (mage.cards.CardImpl)85 CardType (mage.constants.CardType)78 Outcome (mage.constants.Outcome)76 Card (mage.cards.Card)72 SimpleActivatedAbility (mage.abilities.common.SimpleActivatedAbility)64 MageObject (mage.MageObject)57 MageInt (mage.MageInt)47 SpellAbility (mage.abilities.SpellAbility)43 Objects (java.util.Objects)38 Zone (mage.constants.Zone)38 mage.constants (mage.constants)37 FilterCard (mage.filter.FilterCard)35