mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
- NPE prevention in ControlGainAi.
This commit is contained in:
@@ -227,6 +227,7 @@ public class ControlGainAi extends SpellAbilityAi {
|
|||||||
t = ComputerUtilCard.getMostExpensivePermanentAI(list, sa, true);
|
t = ComputerUtilCard.getMostExpensivePermanentAI(list, sa, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (t != null) {
|
||||||
if (t.isCreature())
|
if (t.isCreature())
|
||||||
creatures--;
|
creatures--;
|
||||||
if (t.isPlaneswalker())
|
if (t.isPlaneswalker())
|
||||||
@@ -237,6 +238,7 @@ public class ControlGainAi extends SpellAbilityAi {
|
|||||||
artifacts--;
|
artifacts--;
|
||||||
if (t.isEnchantment())
|
if (t.isEnchantment())
|
||||||
enchantments--;
|
enchantments--;
|
||||||
|
}
|
||||||
|
|
||||||
if (!sa.canTarget(t)) {
|
if (!sa.canTarget(t)) {
|
||||||
list.remove(t);
|
list.remove(t);
|
||||||
|
|||||||
@@ -889,6 +889,10 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final boolean canTarget(final GameObject entity) {
|
public final boolean canTarget(final GameObject entity) {
|
||||||
|
if (entity == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
final TargetRestrictions tr = getTargetRestrictions();
|
final TargetRestrictions tr = getTargetRestrictions();
|
||||||
|
|
||||||
// Restriction related to this ability
|
// Restriction related to this ability
|
||||||
|
|||||||
Reference in New Issue
Block a user