public Spell(Champion owner, string spellName, byte slot) { Owner = owner; _spellName = spellName; Slot = slot; Level = 0; Flags = 0; ProjectileFlags = 0; CastTime = 0.0f; ProjectileSpeed = 2000.0f; _currentCastTime = 0.0f; NoCooldown = !_game.Config.CooldownsEnabled; NoManacost = !_game.Config.ManaCostsEnabled; _scriptEngine = new LuaScriptEngine(); LoadLua(_scriptEngine); JObject data; if (slot > 3) { if (!_rafManager.ReadSpellData(spellName, out data)) { return; } // Generate cooldown values for each level of the spell for (var i = 0; i < cooldown.Length; ++i) { cooldown[i] = _rafManager.GetFloatValue(data, "SpellData", "Cooldown"); } return; } if (!_rafManager.ReadSpellData(spellName, out data)) { _logger.LogCoreError("Couldn't find spell stats for " + spellName); return; } // Generate cooldown values for each level of the spell for (var i = 0; i < cooldown.Length; ++i) { cooldown[i] = _rafManager.GetFloatValue(data, "SpellData", "Cooldown" + (i + 1)); } for (var i = 0; i < cost.Length; ++i) { cost[i] = _rafManager.GetFloatValue(data, "SpellData", "ManaCost" + (i + 1)); } for (var i = 0; i < _castRange.Length; ++i) { if (_rafManager.GetFloatValue(data, "SpellData", "CastRange" + (i + 1)) == 0) { _castRange[i] = _rafManager.GetFloatValue(data, "SpellData", "CastRange"); } else { _castRange[i] = _rafManager.GetFloatValue(data, "SpellData", "CastRange" + (i + 1)); } } CastTime = (1.0f + _rafManager.GetFloatValue(data, "SpellData", "DelayCastOffsetPercent")) / 2.0f; Flags = _rafManager.GetIntValue(data, "SpellData", "Flags"); ProjectileSpeed = _rafManager.GetFloatValue(data, "SpellData", "MissileSpeed"); for (var i = 0; true; i++) { if (_rafManager.GetValue(data, "SpellData", "Coefficient" + i) == null) { break; } var coeffValue = _rafManager.GetFloatValue(data, "SpellData", "Coefficient" + i); Coefficient[i] = coeffValue; i++; } LineWidth = _rafManager.GetFloatValue(data, "SpellData", "LineWidth"); hitEffectName = _rafManager.GetStringValue(data, "SpellData", "HitEffectName"); for (var i = 0; true; i++) { string key = "Effect" + (0 + i) + "Level0Amount"; if (_rafManager.GetValue(data, "SpellData", key) == null) { break; } var effectValues = new List <float>(); for (var j = 0; j < 6; ++j) { key = "Effect" + (0 + i) + "Level" + (0 + j) + "Amount"; effectValues.Add(_rafManager.GetFloatValue(data, "SpellData", key)); } effects.Add(effectValues); ++i; } _targetType = (float)Math.Floor( _rafManager.GetFloatValue(data, "SpellData", "TargettingType") + 0.5f ); ReloadLua(); }