Adv 2.0 L4d reader flip: pet helpers off AdvCharacter to PetState

All ten helpers in adventure_pets.go now take PetState (or *PetState
for petGrantXP) instead of *AdventureCharacter. mistyHousingHint takes
raw NPC counters since Misty fields stay on AdvCharacter for a later
phase. mistyReactivatePet returns bool; caller flips both stores.

DeathTransitionParams gained Pet PetState so combat_bridge no longer
touches the DB; arena caller loads PetState. PetState.HasPet() mirrors
AdvCharacter's. petMidnightCheck loads PetState per char.

L4 grep-empty exit criterion now holds for adventure_pets.go.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
prosolis
2026-05-09 11:07:40 -07:00
parent 0004a2e35c
commit 81cce0169f
9 changed files with 147 additions and 148 deletions

View File

@@ -312,6 +312,7 @@ func applyXPBonuses(p XPBonusParams) XPResult {
type DeathTransitionParams struct {
Char *AdventureCharacter
Equip map[EquipmentSlot]*AdvEquipment
Pet PetState // pet state for ditch-recovery roll; zero value disables
ChatLevel int
Location string // set as GrudgeLocation; empty = don't set
Source string // death source: "adventure" | "arena" — recorded on Kill()
@@ -374,8 +375,8 @@ func transitionDeath(p DeathTransitionParams) DeathTransitionResult {
}
r.Died = true
if petRollDitchRecovery(p.Char) && p.Char.DeadUntil != nil {
reduced := time.Now().UTC().Add(petDitchRecoveryTime(p.Char.PetLevel))
if petRollDitchRecovery(p.Pet) && p.Char.DeadUntil != nil {
reduced := time.Now().UTC().Add(petDitchRecoveryTime(p.Pet.Level))
p.Char.DeadUntil = &reduced
r.PetRecovered = true
}