⚔️ fight_GetSpellRange(spellName)
Récupère la portée maximale d'un sort. Peut retourner un dictionnaire avec 'min' et 'max' si la portée est variable, ou un entier si la portée est fixe.
fight_GetSpellRange(spellName)
FightRécupère la portée maximale d'un sort. Peut retourner un dictionnaire avec 'min' et 'max' si la portée est variable, ou un entier si la portée est fixe.
Paramètres
| Paramètre | Type | Description |
|---|---|---|
spellName |
string | Le nom du sort |
Valeur de retour
table - Dictionnaire avec 'min' et 'max' pour la portée (ou int si portée fixe)
Exemple
function example_fightgetspellrange()
-- Vérifier la portée d'un sort
local spellRange = fight_GetSpellRange("Boule de Feu")
local enemyCell = fight_GetClosestEnemyCell()
local distance = fight_GetDistanceToEnemy(enemyCell)
-- Si la portée est un dictionnaire
if type(spellRange) == "table" then
local maxRange = fight_GetProperty(spellRange, "max")
if distance <= maxRange then
fight_CastSpell("Boule de Feu", enemyCell)
end
else
-- Si la portée est un entier
if distance <= spellRange then
fight_CastSpell("Boule de Feu", enemyCell)
end
end
end
-- Appeler la fonction
example_fightgetspellrange()