Card-Forge / forge

An unofficial rules engine for the world's greatest card game.
GNU General Public License v3.0
889 stars 536 forks source link

Volrath's Shapeshifter with Triskelion as topmost card of graveyard causes stack overflow #4723

Open jumpinjackie opened 5 months ago

jumpinjackie commented 5 months ago

Describe the bug

If you resolve a Volrath's Shapeshifter and the topmost card of your graveyard is a Triskelion, the game will stack overflow and the game log is spammed with Volrath's Shapeshifter (as Triskelion?) coming into play with 3 +1/+1 counters over and over.

To Reproduce

  1. Get Triskelion into your graveyard
  2. Resolve a Volrath's Shapeshifter with Triskelion as the topmost card in your GY

Expected behavior

Volrath's Shapeshifter comes into play as a copy of Triskelion with 3 +1/+1 counters

Screenshots

2024-02-21 22_07_24-Forge_ 1 6 60-SNAPSHOT

Copy of the stack trace from the crash dialog attached as well

stacktrace.txt

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

Hanmac commented 5 months ago

@tool4ever the Problem is the CloneState Replacement Effect getting copied. also the Special check for if the ReplacementEffect has already been run for etb ones uses special logic for ones gained by StaticAbilities

maybe that helps to pinpoint the problem?

tool4ever commented 5 months ago

@Hanmac I have it almost fixed like this: image

But I think there is another logic error in the GainTextOf$ logic: currently it would add the RE twice

this results in it getting double the counters

how can we prevent that? 🤔

Hanmac commented 5 months ago

CloneText should probably only copy the Intrinsic Replacement Effects (the ones directly in state)

But I need to debug it

github-actions[bot] commented 4 months ago

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