Merge branch 'precombat-simple' into 'master'

Clean up isPreCombatMain and related

See merge request core-developers/forge!1906
This commit is contained in:
swordshine
2019-06-25 04:07:25 +00:00
17 changed files with 26 additions and 19 deletions

View File

@@ -76,6 +76,7 @@ public class PhaseHandler implements java.io.Serializable {
private int nUpkeepsThisTurn = 0;
private int nUpkeepsThisGame = 0;
private int nCombatsThisTurn = 0;
private int nMain1sThisTurn = 0;
private boolean bPreventCombatDamageThisTurn = false;
private int planarDiceRolledthisTurn = 0;
@@ -392,6 +393,7 @@ public class PhaseHandler implements java.io.Serializable {
playerTurn.removeKeyword("Skip all combat phases of this turn.");
nUpkeepsThisTurn = 0;
nMain1sThisTurn = 0;
// Rule 514.3
givePriorityToPlayer = false;
@@ -459,6 +461,10 @@ public class PhaseHandler implements java.io.Serializable {
game.getUpkeep().registerUntilEndCommand(playerTurn);
break;
case MAIN1:
nMain1sThisTurn++;
break;
case COMBAT_END:
GameEventCombatEnded eventEndCombat = null;
if (combat != null) {
@@ -920,15 +926,16 @@ public class PhaseHandler implements java.io.Serializable {
}
public final boolean isFirstUpkeep() {
return (nUpkeepsThisTurn == 0);
return is(PhaseType.UPKEEP) && (nUpkeepsThisTurn == 0);
}
public final boolean isFirstUpkeepThisGame() {
return (nUpkeepsThisGame == 0);
return is(PhaseType.UPKEEP) && (nUpkeepsThisGame == 0);
}
public final boolean isPreCombatMain() {
return (nCombatsThisTurn == 0);
// 505.1a. Only the first main phase of the turn is a precombat main phase.
return is(PhaseType.MAIN1) && (nMain1sThisTurn == 0);
}
private final static boolean DEBUG_PHASES = false;

View File

@@ -1,7 +1,7 @@
Name:Altar of Shadows
ManaCost:7
Types:Artifact
T:Mode$ Phase | Phase$ Main1 | PreCombatMain$ True | ValidPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigGetMana | TriggerDescription$ At the beginning of your precombat main phase, add {B} for each charge counter on CARDNAME.
T:Mode$ Phase | PreCombatMain$ True | ValidPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigGetMana | TriggerDescription$ At the beginning of your precombat main phase, add {B} for each charge counter on CARDNAME.
SVar:TrigGetMana:DB$ Mana | Produced$ B | Amount$ X | References$ X | SpellDescription$ Add {B} for each charge counter on CARDNAME.
A:AB$ Destroy | Cost$ 7 T | ValidTgts$ Creature | TgtPrompt$ Select target creature | SubAbility$ DBPutCounter | SpellDescription$ Destroy target creature. Then put a charge counter on CARDNAME.
SVar:DBPutCounter:DB$PutCounter | Defined$ Self | CounterType$ CHARGE | CounterNum$ 1

View File

@@ -3,7 +3,7 @@ ManaCost:3 B B
Types:Enchantment
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Creature | TriggerZones$ Battlefield | Execute$ TrigPutCounter | TriggerDescription$ Whenever a creature dies, put a charge counter on CARDNAME.
SVar:TrigPutCounter:DB$PutCounter | Defined$ Self | CounterType$ CHARGE | CounterNum$ 1
T:Mode$ Phase | Phase$ Main1 | PreCombatMain$ True | ValidPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigGetMana | TriggerDescription$ At the beginning of your precombat main phase, add {B} for each charge counter on CARDNAME.
T:Mode$ Phase | PreCombatMain$ True | ValidPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigGetMana | TriggerDescription$ At the beginning of your precombat main phase, add {B} for each charge counter on CARDNAME.
SVar:TrigGetMana:DB$ Mana | Produced$ B | Amount$ X | References$ X | SpellDescription$ Add {X}{B}
SVar:X:Count$CardCounters.CHARGE
SVar:Picture:http://www.wizards.com/global/images/magic/general/black_market.jpg

View File

@@ -1,7 +1,7 @@
Name:Blinkmoth Urn
ManaCost:5
Types:Artifact
T:Mode$ Phase | Phase$ Main1 | PreCombatMain$ True | ValidPlayer$ Player | TriggerZones$ Battlefield | IsPresent$ Card.Self+untapped | Execute$ TrigGetMana | TriggerDescription$ At the beginning of each player's precombat main phase, if CARDNAME is untapped, that player adds {C} for each artifact they control.
T:Mode$ Phase | PreCombatMain$ True | ValidPlayer$ Player | TriggerZones$ Battlefield | IsPresent$ Card.Self+untapped | Execute$ TrigGetMana | TriggerDescription$ At the beginning of each player's precombat main phase, if CARDNAME is untapped, that player adds {C} for each artifact they control.
SVar:TrigGetMana:DB$ Mana | Produced$ C | Amount$ X | References$ X | Defined$ TriggeredPlayer
SVar:X:Count$Valid Artifact.ActivePlayerCtrl
AI:RemoveDeck:Random

View File

@@ -1,7 +1,7 @@
Name:Bounty of the Luxa
ManaCost:2 G U
Types:Enchantment
T:Mode$ Phase | Phase$ Main1 | PreCombatMain$ True | ValidPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigRemove | TriggerDescription$ At the beginning of your precombat main phase, remove all flood counters from CARDNAME. If no counters were removed this way, put a flood counter on CARDNAME and draw a card. Otherwise, add {C}{G}{U}.
T:Mode$ Phase | PreCombatMain$ True | ValidPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigRemove | TriggerDescription$ At the beginning of your precombat main phase, remove all flood counters from CARDNAME. If no counters were removed this way, put a flood counter on CARDNAME and draw a card. Otherwise, add {C}{G}{U}.
SVar:TrigRemove:DB$ RemoveCounter | CounterType$ FLOOD | CounterNum$ All | RememberRemoved$ True | SubAbility$ DBPutCounter
SVar:DBPutCounter:DB$PutCounter | Defined$ Self | ConditionCheckSVar$ X | References$ X | ConditionSVarCompare$ EQ0 | CounterType$ FLOOD | CounterNum$ 1 | SubAbility$ DBDraw
SVar:DBDraw:DB$ Draw | NumCards$ 1 | ConditionCheckSVar$ X | References$ X | ConditionSVarCompare$ EQ0 | SubAbility$ DBGetMana

View File

@@ -3,7 +3,7 @@ ManaCost:B
Types:Creature Horror
PT:1/1
K:Menace
T:Mode$ Phase | Phase$ Main1 | PreCombatMain$ True | ValidPlayer$ You | Execute$ DBImmediateTrigger | TriggerZones$ Battlefield | TriggerDescription$ At the beginning of your precombat main phase, you may sacrifice a creature. When you do, choose a nonland card name, then target player reveals their hand and discards all cards with that name.
T:Mode$ Phase | PreCombatMain$ True | ValidPlayer$ You | Execute$ DBImmediateTrigger | TriggerZones$ Battlefield | TriggerDescription$ At the beginning of your precombat main phase, you may sacrifice a creature. When you do, choose a nonland card name, then target player reveals their hand and discards all cards with that name.
SVar:DBImmediateTrigger:DB$ ImmediateTrigger | Execute$ NameCard | TriggerDescription$ You may sacrifice a creature. When you do, choose a nonland card name, then target player reveals their hand and discards all cards with that name. | UnlessCost$ Sac<1/Creature> | UnlessPayer$ You | UnlessSwitched$ True
SVar:NameCard:DB$ NameCard | Defined$ You | ValidCards$ Card.nonLand | ValidDesc$ nonland | SubAbility$ DBDiscard | SpellDescription$ Choose a nonland card name. Target player reveals their hand and discards all cards with that name.
SVar:DBDiscard:DB$ Discard | ValidTgts$ Player | TgtPrompt$ Select target player | Mode$ RevealDiscardAll | DiscardValid$ Card.NamedCard

View File

@@ -3,7 +3,7 @@ ManaCost:3
Types:Artifact
A:AB$ Mana | Cost$ T | Produced$ Any | Amount$ 1 | SpellDescription$ Add one mana of any color.
A:AB$ PutCounter | Cost$ T | CounterType$ CHARGE | CounterNum$ 1 | SpellDescription$ Put a charge counter on CARDNAME.
T:Mode$ Phase | Phase$ Main1 | PreCombatMain$ True | ValidPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigRemove | TriggerDescription$ At the beginning of your precombat main phase, remove all charge counters from CARDNAME. Add one mana of any color for each charge counter removed this way.
T:Mode$ Phase | PreCombatMain$ True | ValidPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigRemove | TriggerDescription$ At the beginning of your precombat main phase, remove all charge counters from CARDNAME. Add one mana of any color for each charge counter removed this way.
SVar:TrigRemove:DB$ RemoveCounter | CounterType$ CHARGE | CounterNum$ All | RememberRemoved$ True | SubAbility$ TrigGetMana
SVar:TrigGetMana:DB$ Mana | Produced$ Combo Any | Amount$ NumRemoved | References$ NumRemoved | AILogic$ MostProminentInComputerHand | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True

View File

@@ -2,7 +2,7 @@ Name:Eladamri, Lord of Leaves Avatar
ManaCost:no cost
Types:Vanguard
HandLifeModifier:-1/+2
T:Mode$ Phase | Phase$ Main1 | PreCombatMain$ True | ValidPlayer$ Player | TriggerZones$ Command | Execute$ TrigAddMana | TriggerDescription$ At the beginning of each player's precombat main phase, that player adds {G}{G}.
T:Mode$ Phase | PreCombatMain$ True | ValidPlayer$ Player | TriggerZones$ Command | Execute$ TrigAddMana | TriggerDescription$ At the beginning of each player's precombat main phase, that player adds {G}{G}.
SVar:TrigAddMana:DB$ Mana | Produced$ G | Amount$ 2 | Defined$ TriggeredPlayer
AI:RemoveDeck:Random
SVar:Picture:https://downloads.cardforge.org/images/cards/VAN/Eladamri, Lord of Leaves Avatar.full.jpg

View File

@@ -1,7 +1,7 @@
Name:Eladamri's Vineyard
ManaCost:G
Types:Enchantment
T:Mode$ Phase | Phase$ Main1 | PreCombatMain$ True | ValidPlayer$ Player | TriggerZones$ Battlefield | Execute$ TrigMana | TriggerDescription$ At the beginning of each player's precombat main phase, that player adds {G}{G}.
T:Mode$ Phase | PreCombatMain$ True | ValidPlayer$ Player | TriggerZones$ Battlefield | Execute$ TrigMana | TriggerDescription$ At the beginning of each player's precombat main phase, that player adds {G}{G}.
SVar:TrigMana:DB$Mana | Produced$ G | Amount$ 2 | Defined$ TriggeredPlayer
SVar:Picture:http://www.wizards.com/global/images/magic/general/eladamris_vineyard.jpg
Oracle:At the beginning of each player's precombat main phase, that player adds {G}{G}.

View File

@@ -3,7 +3,7 @@ ManaCost:2 G G
Types:Enchantment Aura
K:Enchant permanent
A:SP$ Attach | Cost$ 2 G G | ValidTgts$ Permanent | AILogic$ Pump
T:Mode$ Phase | Phase$ Main1 | PreCombatMain$ True | ValidPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigMana | TriggerDescription$ At the beginning of your precombat main phase, add mana equal to enchanted permanent's mana cost. (Mana cost includes color. If a mana symbol has multiple colors, choose one.)
T:Mode$ Phase | PreCombatMain$ True | ValidPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigMana | TriggerDescription$ At the beginning of your precombat main phase, add mana equal to enchanted permanent's mana cost. (Mana cost includes color. If a mana symbol has multiple colors, choose one.)
SVar:TrigMana:DB$ Mana | Produced$ Special EnchantedManaCost
SVar:Picture:http://www.wizards.com/global/images/magic/general/elemental_resonance.jpg
Oracle:Enchant permanent\nAt the beginning of your precombat main phase, add mana equal to enchanted permanent's mana cost. (Mana cost includes color. If a mana symbol has multiple colors, choose one.)

View File

@@ -2,7 +2,7 @@ Name:Kilnspire District
ManaCost:no cost
Types:Plane Ravnica
T:Mode$ PlaneswalkedTo | ValidCard$ Card.Self | TriggerZones$ Command | Execute$ PutCounter | TriggerDescription$ When you planeswalk to CARDNAME or at the beginning of your precombat main phase, put a charge counter on CARDNAME, then add {R} for each charge counter on it.
T:Mode$ Phase | Phase$ Main1 | PreCombatMain$ True | ValidPlayer$ You | TriggerZones$ Command | Execute$ PutCounter | Secondary$ True | TriggerDescription$ When you planeswalk to CARDNAME or at the beginning of your precombat main phase, put a charge counter on CARDNAME, then add {R} for each charge counter on it.
T:Mode$ Phase | PreCombatMain$ True | ValidPlayer$ You | TriggerZones$ Command | Execute$ PutCounter | Secondary$ True | TriggerDescription$ When you planeswalk to CARDNAME or at the beginning of your precombat main phase, put a charge counter on CARDNAME, then add {R} for each charge counter on it.
SVar:PutCounter:DB$PutCounter | Defined$ Self | CounterType$ CHARGE | CounterNum$ 1 | SubAbility$ DBMana
SVar:DBMana:DB$ Mana | Produced$ R | Amount$ Y | References$ Y
T:Mode$ PlanarDice | Result$ Chaos | TriggerZones$ Command | Execute$ DBPay | TriggerDescription$ Whenever you roll {CHAOS}, you may pay {X}. If you do, CARDNAME deals X damage to any target.

View File

@@ -2,7 +2,7 @@ Name:Magus of the Vineyard
ManaCost:G
Types:Creature Human Wizard
PT:1/1
T:Mode$ Phase | Phase$ Main1 | PreCombatMain$ True | ValidPlayer$ Player | Execute$ TrigMana | TriggerZones$ Battlefield | TriggerDescription$ At the beginning of each player's precombat main phase, that player adds {G}{G}.
T:Mode$ Phase | PreCombatMain$ True | ValidPlayer$ Player | Execute$ TrigMana | TriggerZones$ Battlefield | TriggerDescription$ At the beginning of each player's precombat main phase, that player adds {G}{G}.
SVar:TrigMana:DB$Mana | Produced$ G | Amount$ 2 | Defined$ TriggeredPlayer
SVar:Picture:http://www.wizards.com/global/images/magic/general/magus_of_the_vineyard.jpg
Oracle:At the beginning of each player's precombat main phase, that player adds {G}{G}.

View File

@@ -2,7 +2,7 @@ Name:Orcish Squatters Avatar
ManaCost:no cost
Types:Vanguard
HandLifeModifier:-1/-1
T:Mode$ Phase | Phase$ Main1 | PreCombatMain$ True | ValidPlayer$ You | TriggerZones$ Command | Execute$ TrigGetMana | TriggerDescription$ At the beginning of your precombat main phase, add an amount of {C} equal to the number of lands target opponent controls.
T:Mode$ Phase | PreCombatMain$ True | ValidPlayer$ You | TriggerZones$ Command | Execute$ TrigGetMana | TriggerDescription$ At the beginning of your precombat main phase, add an amount of {C} equal to the number of lands target opponent controls.
SVar:TrigGetMana:DB$ Pump | ValidTgts$ Player | RememberObjects$ Targeted | SubAbility$ DBMana
SVar:DBMana:DB$ Mana | Produced$ C | Amount$ X | References$ X | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True

View File

@@ -3,7 +3,7 @@ ManaCost:2 U
Types:Enchantment Aura
K:Enchant player
A:SP$ Attach | Cost$ 2 U | ValidTgts$ Player
T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ Player.EnchantedBy | TriggerZones$ Battlefield | FirstUpkeep$ True | Execute$ AddUpkeep | TriggerDescription$ At the beginning of enchanted player's first upkeep each turn, that player gets an additional upkeep step after this step.
T:Mode$ Phase | FirstUpkeep$ True | ValidPlayer$ Player.EnchantedBy | TriggerZones$ Battlefield | Execute$ AddUpkeep | TriggerDescription$ At the beginning of enchanted player's first upkeep each turn, that player gets an additional upkeep step after this step.
SVar:AddUpkeep:DB$ AddPhase | ExtraPhase$ Upkeep
AI:RemoveDeck:Random
SVar:Picture:http://www.wizards.com/global/images/magic/general/paradox_haze.jpg

View File

@@ -2,7 +2,7 @@ Name:Plasm Capture
ManaCost:G G U U
Types:Instant
A:SP$ Counter | Cost$ G G U U | TargetType$ Spell | RememberCounteredCMC$ True | ValidTgts$ Card | SubAbility$ DBDelTrig | SpellDescription$ Counter target spell. At the beginning of your next precombat main phase, add X mana in any combination of colors, where X is that spell's converted mana cost.
SVar:DBDelTrig:DB$ DelayedTrigger | Mode$ Phase | Phase$ Main1 | PreCombatMain$ True | ValidPlayer$ You | Execute$ AddMana | TriggerDescription$ At the beginning of your next precombat main phase, add X mana in any combination of colors, where X is that spell's converted mana cost. | RememberNumber$ True | SubAbility$ DBCleanup
SVar:DBDelTrig:DB$ DelayedTrigger | Mode$ Phase | PreCombatMain$ True | ValidPlayer$ You | Execute$ AddMana | TriggerDescription$ At the beginning of your next precombat main phase, add X mana in any combination of colors, where X is that spell's converted mana cost. | RememberNumber$ True | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:AddMana:DB$ Mana | Produced$ Combo Any | Amount$ X | References$ X | AILogic$ MostProminentInComputerHand
SVar:X:Count$TriggerRememberAmount

View File

@@ -1,6 +1,6 @@
Name:Sentinel Dispatch
ManaCost:no cost
Types:Conspiracy
T:Mode$ Phase | Phase$ Upkeep | FirstUpkeepThisGame$ True | Execute$ TrigToken | EffectZone$ Command | TriggerDescription$ At the beginning of the first upkeep, create a 1/1 colorless Construct artifact creature token with defender.
T:Mode$ Phase | FirstUpkeepThisGame$ True | Execute$ TrigToken | EffectZone$ Command | TriggerDescription$ At the beginning of the first upkeep, create a 1/1 colorless Construct artifact creature token with defender.
SVar:TrigToken:DB$ Token | TokenAmount$ 1 | TokenScript$ c_1_1_a_construct_defender | TokenOwner$ You | LegacyImage$ c 1 1 a construct defender cns
Oracle:(Start the game with this conspiracy face up in the command zone.)\nAt the beginning of the first upkeep, create a 1/1 colorless Construct artifact creature token with defender.

View File

@@ -2,7 +2,7 @@ Name:Ventifact Bottle
ManaCost:3
Types:Artifact
A:AB$ PutCounter | Cost$ X 1 T | CounterType$ CHARGE | CounterNum$ X | References$ X | SorcerySpeed$ True | SpellDescription$ Put X charge counters on Ventifact Bottle. Activate this ability only any time you could cast a sorcery.
T:Mode$ Phase | Phase$ Main1 | PreCombatMain$ True | ValidPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigGetMana | CheckSVar$ Y | SVarCompare$ GE1 | TriggerDescription$ At the beginning of your precombat main phase, if CARDNAME has a charge counter on it, tap it and remove all charge counters from it. Add {C} for each charge counter removed this way.
T:Mode$ Phase | PreCombatMain$ True | ValidPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigGetMana | CheckSVar$ Y | SVarCompare$ GE1 | TriggerDescription$ At the beginning of your precombat main phase, if CARDNAME has a charge counter on it, tap it and remove all charge counters from it. Add {C} for each charge counter removed this way.
SVar:TrigGetMana:DB$ Mana | Produced$ C | Amount$ Y | SubAbility$ TrigRemove
SVar:TrigRemove:DB$ RemoveCounter | CounterType$ CHARGE | CounterNum$ Y | References$ Y | SubAbility$ DBTap
SVar:DBTap:DB$ Tap | Defined$ Self