Search in sources :

Example 11 with TurnMod

use of mage.game.turn.TurnMod in project mage by magefree.

the class EonFrolickerEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getFirstTarget());
    if (player == null) {
        return false;
    }
    game.getState().getTurnMods().add(new TurnMod(player.getId(), false));
    FilterPlayer filter = new FilterPlayer(player.getName());
    filter.add(new PlayerIdPredicate(player.getId()));
    Ability ability = new ProtectionAbility(filter);
    game.addEffect(new GainAbilityControlledEffect(ability, Duration.UntilYourNextTurn, StaticFilters.FILTER_PERMANENT_PLANESWALKER), source);
    game.addEffect(new GainAbilityControllerEffect(ability, Duration.UntilYourNextTurn), source);
    return true;
}
Also used : EntersBattlefieldTriggeredAbility(mage.abilities.common.EntersBattlefieldTriggeredAbility) ConditionalInterveningIfTriggeredAbility(mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility) FlyingAbility(mage.abilities.keyword.FlyingAbility) ProtectionAbility(mage.abilities.keyword.ProtectionAbility) Ability(mage.abilities.Ability) Player(mage.players.Player) FilterPlayer(mage.filter.FilterPlayer) GainAbilityControlledEffect(mage.abilities.effects.common.continuous.GainAbilityControlledEffect) FilterPlayer(mage.filter.FilterPlayer) PlayerIdPredicate(mage.filter.predicate.other.PlayerIdPredicate) ProtectionAbility(mage.abilities.keyword.ProtectionAbility) TurnMod(mage.game.turn.TurnMod) GainAbilityControllerEffect(mage.abilities.effects.common.continuous.GainAbilityControllerEffect)

Example 12 with TurnMod

use of mage.game.turn.TurnMod in project mage by magefree.

the class EmrakulThePromisedEndGainControlEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    Player targetPlayer = game.getPlayer(this.getTargetPointer().getFirst(game, source));
    if (controller != null && targetPlayer != null) {
        TurnMod controlPlayerTurnMod = new TurnMod(targetPlayer.getId(), controller.getId());
        TurnMod extraTurnMod = new TurnMod(targetPlayer.getId(), false);
        controlPlayerTurnMod.setSubsequentTurnMod(extraTurnMod);
        game.getState().getTurnMods().add(controlPlayerTurnMod);
        return true;
    }
    return false;
}
Also used : Player(mage.players.Player) TurnMod(mage.game.turn.TurnMod)

Example 13 with TurnMod

use of mage.game.turn.TurnMod in project mage by magefree.

the class SphinxOfTheSecondSunWatcher method apply.

@Override
public boolean apply(Game game, Ability source) {
    TurnPhase turnPhase = game.getPhase().getType();
    for (TurnMod turnMod : game.getState().getTurnMods()) {
        if ("sphinxSecondSun".equals(turnMod.getNote()) && turnMod.getPlayerId().equals(source.getControllerId()) && turnMod.getAfterPhase() == turnPhase) {
            turnPhase = TurnPhase.BEGINNING;
            turnMod.setNote("sphinxSecondSunIgnore");
            break;
        }
    }
    TurnMod newPhase = new TurnMod(source.getControllerId(), TurnPhase.BEGINNING, turnPhase, false);
    newPhase.setNote("sphinxSecondSun");
    game.getState().getTurnMods().add(newPhase);
    return true;
}
Also used : TurnMod(mage.game.turn.TurnMod)

Example 14 with TurnMod

use of mage.game.turn.TurnMod in project mage by magefree.

the class MoraugFuryOfAkoumWatcher method apply.

@Override
public boolean apply(Game game, Ability source) {
    TurnPhase turnPhase = game.getPhase().getType();
    for (TurnMod turnMod : game.getState().getTurnMods()) {
        if ("moraug".equals(turnMod.getNote()) && turnMod.getPlayerId().equals(source.getControllerId()) && turnMod.getAfterPhase() == turnPhase) {
            turnPhase = TurnPhase.COMBAT;
            turnMod.setNote("moraugIgnore");
            break;
        }
    }
    TurnMod combat = new TurnMod(source.getControllerId(), TurnPhase.COMBAT, turnPhase, false);
    combat.setNote("moraug");
    game.getState().getTurnMods().add(combat);
    game.addDelayedTriggeredAbility(new MoraugFuryOfAkoumDelayedTriggeredAbility(combat.getId()), source);
    return true;
}
Also used : TurnMod(mage.game.turn.TurnMod)

Example 15 with TurnMod

use of mage.game.turn.TurnMod in project mage by magefree.

the class TimeStretchEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    game.getState().getTurnMods().add(new TurnMod(source.getFirstTarget(), false));
    game.getState().getTurnMods().add(new TurnMod(source.getFirstTarget(), false));
    return true;
}
Also used : TurnMod(mage.game.turn.TurnMod)

Aggregations

TurnMod (mage.game.turn.TurnMod)26 Player (mage.players.Player)13 UUID (java.util.UUID)6 Ability (mage.abilities.Ability)5 Permanent (mage.game.permanent.Permanent)5 SimpleStaticAbility (mage.abilities.common.SimpleStaticAbility)3 InfoEffect (mage.abilities.effects.common.InfoEffect)3 TargetPlayer (mage.target.TargetPlayer)3 CardInfo (mage.cards.repository.CardInfo)2 MomirEmblem (mage.game.command.emblems.MomirEmblem)2 TargetPermanent (mage.target.TargetPermanent)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Objects (java.util.Objects)1 EntersBattlefieldTriggeredAbility (mage.abilities.common.EntersBattlefieldTriggeredAbility)1 Cost (mage.abilities.costs.Cost)1 RemoveAllCountersSourceCost (mage.abilities.costs.common.RemoveAllCountersSourceCost)1 ManaCosts (mage.abilities.costs.mana.ManaCosts)1 ManaCostsImpl (mage.abilities.costs.mana.ManaCostsImpl)1