mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
Fix AI refusing Gilded Drake trigger when no targets
This commit is contained in:
@@ -30,7 +30,7 @@ public class ControlExchangeAi extends SpellAbilityAi {
|
||||
sa.resetTargets();
|
||||
|
||||
CardCollection list =
|
||||
CardLists.getValidCards(AiAttackController.choosePreferredDefenderPlayer(ai).getCardsIn(ZoneType.Battlefield), tgt.getValidTgts(), ai, sa.getHostCard(), sa);
|
||||
CardLists.getValidCards(ai.getOpponents().getCardsIn(ZoneType.Battlefield), tgt.getValidTgts(), ai, sa.getHostCard(), sa);
|
||||
// AI won't try to grab cards that are filtered out of AI decks on purpose
|
||||
list = CardLists.filter(list, new Predicate<Card>() {
|
||||
@Override
|
||||
@@ -65,7 +65,7 @@ public class ControlExchangeAi extends SpellAbilityAi {
|
||||
}
|
||||
} else {
|
||||
if (mandatory) {
|
||||
return chkAIDrawback(sa, aiPlayer);
|
||||
return chkAIDrawback(sa, aiPlayer) || sa.isTargetNumberValid();
|
||||
} else {
|
||||
return canPlayAI(aiPlayer, sa);
|
||||
}
|
||||
@@ -97,8 +97,12 @@ public class ControlExchangeAi extends SpellAbilityAi {
|
||||
|
||||
Card best = ComputerUtilCard.getBestAI(list);
|
||||
|
||||
// add best Target:
|
||||
// do it here already even if we don't want to play this as it might be for targeting a trigger
|
||||
sa.getTargets().add(best);
|
||||
|
||||
// if Param has Defined, check if the best Target is better than the Defined
|
||||
if (sa.hasParam("Defined")) {
|
||||
if (sa.hasParam("Defined") && (!sa.isTrigger() || sa.getRootAbility().isOptionalTrigger())) {
|
||||
final Card object = AbilityUtils.getDefinedCards(sa.getHostCard(), sa.getParam("Defined"), sa).get(0);
|
||||
// TODO add evaluate Land if able
|
||||
final Card realBest = ComputerUtilCard.getBestAI(Lists.newArrayList(best, object));
|
||||
@@ -109,9 +113,6 @@ public class ControlExchangeAi extends SpellAbilityAi {
|
||||
}
|
||||
}
|
||||
|
||||
// add best Target
|
||||
sa.getTargets().add(best);
|
||||
|
||||
// second target needed (the AI's own worst)
|
||||
if ("TrigTwoTargets".equals(sa.getParam("AILogic"))) {
|
||||
return doTrigTwoTargetsLogic(aiPlayer, sa, best);
|
||||
|
||||
@@ -72,7 +72,7 @@ public class DigEffect extends SpellAbilityEffect {
|
||||
int libraryPosition = sa.hasParam("LibraryPosition") ? Integer.parseInt(sa.getParam("LibraryPosition")) : -1;
|
||||
int destZone1ChangeNum = 1;
|
||||
final boolean mitosis = sa.hasParam("Mitosis");
|
||||
String changeValid = sa.hasParam("ChangeValid") ? sa.getParam("ChangeValid") : "";
|
||||
String changeValid = sa.getParamOrDefault("ChangeValid", "");
|
||||
final boolean anyNumber = sa.hasParam("AnyNumber");
|
||||
|
||||
final int libraryPosition2 = sa.hasParam("LibraryPosition2") ? Integer.parseInt(sa.getParam("LibraryPosition2")) : -1;
|
||||
@@ -86,7 +86,7 @@ public class DigEffect extends SpellAbilityEffect {
|
||||
// These parameters are used to indicate that a dialog box must be show to the player asking if the player wants to proceed
|
||||
// with an optional ability, otherwise the optional ability is skipped.
|
||||
final boolean mayBeSkipped = sa.hasParam("PromptToSkipOptionalAbility");
|
||||
final String optionalAbilityPrompt = sa.hasParam("OptionalAbilityPrompt") ? sa.getParam("OptionalAbilityPrompt") : "";
|
||||
final String optionalAbilityPrompt = sa.getParamOrDefault("OptionalAbilityPrompt", "");
|
||||
|
||||
boolean remZone1 = false;
|
||||
boolean remZone2 = false;
|
||||
|
||||
@@ -35,7 +35,7 @@ public class DigMultipleEffect extends SpellAbilityEffect {
|
||||
int libraryPosition = sa.hasParam("LibraryPosition") ? Integer.parseInt(sa.getParam("LibraryPosition")) : -1;
|
||||
final int libraryPosition2 = sa.hasParam("LibraryPosition2") ? Integer.parseInt(sa.getParam("LibraryPosition2")) : -1;
|
||||
|
||||
String changeValid = sa.hasParam("ChangeValid") ? sa.getParam("ChangeValid") : "";
|
||||
String changeValid = sa.getParamOrDefault("ChangeValid", "");
|
||||
boolean chooseOptional = sa.hasParam("Optional");
|
||||
|
||||
CardZoneTable table = new CardZoneTable();
|
||||
|
||||
@@ -102,8 +102,7 @@ public abstract class AchievementCollection implements Iterable<Achievement> {
|
||||
add(new TotalMatchWins(100, 250, 500, 1000));
|
||||
if (isLimitedFormat) { //make need for speed goal more realistic for limited formats
|
||||
add(new NeedForSpeed(8, 6, 4, 2));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
add(new NeedForSpeed(5, 3, 1, 0));
|
||||
}
|
||||
add(new Overkill(-25, -50, -100, -200));
|
||||
@@ -114,8 +113,7 @@ public abstract class AchievementCollection implements Iterable<Achievement> {
|
||||
add(new ManaScrewed());
|
||||
if (isLimitedFormat) { //lower gold and mythic thresholds based on smaller decks
|
||||
add(new ManaFlooded(8, 11, 14, 17));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
add(new ManaFlooded(8, 12, 18, 24));
|
||||
}
|
||||
add(new RagsToRiches());
|
||||
|
||||
Reference in New Issue
Block a user