2 using System.Collections.Generic;
10 private static void GetDamageModifierText(ref LocalizedString description, DamageModifier damageModifier, Identifier afflictionIdentifier)
12 int roundedValue = (int)Math.Round((1 - Math.Min(damageModifier.DamageMultiplier, damageModifier.ProbabilityMultiplier)) * 100);
13 if (roundedValue == 0) {
return; }
14 string colorStr = XMLExtensions.ToStringHex(GUIStyle.Green);
16 LocalizedString afflictionName =
17 AfflictionPrefab.List.FirstOrDefault(ap => ap.Identifier == afflictionIdentifier)?.Name ??
18 TextManager.Get($
"afflictiontype.{afflictionIdentifier}").Fallback(afflictionIdentifier.Value);
20 if (!description.IsNullOrWhiteSpace()) { description +=
'\n'; }
21 description += $
" ‖color:{colorStr}‖{roundedValue:-0;+#}%‖color:end‖ {afflictionName}";
29 public static void AddTooltipInfo(IReadOnlyList<DamageModifier> damageModifiers, IReadOnlyDictionary<Identifier, float> skillModifiers, ref
LocalizedString description)
31 if (damageModifiers.Any())
41 GetDamageModifierText(ref description, damageModifier, afflictionIdentifier);
45 GetDamageModifierText(ref description, damageModifier, afflictionType);
49 if (skillModifiers.Any())
51 foreach (var skillModifier
in skillModifiers)
53 string colorStr = XMLExtensions.ToStringHex(GUIStyle.Green);
54 int roundedValue = (int)Math.Round(skillModifier.Value);
55 if (roundedValue == 0) {
continue; }
56 if (!description.IsNullOrWhiteSpace()) { description +=
'\n'; }
57 description += $
" ‖color:{colorStr}‖{roundedValue.ToString("+0;-#
")}‖color:end‖ {TextManager.Get($"SkillName.{skillModifier.Key}
").Fallback(skillModifier.Key.Value)}";
ref readonly ImmutableArray< Identifier > ParsedAfflictionIdentifiers
ref readonly ImmutableArray< Identifier > ParsedAfflictionTypes
float ProbabilityMultiplier
override void AddTooltipInfo(ref LocalizedString name, ref LocalizedString description)
readonly Dictionary< Identifier, float > SkillModifiers
static void AddTooltipInfo(IReadOnlyList< DamageModifier > damageModifiers, IReadOnlyDictionary< Identifier, float > skillModifiers, ref LocalizedString description)
Interface for entities that the server can send events to the clients