mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 03:08:02 +00:00
getTargetableCards: Fix AI NPE
This commit is contained in:
committed by
Hans Mackowiak
parent
5f5357d28a
commit
8e4c40ba2a
@@ -40,10 +40,8 @@ public class PermanentNoncreatureAi extends PermanentAi {
|
|||||||
if (host.hasSVar("OblivionRing")) {
|
if (host.hasSVar("OblivionRing")) {
|
||||||
SpellAbility effectExile = AbilityFactory.getAbility(host.getSVar("TrigExile"), host);
|
SpellAbility effectExile = AbilityFactory.getAbility(host.getSVar("TrigExile"), host);
|
||||||
final ZoneType origin = ZoneType.listValueOf(effectExile.getParam("Origin")).get(0);
|
final ZoneType origin = ZoneType.listValueOf(effectExile.getParam("Origin")).get(0);
|
||||||
final TargetRestrictions tgt = effectExile.getTargetRestrictions();
|
effectExile.setActivatingPlayer(ai);
|
||||||
final CardCollection list = CardLists.getValidCards(game.getCardsIn(origin), tgt.getValidTgts(), ai, host,
|
CardCollection targets = CardLists.getTargetableCards(game.getCardsIn(origin), effectExile);
|
||||||
effectExile);
|
|
||||||
CardCollection targets = CardLists.getTargetableCards(list, sa);
|
|
||||||
if (sourceName.equals("Suspension Field")
|
if (sourceName.equals("Suspension Field")
|
||||||
|| sourceName.equals("Detention Sphere")) {
|
|| sourceName.equals("Detention Sphere")) {
|
||||||
// existing "exile until leaves" enchantments only target
|
// existing "exile until leaves" enchantments only target
|
||||||
|
|||||||
@@ -232,8 +232,8 @@ public class CardLists {
|
|||||||
|
|
||||||
public static CardCollection getTargetableCards(Iterable<Card> cardList, SpellAbility source) {
|
public static CardCollection getTargetableCards(Iterable<Card> cardList, SpellAbility source) {
|
||||||
CardCollection result = CardLists.filter(cardList, CardPredicates.isTargetableBy(source));
|
CardCollection result = CardLists.filter(cardList, CardPredicates.isTargetableBy(source));
|
||||||
// Filter more cards that can only be detected along with other candiates
|
// Filter more cards that can only be detected along with other candidates
|
||||||
if (source.getTargets().isEmpty() && source.getMinTargets() >= 2) {
|
if (source.getTargets().isEmpty() && source.usesTargeting() && source.getMinTargets() >= 2) {
|
||||||
CardCollection removeList = new CardCollection();
|
CardCollection removeList = new CardCollection();
|
||||||
TargetRestrictions tr = source.getTargetRestrictions();
|
TargetRestrictions tr = source.getTargetRestrictions();
|
||||||
for (final Card card : cardList) {
|
for (final Card card : cardList) {
|
||||||
|
|||||||
Reference in New Issue
Block a user