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;
}
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;
}
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;
}
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;
}
Aggregations