-- $Id: bot_Magushelp2.lua,v 1.4 2009-04-15 08:22:42 vadim_b Exp $ --[[ AKEB (c) 19.06.2008 18:26 Маг Поддержки Перед ударом Если на ком-то из своей команды нет абилки, наложить ее на себя () Если на противнике нет абилки, наложить на него Определить группу по уровню противника Определить абилку для этого уровня Проверить если на боте не стоит абилка с текущей группы по максимальную, то надожить Скрипт: bot_Magushelp.lua Управляющая функция: bot_Magushelp --]] artikulIdGroup = {0, 2605,2605,2605,2605,2605,2605,2605} groupLevel = {0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7} maxGroup = 8 function bot_Magushelp() if my.status ~= FS_PS_ACTIVE then return end local bot_id = PERS_ID(my.persPtr) bot_MagushelpInitTurnCount(bot_id) if bot_MagushelpTurnCount[bot_id] >= 10 then aux.useEffect({artId = 2608}) return end local persList = PERS_LIST(my.teamNum,true,nil) local cnt = 0 for _,persPtr in pairs(persList) do if not PERS_ISBOT(persPtr) then cnt = 1 break end end if cnt > 0 then bot_MagushelpTurnCount[bot_id] = 0 else bot_MagushelpTurnCount[bot_id] = bot_MagushelpTurnCount[bot_id] + 1 end for _,persPtr in pairs(persList) do if #aux.activeEffects(persPtr,{artId = 2606}) < 1 then aux.useEffect({artId = 2606}) break end end if #aux.activeEffects(my.oppPtr,{artId = 2607}) < 1 then aux.useEffect({artId = 2607},my.oppPtr) end local level = PERS_LEVEL(my.oppPtr) local group = groupLevel[level] if group == nil then group = 0 end local artikulId = artikulIdGroup[group+1] if artikulId == nil then artikulId = 0 end local key=0 local error = false for key=group+1,maxGroup do if #aux.activeEffects(my.persPtr,{artId = artikulIdGroup[key]}) > 0 then error = true break end end if error == false then aux.useEffect({artId = artikulId}) end ATTACK(math.random(3)) end function bot_MagushelpInitTurnCount(botId) if bot_MagushelpTurnCount == nil then bot_MagushelpTurnCount={} end -- Если глобальная переменная не существует создаем ее if botId == nil then return; end -- если не задан ID бота, ничего не делаем if bot_MagushelpTurnCount[botId] == nil then bot_MagushelpTurnCount[botId]=0 end -- Если нет глобальной переменной с Этим ботом создаем ее со значением 0 end