public static string GetEffectText(MagicItemEffectDefinition effectDef, float value) { var localizedDisplayText = Localization.instance.Localize(effectDef.DisplayText); var result = string.Format(localizedDisplayText, value); return(result); }
public static void Add(MagicItemEffectDefinition effectDef) { if (AllDefinitions.ContainsKey(effectDef.Type)) { Debug.LogWarning($"Removed previously existing magic effect type: {effectDef.Type}"); AllDefinitions.Remove(effectDef.Type); } Debug.Log($"Added MagicItemEffect: {effectDef.Type}"); AllDefinitions.Add(effectDef.Type, effectDef); }
public static MagicItemEffect RollEffect(MagicItemEffectDefinition effectDef, ItemRarity itemRarity, MagicItemEffectDefinition.ValueDef valuesOverride = null) { float value = 0; var valuesDef = valuesOverride ?? effectDef.GetValuesForRarity(itemRarity); if (valuesDef != null) { value = valuesDef.MinValue; if (valuesDef.Increment != 0) { EpicLoot.Log($"RollEffect: {effectDef.Type} {itemRarity} value={value} (min={valuesDef.MinValue} max={valuesDef.MaxValue})"); var incrementCount = (int)((valuesDef.MaxValue - valuesDef.MinValue) / valuesDef.Increment); value = valuesDef.MinValue + (Random.Range(0, incrementCount + 1) * valuesDef.Increment); } } return(new MagicItemEffect(effectDef.Type, value)); }