/// <summary> /// Casts the spell w. /// </summary> /// <param name="target">The target.</param> /// <param name="priority">The priority.</param> private void CastSpellW(Obj_AI_Base target, SpellPriority priority) { SpellCastLocker.RunWithLock((int)WSpell.Slot, () => { if (!WSpell.Ready || !IsValidTargetLocked(target, WSpell.Range)) { return; } var localHeroMana = 100 * LocalHero.Mana / LocalHero.MaxMana; var targetPrediction = WSpell.GetPrediction(target); switch (priority) { case SpellPriority.Harass: if (localHeroMana > 55 && targetPrediction.HitChance >= HitChance.Medium) { WSpell.Cast(targetPrediction.CastPosition); } else if (localHeroMana > 30 && localHeroMana <= 55 && targetPrediction.HitChance >= HitChance.High) { WSpell.Cast(targetPrediction.CastPosition); } else if (localHeroMana <= 30 && targetPrediction.HitChance >= HitChance.VeryHigh) { WSpell.Cast(targetPrediction.CastPosition); } break; case SpellPriority.Farm: if (localHeroMana > 30 && targetPrediction.HitChance >= HitChance.Low) { WSpell.Cast(targetPrediction.CastPosition); } break; case SpellPriority.Combo: if (targetPrediction.HitChance >= HitChance.Medium) { WSpell.Cast(targetPrediction.CastPosition); } break; case SpellPriority.Force: if (targetPrediction.HitChance >= HitChance.Low) { WSpell.Cast(targetPrediction.CastPosition); } break; default: Logger.Log($"Caught ArgumentOutOfRangeException: {nameof(priority)}, {priority}", LogType.Error, EventType.OnGameOnUpdateEvent); break; } }); }
/// <summary> /// Casts the spell w. /// </summary> /// <param name="castPosition">The cast position.</param> /// <param name="priority">The priority.</param> private void CastSpellW(Vector2 castPosition, SpellPriority priority) { SpellCastLocker.RunWithLock((int)WSpell.Slot, () => { if (!WSpell.Ready) { return; } var localHeroMana = 100 * LocalHero.Mana / LocalHero.MaxMana; switch (priority) { case SpellPriority.Harass: if (localHeroMana > 55) { WSpell.Cast(castPosition); } else if (localHeroMana > 30 && localHeroMana <= 55) { WSpell.Cast(castPosition); } else if (localHeroMana <= 30) { WSpell.Cast(castPosition); } break; case SpellPriority.Farm: if (localHeroMana > 30) { WSpell.Cast(castPosition); } break; case SpellPriority.Combo: case SpellPriority.Force: WSpell.Cast(castPosition); break; default: Logger.Log($"Caught ArgumentOutOfRangeException: {nameof(priority)}, {priority}", LogType.Error, EventType.OnGameOnUpdateEvent); break; } }); }