Search in sources :

Example 1 with Step

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

the class SourceTappedBeforeUntapStepCondition method apply.

@Override
public boolean apply(Game game, Ability source) {
    TurnPhase turnPhase = game.getTurn().getPhase().getType();
    Step step = game.getPhase().getStep();
    Permanent permanent = game.getBattlefield().getPermanent(permanentId);
    if (permanent != null) {
        if (lastTurnNum != game.getTurnNum() && turnPhase == TurnPhase.BEGINNING) {
            lastTurnNum = game.getTurnNum();
            permanentWasTappedBeforeUntapStep = permanent.isTapped();
        }
        if (step.getType() == PhaseStep.UNTAP) {
            return permanentWasTappedBeforeUntapStep;
        } else {
            return permanent.isTapped();
        }
    }
    return false;
}
Also used : Permanent(mage.game.permanent.Permanent) Step(mage.game.turn.Step) PhaseStep(mage.constants.PhaseStep) TurnPhase(mage.constants.TurnPhase)

Aggregations

PhaseStep (mage.constants.PhaseStep)1 TurnPhase (mage.constants.TurnPhase)1 Permanent (mage.game.permanent.Permanent)1 Step (mage.game.turn.Step)1