mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
* Updated UntapAllDuringEachOtherPlayersUntapStepEffect to also work correct with EndTurn effects played last turn.
This commit is contained in:
parent
ac3c780312
commit
060766bb0a
1 changed files with 7 additions and 11 deletions
|
@ -33,13 +33,13 @@ public class UntapAllDuringEachOtherPlayersUntapStepEffect extends ContinuousEff
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||||
Boolean applied = (Boolean) game.getState().getValue(source.getSourceId() + "applied");
|
if (layer == Layer.RulesEffects && game.getStep().getType() == PhaseStep.UNTAP && !source.isControlledBy(game.getActivePlayerId())) {
|
||||||
if (applied == null) {
|
Integer appliedTurn = (Integer) game.getState().getValue(source.getSourceId() + "appliedTurn");
|
||||||
applied = Boolean.FALSE;
|
if (appliedTurn == null) {
|
||||||
}
|
appliedTurn = 0;
|
||||||
if (!applied && layer == Layer.RulesEffects) {
|
}
|
||||||
if (!source.isControlledBy(game.getActivePlayerId()) && game.getStep().getType() == PhaseStep.UNTAP) {
|
if (appliedTurn < game.getTurnNum()) {
|
||||||
game.getState().setValue(source.getSourceId() + "applied", true);
|
game.getState().setValue(source.getSourceId() + "appliedTurn", game.getTurnNum());
|
||||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
||||||
boolean untap = true;
|
boolean untap = true;
|
||||||
for (RestrictionEffect effect : game.getContinuousEffects().getApplicableRestrictionEffects(permanent, game).keySet()) {
|
for (RestrictionEffect effect : game.getContinuousEffects().getApplicableRestrictionEffects(permanent, game).keySet()) {
|
||||||
|
@ -50,10 +50,6 @@ public class UntapAllDuringEachOtherPlayersUntapStepEffect extends ContinuousEff
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (applied && layer == Layer.RulesEffects) {
|
|
||||||
if (game.getStep().getType() == PhaseStep.END_TURN) {
|
|
||||||
game.getState().setValue(source.getSourceId() + "applied", false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue