SpellManager ยป Cast Spell
Namespace: Mayo.Manager.Spells
Namespace: Mayo.Manager.Spells.Interface
Dependencies: ISpellManager
GameClient: GC.SM
You can find more info's about the Spell properties here:
The return value of the methods listed below indicates whether the spell was executed successfully or not.
Unlike Cast, TryCast checks additional parameters:
- Spell cost
- Cooldown
- Conditions
- Target (if specified)
bool TryCastAsync(Spell, IUnit Target, List<Func<bool>>? Conditions)
bool TryCastAsync(Spell, IPlayer Target, List<Func<bool>>? Conditions)
bool TryCastAsync(Spell, IModel Target, List<Func<bool>>? Conditions)
bool TryCastAsync(Spell, IGameObject Target, List<Func<bool>>? Conditions)
This casts Frostbolt on the target, provided the target does not have the slow effect of Frostbolt as an aura.
Example
var Target = GC.OM.Me.TargetUnit;
if (Target == null)
return;
var Frostbolt = GC.SM.GetSpell("Frostbolt");
if (Frostbolt != null)
await GC.SM.TryCastAsync(Frostbolt, Target, [
() => !Target.HasAura(Frostbolt.ID),
]);
var Fireball = GC.SM.GetSpell("Fireball");
if (Fireball != null)
await GC.SM.TryCastAsync(Fireball, Target);
bool TryCastAsync(int SpellID, IUnit Target, List<Func<bool>>? Conditions)
bool TryCastAsync(int SpellID, IPlayer Target, List<Func<bool>>? Conditions)
bool TryCastAsync(int SpellID, IModel Target, List<Func<bool>>? Conditions)
bool TryCastAsync(int SpellID, IGameObject Target, List<Func<bool>>? Conditions)
bool TryCastAsync(string SpellName, IUnit Target, List<Func<bool>>? Conditions)
bool TryCastAsync(string SpellName, IPlayer Target, List<Func<bool>>? Conditions)
bool TryCastAsync(string SpellName, IModel Target, List<Func<bool>>? Conditions)
bool TryCastAsync(string SpellName, IGameObject Target, List<Func<bool>>? Conditions)
bool TryCastAsync(string SpellName, int Rank, IUnit Target, List<Func<bool>>? Conditions)
bool TryCastAsync(string SpellName, int Rank, IPlayer Target, List<Func<bool>>? Conditions)
bool TryCastAsync(string SpellName, int Rank, IModel Target, List<Func<bool>>? Conditions)
bool TryCastAsync(string SpellName, int Rank, IGameObject Target, List<Func<bool>>? Conditions)
bool TryCast(Spell, IUnit Target, List<Func<bool>>? Conditions)
bool TryCast(Spell, IPlayer Target, List<Func<bool>>? Conditions)
bool TryCast(Spell, IModel Target, List<Func<bool>>? Conditions)
bool TryCast(Spell, IGameObject Target, List<Func<bool>>? Conditions)
bool TryCast(int SpellID, IUnit Target, List<Func<bool>>? Conditions)
bool TryCast(int SpellID, IPlayer Target, List<Func<bool>>? Conditions)
bool TryCast(int SpellID, IModel Target, List<Func<bool>>? Conditions)
bool TryCast(int SpellID, IGameObject Target, List<Func<bool>>? Conditions)
bool TryCast(string SpellName, IUnit Target, List<Func<bool>>? Conditions)
bool TryCast(string SpellName, IPlayer Target, List<Func<bool>>? Conditions)
bool TryCast(string SpellName, IModel Target, List<Func<bool>>? Conditions)
bool TryCast(string SpellName, IGameObject Target, List<Func<bool>>? Conditions)
bool TryCast(string SpellName, int Rank, IUnit Target, List<Func<bool>>? Conditions)
bool TryCast(string SpellName, int Rank, IPlayer Target, List<Func<bool>>? Conditions)
bool TryCast(string SpellName, int Rank, IModel Target, List<Func<bool>>? Conditions)
bool TryCast(string SpellName, int Rank, IGameObject Target, List<Func<bool>>? Conditions)