Search in sources :

Example 1 with ChooseACardNameEffect

use of mage.abilities.effects.common.ChooseACardNameEffect in project mage by magefree.

the class CheeringFanaticEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    new ChooseACardNameEffect(TypeOfName.ALL).apply(game, source);
    String cardName = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY);
    if (cardName == null) {
        return false;
    }
    FilterCard filter = new FilterCard();
    filter.add(new NamePredicate(cardName));
    ContinuousEffect effect = new SpellsCostReductionAllEffect(filter, 1);
    effect.setDuration(Duration.EndOfTurn);
    game.addEffect(effect, source);
    return true;
}
Also used : FilterCard(mage.filter.FilterCard) NamePredicate(mage.filter.predicate.mageobject.NamePredicate) ChooseACardNameEffect(mage.abilities.effects.common.ChooseACardNameEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect) SpellsCostReductionAllEffect(mage.abilities.effects.common.cost.SpellsCostReductionAllEffect)

Aggregations

ContinuousEffect (mage.abilities.effects.ContinuousEffect)1 ChooseACardNameEffect (mage.abilities.effects.common.ChooseACardNameEffect)1 SpellsCostReductionAllEffect (mage.abilities.effects.common.cost.SpellsCostReductionAllEffect)1 FilterCard (mage.filter.FilterCard)1 NamePredicate (mage.filter.predicate.mageobject.NamePredicate)1