NEO: Reckoner Shakedown and BranchEffect upgrade

This commit is contained in:
Tim Mocny
2022-02-18 19:42:44 +00:00
committed by Michael Kamensky
parent 39c49b2315
commit 00ceefa8d9
5 changed files with 42 additions and 12 deletions

View File

@@ -13,18 +13,23 @@ public class BranchEffect extends SpellAbilityEffect {
// TODO Reuse SpellAbilityCondition and areMet() here instead of repeating each // TODO Reuse SpellAbilityCondition and areMet() here instead of repeating each
// For now branch conditions will only be an Svar Compare int value = 0;
String branchSVar = sa.getParam("BranchConditionSVar"); if (sa.hasParam("BranchCondition")) {
if (sa.getParam("BranchCondition").equals("ChosenCard")) {
value = host.getChosenCards().size();
}
} else {
value = AbilityUtils.calculateAmount(host, sa.getParam("BranchConditionSVar"), sa);
}
String branchCompare = sa.getParamOrDefault("BranchConditionSVarCompare", "GE1"); String branchCompare = sa.getParamOrDefault("BranchConditionSVarCompare", "GE1");
String operator = branchCompare.substring(0, 2); String operator = branchCompare.substring(0, 2);
String operand = branchCompare.substring(2); String operand = branchCompare.substring(2);
final int svarValue = AbilityUtils.calculateAmount(host, branchSVar, sa);
final int operandValue = AbilityUtils.calculateAmount(host, operand, sa); final int operandValue = AbilityUtils.calculateAmount(host, operand, sa);
SpellAbility sub = null; SpellAbility sub = null;
if (Expressions.compare(svarValue, operator, operandValue)) { if (Expressions.compare(value, operator, operandValue)) {
sub = sa.getAdditionalAbility("TrueSubAbility"); sub = sa.getAdditionalAbility("TrueSubAbility");
} else { } else {
sub = sa.getAdditionalAbility("FalseSubAbility"); sub = sa.getAdditionalAbility("FalseSubAbility");

View File

@@ -32,11 +32,22 @@ public class ChooseCardEffect extends SpellAbilityEffect {
@Override @Override
protected String getStackDescription(SpellAbility sa) { protected String getStackDescription(SpellAbility sa) {
final StringBuilder sb = new StringBuilder(); final StringBuilder sb = new StringBuilder();
final int numCards = sa.hasParam("Amount") ?
AbilityUtils.calculateAmount(sa.getHostCard(), sa.getParam("Amount"), sa) : 1;
for (final Player p : getTargetPlayers(sa)) { sb.append(Lang.joinHomogenous(getTargetPlayers(sa))).append(" ");
sb.append(p).append(" "); if (sa.hasParam("Mandatory")) {
sb.append(getTargetPlayers(sa).size() == 1 ? "chooses " : "choose ");
} else {
sb.append("may choose ");
} }
sb.append("chooses a card."); String desc = sa.getParamOrDefault("ChoiceDesc", "");
desc = desc.isEmpty() ? "card" : desc + " card";
sb.append(Lang.nounWithNumeralExceptOne(numCards, desc));
if (sa.hasParam("FromDesc")) {
sb.append(" ").append(sa.getParam("FromDesc"));
}
sb.append(".");
return sb.toString(); return sb.toString();
} }

View File

@@ -97,6 +97,7 @@ public class MillEffect extends SpellAbilityEffect {
sb.append("antes "); sb.append("antes ");
} }
sb.append(Lang.nounWithNumeralExceptOne(numCards, "card")).append(".");
sb.append(numCards == 1 ? "a card" : (Lang.getNumeral(numCards) + " cards")).append("."); sb.append(numCards == 1 ? "a card" : (Lang.getNumeral(numCards) + " cards")).append(".");
return sb.toString(); return sb.toString();

View File

@@ -1,10 +1,11 @@
Name:Nightsnare Name:Nightsnare
ManaCost:3 B ManaCost:3 B
Types:Sorcery Types:Sorcery
A:SP$ RevealHand | Cost$ 3 B | ValidTgts$ Opponent | RememberRevealed$ True | SubAbility$ DBChoose | StackDescription$ SpellDescription | SpellDescription$ Target opponent reveals their hand. You may choose a nonland card from it. If you do, that player discards that card. If you don't, that player discards two cards. A:SP$ RevealHand | ValidTgts$ Opponent | RememberRevealed$ True | SubAbility$ DBChoose | SpellDescription$ Target opponent reveals their hand.
SVar:DBChoose:DB$ ChooseCard | ChoiceZone$ Hand | Amount$ 1 | Choices$ Card.nonLand+IsRemembered | SubAbility$ DBDiscard | ChoiceTitle$ You may choose a nonland card | StackDescription$ None SVar:DBChoose:DB$ ChooseCard | ChoiceZone$ Hand | Amount$ 1 | Choices$ Card.nonLand+IsRemembered | ChoiceDesc$ nonland | FromDesc$ from it | SubAbility$ DBBranch | ChoiceTitle$ You may choose a nonland card | SpellDescription$ You may choose a nonland card from it.
SVar:DBDiscard:DB$ Discard | DefinedCards$ ChosenCard | Defined$ Targeted | Mode$ Defined | SubAbility$ DBCleanup | StackDescription$ None | ConditionDefined$ ChosenCard | ConditionPresent$ Card | ConditionCompare$ EQ1 | SubAbility$ DBDiscard2 SVar:DBBranch:DB$ Branch | BranchCondition$ ChosenCard | TrueSubAbility$ DBDiscard | FalseSubAbility$ DBDiscard2 | StackDescription$ If they do, {p:Targeted} discards that card. If they don't, {p:Targeted} discards two cards. | SpellDescription$ If you do, that player discards that card. If you don't, that player discards two cards.
SVar:DBDiscard2:DB$ Discard | Defined$ Targeted | NumCards$ 2 | Mode$ TgtChoose | SubAbility$ DBCleanup | ConditionDefined$ ChosenCard | ConditionPresent$ Card | ConditionCompare$ EQ0 | StackDescription$ None SVar:DBDiscard:DB$ Discard | DefinedCards$ ChosenCard | Defined$ Targeted | Mode$ Defined | SubAbility$ DBCleanup
SVar:DBDiscard2:DB$ Discard | Defined$ Targeted | NumCards$ 2 | Mode$ TgtChoose | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True | ClearChosenCard$ True SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True | ClearChosenCard$ True
AI:RemoveDeck:All DeckHas:Ability$Discard
Oracle:Target opponent reveals their hand. You may choose a nonland card from it. If you do, that player discards that card. If you don't, that player discards two cards. Oracle:Target opponent reveals their hand. You may choose a nonland card from it. If you do, that player discards that card. If you don't, that player discards two cards.

View File

@@ -0,0 +1,12 @@
Name:Reckoner Shakedown
ManaCost:2 B
Types:Sorcery
A:SP$ RevealHand | ValidTgts$ Opponent | TgtPrompt$ Select target opponent | RememberRevealed$ True | SubAbility$ DBChoose | SpellDescription$ Target opponent reveals their hand.
SVar:DBChoose:DB$ ChooseCard | ChoiceZone$ Hand | Amount$ 1 | Choices$ Card.nonLand+IsRemembered | ChoiceDesc$ nonland | FromDesc$ from it | SubAbility$ DBBranch | ChoiceTitle$ You may choose a nonland card | SpellDescription$ You may choose a nonland card from it.
SVar:DBBranch:DB$ Branch | BranchCondition$ ChosenCard | TrueSubAbility$ DBDiscard | FalseSubAbility$ DBPutCounter | StackDescription$ If they do, {p:Targeted} discards that card. If they don't, they put two +1/+1 counters on a creature or Vehicle they control. | SpellDescription$ If you do, that player discards that card. If you don't, put two +1/+1 counters on a creature or Vehicle you control.
SVar:DBDiscard:DB$ Discard | DefinedCards$ ChosenCard | Defined$ Targeted | Mode$ Defined | SubAbility$ DBCleanup
SVar:DBPutCounter:DB$ PutCounter | Choices$ Creature.YouCtrl,Vehicle.YouCtrl | ChoiceTitle$ Choose a creature or Vehicle you control | CounterType$ P1P1 | CounterNum$ 2 | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True | ClearChosenCard$ True
DeckHas:Ability$Discard|Counters
DeckHints:Type$Creature|Vehicle
Oracle:Target opponent reveals their hand. You may choose a nonland card from it. If you do, that player discards that card. If you don't, put two +1/+1 counters on a creature or Vehicle you control.