feat(factions): no raids made only of allies, and allies spare the whole base
A raid whose every spawn is at peace with the player's race is struck from the list the client sends as possibleEvents, and from the server's valid event points when raids are world-based. The structure veto covered only 20 m from the creature, but FindClosestStaticPriorityTarget searches the whole view range. It now holds while any allied player is within 100 m, and reads the per-race lists too.
This commit is contained in:
parent
5807e562ad
commit
df9c768f92
5 changed files with 291 additions and 107 deletions
|
|
@ -40,111 +40,119 @@ namespace RacesOfValheim
|
|||
// but the local client (e.g. a dedicated server owning the mob's AI).
|
||||
string playerRace = FactionHostilityPatch.GetPlayerRace(p);
|
||||
|
||||
// Fenrir Race Logic
|
||||
if (playerRace == "Fenrir")
|
||||
if (IsRaceKin(playerRace, monster.gameObject.name))
|
||||
{
|
||||
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 (playerRace == "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;
|
||||
}
|
||||
|
||||
// Draugh Race Logic
|
||||
if (playerRace == "Draugh")
|
||||
{
|
||||
string prefabName = monster.gameObject.name.ToLower();
|
||||
if (prefabName.Contains("skeleton") || prefabName.Contains("draugr") ||
|
||||
prefabName.Contains("ghost") || prefabName.Contains("wraith"))
|
||||
{
|
||||
__result = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Trenta Race Logic - base passive, live from the start (no progression
|
||||
// gate, unlike Aswid's escalating list above).
|
||||
//
|
||||
// IsEnemy=false is the only lever this patch has, and it produces one
|
||||
// behaviour: the mob never initiates. It reads as two different relationships
|
||||
// only in flavour text - Greyling/Greydwarf/Leech/Deathsquito "don't see" a
|
||||
// Trenta as prey (root-kin, or simply nothing with blood to sense), while
|
||||
// Fuling/Troll "choose" not to fight one - but there is no third state to code
|
||||
// for. Striking first is handled, though not by the AI on its own as this
|
||||
// comment used to claim: MonsterAI.UpdateTarget discards any target IsEnemy
|
||||
// calls a non-enemy, so retaliation needed RaceGrudge, checked at the top of
|
||||
// this method.
|
||||
if (playerRace == TrentaConfig.RaceId)
|
||||
{
|
||||
string prefabName = monster.gameObject.name.ToLower();
|
||||
|
||||
// "fuling" matched nothing: the Fuling family's prefabs are Goblin,
|
||||
// GoblinArcher, GoblinBrute and GoblinShaman, so the Trenta's truce with them
|
||||
// never existed despite this file and TrentaConfig both describing it.
|
||||
// Unlike the other entries here, the goblin name needs its bosses carved back
|
||||
// out - Yagluth is GoblinKing, and Hildir's arena pair are GoblinBruteBros /
|
||||
// *_Hildir - because a substring test would otherwise pacify all three.
|
||||
bool isGoblinKin = prefabName.Contains("goblin")
|
||||
&& !prefabName.Contains("goblinking")
|
||||
&& !prefabName.Contains("hildir")
|
||||
&& !prefabName.Contains("brutebros");
|
||||
|
||||
if (prefabName.Contains("greyling") || prefabName.Contains("greydwarf") ||
|
||||
isGoblinKin || prefabName.Contains("troll") ||
|
||||
prefabName.Contains("leech") || prefabName.Contains("deathsquito"))
|
||||
{
|
||||
__result = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Sverm Race Logic - Hive Pheromones. No progression gate at all, unlike
|
||||
// Aswid's escalating list: an invertebrate is kin from the first minute.
|
||||
//
|
||||
// That absence of a gate is doing real work rather than saving a few lines.
|
||||
// Every invertebrate in the game lives from the Swamp onward, so a gated
|
||||
// version would have handed the race nothing until Bonemass; ungated, a
|
||||
// newborn Sverm walks through leeches and deathsquitoes, which is the whole
|
||||
// of its early game.
|
||||
//
|
||||
// Bonemass is deliberately NOT here. It is a mass of ooze and it would
|
||||
// qualify, but a boss that ignores the player is not a boss.
|
||||
if (playerRace == SvermConfig.RaceId)
|
||||
{
|
||||
string prefabName = monster.gameObject.name.ToLower();
|
||||
|
||||
// "blob" covers Blob, BlobElite, BlobTar and the Ashlands lava blob
|
||||
// whatever it turns out to be called - which is why the one prefab name
|
||||
// still unconfirmed in the design doc costs nothing here.
|
||||
// "seeker" covers Seeker, SeekerBrood, SeekerBrute and SeekerQueen.
|
||||
bool isKin = prefabName.Contains("blob")
|
||||
|| prefabName.Contains("leech")
|
||||
|| prefabName.Contains("tick")
|
||||
|| prefabName.Contains("deathsquito")
|
||||
|| prefabName.Contains("gjall")
|
||||
|| prefabName.Contains("seeker");
|
||||
|
||||
if (isKin && !prefabName.Contains("bonemass"))
|
||||
{
|
||||
__result = false;
|
||||
}
|
||||
__result = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The per-race lists by name alone, so the raid filter can ask about a prefab that was
|
||||
// never spawned (FactionRaids reads RandomEvent.m_spawn). Substring matching, as before.
|
||||
public static bool IsRaceKin(string playerRace, string monsterName)
|
||||
{
|
||||
if (playerRace == null || monsterName == null) return false;
|
||||
string prefabName = monsterName.ToLower();
|
||||
|
||||
// Fenrir Race Logic
|
||||
if (playerRace == "Fenrir")
|
||||
{
|
||||
if (prefabName.Contains("wolf") || prefabName.Contains("fenring") ||
|
||||
prefabName.Contains("ulv") || prefabName.Contains("cultist"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Aswid Race Logic
|
||||
if (playerRace == "Aswid")
|
||||
{
|
||||
int state = BossProgressionManager.GetCurrentProgressionState();
|
||||
|
||||
if (state >= 2 && prefabName.Contains("boar")) return true;
|
||||
if (state >= 3 && prefabName.Contains("bear")) return true;
|
||||
if (state >= 4 && (prefabName.Contains("leech") || prefabName.Contains("ghost") || prefabName.Contains("wraith"))) return true;
|
||||
if (state >= 5 && prefabName.Contains("wolf")) return true;
|
||||
if (state >= 6 && (prefabName.Contains("lox") || prefabName.Contains("deathsquito"))) return true;
|
||||
if (state >= 7 && (prefabName.Contains("hare") || prefabName.Contains("gjall"))) return true;
|
||||
if (state >= 8 && (prefabName.Contains("asksvin") || prefabName.Contains("volture") || prefabName.Contains("vulture") || prefabName.Contains("valkyrie"))) return true;
|
||||
}
|
||||
|
||||
// Draugh Race Logic
|
||||
if (playerRace == "Draugh")
|
||||
{
|
||||
if (prefabName.Contains("skeleton") || prefabName.Contains("draugr") ||
|
||||
prefabName.Contains("ghost") || prefabName.Contains("wraith"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Trenta Race Logic - base passive, live from the start (no progression
|
||||
// gate, unlike Aswid's escalating list above).
|
||||
//
|
||||
// IsEnemy=false is the only lever this patch has, and it produces one
|
||||
// behaviour: the mob never initiates. It reads as two different relationships
|
||||
// only in flavour text - Greyling/Greydwarf/Leech/Deathsquito "don't see" a
|
||||
// Trenta as prey (root-kin, or simply nothing with blood to sense), while
|
||||
// Fuling/Troll "choose" not to fight one - but there is no third state to code
|
||||
// for. Striking first is handled, though not by the AI on its own as this
|
||||
// comment used to claim: MonsterAI.UpdateTarget discards any target IsEnemy
|
||||
// calls a non-enemy, so retaliation needed RaceGrudge, checked at the top of
|
||||
// the postfix.
|
||||
if (playerRace == TrentaConfig.RaceId)
|
||||
{
|
||||
// "fuling" matched nothing: the Fuling family's prefabs are Goblin,
|
||||
// GoblinArcher, GoblinBrute and GoblinShaman, so the Trenta's truce with them
|
||||
// never existed despite this file and TrentaConfig both describing it.
|
||||
// Unlike the other entries here, the goblin name needs its bosses carved back
|
||||
// out - Yagluth is GoblinKing, and Hildir's arena pair are GoblinBruteBros /
|
||||
// *_Hildir - because a substring test would otherwise pacify all three.
|
||||
bool isGoblinKin = prefabName.Contains("goblin")
|
||||
&& !prefabName.Contains("goblinking")
|
||||
&& !prefabName.Contains("hildir")
|
||||
&& !prefabName.Contains("brutebros");
|
||||
|
||||
if (prefabName.Contains("greyling") || prefabName.Contains("greydwarf") ||
|
||||
isGoblinKin || prefabName.Contains("troll") ||
|
||||
prefabName.Contains("leech") || prefabName.Contains("deathsquito"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Sverm Race Logic - Hive Pheromones. No progression gate at all, unlike
|
||||
// Aswid's escalating list: an invertebrate is kin from the first minute.
|
||||
//
|
||||
// That absence of a gate is doing real work rather than saving a few lines.
|
||||
// Every invertebrate in the game lives from the Swamp onward, so a gated
|
||||
// version would have handed the race nothing until Bonemass; ungated, a
|
||||
// newborn Sverm walks through leeches and deathsquitoes, which is the whole
|
||||
// of its early game.
|
||||
//
|
||||
// Bonemass is deliberately NOT here. It is a mass of ooze and it would
|
||||
// qualify, but a boss that ignores the player is not a boss.
|
||||
if (playerRace == SvermConfig.RaceId)
|
||||
{
|
||||
// "blob" covers Blob, BlobElite, BlobTar and the Ashlands lava blob
|
||||
// whatever it turns out to be called - which is why the one prefab name
|
||||
// still unconfirmed in the design doc costs nothing here.
|
||||
// "seeker" covers Seeker, SeekerBrood, SeekerBrute and SeekerQueen.
|
||||
bool isKin = prefabName.Contains("blob")
|
||||
|| prefabName.Contains("leech")
|
||||
|| prefabName.Contains("tick")
|
||||
|| prefabName.Contains("deathsquito")
|
||||
|| prefabName.Contains("gjall")
|
||||
|| prefabName.Contains("seeker");
|
||||
|
||||
if (isKin && !prefabName.Contains("bonemass"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue