fix: restore compatibility with latest Slay the Spire 2 build - #121
Closed
mwijffelaars wants to merge 1 commit into
Closed
fix: restore compatibility with latest Slay the Spire 2 build#121mwijffelaars wants to merge 1 commit into
mwijffelaars wants to merge 1 commit into
Conversation
A recent game update changed three APIs the mod binds to directly. Because MonoMod JIT-compiles these methods, the missing members make whole methods fail to compile at runtime: combat state reads throw MissingMethodException on CombatManager.get_IsPlayPhase(), and the shop/target code paths break the same way. - CombatManager.IsPlayPhase was removed. Add IsPlayPhaseCompat() which reconstructs "player's interactive turn" from members that still exist (IsInProgress && !IsEnemyTurnStarted && !EndingPlayerTurnPhaseOne && !EndingPlayerTurnPhaseTwo) and route all references through it. - player.Creature.CombatState now returns ICombatState instead of the concrete CombatState; widen ResolveTarget() to take the interface (it only uses GetCreature()/Enemies, both on ICombatState). - MerchantRoom.Inventory was removed; use MerchantRoom.GetLocalInventory() at the two call sites. Builds clean against the current game assemblies and verified in-game (combat state reads and shop). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Author
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.
A recent Slay the Spire 2 update changed three game APIs the mod binds to directly. Because MonoMod JIT-compiles these methods, the missing members make whole methods fail to compile at runtime — combat state reads throw
MissingMethodExceptiononCombatManager.get_IsPlayPhase(), and the shop / card-target paths break the same way.Symptom reported in the wild (combat):
Changes
CombatManager.IsPlayPhasewas removed. Added anIsPlayPhaseCompat()helper that reconstructs "it's the player's interactive turn" from members that still exist (IsInProgress && !IsEnemyTurnStarted && !EndingPlayerTurnPhaseOne && !EndingPlayerTurnPhaseTwo) and routed all 7 references through it. It leans permissive on purpose — every action guard also checksPlayerActionsDisabledright after, which covers transient action locks.player.Creature.CombatStatenow returnsICombatStaterather than the concreteCombatState. WidenedResolveTarget()'s parameter to the interface; it only usesGetCreature()/Enemies, both present onICombatState, andCombatStateimplements it, so all callers still bind.MerchantRoom.Inventorywas removed. Switched the two call sites to the newMerchantRoom.GetLocalInventory().Verification
Built clean (0 warnings, 0 errors) against the current game assemblies, and verified in-game: combat state reads and shop both work again. The removed/renamed members were confirmed against the current
sts2.dllvia metadata inspection.