public void OnLoaded(Dictionary <string, object> values) { var descriptions = new List <string>(); string GetEffectDescription(string effectId) { var effectData = CriticalEffectsFeature.GetEffectData(effectId); if (effectData == null || effectData.targetingData.showInStatusPanel == false) { return(null); } return(CriticalEffectsFeature.settings.DescriptionUseName ? effectData.Description.Name : effectData.Description.Details); } var i = 0; foreach (var effectIDs in PenalizedEffectIDs) { i++; foreach (var id in effectIDs) { var effectDesc = GetEffectDescription(id); if (effectDesc == null) { continue; } descriptions.Add(new Text(CriticalEffectsFeature.settings.CritHitText, i, effectDesc).ToString()); } } foreach (var id in OnDestroyedEffectIDs) { var effectDesc = GetEffectDescription(id); if (effectDesc == null) { continue; } descriptions.Add(new Text(CriticalEffectsFeature.settings.CritDestroyedText, effectDesc).ToString()); } if (DeathMethod != DeathMethod.NOT_SET) { descriptions.Add(new Text(CriticalEffectsFeature.settings.CritDestroyedDeathText, DeathMethod).ToString()); } if (HasLinked) { descriptions.Add(new Text(CriticalEffectsFeature.settings.CritLinkedText, LinkedStatisticName).ToString()); } var descriptionTemplate = CriticalEffectsFeature.settings.DescriptionTemplate; { var actorType = GetUnitType(); if (actorType != UnitType.UNDEFINED) { var actorDescription = actorType.ToString(); descriptionTemplate = $"{actorDescription} {descriptionTemplate}"; } } BonusDescriptions.AddTemplatedExtendedDetail( Def, descriptions, CriticalEffectsFeature.settings.ElementTemplate, descriptionTemplate, CriticalEffectsFeature.settings.DescriptionIdentifier, GetUnitType() ); }
public void OnLoaded(Dictionary <string, object> values) { var descriptions = new List <string>(); void AddDescription(string prefix, string effectId) { var effectData = CriticalEffectsFeature.GetEffectData(effectId); if (effectData == null || effectData.targetingData.showInStatusPanel == false) { return; } var description = CriticalEffectsFeature.settings.DescriptionUseName ? effectData.Description.Name : effectData.Description.Details; var text = $"{prefix}: {description}"; descriptions.Add(text); } var i = 0; foreach (var effectIDs in PenalizedEffectIDs) { i++; foreach (var id in effectIDs) { AddDescription($"HIT {i}", id); } } foreach (var id in OnDestroyedEffectIDs) { AddDescription($"DESTROYED", id); } if (DeathMethod != DeathMethod.NOT_SET) { descriptions.Add($"DESTROYED: Mech is incapacitated, reason is {DeathMethod}"); } if (HasLinked) { descriptions.Add($"Critical hits are linked to '{LinkedStatisticName}'"); } var descriptionTemplate = CriticalEffectsFeature.settings.DescriptionTemplate; { var actorDescription = GetActorTypeDescription(); if (actorDescription != null) { descriptionTemplate = $"{actorDescription} {descriptionTemplate}"; } } BonusDescriptions.AddBonusDescriptions( Def.Description, descriptions, CriticalEffectsFeature.settings.ElementTemplate, descriptionTemplate ); }