Initial commit
This commit is contained in:
commit
c4a24c9fdf
142 changed files with 15491 additions and 0 deletions
56
JotunnModStub/RaceHostilityManager.cs
Normal file
56
JotunnModStub/RaceHostilityManager.cs
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RacesOfValheim
|
||||
{
|
||||
// --- RACE HOSTILITY MANAGER ---
|
||||
// This script manages which mobs should not attack the player based on their race.
|
||||
// For now, it manages wolves, ulvs, fenrings, and cultists for the Fenrir race.
|
||||
|
||||
[HarmonyPatch(typeof(BaseAI), nameof(BaseAI.IsEnemy), new System.Type[] { typeof(Character), typeof(Character) })]
|
||||
public static class RaceHostilityManager
|
||||
{
|
||||
public static void Postfix(Character a, Character b, ref bool __result)
|
||||
{
|
||||
if (!__result) return; // If already not enemies, skip
|
||||
|
||||
if (a == null || b == null) return;
|
||||
|
||||
Character playerCharacter = a.IsPlayer() ? a : (b.IsPlayer() ? b : null);
|
||||
Character monster = a.IsPlayer() ? b : (b.IsPlayer() ? a : null);
|
||||
|
||||
if (playerCharacter != null && monster != null)
|
||||
{
|
||||
Player p = playerCharacter as Player;
|
||||
if (p != null)
|
||||
{
|
||||
// Fenrir Race Logic
|
||||
if (p.m_customData.ContainsKey("Race") && p.m_customData["Race"] == "Fenrir")
|
||||
{
|
||||
string prefabName = monster.gameObject.name.ToLower();
|
||||
if (prefabName.Contains("wolf") || prefabName.Contains("fenring") ||
|
||||
prefabName.Contains("ulv") || prefabName.Contains("cultist"))
|
||||
{
|
||||
__result = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Aswid Race Logic
|
||||
if (p.m_customData.ContainsKey("Race") && p.m_customData["Race"] == "Aswid")
|
||||
{
|
||||
string prefabName = monster.gameObject.name.ToLower();
|
||||
int state = BossProgressionManager.GetCurrentProgressionState();
|
||||
|
||||
if (state >= 2 && prefabName.Contains("boar")) __result = false;
|
||||
if (state >= 3 && prefabName.Contains("bear")) __result = false;
|
||||
if (state >= 4 && (prefabName.Contains("leech") || prefabName.Contains("ghost") || prefabName.Contains("wraith"))) __result = false;
|
||||
if (state >= 5 && prefabName.Contains("wolf")) __result = false;
|
||||
if (state >= 6 && (prefabName.Contains("lox") || prefabName.Contains("deathsquito"))) __result = false;
|
||||
if (state >= 7 && (prefabName.Contains("hare") || prefabName.Contains("gjall"))) __result = false;
|
||||
if (state >= 8 && (prefabName.Contains("asksvin") || prefabName.Contains("volture") || prefabName.Contains("vulture") || prefabName.Contains("valkyrie"))) __result = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue