*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:
jendave
2011-08-06 16:41:50 +00:00
parent 78c7169e22
commit 27ae2e587d
2 changed files with 17 additions and 0 deletions

View File

@@ -110,6 +110,7 @@ public class GameAction {
PlayerZone oldBattlefield = AllZone.getZone(Constant.Zone.Battlefield, oldController);
PlayerZone newBattlefield = AllZone.getZone(Constant.Zone.Battlefield, newController);
AllZone.TriggerHandler.suppressMode("ChangesZone");
((PlayerZone_ComesIntoPlay) AllZone.Human_Battlefield).setTriggers(false);
((PlayerZone_ComesIntoPlay) AllZone.Computer_Battlefield).setTriggers(false);
//so "enters the battlefield" abilities don't trigger
@@ -122,6 +123,7 @@ public class GameAction {
AllZone.Combat.removeFromCombat(c);
}
AllZone.TriggerHandler.clearSuppression("ChangesZone");
((PlayerZone_ComesIntoPlay) AllZone.Human_Battlefield).setTriggers(true);
((PlayerZone_ComesIntoPlay) AllZone.Computer_Battlefield).setTriggers(true);
}

View File

@@ -6,6 +6,17 @@ import java.util.HashMap;
public class TriggerHandler {
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)
{
@@ -165,6 +176,10 @@ public class TriggerHandler {
public void runTrigger(String mode,HashMap<String,Object> runParams)
{
if(suppressedModes.contains(mode))
{
return;
}
//AP
for(Trigger regtrig : registeredTriggers)
{