Card-Forge / forge

An unofficial rules engine for the world's greatest card game.
https://card-forge.github.io/forge/
GNU General Public License v3.0
935 stars 547 forks source link

Source information can be invalidated when static abilities involved #1922

Open tool4ever opened 1 year ago

tool4ever commented 1 year ago
  1. Cast World Breaker with a target for its cast trigger
  2. Counter the spell
  3. Observe the ability turns green: grafik
  4. The Ability can now be retargeted with e.g. Bolt Bend onto Gaea's Revenge even though it has "can't be the target of nongreen spells or abilities from nongreen sources" (as long as it has one of the required card types)

The problem is the Devoid static gets removed from the old zone card.

Hanmac commented 1 year ago

@tool4ever i have seen something similar with Jadzi the MDFC when using her trigger to cast a second version of the same card from the libary, but as a Spell Side

github-actions[bot] commented 1 year ago

This issue has not been updated in a while and has now been marked as stale. Stale messages will be auto closed.

github-actions[bot] commented 1 year ago

This issue has not been updated in a while and has now been marked as stale. Stale messages will be auto closed.

tool4ever commented 1 year ago

@Hanmac I don't know a better fix than the one I suggested here: #1771

Would also save us a decent amount of remembering across different cards imo

Hanmac commented 1 year ago

@Hanmac I don't know a better fix than the one I suggested here: #1771

Would also save us a decent amount of remembering across different cards imo

  1. i don't understand why it can become green, shouldn't Devoid stop that?
  2. i think the trigger on the stack should use LKI for the HostCard, so it doesn't change when the Card is removed from stack?
  3. i think what would help here is if i finally have time to implement game-timestamp so we better keep track on if the card should be treated as new object or not
tool4ever commented 1 year ago

Since Devoid is done as static if the Card leaves the stack StaticEffect.remove will remove colorless and then it won't be applied to the old card again

The trigger can't use LKI by default because it should still see changes to its source while it's on the stack

Hanmac commented 1 year ago

@tool4ever then maybe when the card is removed from the stack, it should set the host of the remaining trigger to LKI before the StaticEffect is removed?

tool4ever commented 1 year ago

Ugh it's problematic (multiple tests/cards breaking) because lots of effects store their getHostCard in a variable at the start. Now if GameAction.changeZone switches host to LKI when returning to effect code any Remember$ params will use the old host and 💣

So that approach would probably need a pretty big refactor and then still leave a lingering risk of wrong object reusage...

@tehdiplomat do you have a good idea?

tehdiplomat commented 1 year ago

This sounds similar to other things I've seen where the card really needs to be a Card + Timestamp. And if Card + Timestamp isn't actively in a zone, then we need to go fetch it in LKI.