mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Fix NPE when trying to build Charm description
This commit is contained in:
@@ -26,7 +26,7 @@ public class CharmAi extends SpellAbilityAi {
|
||||
@Override
|
||||
protected boolean checkApiLogic(Player ai, SpellAbility sa) {
|
||||
final Card source = sa.getHostCard();
|
||||
List<AbilitySub> choices = CharmEffect.makePossibleOptions(sa);
|
||||
List<AbilitySub> choices = CharmEffect.makePossibleOptions(sa, false);
|
||||
|
||||
final int num;
|
||||
final int min;
|
||||
|
||||
@@ -20,7 +20,7 @@ import forge.util.collect.FCollection;
|
||||
|
||||
public class CharmEffect extends SpellAbilityEffect {
|
||||
|
||||
public static List<AbilitySub> makePossibleOptions(final SpellAbility sa) {
|
||||
public static List<AbilitySub> makePossibleOptions(final SpellAbility sa, boolean forDesc) {
|
||||
final Card source = sa.getHostCard();
|
||||
List<String> restriction = null;
|
||||
|
||||
@@ -29,6 +29,8 @@ public class CharmEffect extends SpellAbilityEffect {
|
||||
}
|
||||
|
||||
List<AbilitySub> choices = Lists.newArrayList(sa.getAdditionalAbilityList("Choices"));
|
||||
|
||||
if (!forDesc) {
|
||||
List<AbilitySub> toRemove = Lists.newArrayList();
|
||||
for (AbilitySub ch : choices) {
|
||||
// 603.3c If one of the modes would be illegal, that mode can't be chosen.
|
||||
@@ -39,6 +41,7 @@ public class CharmEffect extends SpellAbilityEffect {
|
||||
}
|
||||
}
|
||||
choices.removeAll(toRemove);
|
||||
}
|
||||
|
||||
int indx = 0;
|
||||
// set CharmOrder
|
||||
@@ -52,7 +55,7 @@ public class CharmEffect extends SpellAbilityEffect {
|
||||
public static String makeFormatedDescription(SpellAbility sa) {
|
||||
Card source = sa.getHostCard();
|
||||
|
||||
List<AbilitySub> list = CharmEffect.makePossibleOptions(sa);
|
||||
List<AbilitySub> list = CharmEffect.makePossibleOptions(sa, true);
|
||||
final int num;
|
||||
boolean additionalDesc = sa.hasParam("AdditionalDescription");
|
||||
boolean optional = sa.hasParam("Optional");
|
||||
@@ -166,7 +169,7 @@ public class CharmEffect extends SpellAbilityEffect {
|
||||
//this resets all previous choices
|
||||
sa.setSubAbility(null);
|
||||
|
||||
List<AbilitySub> choices = makePossibleOptions(sa);
|
||||
List<AbilitySub> choices = makePossibleOptions(sa, false);
|
||||
|
||||
// Entwine does use all Choices
|
||||
if (sa.isEntwine()) {
|
||||
|
||||
Reference in New Issue
Block a user