mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
refactor Planechase special action
This commit is contained in:
@@ -2690,8 +2690,8 @@ public class AbilityUtils {
|
||||
return doXMath(game.getStack().getSpellsCastThisTurn().size() - 1, expr, c, ctb);
|
||||
}
|
||||
|
||||
if (sq[0].startsWith("RolledThisTurn")) {
|
||||
return game.getPhaseHandler().getPlanarDiceRolledthisTurn();
|
||||
if (sq[0].startsWith("PlanarDiceSpecialActionThisTurn")) {
|
||||
return game.getPhaseHandler().getPlanarDiceSpecialActionThisTurn();
|
||||
}
|
||||
|
||||
if (sq[0].contains("CardTypes")) {
|
||||
|
||||
@@ -25,8 +25,8 @@ public class RollPlanarDiceEffect extends SpellAbilityEffect {
|
||||
if (game.getActivePlanes() == null) { // not a planechase game, nothing happens
|
||||
return;
|
||||
}
|
||||
if (!sa.hasParam("NotCountedForPDCost")) {
|
||||
game.getPhaseHandler().incPlanarDiceRolledthisTurn();
|
||||
if (sa.hasParam("SpecialAction")) {
|
||||
game.getPhaseHandler().incPlanarDiceSpecialActionThisTurn();
|
||||
}
|
||||
// Play the die roll sound
|
||||
game.fireEvent(new GameEventRollDie());
|
||||
|
||||
@@ -341,23 +341,21 @@ public class CardFactory {
|
||||
}
|
||||
|
||||
private static void buildPlaneAbilities(Card card) {
|
||||
StringBuilder triggerSB = new StringBuilder();
|
||||
triggerSB.append("Mode$ PlanarDice | Result$ Planeswalk | TriggerZones$ Command | Secondary$ True | ");
|
||||
triggerSB.append("TriggerDescription$ Whenever you roll Planeswalk, put this card on the bottom of its owner's planar deck face down, ");
|
||||
triggerSB.append("then move the top card of your planar deck off that planar deck and turn it face up");
|
||||
String trigger = "Mode$ PlanarDice | Result$ Planeswalk | TriggerZones$ Command | Secondary$ True | " +
|
||||
"TriggerDescription$ Whenever you roll the Planeswalker symbol on the planar die, planeswalk.";
|
||||
|
||||
String rolledWalk = "DB$ Planeswalk";
|
||||
|
||||
Trigger planesWalkTrigger = TriggerHandler.parseTrigger(triggerSB.toString(), card, true);
|
||||
Trigger planesWalkTrigger = TriggerHandler.parseTrigger(trigger, card, true);
|
||||
planesWalkTrigger.setOverridingAbility(AbilityFactory.getAbility(rolledWalk, card));
|
||||
card.addTrigger(planesWalkTrigger);
|
||||
|
||||
StringBuilder saSB = new StringBuilder();
|
||||
saSB.append("ST$ RollPlanarDice | Cost$ X | SorcerySpeed$ True | Activator$ Player | ActivationZone$ Command | ");
|
||||
saSB.append("SpellDescription$ Roll the planar dice. X is equal to the amount of times the planar die has been rolled this turn.");
|
||||
String specialA = "ST$ RollPlanarDice | Cost$ X | SorcerySpeed$ True | Activator$ Player | SpecialAction$ True" +
|
||||
"ActivationZone$ Command | SpellDescription$ Roll the planar dice. X is equal to the number of times " +
|
||||
"you have previously taken this action this turn.";
|
||||
|
||||
SpellAbility planarRoll = AbilityFactory.getAbility(saSB.toString(), card);
|
||||
planarRoll.setSVar("X", "Count$RolledThisTurn");
|
||||
SpellAbility planarRoll = AbilityFactory.getAbility(specialA, card);
|
||||
planarRoll.setSVar("X", "Count$PlanarDiceSpecialActionThisTurn");
|
||||
|
||||
card.addSpellAbility(planarRoll);
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ public class PhaseHandler implements java.io.Serializable {
|
||||
private int nUpkeepsThisGame = 0;
|
||||
private int nCombatsThisTurn = 0;
|
||||
private int nMain2sThisTurn = 0;
|
||||
private int planarDiceRolledthisTurn = 0;
|
||||
private int planarDiceSpecialActionThisTurn = 0;
|
||||
|
||||
private transient Player playerTurn = null;
|
||||
private transient Player playerPreviousTurn = null;
|
||||
@@ -522,7 +522,7 @@ public class PhaseHandler implements java.io.Serializable {
|
||||
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromPlayer(playerTurn);
|
||||
game.getTriggerHandler().runTrigger(TriggerType.TurnBegin, runParams, false);
|
||||
}
|
||||
planarDiceRolledthisTurn = 0;
|
||||
planarDiceSpecialActionThisTurn = 0;
|
||||
// Play the End Turn sound
|
||||
game.fireEvent(new GameEventTurnEnded());
|
||||
break;
|
||||
@@ -1212,11 +1212,11 @@ public class PhaseHandler implements java.io.Serializable {
|
||||
onPhaseBegin();
|
||||
}
|
||||
|
||||
public int getPlanarDiceRolledthisTurn() {
|
||||
return planarDiceRolledthisTurn;
|
||||
public int getPlanarDiceSpecialActionThisTurn() {
|
||||
return planarDiceSpecialActionThisTurn;
|
||||
}
|
||||
public void incPlanarDiceRolledthisTurn() {
|
||||
planarDiceRolledthisTurn++;
|
||||
public void incPlanarDiceSpecialActionThisTurn() {
|
||||
planarDiceSpecialActionThisTurn++;
|
||||
}
|
||||
|
||||
public String debugPrintState(boolean hasPriority) {
|
||||
|
||||
@@ -2,6 +2,6 @@ Name:Fractured Powerstone
|
||||
ManaCost:2
|
||||
Types:Artifact
|
||||
A:AB$ Mana | Cost$ T | Produced$ C | SpellDescription$ Add {C}.
|
||||
A:AB$ RollPlanarDice | Cost$ T | SorcerySpeed$ True | NotCountedForPDCost$ True | SpellDescription$ Roll the planar die. Activate only as a sorcery.
|
||||
A:AB$ RollPlanarDice | Cost$ T | SorcerySpeed$ True | SpellDescription$ Roll the planar die. Activate only as a sorcery.
|
||||
AI:RemoveDeck:Random
|
||||
Oracle:{T}: Add {C}.\n{T}: Roll the planar die. Activate only as a sorcery.
|
||||
|
||||
Reference in New Issue
Block a user