Fix Bargaining Table (#1727)

This commit is contained in:
tool4ever
2022-10-22 14:10:39 +02:00
committed by GitHub
parent b4c0c517e7
commit ae255a8e8f
9 changed files with 45 additions and 33 deletions

View File

@@ -1086,7 +1086,7 @@ public class AiController {
if (source.hasSVar("AIPriorityModifier")) {
p += Integer.parseInt(source.getSVar("AIPriorityModifier"));
}
if (ComputerUtilCard.isCardRemAIDeck(source)) {
if (ComputerUtilCard.isCardRemAIDeck(sa.getOriginalHost() != null ? sa.getOriginalHost() : source)) {
p -= 10;
}
// don't play equipments before having any creatures
@@ -1955,6 +1955,22 @@ public class AiController {
return max;
}
public int chooseNumber(SpellAbility sa, String title, List<Integer> options, Player relatedPlayer) {
switch(sa.getApi())
{
case SetLife: // Reverse the Sands
if (relatedPlayer.equals(sa.getHostCard().getController())) {
return Collections.max(options);
} else if (relatedPlayer.isOpponentOf(sa.getHostCard().getController())) {
return Collections.min(options);
} else {
return options.get(0);
}
default:
return options.get(0);
}
}
public boolean confirmPayment(CostPart costPart) {
throw new UnsupportedOperationException("AI is not supposed to reach this code at the moment");
}
@@ -2120,22 +2136,6 @@ public class AiController {
return library;
} // smoothComputerManaCurve()
public int chooseNumber(SpellAbility sa, String title, List<Integer> options, Player relatedPlayer) {
switch(sa.getApi())
{
case SetLife: // Reverse the Sands
if (relatedPlayer.equals(sa.getHostCard().getController())) {
return Collections.max(options);
} else if (relatedPlayer.isOpponentOf(sa.getHostCard().getController())) {
return Collections.min(options);
} else {
return options.get(0);
}
default:
return 0;
}
}
public boolean chooseDirection(SpellAbility sa) {
if (sa == null || sa.getApi() == null) {
throw new UnsupportedOperationException();

View File

@@ -591,11 +591,6 @@ public class PlayerControllerAi extends PlayerController {
return ComputerUtil.vote(player, options, sa, votes, forPlayer);
}
@Override
public boolean confirmReplacementEffect(ReplacementEffect replacementEffect, SpellAbility effectSA, GameEntity affected, String question) {
return brains.aiShouldRun(replacementEffect, effectSA, affected);
}
@Override
public boolean mulliganKeepHand(Player firstPlayer, int cardsToReturn) {
return !ComputerUtil.wantMulligan(player, cardsToReturn);
@@ -1012,6 +1007,11 @@ public class PlayerControllerAi extends PlayerController {
return brains.confirmPayment(costPart); // AI is expected to know what it is paying for at the moment (otherwise add another parameter to this method)
}
@Override
public boolean confirmReplacementEffect(ReplacementEffect replacementEffect, SpellAbility effectSA, GameEntity affected, String question) {
return brains.aiShouldRun(replacementEffect, effectSA, affected);
}
@Override
public ReplacementEffect chooseSingleReplacementEffect(String prompt, List<ReplacementEffect> possibleReplacers) {
return brains.chooseSingleReplacementEffect(possibleReplacers);