Fix Windfall (#6530)

This commit is contained in:
tool4ever
2024-11-04 11:27:51 +01:00
committed by GitHub
parent fe259dafd2
commit 41a3b24aef
7 changed files with 25 additions and 38 deletions

View File

@@ -56,7 +56,7 @@ public class DrawEffect extends SpellAbilityEffect {
@Override @Override
public void resolve(SpellAbility sa) { public void resolve(SpellAbility sa) {
final Card source = sa.getHostCard(); final Card source = sa.getHostCard();
final int numCards = sa.hasParam("NumCards") ? AbilityUtils.calculateAmount(sa.getHostCard(), sa.getParam("NumCards"), sa) : 1;
final boolean upto = sa.hasParam("Upto"); final boolean upto = sa.hasParam("Upto");
final boolean optional = sa.hasParam("OptionalDecider") || upto; final boolean optional = sa.hasParam("OptionalDecider") || upto;
Map<AbilityKey, Object> moveParams = AbilityKey.newMap(); Map<AbilityKey, Object> moveParams = AbilityKey.newMap();
@@ -70,20 +70,17 @@ public class DrawEffect extends SpellAbilityEffect {
continue; continue;
} }
int numCards = sa.hasParam("NumCards") ? AbilityUtils.calculateAmount(sa.getHostCard(), sa.getParam("NumCards"), sa) : 1; int actualNum = numCards * Collections.frequency(tgts, p);
numCards *= Collections.frequency(tgts, p);
// it is optional, not upto and player can't choose to draw that many cards // it is optional, not upto and player can't choose to draw that many cards
if (optional && !upto && !p.canDrawAmount(numCards)) { if (optional && !upto && !p.canDrawAmount(actualNum)) {
continue; continue;
} }
if (optional && !p.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantDrawCards", Lang.nounWithAmount(numCards, " card")), null)) { if (optional && !p.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantDrawCards", Lang.nounWithAmount(actualNum, " card")), null)) {
continue; continue;
} }
int actualNum = numCards;
if (upto) { // if it is upto, player can only choose how many cards they can draw if (upto) { // if it is upto, player can only choose how many cards they can draw
actualNum = StaticAbilityCantDraw.canDrawAmount(p, actualNum); actualNum = StaticAbilityCantDraw.canDrawAmount(p, actualNum);
} }
@@ -101,7 +98,6 @@ public class DrawEffect extends SpellAbilityEffect {
if (sa.hasParam("RememberDrawn")) { if (sa.hasParam("RememberDrawn")) {
source.addRemembered(drawn); source.addRemembered(drawn);
} }
sa.setSVar("AFNotDrawnNum_" + p.getId(), "Number$" + drawn.size());
} }
} }
} }

View File

