Merge branch 'misfortune' into 'master'

CMR: Wheel of Misfortune and support

See merge request core-developers/forge!3392
This commit is contained in:
Michael Kamensky
2020-11-14 03:59:45 +00:00
4 changed files with 30 additions and 1 deletions

View File

@@ -1762,6 +1762,8 @@ public class AiController {
return Math.max(remaining, min) / 2; return Math.max(remaining, min) / 2;
} else if ("LowestLoseLife".equals(logic)) { } else if ("LowestLoseLife".equals(logic)) {
return MyRandom.getRandom().nextInt(Math.min(player.getLife() / 3, player.getWeakestOpponent().getLife())) + 1; return MyRandom.getRandom().nextInt(Math.min(player.getLife() / 3, player.getWeakestOpponent().getLife())) + 1;
} else if ("HighestLoseLife".equals(logic)) {
return MyRandom.getRandom().nextInt(Math.max(player.getLife() / 3, player.getWeakestOpponent().getLife())) + 1;
} else if ("HighestGetCounter".equals(logic)) { } else if ("HighestGetCounter".equals(logic)) {
return MyRandom.getRandom().nextInt(3); return MyRandom.getRandom().nextInt(3);
} else if (source.hasSVar("EnergyToPay")) { } else if (source.hasSVar("EnergyToPay")) {

View File

@@ -46,7 +46,7 @@ public final class AbilityFactory {
static final List<String> additionalAbilityKeys = Lists.newArrayList( static final List<String> additionalAbilityKeys = Lists.newArrayList(
"WinSubAbility", "OtherwiseSubAbility", // Clash "WinSubAbility", "OtherwiseSubAbility", // Clash
"ChooseNumberSubAbility", "Lowest", "Highest", // ChooseNumber "ChooseNumberSubAbility", "Lowest", "Highest", "NotLowest", // ChooseNumber
"HeadsSubAbility", "TailsSubAbility", "LoseSubAbility", // FlipCoin "HeadsSubAbility", "TailsSubAbility", "LoseSubAbility", // FlipCoin
"TrueSubAbility", "FalseSubAbility", // Branch "TrueSubAbility", "FalseSubAbility", // Branch
"ChosenPile", "UnchosenPile", // MultiplePiles & TwoPiles "ChosenPile", "UnchosenPile", // MultiplePiles & TwoPiles

View File

@@ -125,6 +125,23 @@ public class ChooseNumberEffect extends SpellAbilityEffect {
card.clearRemembered(); card.clearRemembered();
} }
} }
if (sa.hasParam("NotLowest")) {
List<Player> notLowestNum = Lists.newArrayList();
for (Player p : chooseMap.keySet()) {
if (!lowestNum.contains(p)) {
notLowestNum.add(p);
}
}
AbilitySub sub = sa.getAdditionalAbility("NotLowest");
for (Player p : notLowestNum) {
card.addRemembered(p);
AbilityUtils.resolve(sub);
card.clearRemembered();
}
}
if (sa.hasParam("Highest")) { if (sa.hasParam("Highest")) {
AbilitySub sub = sa.getAdditionalAbility("Highest"); AbilitySub sub = sa.getAdditionalAbility("Highest");

View File

@@ -0,0 +1,10 @@
Name:Wheel of Misfortune
ManaCost:2 R
Types:Sorcery
A:SP$ ChooseNumber | Cost$ 2 R | Defined$ Player | SecretlyChoose$ True | Highest$ DBLoseLife | NotLowest$ DBDiscard | AILogic$ HighestLoseLife | StackDescription$ SpellDescription | SpellDescription$ Each player secretly chooses a number 0 or greater, then all players reveal those numbers simultaneously and determine the highest and lowest numbers revealed this way. CARDNAME deals damage equal to the highest number to each player who chose that number. Each player who didnt choose the lowest number discards their hand, then draws seven cards.
SVar:DBLoseLife:DB$ DealDamage | Defined$ Remembered | References$ X | NumDmg$ X
SVar:X:Count$ChosenNumber
SVar:DBDiscard:DB$ Discard | Defined$ Player.IsRemembered | Mode$ Hand | SubAbility$ DBDraw
SVar:DBDraw:DB$ Draw | Defined$ Remembered | NumCards$ 7
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
Oracle:Each player secretly chooses a number 0 or greater, then all players reveal those numbers simultaneously and determine the highest and lowest numbers revealed this way. Wheel of Misfortune deals damage equal to the highest number to each player who chose that number. Each player who didnt choose the lowest number discards their hand, then draws seven cards.