-- $Id: bot_Voevoda.lua,v 1.71 2009-08-07 10:10:58 a.abolishin Exp $ --[[ AKEB (c) 19.03.2009 17:01 Бот Воевода !для функций Voevoda_main Перед боем: -Использовать на произвольного противника абилку А1(призыв). Каждый ход проверяет уровень оппонентов, - если против бота ИГРОК 6 уровня или старше и на игроке нет абилки А2(дебаф), использовать на этого игрока А2(дебаф). - если против бота БОТ 6 уровня или старше, не входящий в список {B}, и на этом боте нет абилки А3(яд), использовать на этого бота А3(яд). Перед ударом: -С вероятностью R1 применить на произвольного игрока своей команды абилку А4(лечилка). -С вероятностью R2 применить на произвольного игрока противоположной команды абилку А5(травилка). !для функций Voevoda_opp то же самое, но только без применения А1. [Скрипт Скрипт: bot_Voevoda.lua Управляющая функция: bot_Voevoda_mainhum bot_Voevoda_mainmagm bot_Voevoda_opphum bot_Voevoda_oppmagm Управляющая функция для теста: bot_Voevoda_tmain bot_Voevoda_topp ] [function function bot_Voevoda_mainhum A= {4192, 4189, 4196, 4187, 4186} B= {763} function bot_Voevoda_mainmagm A= {4191, 4190, 4196, 4187, 4186} B= {762} function bot_Voevoda_opphum A= {0, 4189, 4196, 4187, 4186} B= {0} function bot_Voevoda_oppmagm A= {0, 4190, 4196, 4187, 4186} B= {0} function bot_Voevoda_tmain A= {4067, 161, 4170, 167, 169} B= {753} function bot_Voevoda_topp A= {0, 161, 4170, 167, 169} B= {0} ] --]] function bot_Voevoda_r(T, A, R, IMax, time_, B) local botId = PERS_ID(my.persPtr) -- Инициализация bot_VoevodaInitTable(botId, time_) -- Использовать на произвольного противника абилку А1(призыв). if A[1] > 0 and bot_VoevodaArtUsed[botId] < 1 then local target = aux.getRandVal(PERS_LIST(aux.oppTeamNum(), true)) if target then local status = aux.useEffect({artId = A[1]}, target) if status == 0 then bot_VoevodaArtUsed[botId] = 1 end end end -- Использовать А2 if bot_VoevodaArtUsed2[botId] < 1 then local status = aux.useEffect({artId = A[2]}) if status == 0 then bot_VoevodaArtUsed2[botId] = 1 end end local sort_min = function (a,b) return PERS_LEVEL(a) < PERS_LEVEL(b) end local sort_max = function (a, b) return PERS_LEVEL(a) > PERS_LEVEL(b) end local persListMyTeam = aux.getPersList(my.teamNum, true, true, false) if persListMyTeam then for _, persPtr in pairs(persListMyTeam) do local persId = PERS_ID(persPtr) if not aux.inTable(persId, bot_VoevodaPersCast) then aux.useEffect({artId = A[7]}, persPtr) -- +hp aux.useEffect({artId = A[8]}, persPtr) -- +resist table.insert(bot_VoevodaPersCast, persId) end end if #persListMyTeam > 0 then table.sort(persListMyTeam, sort_min) end end --local persListMyOppTeam = aux.getPersList(aux.oppTeamNum(),nil,nil,false) local persListMyOppTeam = aux.getPersList(nil, nil, true, false) local maxLevel = 0 if #persListMyOppTeam > 0 then table.sort(persListMyOppTeam, sort_max) maxLevel = PERS_LEVEL(persListMyOppTeam[1]) end local I = 0 if bot_VoevodaMaxLevel[botId] ~= maxLevel then bot_VoevodaMaxLevel[botId] = maxLevel bot_VoevodaGlob[botId] = {} end for _, persPtr in pairs(persListMyTeam) do if I >= IMax then break; end local pers = PERS(persPtr) if not aux.inTable(pers.id, bot_VoevodaGlob[botId]) then if T[pers.level] and T[pers.level][bot_VoevodaMaxLevel[botId]] then for t_id, t_art in pairs(T[pers.level][bot_VoevodaMaxLevel[botId]]) do aux.useEffect({artId = t_art}, persPtr) bot_VoevodaGlob[botId][pers.id] = 1 end I = I + 1 end table.insert(bot_VoevodaGlob[botId], pers.id) end end local N = #aux.getPersList(aux.oppTeamNum(), true, true, false) local R1 = math.min(math.max(R[3]-((R[3]-R[1])*(R[3]-R[2])*(50-10))/(50*(R[3]-R[2])-10*(R[3]-R[1])+N*(R[2]-R[1])),0),1) if aux.randRoll(R1) then local persPtr = aux.getPersList(my.teamNum, true, true, false, 1) if persPtr and (#persPtr > 0) then aux.useEffect({artId = A[4]}, persPtr[1]) end end local M = #aux.getPersList(aux.oppTeamNum(),false,true,false) local R2 = math.min(math.max(R[6]-((R[6]-R[4])*(R[6]-R[5])*(50-10))/(50*(R[6]-R[5])-10*(R[6]-R[4])+M*(R[5]-R[4])),0),1) if aux.randRoll(R2) then --local persPtr = aux.getPersList(aux.oppTeamNum(),true,true,false,1) local persPtr = aux.getPersList(aux.oppTeamNum(), true, true, false, 1) if persPtr and (#persPtr > 0) then aux.useEffect({artId = A[5]}, persPtr[1]) end end if my.status ~= FS_PS_ACTIVE then -- если наш статус неактивный, ничего не делаем return end local goddamnedenemies = aux.getPersList(aux.oppTeamNum(), true, true, true) if goddamnedenemies then for _, enemyPtr in pairs(goddamnedenemies) do local pers = PERS(enemyPtr) if (not aux.inTable(pers.artId, B)) and (#aux.activeEffects(enemyPtr, {artId = A[6]}) < 1) then aux.useEffect({artId = A[6]}, enemyPtr) end end end if bot_VoevodaTime[botId] < my.stime and PERS_COUNT(my.teamNum, true) < 2 then local persListToDie = aux.getPersList(aux.oppTeamNum(), true, true, true) for _,persPtr in pairs(persListToDie) do local pers = PERS(persPtr) if aux.inTable(pers.artId,B) then aux.useEffect({artId = A[3]}, persPtr) end end aux.useEffect({artId = A[3]}) end ATTACK(math.random(3)) end function bot_VoevodaInitTable(botId,T1) if botId == nil then return; end if bot_VoevodaTime == nil then bot_VoevodaTime = {} end if bot_VoevodaTime[botId] == nil then bot_VoevodaTime[botId] = my.stime+T1 end if bot_VoevodaArtUsed == nil then bot_VoevodaArtUsed = {} end if bot_VoevodaArtUsed[botId] == nil then bot_VoevodaArtUsed[botId] = 0 end if bot_VoevodaArtUsed2 == nil then bot_VoevodaArtUsed2 = {} end if bot_VoevodaArtUsed2[botId] == nil then bot_VoevodaArtUsed2[botId] = 0 end if bot_VoevodaGlob == nil then bot_VoevodaGlob= {} end if bot_VoevodaGlob[botId] == nil then bot_VoevodaGlob[botId] = {} end if bot_VoevodaMaxLevel == nil then bot_VoevodaMaxLevel = {} end if bot_VoevodaMaxLevel[botId] == nil then bot_VoevodaMaxLevel[botId] = -1 end -- список тех на кого мы уже скастовали +hp и +resist if bot_VoevodaPersCast == nil then bot_VoevodaPersCast = {} end if bot_VoevodaPersCast[botId] == nil then bot_VoevodaPersCast[botId]= {} end end ----------------------------------------------------------------------------------------------------------------------------------- -- botID = 766 function bot_Voevoda_mainhum() local T = { [2] = { [3]={4253,4269}, [4]={4256,4271}, [5]={4259,4273}, }, [3] = { [4]={4253,4269}, [5]={4256,4271}, }, [4] = { [5]={4253,4269}, }, [6] = { [7]={4253,4269}, [8]={4256,4271}, [9]={4259,4273}, [10]={4260,4274}, }, [7] = { [8]={4253,4269}, [9]={4256,4271}, [10]={4259,4273}, }, [8] = { [9]={4253,4269}, [10]={4256,4271}, }, [9] = { [10]={4253,4269}, }, [11] = { [12]={4252,4268}, [13]={4253,4269}, [14]={4255,4270}, [15]={4257,4272}, }, [12] = { [13]={4252,4268}, [14]={4253,4269}, [15]={4255,4270}, }, [13] = { [14]={4252,4268}, [15]={4253,4269}, }, [14] = { [15]={4252,4268}, } } return bot_Voevoda_r(T,{4192,4222,2608,4187,4186,4196, 5007, 5008},{0.029, 0.07, 0.117, -0.0075, 0.03, 0.05},2,420,{763}) end -- botID = 767 function bot_Voevoda_mainmagm() local T = { [2] = { [3]={4262,4276}, [4]={4264,4278}, [5]={4266,4280}, }, [3] = { [4]={4262,4276}, [5]={4264,4278}, }, [4] = { [5]={4262,4276}, }, [6] = { [7]={4262,4276}, [8]={4264,4278}, [9]={4266,4280}, [10]={4267,4281}, }, [7] = { [8]={4262,4276}, [9]={4264,4278}, [10]={4266,4280}, }, [8] = { [9]={4262,4276}, [10]={4264,4278}, }, [9] = { [10]={4262,4276}, }, [11] = { [12]={4261,4275}, [13]={4262,4276}, [14]={4263,4277}, [15]={4265,4279}, }, [12] = { [13]={4261,4275}, [14]={4262,4276}, [15]={4263,4277}, }, [13] = { [14]={4261,4275}, [15]={4262,4276}, }, [14] = { [15]={4261,4275}, } } return bot_Voevoda_r(T,{4191,4225,2608,4187,4186,4188, 5007, 5008},{0.029, 0.07, 0.117, -0.0075, 0.03, 0.05},2,420,{762}) end -- botID = 762 function bot_Voevoda_opphum() local T = { [2] = { [3]={4253,4269}, [4]={4256,4271}, [5]={4259,4273}, }, [3] = { [4]={4253,4269}, [5]={4256,4271}, }, [4] = { [5]={4253,4269}, }, [6] = { [7]={4253,4269}, [8]={4256,4271}, [9]={4259,4273}, [10]={4260,4274}, }, [7] = { [8]={4253,4269}, [9]={4256,4271}, [10]={4259,4273}, }, [8] = { [9]={4253,4269}, [10]={4256,4271}, }, [9] = { [10]={4253,4269}, }, [11] = { [12]={4252,4268}, [13]={4253,4269}, [14]={4255,4270}, [15]={4257,4272}, }, [12] = { [13]={4252,4268}, [14]={4253,4269}, [15]={4255,4270}, }, [13] = { [14]={4252,4268}, [15]={4253,4269}, }, [14] = { [15]={4252,4268}, } } return bot_Voevoda_r(T,{0,4222,2608,4187,4186,4196, 5007, 5008},{0.029, 0.07, 0.117, -0.0075, 0.03, 0.05},2,420,{767}) end -- botID = 763 function bot_Voevoda_oppmagm() local T = { [2] = { [3]={4262,4276}, [4]={4264,4278}, [5]={4266,4280}, }, [3] = { [4]={4262,4276}, [5]={4264,4278}, }, [4] = { [5]={4262,4276}, }, [6] = { [7]={4262,4276}, [8]={4264,4278}, [9]={4266,4280}, [10]={4267,4281}, }, [7] = { [8]={4262,4276}, [9]={4264,4278}, [10]={4266,4280}, }, [8] = { [9]={4262,4276}, [10]={4264,4278}, }, [9] = { [10]={4262,4276}, }, [11] = { [12]={4261,4275}, [13]={4262,4276}, [14]={4263,4277}, [15]={4265,4279}, }, [12] = { [13]={4261,4275}, [14]={4262,4276}, [15]={4263,4277}, }, [13] = { [14]={4261,4275}, [15]={4262,4276}, }, [14] = { [15]={4261,4275}, } } return bot_Voevoda_r(T,{0,4225,2608,4187,4186,4188, 5007, 5008},{0.029, 0.07, 0.117, -0.0075, 0.03, 0.05},2,420,{766}) end function bot_Voevoda_mainhum_t() local T = { [2] = { [3]={4253,4269}, [4]={4256,4271}, [5]={4259,4273}, }, [3] = { [4]={4253,4269}, [5]={4256,4271}, }, [4] = { [5]={4253,4269}, }, [6] = { [7]={4253,4269}, [8]={4256,4271}, [9]={4259,4273}, [10]={4260,4274}, }, [7] = { [8]={4253,4269}, [9]={4256,4271}, [10]={4259,4273}, }, [8] = { [9]={4253,4269}, [10]={4256,4271}, }, [9] = { [10]={4253,4269}, }, [11] = { [12]={4252,4268}, [13]={4253,4269}, [14]={4255,4270}, [15]={4257,4272}, }, [12] = { [13]={4252,4268}, [14]={4253,4269}, [15]={4255,4270}, }, [13] = { [14]={4252,4268}, [15]={4253,4269}, }, [14] = { [15]={4252,4268}, } } return bot_Voevoda_r(T,{4192,4222,2608,4187,4186,4196},{0.029, 0.07, 0.117, -0.0075, 0.03, 0.05},2,120,{763}) end function bot_Voevoda_mainmagm_t() local T = { [2] = { [3]={4262,4276}, [4]={4264,4278}, [5]={4266,4280}, }, [3] = { [4]={4262,4276}, [5]={4264,4278}, }, [4] = { [5]={4262,4276}, }, [6] = { [7]={4262,4276}, [8]={4264,4278}, [9]={4266,4280}, [10]={4267,4281}, }, [7] = { [8]={4262,4276}, [9]={4264,4278}, [10]={4266,4280}, }, [8] = { [9]={4262,4276}, [10]={4264,4278}, }, [9] = { [10]={4262,4276}, }, [11] = { [12]={4261,4275}, [13]={4262,4276}, [14]={4263,4277}, [15]={4265,4279}, }, [12] = { [13]={4261,4275}, [14]={4262,4276}, [15]={4263,4277}, }, [13] = { [14]={4261,4275}, [15]={4262,4276}, }, [14] = { [15]={4261,4275}, } } return bot_Voevoda_r(T,{4191,4225,2608,4187,4186,4188},{0.029, 0.07, 0.117, -0.0075, 0.03, 0.05},2,120,{762}) end function bot_Voevoda_opphum_t() local T = { [2] = { [3]={4253,4269}, [4]={4256,4271}, [5]={4259,4273}, }, [3] = { [4]={4253,4269}, [5]={4256,4271}, }, [4] = { [5]={4253,4269}, }, [6] = { [7]={4253,4269}, [8]={4256,4271}, [9]={4259,4273}, [10]={4260,4274}, }, [7] = { [8]={4253,4269}, [9]={4256,4271}, [10]={4259,4273}, }, [8] = { [9]={4253,4269}, [10]={4256,4271}, }, [9] = { [10]={4253,4269}, }, [11] = { [12]={4252,4268}, [13]={4253,4269}, [14]={4255,4270}, [15]={4257,4272}, }, [12] = { [13]={4252,4268}, [14]={4253,4269}, [15]={4255,4270}, }, [13] = { [14]={4252,4268}, [15]={4253,4269}, }, [14] = { [15]={4252,4268}, } } return bot_Voevoda_r(T,{0,4222,2608,4187,4186,4196},{0.029, 0.07, 0.117, -0.0075, 0.03, 0.05},2,120,{767}) end function bot_Voevoda_oppmagm_t() local T = { [2] = { [3]={4262,4276}, [4]={4264,4278}, [5]={4266,4280}, }, [3] = { [4]={4262,4276}, [5]={4264,4278}, }, [4] = { [5]={4262,4276}, }, [6] = { [7]={4262,4276}, [8]={4264,4278}, [9]={4266,4280}, [10]={4267,4281}, }, [7] = { [8]={4262,4276}, [9]={4264,4278}, [10]={4266,4280}, }, [8] = { [9]={4262,4276}, [10]={4264,4278}, }, [9] = { [10]={4262,4276}, }, [11] = { [12]={4261,4275}, [13]={4262,4276}, [14]={4263,4277}, [15]={4265,4279}, }, [12] = { [13]={4261,4275}, [14]={4262,4276}, [15]={4263,4277}, }, [13] = { [14]={4261,4275}, [15]={4262,4276}, }, [14] = { [15]={4261,4275}, } } return bot_Voevoda_r(T,{0,4225,2608,4187,4186,4188},{0.029, 0.07, 0.117, -0.0075, 0.03, 0.05},2,120,{766}) end