Commit 49820c00 authored by JoyJ's avatar JoyJ

fixes

parent ac0f0210
......@@ -214,7 +214,7 @@ function X.ConsiderW()
local nDamage = abilityW:GetAbilityDamage()
local nCastPoint = abilityW:GetCastPoint()
local enemies = bot:GetNearbyHeroes( castRange, true, BOT_MODE_NONE )
local nRadius = 300
local nRadius = abilityW:GetVal('radius')
if aTarget ~= nil
and aTarget:IsAlive()
......@@ -234,16 +234,16 @@ function X.ConsiderW()
if (J.IsPushing( bot ) or J.IsDefending( bot ) or J.IsLaning(bot)) and nHP > 0.7
then
local creeps = bot:GetNearbyLaneCreeps( castRange + 300, true )
local creeps = bot:GetNearbyLaneCreeps( castRange + 600, true )
local maxHit = 0
local maxHitCreep = nil
for creep in creeps do
for _,creep in pairs(creeps) do
local hit = 0
local kill = 0
for cr in creeps do
if cr~=creep and J.GetDistanceFromUnitToUnit(cr,creep) < nRadius then
if cr~=creep and cr:GetDistanceToUnit(creep) < nRadius then
hit = hit + 1
if creep:GetHealth() < nDamage then
kill = kill + 1
......
......@@ -852,32 +852,32 @@ Item['item_obsidian_destroyer_outfit'] = { 'item_tango', 'item_crown', 'item_rin
----------------------------------------------------------------------
Item['item_carry_alchemist_outfit'] = { 'item_tango', 'item_flask', 'item_quelling_blade', 'item_double_branches', 'item_circlet', 'item_magic_stick', 'item_gauntlets', 'item_recipe_bracer', 'item_recipe_magic_wand', 'item_phase_boots' }
Item['item_carry_alchemist_outfit'] = { 'item_tango', 'item_quelling_blade', 'item_double_branches', 'item_circlet', 'item_magic_stick', 'item_gauntlets', 'item_recipe_bracer', 'item_recipe_magic_wand', 'item_phase_boots' }
Item['item_ranged_carry_outfit'] = { 'item_tango', 'item_flask', 'item_double_branches', 'item_slippers', 'item_circlet', 'item_magic_stick', 'item_recipe_wraith_band', 'item_flask', 'item_power_treads_agi', 'item_recipe_magic_wand', 'item_infused_raindrop' }
Item['item_ranged_carry_outfit'] = { 'item_tango', 'item_double_branches', 'item_slippers', 'item_circlet', 'item_magic_stick', 'item_recipe_wraith_band', 'item_flask', 'item_power_treads_agi', 'item_recipe_magic_wand', 'item_infused_raindrop' }
Item['item_melee_carry_outfit'] = { 'item_tango', 'item_flask', 'item_quelling_blade', 'item_double_branches', 'item_circlet', 'item_magic_stick', 'item_slippers', 'item_recipe_wraith_band', 'item_flask', 'item_recipe_magic_wand', 'item_power_treads_agi' }
Item['item_melee_carry_outfit'] = { 'item_tango', 'item_quelling_blade', 'item_double_branches', 'item_circlet', 'item_magic_stick', 'item_slippers', 'item_recipe_wraith_band', 'item_flask', 'item_recipe_magic_wand', 'item_power_treads_agi' }
Item['item_phantom_assassin_outfit'] = { 'item_tango', 'item_flask', 'item_quelling_blade', 'item_double_branches', 'item_circlet', 'item_magic_stick', 'item_slippers', 'item_recipe_wraith_band', 'item_flask', 'item_recipe_magic_wand', 'item_power_treads_agi', 'item_blight_stone' }
Item['item_phantom_assassin_outfit'] = { 'item_tango', 'item_quelling_blade', 'item_double_branches', 'item_circlet', 'item_magic_stick', 'item_slippers', 'item_recipe_wraith_band', 'item_flask', 'item_recipe_magic_wand', 'item_power_treads_agi', 'item_blight_stone' }
Item['item_juggernaut_outfit'] = { 'item_tango', 'item_flask', 'item_quelling_blade', 'item_double_branches', 'item_circlet', 'item_magic_stick', 'item_slippers', 'item_recipe_wraith_band', 'item_flask', 'item_recipe_magic_wand', 'item_phase_boots', 'item_wraith_band' }
Item['item_juggernaut_outfit'] = { 'item_tango', 'item_quelling_blade', 'item_double_branches', 'item_circlet', 'item_magic_stick', 'item_slippers', 'item_recipe_wraith_band', 'item_flask', 'item_recipe_magic_wand', 'item_phase_boots', 'item_wraith_band' }
Item['item_huskar_outfit'] = { 'item_tango', 'item_flask', 'item_double_branches', 'item_gauntlets', 'item_circlet', 'item_magic_stick', 'item_recipe_bracer', 'item_boots', 'item_bracer', 'item_recipe_magic_wand', 'item_flask', 'item_blades_of_attack', 'item_chainmail' }
Item['item_huskar_outfit'] = { 'item_tango', 'item_double_branches', 'item_gauntlets', 'item_circlet', 'item_magic_stick', 'item_recipe_bracer', 'item_boots', 'item_bracer', 'item_recipe_magic_wand', 'item_flask', 'item_blades_of_attack', 'item_chainmail' }
Item['item_sven_outfit'] = { 'item_tango', 'item_flask', 'item_quelling_blade', 'item_double_branches', 'item_circlet', 'item_magic_stick', 'item_gauntlets', 'item_recipe_bracer', 'item_flask', 'item_recipe_magic_wand', 'item_phase_boots' }
Item['item_sven_outfit'] = { 'item_tango', 'item_quelling_blade', 'item_double_branches', 'item_circlet', 'item_magic_stick', 'item_gauntlets', 'item_recipe_bracer', 'item_flask', 'item_recipe_magic_wand', 'item_phase_boots' }
Item['item_bristleback_outfit'] = { 'item_tango', 'item_flask', 'item_quelling_blade', 'item_double_branches', 'item_circlet', 'item_magic_stick', 'item_gauntlets', 'item_recipe_bracer', 'item_flask', 'item_recipe_magic_wand', 'item_power_treads_str' }
Item['item_bristleback_outfit'] = { 'item_tango', 'item_quelling_blade', 'item_double_branches', 'item_circlet', 'item_magic_stick', 'item_gauntlets', 'item_recipe_bracer', 'item_flask', 'item_recipe_magic_wand', 'item_power_treads_str' }
----------------------------------------------------------------------
Item['item_tank_outfit'] = { 'item_tango', 'item_flask', 'item_quelling_blade', 'item_double_branches', 'item_circlet', 'item_magic_stick', 'item_gauntlets', 'item_recipe_bracer', 'item_flask', 'item_recipe_magic_wand', 'item_power_treads_str' }
Item['item_tank_outfit'] = { 'item_tango', 'item_quelling_blade', 'item_double_branches', 'item_circlet', 'item_magic_stick', 'item_gauntlets', 'item_recipe_bracer', 'item_flask', 'item_recipe_magic_wand', 'item_power_treads_str' }
Item['item_tank_lina_outfit'] = { 'item_tango', 'item_double_branches', 'item_circlet', 'item_mantle', 'item_magic_stick', 'item_recipe_null_talisman', 'item_flask', 'item_phase_boots', 'item_recipe_magic_wand' }
Item['item_dragon_knight_outfit'] = { 'item_tango', 'item_flask', 'item_quelling_blade', 'item_double_branches', 'item_gauntlets', 'item_magic_stick', 'item_flask', 'item_recipe_magic_wand', 'item_gauntlets', 'item_power_treads_str', 'item_broken_soul_ring' }
Item['item_dragon_knight_outfit'] = { 'item_tango', 'item_quelling_blade', 'item_double_branches', 'item_gauntlets', 'item_magic_stick', 'item_flask', 'item_recipe_magic_wand', 'item_gauntlets', 'item_power_treads_str', 'item_broken_soul_ring' }
Item['item_ogre_magi_outfit'] = { 'item_tango', 'item_flask', 'item_quelling_blade', 'item_double_branches', 'item_circlet', 'item_magic_stick', 'item_mantle', 'item_recipe_null_talisman', 'item_flask', 'item_recipe_magic_wand', 'item_power_treads', 'item_hand_of_midas' }
Item['item_ogre_magi_outfit'] = { 'item_tango', 'item_quelling_blade', 'item_double_branches', 'item_circlet', 'item_magic_stick', 'item_mantle', 'item_recipe_null_talisman', 'item_flask', 'item_recipe_magic_wand', 'item_power_treads', 'item_hand_of_midas' }
--------------------------------------------------------------------------
......
......@@ -3465,7 +3465,7 @@ end
function J.MergeGroup(...)
local args = {...}
local result = {}
for a in arg do
for _,a in pairs(args) do
table.insert(result,a)
end
return result
......
......@@ -7,6 +7,7 @@
--- Link:http://steamcommunity.com/sharedfiles/filedetails/?id=1627071163
----------------------------------------------------------------------------------------------------
require(GetScriptDirectory() .. "/rewrite_functions")
local X = {}
local bot = GetBot()
......@@ -248,10 +249,11 @@ end
function X.EnemyCastResponse(hTable)
local pid=hTable.player_id
local unit=hTable.unit
local ability=hTable.ability:GetName()
local ability=hTable.ability
local abilityName = ability:GetName()
local loc=hTable.location
if ability=="jakiro_macropyre" then --烈焰焚身
if abilityName=="jakiro_macropyre" then --烈焰焚身
local range=ability:GetVal('cast_range')
local radius=ability:GetVal('path_radius')
local duration=ability:GetVal('duration')
......@@ -261,18 +263,18 @@ function X.EnemyCastResponse(hTable)
for i=1,max do
local locx = J.GetVectorFromVectorToAngleWithDistance(loc, angle, radius * i)
local loc = J.GetVectorFromVectorToAngleWithDistance(loc, angle, radius * i)
loc.z = radius
AddAvoidanceZone(loc, duration)
end
elseif ability=="abyssal_underlord_firestorm" then --火焰风暴
elseif abilityName=="abyssal_underlord_firestorm" then --火焰风暴
local radius=ability:GetVal('radius')
local duration=ability:GetVal('wave_duration')
loc.z=radius
AddAvoidanceZone(loc, duration)
elseif ability=="lich_chain_frost" then --连环霜冻
elseif abilityName=="lich_chain_frost" then --连环霜冻
local radius=ability:GetVal('jump_range') + 100
for i=1,36 do
local angle = 10 * i
......@@ -280,7 +282,7 @@ function X.EnemyCastResponse(hTable)
avLoc.z=radius
AddAvoidanceZone(avLoc, 5.0)
end
elseif ability=="winter_wyvern_winters_curse" then --寒冬诅咒
elseif abilityName=="winter_wyvern_winters_curse" then --寒冬诅咒
local radius=ability:GetVal('radius')
local duration=ability:GetVal('duration')
loc.z=radius
......@@ -297,7 +299,8 @@ function X.SetReplyHumanTime( tChat )
J.Role.SetLastChatString( sChatString )
end
if string.sub(sChatString,1,2) == "/" then
print(tChat)
if string.sub(sChatString,1,2) == "=" then
X.Commands(sChatString, nChatID)
return
end
......@@ -313,14 +316,14 @@ function X.SetReplyHumanTime( tChat )
end
function X.Commands(tChat, pid)
if not bot:GetPlayerID() == J.Role.GetReplyMemberID() then return end
if tChat == "-xy" then
print(tChat)
if tChat == "=xy" then
local units = GetUnitList(UNIT_LIST_ALLIED_HEROES)
for unit in units do
if unit:IsHero() and unit:IsAlive()
and unit:GetPlayerID() == pid then
local loc=unit:GetLocation()
ActionImmediate_Chat(unit:GetUnitName() .. " : X=" .. tostring(loc.x) .. ",Y=" .. tostring(loc.y))
bot:ActionImmediate_Chat(unit:GetUnitName() .. " : X=" .. tostring(loc.x) .. ",Y=" .. tostring(loc.y))
end
end
end
......
......@@ -97,6 +97,13 @@ local function GeneralPurchase()
end
end
if bot:GetAssignedLane() == LANE_MID and not bot.buyedFlask and GetItemStockCount( 'item_flask' )>0 then
if bot:ActionImmediate_PurchaseItem( 'item_flask' ) == PURCHASE_ITEM_SUCCESS then
bot.buyedFlask = true
return
end
end
local cost = itemCost
--使得飞鞋一次购买完成
......
......@@ -565,6 +565,7 @@ function Think()
local farmTarget = J.Site.GetFarmLaneTarget(hLaneCreepList);
local nSearchRange = bot:GetAttackRange() + 180
if nSearchRange > 1600 then nSearchRange = 1600 end
if nSearchRange < 600 then nSearchRange = 600 end
local nNeutrals = bot:GetNearbyNeutralCreeps(nSearchRange);
if farmTarget ~= nil and #nNeutrals == 0 then
......
......@@ -47,4 +47,5 @@ function GetDesire()
return 0
end
-- dota2jmz@163.com QQ:2462331592..
......@@ -68,7 +68,7 @@ function CDOTA_Bot_Script.IsEnemy(unit)
return GetBot():GetTeam() ~= unit:GetTeam()
end
function CDOTA_Bot_Script.GetDistanceToUnit(unit, unit2)
if not unit2 then return 99999 end
if not unit2 or not unit2:CanBeSeen() then return 99999 end
local loc1=unit:GetLocation()
local loc2=unit2:GetLocation()
return math.sqrt(( loc1.x - loc2.x )*( loc1.x - loc2.x ) + ( loc1.y - loc2.y ) * ( loc1.y - loc2.y ))
......@@ -130,7 +130,7 @@ function CDOTA_Bot_Script.GetLocation(unit)
if not unit:CanBeSeen() then
local id=unit:GetPlayerID()
local info=GetHeroLastSeenInfo(id)
if info and info.time_since_seen < 2.0 then
if info and info.time_since_seen and info.time_since_seen < 2.0 then
return info.location
end
end
......@@ -275,7 +275,7 @@ end
local gnh=CDOTA_Bot_Script.GetNearbyHeroes
CDOTA_Bot_Script.GetNearbyHeroes = function(u,nRadius,bEnemies,eBotMode)
if not u:CanBeSeen() then return {} end
if nRadius <= 1600 and u:IsAlly() then return gnh(u,nRadius,bEnemies,eBotMode) end
if nRadius <= 1600 and u:IsBot() then return gnh(u,nRadius,bEnemies,eBotMode) end
local list
if bEnemies then
list=GetUnitList(UNIT_LIST_ENEMY_HEROES)
......@@ -292,7 +292,9 @@ end
local gnc=CDOTA_Bot_Script.GetNearbyCreeps
CDOTA_Bot_Script.GetNearbyCreeps = function(u,nRadius,bEnemies)
if not u:CanBeSeen() then return {} end
if nRadius <= 1600 and u:IsAlly() then return gnc(u,nRadius,bEnemies) end
if nRadius <= 1600 and u:IsBot() then
return gnc(u,nRadius,bEnemies)
end
local list
if bEnemies then
list=GetUnitList(UNIT_LIST_ENEMY_CREEPS) or {}
......@@ -300,11 +302,16 @@ CDOTA_Bot_Script.GetNearbyCreeps = function(u,nRadius,bEnemies)
list=GetUnitList(UNIT_LIST_ALLIED_CREEPS) or {}
end
list=FilterTable(list,function(unit)
return u:GetDistanceToUnit(unit) <= nRadius
return GetUnitToUnitDistance(u,unit) <= nRadius
end)
return list
end
_G.Unit = CDOTA_Bot_Script
table.GetNearbyCreeps = CDOTA_Bot_Script.GetNearbyCreeps
--------------------------------
--rewrite functions CDOTABaseAbility_BotScript
--------------------------------
\ No newline at end of file
--------------------------------
print("Rewrite complete")
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment