update ChooseCardAi with "NotSelf" consumable

This commit is contained in:
Northmoc
2022-11-06 14:30:36 -05:00
parent e637a2279b
commit 0c06184da8
2 changed files with 11 additions and 3 deletions

View File

@@ -162,9 +162,17 @@ public class ChooseCardAi extends SpellAbilityAi {
public Card chooseSingleCard(final Player ai, final SpellAbility sa, Iterable<Card> options, boolean isOptional, Player targetedPlayer, Map<String, Object> params) {
final Card host = sa.getHostCard();
final Player ctrl = host.getController();
final String logic = sa.getParam("AILogic");
String logic = sa.getParamOrDefault("AILogic", "");
if (logic.contains("NotSelf")) {
CardCollection opt = (CardCollection) options;
if (opt.contains(host)) {
opt.remove(host);
}
options = opt;
logic = logic.replace("NotSelf", "");
}
Card choice = null;
if (logic == null) {
if (logic.equals("")) {
// Base Logic is choose "best"
choice = ComputerUtilCard.getBestAI(options);
} else if ("WorstCard".equals(logic)) {

View File

@@ -4,7 +4,7 @@ Types:Creature Human Wizard
PT:3/4
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigRepeatEach | TriggerDescription$ When CARDNAME enters the battlefield, starting with you, each player chooses up to five permanents they control. All permanents other than CARDNAME that weren't chosen this way phase out.
SVar:TrigRepeatEach:DB$ RepeatEach | RepeatPlayers$ Player | StartingWithActivator$ True | RepeatSubAbility$ DBChoosePermanent | SubAbility$ DBPhaseOut
SVar:DBChoosePermanent:DB$ ChooseCard | ChoiceTitle$ Choose up to five permanents you control | MinAmount$ 0 | Amount$ 5 | Defined$ Remembered | Choices$ Permanent.RememberedPlayerCtrl | RememberChosen$ True | AILogic$ BestCard
SVar:DBChoosePermanent:DB$ ChooseCard | ChoiceTitle$ Choose up to five permanents you control | MinAmount$ 0 | Amount$ 5 | Defined$ Remembered | Choices$ Permanent.RememberedPlayerCtrl | RememberChosen$ True | AILogic$ NotSelf
SVar:DBPhaseOut:DB$ Phases | AllValid$ Permanent.Other+IsNotRemembered | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearChosenCard$ True | ClearRemembered$ True
S:Mode$ CantPhaseIn | ValidCard$ Permanent | Description$ Permanents can't phase in.