private static SpellConfig Randomize(SpellConfig spellConfig) { if (spellConfig == null) return null; if(_randomizer == null) _randomizer = new Randomizer.Randomizer(); if (!KeysExist(ConfigValue.EnableRandomizer, ConfigValue.RandomizerMaxDangerLevel, ConfigValue.RandomizerPercentage, ConfigValue.DrawBlockedRandomizerSpells)) { ConsoleDebug.WriteLine("Config Keys Not Found!", true); return spellConfig; } if (GetBool(ConfigValue.EnableRandomizer) && GetInt(ConfigValue.RandomizerMaxDangerLevel) > (int) spellConfig.DangerLevel) { spellConfig.Dodge = _randomizer.IsAbovePercentage(1f - GetInt(ConfigValue.RandomizerPercentage) / 100f); spellConfig.Draw = spellConfig.Draw && GetBool(ConfigValue.DrawBlockedRandomizerSpells); } return spellConfig; }
public static void SetSpell(string id, SpellConfig value, bool raiseEvent = true) { if (Spells.Any(i => i.Key == id)) { Spells[id] = value; return; } Spells.Add(id, value); if (raiseEvent && OnConfigValueChanged != null) OnConfigValueChanged.Invoke(new ConfigValueChangedArgs(id, value)); }