mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
Slowtrips finally slayed.
This commit is contained in:
@@ -3,6 +3,7 @@ package forge.card.ability.effects;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import forge.card.ability.AbilityUtils;
|
||||
import forge.card.ability.SpellAbilityEffect;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
import forge.card.trigger.Trigger;
|
||||
@@ -37,6 +38,19 @@ public class DelayedTriggerEffect extends SpellAbilityEffect {
|
||||
mapParams.remove("SpellDescription");
|
||||
}
|
||||
|
||||
String triggerRemembered = null;
|
||||
|
||||
// Set Remembered
|
||||
if (sa.hasParam("RememberObjects")) {
|
||||
triggerRemembered = sa.getParam("RememberObjects");
|
||||
}
|
||||
|
||||
if (triggerRemembered != null) {
|
||||
for (final Object o : AbilityUtils.getDefinedObjects(sa.getSourceCard(), triggerRemembered, sa)) {
|
||||
sa.getSourceCard().addRemembered(o);
|
||||
}
|
||||
}
|
||||
|
||||
final Trigger delTrig = TriggerHandler.parseTrigger(mapParams, sa.getSourceCard(), true);
|
||||
|
||||
sa.getActivatingPlayer().getGame().getTriggerHandler().registerDelayedTrigger(delTrig);
|
||||
|
||||
@@ -74,10 +74,6 @@ public class DrawEffect extends SpellAbilityEffect {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append("Do you want to draw ").append(numCards).append(" cards(s)");
|
||||
|
||||
if (slowDraw) {
|
||||
sb.append(" next upkeep");
|
||||
}
|
||||
|
||||
sb.append("?");
|
||||
|
||||
if (!GuiDialog.confirm(sa.getSourceCard(), sb.toString())) {
|
||||
@@ -85,11 +81,9 @@ public class DrawEffect extends SpellAbilityEffect {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: remove this deprecation exception
|
||||
if (slowDraw) {
|
||||
for (int i = 0; i < numCards; i++) {
|
||||
p.addSlowtripList(source);
|
||||
}
|
||||
throw new RuntimeException("This api option is no longer supported. Please file a bug report with the card that threw this error.");
|
||||
} else {
|
||||
final List<Card> drawn = p.drawCards(numCards);
|
||||
if (sa.hasParam("Reveal")) {
|
||||
|
||||
@@ -348,11 +348,6 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable {
|
||||
|
||||
case UPKEEP:
|
||||
if (this.getPlayerTurn().hasKeyword("Skip your upkeep step.")) {
|
||||
// Slowtrips all say "on the next turn's upkeep" if there is no
|
||||
// upkeep next turn, the trigger will never occur.
|
||||
for (Player p : game.getPlayers()) {
|
||||
p.clearSlowtripList();
|
||||
}
|
||||
this.setPlayersPriorityPermission(false);
|
||||
} else {
|
||||
this.nUpkeepsThisTurn++;
|
||||
|
||||
@@ -84,7 +84,6 @@ public class Upkeep extends Phase {
|
||||
game.getStack().freezeStack();
|
||||
Upkeep.upkeepBraidOfFire(game);
|
||||
|
||||
Upkeep.upkeepSlowtrips(game); // for "Draw a card at the beginning of the next turn's upkeep."
|
||||
Upkeep.upkeepUpkeepCost(game); // sacrifice unless upkeep cost is paid
|
||||
Upkeep.upkeepEcho(game);
|
||||
|
||||
@@ -202,47 +201,6 @@ public class Upkeep extends Phase {
|
||||
}
|
||||
} // echo
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* upkeepSlowtrips. Draw a card at the beginning of the next turn's upkeep.
|
||||
* </p>
|
||||
*/
|
||||
private static void upkeepSlowtrips(final GameState game) {
|
||||
Player turnOwner = game.getPhaseHandler().getPlayerTurn();
|
||||
|
||||
// does order matter here?
|
||||
drawForSlowtrips(turnOwner, game);
|
||||
for (Player p : game.getPlayers()) {
|
||||
if (p == turnOwner) {
|
||||
continue;
|
||||
}
|
||||
drawForSlowtrips(p, game);
|
||||
}
|
||||
}
|
||||
|
||||
public static void drawForSlowtrips(final Player player, final GameState game) {
|
||||
List<Card> list = player.getSlowtripList();
|
||||
|
||||
for (Card card : list) {
|
||||
// otherwise another slowtrip gets added
|
||||
card.removeIntrinsicKeyword("Draw a card at the beginning of the next turn's upkeep.");
|
||||
|
||||
final Ability slowtrip = new Ability(card, ManaCost.ZERO) {
|
||||
@Override
|
||||
public void resolve() {
|
||||
player.drawCard();
|
||||
}
|
||||
};
|
||||
slowtrip.setStackDescription(card + " - Draw a card.");
|
||||
slowtrip.setDescription(card + " - Draw a card.");
|
||||
slowtrip.setActivatingPlayer(player);
|
||||
|
||||
game.getStack().addSimultaneousStackEntry(slowtrip);
|
||||
|
||||
}
|
||||
player.clearSlowtripList();
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* upkeepUpkeepCost.
|
||||
|
||||
@@ -134,9 +134,6 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
/** The num discarded this turn. */
|
||||
private int numDiscardedThisTurn = 0;
|
||||
|
||||
/** The slowtrip list. */
|
||||
private List<Card> slowtripList = new ArrayList<Card>();
|
||||
|
||||
/** A list of tokens not in play, but on their way.
|
||||
* This list is kept in order to not break ETB-replacement
|
||||
* on tokens. */
|
||||
@@ -1948,38 +1945,6 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
return old;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Getter for the field <code>slowtripList</code>.
|
||||
* </p>
|
||||
*
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public final List<Card> getSlowtripList() {
|
||||
return this.slowtripList;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* clearSlowtripList.
|
||||
* </p>
|
||||
*/
|
||||
public final void clearSlowtripList() {
|
||||
this.slowtripList.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* addSlowtripList.
|
||||
* </p>
|
||||
*
|
||||
* @param card
|
||||
* a {@link forge.Card} object.
|
||||
*/
|
||||
public final void addSlowtripList(final Card card) {
|
||||
this.slowtripList.add(card);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* getTurn.
|
||||
|
||||
Reference in New Issue
Block a user