Merge branch 'assorted-fixes' into 'master'

- Fixed the AI for Hunt the Weak/Savage Storm, prevented a crash when trying to exec a trigger with a non-existent SVar

See merge request core-developers/forge!130
This commit is contained in:
Michael Kamensky
2018-01-21 18:04:27 +00:00
2 changed files with 6 additions and 0 deletions

View File

@@ -55,6 +55,7 @@ public class FightAi extends SpellAbilityAi {
return true; return true;
} }
} }
return false; // bail at this point, otherwise the AI will overtarget and waste the activation
} }
if (sa.hasParam("TargetsFromDifferentZone")) { if (sa.hasParam("TargetsFromDifferentZone")) {

View File

@@ -570,6 +570,11 @@ public class TriggerHandler {
}; };
} }
else { else {
if (!host.getCurrentState().hasSVar(triggerParams.get("Execute"))) {
System.err.println("Warning: tried to run a trigger for card " + host + " referencing a SVar " + triggerParams.get("Execute") + " not present on the current state " + host.getCurrentState() + ". Aborting trigger execution to prevent a crash.");
return;
}
sa = AbilityFactory.getAbility(host, triggerParams.get("Execute")); sa = AbilityFactory.getAbility(host, triggerParams.get("Execute"));
} }
} else { } else {