mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 10:18:01 +00:00
Update CharmEffect.java
@TRT please check further, just added NPE check so it will not crash
This commit is contained in:
@@ -65,10 +65,12 @@ public class CharmEffect extends SpellAbilityEffect {
|
|||||||
// using getCardForUi game is not set, so can't guess max charm
|
// using getCardForUi game is not set, so can't guess max charm
|
||||||
num = Integer.MAX_VALUE;
|
num = Integer.MAX_VALUE;
|
||||||
} else {
|
} else {
|
||||||
// fallback needed while ability building
|
// fallback needed while ability building @TRT please check why it broke CharmEffect without using try-catch
|
||||||
|
try {
|
||||||
if (sa.getActivatingPlayer() == null) {
|
if (sa.getActivatingPlayer() == null) {
|
||||||
sa.setActivatingPlayer(source.getController());
|
sa.setActivatingPlayer(source.getController());
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {}
|
||||||
num = Math.min(AbilityUtils.calculateAmount(source, sa.getParamOrDefault("CharmNum", "1"), sa), list.size());
|
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;
|
final int min = sa.hasParam("MinCharmNum") ? AbilityUtils.calculateAmount(source, sa.getParam("MinCharmNum"), sa) : num;
|
||||||
|
|||||||
Reference in New Issue
Block a user