Merge pull request #3076 from tool4ever/fixroll

Fix rollback sometimes reverting to LKI version of card
This commit is contained in:
Anthony Calosa
2023-05-08 17:36:03 +08:00
committed by GitHub
12 changed files with 19 additions and 13 deletions

View File

@@ -868,6 +868,9 @@ public final class GameActionUtil {
final Game game = ability.getActivatingPlayer().getGame();
if (fromZone != null) { // and not a copy
// might have been an alternative lki host
oldCard = ability.getCardState().getCard();
oldCard.setCastSA(null);
oldCard.setCastFrom(null);
// add back to where it came from, hopefully old state

View File

@@ -296,7 +296,6 @@ public class PlayEffect extends SpellAbilityEffect {
continue;
}
state = CardStateName.Transformed;
tgtCard.incrementTransformedTimestamp();
}
// TODO if cost isn't replaced should include alternative ones
@@ -420,6 +419,10 @@ public class PlayEffect extends SpellAbilityEffect {
tgtSA.setAlternativeCost(AlternativeCost.Madness);
}
if (sa.hasParam("CastTransformed")) {
tgtSA.putParam("CastTransformed", "True");
}
if (tgtSA.usesTargeting() && !optional) {
tgtSA.getTargetRestrictions().setMandatory(true);
}

View File

@@ -1452,7 +1452,7 @@ public class CardView extends GameEntityView {
public boolean hasLandwalk() {
return get(TrackableProperty.HasLandwalk);
}
public boolean hasHasAftermath() {
public boolean hasAftermath() {
return get(TrackableProperty.HasAftermath);
}

View File

@@ -3183,7 +3183,7 @@ public class Player extends GameEntity implements Comparable<Player> {
{
final String drawTrig = "Mode$ Phase | Phase$ End of Turn | TriggerZones$ Command | " +
"ValidPlayer$ You | TriggerDescription$ At the beginning of your end step, draw a card.";
final String drawEff = "AB$ Draw | Cost$ 0 | Defined$ You";
final String drawEff = "DB$ Draw | Defined$ You";
final Trigger drawTrigger = TriggerHandler.parseTrigger(drawTrig, monarchEffect, true);
@@ -3194,7 +3194,7 @@ public class Player extends GameEntity implements Comparable<Player> {
{
final String damageTrig = "Mode$ DamageDone | ValidSource$ Creature | ValidTarget$ You | CombatDamage$ True | TriggerZones$ Command |" +
" TriggerDescription$ Whenever a creature deals combat damage to you, its controller becomes the monarch.";
final String damageEff = "AB$ BecomeMonarch | Cost$ 0 | Defined$ TriggeredSourceController";
final String damageEff = "DB$ BecomeMonarch | Defined$ TriggeredSourceController";
final Trigger damageTrigger = TriggerHandler.parseTrigger(damageTrig, monarchEffect, true);

View File

@@ -369,7 +369,7 @@ public class SpellAbilityRestriction extends SpellAbilityVariables {
}
// Explicit Aftermath check there
if (sa.isAftermath() && !c.isInZone(ZoneType.Graveyard)) {
if ((sa.isAftermath() || sa.isDisturb()) && !c.isInZone(ZoneType.Graveyard)) {
return false;
}

View File

@@ -416,7 +416,7 @@ public class CardImageRenderer {
if (alt == null)
alt = card.getAlternateState().getCard();
CardView cv = altState && isFaceDown ? alt : card;
boolean isAftermath = altState ? cv.getAlternateState().hasHasAftermath() : cv.getRightSplitState().hasHasAftermath();
boolean isAftermath = altState ? cv.getAlternateState().hasAftermath() : cv.getRightSplitState().hasAftermath();
if (!isAftermath) {
CardEdition ed = FModel.getMagicDb().getEditions().get(cv.getCurrentState().getSetCode());
boolean isOldFrame = ed != null && !ed.isModern();

View File

@@ -5,5 +5,5 @@ PT:6/6
K:Flying
T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigEnergy | TriggerDescription$ At the beginning of your upkeep, you get {E}{E}{E} (three energy counters).
SVar:TrigEnergy:DB$ PutCounter | Defined$ You | CounterType$ ENERGY | CounterNum$ 3
A:AB$ ChangeZoneAll | Cost$ PayEnergy<8> | ChangeType$ Creature.Other | SorcerySpeed$ True | Origin$ Battlefield | Destination$ Hand | SpellDescription$ Return all other creatures to their owners' hands. Activate only as a sorcery.
A:AB$ ChangeZoneAll | Cost$ PayEnergy<8> | ChangeType$ Creature.StrictlyOther | SorcerySpeed$ True | Origin$ Battlefield | Destination$ Hand | SpellDescription$ Return all other creatures to their owners' hands. Activate only as a sorcery.
Oracle:Flying\nAt the beginning of your upkeep, you get {E}{E}{E} (three energy counters).\nPay {E}{E}{E}{E}{E}{E}{E}{E}: Return all other creatures to their owners' hands. Activate only as a sorcery.

View File

@@ -4,7 +4,7 @@ Types:Creature Ogre Citizen
PT:3/3
K:Vigilance
T:Mode$ Phase | Phase$ End of Turn | ValidPlayer$ You | TriggerZones$ Battlefield | OptionalDecider$ You | Execute$ TrigReturn | TriggerDescription$ At the beginning of your end step, you may return another creature you control to its owner's hand, then put a number of +1/+1 counters equal to that creature's power on CARDNAME.
SVar:TrigReturn:DB$ ChangeZone | Origin$ Battlefield | Destination$ Hand | Hidden$ True | ChangeType$ Creature.Other+YouCtrl | RememberLKI$ True | SubAbility$ DBPutCounter
SVar:TrigReturn:DB$ ChangeZone | Origin$ Battlefield | Destination$ Hand | Hidden$ True | ChangeType$ Creature.StrictlyOther+YouCtrl | RememberLKI$ True | SubAbility$ DBPutCounter
SVar:DBPutCounter:DB$ PutCounter | CounterType$ P1P1 | CounterNum$ X | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:X:RememberedLKI$CardPower

View File

@@ -3,7 +3,7 @@ ManaCost:2 R B
Types:Legendary Creature Phyrexian Beast
PT:4/4
T:Mode$ Phase | Phase$ End of Turn | ValidPlayer$ You | Execute$ TrigSac | TriggerZones$ Battlefield | TriggerDescription$ At the beginning of your end step, you may sacrifice another creature. If you do, reveal cards from the top of your library until you reveal a nonlegendary creature card with lesser mana value, put it onto the battlefield, then put the rest on the bottom of your library in a random order.
SVar:TrigSac:AB$ DigUntil | Cost$ Sac<1/Creature.Other/another creature> | Defined$ You | Valid$ Card.Creature+nonLegendary+cmcLTX | FoundDestination$ Battlefield | RevealedDestination$ Library | RevealRandomOrder$ True
SVar:TrigSac:AB$ DigUntil | Cost$ Sac<1/Creature.StrictlyOther/another creature> | Defined$ You | Valid$ Card.Creature+nonLegendary+cmcLTX | FoundDestination$ Battlefield | RevealedDestination$ Library | RevealRandomOrder$ True
SVar:X:Sacrificed$CardManaCost
DeckHas:Ability$Sacrifice
Oracle:At the beginning of your end step, you may sacrifice another creature. If you do, reveal cards from the top of your library until you reveal a nonlegendary creature card with lesser mana value, put it onto the battlefield, then put the rest on the bottom of your library in a random order.

View File

@@ -4,9 +4,9 @@ Types:Creature Unicorn
PT:3/4
K:Vigilance
T:Mode$ Phase | Phase$ BeginCombat | ValidPlayer$ You | IsPresent$ Card.IsCommander+YouOwn+YouCtrl | TriggerZones$ Battlefield | Execute$ PreventEffect | TriggerDescription$ Lieutenant — At the beginning of combat on your turn, if you control your commander, prevent all combat damage that would be dealt to creatures you control this turn.
SVar:PreventEffect:DB$ Effect | ReplacementEffects$ RPrevent | ValidTgts$ You | Description$ Prevent all combat damage that would be dealt to creatures you control this turn.
SVar:PreventEffect:DB$ Effect | ReplacementEffects$ RPrevent | ValidTgts$ You | SubAbility$ DBPumpAll
SVar:RPrevent:Event$ DamageDone | Prevent$ True | IsCombat$ True | ActiveZones$ Command | ValidTarget$ Creature.YouCtrl | Description$ Prevent all combat damage that would be dealt to creatures you control this turn.
S:Mode$ Continuous | Affected$ Creature.Other+YouCtrl | AddKeyword$ Vigilance | Description$ Other creatures you control gain vigilance until end of turn.
SVar:DBPumpAll:DB$ PumpAll | ValidCards$ Creature.StrictlyOther+YouCtrl | KW$ Vigilance
SVar:BuffedBy:Card.IsCommander
AI:RemoveDeck:Random
Oracle:Vigilance\nLieutenant — At the beginning of combat on your turn, if you control your commander, prevent all combat damage that would be dealt to creatures you control this turn. Other creatures you control gain vigilance until end of turn.

View File

@@ -4,7 +4,7 @@ Types:Legendary Creature Demon Dragon
PT:6/6
K:Flying
T:Mode$ Phase | Phase$ End of Turn | ValidPlayer$ You | Execute$ DBTrigger | TriggerZones$ Battlefield | TriggerDescription$ At the beginning of your end step, you may sacrifice another creature. When you do, CARDNAME deals damage equal to that creature's power to any target and you create three Treasure tokens.
SVar:DBTrigger:AB$ ImmediateTrigger | Cost$ Sac<1/Creature.Other/another creature> | Execute$ DBDealDmg | AILogic$ SacForDamage | RememberObjects$ Sacrificed | TriggerDescription$ When you do, CARDNAME deals damage equal to that creature's power to any target and you create three Treasure tokens.
SVar:DBTrigger:AB$ ImmediateTrigger | Cost$ Sac<1/Creature.StrictlyOther/another creature> | Execute$ DBDealDmg | AILogic$ SacForDamage | RememberObjects$ Sacrificed | TriggerDescription$ When you do, CARDNAME deals damage equal to that creature's power to any target and you create three Treasure tokens.
SVar:DBDealDmg:DB$ DealDamage | ValidTgts$ Any | TgtPrompt$ Select any target to deal the damage to | NumDmg$ XPower | SubAbility$ DBToken
SVar:DBToken:DB$ Token | TokenAmount$ 3 | TokenScript$ c_a_treasure_sac
SVar:XPower:TriggerRemembered$CardPower

View File

@@ -109,7 +109,7 @@ public class HumanPlay {
final HumanPlaySpellAbility req = new HumanPlaySpellAbility(controller, sa);
if (!req.playAbility(true, false, false)) {
Card rollback = p.getGame().getCardState(sa.getHostCard());
Card rollback = p.getGame().getCardState(source);
if (castFaceDown) {
rollback.setFaceDown(false);
} else if (flippedToCast) {