mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
Fix NPE with Unexpected Fangs
This commit is contained in:
@@ -147,11 +147,19 @@ public class CountersPutAi extends CountersAi {
|
|||||||
final String sourceName = ComputerUtilAbility.getAbilitySourceName(sa);
|
final String sourceName = ComputerUtilAbility.getAbilitySourceName(sa);
|
||||||
CardCollection list;
|
CardCollection list;
|
||||||
Card choice = null;
|
Card choice = null;
|
||||||
final String type = sa.getParam("CounterType");
|
|
||||||
final String amountStr = sa.getParamOrDefault("CounterNum", "1");
|
final String amountStr = sa.getParamOrDefault("CounterNum", "1");
|
||||||
final boolean divided = sa.isDividedAsYouChoose();
|
final boolean divided = sa.isDividedAsYouChoose();
|
||||||
final String logic = sa.getParamOrDefault("AILogic", "");
|
final String logic = sa.getParamOrDefault("AILogic", "");
|
||||||
PhaseHandler ph = ai.getGame().getPhaseHandler();
|
PhaseHandler ph = ai.getGame().getPhaseHandler();
|
||||||
|
final String[] types;
|
||||||
|
if (sa.hasParam("CounterType")) {
|
||||||
|
// TODO some cards let you choose types, should check each
|
||||||
|
types = sa.getParam("CounterType").split(",");
|
||||||
|
} else {
|
||||||
|
// all types will be added
|
||||||
|
types = sa.getParam("CounterTypes").split(",");
|
||||||
|
}
|
||||||
|
final String type = types[0];
|
||||||
|
|
||||||
final boolean isClockwork = "True".equals(sa.getParam("UpTo")) && "Self".equals(sa.getParam("Defined"))
|
final boolean isClockwork = "True".equals(sa.getParam("UpTo")) && "Self".equals(sa.getParam("Defined"))
|
||||||
&& "P1P0".equals(sa.getParam("CounterType")) && "Count$xPaid".equals(source.getSVar("X"))
|
&& "P1P0".equals(sa.getParam("CounterType")) && "Count$xPaid".equals(source.getSVar("X"))
|
||||||
@@ -739,11 +747,19 @@ public class CountersPutAi extends CountersAi {
|
|||||||
// boolean chance = true;
|
// boolean chance = true;
|
||||||
boolean preferred = true;
|
boolean preferred = true;
|
||||||
CardCollection list;
|
CardCollection list;
|
||||||
final String type = sa.getParam("CounterType");
|
|
||||||
final String amountStr = sa.getParamOrDefault("CounterNum", "1");
|
final String amountStr = sa.getParamOrDefault("CounterNum", "1");
|
||||||
final boolean divided = sa.isDividedAsYouChoose();
|
final boolean divided = sa.isDividedAsYouChoose();
|
||||||
final int amount = AbilityUtils.calculateAmount(source, amountStr, sa);
|
final int amount = AbilityUtils.calculateAmount(source, amountStr, sa);
|
||||||
int left = amount;
|
int left = amount;
|
||||||
|
final String[] types;
|
||||||
|
if (sa.hasParam("CounterType")) {
|
||||||
|
// TODO some cards let you choose types, should check each
|
||||||
|
types = sa.getParam("CounterType").split(",");
|
||||||
|
} else {
|
||||||
|
// all types will be added
|
||||||
|
types = sa.getParam("CounterTypes").split(",");
|
||||||
|
}
|
||||||
|
final String type = types[0];
|
||||||
|
|
||||||
if (!sa.usesTargeting()) {
|
if (!sa.usesTargeting()) {
|
||||||
// No target. So must be defined
|
// No target. So must be defined
|
||||||
|
|||||||
Reference in New Issue
Block a user