Merge pull request #2447 from Agetian/ai-conduitofworlds

Improve AI handling for Conduit of Worlds
This commit is contained in:
Anthony Calosa
2023-02-11 14:43:11 +08:00
committed by GitHub
2 changed files with 10 additions and 2 deletions

View File

@@ -180,13 +180,21 @@ public class PlayAi extends SpellAbilityAi {
// Before accepting, see if the spell has a valid number of targets (it should at this point).
// Proceeding past this point if the spell is not correctly targeted will result
// in "Failed to add to stack" error and the card disappearing from the game completely.
if (!sa.hasParam("WithoutManaCost") && !ComputerUtilCost.canPayCost(spell, ai, true)) {
// if we won't be able to pay the cost, don't choose the card
return false;
}
return spell.isTargetNumberValid();
}
}
return false;
}
});
return ComputerUtilCard.getBestAI(tgtCards);
final Card best = ComputerUtilCard.getBestAI(tgtCards);
if (sa.usesTargeting() && !sa.isTargetNumberValid()) {
sa.getTargets().add(best);
}
return best;
}
private static List<Card> getPlayableCards(SpellAbility sa, Player ai) {

View File

@@ -2,7 +2,7 @@ Name:Conduit of Worlds
ManaCost:2 G G
Types:Artifact
S:Mode$ Continuous | Affected$ Land.YouOwn | MayPlay$ True | AffectedZone$ Graveyard | Description$ You may play lands from your graveyard.
A:AB$ Play | Cost$ T | ValidSA$ Spell | SorcerySpeed$ True | TgtPrompt$ Choose target nonland permanent card in your graveyard | ConditionCheckSVar$ X | ConditionSVarCompare$ EQ0 | TgtZone$ Graveyard | ValidTgts$ Permanent.nonLand+YouOwn | RememberPlayed$ True | Optional$ True | SubAbility$ DBEffect | SpellDescription$ Choose target nonland permanent card in your graveyard. If you haven't cast a spell this turn, you may cast that card. If you do, you can't cast additional spells this turn. Activate only as a sorcery.
A:AB$ Play | Cost$ T | ValidSA$ Spell | SorcerySpeed$ True | TgtPrompt$ Choose target nonland permanent card in your graveyard | ConditionCheckSVar$ X | ConditionSVarCompare$ EQ0 | TgtZone$ Graveyard | ValidTgts$ Permanent.nonLand+YouOwn | RememberPlayed$ True | Optional$ True | SubAbility$ DBEffect | AILogic$ NeedsChosenCard | SpellDescription$ Choose target nonland permanent card in your graveyard. If you haven't cast a spell this turn, you may cast that card. If you do, you can't cast additional spells this turn. Activate only as a sorcery.
SVar:DBEffect:DB$ Effect | Name$ Conduit of Worlds's Effect | ConditionDefined$ Remembered | ConditionPresent$ Card | StaticAbilities$ STCantBeCast | SubAbility$ DBCleanup
SVar:STCantBeCast:Mode$ CantBeCast | EffectZone$ Command | ValidCard$ Card | Caster$ You | Description$ You can't cast additional spells this turn.
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True