mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
*Added the ability to suppress trigger modes. Currently only used when control changes on a permanent (since it moves battlefield->battlefield).
This commit is contained in:
@@ -110,6 +110,7 @@ public class GameAction {
|
|||||||
PlayerZone oldBattlefield = AllZone.getZone(Constant.Zone.Battlefield, oldController);
|
PlayerZone oldBattlefield = AllZone.getZone(Constant.Zone.Battlefield, oldController);
|
||||||
PlayerZone newBattlefield = AllZone.getZone(Constant.Zone.Battlefield, newController);
|
PlayerZone newBattlefield = AllZone.getZone(Constant.Zone.Battlefield, newController);
|
||||||
|
|
||||||
|
AllZone.TriggerHandler.suppressMode("ChangesZone");
|
||||||
((PlayerZone_ComesIntoPlay) AllZone.Human_Battlefield).setTriggers(false);
|
((PlayerZone_ComesIntoPlay) AllZone.Human_Battlefield).setTriggers(false);
|
||||||
((PlayerZone_ComesIntoPlay) AllZone.Computer_Battlefield).setTriggers(false);
|
((PlayerZone_ComesIntoPlay) AllZone.Computer_Battlefield).setTriggers(false);
|
||||||
//so "enters the battlefield" abilities don't trigger
|
//so "enters the battlefield" abilities don't trigger
|
||||||
@@ -122,6 +123,7 @@ public class GameAction {
|
|||||||
AllZone.Combat.removeFromCombat(c);
|
AllZone.Combat.removeFromCombat(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AllZone.TriggerHandler.clearSuppression("ChangesZone");
|
||||||
((PlayerZone_ComesIntoPlay) AllZone.Human_Battlefield).setTriggers(true);
|
((PlayerZone_ComesIntoPlay) AllZone.Human_Battlefield).setTriggers(true);
|
||||||
((PlayerZone_ComesIntoPlay) AllZone.Computer_Battlefield).setTriggers(true);
|
((PlayerZone_ComesIntoPlay) AllZone.Computer_Battlefield).setTriggers(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,17 @@ import java.util.HashMap;
|
|||||||
public class TriggerHandler {
|
public class TriggerHandler {
|
||||||
|
|
||||||
private ArrayList<Trigger> registeredTriggers = new ArrayList<Trigger>();
|
private ArrayList<Trigger> registeredTriggers = new ArrayList<Trigger>();
|
||||||
|
private ArrayList<String> suppressedModes = new ArrayList<String>();
|
||||||
|
|
||||||
|
public void suppressMode(String mode)
|
||||||
|
{
|
||||||
|
suppressedModes.add(mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearSuppression(String mode)
|
||||||
|
{
|
||||||
|
suppressedModes.remove(mode);
|
||||||
|
}
|
||||||
|
|
||||||
public static Trigger parseTrigger(String name,String trigParse,Card host)
|
public static Trigger parseTrigger(String name,String trigParse,Card host)
|
||||||
{
|
{
|
||||||
@@ -165,6 +176,10 @@ public class TriggerHandler {
|
|||||||
|
|
||||||
public void runTrigger(String mode,HashMap<String,Object> runParams)
|
public void runTrigger(String mode,HashMap<String,Object> runParams)
|
||||||
{
|
{
|
||||||
|
if(suppressedModes.contains(mode))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
//AP
|
//AP
|
||||||
for(Trigger regtrig : registeredTriggers)
|
for(Trigger regtrig : registeredTriggers)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user