mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
Added missing logic to remove continuous effects with duration EndOfCombat.
This commit is contained in:
parent
c2ecf71cab
commit
f84177bbcd
5 changed files with 40 additions and 5 deletions
|
@ -73,5 +73,15 @@ import mage.game.events.GameEvent;
|
|||
}
|
||||
}
|
||||
|
||||
public void removeEndOfCombatAbilities() {
|
||||
for (Iterator<DelayedTriggeredAbility> it = this.iterator();it.hasNext();) {
|
||||
DelayedTriggeredAbility ability = it.next();
|
||||
if (ability.getDuration() == Duration.EndOfCombat) {
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -117,6 +117,16 @@ public class ContinuousEffects implements Serializable {
|
|||
return restrictionEffects;
|
||||
}
|
||||
|
||||
public void removeEndOfCombatEffects() {
|
||||
layeredEffects.removeEndOfCombatEffects();
|
||||
replacementEffects.removeEndOfCombatEffects();
|
||||
preventionEffects.removeEndOfCombatEffects();
|
||||
requirementEffects.removeEndOfCombatEffects();
|
||||
restrictionEffects.removeEndOfCombatEffects();
|
||||
asThoughEffects.removeEndOfCombatEffects();
|
||||
costModificationEffects.removeEndOfCombatEffects();
|
||||
}
|
||||
|
||||
public void removeEndOfTurnEffects() {
|
||||
layeredEffects.removeEndOfTurnEffects();
|
||||
replacementEffects.removeEndOfTurnEffects();
|
||||
|
|
|
@ -27,14 +27,11 @@
|
|||
*/
|
||||
package mage.abilities.effects;
|
||||
|
||||
import mage.Constants;
|
||||
import mage.abilities.Ability;
|
||||
import mage.game.Game;
|
||||
|
||||
import java.util.*;
|
||||
import static mage.Constants.Duration.Custom;
|
||||
import static mage.Constants.Duration.OneUse;
|
||||
import static mage.Constants.Duration.WhileOnBattlefield;
|
||||
import mage.Constants.Duration;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -68,7 +65,17 @@ public class ContinuousEffectsList<T extends ContinuousEffect> extends ArrayList
|
|||
public void removeEndOfTurnEffects() {
|
||||
for (Iterator<T> i = this.iterator(); i.hasNext();) {
|
||||
T entry = i.next();
|
||||
if (entry.getDuration() == Constants.Duration.EndOfTurn) {
|
||||
if (entry.getDuration() == Duration.EndOfTurn) {
|
||||
i.remove();
|
||||
effectAbilityMap.remove(entry.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void removeEndOfCombatEffects() {
|
||||
for (Iterator<T> i = this.iterator(); i.hasNext();) {
|
||||
T entry = i.next();
|
||||
if (entry.getDuration() == Duration.EndOfCombat) {
|
||||
i.remove();
|
||||
effectAbilityMap.remove(entry.getId());
|
||||
}
|
||||
|
|
|
@ -366,6 +366,13 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
battlefield.fireControlChangeEvents(game);
|
||||
}
|
||||
|
||||
// Remove End of Combat effects
|
||||
public void removeEocEffects(Game game) {
|
||||
effects.removeEndOfCombatEffects();
|
||||
delayed.removeEndOfCombatAbilities();
|
||||
applyEffects(game);
|
||||
}
|
||||
|
||||
public void removeEotEffects(Game game) {
|
||||
effects.removeEndOfTurnEffects();
|
||||
delayed.removeEndOfTurnAbilities();
|
||||
|
|
|
@ -55,6 +55,7 @@ public class EndOfCombatStep extends Step<EndOfCombatStep> {
|
|||
super.endStep(game, activePlayerId);
|
||||
//20091005 - 511.3
|
||||
game.getCombat().endCombat(game);
|
||||
game.getState().removeEocEffects(game);
|
||||
// game.saveState();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue