Merge branch 'fixTokenScriptAgain' into 'master'

TokenInfo: fix if script is null

See merge request core-developers/forge!1415
This commit is contained in:
Michael Kamensky
2019-02-23 13:44:07 +00:00
2 changed files with 4 additions and 9 deletions

View File

@@ -63,15 +63,6 @@ public class TokenAi extends SpellAbilityAi {
this.actualToken = TokenInfo.getProtoType(mapParams.getParam("TokenScript"), mapParams); this.actualToken = TokenInfo.getProtoType(mapParams.getParam("TokenScript"), mapParams);
if (actualToken == null) { if (actualToken == null) {
String[] keywords;
if (mapParams.hasParam("TokenKeywords")) {
// TODO: Change this Split to a semicolon or something else
keywords = mapParams.getParam("TokenKeywords").split("<>");
} else {
keywords = new String[0];
}
this.tokenPower = mapParams.getParam("TokenPower"); this.tokenPower = mapParams.getParam("TokenPower");
this.tokenToughness = mapParams.getParam("TokenToughness"); this.tokenToughness = mapParams.getParam("TokenToughness");
} else { } else {

View File

@@ -226,6 +226,10 @@ public class TokenInfo {
} }
static public Card getProtoType(final String script, final SpellAbility sa) { static public Card getProtoType(final String script, final SpellAbility sa) {
// script might be null, or sa might be null
if (script == null || sa == null) {
return null;
}
final Card host = sa.getHostCard(); final Card host = sa.getHostCard();
final Game game = host.getGame(); final Game game = host.getGame();