feat(skeleton): per-player options to eat real food and spend stamina
Two options in "Skeleton - Mortal Habits", both off and not synced by the server, since each only gives up an advantage. Eats Mortal Food: the Skeleton eats like the living. The max health override and the fake foods step aside, so meals decide health and stamina and the tier's health bonus, which stood in for food, no longer applies. The food HUD shows again. Feels Fatigue: the Skeleton spends stamina. Without eating, its max stamina is base plus the stamina of the tier's stand-in meals, because the fake foods sit at m_time 0 and give none. The compendium builds its diet line from four new keys (English, Italian, Russian) when either option is on.
This commit is contained in:
parent
4c7e0ec16d
commit
9ed606a9aa
9 changed files with 86 additions and 13 deletions
|
|
@ -125,6 +125,22 @@ namespace RacesOfValheim
|
|||
Player.m_localPlayer.m_customData["Race"] == "Skeleton";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stamina from the tier's stand-in meals, for a Skeleton who feels fatigue but does not
|
||||
/// eat. The fake foods cannot supply it: they are kept at m_time 0, so UpdateFood scales
|
||||
/// their stamina to nothing on every tick.
|
||||
/// </summary>
|
||||
public static float GetStandInStamina(int state)
|
||||
{
|
||||
var foods = GetBestRealFoods(state);
|
||||
float stamina = 0f;
|
||||
if (foods != null)
|
||||
{
|
||||
foreach (var f in foods) stamina += f.m_shared.m_foodStamina;
|
||||
}
|
||||
return stamina;
|
||||
}
|
||||
|
||||
private static readonly int StatsEffectHash = "SE_SkeletonStats".GetStableHashCode();
|
||||
|
||||
private float lastAuraTime = 0f;
|
||||
|
|
@ -137,7 +153,7 @@ namespace RacesOfValheim
|
|||
|
||||
private static List<ItemDrop.ItemData>[] cachedRealFoods = new List<ItemDrop.ItemData>[9];
|
||||
|
||||
private List<ItemDrop.ItemData> GetBestRealFoods(int state)
|
||||
private static List<ItemDrop.ItemData> GetBestRealFoods(int state)
|
||||
{
|
||||
if (state < 1) state = 1;
|
||||
if (state > 8) state = 8;
|
||||
|
|
@ -453,8 +469,15 @@ namespace RacesOfValheim
|
|||
// Manage Fake Foods
|
||||
var foods = Player.m_localPlayer.GetFoods();
|
||||
bool needsFood = false;
|
||||
|
||||
if (foods.Count != 3)
|
||||
|
||||
if (SkeletonConfig.EatsMortalFood.Value)
|
||||
{
|
||||
// Real meals instead. The stand-in foods are the ones held at m_time 0 or below;
|
||||
// dropped here at once rather than left for UpdateFood, which would announce each
|
||||
// one as "food done".
|
||||
foods.RemoveAll(f => f.m_time <= 0f);
|
||||
}
|
||||
else if (foods.Count != 3)
|
||||
{
|
||||
needsFood = true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue