Some fixes (#1911)

This commit is contained in:
tool4ever
2022-11-16 21:55:43 +01:00
committed by GitHub
parent e8391525e0
commit 3728e926cc
9 changed files with 8 additions and 12 deletions

View File

@@ -22,7 +22,6 @@ import forge.game.phase.PhaseType;
import forge.game.player.Player;
import forge.game.spellability.Spell;
import forge.game.spellability.SpellAbility;
import forge.game.trigger.WrappedAbility;
import forge.game.zone.ZoneType;
import forge.util.MyRandom;
import forge.util.TextUtil;
@@ -594,7 +593,7 @@ public class ComputerUtilCost {
}
// Ward - will be accounted for when rechecking a targeted ability
if (!(sa instanceof WrappedAbility) && sa.usesTargeting() && !cannotBeCountered) {
if (!sa.isTrigger() && sa.usesTargeting() && (!sa.isSpell() || !cannotBeCountered)) {
for (Card tgt : sa.getTargets().getTargetCards()) {
if (tgt.hasKeyword(Keyword.WARD) && tgt.isInPlay() && tgt.getController().isOpponentOf(sa.getHostCard().getController())) {
Cost wardCost = ComputerUtilCard.getTotalWardCost(tgt);
@@ -797,7 +796,7 @@ public class ComputerUtilCost {
if (ApiType.Counter.equals(sa.getApi())) {
List<SpellAbility> spells = AbilityUtils.getDefinedSpellAbilities(source, sa.getParamOrDefault("Defined", "Targeted"), sa);
for (SpellAbility toBeCountered : spells) {
if (sa.isSpell() && !CardFactoryUtil.isCounterable(toBeCountered.getHostCard())) {
if (toBeCountered.isSpell() && !CardFactoryUtil.isCounterable(toBeCountered.getHostCard())) {
return false;
}
// TODO check hasFizzled

View File

@@ -1406,8 +1406,7 @@ public class ComputerUtilMana {
public static int getAvailableManaEstimate(final Player p, final boolean checkPlayable) {
int availableMana = 0;
final CardCollectionView list = new CardCollection(p.getCardsIn(ZoneType.Battlefield));
final List<Card> srcs = CardLists.filter(list, new Predicate<Card>() {
final List<Card> srcs = CardLists.filter(p.getCardsIn(ZoneType.Battlefield), new Predicate<Card>() {
@Override
public boolean apply(final Card c) {
return !c.getManaAbilities().isEmpty();

View File

@@ -260,7 +260,7 @@ public class PumpAi extends PumpAiBase {
// Donate step 1 - try to target an opponent, preferably one who does not have a donate target yet
return SpecialCardAi.Donate.considerTargetingOpponent(ai, sa);
} else if (aiLogic.equals("InfernoOfTheStarMounts")) {
int numRedMana = ComputerUtilMana.determineLeftoverMana(sa, ai, "R", false);
int numRedMana = ComputerUtilMana.determineLeftoverMana(new SpellAbility.EmptySa(source), ai, "R", false);
int currentPower = source.getNetPower();
if (currentPower < 20 && currentPower + numRedMana >= 20) {
return true;