Update CharmEffect.java

@TRT please check further, just added NPE check so it will not crash
This commit is contained in:
Anthony Calosa
2022-11-23 15:43:48 +08:00
committed by GitHub
parent 5e1b9db4a6
commit 202c440797

View File

@@ -65,10 +65,12 @@ public class CharmEffect extends SpellAbilityEffect {
// using getCardForUi game is not set, so can't guess max charm
num = Integer.MAX_VALUE;
} else {
// fallback needed while ability building
if (sa.getActivatingPlayer() == null) {
sa.setActivatingPlayer(source.getController());
}
// fallback needed while ability building @TRT please check why it broke CharmEffect without using try-catch
try {
if (sa.getActivatingPlayer() == null) {
sa.setActivatingPlayer(source.getController());
}
} catch (Exception e) {}
num = Math.min(AbilityUtils.calculateAmount(source, sa.getParamOrDefault("CharmNum", "1"), sa), list.size());
}
final int min = sa.hasParam("MinCharmNum") ? AbilityUtils.calculateAmount(source, sa.getParam("MinCharmNum"), sa) : num;