diff --git a/JotunnModStub/Translations/English/compendium.json b/JotunnModStub/Translations/English/compendium.json index 657b743..e3cd39b 100644 --- a/JotunnModStub/Translations/English/compendium.json +++ b/JotunnModStub/Translations/English/compendium.json @@ -218,7 +218,7 @@ "rov_compendium_trenta_secrets_heartwood": "The Secrets of the Heartwood\n", "rov_compendium_trenta_spray_toxic_pollen_bursts_out": "A spray of toxic pollen bursts out to $1 meters: every ally caught in it is healed $2, every foe is poisoned for $3. $4-second cooldown, shortened to $5 seconds while transformed into Muspell.\n", "rov_compendium_trenta_stand_still_daylight_roof_over": "Stand still in daylight, roof over nothing but sky, for $1 unbroken seconds, and roots take hold: $2 ticks of healing follow, $3% of your maximum health apiece, along with a Rested buff lasting $4 minutes - longer with every boss you have felled.\n", - "rov_compendium_trenta_swamp_has_nothing_left_spoil": "The swamp has nothing left to spoil in you. Poison cannot touch you, the Wet effect cannot land on you, and swimming costs no stamina at all.\n", + "rov_compendium_trenta_swamp_has_nothing_left_spoil": "The swamp has nothing left to spoil in you. Poison cannot touch you, the Wet effect cannot land on you, and swimming costs no stamina at all. In the water your stamina even comes back, slowly.\n", "rov_compendium_trenta_swarm_hornets_has_made_its": "A swarm of hornets has made its home in your branches and never leaves. Any foe that comes within $1 meters is stung for $2 poison and pierce damage every $3 seconds until it breaks off or falls.\n", "rov_compendium_trenta_take_shape_young_elder_root": "Take the shape of a young Elder, root and bramble given fury. Left Mouse stomps the ground for $1 damage in a ring around you, Right Mouse looses a root-spike that pierces for $2 - both rising with your Unarmed skill. Purple Rain still answers your call while transformed, on its shorter cooldown.\n", "rov_compendium_trenta_thorns_passive": "[Moder Unlock] Thorns (Passive):", diff --git a/JotunnModStub/Translations/Italian/compendium.json b/JotunnModStub/Translations/Italian/compendium.json index 34ca869..114d323 100644 --- a/JotunnModStub/Translations/Italian/compendium.json +++ b/JotunnModStub/Translations/Italian/compendium.json @@ -218,7 +218,7 @@ "rov_compendium_trenta_secrets_heartwood": "I segreti del durame\n", "rov_compendium_trenta_spray_toxic_pollen_bursts_out": "Uno spruzzo di polline tossico esplode fino a $1 metri: ogni alleato colpito viene curato di $2, ogni nemico viene avvelenato per $3. Ricarica di $4 secondi, ridotta a $5 secondi da trasformato in Muspell.\n", "rov_compendium_trenta_stand_still_daylight_roof_over": "Resta fermo alla luce del giorno, con sopra la testa nient'altro che cielo, per $1 secondi di fila, e le radici attecchiscono: seguono $2 impulsi di cura, ciascuno del $3% della salute massima, insieme a un bonus Riposato di $4 minuti, più lungo per ogni boss che hai abbattuto.\n", - "rov_compendium_trenta_swamp_has_nothing_left_spoil": "La palude non ha più niente da guastare in te. Il veleno non può toccarti, l'effetto Bagnato non può colpirti, e nuotare non costa stamina.\n", + "rov_compendium_trenta_swamp_has_nothing_left_spoil": "La palude non ha più niente da guastare in te. Il veleno non può toccarti, l'effetto Bagnato non può colpirti, e nuotare non costa stamina. In acqua la stamina torna persino, piano piano.\n", "rov_compendium_trenta_swarm_hornets_has_made_its": "Uno sciame di calabroni ha fatto casa tra i tuoi rami e non se ne va più. Ogni nemico che arriva entro $1 metri viene punto per $2 danni da veleno e perforanti ogni $3 secondi, finché non si allontana o cade.\n", "rov_compendium_trenta_take_shape_young_elder_root": "Prendi la forma di un giovane Antico, radici e rovi fatti furia. Il tasto sinistro pesta il terreno per $1 danni in un anello intorno a te, il destro scaglia una punta di radice che perfora per $2, ed entrambi crescono con la tua abilità a mani nude. Purple Rain risponde ancora al tuo richiamo mentre sei trasformato, con la sua ricarica più breve.\n", "rov_compendium_trenta_thorns_passive": "[Sblocco Moder] Spine (passiva):", diff --git a/JotunnModStub/Translations/Russian/compendium.json b/JotunnModStub/Translations/Russian/compendium.json index c1ce95c..366bca7 100644 --- a/JotunnModStub/Translations/Russian/compendium.json +++ b/JotunnModStub/Translations/Russian/compendium.json @@ -218,7 +218,7 @@ "rov_compendium_trenta_secrets_heartwood": "Тайны Сердцевины\n", "rov_compendium_trenta_spray_toxic_pollen_bursts_out": "Выброс токсичной пыльцы в радиусе $1 м: каждый союзник внутри исцеляется на $2 ед., а каждый враг отравляется на $3 ед. урона. Перезарядка: $4 с (сокращается до $5 с в облике Муспелля).\n", "rov_compendium_trenta_stand_still_daylight_roof_over": "Постойте неподвижно под чистым небом при дневном свете в течение $1 с, и корни войдут в почву: последуют $2 тактов исцеления по $3% от макс. здоровья каждый, а также эффект «Бодрость» на $4 минут — время действия растет с каждым павшим боссом.\n", - "rov_compendium_trenta_swamp_has_nothing_left_spoil": "Болотам нечего осквернять в вашем теле. Яд не может навредить вам, эффект сырости не накладывается, а плавание вовсе не расходует выносливость.\n", + "rov_compendium_trenta_swamp_has_nothing_left_spoil": "Болотам нечего осквернять в вашем теле. Яд не может навредить вам, эффект сырости не накладывается, а плавание вовсе не расходует выносливость. В воде выносливость даже понемногу восстанавливается.\n", "rov_compendium_trenta_swarm_hornets_has_made_its": "Рой шершней свил гнездо в вашей кроне. Любой враг, приблизившийся на расстояние ближе $1 м, получает $2 ед. урона ядом и колющими ударами каждые $3 с, пока не отступит или не погибнет.\n", "rov_compendium_trenta_take_shape_young_elder_root": "Примите облик юного Древнего, воплотив ярость корней и терновника. ЛКМ сотрясает землю, нанося $1 ед. урона в круге вокруг вас, а ПКМ выпускает пронзающий корень на $2 ед. урона — мощь обоих приемов зависит от навыка «Без оружия». В этой форме вы по-прежнему можете призывать Purple Rain с уменьшенным временем перезарядки.\n", "rov_compendium_trenta_thorns_passive": "[Награда: Матерь] Шипы (Пассивное):", diff --git a/JotunnModStub/Trenta/TrentaConfigManagement.cs b/JotunnModStub/Trenta/TrentaConfigManagement.cs index 081a808..1eaa602 100644 --- a/JotunnModStub/Trenta/TrentaConfigManagement.cs +++ b/JotunnModStub/Trenta/TrentaConfigManagement.cs @@ -46,6 +46,9 @@ namespace RacesOfValheim public static ConfigEntry PurpleRainHealAmount; public static ConfigEntry PurpleRainPoisonDamage; + // ─── Bonemass (tier 4+, passive) ────────────────────────────────────── + public static ConfigEntry SwimStaminaRegen; + // ─── Last Stand & Thorns (tier 5+) ──────────────────────────────────── public static ConfigEntry LastStandMaxArmorBonus; public static ConfigEntry ThornsReflectPercent; @@ -114,6 +117,10 @@ namespace RacesOfValheim PurpleRainPoisonDamage = config.Bind(purpleRain, "Enemy Poison Damage", 40f, new ConfigDescription("Flat poison damage applied to every enemy hit.", new AcceptableValueRange(0f, 200f))); + const string bonemass = "Trenta - Bonemass"; + SwimStaminaRegen = config.Bind(bonemass, "Swim Stamina Regen", 0.1f, + new ConfigDescription("Share of the normal stamina regen kept while swimming, from Bonemass on. The game stops regen in water entirely, so an empty Trenta used to drown even though swimming is free. 0 is the game's behaviour.", new AcceptableValueRange(0f, 1f))); + const string lastStand = "Trenta - Last Stand & Thorns"; LastStandMaxArmorBonus = config.Bind(lastStand, "Last Stand Max Armor Bonus", 0.5f, new ConfigDescription("Armor multiplier bonus at near-zero health, tier 5+ (0.5 = +50%). Scales down to 0 at full health.", new AcceptableValueRange(0f, 3f))); diff --git a/JotunnModStub/Trenta/TrentaPatches.cs b/JotunnModStub/Trenta/TrentaPatches.cs index 33afad0..6ecb6d2 100644 --- a/JotunnModStub/Trenta/TrentaPatches.cs +++ b/JotunnModStub/Trenta/TrentaPatches.cs @@ -125,6 +125,44 @@ namespace RacesOfValheim } } + /// + /// A trickle of stamina regen while swimming, for a Bonemass-tier Trenta. Vanilla's + /// Player.UpdateStats stops regen outright while swimming off the ground, and drowning starts + /// at 0 stamina, so the free stroke above was not enough: a Trenta who went in empty never + /// got a point back and drowned in water it swims for free. The same formula vanilla uses on + /// land, times Swim Stamina Regen (slow on purpose). + /// + [HarmonyPatch(typeof(Player), "UpdateStats", new[] { typeof(float) })] + public static class Trenta_Player_SwimStaminaRegen_Patch + { + private static readonly AccessTools.FieldRef RegenTimer = + AccessTools.FieldRefAccess("m_staminaRegenTimer"); + + public static void Postfix(Player __instance, float dt) + { + if (__instance != Player.m_localPlayer || !TrentaRace.IsTrenta()) return; + if (BossProgressionManager.GetCurrentProgressionState() < TrentaConfig.BonemassDefeatedState) return; + + // Only where vanilla held regen at zero for the water alone. + if (!__instance.IsSwimming() || __instance.IsOnGround()) return; + if (__instance.InAttack() || __instance.InDodge() || __instance.IsEncumbered()) return; + + float share = TrentaConfigManagement.SwimStaminaRegen.Value; + if (share <= 0f || RegenTimer(__instance) > 0f) return; + + float max = __instance.GetMaxStamina(); + float stamina = __instance.GetStamina(); + if (max <= 0f || stamina >= max) return; + + float regen = __instance.m_staminaRegen + + (1f - stamina / max) * __instance.m_staminaRegen * __instance.m_staminaRegenTimeMultiplier; + float multiplier = 1f; + __instance.GetSEMan().ModifyStaminaRegen(ref multiplier); + + __instance.AddStamina(regen * multiplier * share * dt * Game.m_staminaRegenRate); + } + } + /// /// Blocks the Wet status effect from ever landing on a Bonemass-tier Trenta. ///