Initial commit
This commit is contained in:
commit
c4a24c9fdf
142 changed files with 15491 additions and 0 deletions
97
JotunnModStub/Fenrir/FenrirPatches.cs
Normal file
97
JotunnModStub/Fenrir/FenrirPatches.cs
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
using System.Collections;
|
||||
using BepInEx;
|
||||
using HarmonyLib;
|
||||
using Jotunn.Configs;
|
||||
using Jotunn.Entities;
|
||||
using Jotunn.Managers;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI; // Added for UI
|
||||
|
||||
namespace RacesOfValheim
|
||||
{
|
||||
[HarmonyPatch(typeof(Character), nameof(Character.StartAttack))]
|
||||
public static class BlockPlayerLogicAttackPatch
|
||||
{
|
||||
public static bool Prefix(Character __instance)
|
||||
{
|
||||
if (__instance != null && __instance == Player.m_localPlayer)
|
||||
{
|
||||
if (__instance.GetSEMan().HaveStatusEffect("SE_FenrirForm".GetStableHashCode()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// --- PATCH 2: BLOCCO ANIMAZIONI ED EFFETTI SONORI NATIVI ---
|
||||
[HarmonyPatch(typeof(ZSyncAnimation), nameof(ZSyncAnimation.SetTrigger))]
|
||||
public static class BlockPlayerAnimationsPatch
|
||||
{
|
||||
public static bool Prefix(ZSyncAnimation __instance, string name)
|
||||
{
|
||||
if (Player.m_localPlayer != null && __instance.gameObject == Player.m_localPlayer.gameObject)
|
||||
{
|
||||
if (Player.m_localPlayer.GetSEMan().HaveStatusEffect("SE_FenrirForm".GetStableHashCode()))
|
||||
{
|
||||
string triggerName = name.ToLower();
|
||||
if (triggerName.Contains("attack") || triggerName.Contains("swing") || triggerName.Contains("punch"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch]
|
||||
public static class FenrirDamagePatch
|
||||
{
|
||||
[HarmonyTargetMethod]
|
||||
public static System.Reflection.MethodBase TargetMethod()
|
||||
{
|
||||
return System.Linq.Enumerable.FirstOrDefault(
|
||||
HarmonyLib.AccessTools.GetDeclaredMethods(typeof(ItemDrop.ItemData)),
|
||||
m => m.Name == "GetDamage" && m.ReturnType == typeof(HitData.DamageTypes)
|
||||
);
|
||||
}
|
||||
public static void Postfix(ItemDrop.ItemData __instance, ref HitData.DamageTypes __result)
|
||||
{
|
||||
if (Player.m_localPlayer != null &&
|
||||
Player.m_localPlayer.GetSEMan().HaveStatusEffect("SE_FenrirCurse".GetStableHashCode()) &&
|
||||
Player.m_localPlayer.GetInventory().ContainsItem(__instance))
|
||||
{
|
||||
int state = BossProgressionManager.GetCurrentProgressionState();
|
||||
if (state > 0)
|
||||
{
|
||||
float bonus = FenrirProgression.GetDamageBonus(state);
|
||||
|
||||
if (__result.m_slash > 0) __result.m_slash += bonus;
|
||||
if (__result.m_blunt > 0) __result.m_blunt += bonus;
|
||||
if (__result.m_pierce > 0) __result.m_pierce += bonus;
|
||||
if (__result.m_chop > 0) __result.m_chop += bonus;
|
||||
if (__result.m_pickaxe > 0) __result.m_pickaxe += bonus;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(Player), nameof(Player.GetBodyArmor))]
|
||||
public static class FenrirArmorPatch
|
||||
{
|
||||
public static void Postfix(Player __instance, ref float __result)
|
||||
{
|
||||
if (__instance != null && __instance == Player.m_localPlayer)
|
||||
{
|
||||
if (__instance.GetSEMan().HaveStatusEffect("SE_FenrirCurse".GetStableHashCode()))
|
||||
{
|
||||
int state = BossProgressionManager.GetCurrentProgressionState();
|
||||
__result += FenrirProgression.GetArmorBonus(state);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue