mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28: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";
|
final String xSvar = card.getSVar("X").startsWith("Count$xPaid") ? "PayX" : "X";
|
||||||
if (!sa.getSVar(xSvar).isEmpty() || card.hasSVar(xSvar)) {
|
if (!sa.getSVar(xSvar).isEmpty() || card.hasSVar(xSvar)) {
|
||||||
if (xSvar.equals("PayX") && 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 {
|
} else {
|
||||||
manaToAdd = AbilityUtils.calculateAmount(card, xSvar, sa) * cost.getXcounter();
|
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
|
// In MoJhoSto, prefer Jhoira sorcery ability from time to time
|
||||||
if (source.getGame().getRules().hasAppliedVariant(GameType.MoJhoSto)
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,16 +54,16 @@ public class PlayAi extends SpellAbilityAi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("ReplaySpell".equals(logic)) {
|
if (game.getRules().hasAppliedVariant(GameType.MoJhoSto) && source.getName().equals("Jhoira of the Ghitu Avatar")) {
|
||||||
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
|
// 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
|
// Can probably be improved, but as random as MoJhoSto already is, probably not a huge deal for now
|
||||||
if (MyRandom.percentTrue(80)) {
|
if ("Instant".equals(sa.getParam("AnySupportedCard")) && MyRandom.percentTrue(80)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ("ReplaySpell".equals(logic)) {
|
||||||
|
return ComputerUtil.targetPlayableSpellCard(ai, cards, sa, sa.hasParam("WithoutManaCost"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (source != null && source.hasKeyword("Hideaway") && source.hasRemembered()) {
|
if (source != null && source.hasKeyword("Hideaway") && source.hasRemembered()) {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ Name:Jhoira of the Ghitu Avatar
|
|||||||
ManaCost:no cost
|
ManaCost:no cost
|
||||||
Types:Vanguard
|
Types:Vanguard
|
||||||
HandLifeModifier:+1/+0
|
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.
|
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
|
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.
|
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