### Get All Entities Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightaction Returns a list of all entities in the combat (allies, enemies, summons, etc.). ```APIDOC ## getAllEntities ### Description Retourne la liste des entités. (alliés, ennemis, invocations, ...) ### Method GET ### Endpoint /fightAction/getAllEntities ### Parameters N/A ### Request Example ```javascript fightAction.getAllEntities() ``` ### Response #### Success Response (200) - **entities** (list of objects) - A list containing the objects of the entities in combat. #### Response Example ```json { "entities": [ { "id": 1, "name": "Ally1", "team": "ally" }, { "id": 2, "name": "Enemy1", "team": "enemy" } ] } ``` ``` -------------------------------- ### Get Dofus Touch Challenge XP Bonus Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightchallenge/dofus-touch Retrieves the bonus experience percentage awarded for successfully completing the current challenge. This function returns an integer. ```coffeescript fightChallenge:getXpBonus() ``` -------------------------------- ### Get Shortest Path (Ignore Entities) Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightaction Calculates the shortest path between two cells, with an option to ignore cells occupied by entities. This is a core pathfinding function. It requires start and end cell IDs, and a boolean to indicate whether to ignore entities. Returns a list of cell IDs representing the path. ```coffeescript fightAction:getShortestPath(cellStart, cellEnd, ignoreEntities) ``` -------------------------------- ### Choose Cell Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightaction Allows placing your character on a given cell before the start of combat. ```APIDOC ## chooseCell ### Description Permet de placer votre personnage sur une cellule donnée avant le début du combat. ### Method POST ### Endpoint /fightAction/chooseCell ### Parameters #### Request Body - **cellId** (int) - Required - The ID of the cell to place the character on. ### Request Example ```json { "cellId": 50 } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message. #### Response Example ```json { "message": "Character placed on cell 50." } ``` ``` -------------------------------- ### Using fightBasic for Basic AI Turns in Lua Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightbasic This Lua code demonstrates how to integrate the fightBasic class into a fight management function. It shows how to play turns using a pre-configured basic AI and how to dynamically configure a new basic AI with custom spells, fight speed, and approach distance before playing a turn. The example highlights turn-based logic within a game or simulation. ```lua function move() -- Ma fonction move end function fightManagement() if fightCharacter:isItMyTurn() then if fightAction:getCurrentTurn() == 1 then -- Mes instructions de l'IA pour le tour 1 elseif fightAction:getCurrentTurn() == 2 then -- Je joue le tour avec l'IA basique pré-configurée de mon bot, avec la tactique "Corps à corps" fightBasic:playTurn(1) elseif fightAction:getCurrentTurn() == 3 then -- Je configure une nouvelle IA basique d'abord -- Je vide la liste des sorts existants fightBasic:clearSpells() -- J'ajoute le sort "Lancer de Pièces" fightBasic:addSpell(13338, 0, 1, 3, false, 100) -- Je mets la vitesse la plus rapide de combat fightBasic:setFightSpeed(0) -- Je m'approche si la distance est supérieure à 6 fightBasic:setApproachDistance(6) -- Je joue le tour avec la nouvelle IA basique, avec la tactique "Distance" fightBasic:playTurn(2) else -- Mes instructions de l'IA pour les tours >= 4 end end end ``` -------------------------------- ### Get Shortest Path (Avoid Specific Cells) Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightaction Calculates the shortest path between two cells, while avoiding a specified list of cells. This function offers more control over pathfinding by allowing custom avoidance lists. It requires start and end cell IDs, and a list of cell IDs to avoid. Returns a list of cell IDs representing the path. ```lua -- Liste de cellules à éviter avoidCells = {412, 315, 493} fightAction:getShortestPath(cellStart, cellEnd, avoidCells) ``` -------------------------------- ### Get Distance Between Cells Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightaction Calculates the number of cells between a starting and ending cell. This function is fundamental for pathfinding and evaluating distances. It takes two cell IDs (start and end) and returns an integer representing the distance. ```coffeescript fightAction:getDistance(cellIdStart, cellIdEnd) ``` -------------------------------- ### Get Dofus 2.0 Challenge XP Bonus Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightchallenge/dofus-2 Retrieves the experience (XP) bonus percentage for a specified Dofus 2.0 fight challenge. If challengeId is -1, it defaults to the first challenge in the list. Returns an integer representing the bonus. ```coffeescript fightChallenge:getXpBonus(challengeId) ``` -------------------------------- ### Get All Entities Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightaction Retrieves a list of all entities currently in combat, including allies, enemies, and summons. This function provides a comprehensive overview of the combat participants. It takes no arguments and returns a list of entity objects. ```coffeescript fightAction:getAllEntities() ``` -------------------------------- ### Get Dofus Touch Challenge Drop Bonus Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightchallenge/dofus-touch Retrieves the bonus drop percentage awarded for successfully completing the current challenge. This function returns an integer. ```coffeescript fightChallenge:getDroptBonus() ``` -------------------------------- ### Get walkable cells in a diagonal pattern Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightaction Retrieves a list of walkable cells forming a diagonal line pattern around a central cell. The selection is constrained by the provided minimum and maximum radii. ```coffeescript fightAction:getCells_diagonal(centerCell, minRadius, radius) ``` -------------------------------- ### Get Dofus Touch Challenge Target IDs Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightchallenge/dofus-touch Retrieves a list of identifiers for all enemy targets within the current challenge. This function returns a list of doubles. ```coffeescript fightChallenge:getTargetIds() ``` -------------------------------- ### Get Entities Count Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightaction Returns the number of entities in combat (allies, enemies, summons, etc.). ```APIDOC ## getEntitiesCount ### Description Retourne le nombre d'entités en combat.(alliés, ennemis, invocations, ...) ### Method GET ### Endpoint /fightAction/getEntitiesCount ### Parameters N/A ### Request Example ```javascript fightAction.getEntitiesCount() ``` ### Response #### Success Response (200) - **count** (int) - The total number of entities in combat. #### Response Example ```json { "count": 15 } ``` ``` -------------------------------- ### Get walkable cells in a square pattern Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightaction Retrieves a list of walkable cells that form a square shape around a specified center cell. It considers cells within a minimum and maximum radius from the center. ```coffeescript fightAction:getCells_square(centerCell, minRadius, radius) ``` -------------------------------- ### Get walkable cells in a cross pattern Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightaction Fetches a list of walkable cells forming a cross shape centered on a given cell. The function respects a minimum and maximum radius for cell inclusion. ```coffeescript fightAction:getCells_cross(centerCell, minRadius, radius) ``` -------------------------------- ### Get Real Reachable Cells Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightaction Returns a list of reachable cell IDs considering existing fighters on the map. ```APIDOC ## getRealReachableCells ### Description Retourne la liste des identifiants cellules marchables pour le personnage, et prenant en considération les combattants existants dans le terrain. ### Method GET ### Endpoint /fightAction/getRealReachableCells ### Parameters N/A ### Request Example ```javascript fightAction.getRealReachableCells() ``` ### Response #### Success Response (200) - **cells** (list of int) - A list of reachable cell IDs considering fighters. #### Response Example ```json { "cells": [1, 2, 4, 5] } ``` ``` -------------------------------- ### Get Reachable Cells Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightaction Returns a list of reachable cell IDs for the character. ```APIDOC ## getReachableCells ### Description Retourne la liste des identifiants cellules marchables pour le personnage. ### Method GET ### Endpoint /fightAction/getReachableCells ### Parameters N/A ### Request Example ```javascript fightAction.getReachableCells() ``` ### Response #### Success Response (200) - **cells** (list of int) - A list of reachable cell IDs. #### Response Example ```json { "cells": [1, 2, 3, 4, 5] } ``` ``` -------------------------------- ### Get Creature ID Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightslave Returns the ID of the companion or monster playing the turn. This method should be used to determine whose turn it is. ```APIDOC ## creatureId ### Description Returns the ID of the companion or monster playing the turn. This method is essential for determining whose turn it is. ### Method GET ### Endpoint /fightSlave/creatureId ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **creatureId** (integer) - The ID of the creature whose turn it is. #### Response Example ```json { "creatureId": 12345 } ``` ``` -------------------------------- ### Get Fighter Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightaction Returns the ID of the entity on a given cell, or null if no entity is present. ```APIDOC ## getFighter ### Description Retourne l'ID de l'entité sur la cellule souhaitée, si aucune ça retourne null. ### Method GET ### Endpoint /fightAction/getFighter ### Parameters #### Query Parameters - **cellId** (int) - Required - Identifiant de la cellule ### Request Example ```javascript fightAction.getFighter(75) ``` ### Response #### Success Response (200) - **entityId** (double) - The ID of the entity on the cell, or null. #### Response Example ```json { "entityId": 789.123 } ``` ```json { "entityId": null } ``` ``` -------------------------------- ### Get walkable cells in a lozenge pattern Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightaction Returns a list of walkable cells arranged in a lozenge (diamond) shape around a central cell. It filters cells based on minimum and maximum radius parameters. ```coffeescript fightAction:getCells_lozenge(centerCell, minRadius, radius) ``` -------------------------------- ### Get Shortest Path (Avoid Cells) Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightaction Retrieves the list of cells forming the shortest path between two cells, specifying cells to avoid. ```APIDOC ## getShortestPath (Avoid Cells) ### Description Méthode permettant de récupérer la liste des cellules du chemin entre deux cellules, en précisant les cellules à éviter. (similaire à la méthode ci-dessus mais pratique pour forcer des cellules à éviter) ### Method POST ### Endpoint /fightAction/getShortestPath ### Parameters #### Request Body - **cellStart** (int) - Required - The starting cell ID. - **cellEnd** (int) - Required - The ending cell ID. - **avoidCells** (list of int) - Optional - A list of cell IDs to avoid. ### Request Example ```json { "cellStart": 10, "cellEnd": 30, "avoidCells": [12, 15, 25] } ``` ### Response #### Success Response (200) - **path** (list of int) - A list of cell IDs representing the shortest path avoiding specified cells. #### Response Example ```json { "path": [10, 11, 13, 14, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30] } ``` ``` -------------------------------- ### Lua AI Script for Enutrof Movement and Attack Source: https://doc.ankabot.dev/intelligence-artificielle-ia/introduction This Lua script defines the 'Main' function, which is executed at the start of each bot's turn. It checks if it's the bot's turn, moves the character to the nearest enemy's cell, and then attempts to cast the 'Lancer de Pièces' spell three times. It includes checks to ensure the spell can be cast before execution. This script is intended to be placed in a separate '.lua' file within the 'AI' folder. ```lua function Main() -- Je vérifie dans un premier temps que c'est bien à moi de jouer : if (fightCharacter:isItMyTurn() == true) then -- J'avance vers mon ennemi le plus proche fightAction:moveToWardCell(fightAction:getNearestEnemy()) -- Je vais désormais tenter à 3 reprises de lancer le sort Lancer de Pièces for i = 1, 3 do -- Cellule de mon ennemi le plus proche local cellId = fightAction:getNearestEnemy() -- Identifiant du sort "Lancer de Pièces" local spellId = 13338 -- Je vérifie si je peux lancer mon sort if(fightAction:canCastSpellOnCell(fightCharacter:getCellId(),spellId,cellId) == 0) then -- Je lance mon sort sur la cible fightAction:castSpellOnCell(spellId,cellId) end end end end ``` -------------------------------- ### Get Shortest Path (Ignore Entities) Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightaction Retrieves the list of cells forming the shortest path between two cells, optionally avoiding cells occupied by entities. ```APIDOC ## getShortestPath (Ignore Entities) ### Description Méthode permettant de récupérer la liste des cellules du chemin entre deux cellules. ### Method GET ### Endpoint /fightAction/getShortestPath ### Parameters #### Query Parameters - **cellStart** (int) - Required - The starting cell ID. - **cellEnd** (int) - Required - The ending cell ID. - **ignoreEntities** (bool) - Optional - If true, avoids cells occupied by entities. Defaults to false. ### Request Example ```javascript fightAction.getShortestPath(10, 20, true) ``` ### Response #### Success Response (200) - **path** (list of int) - A list of cell IDs representing the shortest path. #### Response Example ```json { "path": [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] } ``` ``` -------------------------------- ### Get Dofus Touch Challenge Target Cells Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightchallenge/dofus-touch Retrieves a list of cell coordinates for all enemy targets in the current challenge. This function returns a list of integers representing cell IDs. ```coffeescript fightChallenge:getTargetCells() ``` -------------------------------- ### Get Dofus Touch Challenge ID Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightchallenge/dofus-touch Retrieves the unique identifier for the current combat challenge. This function returns an integer representing the challenge ID. ```coffeescript fightChallenge:getChallengeId() ``` -------------------------------- ### Get Dofus 2.0 Challenge Drop Bonus Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightchallenge/dofus-2 Retrieves the drop bonus percentage for a specified Dofus 2.0 fight challenge. If challengeId is -1, it defaults to the first challenge in the list. Returns an integer representing the bonus. ```coffeescript fightChallenge:getDropBonus(challengeId) ``` -------------------------------- ### Get Dofus Touch Challenge Target ID Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightchallenge/dofus-touch Retrieves the identifier of the current challenge's target. This function returns an integer representing the target's ID. ```coffeescript fightChallenge:getTargetId() ``` -------------------------------- ### Get Character Level - Coffeescript Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightcharacter Returns the current level of the fight character. The level is a key progression metric for characters. The function returns an integer. ```coffeescript fightCharacter:getLevel() ``` -------------------------------- ### Get Entities Count Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightaction Returns the total number of entities involved in the combat, encompassing allies, enemies, and summons. This provides a quick metric of the combat's scale. It takes no arguments and returns an integer. ```coffeescript fightAction:getEntitiesCount() ``` -------------------------------- ### Get Real Reachable Cells Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightaction Returns a list of reachable cells, considering existing combatants on the field. This provides a more accurate representation of movement options during combat. It takes no arguments and returns a list of cell IDs. ```coffeescript fightAction:getRealReachableCells() ``` -------------------------------- ### Get Reachable Cells Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightaction Returns a list of all cells that the character can reach. This function is vital for determining movement capabilities and planning actions. It takes no arguments and returns a list of cell IDs. ```coffeescript fightAction:getReachableCells() ``` -------------------------------- ### Get Dofus 2.0 Fight Challenge IDs Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightchallenge/dofus-2 Returns a list of integer identifiers for all challenges currently active in a Dofus 2.0 fight. This function is useful for iterating through available challenges. ```coffeescript fightChallenge:getChallengeIds() ``` -------------------------------- ### Get Dofus 2.0 Challenge Target Cells Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightchallenge/dofus-2 Returns a list of integer cell identifiers targeted by a specific Dofus 2.0 fight challenge. If challengeId is -1, it defaults to the first challenge. This provides the grid positions of targeted combatants. ```coffeescript fightChallenge:getTargetCells(challengeId) ``` -------------------------------- ### Get State Turns Remaining Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightaction Returns the number of remaining turns for a specific status effect. If the status is not applied, it returns 0. This is useful for tracking buff/debuff durations. It takes no arguments and returns an integer. ```coffeescript fightAction:stateTurns() ``` -------------------------------- ### Get Latest Dofus 2.0 Fight Challenge List Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightchallenge/dofus-2 Retrieves the most recent ChallengeListMessage sent by the Dofus 2.0 game server. This function allows access to the current state of fight challenges. ```coffeescript fightChallenge:getFightChallenges() ``` -------------------------------- ### Get Character Life Points Percentage - Coffeescript Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightcharacter Returns the current Life Points of the fight character as a percentage of their maximum health. This provides a quick overview of the character's health status. The function returns an integer (0-100). ```coffeescript fightCharacter:getLifePointsP() ``` -------------------------------- ### Get Dofus 2.0 Challenge Target IDs Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightchallenge/dofus-2 Returns a list of integer identifiers for the combatants targeted by a specific Dofus 2.0 fight challenge. If challengeId is -1, it defaults to the first challenge. This helps identify which characters are affected by the challenge. ```coffeescript fightChallenge:getTargetIds(challengeId) ``` -------------------------------- ### Get Character Movement Points (MP) - Coffeescript Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightcharacter Returns the current number of Movement Points (MP) available to the fight character. MP are used for moving on the game map. The function returns an integer. ```coffeescript fightCharacter:getMP() ``` -------------------------------- ### Get Character Breed ID - Coffeescript Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightcharacter Returns the breed ID of the fight character. This ID corresponds to a specific character race (e.g., Feca, Iop). A lookup table is provided in the documentation for breed names. ```coffeescript fightCharacter:getBreed() ``` -------------------------------- ### Move Character Between Cells using fightAction Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightaction Moves a character from a starting cell towards a target cell. If the target cell is occupied, the character will move to the nearest available cell. This is essential for navigating around obstacles or other characters. ```coffeescript fightAction:moveTowardCellFromCell(fromCellId, toCellId) ``` -------------------------------- ### Get Character Action Points (AP) - Coffeescript Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightcharacter Returns the current number of Action Points (AP) available to the fight character. This is crucial for performing actions like casting spells. The function returns an integer. ```coffeescript fightCharacter:getAP() ``` -------------------------------- ### getXpBonus Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightchallenge/dofus-touch Retrieves the experience bonus percentage for completing the current fight challenge. ```APIDOC ## GET fightChallenge/getXpBonus ### Description Returns the experience bonus percentage obtained by completing the challenge. ### Method GET ### Endpoint /fightChallenge/getXpBonus ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **xpBonus** (int) - The percentage of additional experience awarded upon challenge completion. #### Response Example { "xpBonus": 10 } ``` -------------------------------- ### Get Spell Zone Cells Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightaction Returns a list of cell IDs affected by a spell's area of effect. This is critical for spellcasting strategy and targeting. It requires a Spell ID and a Cell object as input and returns a list of cell IDs. ```coffeescript fightAction:getSpellZone(SpellId, Cell) ``` -------------------------------- ### Afficher les sorts d'une entité - Ankabot CoffeeScript Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightslave Affiche dans la console du jeu tous les sorts disponibles pour l'entité actuelle, ainsi que leur grade correspondant. Cette méthode est utile pour l'analyse des capacités de l'entité. Elle ne prend aucun argument. ```coffeescript fightSlave:showSpells() ``` -------------------------------- ### Get Distance Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightaction Calculates the distance between two cells. ```APIDOC ## getDistance ### Description Retourne le nombre de cellules entre deux cellules. ### Method GET ### Endpoint /fightAction/getDistance ### Parameters #### Query Parameters - **cellIdStart** (int) - Required - Cellule de départ - **cellIdEnd** (int) - Required - Cellule d'arrivée ### Request Example ```javascript fightAction.getDistance(5, 15) ``` ### Response #### Success Response (200) - **distance** (int) - The distance between the two cells. #### Response Example ```json { "distance": 10 } ``` ``` -------------------------------- ### Ankabot Main Script Configuration for Custom AI Source: https://doc.ankabot.dev/intelligence-artificielle-ia/introduction This code snippet is a single line that needs to be added to the top of your main Ankabot script. It assigns the filename of your custom AI script to the 'AI_FILE' variable, telling Ankabot which AI file to load and execute. Ensure the filename matches the custom AI script you created. ```lua AI_FILE = "ENU.lua" ``` -------------------------------- ### Implémenter le placement personnalisé en Lua Source: https://doc.ankabot.dev/intelligence-artificielle-ia/emplacement-personnalise La fonction fightManagementPosition, écrite en Lua, permet aux développeurs de choisir une cellule spécifique pour leur personnage après une analyse des positions des alliés et des ennemis. Elle prend en entrée des dictionnaires représentant les positions des challengers et des défenseurs, avec les identifiants des joueurs ou monstres. Si un emplacement est vide, son identifiant est -1. La fonction utilise ensuite fightAction:chooseCell pour définir l'emplacement choisi. ```lua function fightManagementPosition(challengers, defenders) global:printSuccess("Les emplacements de mon équipe : ") for cell, id in pairs(challengers) do global:printSuccess("Cell: "..cell.." - ID: "..id) end global:printMessage("Les emplacements de l'équipe adverse : ") for cell, id in pairs(defenders) do global:printMessage("Cell: "..cell.." - ID: "..id) end -- j'analyse les données que j'ai ... après je choisis une cellule X où je veux me placer fightAction:chooseCell(X) end ``` -------------------------------- ### Get Cell ID Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightslave Returns the cell ID of the entity that is currently playing its turn. ```APIDOC ## cellId ### Description Returns the cell ID of the entity that is currently playing its turn. ### Method GET ### Endpoint /fightSlave/cellId ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **cellId** (integer) - The cell ID of the current turn's entity. #### Response Example ```json { "cellId": 500 } ``` ``` -------------------------------- ### Get Nearest Ally Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightaction Retrieves the cell ID of the nearest ally. ```APIDOC ## getNearestAlly ### Description Retourne l'identifiant de la cellule de l'allié le plus proche. ### Method GET ### Endpoint /fightAction/getNearestAlly ### Parameters N/A ### Request Example ```javascript fightAction.getNearestAlly() ``` ### Response #### Success Response (200) - **cellId** (int) - The ID of the nearest ally's cell. #### Response Example ```json { "cellId": 123 } ``` ``` -------------------------------- ### Display Fighter Cells (Lua) Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/entite This snippet demonstrates how to retrieve all entities involved in a fight and print their respective IDs and Cell IDs. It iterates through the list of entities obtained from `fightAction:getAllEntities()` and uses `global:printSuccess` to display the information. ```lua -- Afficher les cellules des combattants local entities = fightAction:getAllEntities() for _,entity in ipairs(entities) do global:printSuccess("ID: "..entity.Id.." - CellID: "..entity.CellId) end ``` -------------------------------- ### getXpBonus Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightchallenge/dofus-2 Retrieves the XP bonus for a challenge. If no challenge ID is provided, it defaults to the first challenge. ```APIDOC ## getXpBonus ### Description Returns the XP bonus of a challenge present in the fight. If challengeId is -1, the first challenge will be used. ### Method GET ### Endpoint /fightChallenge/getXpBonus ### Parameters #### Query Parameters - **challengeId** (int) - Optional - The ID of the challenge. Defaults to -1 (first challenge). ### Request Example ```json { "challengeId": -1 } ``` ### Response #### Success Response (200) - **xpBonus** (int) - The XP bonus percentage. #### Response Example ```json { "xpBonus": 20 } ``` ``` -------------------------------- ### Get Spell Zone Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightaction Returns the list of cell IDs affected by a spell zone. ```APIDOC ## getSpellZone ### Description Retourne la liste des identifiants cellules que touche le sort de zone. ### Method GET ### Endpoint /fightAction/getSpellZone ### Parameters #### Query Parameters - **SpellId** (int) - Required - The ID of the spell. - **Cell** (int) - Required - The center cell of the spell's area. ### Request Example ```javascript fightAction.getSpellZone(101, 50) ``` ### Response #### Success Response (200) - **cells** (list of int) - A list of cell IDs affected by the spell zone. #### Response Example ```json { "cells": [45, 46, 47, 55, 56, 57, 65, 66, 67] } ``` ``` -------------------------------- ### Get Adjacent Cells Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightaction Returns a list of adjacent cell IDs for a given cell. ```APIDOC ## getAdjacentCells ### Description Retourne la liste des identifiants cellules adjacente pour une cellule donnée. ### Method GET ### Endpoint /fightAction/getAdjacentCells ### Parameters #### Query Parameters - **cellId** (int) - Required - Identifiant de la cellule ### Request Example ```javascript fightAction.getAdjacentCells(10) ``` ### Response #### Success Response (200) - **cells** (list of int) - A list of adjacent cell IDs. #### Response Example ```json { "cells": [11, 12, 13] } ``` ``` -------------------------------- ### Show Spells Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightslave Displays all spells of the entity in the console, along with their grades. ```APIDOC ## showSpells ### Description Displays all spells of the entity in the console, along with their respective grades. ### Method GET ### Endpoint /fightSlave/showSpells ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **spells** (array) - An array of spell objects, where each object contains spell details and grades. #### Response Example ```json { "spells": [ { "id": 101, "name": "Fireball", "grade": 5 }, { "id": 205, "name": "Heal", "grade": 3 } ] } ``` ``` -------------------------------- ### Gestion IA Companion/Invocation avec AnkaBot (Lua) Source: https://doc.ankabot.dev/intelligence-artificielle-ia/creatures-controlables Exemple de script Lua pour gérer l'IA d'un compagnon (Lumino) et le personnage principal dans Dofus 2.0. Le personnage principal utilise l'IA intégrée d'AnkaBot (`fightBasic`), tandis que le compagnon utilise une IA personnalisée pour lancer le sort 'Tambourino' de manière répétée et se rapprocher de l'ennemi. Utilise `fightSlave` pour les actions du compagnon et `fightCharacter` pour le personnage principal. ```lua function fightManagement() -- Vérifier que c'est le tour de mon personnage principale. if fightCharacter:isItMyTurn() then -- Jouer le tour de mon personnage avec l'IA configurée dans l'interface global:printMessage("C'est mon tour, je joue avec l'IA configurée dans l'interface !") fightBasic:playTurn(1) else -- L'entité qui joue le tour local slave = fightSlave:entity() if slave == nil then global:printSuccess("Une erreur est survenue, impossible de récupérer l'entité qui joue le tour !") end -- Tour de qui ? global:printMessage("C'est le tour de "..fightSlave:name().." !") -- Vérifier que c'est Lumino (1 = Lumino) if slave.CreatureGenericId == 1 then -- Lancer le maximum de fois possible le sort "Tambourino" (ID: 4204) du Lumino while spell_Tambourino() do end -- On se rapproche de l'ennemi le plus proche fightSlave:moveTowardCell(fightSlave:getNearestEnemy()) end end end function spell_Tambourino() -- Récupérer la cellule de l'ennemi le plus proche local enemyCell = fightSlave:getNearestEnemy() -- Chercher une cellule où on peut lancer le sort "Tambourino" (ID: 4204) du Lumino local moveCell = -1 local realReachableCells = fightSlave:getRealReachableCells() for _, cell in ipairs(realReachableCells) do if fightSlave:canCastSpellOnCellAfterMove(cell, 4204, enemyCell) == 0 then if moveCell == -1 then moveCell = cell else if fightAction:getDistance(cell, fightSlave:cellId()) < fightAction:getDistance(moveCell, fightSlave:cellId()) then moveCell = cell end end end end -- Vérifier et lancer if moveCell ~= -1 then -- Se déplacer global:printSuccess("Je me déplace à la cellule "..moveCell.." pour lancer le sort !") fightSlave:moveTowardCell(moveCell) if fightSlave:cellId() ~= moveCell then global:printError("Le déplacement a échoué !") return false end -- Lancer global:printSuccess("Je lance le sort !") if fightSlave:castSpellOnCell(4204, enemyCell) then return true end end return false end ``` -------------------------------- ### Choose Cell for Placement Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightaction Allows the character to be placed on a specified cell before combat begins. This function is used for initial positioning. It requires a cell ID as input. ```coffeescript fightAction:chooseCell(cellId) ``` -------------------------------- ### Obtenir les cellules réellement atteignables - fightSlave Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightslave Retourne une liste des identifiants des cellules que le personnage peut réellement atteindre, en tenant compte des combattants présents sur le terrain qui pourraient bloquer le passage. Cette méthode est plus précise pour la planification de mouvement. ```coffeescript fightSlave:getRealReachableCells() ``` -------------------------------- ### getDroptBonus Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightchallenge/dofus-touch Retrieves the drop bonus percentage for completing the current fight challenge. ```APIDOC ## GET fightChallenge/getDroptBonus ### Description Returns the drop bonus percentage obtained by completing the challenge. ### Method GET ### Endpoint /fightChallenge/getDroptBonus ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **droptBonus** (int) - The percentage of additional loot awarded upon challenge completion. #### Response Example { "droptBonus": 5 } ``` -------------------------------- ### Get Character Range - Coffeescript Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightcharacter Returns the base range of the fight character. This is distinct from the current PO which can be modified by spells. The function returns an integer. ```coffeescript fightCharacter:getRange() ``` -------------------------------- ### Obtenir les cellules atteignables - fightSlave Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightslave Retourne une liste des identifiants de toutes les cellules que le personnage peut atteindre en se déplaçant. Ne prend pas en compte les obstacles dynamiques. ```coffeescript fightSlave:getReachableCells() ``` -------------------------------- ### Play Turn Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightbasic/playturn Allows a player to play their turn by selecting a tactic. The tactic determines the action taken during the turn. ```APIDOC ## POST /playTurn ### Description Allows a player to play their turn by selecting a tactic. The tactic determines the action taken during the turn. ### Method POST ### Endpoint /playTurn ### Parameters #### Request Body - **tactic** (int) - Required - The tactic with which the turn will be played. 0 = Immobile, 1 = Melee, 2 = Ranged. ### Request Example ```json { "tactic": 1 } ``` ### Response #### Success Response (200) - **result** (any) - Description of the return value (currently empty). #### Response Example ```json { "result": null } ``` ``` -------------------------------- ### Get Character ID - Coffeescript Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightcharacter Returns the unique identifier (ID) of the fight character. This ID is used internally by the game to distinguish characters. The function returns a double. ```coffeescript fightCharacter:getId() ``` -------------------------------- ### getTargetCells Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightchallenge/dofus-touch Retrieves a list of cells occupied by enemy targets for the current fight challenge. ```APIDOC ## GET fightChallenge/getTargetCells ### Description Returns the list of cells occupied by the challenge targets. ### Method GET ### Endpoint /fightChallenge/getTargetCells ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **targetCells** (list of int) - A list containing the cell coordinates of the enemy targets. #### Response Example { "targetCells": [5, 10, 15] } ``` -------------------------------- ### Get Dofus 2.0 Challenge Name by ID Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightchallenge/dofus-2 Retrieves the name of a Dofus 2.0 fight challenge given its unique identifier. This function is part of the fightChallenge utility. ```coffeescript fightChallenge:challengeName(challengeId) ``` -------------------------------- ### Obtenir la cellule de l'entité jouant le tour - Ankabot CoffeeScript Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightslave Retourne l'identifiant de la cellule sur laquelle se trouve l'entité qui est actuellement en train de jouer son tour. Cette méthode est utile pour la manipulation de position et la stratégie de déplacement. Elle ne prend aucun argument. ```coffeescript fightSlave:cellId() ``` -------------------------------- ### Get Character Cell ID - Coffeescript Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightcharacter Returns the ID of the cell the fight character is currently occupying on the map. This is useful for positional logic in combat. The function returns an integer. ```coffeescript fightCharacter:getCellId() ``` -------------------------------- ### Obtenir l'index de l'entité courante - fightSlave Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightslave Retourne l'identifiant unique (index) de l'entité qui joue le tour. Utile pour référencer le personnage dans des structures de données ou des logs. ```coffeescript fightSlave:index() ``` -------------------------------- ### Get Number of Invocations - Coffeescript Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightcharacter Returns the count of active invocations (summons) that the fight character currently has on the terrain. This is important for strategies involving summoned creatures. The function returns an integer. ```coffeescript fightCharacter:getCountInvocation() ``` -------------------------------- ### getTargetIds Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightchallenge/dofus-touch Retrieves a list of enemy target IDs for the current fight challenge. ```APIDOC ## GET fightChallenge/getTargetIds ### Description Returns the list of enemy targets for the challenge. ### Method GET ### Endpoint /fightChallenge/getTargetIds ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **targetIds** (list of double) - A list containing the identifiers of enemy targets. #### Response Example { "targetIds": [789, 101, 112] } ``` -------------------------------- ### Get Character Life Points - Coffeescript Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightcharacter Returns the current number of Life Points (HP) of the fight character. This indicates the character's remaining health. The function returns an integer. ```coffeescript fightCharacter:getLifePoints() ``` -------------------------------- ### Vérifier la possibilité de lancer un sort après déplacement - fightSlave Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightslave Vérifie si un sort peut être lancé sur une cellule cible après un déplacement potentiel vers une autre cellule. Simule le lancer de sort depuis la cellule de destination pour vérifier la faisabilité. Prend en paramètres l'ID de la cellule de lancement (après déplacement), l'ID du sort et l'ID de la cellule cible. ```coffeescript fightSlave:canCastSpellOnCellAfterMove(launchedCellId, spellId, targetCellId) ``` -------------------------------- ### Obtenir l'ID de l'entité jouant le tour - Ankabot CoffeeScript Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightslave Retourne l'identifiant unique du companion ou du monstre qui est actuellement en train de jouer son tour. Cette méthode est essentielle pour identifier l'entité active dans le jeu. Elle ne prend aucun argument. ```coffeescript fightSlave:creatureId() ``` -------------------------------- ### Get Character Map ID - Coffeescript Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightcharacter Retrieves the current map ID for the fight character. This function takes no arguments and returns an integer representing the map's unique identifier. ```coffeescript fightCharacter:getMapid() ``` -------------------------------- ### Ankabot Lua Script: Movement and Combat AI Source: https://doc.ankabot.dev/intelligence-artificielle-ia/introduction This Lua script defines functions for bot movement and combat management. The `move` function outlines a series of map and path movements. The `fightManagement` function handles turn-based combat logic, including checking if it's the bot's turn, moving to the nearest enemy, and attempting to cast a specific spell (Lancer de Pièces, ID 13338) up to three times if conditions allow. ```lua function move() return { {map = "191105026", path = "left" }, {map = "191104000", path = "bottom"}, {map = "192415750", path = "409" }, {map = "84677894", path = "bottom" }, {map = "84677893", path = "bottom" }, {map = "84677892", path = "left" }, {map = "84677380", path = "top" }, {map = "84677381", path = "left" }, } end function fightManagement() -- Je vérifie dans un premier temps que c'est bien à moi de jouer : if (fightCharacter:isItMyTurn() == true) then -- J'avance vers mon ennemi le plus proche fightAction:moveToWardCell(fightAction:getNearestEnemy()) -- Je vais désormais tenter à 3 reprises de lancer le sort Lancer de Pièces for i = 1, 3 do -- Cellule de mon ennemi le plus proche local cellId = fightAction:getNearestEnemy() -- Identifiant du sort "Lancer de Pièces" local spellId = 13338 -- Je vérifie si je peux lancer mon sort if(fightAction:canCastSpellOnCell(fightCharacter:getCellId(),spellId,cellId) == 0) then -- Je lance mon sort sur la cible fightAction:castSpellOnCell(spellId,cellId) end end end end ``` -------------------------------- ### Play Turn with Tactic (CSS) Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightbasic/playturn The playTurn method in CSS syntax allows you to specify the tactic for playing a turn. The tactic is an integer where 0 means Immobile, 1 means Close Combat, and 2 means Ranged. This method does not have a documented return value. ```css fightBasic:playTurn(tactic) ``` -------------------------------- ### Get Character Range (PO) - Coffeescript Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightcharacter Returns the current range (PO) of the fight character. Range determines how far the character can attack or use certain abilities. The function returns an integer. ```coffeescript fightCharacter:getPO() ``` -------------------------------- ### Vérifier la possibilité de lancer un sort sur une cellule - fightSlave Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightslave Détermine si un sort peut être lancé sur une cellule cible depuis une cellule de lancement spécifiée. Retourne un code d'erreur en cas d'impossibilité, ou 0 si le lancement est possible. Prend en paramètres l'ID de la cellule de lancement, l'ID du sort et l'ID de la cellule cible. ```coffeescript fightSlave:canCastSpellOnCell(launchedCellId, spellId, targetCellId) ``` -------------------------------- ### Get Character Maximum Life Points - Coffeescript Source: https://doc.ankabot.dev/intelligence-artificielle-ia/methodes/fightcharacter Returns the maximum possible Life Points (HP) for the fight character. This represents the character's total health when at full capacity. The function returns an integer. ```coffeescript fightCharacter:getLifePointsMax() ```