Search in sources :

Example 6 with CastSpellLastTurnWatcher

use of mage.watchers.common.CastSpellLastTurnWatcher in project mage by magefree.

the class MagusOfTheMindEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    MageObject sourceObject = source.getSourceObject(game);
    CastSpellLastTurnWatcher watcher = game.getState().getWatcher(CastSpellLastTurnWatcher.class);
    if (watcher == null) {
        return false;
    }
    int stormCount = watcher.getAmountOfSpellsAllPlayersCastOnCurrentTurn() + 1;
    if (controller != null && sourceObject != null) {
        controller.shuffleLibrary(source, game);
        if (controller.getLibrary().hasCards()) {
            Set<Card> cards = controller.getLibrary().getTopCards(game, stormCount);
            return PlayFromNotOwnHandZoneTargetEffect.exileAndPlayFromExile(game, source, cards, TargetController.YOU, Duration.EndOfTurn, true, false, false);
        }
        return true;
    }
    return false;
}
Also used : Player(mage.players.Player) MageObject(mage.MageObject) CastSpellLastTurnWatcher(mage.watchers.common.CastSpellLastTurnWatcher) Card(mage.cards.Card)

Example 7 with CastSpellLastTurnWatcher

use of mage.watchers.common.CastSpellLastTurnWatcher in project mage by magefree.

the class MangaraTheDiplomatCastTriggeredAbility method checkTrigger.

@Override
public boolean checkTrigger(GameEvent event, Game game) {
    Player player = game.getPlayer(getControllerId());
    CastSpellLastTurnWatcher watcher = game.getState().getWatcher(CastSpellLastTurnWatcher.class);
    return player != null && watcher != null && player.hasOpponent(event.getPlayerId(), game) && watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(event.getPlayerId()) == 2;
}
Also used : Player(mage.players.Player) CastSpellLastTurnWatcher(mage.watchers.common.CastSpellLastTurnWatcher)

Example 8 with CastSpellLastTurnWatcher

use of mage.watchers.common.CastSpellLastTurnWatcher in project mage by magefree.

the class IrencragFeatCantCastEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    new BasicManaEffect(Mana.RedMana(7)).apply(game, source);
    CastSpellLastTurnWatcher watcher = game.getState().getWatcher(CastSpellLastTurnWatcher.class);
    if (watcher == null) {
        return false;
    }
    int start = watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(source.getControllerId());
    game.addEffect(new IrencragFeatCantCastEffect(start), source);
    return true;
}
Also used : BasicManaEffect(mage.abilities.effects.mana.BasicManaEffect) CastSpellLastTurnWatcher(mage.watchers.common.CastSpellLastTurnWatcher)

Example 9 with CastSpellLastTurnWatcher

use of mage.watchers.common.CastSpellLastTurnWatcher in project mage by magefree.

the class DampingSphereIncreasementAllEffect method apply.

@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
    CastSpellLastTurnWatcher watcher = game.getState().getWatcher(CastSpellLastTurnWatcher.class);
    if (watcher != null) {
        int additionalCost = watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(abilityToModify.getControllerId());
        CardUtil.increaseCost(abilityToModify, additionalCost);
        return true;
    }
    return false;
}
Also used : CastSpellLastTurnWatcher(mage.watchers.common.CastSpellLastTurnWatcher)

Aggregations

CastSpellLastTurnWatcher (mage.watchers.common.CastSpellLastTurnWatcher)9 Player (mage.players.Player)3 MageObject (mage.MageObject)1 BasicManaEffect (mage.abilities.effects.mana.BasicManaEffect)1 Card (mage.cards.Card)1