mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
- Experimental: fixed state triggers so they will trigger during the middle of the resolution of a spell or ability. (e.g. Cloudshift an Enchantment creature would fire Tethered Griffin's trigger)
This commit is contained in:
@@ -763,6 +763,9 @@ public class GameAction {
|
||||
game.fireEvent(new GameEventCardStatsChanged(affectedCards));
|
||||
}
|
||||
|
||||
final HashMap<String, Object> runParams = new HashMap<String, Object>();
|
||||
game.getTriggerHandler().runTrigger(TriggerType.Always, runParams, false);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -802,9 +805,6 @@ public class GameAction {
|
||||
|
||||
this.checkStaticAbilities();
|
||||
|
||||
final HashMap<String, Object> runParams = new HashMap<String, Object>();
|
||||
game.getTriggerHandler().runTrigger(TriggerType.Always, runParams, false);
|
||||
|
||||
for (Player p : game.getPlayers()) {
|
||||
for (Card c : p.getCardsIn(ZoneType.Battlefield)) {
|
||||
if (!c.getController().equals(p)) { // should not be here
|
||||
|
||||
@@ -155,8 +155,9 @@ public class TriggerHandler {
|
||||
}
|
||||
|
||||
//runWaitingTrigger(new TriggerWaiting(mode, runParams));
|
||||
|
||||
if (game.getStack().isFrozen() || holdTrigger) {
|
||||
if (mode == TriggerType.Always) {
|
||||
runStateTrigger(runParams);
|
||||
} else if (game.getStack().isFrozen() || holdTrigger) {
|
||||
waitingTriggers.add(new TriggerWaiting(mode, runParams));
|
||||
} else {
|
||||
runWaitingTrigger(new TriggerWaiting(mode, runParams));
|
||||
@@ -164,6 +165,21 @@ public class TriggerHandler {
|
||||
// Tell auto stop to stop
|
||||
}
|
||||
|
||||
public final boolean runStateTrigger(Map<String, Object> runParams) {
|
||||
boolean checkStatics = false;
|
||||
// only cards in play can run state triggers
|
||||
List<Card> allCards = new ArrayList<Card>(game.getCardsIn(ZoneType.listValueOf("Battlefield,Command")));
|
||||
for (final Card c : allCards) {
|
||||
for (final Trigger t : c.getTriggers()) {
|
||||
if (canRunTrigger(t, TriggerType.Always, runParams)) {
|
||||
this.runSingleTrigger(t, runParams);
|
||||
checkStatics = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return checkStatics;
|
||||
}
|
||||
|
||||
public final boolean runWaitingTriggers() {
|
||||
ArrayList<TriggerWaiting> waiting = new ArrayList<TriggerWaiting>(waitingTriggers);
|
||||
waitingTriggers.clear();
|
||||
|
||||
@@ -2,7 +2,7 @@ Name:Bronze Bombshell
|
||||
ManaCost:4
|
||||
Types:Artifact Creature Construct
|
||||
PT:4/1
|
||||
T:Mode$ Always | IsPresent$ Card.Self+OwnerDoesntControl | Execute$ TrigSac | TriggerDescription$ When a player other than CARDNAME's owner controls it, that player sacrifices it. If the player does, CARDNAME deals 7 damage to him or her.
|
||||
T:Mode$ Always | TriggerZones$ Battlefield | IsPresent$ Card.Self+OwnerDoesntControl | Execute$ TrigSac | TriggerDescription$ When a player other than CARDNAME's owner controls it, that player sacrifices it. If the player does, CARDNAME deals 7 damage to him or her.
|
||||
SVar:TrigSac:AB$SacrificeAll | Cost$ 0 | Defined$ Self | RememberSacrificed$ True | SubAbility$ DBDmg
|
||||
SVar:DBDmg:DB$DealDamage | Defined$ You | NumDmg$ 7 | CheckSVar$ X | SVarCompare$ GE1 | References$ X
|
||||
SVar:X:Remembered$Amount
|
||||
|
||||
@@ -2,7 +2,7 @@ Name:Garruk Relentless
|
||||
ManaCost:3 G
|
||||
Types:Planeswalker Garruk
|
||||
Loyalty:3
|
||||
T:Mode$ Always | IsPresent$ Card.Self+counters_LE2_LOYALTY | Execute$ TrigTransform | TriggerDescription$ When CARDNAME has two or fewer loyalty counters on him, transform him.
|
||||
T:Mode$ Always | TriggerZones$ Battlefield | IsPresent$ Card.Self+counters_LE2_LOYALTY | Execute$ TrigTransform | TriggerDescription$ When CARDNAME has two or fewer loyalty counters on him, transform him.
|
||||
A:AB$ DealDamage | Cost$ AddCounter<0/LOYALTY> | ValidTgts$ Creature | TgtPrompt$ Select target creature | NumDmg$ 3 | SubAbility$ DamageThis | Planeswalker$ True | SpellDescription$ CARDNAME deals 3 damage to target creature. That creature deals damage equal to its power to him.
|
||||
A:AB$ Token | Cost$ AddCounter<0/LOYALTY> | TokenAmount$ 1 | TokenName$ Wolf | TokenColors$ Green | TokenTypes$ Creature,Wolf | TokenOwner$ You | TokenPower$ 2 | TokenToughness$ 2 | Planeswalker$ True | References$ Y | SpellDescription$ Put a 2/2 green Wolf creature token onto the battlefield.
|
||||
SVar:DamageThis:DB$ DealDamage | Defined$ Self | DamageSource$ Targeted | NumDmg$ Y
|
||||
|
||||
@@ -4,7 +4,7 @@ Types:Artifact Creature Scarecrow
|
||||
PT:4/4
|
||||
K:ETBReplacement:Other:ChooseColor
|
||||
SVar:ChooseColor:DB$ ChooseColor | Defined$ You | SpellDescription$ As CARDNAME enters the battlefield, choose a color. | AILogic$ MostProminentComputerControls
|
||||
T:Mode$ Always | CheckSVar$ X | SVarCompare$ EQ0 | TriggerZones$ Battlefield | Static$ True | Execute$ TrigSacrifice | TriggerDescription$ When you control no permanents of the chosen color, sacrifice CARDNAME.
|
||||
T:Mode$ Always | CheckSVar$ X | SVarCompare$ EQ0 | TriggerZones$ Battlefield | Execute$ TrigSacrifice | TriggerDescription$ When you control no permanents of the chosen color, sacrifice CARDNAME.
|
||||
SVar:TrigSacrifice:AB$ Sacrifice | Cost$ 0
|
||||
SVar:X:Count$Valid Permanent.YouCtrl+ChosenColor
|
||||
SVar:NeedsToPlay:Permanent.nonColorless+YouCtrl
|
||||
|
||||
Reference in New Issue
Block a user