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