RynthCore as of 2026-11-02 (internal 3263c88): release 2026.11.2.2
This commit is contained in:
parent
00ee01167e
commit
5ad460080c
12 changed files with 361 additions and 23 deletions
|
|
@ -85,6 +85,8 @@ internal static class MonsterHud
|
|||
GoldGlow = C(0x55E6C766), NameText = C(0xFFF2E8DC), AttackerText = C(0xFFFF8A7A),
|
||||
BadgeBack = C(0xD0101820), Leader = C(0x60FFFFFF),
|
||||
HoverEdge = C(0xC0FFFFFF), UnknownFill = C(0xFF5E8A6A);
|
||||
// Your plate's "Grey out what debuffs take": the lost part of a bar, lighter than the empty track.
|
||||
private static readonly uint LostTop = C(0xE07A7A7A), LostBottom = C(0xE04E4E4E), LostEdge = C(0xFF1A1A1A);
|
||||
// Also the debuff icon row's (DebuffIconRow): outlines, stack digits, "+N".
|
||||
internal static readonly uint Outline = C(0xE6000000), HpText = C(0xFFFFFFFF), DimText = C(0xFFB8C4D0);
|
||||
private static uint BadgeEdge => RynthTheme.Border;
|
||||
|
|
@ -1436,10 +1438,12 @@ internal static class MonsterHud
|
|||
/// gradient fill with a shine line, and optional quarter ticks. Shared with
|
||||
/// the player plate, whose options can leave out the edge and track
|
||||
/// (<paramref name="track"/>) and the chip (<paramref name="chip"/>);
|
||||
/// monster plates always draw both.
|
||||
/// monster plates always draw both. <paramref name="cap"/> below 1 (your
|
||||
/// plate, "Grey out what debuffs take"): the bar spans the maximum without
|
||||
/// debuffs and from <paramref name="cap"/> to the end is grey, what they take.
|
||||
/// </summary>
|
||||
internal static void PaintBar(ImDrawListPtr dl, Vector2 b0, Vector2 b1, float round, float a,
|
||||
float shownRatio, float trailRatio, uint baseCol, bool ticks, bool track = true, bool chip = true)
|
||||
float shownRatio, float trailRatio, uint baseCol, bool ticks, bool track = true, bool chip = true, float cap = 1f)
|
||||
{
|
||||
if (track)
|
||||
{
|
||||
|
|
@ -1457,6 +1461,16 @@ internal static class MonsterHud
|
|||
if (chip && trail > shown + 0.002f)
|
||||
dl.AddRectFilled(new Vector2(i0.X + innerW * shown, i0.Y), new Vector2(i0.X + innerW * trail, innerBottom), Mul(Trail, a * 0.85f));
|
||||
|
||||
// What debuffs take: a grey block from the lowered maximum to the end, with a dark edge where it starts.
|
||||
float lostFrom = Math.Clamp(cap, 0f, 1f);
|
||||
if (lostFrom < 0.998f)
|
||||
{
|
||||
float lx = MathF.Round(i0.X + innerW * lostFrom);
|
||||
var l1 = new Vector2(i0.X + innerW, innerBottom);
|
||||
dl.AddRectFilledMultiColor(new Vector2(lx, i0.Y), l1, Mul(LostTop, a), Mul(LostTop, a), Mul(LostBottom, a), Mul(LostBottom, a));
|
||||
dl.AddLine(new Vector2(lx, i0.Y), new Vector2(lx, innerBottom), Mul(LostEdge, a), 1f);
|
||||
}
|
||||
|
||||
if (shown > 0.001f)
|
||||
{
|
||||
uint top = Mul(Shade(baseCol, 1.18f), a), bottom = Mul(Shade(baseCol, 0.72f), a);
|
||||
|
|
|
|||
|
|
@ -108,6 +108,11 @@ internal static class MonsterHudSettings
|
|||
public static bool SelfNumberBand = true;
|
||||
/// <summary>"Debuffs on you": icons for harmful spells on you under your mana bar (only while you have one).</summary>
|
||||
public static bool SelfDebuffs = true;
|
||||
/// <summary>
|
||||
/// "Grey out what debuffs take" (2026-11-02): each bar spans your maximum without the harmful spells on you,
|
||||
/// and what they take off it shows grey at the bar's end, instead of the bar filling up to the lowered maximum.
|
||||
/// </summary>
|
||||
public static bool SelfDebuffLoss = true;
|
||||
|
||||
// Combat text (CombatText): floating numbers and the kill burst.
|
||||
public static bool Numbers = true;
|
||||
|
|
@ -258,6 +263,7 @@ internal static class MonsterHudSettings
|
|||
case "selfTextOutline": SelfTextOutline = val == "1"; break;
|
||||
case "selfNumberBand": SelfNumberBand = val == "1"; break;
|
||||
case "selfDebuffs": SelfDebuffs = val == "1"; break;
|
||||
case "selfDebuffLoss": SelfDebuffLoss = val == "1"; break;
|
||||
case "numbers": Numbers = val == "1"; break;
|
||||
case "numDealt": NumDealt = val == "1"; break;
|
||||
case "numTaken": NumTaken = val == "1"; break;
|
||||
|
|
@ -375,6 +381,7 @@ internal static class MonsterHudSettings
|
|||
sw.WriteLine($"selfTextOutline={B(SelfTextOutline)}");
|
||||
sw.WriteLine($"selfNumberBand={B(SelfNumberBand)}");
|
||||
sw.WriteLine($"selfDebuffs={B(SelfDebuffs)}");
|
||||
sw.WriteLine($"selfDebuffLoss={B(SelfDebuffLoss)}");
|
||||
sw.WriteLine($"numbers={B(Numbers)}");
|
||||
sw.WriteLine($"numDealt={B(NumDealt)}");
|
||||
sw.WriteLine($"numTaken={B(NumTaken)}");
|
||||
|
|
@ -417,7 +424,7 @@ internal static class MonsterHudSettings
|
|||
PortalNames = true; PortalMaxDistance = DefaultPortalDistance;
|
||||
SelfPlate = true; SelfNumbers = false; SelfName = false; SelfHideFirstPerson = true;
|
||||
SelfPlacement = SelfPlacement.Fixed; SelfLocked = true; SelfFixedX = DefaultSelfFixedX; SelfFixedY = DefaultSelfFixedY;
|
||||
SelfBarTrack = true; SelfBarChip = true; SelfTextOutline = true; SelfNumberBand = true; SelfDebuffs = true;
|
||||
SelfBarTrack = true; SelfBarChip = true; SelfTextOutline = true; SelfNumberBand = true; SelfDebuffs = true; SelfDebuffLoss = true;
|
||||
Numbers = true; NumDealt = true; NumTaken = true; NumHeals = true; NumKills = true;
|
||||
NumSize = 1.0f; NumTime = 1.0f; NumRestores = true; KeepOnScreen = true;
|
||||
GainSize = 1.0f; GainTime = 1.0f; SelfPosition = SelfPlatePosition.Above;
|
||||
|
|
@ -483,7 +490,7 @@ internal static class MonsterHudSettings
|
|||
$"portal names {OnOff(PortalNames)} ({PortalMaxDistance:0}yd); " +
|
||||
$"self {OnOff(SelfPlate)} ({(SelfPlacement == SelfPlacement.Fixed ? "fixed on screen, " + (SelfLocked ? "locked" : "unlocked") : "follows you, " + SelfPosition.ToString().ToLowerInvariant())}, " +
|
||||
$"numbers {OnOff(SelfNumbers)}, name {OnOff(SelfName)}, hide in first person {OnOff(SelfHideFirstPerson)}, " +
|
||||
$"debuffs on you {OnOff(SelfDebuffs)}, track {OnOff(SelfBarTrack)}, damage trail {OnOff(SelfBarChip)}, " +
|
||||
$"debuffs on you {OnOff(SelfDebuffs)}, debuff loss greyed {OnOff(SelfDebuffLoss)}, track {OnOff(SelfBarTrack)}, damage trail {OnOff(SelfBarChip)}, " +
|
||||
$"text outline {OnOff(SelfTextOutline)}, number band {OnOff(SelfNumberBand)}); " +
|
||||
$"combat text {OnOff(Numbers)} (dealt {OnOff(NumDealt)}, taken {OnOff(NumTaken)}, heals {OnOff(NumHeals)}, kills {OnOff(NumKills)}); " +
|
||||
$"gains {OnOff(Gains)} (xp {OnOff(GainXp)}, lum {OnOff(GainLum)}, radiance {OnOff(GainRadiance)}); " +
|
||||
|
|
|
|||
|
|
@ -136,6 +136,10 @@ internal static class MonsterHudSettingsUi
|
|||
"Icons under your mana bar for harmful spells on you (vulnerabilities, Imperil, Magic Yield, attribute and skill debuffs...), " +
|
||||
"the monster plates' icons: one per kind, a line that runs out with the spell, blinking in its last 5 seconds, \"+N\" when more than fit. " +
|
||||
"Only shows while you have one. Chat: /rv plates self debuffs.", sub: true);
|
||||
changed |= Toggle("Grey out what debuffs take", ref MonsterHudSettings.SelfDebuffLoss,
|
||||
"While a debuff lowers your maximum health, stamina or mana (Endurance or Self lowered, a spell on the vital itself), " +
|
||||
"the bar keeps its full length and the part the debuff takes shows grey at its end, instead of the bar filling up " +
|
||||
"to the lowered maximum. The numbers stay what the game says. Vitae isn't counted. Chat: /rv plates self lost.", sub: true);
|
||||
changed |= PercentSlider("Your debuff icon size", ref MonsterHudSettings.SelfDebuffIconSize,
|
||||
MonsterHudSettings.MinDebuffIconSize, MonsterHudSettings.MaxDebuffIconSize, w,
|
||||
"How big the icons under your bars are (100% = the default), apart from the monster plates' and from " +
|
||||
|
|
|
|||
|
|
@ -48,6 +48,12 @@
|
|||
// area cover the row at any size, and an enlarged row wider than the bars
|
||||
// (IconsOver) too.
|
||||
//
|
||||
// "Grey out what debuffs take" (2026-11-02, setting, on by default): while a
|
||||
// harmful spell lowers a maximum, the bar spans the maximum without it
|
||||
// (VitalLoss.FullMax, worked back from the shown one with the same snapshot's
|
||||
// StatMods) and the part it takes is grey at the bar's end, instead of the bar
|
||||
// filling up to the lowered maximum. The numbers stay AC's.
|
||||
//
|
||||
// Render thread only. Engine-owned statics.
|
||||
// ============================================================================
|
||||
|
||||
|
|
@ -73,6 +79,8 @@ internal static class PlayerPlate
|
|||
private struct BarState
|
||||
{
|
||||
public float Shown, Trail;
|
||||
// Where the debuffed maximum ends on a bar that spans the full one (1 = nothing lost); eased.
|
||||
public float Cap;
|
||||
public long Hold;
|
||||
public bool Init;
|
||||
public uint Cur, Max;
|
||||
|
|
@ -95,6 +103,8 @@ internal static class PlayerPlate
|
|||
private static int _overflowKey = -1;
|
||||
private static string _overflowText = "";
|
||||
private static readonly HarmfulSpellLookup Harmful = LookupHarmful;
|
||||
// "Grey out what debuffs take": the buff/debuff totals per vital (health, stamina, mana) from the same read.
|
||||
private static readonly VitalMods[] _vitalMods = { VitalMods.None, VitalMods.None, VitalMods.None };
|
||||
|
||||
// Fixed mode: dragging (unlocked only).
|
||||
private static bool _hover, _dragging, _wantsMouse;
|
||||
|
|
@ -120,6 +130,7 @@ internal static class PlayerPlate
|
|||
_alpha = 0f;
|
||||
_iconCount = 0;
|
||||
_nextDebuffRead = 0;
|
||||
for (int i = 0; i < _vitalMods.Length; i++) _vitalMods[i] = VitalMods.None;
|
||||
HeadOnScreen = false;
|
||||
FirstPerson = false;
|
||||
DropDrag();
|
||||
|
|
@ -299,24 +310,35 @@ internal static class PlayerPlate
|
|||
if (!show) { if (_alpha < 0.02f) _alpha = 0f; return false; }
|
||||
if (_alpha < 0.01f) return false;
|
||||
|
||||
RefreshDebuffs(f.Now);
|
||||
PlayerVitalsHooks.TryGetSnapshot(out PlayerVitalsSnapshot v);
|
||||
float kBar = 1f - MathF.Exp(-f.Dt * 14f);
|
||||
Step(ref _hp, v.Health, v.MaxHealth, f.Now, kBar, f.Dt);
|
||||
Step(ref _st, v.Stamina, v.MaxStamina, f.Now, kBar, f.Dt);
|
||||
Step(ref _mn, v.Mana, v.MaxMana, f.Now, kBar, f.Dt);
|
||||
RefreshDebuffs(f.Now);
|
||||
bool loss = MonsterHudSettings.SelfDebuffLoss;
|
||||
// The full maximums each frame from the latest totals, so a debuff's lowered maximum (which AC
|
||||
// sends at once) and its totals (read 4x a second) only disagree until the next read.
|
||||
Step(ref _hp, v.Health, v.MaxHealth, loss ? VitalLoss.FullMax(v.MaxHealth, in _vitalMods[VitalLoss.Health]) : v.MaxHealth, f.Now, kBar, f.Dt);
|
||||
Step(ref _st, v.Stamina, v.MaxStamina, loss ? VitalLoss.FullMax(v.MaxStamina, in _vitalMods[VitalLoss.Stamina]) : v.MaxStamina, f.Now, kBar, f.Dt);
|
||||
Step(ref _mn, v.Mana, v.MaxMana, loss ? VitalLoss.FullMax(v.MaxMana, in _vitalMods[VitalLoss.Mana]) : v.MaxMana, f.Now, kBar, f.Dt);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>"Debuffs on you": the snapshot read and the icons picked, four times a second. Render thread.</summary>
|
||||
/// <summary>
|
||||
/// "Debuffs on you" and "Grey out what debuffs take": the snapshot read, the icons picked and the
|
||||
/// vitals' totals summed, four times a second. Render thread.
|
||||
/// </summary>
|
||||
private static void RefreshDebuffs(long nowTicks)
|
||||
{
|
||||
if (!MonsterHudSettings.SelfDebuffs) { _iconCount = 0; return; }
|
||||
bool icons = MonsterHudSettings.SelfDebuffs, loss = MonsterHudSettings.SelfDebuffLoss;
|
||||
if (!icons) _iconCount = 0;
|
||||
if (!loss) for (int i = 0; i < _vitalMods.Length; i++) _vitalMods[i] = VitalMods.None;
|
||||
if (!icons && !loss) return;
|
||||
long ms = Environment.TickCount64;
|
||||
if (ms < _nextDebuffRead) return;
|
||||
_nextDebuffRead = ms + DebuffReadMs;
|
||||
if (!PortalSpellTable.Ready) { _iconCount = 0; return; } // MonsterHud.Update queued the load
|
||||
int n = EnchantmentHooks.CopyPlayerStatMods(_eIds, _eExp, _eTypes, _eKeys, _eVals, _eCats);
|
||||
if (loss) VitalLoss.Collect(_eIds, _eTypes, _eKeys, _eVals, _eCats, n, _vitalMods);
|
||||
if (!icons) return;
|
||||
if (!PortalSpellTable.Ready) { _iconCount = 0; return; } // MonsterHud.Update queued the load
|
||||
_iconCount = n > 0
|
||||
? SelfDebuffs.Select(_eIds, _eExp, _eCats, n, TimeSyncHooks.GetCurrentServerTime(), nowTicks, Stopwatch.Frequency, Harmful, _icons)
|
||||
: 0;
|
||||
|
|
@ -422,17 +444,26 @@ internal static class PlayerPlate
|
|||
return dx * dx + dy * dy + dz * dz < FirstPersonDistance * FirstPersonDistance;
|
||||
}
|
||||
|
||||
private static void Step(ref BarState b, uint cur, uint max, long now, float kBar, float dt)
|
||||
/// <summary>
|
||||
/// One bar's step: <paramref name="max"/> is AC's (debuffed) maximum, <paramref name="full"/> the one
|
||||
/// without debuffs that the bar spans (= max when nothing is lost or the option is off).
|
||||
/// </summary>
|
||||
private static void Step(ref BarState b, uint cur, uint max, uint full, long now, float kBar, float dt)
|
||||
{
|
||||
float ratio = max > 0 ? Math.Clamp((float)cur / max, 0f, 1f) : 0f;
|
||||
if (full < max) full = max;
|
||||
float ratio = full > 0 ? Math.Clamp((float)cur / full, 0f, 1f) : 0f;
|
||||
float cap = full > 0 ? Math.Clamp((float)max / full, 0f, 1f) : 1f;
|
||||
b.Cur = cur; b.Max = max;
|
||||
if (!b.Init || _alpha <= 0.02f)
|
||||
{
|
||||
b.Shown = b.Trail = ratio;
|
||||
b.Cap = cap;
|
||||
b.Hold = 0;
|
||||
b.Init = true;
|
||||
return;
|
||||
}
|
||||
b.Cap += (cap - b.Cap) * kBar;
|
||||
if (MathF.Abs(cap - b.Cap) < 0.0005f) b.Cap = cap;
|
||||
MonsterHud.StepBar(ref b.Shown, ref b.Trail, ref b.Hold, ratio, now, kBar, dt);
|
||||
}
|
||||
|
||||
|
|
@ -442,7 +473,7 @@ internal static class PlayerPlate
|
|||
ImFontPtr font = l.Small;
|
||||
var b0 = new Vector2(left, top);
|
||||
var b1 = new Vector2(left + w, top + h);
|
||||
MonsterHud.PaintBar(dl, b0, b1, l.M.Round, a, b.Shown, b.Trail, col, ticks: false, track: l.Track, chip: l.Chip);
|
||||
MonsterHud.PaintBar(dl, b0, b1, l.M.Round, a, b.Shown, b.Trail, col, ticks: false, track: l.Track, chip: l.Chip, cap: b.Cap);
|
||||
if (!l.Numbers || h < 8f || b.Max == 0) return;
|
||||
long key = ((long)b.Max << 32) | b.Cur;
|
||||
string? text = b.Text;
|
||||
|
|
|
|||
146
src/RynthCore.Engine/ImGui/MonsterHud/VitalLoss.cs
Normal file
146
src/RynthCore.Engine/ImGui/MonsterHud/VitalLoss.cs
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
// ============================================================================
|
||||
// RynthCore.Engine - ImGui/MonsterHud/VitalLoss.cs
|
||||
// "Grey out what debuffs take" (2026-11-02, owner: "instead of re-scaling the
|
||||
// bar to 100% with the debuff, show a greyed out area of what is lost"): what
|
||||
// your health, stamina and mana maximums would be without the harmful spells
|
||||
// on you. Your plate's bar then spans that maximum, and the part the debuffs
|
||||
// take is painted grey at its right end.
|
||||
//
|
||||
// A pure function over the engine's player enchantment snapshot
|
||||
// (EnchantmentHooks.CopyPlayerStatMods: StatMod type, key, value, spell
|
||||
// category), which PlayerPlate reads four times a second. Only the shown
|
||||
// (debuffed) maximum comes from AC; the rest is worked back from it, so a
|
||||
// rounding step or a rule this misses can only move the grey edge a point or
|
||||
// two, never the fill.
|
||||
//
|
||||
// AC's rules, as far as they matter here:
|
||||
// - a vital's maximum is (its attribute part + ranks + start) x the vital's
|
||||
// multipliers + its additive mods; health's attribute part is Endurance/2,
|
||||
// stamina's Endurance, mana's Self;
|
||||
// - only the strongest enchantment of a spell category counts (the others
|
||||
// wait under it); category 0 entries each count;
|
||||
// - harmful = an additive mod below 0 or a multiplier below 1 (attribute
|
||||
// debuffs are additive; a vital's can be either);
|
||||
// - vitae is left out: it is the death penalty, not a debuff, and the
|
||||
// snapshot doesn't carry it; cooldowns (ids 0x8000+) carry no StatMod.
|
||||
// No engine dependencies (the offline tests compile it).
|
||||
// ============================================================================
|
||||
|
||||
using System;
|
||||
|
||||
namespace RynthCore.Engine.ImGuiBackend.Hud;
|
||||
|
||||
/// <summary>One vital's enchantment totals: buffs and debuffs apart.</summary>
|
||||
internal struct VitalMods
|
||||
{
|
||||
public float BuffMult, DebuffMult, BuffAdd, DebuffAdd;
|
||||
/// <summary>What attribute debuffs take off the vital's attribute part (health: half the Endurance lost).</summary>
|
||||
public float AttrLoss;
|
||||
|
||||
public static VitalMods None => new() { BuffMult = 1f, DebuffMult = 1f };
|
||||
|
||||
/// <summary>A harmful spell lowers this vital's maximum.</summary>
|
||||
public readonly bool AnyDebuff => DebuffMult < 0.9999f || DebuffAdd < 0f || AttrLoss > 0f;
|
||||
}
|
||||
|
||||
internal static class VitalLoss
|
||||
{
|
||||
// StatMod type bits (PlayerProgressHooks.Mod*).
|
||||
internal const uint ModAttribute = 0x1, ModSecondAttribute = 0x2, ModMultiplicative = 0x4000, ModAdditive = 0x8000, ModVitae = 0x800000;
|
||||
// Attribute keys; vital keys come in pairs (max, current): health 1-2, stamina 3-4, mana 5-6.
|
||||
internal const uint Endurance = 2, Self = 6;
|
||||
internal const int Health = 0, Stamina = 1, Mana = 2;
|
||||
internal const uint FirstCooldownId = 0x8000;
|
||||
private const int MaxEntries = 256;
|
||||
/// <summary>A worked-back maximum never goes past this many times the shown one (a bad multiplier).</summary>
|
||||
private const float MaxGrowth = 10f;
|
||||
|
||||
/// <summary>
|
||||
/// The totals for health, stamina and mana (<paramref name="dst"/>[Health..Mana]) from the first
|
||||
/// <paramref name="n"/> snapshot entries. Entries of a spell category past its strongest are skipped.
|
||||
/// </summary>
|
||||
internal static void Collect(uint[] ids, uint[] types, uint[] keys, float[] vals, uint[] categories, int n, Span<VitalMods> dst)
|
||||
{
|
||||
for (int v = 0; v < dst.Length; v++) dst[v] = VitalMods.None;
|
||||
if (dst.Length < 3 || n <= 0) return;
|
||||
n = Math.Min(Math.Min(n, MaxEntries),
|
||||
Math.Min(Math.Min(ids.Length, types.Length), Math.Min(keys.Length, Math.Min(vals.Length, categories.Length))));
|
||||
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
uint type = types[i];
|
||||
if (ids[i] == 0 || ids[i] >= FirstCooldownId || (type & ModVitae) != 0) continue;
|
||||
if ((type & (ModAttribute | ModSecondAttribute)) == 0) continue;
|
||||
bool mult = (type & ModMultiplicative) != 0;
|
||||
if (!mult && (type & ModAdditive) == 0) continue;
|
||||
float val = vals[i];
|
||||
if (float.IsNaN(val) || float.IsInfinity(val)) continue;
|
||||
if (!Strongest(i, types, keys, vals, categories, n)) continue;
|
||||
|
||||
if ((type & ModSecondAttribute) != 0)
|
||||
{
|
||||
int v = keys[i] switch { 1 or 2 => Health, 3 or 4 => Stamina, 5 or 6 => Mana, _ => -1 };
|
||||
if (v < 0) continue;
|
||||
ref VitalMods m = ref dst[v];
|
||||
if (mult)
|
||||
{
|
||||
if (val <= 0f) continue; // never a real multiplier
|
||||
if (val < 1f) m.DebuffMult *= val; else m.BuffMult *= val;
|
||||
}
|
||||
else if (val < 0f) m.DebuffAdd += val;
|
||||
else m.BuffAdd += val;
|
||||
}
|
||||
else if (!mult && val < 0f)
|
||||
{
|
||||
// An attribute debuff: Endurance feeds health (half) and stamina, Self feeds mana.
|
||||
float lost = -val;
|
||||
if (keys[i] == Endurance)
|
||||
{
|
||||
dst[Health].AttrLoss += lost * 0.5f;
|
||||
dst[Stamina].AttrLoss += lost;
|
||||
}
|
||||
else if (keys[i] == Self)
|
||||
dst[Mana].AttrLoss += lost;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Entry <paramref name="i"/> is its spell category's strongest on the same stat (ties: the first).
|
||||
/// Category 0 entries always count.
|
||||
/// </summary>
|
||||
private static bool Strongest(int i, uint[] types, uint[] keys, float[] vals, uint[] categories, int n)
|
||||
{
|
||||
uint cat = categories[i];
|
||||
if (cat == 0) return true;
|
||||
float mine = Strength(types[i], vals[i]);
|
||||
for (int j = 0; j < n; j++)
|
||||
{
|
||||
if (j == i || categories[j] != cat || keys[j] != keys[i]) continue;
|
||||
if ((types[j] & (ModAttribute | ModSecondAttribute | ModMultiplicative | ModAdditive)) !=
|
||||
(types[i] & (ModAttribute | ModSecondAttribute | ModMultiplicative | ModAdditive))) continue;
|
||||
float other = Strength(types[j], vals[j]);
|
||||
if (other > mine || (other == mine && j < i)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static float Strength(uint type, float val) =>
|
||||
float.IsFinite(val) ? ((type & ModMultiplicative) != 0 ? MathF.Abs(val - 1f) : MathF.Abs(val)) : 0f;
|
||||
|
||||
/// <summary>
|
||||
/// The maximum without the debuffs, worked back from the <paramref name="shown"/> (debuffed) one:
|
||||
/// shown = part x buffMult x debuffMult + buffAdd + debuffAdd, where part already lost AttrLoss.
|
||||
/// Never below <paramref name="shown"/>; equal to it with no debuff.
|
||||
/// </summary>
|
||||
internal static uint FullMax(uint shown, in VitalMods m)
|
||||
{
|
||||
if (shown == 0 || !m.AnyDebuff) return shown;
|
||||
double scaled = shown - (double)m.BuffAdd - m.DebuffAdd; // part x buffMult x debuffMult
|
||||
if (scaled < 0) scaled = 0;
|
||||
double debuffMult = Math.Max(m.DebuffMult, 0.01f);
|
||||
double full = scaled / debuffMult + m.AttrLoss * (double)m.BuffMult + m.BuffAdd;
|
||||
full = Math.Min(full, shown * (double)MaxGrowth);
|
||||
return full <= shown ? shown : (uint)Math.Round(full);
|
||||
}
|
||||
}
|
||||
|
|
@ -50,7 +50,7 @@ internal sealed class ClassicMainTab : IClassicTab
|
|||
|
||||
private static readonly (string Schema, string Label)[] BehaviorRight =
|
||||
{
|
||||
("Boost Nav Priority", "Navigate only (no hunting, no looting)"), ("Boost Loot Priority", "Looting first"),
|
||||
("Boost Nav Priority", "Route only (no fights on a route)"), ("Boost Loot Priority", "Looting first"),
|
||||
("Loot Only Rare Corpses", "Rare corpses only"), ("Auto Fellowship Management", "Manage fellowship"),
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue