Quand l'une de ces méthodes est appelée, le personnage effectue l'action, et l'exécution de la fonction fight_action() est interrompu, pour mieux comprendre ça, voici un exemple :
functionfight_action()console.print("Hello") -- "Hello" est affiché dans la console.fight.finishTurn() -- Passe le tour et interrompt l'exécution.console.print("Hey") -- "Hey" n'est pas affiché dans la console.end
Si l'exécution de la fonction fight_action() se termine sans aucune action, le personnage ne fait rien.
function fight_action()
-- Afficher
console.print("Round: "..fight.currentRound())
console.print("Action: "..fight.currentAction())
-- Récupérer mon combattant
local me = fight.currentFighter()
-- Récupérer l'ennemi le plus proche
local nearestEnemy = fight.nearestEnemy()
-- S'approcher de l'ennemi
fight.moveTowardCell(nearestEnemy.cellId)
-- Lancer le sort "Stase" sur l'ennemi
if fight.canCastSpell(12728, me.cellId, nearestEnemy.cellId) == enum_SpellCastError.NoError then
fight.castSpell(12728, nearestEnemy.cellId)
end
-- Passer le tour
fight.finishTurn()
end