Bonjour j'ai crée mon IA de combat de cra terre mais il ne fonctionne pas il passe seulement son tour jusqua mourir...
Code:
--######################################################################################
-- Partie Description IA Combat Cra Terre
--######################################################################################
DofusClass="9"
--MAX_MONSTRES = 8 -- nombre max de monstre
--MIN_MONSTRES = 1 -- nombre min de monstre
--MIN_MONSTERS_LEVEL = 1 -- lvl min monstre
--MAX_MONSTERS_LEVEL = 1000 -- lvl max monstre
--######################################################################################
-- Partie Mode Combat -------------------------------------------------------------
--######################################################################################
function Main()
if (fight:getCurrentTour() <= 1) then -- Si 1er tours
fight:launchSpellInCell(fight:getPlayerCell(), "Tir Éloigné")
fight:launchSpellInCell(fight:getPlayerCell(), "Tir Puissant")
Fleche()
MoveFuyard()
fighter:passTurn()
else
FlecheErosive()
if (fighter:getAP() >= 8) then
FlecheDestructive()
end
FlecheDestructive()
MoveFuyard()
fighter:passTurn()
end
end
function Fleche()
if (fight:getCurrentTour() == 1 or fight:getCurrentTour() % 1 == 0) then
if (fight:launchSpellInCell(fight:getNearestEnemy(), 171) == 16) then -- Si pas à portée
if (fight:getDistance(getPlayerCell, getNearestEnemy) > 10) then
fight:moveToWardCell(fight:getNearestEnemy()) -- on avance
else
fight:moveFarthestCell(fight:getNearestEnemy()) -- on recul
end
if not (fight:launchSpellInCell(fight:getNearestEnemy(), 171) == 16) then -- Si a portée
fight:launchSpellInCell(fight:getNearestEnemy(), 171) -- On lance sort
end
else
fight:launchSpellInCell(fight:getNearestEnemy(), 171) -- On lance sort
end
if (fighter:getAP() = 4) then
if (fight:launchSpellInCell(fight:getNearestEnemy(), 175) == 16) then -- Si pas à portée
if (fighter:getMP() > 0) then
if (fight:getDistance(getPlayerCell, getNearestEnemy) > 10) then
fight:moveToWardCell(fight:getNearestEnemy()) -- on avance
else
fight:moveFarthestCell(fight:getNearestEnemy()) -- on recul
end
if not (fight:launchSpellInCell(fight:getNearestEnemy(), 175) == 16) then -- Si a portée
fight:launchSpellInCell(fight:getNearestEnemy(), 175) -- On lance sort
end
end
else
fight:launchSpellInCell(fight:getNearestEnemy(), 175) -- On lance sort
end
end
end
end
function FlecheErosive()
if (fight:getCurrentTour() == 1 or fight:getCurrentTour() % 1 == 0) then
if (fight:launchSpellInCell(fight:getNearestEnemy(), "Flèche Érosive") == 16) then -- Si pas à portée
fight:moveToWardCell(getEmptyCell("Flèche Érosive")) -- on avance
if not (fight:launchSpellInCell(fight:getNearestEnemy(), "Flèche Érosive") == 16) then -- Si a portée
fight:launchSpellInCell(fight:getNearestEnemy(), "Flèche Érosive") -- On lance sort
fight:launchSpellInCell(fight:getNearestEnemy(), "Flèche Érosive") -- On lance sort
end
else
fight:launchSpellInCell(fight:getNearestEnemy(), "Flèche Érosive") -- On lance sort
fight:launchSpellInCell(fight:getNearestEnemy(), "Flèche Érosive") -- On lance sort
end
end
end
function FlecheDestructive()
if (fight:getCurrentTour() == 1 or fight:getCurrentTour() % 1 == 0) then
if (fight:launchSpellInCell(fight:getNearestEnemy(), 171) == 16) then -- Si pas à portée
if (fighter:getMP() > 0) then
if (fight:getDistance(getPlayerCell, getNearestEnemy) > 10) then
fight:moveToWardCell(fight:getNearestEnemy()) -- on avance
else
fight:moveFarthestCell(fight:getNearestEnemy()) -- on recul
end
if not (fight:launchSpellInCell(fight:getNearestEnemy(), 171) == 16) then -- Si a portée
fight:launchSpellInCell(fight:getNearestEnemy(), 171) -- On lance sort
end
end
else
fight:launchSpellInCell(fight:getNearestEnemy(), 171) -- On lance sort
end
if (fighter:getAP() == 4) then
if (fight:launchSpellInCell(fight:getNearestEnemy(), 175) == 16) then -- Si pas à portée
if (fighter:getMP() > 0) then
if (fight:getDistance(getPlayerCell, getNearestEnemy) > 10) then
fight:moveToWardCell(fight:getNearestEnemy()) -- on avance
else
fight:moveFarthestCell(fight:getNearestEnemy()) -- on recul
end
if not (fight:launchSpellInCell(fight:getNearestEnemy(), 175) == 16) then -- Si a portée
fight:launchSpellInCell(fight:getNearestEnemy(), 175) -- On lance sort
end
end
else
fight:launchSpellInCell(fight:getNearestEnemy(), 175) -- On lance sort
end
end
end
end
function MoveFuyard()
if (fighter:getMP() > 0) then
fight:moveFarthestCell(fight:getNearestEnemy())
end
end
Last edited by a moderator: