Add Aswid passive lifesteal scaling with progression state
This commit is contained in:
parent
9c64ed0072
commit
55d2cc97bb
2 changed files with 29 additions and 11 deletions
|
|
@ -654,22 +654,38 @@ namespace RacesOfValheim
|
||||||
{
|
{
|
||||||
if (hit == null || __instance == null || __instance.IsPlayer()) return;
|
if (hit == null || __instance == null || __instance.IsPlayer()) return;
|
||||||
|
|
||||||
// Check if it died from this hit
|
|
||||||
if (__state > 0f && __instance.GetHealth() <= 0f)
|
|
||||||
{
|
|
||||||
Jotunn.Logger.LogInfo($"[AswidDebug] {__instance.name} died. __state: {__state}, CurrentHP: {__instance.GetHealth()}");
|
|
||||||
Character attacker = hit.GetAttacker();
|
Character attacker = hit.GetAttacker();
|
||||||
if (attacker != null) Jotunn.Logger.LogInfo($"[AswidDebug] Attacker is: {attacker.name} / Player: {attacker.IsPlayer()} / Local: {attacker == Player.m_localPlayer}");
|
|
||||||
|
|
||||||
if (attacker != null && attacker.IsPlayer() && attacker == Player.m_localPlayer)
|
if (attacker != null && attacker.IsPlayer() && attacker == Player.m_localPlayer)
|
||||||
{
|
{
|
||||||
ZNetView nview = attacker.GetComponent<ZNetView>();
|
ZNetView nview = attacker.GetComponent<ZNetView>();
|
||||||
if (nview != null && nview.IsValid() && nview.GetZDO().GetString("RacesOfValheim_Race", "Human") == "Aswid")
|
if (nview != null && nview.IsValid() && nview.GetZDO().GetString("RacesOfValheim_Race", "Human") == "Aswid")
|
||||||
{
|
{
|
||||||
|
float physDamage = hit.m_damage.m_blunt + hit.m_damage.m_slash + hit.m_damage.m_pierce + hit.m_damage.m_chop + hit.m_damage.m_pickaxe + hit.m_damage.m_damage;
|
||||||
|
|
||||||
|
// On-hit Lifesteal
|
||||||
|
if (physDamage > 0f)
|
||||||
|
{
|
||||||
|
int currentState = BossProgressionManager.GetCurrentProgressionState();
|
||||||
|
var rules = AswidProgression.GetRules(currentState);
|
||||||
|
float lifesteal = rules.LifestealPercent;
|
||||||
|
if (EnvMan.instance != null && EnvMan.IsNight())
|
||||||
|
{
|
||||||
|
lifesteal *= 2f;
|
||||||
|
}
|
||||||
|
if (lifesteal > 0f)
|
||||||
|
{
|
||||||
|
float healAmount = physDamage * lifesteal;
|
||||||
|
Player.m_localPlayer.Heal(healAmount, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// On-death Devour
|
||||||
|
if (__state > 0f && __instance.GetHealth() <= 0f)
|
||||||
|
{
|
||||||
|
Jotunn.Logger.LogInfo($"[AswidDebug] {__instance.name} died. __state: {__state}, CurrentHP: {__instance.GetHealth()}");
|
||||||
Jotunn.Logger.LogInfo($"[AswidDebug] Attacker is local Aswid player. Checking damage type...");
|
Jotunn.Logger.LogInfo($"[AswidDebug] Attacker is local Aswid player. Checking damage type...");
|
||||||
|
|
||||||
// Check if physical attack
|
if (physDamage > 0f)
|
||||||
if (hit.m_damage.m_blunt > 0 || hit.m_damage.m_slash > 0 || hit.m_damage.m_pierce > 0 || hit.m_damage.m_chop > 0 || hit.m_damage.m_pickaxe > 0 || hit.m_damage.m_damage > 0)
|
|
||||||
{
|
{
|
||||||
Jotunn.Logger.LogInfo($"[AswidDebug] Calling TryConsumeMob for {__instance.name}");
|
Jotunn.Logger.LogInfo($"[AswidDebug] Calling TryConsumeMob for {__instance.name}");
|
||||||
AswidRace.TryConsumeMob(__instance, __instance.GetMaxHealth());
|
AswidRace.TryConsumeMob(__instance, __instance.GetMaxHealth());
|
||||||
|
|
|
||||||
|
|
@ -23,11 +23,13 @@ namespace RacesOfValheim
|
||||||
public float BonusHealth = 0f;
|
public float BonusHealth = 0f;
|
||||||
public float BonusStamina = 0f;
|
public float BonusStamina = 0f;
|
||||||
public bool HasSurtlingForm = false;
|
public bool HasSurtlingForm = false;
|
||||||
|
public float LifestealPercent = 0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AswidRules GetRules(int state)
|
public static AswidRules GetRules(int state)
|
||||||
{
|
{
|
||||||
AswidRules rules = new AswidRules();
|
AswidRules rules = new AswidRules();
|
||||||
|
rules.LifestealPercent = (state * 2f) / 100f; // 2% per state
|
||||||
|
|
||||||
// State 0 is the base state, no modifiers yet.
|
// State 0 is the base state, no modifiers yet.
|
||||||
if (state >= 1)
|
if (state >= 1)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue