refactor Planechase special action

This commit is contained in:
Northmoc
2023-04-19 10:48:18 -04:00
parent 9d85c14ca1
commit 136b352391
5 changed files with 19 additions and 21 deletions

View File

@@ -2690,8 +2690,8 @@ public class AbilityUtils {
return doXMath(game.getStack().getSpellsCastThisTurn().size() - 1, expr, c, ctb); return doXMath(game.getStack().getSpellsCastThisTurn().size() - 1, expr, c, ctb);
} }
if (sq[0].startsWith("RolledThisTurn")) { if (sq[0].startsWith("PlanarDiceSpecialActionThisTurn")) {
return game.getPhaseHandler().getPlanarDiceRolledthisTurn(); return game.getPhaseHandler().getPlanarDiceSpecialActionThisTurn();
} }
if (sq[0].contains("CardTypes")) { if (sq[0].contains("CardTypes")) {

View File

@@ -25,8 +25,8 @@ public class RollPlanarDiceEffect extends SpellAbilityEffect {
if (game.getActivePlanes() == null) { // not a planechase game, nothing happens if (game.getActivePlanes() == null) { // not a planechase game, nothing happens
return; return;
} }
if (!sa.hasParam("NotCountedForPDCost")) { if (sa.hasParam("SpecialAction")) {
game.getPhaseHandler().incPlanarDiceRolledthisTurn(); game.getPhaseHandler().incPlanarDiceSpecialActionThisTurn();
} }
// Play the die roll sound // Play the die roll sound
game.fireEvent(new GameEventRollDie()); game.fireEvent(new GameEventRollDie());

View File

@@ -341,23 +341,21 @@ public class CardFactory {
} }
private static void buildPlaneAbilities(Card card) { private static void buildPlaneAbilities(Card card) {
StringBuilder triggerSB = new StringBuilder(); String trigger = "Mode$ PlanarDice | Result$ Planeswalk | TriggerZones$ Command | Secondary$ True | " +
triggerSB.append("Mode$ PlanarDice | Result$ Planeswalk | TriggerZones$ Command | Secondary$ True | "); "TriggerDescription$ Whenever you roll the Planeswalker symbol on the planar die, planeswalk.";
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 rolledWalk = "DB$ 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)); planesWalkTrigger.setOverridingAbility(AbilityFactory.getAbility(rolledWalk, card));
card.addTrigger(planesWalkTrigger); card.addTrigger(planesWalkTrigger);
StringBuilder saSB = new StringBuilder(); String specialA = "ST$ RollPlanarDice | Cost$ X | SorcerySpeed$ True | Activator$ Player | SpecialAction$ True" +
saSB.append("ST$ RollPlanarDice | Cost$ X | SorcerySpeed$ True | Activator$ Player | ActivationZone$ Command | "); "ActivationZone$ Command | SpellDescription$ Roll the planar dice. X is equal to the number of times " +
saSB.append("SpellDescription$ Roll the planar dice. X is equal to the amount of times the planar die has been rolled this turn."); "you have previously taken this action this turn.";
SpellAbility planarRoll = AbilityFactory.getAbility(saSB.toString(), card); SpellAbility planarRoll = AbilityFactory.getAbility(specialA, card);
planarRoll.setSVar("X", "Count$RolledThisTurn"); planarRoll.setSVar("X", "Count$PlanarDiceSpecialActionThisTurn");
card.addSpellAbility(planarRoll); card.addSpellAbility(planarRoll);
} }

View File

@@ -91,7 +91,7 @@ public class PhaseHandler implements java.io.Serializable {
private int nUpkeepsThisGame = 0; private int nUpkeepsThisGame = 0;
private int nCombatsThisTurn = 0; private int nCombatsThisTurn = 0;
private int nMain2sThisTurn = 0; private int nMain2sThisTurn = 0;
private int planarDiceRolledthisTurn = 0; private int planarDiceSpecialActionThisTurn = 0;
private transient Player playerTurn = null; private transient Player playerTurn = null;
private transient Player playerPreviousTurn = 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); final Map<AbilityKey, Object> runParams = AbilityKey.mapFromPlayer(playerTurn);
game.getTriggerHandler().runTrigger(TriggerType.TurnBegin, runParams, false); game.getTriggerHandler().runTrigger(TriggerType.TurnBegin, runParams, false);
} }
planarDiceRolledthisTurn = 0; planarDiceSpecialActionThisTurn = 0;
// Play the End Turn sound // Play the End Turn sound
game.fireEvent(new GameEventTurnEnded()); game.fireEvent(new GameEventTurnEnded());
break; break;
@@ -1212,11 +1212,11 @@ public class PhaseHandler implements java.io.Serializable {
onPhaseBegin(); onPhaseBegin();
} }
public int getPlanarDiceRolledthisTurn() { public int getPlanarDiceSpecialActionThisTurn() {
return planarDiceRolledthisTurn; return planarDiceSpecialActionThisTurn;
} }
public void incPlanarDiceRolledthisTurn() { public void incPlanarDiceSpecialActionThisTurn() {
planarDiceRolledthisTurn++; planarDiceSpecialActionThisTurn++;
} }
public String debugPrintState(boolean hasPriority) { public String debugPrintState(boolean hasPriority) {

View File

@@ -2,6 +2,6 @@ Name:Fractured Powerstone
ManaCost:2 ManaCost:2
Types:Artifact Types:Artifact
A:AB$ Mana | Cost$ T | Produced$ C | SpellDescription$ Add {C}. 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 AI:RemoveDeck:Random
Oracle:{T}: Add {C}.\n{T}: Roll the planar die. Activate only as a sorcery. Oracle:{T}: Add {C}.\n{T}: Roll the planar die. Activate only as a sorcery.