mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
- Some improvements to the Jhoira AI algorithm in MoJhoSto: don't rely on an AI logic (since it's mode-specific).
- Fixed a crash related to the AI playing MoJhoSto.
This commit is contained in:
@@ -1115,7 +1115,9 @@ public class ComputerUtilMana {
|
||||
final String xSvar = card.getSVar("X").startsWith("Count$xPaid") ? "PayX" : "X";
|
||||
if (!sa.getSVar(xSvar).isEmpty() || card.hasSVar(xSvar)) {
|
||||
if (xSvar.equals("PayX") && card.hasSVar(xSvar)) {
|
||||
manaToAdd = Integer.parseInt(card.getSVar(xSvar)) * cost.getXcounter(); // X
|
||||
// X SVar may end up being an empty string when copying a spell with no cost (e.g. Jhoira Avatar)
|
||||
String xValue = card.getSVar(xSvar);
|
||||
manaToAdd = xValue.isEmpty() ? 0 : Integer.parseInt(card.getSVar(xSvar)) * cost.getXcounter(); // X
|
||||
} else {
|
||||
manaToAdd = AbilityUtils.calculateAmount(card, xSvar, sa) * cost.getXcounter();
|
||||
}
|
||||
|
||||
@@ -783,7 +783,8 @@ public class SpecialCardAi {
|
||||
|
||||
// In MoJhoSto, prefer Jhoira sorcery ability from time to time
|
||||
if (source.getGame().getRules().hasAppliedVariant(GameType.MoJhoSto)
|
||||
&& ai.getLandsInPlay().size() >= 3 && MyRandom.percentTrue(50)) {
|
||||
&& CardLists.filter(ai.getLandsInPlay(), CardPredicates.Presets.UNTAPPED).size() >= 3
|
||||
&& MyRandom.percentTrue(50)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,17 +53,17 @@ public class PlayAi extends SpellAbilityAi {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (game.getRules().hasAppliedVariant(GameType.MoJhoSto) && source.getName().equals("Jhoira of the Ghitu Avatar")) {
|
||||
// Some additional logic for MoJhoSto: don't spam activate the Instant copying ability all the time
|
||||
// Can probably be improved, but as random as MoJhoSto already is, probably not a huge deal for now
|
||||
if ("Instant".equals(sa.getParam("AnySupportedCard")) && MyRandom.percentTrue(80)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ("ReplaySpell".equals(logic)) {
|
||||
return ComputerUtil.targetPlayableSpellCard(ai, cards, sa, sa.hasParam("WithoutManaCost"));
|
||||
} else if ("JhoiraAvatarInstant".equals(logic)) {
|
||||
if (game.getRules().hasAppliedVariant(GameType.MoJhoSto)) {
|
||||
// Some additional logic for MoJhoSto: don't spam activate the Instant copying ability all the time
|
||||
// Can probably be improved, but as random as MoJhoSto already is, probably not a huge deal for now
|
||||
if (MyRandom.percentTrue(80)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (source != null && source.hasKeyword("Hideaway") && source.hasRemembered()) {
|
||||
|
||||
Reference in New Issue
Block a user