Skip to content

Conversation

@Callumvl
Copy link
Contributor

@Callumvl Callumvl commented Jan 2, 2026

Hopefully addresses #12349 + #11443
as well as part of #7750

The previous implementation would suddenly add large discounts on casting a creature/artifact, didn't seem to handle rollbacks, among other issues.

fix #12349, fix #11443

@github-actions github-actions bot added the cards label Jan 2, 2026
Copy link
Contributor

@xenohedron xenohedron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks fine, using common classes is good, but I am confused as to what the problem actually was

@Callumvl
Copy link
Contributor Author

@xenohedron I am still somewhat confused myself on the problem. But happy to provide what I did work out.

The main issue is that Dargo was sometimes being discounted to just R when there had not been a sacrifice that turn (this was an AI match, not sure if relevant). I added some temporary debug messages to where the sac map is incremented and noticed that i seemed to get SACRIFICED_PERMANENT events when i was not expecting (e.g. on casting something), causing the value in the sac map to be incorrect.

To replicate:

  1. Start an AI match with Dargo as one of the commanders.
  2. Add 5 Lotus Petal to hand.
  3. Cast 1 Lotus Petal.
  4. Dargo appears as castable for R (should be 6R)
  5. Cast Dargo using the Lotus Petal (should have cost 4R with a -2 reduction from the Lotus Petal sacrifice)

While looking into this I also noticed a secondary issue, using the rollback function does not reset the sacrifices for that turn. So on a turn where Dargo costs 6R, if the cost is reduced via sacrifices to R, then the turn is rolled back, he will still cost R without having to sacrifice anything.

Hope that clarifies things somewhat,
Cheers!

@xenohedron
Copy link
Contributor

Interesting. The AI does simulate the game state, which effectively involves firing various events and rolling back, and those simulations do get caught by print statements. You can wrap in if (!game.isSimulation()) { } if needed. But those simulated states should not be getting picked up by the watcher, not sure what the cause might be.

So you confirm that you can no longer reproduce those bugs with the code in this PR?

@Callumvl
Copy link
Contributor Author

@xenohedron Thanks for the suggestion. I believe I may have found the culprit, all of the increases were related to simulated events, the problem was that the sacMap was static,. After removing that part of the declaration, the bugs are also fixed.

Yes, i can confirm :)

@JayDi85
Copy link
Member

JayDi85 commented Jan 14, 2026

@xenohedron looks like there are many buggy places with same code style (wrong usage of static fields). Created related issue: #14249

@xenohedron
Copy link
Contributor

Oh good catch, that certainly explains it

@xenohedron xenohedron merged commit 3e216ae into magefree:master Jan 15, 2026
4 checks passed
@Callumvl Callumvl deleted the Fix-Dargo branch January 15, 2026 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dargo, the Shipwrecker casting Issue Dargo isn't being discounted

3 participants