mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
Reduce FailedToTarget scenario
This commit is contained in:
@@ -313,7 +313,6 @@ public class AiController {
|
||||
// need to set TriggeredObject
|
||||
exSA.setTriggeringObject(AbilityKey.Card, card);
|
||||
|
||||
|
||||
// for trigger test, need to ignore the conditions
|
||||
SpellAbilityCondition cons = exSA.getConditions();
|
||||
if (cons != null) {
|
||||
|
||||
@@ -162,7 +162,7 @@ public abstract class SpellAbilityAi {
|
||||
if (ComputerUtil.preventRunAwayActivations(sa)) {
|
||||
return false; // prevent infinite loop
|
||||
}
|
||||
return MyRandom.getRandom().nextFloat() < .8f; // random success
|
||||
return MyRandom.getRandom().nextFloat() < .8f; // random success
|
||||
}
|
||||
|
||||
public final boolean doTriggerAI(final Player aiPlayer, final SpellAbility sa, final boolean mandatory) {
|
||||
@@ -193,7 +193,7 @@ public abstract class SpellAbilityAi {
|
||||
* Handles the AI decision to play a triggered SpellAbility
|
||||
*/
|
||||
protected boolean doTriggerAINoCost(final Player aiPlayer, final SpellAbility sa, final boolean mandatory) {
|
||||
if (canPlayWithoutRestrict(aiPlayer, sa)) {
|
||||
if (canPlayWithoutRestrict(aiPlayer, sa) && (!mandatory || sa.isTargetNumberValid())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -400,7 +400,6 @@ public class PumpAi extends PumpAiBase {
|
||||
if (ComputerUtilCard.shouldPumpCard(ai, sa, card, defense, attack, keywords, false)) {
|
||||
return true;
|
||||
} else if (containsUsefulKeyword(ai, keywords, card, sa, attack)) {
|
||||
|
||||
Card pumped = ComputerUtilCard.getPumpedCreature(ai, sa, card, 0, 0, keywords);
|
||||
if (game.getPhaseHandler().is(PhaseType.COMBAT_DECLARE_ATTACKERS, ai)
|
||||
|| game.getPhaseHandler().is(PhaseType.COMBAT_BEGIN, ai)) {
|
||||
|
||||
@@ -44,7 +44,6 @@ public abstract class PumpAiBase extends SpellAbilityAi {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public boolean grantsUsefulExtraBlockOpts(final Player ai, final SpellAbility sa, final Card card, List<String> keywords) {
|
||||
PhaseHandler ph = ai.getGame().getPhaseHandler();
|
||||
Card pumped = ComputerUtilCard.getPumpedCreature(ai, sa, card, 0, 0, keywords);
|
||||
@@ -506,7 +505,6 @@ public abstract class PumpAiBase extends SpellAbilityAi {
|
||||
else {
|
||||
final boolean addsKeywords = !keywords.isEmpty();
|
||||
if (addsKeywords) {
|
||||
|
||||
// If the keyword can prevent a creature from attacking, see if there's some kind of viable prioritization
|
||||
if (keywords.contains("CARDNAME can't attack.") || keywords.contains("CARDNAME can't attack or block.")
|
||||
|| keywords.contains("HIDDEN CARDNAME can't attack.") || keywords.contains("HIDDEN CARDNAME can't attack or block.")) {
|
||||
|
||||
@@ -151,6 +151,12 @@ public class PumpAllAi extends PumpAiBase {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean doTriggerAINoCost(Player ai, SpellAbility sa, boolean mandatory) {
|
||||
// important to call canPlay first so targets are added if needed
|
||||
return canPlayAI(ai, sa) || mandatory;
|
||||
}
|
||||
|
||||
boolean pumpAgainstRemoval(Player ai, SpellAbility sa, List<Card> comp) {
|
||||
final List<GameObject> objects = ComputerUtil.predictThreatenedObjects(sa.getActivatingPlayer(), sa, true);
|
||||
for (final Card c : comp) {
|
||||
|
||||
@@ -39,6 +39,4 @@ public class TapOrUntapAi extends TapAiBase {
|
||||
return randomReturn;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -244,7 +244,6 @@ public class SpellAbilityCondition extends SpellAbilityVariables {
|
||||
* @return a boolean.
|
||||
*/
|
||||
public final boolean areMet(final SpellAbility sa) {
|
||||
|
||||
Player activator = sa.getActivatingPlayer();
|
||||
if (activator == null) {
|
||||
activator = sa.getHostCard().getController();
|
||||
|
||||
Reference in New Issue
Block a user