mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
Fix Bargaining Table (#1727)
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user