API Lua Combat Avance
49 entries — WGRetro bot reference for Dofus Retro
Combat — Validation sorts
-- Verifier si on peut lancer un sort
local check = bot.canCastSpell(161)
if check.ok then
local enemy = bot.getNearestEnemy()
if enemy and bot.canCastSpellOnCell(161, enemy.cell) == "ok" then
bot.castSpell(161, enemy.cell)
end
end
-- AoE optimale
local aoe = bot.getBestZoneTarget(163)
if aoe and aoe.count >= 2 then
bot.castSpell(163, aoe.cellId)
endCombat — Auto-play
-- Auto-play simple
bot.addSpell(161)
bot.addSpell(162)
-- Dans fightManagement :
bot.playTurn() -- cast tous les sorts + endTurnCombat — Validation sorts
| Property / Method | Type | Description |
|---|---|---|
| bot.canCastSpell(spellId) | { ok, reason } | Verifie si le sort peut etre lance (AP, cooldown, maxPerTurn, summon_limit). Reasons: "ok", "spell_not_found", "not_enough_ap", "cooldown", "max_per_turn", "summon_limit" |
| bot.canCastSpellOnCell(spellId, cellId) | string | Verifie sur une cellule precise. Retourne "ok" ou la raison du refus |
| bot.getTargetableCells(spellId) | table | Cellules ciblables par le sort (portee + LdV + ligne + freeCell) |
| bot.getSpellZoneCells(spellId, targetCell) | table | Cellules affectees par la zone d'effet |
| bot.getEnemiesInZone(spellId, targetCell) | table | Ennemis touches par la zone du sort sur cette cellule |
| bot.getBestZoneTarget(spellId) | { cellId, count } \ | nil | Cellule ciblable qui touche le plus d'ennemis (AoE optimal) |
| bot.spellCooldown(spellId) | number | Tours de cooldown restants (0 = pret) |
| bot.spellRange(spellId) | { min, max } \ | nil | Portee min/max du sort |
| bot.getSpellRange(spellId) | { min, max } \ | nil | Alias de spellRange |
| bot.getFightSpell(spellId) | table \ | nil | Donnees completes du sort |
| bot.getFightSpells() | table | Tous nos sorts avec donnees de combat completes |
Combat — Pathfinding
| Property / Method | Type | Description |
|---|---|---|
| bot.getReachableCells() | table | Cellules accessibles avec nos PM actuels (BFS) |
| bot.getPath(fromCell, toCell) | table | Chemin BFS entre deux cellules ({} si inatteignable) |
| bot.pathLength(fromCell, toCell) | number | Nombre de pas du chemin BFS (0 si inatteignable) |
| bot.isLineOfSight(fromCell, toCell) | boolean | Ligne de vue libre |
| bot.adjacentCells(cellId) | table | 4 cellules adjacentes |
| bot.isCellWalkable(cellId) | boolean | Cellule marchable sur la map |
| bot.isCellFree(cellId) | boolean | Cellule marchable ET pas de combattant vivant dessus |
| bot.getFighterOnCell(cellId) | table \ | nil | Combattant vivant sur la cellule |
| bot.getFighter(id) | table \ | nil | Combattant par ID (string ou number) |
Combat — Invocations
| Property / Method | Type | Description |
|---|---|---|
| bot.getSummons() | table | Nos invocations vivantes |
| bot.hasSummons() | boolean | Avons-nous des invocations ? |
| bot.summonCount() | number | Nombre d'invocations vivantes |
| bot.summonMax() | number | Nombre max d'invocations (1 par defaut) |
| bot.summon(spellId, cellId) | void | Lancer un sort d'invocation sur une cellule |
Combat — Challenges
| Property / Method | Type | Description |
|---|---|---|
| bot.hasChallenges() | boolean | Challenges actifs ? |
| bot.getChallengeIds() | table | IDs des challenges |
| bot.getChallengeCount() | number | Nombre de challenges |
| bot.isChallengeActive(id) | boolean | Challenge actif ? |
| bot.challengeName(id) | string | Nom du challenge |
| bot.getActiveChallenges() | table | {{ id, name, active }} |
Combat — Auto-play
| Property / Method | Type | Description |
|---|---|---|
| bot.addSpell(spellId) | void | Ajouter un sort a la liste auto-play |
| bot.clearSpells() | void | Vider la liste auto-play |
| bot.playTurn() | void | Jouer tous les sorts de la liste sur l'ennemi le plus proche, puis passer le tour |
Combat — Alias et utilitaires
| Property / Method | Type | Description |
|---|---|---|
| bot.isInFight() | boolean | En combat (fonction) |
| bot.myCell() | number | Ma cellule en combat |
| bot.myId() | string | Mon ID en combat |
| bot.myHP() | number | Mes PV en combat |
| bot.myLifePercent() | number | Mes PV en % en combat |
| bot.ap() | number | PA restants |
| bot.mp() | number | PM restants |
| bot.lifePoints() | number | PV actuels |
| bot.maxLifePoints() | number | PV max |
| bot.lifePointsP() | number | PV en % |
| bot.getSummonById(id) | table\ | nil | Invocation par ID |
| bot.moveTowardFighter(id) | void | Se rapprocher d'un combattant |
| bot.fightGroup(entityId) | void | Attaquer un groupe par ID |
| bot.placeOnCell(cellId) | void | Alias chooseCell |
| bot.ready() | void | Alias fightReady |
These functions are used in the WGRetro bot Lua scripts — testable with the free plan (1 bot, no time limit). Ready-to-use scripts on the marketplace.