mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
- Fixed possible NPE in checkETBEffects caused by getPossibleETBCounters.
This commit is contained in:
@@ -387,15 +387,11 @@ public class SpellPermanent extends Spell {
|
|||||||
return super.canPlayAI();
|
return super.canPlayAI();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean checkETBEffects(final Card card, final SpellAbility sa, final ApiType api) {
|
|
||||||
return checkETBEffects(card, sa, api, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean checkETBEffects(final Card card, final AIPlayer ai) {
|
public static boolean checkETBEffects(final Card card, final AIPlayer ai) {
|
||||||
return checkETBEffects(card, null, null, ai);
|
return checkETBEffects(card, null, null, ai);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean checkETBEffects(final Card card, final SpellAbility sa, final ApiType api, final AIPlayer ai) {
|
public static boolean checkETBEffects(final Card card, final SpellAbility sa, final ApiType api, final AIPlayer ai) {
|
||||||
boolean rightapi = false;
|
boolean rightapi = false;
|
||||||
|
|
||||||
if (card.isCreature()
|
if (card.isCreature()
|
||||||
|
|||||||
@@ -145,11 +145,8 @@ public class AiController {
|
|||||||
for (final Card c : all) {
|
for (final Card c : all) {
|
||||||
for (final SpellAbility sa : c.getNonManaSpellAbilities()) {
|
for (final SpellAbility sa : c.getNonManaSpellAbilities()) {
|
||||||
if (sa instanceof SpellPermanent) {
|
if (sa instanceof SpellPermanent) {
|
||||||
// TODO ArsenalNut (13 Oct 2012) added line to set activating player to fix NPE problem
|
|
||||||
// in checkETBEffects. There is SpellPermanent.checkETBEffects where the player can be
|
|
||||||
// directly input but it is currently a private method.
|
|
||||||
sa.setActivatingPlayer(player);
|
sa.setActivatingPlayer(player);
|
||||||
if (SpellPermanent.checkETBEffects(c, sa, ApiType.Counter)) {
|
if (SpellPermanent.checkETBEffects(c, sa, ApiType.Counter, player)) {
|
||||||
spellAbilities.add(sa);
|
spellAbilities.add(sa);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user