mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 10:18:01 +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()) {
|
||||
|
||||
@@ -2,7 +2,7 @@ Name:Jhoira of the Ghitu Avatar
|
||||
ManaCost:no cost
|
||||
Types:Vanguard
|
||||
HandLifeModifier:+1/+0
|
||||
A:AB$ Play | Cost$ 3 Discard<1/Card> | ActivationZone$ Command | AnySupportedCard$ Instant | RandomCopied$ True | RandomNum$ 3 | ChoiceNum$ 1 | CopyCard$ True | WithoutManaCost$ True | AILogic$ JhoiraAvatarInstant | SpellDescription$ Copy three instant cards chosen at random. You may cast one of the copies without paying its mana cost.
|
||||
A:AB$ Play | Cost$ 3 Discard<1/Card> | ActivationZone$ Command | AnySupportedCard$ Instant | RandomCopied$ True | RandomNum$ 3 | ChoiceNum$ 1 | CopyCard$ True | WithoutManaCost$ True | SpellDescription$ Copy three instant cards chosen at random. You may cast one of the copies without paying its mana cost.
|
||||
A:AB$ Play | Cost$ 3 Discard<1/Card> | ActivationZone$ Command | AnySupportedCard$ Sorcery | RandomCopied$ True | RandomNum$ 3 | ChoiceNum$ 1 | CopyCard$ True | WithoutManaCost$ True | SorcerySpeed$ True | SpellDescription$ Copy three sorcery cards chosen at random. You may cast one of the copies without paying its mana cost. Activate this ability only any time you could cast a sorcery.
|
||||
SVar:Picture:https://downloads.cardforge.org/images/cards/VAN/Jhoira of the Ghitu Avatar.full.jpg
|
||||
Oracle:Hand +1, life +0\n{3}, Discard a card: Copy three instant cards chosen at random. You may cast one of the copies without paying its mana cost.\n{3}, Discard a card: Copy three sorcery cards chosen at random. You may cast one of the copies without paying its mana cost. Activate this ability only any time you could cast a sorcery.
|
||||
|
||||
Reference in New Issue
Block a user