@@ -48,23 +48,14 @@ public class LifeGainEffect extends SpellAbilityEffect {
*/ */
@Override @Override
public void resolve(SpellAbility sa) { public void resolve(SpellAbility sa) {
String amount = sa.getParam("LifeAmount"); final int lifeAmount = AbilityUtils.calculateAmount(sa.getHostCard(), sa.getParam("LifeAmount"), sa);
boolean variableAmount = amount.equals("AFNotDrawnNum");
if (variableAmount) {
amount = "X";
}
final List<Player> tgts = getTargetPlayersWithDuplicates(true, "Defined", sa); final List<Player> tgts = getTargetPlayersWithDuplicates(true, "Defined", sa);
for (final Player p : Sets.newHashSet(tgts)) { for (final Player p : Sets.newHashSet(tgts)) {
if (!p.isInGame()) { if (!p.isInGame()) {
continue; continue;
} }
if (variableAmount) { p.gainLife(lifeAmount * Collections.frequency(tgts, p), sa.getHostCard(), sa);
sa.setSVar("AFNotDrawnNum", sa.getSVar("AFNotDrawnNum_" + p.getId()));
}
int lifeAmount = AbilityUtils.calculateAmount(sa.getHostCard(), amount, sa);
lifeAmount *= Collections.frequency(tgts, p);
p.gainLife(lifeAmount, sa.getHostCard(), sa);
} }
} }

View File

@@ -4,6 +4,6 @@ Types:Sorcery
A:SP$ Draw | Defined$ Opponent | RememberDrawn$ AllReplaced | SubAbility$ DBDraw | SpellDescription$ Each opponent draws a card, then you draw a card for each opponent who drew a card this way. A:SP$ Draw | Defined$ Opponent | RememberDrawn$ AllReplaced | SubAbility$ DBDraw | SpellDescription$ Each opponent draws a card, then you draw a card for each opponent who drew a card this way.
SVar:DBDraw:DB$ Draw | NumCards$ X | SubAbility$ DBCleanup | StackDescription$ {p:You} draws a card for each opponent who drew a card this way. SVar:DBDraw:DB$ Draw | NumCards$ X | SubAbility$ DBCleanup | StackDescription$ {p:You} draws a card for each opponent who drew a card this way.
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:X:PlayerCountRememberedOwner$Amount SVar:X:PlayerCountOpponents$HasPropertyIsRememberedOrController
AI:RemoveDeck:Random AI:RemoveDeck:Random
Oracle:Each opponent draws a card, then you draw a card for each opponent who drew a card this way. Oracle:Each opponent draws a card, then you draw a card for each opponent who drew a card this way.

View File

@@ -5,8 +5,9 @@ K:Cumulative upkeep:1
T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | Execute$ TrigPutCounter | TriggerZones$ Battlefield | TriggerDescription$ At the beginning of your upkeep, put a growth counter on CARDNAME. T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | Execute$ TrigPutCounter | TriggerZones$ Battlefield | TriggerDescription$ At the beginning of your upkeep, put a growth counter on CARDNAME.
T:Mode$ Phase | Phase$ Draw | ValidPlayer$ Opponent | Execute$ TrigDraw | TriggerZones$ Battlefield | TriggerDescription$ At the beginning of each opponent's draw step, that player draws an additional card for each growth counter on CARDNAME, then CARDNAME deals damage to the player equal to the number of cards they drew this way. T:Mode$ Phase | Phase$ Draw | ValidPlayer$ Opponent | Execute$ TrigDraw | TriggerZones$ Battlefield | TriggerDescription$ At the beginning of each opponent's draw step, that player draws an additional card for each growth counter on CARDNAME, then CARDNAME deals damage to the player equal to the number of cards they drew this way.
SVar:TrigPutCounter:DB$ PutCounter | Defined$ Self | CounterType$ GROWTH | CounterNum$ 1 SVar:TrigPutCounter:DB$ PutCounter | Defined$ Self | CounterType$ GROWTH | CounterNum$ 1
SVar:TrigDraw:DB$ Draw | Defined$ TriggeredPlayer | NumCards$ X | SubAbility$ DBDamage SVar:TrigDraw:DB$ Draw | Defined$ TriggeredPlayer | NumCards$ X | RememberDrawn$ AllReplaced | SubAbility$ DBDamage
SVar:DBDamage:DB$ DealDamage | Defined$ TriggeredPlayer | NumDmg$ X SVar:DBDamage:DB$ DealDamage | Defined$ TriggeredPlayer | NumDmg$ Remembered$Amount | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:X:Count$CardCounters.GROWTH SVar:X:Count$CardCounters.GROWTH
AI:RemoveDeck:Random AI:RemoveDeck:Random
Oracle:Cumulative upkeep {1} (At the beginning of your upkeep, put an age counter on this permanent, then sacrifice it unless you pay its upkeep cost for each age counter on it.)\nAt the beginning of your upkeep, put a growth counter on Malignant Growth.\nAt the beginning of each opponent's draw step, that player draws an additional card for each growth counter on Malignant Growth, then Malignant Growth deals damage to the player equal to the number of cards they drew this way. Oracle:Cumulative upkeep {1} (At the beginning of your upkeep, put an age counter on this permanent, then sacrifice it unless you pay its upkeep cost for each age counter on it.)\nAt the beginning of your upkeep, put a growth counter on Malignant Growth.\nAt the beginning of each opponent's draw step, that player draws an additional card for each growth counter on Malignant Growth, then Malignant Growth deals damage to the player equal to the number of cards they drew this way.

View File

@@ -1,10 +1,11 @@
Name:Temporary Truce Name:Temporary Truce
ManaCost:1 W ManaCost:1 W
Types:Sorcery Types:Sorcery
A:SP$ Draw | Defined$ Player | Upto$ True | NumCards$ 2 | SubAbility$ DBRepeat | AILogic$ GainLife | SpellDescription$ Each player may draw up to two cards. For each card less than two a player draws this way, that player gains 2 life. A:SP$ Draw | Defined$ Player | Upto$ True | NumCards$ 2 | RememberDrawn$ AllReplaced | SubAbility$ DBRepeat | AILogic$ GainLife | SpellDescription$ Each player may draw up to two cards. For each card less than two a player draws this way, that player gains 2 life.
SVar:DBRepeat:DB$ RepeatEach | RepeatPlayers$ Player | RepeatSubAbility$ DBGainLife | StackDescription$ For each card less than two a player draws this way, that player gains 2 life. SVar:DBRepeat:DB$ RepeatEach | RepeatPlayers$ Player | RepeatSubAbility$ DBGainLife | SubAbility$ DBCleanup | StackDescription$ For each card less than two a player draws this way, that player gains 2 life.
SVar:DBGainLife:DB$ GainLife | LifeAmount$ AFNotDrawnNum | Defined$ Player.IsRemembered SVar:DBGainLife:DB$ GainLife | LifeAmount$ X | Defined$ Player.IsRemembered
SVar:Y:SVar$AFNotDrawnNum/NMinus.2 SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:Y:Remembered$Valid Card.RememberedPlayerOwn/NMinus.2
SVar:X:SVar$Y/Twice SVar:X:SVar$Y/Twice
AI:RemoveDeck:All AI:RemoveDeck:All
Oracle:Each player may draw up to two cards. For each card less than two a player draws this way, that player gains 2 life. Oracle:Each player may draw up to two cards. For each card less than two a player draws this way, that player gains 2 life.

View File

@@ -1,10 +1,11 @@
Name:Truce Name:Truce
ManaCost:2 W ManaCost:2 W
Types:Instant Types:Instant
A:SP$ Draw | Defined$ Player | Upto$ True | NumCards$ 2 | SubAbility$ DBRepeat | AILogic$ GainLife | SpellDescription$ Each player may draw up to two cards. For each card less than two a player draws this way, that player gains 2 life. A:SP$ Draw | Defined$ Player | Upto$ True | NumCards$ 2 | RememberDrawn$ AllReplaced | SubAbility$ DBRepeat | AILogic$ GainLife | SpellDescription$ Each player may draw up to two cards. For each card less than two a player draws this way, that player gains 2 life.
SVar:DBRepeat:DB$ RepeatEach | RepeatPlayers$ Player | RepeatSubAbility$ DBGainLife | StackDescription$ For each card less than two a player draws this way, that player gains 2 life. SVar:DBRepeat:DB$ RepeatEach | RepeatPlayers$ Player | RepeatSubAbility$ DBGainLife | SubAbility$ DBCleanup | StackDescription$ For each card less than two a player draws this way, that player gains 2 life.
SVar:DBGainLife:DB$ GainLife | LifeAmount$ AFNotDrawnNum | Defined$ Player.IsRemembered SVar:DBGainLife:DB$ GainLife | LifeAmount$ X | Defined$ Player.IsRemembered
SVar:Y:SVar$AFNotDrawnNum/NMinus.2 SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:Y:Remembered$Valid Card.RememberedPlayerOwn/NMinus.2
SVar:X:SVar$Y/Twice SVar:X:SVar$Y/Twice
AI:RemoveDeck:All AI:RemoveDeck:All
Oracle:Each player may draw up to two cards. For each card less than two a player draws this way, that player gains 2 life. Oracle:Each player may draw up to two cards. For each card less than two a player draws this way, that player gains 2 life.

View File

@@ -2,14 +2,11 @@ Name:Whispering Madness
ManaCost:2 U B ManaCost:2 U B
Types:Sorcery Types:Sorcery
K:Cipher K:Cipher
A:SP$ RepeatEach | RepeatPlayers$ Player | RepeatSubAbility$ MadnessDiscard | SubAbility$ MadnessDraw | SpellDescription$ Each player discards their hand, then draws cards equal to the greatest number of cards a player discarded this way. A:SP$ Discard | Defined$ Player | Mode$ Hand | RememberDiscarded$ True | SubAbility$ WindfallDraw | SpellDescription$ Each player discards their hand, then draws cards equal to the greatest number of cards a player discarded this way.
SVar:MadnessDiscard:DB$ Discard | Defined$ Player.IsRemembered | Mode$ Hand | RememberDiscarded$ True | SubAbility$ MadnessSaveAmount SVar:WindfallDraw:DB$ Draw | Defined$ Player | NumCards$ X | SubAbility$ WindfallCleanup
SVar:MadnessSaveAmount:DB$ StoreSVar | SVar$ MaxDiscard | Type$ CountSVar | Expression$ NumDiscard | ConditionCheckSVar$ NumDiscard | ConditionSVarCompare$ GTMaxDiscard | SubAbility$ MadnessCleanUp SVar:WindfallCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:MadnessCleanUp:DB$ Cleanup | ClearRemembered$ True # Some cards may allow you to discard to other zones
SVar:MadnessDraw:DB$ Draw | Defined$ Player | NumCards$ MaxDiscard | SubAbility$ MadnessReset SVar:X:PlayerCountPlayers$HighestValidGraveyard,Library,Exile Card.IsRemembered+YouOwn
SVar:MadnessReset:DB$ StoreSVar | SVar$ MaxDiscard | Type$ Number | Expression$ 0
SVar:NumDiscard:Count$RememberedSize/Minus.1
SVar:MaxDiscard:Number$0
AI:RemoveDeck:All AI:RemoveDeck:All
AI:RemoveDeck:Random AI:RemoveDeck:Random
DeckNeeds:Type$Creature DeckNeeds:Type$Creature