* Fixed a bug of CastOnlyDuringPhaseStepSourceEffect that allowed players to cast spells in not allowed phases/steps (e.g. Chaotic Strike and Aleatory).

This commit is contained in:
LevelX2 2016-02-02 15:01:03 +01:00
parent 7b326685c1
commit 43460c1256
2 changed files with 36 additions and 4 deletions

View file

@ -47,12 +47,15 @@ public class CastOnlyDuringPhaseStepSourceEffect extends ContinuousRuleModifying
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
// has to return true, if the spell cannot be cast in the current phase / step
if (event.getSourceId().equals(source.getSourceId())) {
return (turnPhase == null || !game.getPhase().getType().equals(turnPhase))
&& (phaseStep == null || !game.getTurn().getStepType().equals(phaseStep))
&& (condition == null || !condition.apply(game, source));
if ((turnPhase != null && !game.getPhase().getType().equals(turnPhase))
|| (phaseStep != null && !game.getTurn().getStepType().equals(phaseStep))
|| (condition != null && !condition.apply(game, source))) {
return true;
}
}
return false;
return false; // casr not prevented by this effect
}
@Override