mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
Merge branch 'npefix' into 'master'
Fix Charm NPE See merge request core-developers/forge!6487
This commit is contained in:
@@ -34,7 +34,7 @@ public class CharmAi extends SpellAbilityAi {
|
||||
num = min = choices.size();
|
||||
} else {
|
||||
num = AbilityUtils.calculateAmount(source, sa.getParamOrDefault("CharmNum", "1"), sa);
|
||||
min = sa.hasParam("MinCharmNum") ? AbilityUtils.calculateAmount(source, sa.getParamOrDefault("MinCharmNum", "1"), sa) : num;
|
||||
min = sa.hasParam("MinCharmNum") ? AbilityUtils.calculateAmount(source, sa.getParam("MinCharmNum"), sa) : num;
|
||||
}
|
||||
|
||||
boolean timingRight = sa.isTrigger(); //is there a reason to play the charm now?
|
||||
|
||||
@@ -167,16 +167,17 @@ public class CharmEffect extends SpellAbilityEffect {
|
||||
return true;
|
||||
}
|
||||
|
||||
Card source = sa.getHostCard();
|
||||
Player activator = sa.getActivatingPlayer();
|
||||
final Card source = sa.getHostCard();
|
||||
final Player activator = sa.getActivatingPlayer();
|
||||
|
||||
final int num = Math.min(AbilityUtils.calculateAmount(source, sa.getParamOrDefault("CharmNum", "1"), sa), choices.size());
|
||||
final int min = sa.hasParam("MinCharmNum") ? AbilityUtils.calculateAmount(source, sa.getParamOrDefault("MinCharmNum", "1"), sa) : num;
|
||||
int num = AbilityUtils.calculateAmount(source, sa.getParamOrDefault("CharmNum", "1"), sa);
|
||||
final int min = sa.hasParam("MinCharmNum") ? AbilityUtils.calculateAmount(source, sa.getParam("MinCharmNum"), sa) : num;
|
||||
|
||||
// if the amount of choices is smaller than min then they can't be chosen
|
||||
if (min > choices.size()) {
|
||||
return false;
|
||||
}
|
||||
num = Math.min(num, choices.size());
|
||||
|
||||
boolean isOptional = sa.hasParam("Optional");
|
||||
if (isOptional && !activator.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblWouldYouLikeCharm", CardTranslation.getTranslatedName(source.getName())))) {
|
||||
|
||||
Reference in New Issue
Block a user