fix(elf-x): apply mana reduction in the same turn as summon#394
Open
Shahrukh95 wants to merge 2 commits into
Open
fix(elf-x): apply mana reduction in the same turn as summon#394Shahrukh95 wants to merge 2 commits into
Shahrukh95 wants to merge 2 commits into
Conversation
sindreslungaard
requested changes
Apr 25, 2026
sindreslungaard
left a comment
Owner
There was a problem hiding this comment.
looks good, minor touch on the SpawnCard return value
sindreslungaard
approved these changes
Apr 25, 2026
DragosIonita23
approved these changes
Jun 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Summary
Elf-X's mana reduction was not applying in the same turn it was summoned. The persistent effect was registered but not yet invoked when
BroadcastStateran, so creatures in hand required their full cost. This is fixed by applying the discount immediately onInTheBattlezonebeforeBroadcastStateruns.Additionally, in the dev environment, cards added mid-turn via
/addor/initalso did not receive the same-turn discount because they missed that turn'sUntapStep, leavingcnd.Creatureunset. This is fixed by running spawned cards through a syntheticUntapStepon creation.Closes #379
🐞 Bugs Fixed
/addor/initmid-turn now also receive the same-turn discount🔧 Other Changes
sim/game/cards/dm02/tree_folk.go: Added an immediateapplyDiscount()call inside theInTheBattlezonehandler, beforeApplyPersistentEffect. The discount logic is extracted into a localapplyDiscountclosure, used in both theInTheBattlezonehandler and the persistent effect.sim/game/match/match.go: After eachSpawnCard, the new card's handlers are run with a syntheticUntapStepcontext. This is because cards spawned mid-turn via/addor/initmiss that turn'sUntapStep, so they lackcnd.Creaturefor the remainder of the turn. This caused same-turn discount to fail for those cards (next-turn worked fine sinceUntapStepwould catch them).sim/game/match/player.go:SpawnCardnow returns*Cardinstead of nothing. This is to givespawnCardsToGivenZonesinsim/game/match/match.goaccess to the newly created card for initialization.✅ Checklist
Please confirm the following before submitting your PR:
📸 Screenshots (if applicable)
No changes to the frontend