--[[ a.abolishin Межрасовый замок. ]] -- атакующий бот function bot_CastleAttacker_r(A, C) local bot = PERS(my.persPtr) local pwnage = lookupParam("Fight", "owner_sieges_number") or 1 pwnage = pwnage - 1 -- размер команды if bot_CastleAttackerPersCount == nil then bot_CastleAttackerPersCount = {} end if bot_CastleAttackerPersCount[bot.id] == nil then bot_CastleAttackerPersCount[bot.id] = 0 end -- время для отступления if bot_CastleAttackerTime == nil then bot_CastleAttackerTime = {} end if bot_CastleAttackerTime[bot.id] == nil then bot_CastleAttackerTime[bot.id] = my.stime + C[2] end -- проверяем всех на наличие бафов -- берем полный список (избегаем: 1 сдох + 1 зашел) local myTeam = aux.getPersList(my.teamNum, nil, true, false) if myTeam then -- получаем валидный список local myTeamSize = #myTeam -- получаем размер списка -- если вдруг размер команды изменился (в большую сторону) if myTeamSize > bot_CastleAttackerPersCount[bot.id] then for _, persPtr in pairs(myTeam) do -- то начинаем проверять if PERS_HP(persPtr) > 0 then -- но только живых -- если нужны эффекты, а их нету if (pwnage > 0) and (#aux.activeEffects(persPtr, {artId = A[2]}) < 1) then for i=1, pwnage do -- кидаем нужное кол-во aux.useEffect({artId = A[2]}, persPtr) end end end end bot_CastleAttackerPersCount[bot.id] = myTeamSize -- запоминаем новый размер команды end end -- можем ли ходить? if my.status ~= FS_PS_ACTIVE then return end -- отлечка/отступление local inTimeout = (bot_CastleAttackerTime[bot.id]-my.stime) >= 0 local hpC = bot.hp/bot.hpMax -- если еще не время if inTimeout then -- а уже мало хп if (hpC < C[1]) and (#aux.activeEffects(my.persPtr, {artId = A[1]}) < 1) then aux.useEffect({artId = A[1]}) -- то лечимся end else -- а если уже время пришло if #aux.getPersList(my.teamNum, true, true, false) > 0 then -- а еще есть живые if (hpC < C[1]) and (#aux.activeEffects(my.persPtr, {artId = A[1]}) < 1) then aux.useEffect({artId = A[1]}) -- то лечимся end else -- а если живых нет aux.useEffect({artId = A[3]}) -- валим из боя end end ATTACK(math.random(3)) end -- бот защитник function bot_CastleDefender_r(A, C) local bot = PERS(my.persPtr) -- время для отступления if bot_CastleDefenderTime == nil then bot_CastleDefenderTime = {} end if bot_CastleDefenderTime[bot.id] == nil then bot_CastleDefenderTime[bot.id] = my.stime + C[2] end -- можем ли ходить? if my.status ~= FS_PS_ACTIVE then return end -- отлечка/отступление local inTimeout = (bot_CastleDefenderTime[bot.id]-my.stime) >= 0 local hpC = bot.hp/bot.hpMax -- если еще не время if inTimeout then -- а уже мало хп if (hpC < C[1]) and (#aux.activeEffects(my.persPtr, {artId = A[1]}) < 1) then aux.useEffect({artId = A[1]}) -- то лечимся end else -- а если уже время пришло if #aux.getPersList(my.teamNum, true, true, false) > 0 then -- а еще есть живые if (hpC < C[1]) and (#aux.activeEffects(my.persPtr, {artId = A[1]}) < 1) then aux.useEffect({artId = A[1]}) -- то лечимся end else -- а если живых нет aux.useEffect({artId = A[2]}) -- валим из боя end end ATTACK(math.random(3)) end -- botId = 974, 1147 function bot_CastleAttacker() -- лечилка, antipwnage баф, отступление local A = {6736, 6737, 2608} -- порог жизни для отлечки, таймаут для слива боя local C = {0.75, 420} bot_CastleAttacker_r(A, C) end -- botId = 975, 1146 function bot_CastleDefender() -- лечилка, отступление local A = {6736, 2608} -- порог жизни для отлечки, таймаут для слива боя local C = {0.75, 540} bot_CastleDefender_r(A, C) end