mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
- Fixed the AI targeting nonland permanents with no activated abilities with effects like Detain.
This commit is contained in:
@@ -3,6 +3,7 @@ package forge.ai.ability;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.google.common.base.Predicates;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
@@ -461,6 +462,22 @@ public class PumpAi extends PumpAiBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Detain and similar effects: don't target noncreature permanents that don't have
|
||||||
|
// any activated abilities.
|
||||||
|
if ("HIDDEN CARDNAME can't attack or block. & HIDDEN CARDNAME's activated abilities can't be activated.".equals(sa.getParam("KW"))) {
|
||||||
|
list = CardLists.filter(list, Predicates.or(CardPredicates.Presets.CREATURES, new Predicate<Card>() {
|
||||||
|
@Override
|
||||||
|
public boolean apply(Card card) {
|
||||||
|
for (SpellAbility sa: card.getSpellAbilities()) {
|
||||||
|
if (sa.isAbility()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
if (list.isEmpty()) {
|
if (list.isEmpty()) {
|
||||||
if (ComputerUtil.activateForCost(sa, ai)) {
|
if (ComputerUtil.activateForCost(sa, ai)) {
|
||||||
return pumpMandatoryTarget(ai, sa);
|
return pumpMandatoryTarget(ai, sa);
|
||||||
|
|||||||
Reference in New Issue
Block a user