mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
- Added Halfdane
This commit is contained in:
@@ -7,6 +7,7 @@ import forge.game.ability.AbilityUtils;
|
||||
import forge.game.card.Card;
|
||||
import forge.game.card.CardUtil;
|
||||
import forge.game.event.GameEventCardStatsChanged;
|
||||
import forge.game.phase.PhaseType;
|
||||
import forge.game.replacement.ReplacementEffect;
|
||||
import forge.game.replacement.ReplacementHandler;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
@@ -290,6 +291,12 @@ public class AnimateEffect extends AnimateEffectBase {
|
||||
source.addLeavesPlayCommand(unanimate);
|
||||
} else if (sa.hasParam("UntilYourNextUpkeep")) {
|
||||
game.getUpkeep().addUntil(source.getController(), unanimate);
|
||||
} else if (sa.hasParam("UntilTheEndOfYourNextUpkeep")) {
|
||||
if (game.getPhaseHandler().is(PhaseType.UPKEEP)) {
|
||||
game.getUpkeep().registerUntilEnd(source.getController(), unanimate);
|
||||
} else {
|
||||
game.getUpkeep().addUntilEnd(source.getController(), unanimate);
|
||||
}
|
||||
} else if (sa.hasParam("UntilControllerNextUntap")) {
|
||||
game.getUntap().addUntil(c.getController(), unanimate);
|
||||
} else if (sa.hasParam("UntilYourNextTurn")) {
|
||||
|
||||
@@ -93,7 +93,8 @@ public class Phase implements java.io.Serializable {
|
||||
|
||||
/** The until map. */
|
||||
private final HashMap<Player, List<GameCommand>> untilMap = new HashMap<Player, List<GameCommand>>();
|
||||
|
||||
private final HashMap<Player, List<GameCommand>> untilEndMap = new HashMap<Player, List<GameCommand>>();
|
||||
private final HashMap<Player, List<GameCommand>> registerMap = new HashMap<Player, List<GameCommand>>();
|
||||
/**
|
||||
* <p>
|
||||
* Add a Command that will terminate an effect with "until <Player's> next <phase>".
|
||||
@@ -121,6 +122,35 @@ public class Phase implements java.io.Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
public final void registerUntilEnd(Player p, final GameCommand c) {
|
||||
if (this.registerMap.containsKey(p)) {
|
||||
this.registerMap.get(p).add(0, c);
|
||||
} else {
|
||||
this.registerMap.put(p, Lists.newArrayList(c));
|
||||
}
|
||||
}
|
||||
|
||||
public final void addUntilEnd(Player p, final GameCommand c) {
|
||||
if (this.untilEndMap.containsKey(p)) {
|
||||
this.untilEndMap.get(p).add(0, c);
|
||||
} else {
|
||||
this.untilEndMap.put(p, Lists.newArrayList(c));
|
||||
}
|
||||
}
|
||||
|
||||
public final void RegisterUntilEndCommand(final Player p) {
|
||||
if (this.registerMap.containsKey(p)) {
|
||||
this.untilEndMap.put(p, registerMap.get(p));
|
||||
registerMap.remove(p);
|
||||
}
|
||||
}
|
||||
|
||||
public final void executeUntilEndOfPhase(final Player p) {
|
||||
if (this.untilEndMap.containsKey(p)) {
|
||||
this.execute(this.untilEndMap.get(p));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* execute.
|
||||
|
||||
@@ -424,6 +424,8 @@ public class PhaseHandler implements java.io.Serializable {
|
||||
c.getDamageHistory().setNotBlockedSinceLastUpkeepOf(this.getPlayerTurn());
|
||||
c.getDamageHistory().setNotBeenBlockedSinceLastUpkeepOf(this.getPlayerTurn());
|
||||
}
|
||||
game.getUpkeep().executeUntilEndOfPhase(this.getPlayerTurn());
|
||||
game.getUpkeep().RegisterUntilEndCommand(this.getPlayerTurn());
|
||||
break;
|
||||
|
||||
case COMBAT_END:
|
||||
|
||||
Reference in New Issue
Block a user