Search in sources :

Example 16 with SimpleStaticAbility

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

the class MomirDuel method init.

@Override
protected void init(UUID choosingPlayerId) {
    Ability ability = new SimpleStaticAbility(Zone.COMMAND, new InfoEffect("Vanguard effects"));
    for (UUID playerId : state.getPlayerList(startingPlayerId)) {
        Player player = getPlayer(playerId);
        if (player != null) {
            CardInfo cardInfo = CardRepository.instance.findCard("Momir Vig, Simic Visionary");
            addEmblem(new MomirEmblem(), cardInfo.getCard(), playerId);
        }
    }
    getState().addAbility(ability, null);
    super.init(choosingPlayerId);
    state.getTurnMods().add(new TurnMod(startingPlayerId, PhaseStep.DRAW));
}
Also used : SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) Ability(mage.abilities.Ability) Player(mage.players.Player) SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) CardInfo(mage.cards.repository.CardInfo) TurnMod(mage.game.turn.TurnMod) UUID(java.util.UUID) MomirEmblem(mage.game.command.emblems.MomirEmblem) InfoEffect(mage.abilities.effects.common.InfoEffect)

Example 17 with SimpleStaticAbility

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

the class KethisTheHiddenHandGraveyardEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller == null) {
        return false;
    }
    controller.getGraveyard().getCards(game).stream().filter(card -> affectedObjectList.stream().anyMatch(mor -> mor.refersTo(card, game))).forEach(card -> {
        Ability ability = new SimpleStaticAbility(Zone.GRAVEYARD, new KethisTheHiddenHandGraveyardEffect());
        ability.setSourceId(card.getId());
        ability.setControllerId(card.getOwnerId());
        game.getState().addOtherAbility(card, ability);
    });
    return true;
}
Also used : FilterCard(mage.filter.FilterCard) SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) TargetCardInYourGraveyard(mage.target.common.TargetCardInYourGraveyard) MageObjectReference(mage.MageObjectReference) UUID(java.util.UUID) MageInt(mage.MageInt) Player(mage.players.Player) CardSetInfo(mage.cards.CardSetInfo) Objects(java.util.Objects) ContinuousEffectImpl(mage.abilities.effects.ContinuousEffectImpl) Game(mage.game.Game) AsThoughEffectImpl(mage.abilities.effects.AsThoughEffectImpl) CardImpl(mage.cards.CardImpl) SpellsCostReductionControllerEffect(mage.abilities.effects.common.cost.SpellsCostReductionControllerEffect) Card(mage.cards.Card) mage.constants(mage.constants) ExileFromGraveCost(mage.abilities.costs.common.ExileFromGraveCost) Ability(mage.abilities.Ability) SimpleActivatedAbility(mage.abilities.common.SimpleActivatedAbility) SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) Ability(mage.abilities.Ability) Player(mage.players.Player) SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility)

Example 18 with SimpleStaticAbility

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

the class SakashimaOfAThousandFacesEffect method apply.

@Override
public boolean apply(Game game, MageObject blueprint, Ability source, UUID copyToObjectId) {
    blueprint.getAbilities().add(new SimpleStaticAbility(new SakashimaOfAThousandFacesEffect()));
    blueprint.getAbilities().add(PartnerAbility.getInstance());
    return true;
}
Also used : SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility)

Example 19 with SimpleStaticAbility

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

the class UginTheIneffableLookAtFaceDownEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    MageObject sourceObject = source.getSourceObject(game);
    if (player == null || sourceObject == null) {
        return false;
    }
    Card card = player.getLibrary().getFromTop(game);
    if (card == null) {
        return false;
    }
    // exile and look
    UUID exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter());
    if (player.moveCardsToExile(card, source, game, false, exileZoneId, sourceObject.getIdName() + " (" + player.getName() + ")")) {
        card.turnFaceDown(source, game, source.getControllerId());
        player.lookAtCards(player.getName() + " - " + card.getIdName() + " - " + CardUtil.sdf.format(System.currentTimeMillis()), card, game);
    }
    // create token
    Set<MageObjectReference> tokenObjs = new HashSet<>();
    CreateTokenEffect effect = new CreateTokenEffect(new UginTheIneffableToken());
    effect.apply(game, source);
    // with return ability
    for (UUID addedTokenId : effect.getLastAddedTokenIds()) {
        // display referenced exiled face-down card on token
        SimpleStaticAbility sa = new SimpleStaticAbility(Zone.BATTLEFIELD, new InfoEffect("Referenced object: " + card.getId().toString().substring(0, 3)));
        GainAbilityTargetEffect gainAbilityEffect = new GainAbilityTargetEffect(sa, Duration.WhileOnBattlefield);
        gainAbilityEffect.setTargetPointer(new FixedTarget(addedTokenId));
        game.addEffect(gainAbilityEffect, source);
        // look at face-down card in exile
        UginTheIneffableLookAtFaceDownEffect lookAtEffect = new UginTheIneffableLookAtFaceDownEffect();
        lookAtEffect.setTargetPointer(new FixedTarget(card.getId(), game));
        game.addEffect(lookAtEffect, source);
        tokenObjs.add(new MageObjectReference(addedTokenId, game));
        game.addDelayedTriggeredAbility(new UginTheIneffableDelayedTriggeredAbility(tokenObjs, new MageObjectReference(card, game)), source);
    }
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) UginTheIneffableToken(mage.game.permanent.token.UginTheIneffableToken) MageObject(mage.MageObject) CreateTokenEffect(mage.abilities.effects.common.CreateTokenEffect) SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) Card(mage.cards.Card) FilterCard(mage.filter.FilterCard) InfoEffect(mage.abilities.effects.common.InfoEffect) GainAbilityTargetEffect(mage.abilities.effects.common.continuous.GainAbilityTargetEffect) UUID(java.util.UUID) MageObjectReference(mage.MageObjectReference) HashSet(java.util.HashSet)

Example 20 with SimpleStaticAbility

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

the class InfoEffect method addCardHintToPermanent.

/**
 * Add temporary card hint to permanent (visible in rules list)
 *
 * @param game
 * @param source
 * @param permanent
 * @param cardHint
 * @param duration
 */
public static void addCardHintToPermanent(Game game, Ability source, Permanent permanent, Hint cardHint, Duration duration) {
    SimpleStaticAbility ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new InfoEffect("hint"));
    ability.setRuleVisible(false);
    ability.addHint(cardHint);
    GainAbilityTargetEffect gainEffect = new GainAbilityTargetEffect(ability, duration);
    gainEffect.setTargetPointer(new FixedTarget(permanent, game));
    game.addEffect(gainEffect, source);
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) SimpleStaticAbility(mage.abilities.common.SimpleStaticAbility) GainAbilityTargetEffect(mage.abilities.effects.common.continuous.GainAbilityTargetEffect)

Aggregations

SimpleStaticAbility (mage.abilities.common.SimpleStaticAbility)61 Test (org.junit.Test)27 Ability (mage.abilities.Ability)21 Player (mage.players.Player)14 Permanent (mage.game.permanent.Permanent)11 InfoEffect (mage.abilities.effects.common.InfoEffect)10 BoostAllEffect (mage.abilities.effects.common.continuous.BoostAllEffect)10 GainAbilityTargetEffect (mage.abilities.effects.common.continuous.GainAbilityTargetEffect)9 Card (mage.cards.Card)9 FixedTarget (mage.target.targetpointer.FixedTarget)9 UUID (java.util.UUID)8 LeavesBattlefieldTriggeredAbility (mage.abilities.common.LeavesBattlefieldTriggeredAbility)6 ContinuousEffect (mage.abilities.effects.ContinuousEffect)6 GainLifeEffect (mage.abilities.effects.common.GainLifeEffect)6 FilterCard (mage.filter.FilterCard)5 MageObject (mage.MageObject)4 DamageTargetEffect (mage.abilities.effects.common.DamageTargetEffect)4 PreventAllDamageToAllEffect (mage.abilities.effects.common.PreventAllDamageToAllEffect)4 BoostSourceEffect (mage.abilities.effects.common.continuous.BoostSourceEffect)4 AbilitiesCostReductionControllerEffect (mage.abilities.effects.common.cost.AbilitiesCostReductionControllerEffect)4