Skip to content

fix: 修复打完boss不回血的问题 restore HP between acts using original game formula#83

Open
tianyumyum wants to merge 1 commit into
wuhao21:mainfrom
tianyumyum:fix/between-act-healing
Open

fix: 修复打完boss不回血的问题 restore HP between acts using original game formula#83
tianyumyum wants to merge 1 commit into
wuhao21:mainfrom
tianyumyum:fix/between-act-healing

Conversation

@tianyumyum
Copy link
Copy Markdown

Problem

In headless mode, player HP is not restored when transitioning between acts. After
defeating the Act 1 Boss, the player enters Act 2 with the same HP instead of being healed.

Example from game log:

  • Act 1 end: HP = 22/80
  • Act 2 start: HP = 22/80 (should be 80/80 at A0, or ~69/80 at A2+)

Root Cause

Between-act healing is handled by AncientEventModel.BeforeEventStarted, which is
triggered via Godot transition callbacks during the act transition animation. In headless
mode, GodotStubs no-ops these callbacks, so the healing never fires.

Fix

Add HealBetweenActs() after both EnterNextAct() call sites, replicating the original
formula from the game engine IL:

healAmount = MaxHp - CurrentHp                                                           
if Ascension >= 2: healAmount *= 0.8                                                     
                                                                                           
- Only triggers when RoomType == Boss → next act (not between regular combats)             
- Safe against double-healing: if the engine already healed (missingHp <= 0), it no-ops

In the real game, AncientEventModel.BeforeEventStarted heals the player
between acts. In headless mode, Godot transition callbacks are no-oped
so this never fires.

Replicate the exact formula from sts2.dll IL:
  healAmount = MaxHp - CurrentHp
  if Ascension >= 2: healAmount *= 0.8

This matches the game engine behavior including the Ascension 2+ penalty.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant