- Script execution in GameState: do not iterate over all SVars, just grab the necessary SVar directly.

This commit is contained in:
Agetian
2017-07-31 12:00:02 +00:00
parent c34fae302e
commit d6e8a96b19

View File

@@ -384,11 +384,13 @@ public abstract class GameState {
sPtr = sPtr.substring(0, sPtr.indexOf("->")); sPtr = sPtr.substring(0, sPtr.indexOf("->"));
} }
for (Entry<String, String> svar : c.getSVars().entrySet()) { if (!c.hasSVar(sPtr)) {
String svarName = svar.getKey(); System.out.println("ERROR: Unable to find SVar " + sPtr + " on card " + c + " + to execute!");
String svarValue = svar.getValue(); return;
}
String svarValue = c.getSVar(sPtr);
if (svarName.equals(sPtr)) {
SpellAbility sa = AbilityFactory.getAbility(svarValue, c); SpellAbility sa = AbilityFactory.getAbility(svarValue, c);
sa.setActivatingPlayer(c.getController()); sa.setActivatingPlayer(c.getController());
if (tgtID != -1) { if (tgtID != -1) {
@@ -396,8 +398,6 @@ public abstract class GameState {
} }
sa.resolve(); sa.resolve();
} }
}
}
} }