Skip to content

fix(plantheal): retry hug after EV recast instead of exiting#2

Closed
MahtraDR wants to merge 2 commits intomainfrom
fix-plantheal-ev-recast-retry
Closed

fix(plantheal): retry hug after EV recast instead of exiting#2
MahtraDR wants to merge 2 commits intomainfrom
fix-plantheal-ev-recast-retry

Conversation

@MahtraDR
Copy link
Owner

Summary

Fixes a bug where plantheal would exit immediately after recasting EV instead of retrying the hug with the fresh plant.

Problem

When hugging a Vela'Tohr plant, if the game returns:

  • "appreciates the sentiment" - plant has no wounds to transfer
  • "no empathic bond" - bond is broken

...the script correctly releases and recasts EV to create a fresh plant. However, it then immediately exits with:

**Stopped before hugging** (bleeding, threshold, hug_count, or plant disappeared). Check logs above for details.

This happens because after release_and_recast_ev, the code returned HugResult.new(0, :stopped_early) which triggers the exit path in run_loop.

Solution

After recasting EV, the script now retries the hug with the fresh plant instead of exiting:

when HUG_APPRECIATES
  DRC.message("Hug returned 'appreciates the sentiment' — **releasing and recasting EV**.")
  release_and_recast_ev
  # Fresh plant should have wounds now - retry the hug
  return hug_plant_once(retries - 1)  # <-- NEW: retry instead of exit

A retry counter (MAX_HUG_RETRIES = 3) prevents infinite loops if EV keeps failing.

Changes

  • Add MAX_HUG_RETRIES constant (default 3)
  • Add retries parameter to hug_plant_once() method
  • HUG_APPRECIATES case: recast EV → retry hug (decrement counter)
  • "no empathic bond" case: recast EV → retry hug (decrement counter)
  • Add max retries guard at method entry to prevent infinite recursion

Testing

Verified in-game that the script now:

  1. Detects "appreciates the sentiment" response
  2. Releases and recasts EV
  3. Retries the hug with the fresh plant
  4. Successfully transfers wounds and continues training

🤖 Generated with Claude Code

MahtraDR and others added 2 commits February 13, 2026 16:07
When the hug returns "appreciates the sentiment" (plant has no wounds)
or "no empathic bond" (bond broken), the script correctly releases and
recasts EV, but then immediately exits with "Stopped before hugging"
instead of retrying with the fresh plant.

This fix changes the behavior to retry the hug (up to 3 times) after
recasting EV, which allows the script to continue training empathy
with the fresh plant that now has wounds to transfer.

Changes:
- Add MAX_HUG_RETRIES constant (default 3) for recursion guard
- Add retries parameter to hug_plant_once() method
- After "appreciates the sentiment" → recast EV → retry hug
- After "no empathic bond" → recast EV → retry hug
- Add max retries check to prevent infinite loops

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add spec for MAX_HUG_RETRIES constant (value 3)
- Add spec for retry exhaustion returning stopped_early
- Add spec for retry after HUG_APPRECIATES response
- Add spec for retry after "no empathic bond" response
- Add spec verifying retry counter decrements on each retry

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@MahtraDR MahtraDR closed this Feb 13, 2026
@MahtraDR MahtraDR deleted the fix-plantheal-ev-recast-retry branch February 13, 2026 03:17
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