diff --git a/Assets/Scripts/Game/Entities/DaggerfallEntity.cs b/Assets/Scripts/Game/Entities/DaggerfallEntity.cs index 040326032c..4e6844e692 100644 --- a/Assets/Scripts/Game/Entities/DaggerfallEntity.cs +++ b/Assets/Scripts/Game/Entities/DaggerfallEntity.cs @@ -399,7 +399,7 @@ public void SetIncreasedWeightAllowanceMultiplier(float amount) public void SetIncreasedArmorValueModifier(int amount) { - // Increased armor value does not stack, only effect with the highest modifier used + // Increased armor value does not stack, only effect with the strongest modifier used // In classic effects this never goes below -5 (lower modifier -> higher armor) if (amount < IncreasedArmorValueModifier) { @@ -409,10 +409,12 @@ public void SetIncreasedArmorValueModifier(int amount) public void SetDecreasedArmorValueModifier(int amount) { - // Decreased armor value does not stack, only effect with the lowest modifier uses + // Decreased armor value does not stack, only effect with the strongest modifier uses // In classic effects this never goes above +5 (higher modifier -> lower armor) - if (amount < DecreasedArmorValueModifier) + if (amount > DecreasedArmorValueModifier) + { DecreasedArmorValueModifier = amount; + } } public void ChangeChanceToHitModifier(int amount) diff --git a/Assets/Scripts/Game/UserInterface/PaperDoll.cs b/Assets/Scripts/Game/UserInterface/PaperDoll.cs index 2a4f69c695..cda71a10bc 100644 --- a/Assets/Scripts/Game/UserInterface/PaperDoll.cs +++ b/Assets/Scripts/Game/UserInterface/PaperDoll.cs @@ -156,20 +156,29 @@ void RefreshArmourValues(PlayerEntity playerEntity, bool suppress = false) if (!showArmorLabels) return; + // "Increased" armor value modifier is negative or 0 + // "Decreased" armor value modifier is positive or 0 + // They are applied directly as a hit malus/bonus when an enemy attacks + + // For the purpose of UI, we invert this logic + // We show bonuses as bigger numbers and maluses as small numbers + // Also, 1 AC = 5 hit modifier + // Therefore, a -5 "Increase" armor value gives +1 AC + // and a +5 "Decrease" armopr values gives -1 AC + + int avMod = playerEntity.IncreasedArmorValueModifier + playerEntity.DecreasedArmorValueModifier; + Color textColor = DaggerfallUI.DaggerfallDefaultTextColor; + if (avMod > 0) + textColor = DaggerfallUI.DaggerfallUnityStatDrainedTextColor; + else if (avMod < 0) + textColor = DaggerfallUI.DaggerfallUnityStatIncreasedTextColor; + for (int bpIdx = 0; bpIdx < DaggerfallEntity.NumberBodyParts; bpIdx++) { - int armorMod = playerEntity.DecreasedArmorValueModifier - playerEntity.IncreasedArmorValueModifier; - sbyte av = playerEntity.ArmorValues[bpIdx]; - int bpAv = (100 - av) / 5 + armorMod; - armourLabels[bpIdx].Text = (!suppress) ? bpAv.ToString() : string.Empty; - - if (armorMod < 0) - armourLabels[bpIdx].TextColor = DaggerfallUI.DaggerfallUnityStatDrainedTextColor; - else if (armorMod > 0) - armourLabels[bpIdx].TextColor = DaggerfallUI.DaggerfallUnityStatIncreasedTextColor; - else - armourLabels[bpIdx].TextColor = DaggerfallUI.DaggerfallDefaultTextColor; + int ac = (100 - (av + avMod)) / 5; + armourLabels[bpIdx].Text = (!suppress) ? ac.ToString() : string.Empty; + armourLabels[bpIdx].TextColor = textColor; } }