feat(furling): the five crops

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Ferdinando 2026-08-07 17:02:48 +02:00
commit e8a0bff0a6
3 changed files with 589 additions and 18 deletions

View file

@ -46,6 +46,30 @@ namespace RacesOfValheim
}
}
/// <summary>
/// The Furling's truce with the Plains. Every name here is the game's actual internal prefab
/// id, checked against the shipped asset manifest one at a time, because the display names do
/// not predict them at all - this is the family where "Fuling" is the word the game shows the
/// player and "Goblin" is the word the game uses in code.
///
/// The full roster under Assets/Characters, so nothing is missed by accident:
/// Goblin ............... Fuling (NOT "Fuling" - that prefab does not exist)
/// GoblinArcher ......... Fuling Archer (was missing entirely)
/// GoblinBrute .......... Fuling Berserker
/// GoblinShaman ......... Fuling Shaman
/// GoblinKing ........... Yagluth - a boss, stays hostile
/// GoblinBruteBros, GoblinBrute_Hildir, GoblinShaman_Hildir (+ _nochest variants)
/// Hildir's quest bosses - arena fights, they stay hostile too
/// The old code checked for "goblinking" inside a branch it could never reach, which is a
/// good sign the list was written from the display names rather than from the assets.
/// </summary>
private static readonly System.Collections.Generic.HashSet<string> FurlingFriends =
new System.Collections.Generic.HashSet<string>
{
"Goblin", "GoblinArcher", "GoblinBrute", "GoblinShaman",
"Lox", "Deathsquito", "Troll",
};
[HarmonyPatch(typeof(BaseAI), "IsEnemy", typeof(Character), typeof(Character))]
public static class Furling_BaseAI_IsEnemy_Patch
{
@ -59,23 +83,12 @@ namespace RacesOfValheim
if (a == playerChar) otherChar = b;
else if (b == playerChar) otherChar = a;
if (otherChar != null)
{
string name = otherChar.gameObject.name.Replace("(Clone)", "").ToLower();
if (name == "goblin" ||
name == "goblinbrute" ||
name == "goblinshaman" ||
name == "lox" ||
name == "deathsquito" ||
name == "troll")
{
// Exclude minibosses/bosses explicitly if needed, but normally bosses are handled separately (Yagluth is GoblinKing).
if (name != "goblinking")
{
__result = false;
}
}
}
if (otherChar == null) return;
// Trimmed as well as stripped: a stray "(Clone)" leaves a trailing space behind, and
// an exact-match set is unforgiving about it in a way the old ToLower chain also was.
string name = otherChar.gameObject.name.Replace("(Clone)", "").Trim();
if (FurlingFriends.Contains(name)) __result = false;
}
}