- Basic logic for Professor Onyx.

This commit is contained in:
Michael Kamensky
2021-03-26 14:38:10 +03:00
parent a4d28b13ef
commit 6d00a26530
2 changed files with 11 additions and 4 deletions

View File

@@ -1102,6 +1102,8 @@ public class AiController {
}
public CardCollection getCardsToDiscard(int min, final int max, final CardCollection validCards, final SpellAbility sa) {
String logic = sa.getParamOrDefault("AILogic", "");
if (validCards.size() < min) {
return null;
}
@@ -1111,11 +1113,16 @@ public class AiController {
int count = 0;
if (sa != null) {
sourceCard = sa.getHostCard();
if ("Always".equals(sa.getParam("AILogic")) && !validCards.isEmpty()) {
if ("Always".equals(logic) && !validCards.isEmpty()) {
min = 1;
} else if ("VolrathsShapeshifter".equals(sa.getParam("AILogic"))) {
} else if (logic.startsWith("UnlessAtLife.")) {
int threshold = AbilityUtils.calculateAmount(sourceCard, logic.substring(logic.indexOf(".") + 1), sa);
if (player.getLife() <= threshold) {
min = 1;
}
} else if ("VolrathsShapeshifter".equals(logic)) {
return SpecialCardAi.VolrathsShapeshifter.targetBestCreature(player, sa);
} else if ("DiscardCMCX".equals(sa.getParam("AILogic"))) {
} else if ("DiscardCMCX".equals(logic)) {
final int cmc = sa.getXManaCostPaid();
CardCollection discards = CardLists.filter(player.getCardsIn(ZoneType.Hand), CardPredicates.hasCMC(cmc));
if (discards.isEmpty()) {

View File

@@ -13,7 +13,7 @@ SVar:DBChooseCard:DB$ ChooseCard | Defined$ Player.IsRemembered | Choices$ Creat
SVar:DBSac:DB$ SacrificeAll | ValidCards$ Card.IsRemembered | SubAbility$ DBCleanup | StackDescription$ Each opponent sacrifices a creature with the greatest power among creatures they control.
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True | ClearChosen$ True
A:AB$ Repeat | Cost$ SubCounter<8/LOYALTY> | Planeswalker$ True | Ultimate$ True | RepeatSubAbility$ TrigDiscard | MaxRepeat$ 7 | StackDescription$ SpellDescription | SpellDescription$ Each opponent may discard a card. If they don't, they lose 3 life. Repeat this process six more times.
SVar:TrigDiscard:DB$ Discard | Defined$ Player.Opponent | Mode$ TgtChoose | Optional$ True | RememberDiscardingPlayers$ True | SubAbility$ DBLoseLife
SVar:TrigDiscard:DB$ Discard | Defined$ Player.Opponent | Mode$ TgtChoose | Optional$ True | RememberDiscardingPlayers$ True | AILogic$ UnlessAtLife.6 | SubAbility$ DBLoseLife
SVar:DBLoseLife:DB$ LoseLife | Defined$ Opponent.IsNotRemembered | LifeAmount$ 3 | SubAbility$ DBCleanup
DeckHints:Type$Instant|Sorcery
DeckHas:Ability$Graveyard & Ability$LifeGain