Fix Pure Intentions (#4845)

* Fix Pure Intentions

* Remove obsolete stuff

---------

Co-authored-by: tool4EvEr <tool4EvEr@192.168.0.59>
This commit is contained in:
tool4ever
2024-03-20 17:46:14 +01:00
committed by GitHub
parent 93a52a4263
commit 7f7bc711f3
19 changed files with 29 additions and 34 deletions

View File

@@ -1911,8 +1911,6 @@ public class GameAction {
runParams.putAll(params);
}
game.getTriggerHandler().runTrigger(TriggerType.Destroyed, runParams, false);
// in case the destroyed card has such a trigger
game.getTriggerHandler().registerActiveLTBTrigger(c);
final Card sacrificed = sacrificeDestroy(c, sa, params);
return sacrificed != null;

View File

@@ -804,8 +804,9 @@ public abstract class SpellAbilityEffect {
final CardCollection discardedByPlayer = new CardCollection();
for (Card card : Lists.newArrayList(discardedMap.get(p))) { // without copying will get concurrent modification exception
if (card == null) { continue; }
if (p.discard(card, sa, effect, params) != null) {
discardedByPlayer.add(card);
Card moved = p.discard(card, sa, effect, params);
if (moved != null) {
discardedByPlayer.add(moved);
}
}
discardedMap.put(p, discardedByPlayer);

View File

@@ -375,8 +375,9 @@ public class PhaseHandler implements java.io.Serializable {
final CardCollection discarded = new CardCollection();
List<Card> discardedBefore = Lists.newArrayList(playerTurn.getDiscardedThisTurn());
for (Card c : playerTurn.getController().chooseCardsToDiscardToMaximumHandSize(numDiscard)) {
if (playerTurn.discard(c, null, false, moveParams) != null) {
discarded.add(c);
Card moved = playerTurn.discard(c, null, false, moveParams);
if (moved != null) {
discarded.add(moved);
}
}
table.triggerChangesZoneAll(game, null);

View File

@@ -3776,12 +3776,13 @@ public class Player extends GameEntity implements Comparable<Player> {
game.getAction().moveTo(ZoneType.Hand, c, sa, params);
} else if (c.isInZone(ZoneType.Hand)) { // Discard and Draw
List<Card> discardedBefore = Lists.newArrayList(getDiscardedThisTurn());
if (discard(c, sa, true, params) != null) {
Card moved = discard(c, sa, true, params);
if (moved != null) {
// Change this if something would make multiple player learn at the same time
// Discard Trigger outside Effect
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromPlayer(this);
runParams.put(AbilityKey.Cards, new CardCollection(c));
runParams.put(AbilityKey.Cards, new CardCollection(moved));
runParams.put(AbilityKey.Cause, sa);
runParams.put(AbilityKey.DiscardedBefore, discardedBefore);
if (params != null) {

View File

@@ -1244,6 +1244,7 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
return null; // the ability was not copyable, e.g. a Suspend SA may get here
}
newSA.setPayCosts(newSA.getPayCosts().copyWithNoMana());
// currently needed by AI
if (!newSA.hasParam("WithoutManaCost")) {
newSA.mapParams.put("WithoutManaCost", "True");
}

View File

@@ -152,16 +152,9 @@ public class TriggerChangesZone extends Trigger {
return false;
}
final Card card = (Card) runParams.get(AbilityKey.Card);
if (card == null) {
return false;
}
final Card card = (Card) runParams.get(AbilityKey.CardLKI);
final int rightSide = AbilityUtils.calculateAmount(getHostCard(), cond.substring(2), this);
// need to check the ChangeZone LKI copy for damage, otherwise it'll return 0 for a new object in the new zone
Card lkiCard = card.getGame().getChangeZoneLKIInfo(card);
final boolean expr = Expressions.compare(lkiCard.getAssignedDamage(), cond, rightSide);
final boolean expr = Expressions.compare(card.getAssignedDamage(), cond, rightSide);
if (!expr) {
return false;
}

View File

@@ -67,6 +67,8 @@ public class WrappedAbility extends Ability {
ApiType.SacrificeAll,
ApiType.Pump,
ApiType.DealDamage, // checked
ApiType.Regenerate, // Updated
ApiType.RegenerateAll, // No Triggered
ApiType.Regeneration, // Replacement Effect only
@@ -490,9 +492,7 @@ public class WrappedAbility extends Ability {
}
}
if (!regtrig.hasParam("NoTimestampCheck")) {
timestampCheck();
}
timestampCheck();
getActivatingPlayer().getController().playSpellAbilityNoStack(sa, false);
}

View File

@@ -3,6 +3,6 @@ ManaCost:2 W W
Types:Enchantment
T:Mode$ ChangesZone | ValidCard$ Creature.YouCtrl,Planeswalker.YouCtrl | Origin$ Battlefield | Destination$ Graveyard | Execute$ TrigDiesToken | TriggerZones$ Battlefield | TriggerDescription$ Whenever a creature or planeswalker you control dies, you may sacrifice CARDNAME. If you do, create a 4/4 white Avatar creature token with flying.
SVar:TrigDiesToken:AB$ Token | Cost$ Sac<1/CARDNAME> | TokenOwner$ You | TokenAmount$ 1 | TokenScript$ w_4_4_avatar_flying
T:Mode$ Discarded | ValidCard$ Card.Self | ValidCause$ Card.OppCtrl | IsPresent$ Plains.YouCtrl | Execute$ TrigDiscardedToken | TriggerZones$ Battlefield | TriggerDescription$ When a spell or ability an opponent controls causes you to discard this card, if you control a Plains, create a 4/4 white Avatar creature token with flying.
T:Mode$ Discarded | ValidCard$ Card.Self | ValidCause$ SpellAbility.OppCtrl | IsPresent$ Plains.YouCtrl | Execute$ TrigDiscardedToken | TriggerDescription$ When a spell or ability an opponent controls causes you to discard this card, if you control a Plains, create a 4/4 white Avatar creature token with flying.
SVar:TrigDiscardedToken:DB$ Token | TokenOwner$ You | TokenAmount$ 1 | TokenScript$ w_4_4_avatar_flying
Oracle:Whenever a creature or planeswalker you control dies, you may sacrifice Ajani's Last Stand. If you do, create a 4/4 white Avatar creature token with flying.\nWhen a spell or ability an opponent controls causes you to discard this card, if you control a Plains, create a 4/4 white Avatar creature token with flying.

View File

@@ -1,7 +1,7 @@
Name:Dingus Egg
ManaCost:4
Types:Artifact
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Land | TriggerZones$ Battlefield | Execute$ TrigDamage | NoTimestampCheck$ True | TriggerDescription$ Whenever a land is put into a graveyard from the battlefield, CARDNAME deals 2 damage to that land's controller.
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Land | TriggerZones$ Battlefield | Execute$ TrigDamage | TriggerDescription$ Whenever a land is put into a graveyard from the battlefield, CARDNAME deals 2 damage to that land's controller.
SVar:TrigDamage:DB$ DealDamage | Defined$ TriggeredCardController | NumDmg$ 2
AI:RemoveDeck:Random
Oracle:Whenever a land is put into a graveyard from the battlefield, Dingus Egg deals 2 damage to that land's controller.

View File

@@ -2,7 +2,7 @@ Name:Gorilla Tactics
ManaCost:1 G
Types:Instant
A:SP$ Token | Cost$ 1 G | TokenScript$ g_2_2_gorilla | SpellDescription$ Create a 2/2 green Gorilla creature token.
T:Mode$ Discarded | ValidCard$ Card.Self | ValidCause$ Card.OppCtrl | Execute$ TrigDouble | TriggerDescription$ When a spell or ability an opponent controls causes you to discard CARDNAME, create two 2/2 green Gorilla creature tokens.
T:Mode$ Discarded | ValidCard$ Card.Self | ValidCause$ SpellAbility.OppCtrl | Execute$ TrigDouble | TriggerDescription$ When a spell or ability an opponent controls causes you to discard CARDNAME, create two 2/2 green Gorilla creature tokens.
SVar:TrigDouble:DB$ Token | TokenScript$ g_2_2_gorilla | TokenAmount$ 2
DeckHas:Ability$Token
Oracle:Create a 2/2 green Gorilla creature token.\nWhen a spell or ability an opponent controls causes you to discard Gorilla Tactics, create two 2/2 green Gorilla creature tokens.

View File

@@ -2,7 +2,7 @@ Name:Guerrilla Tactics
ManaCost:1 R
Types:Instant
A:SP$ DealDamage | Cost$ 1 R | ValidTgts$ Any | NumDmg$ 2 | SpellDescription$ CARDNAME deals 2 damage to any target.
T:Mode$ Discarded | ValidCard$ Card.Self | ValidCause$ Card.OppCtrl | Execute$ TrigDoubleDmg | TriggerDescription$ When a spell or ability an opponent controls causes you to discard CARDNAME, CARDNAME deals 4 damage to any target.
T:Mode$ Discarded | ValidCard$ Card.Self | ValidCause$ SpellAbility.OppCtrl | Execute$ TrigDoubleDmg | TriggerDescription$ When a spell or ability an opponent controls causes you to discard CARDNAME, CARDNAME deals 4 damage to any target.
SVar:TrigDoubleDmg:DB$ DealDamage | ValidTgts$ Any | NumDmg$ 4
SVar:DiscardMeByOpp:3
Oracle:Guerrilla Tactics deals 2 damage to any target.\nWhen a spell or ability an opponent controls causes you to discard Guerrilla Tactics, Guerrilla Tactics deals 4 damage to any target.

View File

@@ -2,7 +2,7 @@ Name:Mangara's Blessing
ManaCost:2 W
Types:Instant
A:SP$ GainLife | Cost$ 2 W | Defined$ You | LifeAmount$ 5 | SpellDescription$ You gain 5 life.
T:Mode$ Discarded | ValidCard$ Card.Self | ValidCause$ Card.OppCtrl | Execute$ TrigGainLife | TriggerDescription$ When a spell or ability an opponent controls causes you to discard CARDNAME, you gain 2 life, and you return CARDNAME from your graveyard to your hand at the beginning of the next end step.
T:Mode$ Discarded | ValidCard$ Card.Self | ValidCause$ SpellAbility.OppCtrl | Execute$ TrigGainLife | TriggerDescription$ When a spell or ability an opponent controls causes you to discard CARDNAME, you gain 2 life, and you return CARDNAME from your graveyard to your hand at the beginning of the next end step.
SVar:TrigGainLife:DB$ GainLife | Defined$ You | LifeAmount$ 2 | SubAbility$ DelayReturn
SVar:DelayReturn:DB$ DelayedTrigger | Mode$ Phase | Phase$ End of Turn | Execute$ TrigReturn | TriggerDescription$ Return CARDNAME from your graveyard to your hand.
SVar:TrigReturn:DB$ ChangeZone | Origin$ Graveyard | Destination$ Hand | Defined$ Self

View File

@@ -2,7 +2,7 @@ Name:Metrognome
ManaCost:4
Types:Artifact
A:AB$ Token | Cost$ 4 T | TokenAmount$ 1 | TokenScript$ c_1_1_a_gnome | TokenOwner$ You | SpellDescription$ Create a 1/1 colorless Gnome artifact creature token.
T:Mode$ Discarded | ValidCard$ Card.Self | ValidCause$ Card.OppCtrl | Execute$ TrigToken | TriggerDescription$ When a spell or ability an opponent controls causes you to discard CARDNAME, create four 1/1 colorless Gnome artifact creature tokens.
T:Mode$ Discarded | ValidCard$ Card.Self | ValidCause$ SpellAbility.OppCtrl | Execute$ TrigToken | TriggerDescription$ When a spell or ability an opponent controls causes you to discard CARDNAME, create four 1/1 colorless Gnome artifact creature tokens.
SVar:TrigToken:DB$ Token | TokenAmount$ 4 | TokenScript$ c_1_1_a_gnome | TokenOwner$ You
SVar:DiscardMeByOpp:2
Oracle:When a spell or ability an opponent controls causes you to discard Metrognome, create four 1/1 colorless Gnome artifact creature tokens.\n{4}, {T}: Create a 1/1 colorless Gnome artifact creature token.

View File

@@ -5,7 +5,7 @@ PT:3/3
K:Changeling
T:Mode$ SpellCast | ValidCard$ Instant,Sorcery | ValidActivatingPlayer$ You | TriggerZones$ Battlefield | TargetsValid$ Permanent.YouCtrl+Other+inZoneBattlefield | Execute$ TrigCopyTarget | TriggerDescription$ Whenever you cast an instant or sorcery spell, if it targets one or more other permanents you control, create a token that's a copy of one of those permanents.
SVar:TrigCopyTarget:DB$ CopyPermanent | Defined$ TriggeredSpellAbilityTargets | Choices$ Permanent.YouCtrl+Other | ConditionDefined$ TriggeredSpellAbility | ConditionPresent$ Spell.IsTargeting Valid Permanent.YouCtrl~Other
T:Mode$ Discarded | ValidCard$ Card.Self | ValidCause$ Card.OppCtrl | Execute$ TrigTokenCopy | TriggerDescription$ When a spell or ability an opponent controls causes you to discard this card, create a token that's a copy of target permanent.
T:Mode$ Discarded | ValidCard$ Card.Self | ValidCause$ SpellAbility.OppCtrl | Execute$ TrigTokenCopy | TriggerDescription$ When a spell or ability an opponent controls causes you to discard this card, create a token that's a copy of target permanent.
SVar:TrigTokenCopy:DB$ CopyPermanent | ValidTgts$ Permanent
DeckHints:Type$Instant|Sorcery
DeckHas:Ability$Token

View File

@@ -2,7 +2,7 @@ Name:Psychic Purge
ManaCost:U
Types:Sorcery
A:SP$ DealDamage | Cost$ U | ValidTgts$ Any | NumDmg$ 1 | SpellDescription$ CARDNAME deals 1 damage to any target.
T:Mode$ Discarded | ValidCard$ Card.Self | ValidCause$ Card.OppCtrl | Execute$ TrigLoseLife | TriggerDescription$ When a spell or ability an opponent controls causes you to discard CARDNAME, that player loses 5 life.
T:Mode$ Discarded | ValidCard$ Card.Self | ValidCause$ SpellAbility.OppCtrl | Execute$ TrigLoseLife | TriggerDescription$ When a spell or ability an opponent controls causes you to discard CARDNAME, that player loses 5 life.
SVar:TrigLoseLife:DB$ LoseLife | Defined$ TriggeredCauseController | LifeAmount$ 5
SVar:DiscardMeByOpp:3
Oracle:Psychic Purge deals 1 damage to any target.\nWhen a spell or ability an opponent controls causes you to discard Psychic Purge, that player loses 5 life.

View File

@@ -2,9 +2,9 @@ Name:Pure Intentions
ManaCost:W
Types:Instant Arcane
A:SP$ Effect | Cost$ W | Triggers$ PureDiscarded | SpellDescription$ Whenever a spell or ability an opponent controls causes you to discard cards this turn, return those cards from your graveyard to your hand.
SVar:PureDiscarded:Mode$ Discarded | ValidCard$ Card.YouCtrl | ValidCause$ Card.OppCtrl | TriggerZones$ Command | Execute$ TrigPureChange | TriggerDescription$ Whenever a spell or ability an opponent controls causes you to discard cards this turn, return those cards from your graveyard to your hand.
SVar:TrigPureChange:DB$ ChangeZone | Defined$ TriggeredCardLKICopy | Origin$ Graveyard | Destination$ Hand
T:Mode$ Discarded | ValidCard$ Card.Self | ValidCause$ Card.OppCtrl | Execute$ TrigDelay | TriggerDescription$ When a spell or ability an opponent controls causes you to discard CARDNAME, return CARDNAME from your graveyard to your hand at the beginning of the next end step.
SVar:PureDiscarded:Mode$ DiscardedAll | ValidCard$ Card.YouCtrl | ValidCause$ SpellAbility.OppCtrl | TriggerZones$ Command | Execute$ TrigPureChange | TriggerDescription$ Whenever a spell or ability an opponent controls causes you to discard cards this turn, return those cards from your graveyard to your hand.
SVar:TrigPureChange:DB$ ChangeZone | Defined$ TriggeredCards | Origin$ Graveyard | Destination$ Hand
T:Mode$ Discarded | ValidCard$ Card.Self | ValidCause$ SpellAbility.OppCtrl | Execute$ TrigDelay | TriggerDescription$ When a spell or ability an opponent controls causes you to discard CARDNAME, return CARDNAME from your graveyard to your hand at the beginning of the next end step.
SVar:TrigDelay:DB$ DelayedTrigger | Mode$ Phase | Phase$ End of Turn | Execute$ TrigPureReturn | SpellDescription$ Return CARDNAME from your graveyard to your hand at the beginning of the next end step.
SVar:TrigPureReturn:DB$ ChangeZone | Origin$ Graveyard | Destination$ Hand
SVar:DiscardMeByOpp:1

View File

@@ -4,7 +4,7 @@ Types:Creature Beast
PT:4/5
K:Split second
K:Shroud
T:Mode$ Discarded | ValidCard$ Card.Self | ValidCause$ Card.OppCtrl | Execute$ TrigReturn | TriggerDescription$ When a spell or ability an opponent controls causes you to discard CARDNAME, return it to your hand.
T:Mode$ Discarded | ValidCard$ Card.Self | ValidCause$ SpellAbility.OppCtrl | Execute$ TrigReturn | TriggerDescription$ When a spell or ability an opponent controls causes you to discard CARDNAME, return it to your hand.
SVar:TrigReturn:DB$ ChangeZone | Origin$ Graveyard,Exile | Destination$ Hand
SVar:DiscardMeByOpp:1
Oracle:Split second (As long as this spell is on the stack, players can't cast spells or activate abilities that aren't mana abilities.)\nShroud (This creature can't be the target of spells or abilities.)\nWhen a spell or ability an opponent controls causes you to discard Quagnoth, return it to your hand.

View File

@@ -2,7 +2,7 @@ Name:Sand Golem
ManaCost:5
Types:Artifact Creature Golem
PT:3/3
T:Mode$ Discarded | ValidCard$ Card.Self | ValidCause$ Card.OppCtrl | Execute$ DelTrig | TriggerDescription$ When a spell or ability an opponent controls causes you to discard CARDNAME, return CARDNAME from your graveyard to the battlefield with a +1/+1 counter on it at the beginning of the next end step.
T:Mode$ Discarded | ValidCard$ Card.Self | ValidCause$ SpellAbility.OppCtrl | Execute$ DelTrig | TriggerDescription$ When a spell or ability an opponent controls causes you to discard CARDNAME, return CARDNAME from your graveyard to the battlefield with a +1/+1 counter on it at the beginning of the next end step.
SVar:DelTrig:DB$ DelayedTrigger | Mode$ Phase | Phase$ End of Turn | Execute$ TrigReturn | TriggerDescription$ Return CARDNAME from your graveyard to the battlefield with a +1/+1 counter on it at the beginning of the next end step.
SVar:TrigReturn:DB$ ChangeZone | Defined$ Self | Origin$ Graveyard | Destination$ Battlefield | WithCountersType$ P1P1
SVar:DiscardMeByOpp:3

View File

@@ -1,7 +1,7 @@
Name:Spiritual Focus
ManaCost:1 W
Types:Enchantment
T:Mode$ Discarded | ValidCard$ Card.YouCtrl | ValidCause$ Card.OppCtrl | TriggerZones$ Battlefield | Execute$ TrigGainLife | TriggerDescription$ Whenever a spell or ability an opponent controls causes you to discard a card, you gain 2 life and you may draw a card.
T:Mode$ Discarded | ValidCard$ Card.YouCtrl | ValidCause$ SpellAbility.OppCtrl | TriggerZones$ Battlefield | Execute$ TrigGainLife | TriggerDescription$ Whenever a spell or ability an opponent controls causes you to discard a card, you gain 2 life and you may draw a card.
SVar:TrigGainLife:DB$ GainLife | Defined$ You | LifeAmount$ 2 | SubAbility$ DBDraw
SVar:DBDraw:DB$ Draw | NumCards$ 1 | OptionalDecider$ You
Oracle:Whenever a spell or ability an opponent controls causes you to discard a card, you gain 2 life and you may draw a card.