Commit 7d71950a authored by JoyJ's avatar JoyJ

add mureta; fix disruptor

parent bacd194c
......@@ -352,7 +352,7 @@ local hEnemyLocations = {}
local nEnemyLocationsIndex = 1
function X.UpdateEnemyLocations()
local enemies = bot:GetNearbyHeroes( 99999, true, BOT_MODE_NONE )
local enemies = GetUnitList( UNIT_LIST_ENEMY_HEROES )
for _,u in pairs(enemies) do
if not hEnemyLocations[u] then
hEnemyLocations[u] = {}
......@@ -412,10 +412,10 @@ function X.ConsiderW()
then
for _, npcEnemy in pairs( nInRangeEnemyList ) do
local newLocation = X.GetWLocation(npcEnemy)
if newLocation and GetUnitToLocationDistance(bot,newLocation)>GetUnitToUnitDistance(bot,npcEnemy)+400
if (newLocation and GetUnitToLocationDistance(bot,newLocation)>GetUnitToUnitDistance(bot,npcEnemy)+400
or nHP<0.2)
and not J.IsDisabled( npcEnemy )
and not J.IsTaunted( npcEnemy )
and not npcEnemy:IsDisarmed()
then
return BOT_ACTION_DESIRE_HIGH, npcEnemy, "W-撤退:"..J.Chat.GetNormName( npcEnemy )
end
......
----------------------------------------------------------------------------------------------------
--- The Creation Come From: BOT EXPERIMENT Credit:FURIOUSPUPPY
--- BOT EXPERIMENT Author: Arizona Fauzie 2018.11.21
--- Link:http://steamcommunity.com/sharedfiles/filedetails/?id=837040016
--- Refactor: 决明子 Email: dota2jmz@163.com 微博@Dota2_决明子
--- Link:http://steamcommunity.com/sharedfiles/filedetails/?id=1573671599
--- Link:http://steamcommunity.com/sharedfiles/filedetails/?id=1627071163
----------------------------------------------------------------------------------------------------
local X = {}
local bDebugMode = ( 1 == 10 )
local bot = GetBot()
local J = require( GetScriptDirectory()..'/FunLib/jmz_func' )
local Minion = dofile( GetScriptDirectory()..'/FunLib/aba_minion' )
local sTalentList = J.Skill.GetTalentList( bot )
local sAbilityList = J.Skill.GetAbilityList( bot )
local sOutfitType = J.Item.GetOutfitType( bot )
local tTalentTreeList = {
['t25'] = {0, 10},
['t20'] = {10, 0},
['t15'] = {10, 0},
['t10'] = {10, 0},
}
local nAbilityBuildList = {3,2,3,1,3,6,3,2,2,2,6,1,1,1,6}
local nTalentBuildList = J.Skill.GetTalentBuild( tTalentTreeList )
local tOutFitList = {}
tOutFitList['outfit_carry'] = {
"item_ranged_carry_outfit",
"item_maelstrom",
"item_mask_of_madness",
"item_dragon_lance",
"item_black_king_bar",
"item_travel_boots",
"item_monkey_king_bar",
"item_hurricane_pike",
"item_mjollnir",
"item_moon_shard",
"item_travel_boots_2",
}
tOutFitList['outfit_mid'] = tOutFitList['outfit_carry']
tOutFitList['outfit_priest'] = {
"item_priest_outfit",
"item_mekansm",
"item_shadow_amulet",
"item_guardian_greaves",
"item_spirit_vessel",
"item_glimmer_cape",
"item_wraith_pact",
"item_shivas_guard",
"item_mystic_staff",
"item_sheepstick",
}
tOutFitList['outfit_mage'] = tOutFitList['outfit_priest']
tOutFitList['outfit_tank'] = tOutFitList['outfit_priest']
X['sBuyList'] = tOutFitList[sOutfitType]
X['sSellList'] = {
"item_travel_boots",
"item_quelling_blade",
"item_black_king_bar",
"item_magic_wand",
"item_travel_boots",
"item_magic_wand",
"item_assault",
"item_ancient_janggo",
}
if J.Role.IsPvNMode() or J.Role.IsAllShadow() then X['sBuyList'], X['sSellList'] = { 'PvN_tank' }, {"item_power_treads", 'item_quelling_blade'} end
nAbilityBuildList, nTalentBuildList, X['sBuyList'], X['sSellList'] = J.SetUserHeroInit( nAbilityBuildList, nTalentBuildList, X['sBuyList'], X['sSellList'] )
X['sSkillList'] = J.Skill.GetSkillList( sAbilityList, nAbilityBuildList, sTalentList, nTalentBuildList )
X['bDeafaultAbility'] = false
X['bDeafaultItem'] = false
function X.MinionThink( hMinionUnit )
if Minion.IsValidUnit( hMinionUnit )
then
Minion.IllusionThink( hMinionUnit )
end
end
local abilityQ = bot:GetAbilityByName( sAbilityList[1] )
local abilityW = bot:GetAbilityByName( sAbilityList[2] )
local abilityE = bot:GetAbilityByName( sAbilityList[3] )
local abilityR = bot:GetAbilityByName( sAbilityList[6] )
local castQDesire, castQTarget, castQVector
local castWDesire, castWLocation
local castEDesire, castETarget
local castRDesire
local nKeepMana, nMP, nHP, nLV, hEnemyList, hAllyList, botTarget, sMotive
local aetherRange = 0
function X.SkillsComplement()
J.ConsiderForMkbDisassembleMask( bot )
if bot.theRole == 'support' and nAbilityBuildList[1]==3 then
nAbilityBuildList = {1,2,1,2,1,6,1,2,2,3,6,3,3,3,6}
tTalentTreeList = {
['t25'] = {0, 10},
['t20'] = {0, 10},
['t15'] = {0, 10},
['t10'] = {0, 10},
}
nTalentBuildList = J.Skill.GetTalentBuild( tTalentTreeList )
X['sSkillList'] = J.Skill.GetSkillList( sAbilityList, nAbilityBuildList, sTalentList, nTalentBuildList )
end
if J.CanNotUseAbility( bot ) or bot:IsInvisible() then return end
nKeepMana = 400
aetherRange = 0
nLV = bot:GetLevel()
nMP = bot:GetMana() / bot:GetMaxMana()
nHP = bot:GetHealth() / bot:GetMaxHealth()
botTarget = J.GetProperTarget( bot )
hEnemyList = bot:GetNearbyHeroes( 1600, true, BOT_MODE_NONE )
hAllyList = J.GetAlliesNearLoc( bot:GetLocation(), 1600 )
--计算天赋可能带来的通用变化
local aether = J.IsItemAvailable( "item_aether_lens" )
if aether ~= nil then aetherRange = 250 end
castRDesire, castRTarget, sMotive = X.ConsiderR()
if castRDesire > 0 then
J.SetReportMotive( bDebugMode, sMotive )
J.SetQueuePtToINT( bot, true )
bot:Action_UseAbility( abilityR )
--释放BKB
local abilityBKB = J.IsItemAvailable( "item_black_king_bar" )
if abilityBKB ~= nil
and abilityBKB:IsFullyCastable()
and bot:GetMana() > abilityBKB:GetManaCost()
then
bot:ActionQueue_UseAbility( abilityBKB )
end
--释放疯脸
local abilityMoM = J.IsItemAvailable( "item_mask_of_madness" )
if abilityMoM ~= nil
and abilityMoM:IsFullyCastable()
and bot:GetMana() > abilityMoM:GetManaCost()
then
bot:ActionQueue_UseAbility( abilityMoM )
end
return
end
castQDesire, castQTarget, castQVector, sMotive = X.ConsiderQ()
--no way to use castQVector for now
if castQDesire > 0 then
J.SetReportMotive( bDebugMode, sMotive )
J.SetQueuePtToINT( bot, true )
bot:ActionQueue_UseAbilityOnEntity(abilityQ,castQTarget)
return
end
castWDesire, castWLocation, sMotive = X.ConsiderW()
if castWDesire > 0 then
J.SetReportMotive( bDebugMode, sMotive )
J.SetQueuePtToINT( bot, true )
bot:ActionQueue_UseAbilityOnLocation( abilityW, castWLocation )
return
end
end
function X.ConsiderQ()
if not abilityQ:IsFullyCastable() then return 0 end
local nSkillLV = abilityQ:GetLevel()
local nCastRange = abilityQ:GetCastRange()
local nCastPoint = abilityQ:GetCastPoint()
local nManaCost = abilityQ:GetManaCost()
local nDamage = abilityQ:GetAbilityDamage()
local nDamageType = DAMAGE_TYPE_MAGICAL
local nInRangeEnemyList = J.GetAroundEnemyHeroList( nCastRange )
local hCastTarget = nil
local sCastMotive = nil
--击杀
for _, npcEnemy in pairs( nInRangeEnemyList )
do
if J.IsValidHero( npcEnemy )
and J.CanCastOnNonMagicImmune( npcEnemy )
and J.WillMagicKillTarget( bot, npcEnemy, nDamage, nCastPoint ) then
return BOT_ACTION_DESIRE_HIGH, npcEnemy,nil, 'Q-击杀'..J.Chat.GetNormName( npcEnemy )
end
end
--团战
if J.IsInTeamFight( bot, 1200 ) and DotaTime() > 4 * 60 then
local npcEnemy = J.GetLeastHpUnit(nInRangeEnemyList)
if npcEnemy then
return BOT_ACTION_DESIRE_HIGH, npcEnemy, "W-团战"..J.Chat.GetNormName( npcEnemy )
end
end
return BOT_ACTION_DESIRE_NONE
end
function X.GetWCastSilentLocation(vLocation)
local nRadius = 320
local locations={ J.GetVectorFromVectorToAngleWithDistance(vLocation,0,nRadius),
J.GetVectorFromVectorToAngleWithDistance(vLocation,90,nRadius),
J.GetVectorFromVectorToAngleWithDistance(vLocation,270,nRadius),
J.GetVectorFromVectorToAngleWithDistance(vLocation,360,nRadius),
}
if nLV>=25 then
locations= { J.GetVectorFromVectorToAngleWithDistance(vLocation,30,nRadius),
J.GetVectorFromVectorToAngleWithDistance(vLocation,90,nRadius),
J.GetVectorFromVectorToAngleWithDistance(vLocation,150,nRadius),
J.GetVectorFromVectorToAngleWithDistance(vLocation,210,nRadius),
J.GetVectorFromVectorToAngleWithDistance(vLocation,270,nRadius),
J.GetVectorFromVectorToAngleWithDistance(vLocation,330,nRadius),
}
end
for _,vLoc in pairs(locations) do
if GetUnitToLocationDistance(bot,vLoc) < abilityW:GetCasterRange() then
return vLoc
end
end
return nil
end
function X.ConsiderW()
if not abilityW:IsFullyCastable() then return 0 end
local nSkillLV = abilityW:GetLevel()
local nCastRange = abilityW:GetCastRange() + aetherRange
local nRadius = abilityW:GetAOERadius()
local nCastPoint = abilityW:GetCastPoint()
local nManaCost = abilityW:GetManaCost()
local nDamage = abilityW:GetAbilityDamage()
local nDamageType = DAMAGE_TYPE_MAGICAL
local nInRangeEnemyList = bot:GetNearbyHeroes( nCastRange, true, BOT_MODE_NONE )
local nTargetLocation = nil
--打断施法
for _, npcEnemy in pairs( hEnemyList )
do
if npcEnemy:IsChanneling()
and not npcEnemy:HasModifier( 'modifier_teleporting' )
and J.IsInRange( bot, npcEnemy, nCastRange + nRadius )
and J.CanCastOnNonMagicImmune( npcEnemy )
then
nTargetLocation = X.GetWCastSilentLocation(npcEnemy:GetLocation())
if nTargetLocation then
return BOT_ACTION_DESIRE_HIGH, nTargetLocation, "W-打断施法:"..J.Chat.GetNormName( npcEnemy )
end
end
end
if J.IsGoingOnSomeone( bot )then
--AOE
local nAoeLoc = J.GetAoeEnemyHeroLocation( bot, nCastRange, nRadius, 2 )
if nAoeLoc ~= nil
then
nTargetLocation = nAoeLoc
return BOT_ACTION_DESIRE_HIGH, nTargetLocation, 'W-Aoe'
end
--攻击
if J.IsValidHero( botTarget )
and J.IsInRange( bot, botTarget, nCastRange + nRadius - 200 )
and J.CanCastOnNonMagicImmune( botTarget )
and ( J.IsInRange( bot, botTarget, 700 ) or botTarget:IsFacingLocation( bot:GetLocation(), 40 ) )
and not J.IsDisabled( botTarget )
then
nTargetLocation = J.GetCastLocation( bot, botTarget, nCastRange, nRadius )
if nTargetLocation ~= nil
then
return BOT_ACTION_DESIRE_HIGH, nTargetLocation, "W-Attack:"..J.Chat.GetNormName( botTarget )
end
end
end
return BOT_ACTION_DESIRE_NONE
end
function X.ConsiderR()
if not abilityR:IsFullyCastable() then
return 0
end
local nEnemysHerosInBonus = bot:GetNearbyHeroes( bot:GetAttackRange() + 150, true, BOT_MODE_NONE )
--打架时
if J.IsGoingOnSomeone( bot )
then
local npcTarget = J.GetProperTarget( bot )
if J.IsValidHero( npcTarget )
and ( J.GetHP( npcTarget ) > 0.25 or #nEnemysHerosInBonus >= 2 )
and ( J.IsInRange( npcTarget, bot, 700 )
or J.IsInRange( npcTarget, bot, npcTarget:GetAttackRange() + 80 ) )
then
return BOT_ACTION_DESIRE_HIGH
end
end
return 0
end
return X
-- dota2jmz@163.com QQ:2462331592..
......@@ -3704,6 +3704,15 @@ Chat['tHeroNameList'] = {
},
-- 123
['npc_dota_hero_muerta'] = {
['sNormName'] = '琼碧',
['sShortName'] = 'muerta',
['sCnName'] = '琼英碧灵',
['sEnName'] = 0,
},
}
......
......@@ -1493,6 +1493,30 @@ X["hero_roles"] = {
['support'] = 3,
['pusher'] = 0
},
["npc_dota_hero_primal_beast"] = {
['carry'] = 0,
['disabler'] = 2,
['durable'] = 1,
['escape'] = 1,
['initiator'] = 3,
['jungler'] = 0,
['nuker'] = 0,
['support'] = 1,
['pusher'] = 0
},
["npc_dota_hero_muerta"] = {
['carry'] = 2,
['disabler'] = 2,
['durable'] = 0,
['escape'] = 1,
['initiator'] = 0,
['jungler'] = 2,
['nuker'] = 3,
['support'] = 2,
['pusher'] = 2
},
}
......@@ -1647,6 +1671,7 @@ X['off'] = {
'npc_dota_hero_tusk',
'npc_dota_hero_venomancer',
'npc_dota_hero_windrunner',
'npc_dota_hero_primal_beast',
}
X['mid'] = {
......@@ -1716,6 +1741,7 @@ X['safe'] = {
'npc_dota_hero_ogre_magi',
'npc_dota_hero_omniknight',
'npc_dota_hero_marci',
'npc_dota_hero_muerta',
}
......@@ -1763,7 +1789,6 @@ X['supp'] = {
'npc_dota_hero_death_prophet',
'npc_dota_hero_windrunner',
'npc_dota_hero_venomancer',
}
......
......@@ -437,11 +437,12 @@ function J.GetAlliesNearLoc( vLoc, nRadius )
end
function J.GetEnemiesNearLoc(bot, vLoc, nRadius)
local enemies = bot:GetNearbyHeroes( 99999, true, BOT_MODE_NONE )
local enemies = GetUnitList( UNIT_LIST_ENEMY_HEROES )
return J.FilterGroup(enemies,function(u)
return u:IsAlive()
and GetUnitToLocationDistance( u, vLoc ) <= nRadius
return GetUnitToLocationDistance( u, vLoc ) <= nRadius
end)
end
function J.IsAllyHeroBetweenAllyAndEnemy( hAlly, hEnemy, vLoc, nRadius )
......@@ -3258,6 +3259,145 @@ function J.Or(...)
end
end
function J.GetAngle(x1,y1,x2,y2)
return math.deg(math.atan2( y2 - y1, x2 - x1 ))
end
function J.GetDistance(x1, y1, x2, y2)
return math.sqrt(( x1 - x2 )*( x1 - x2 ) + ( y1 - y2 ) * ( y1 - y2 ))
end
function J.GetAngleFromVectorToXY(v, x, y)
return J.GetAngle(v.x, v.y, x, y)
end
function J.GetAngleFromXYToVector(x, y, v)
return J.GetAngle(x, y, v.x, v.y)
end
function J.GetAngleFromVectorToVector(v1, v2)
return J.GetAngle(v1.x, v1.y, v2.x, v2.y)
end
function J.GetDistanceFromVectorToXY(v, x, y)
return J.GetDistance(v.x, v.y, x, y)
end
function J.GetDistanceFromXYToVector(x, y, v)
return J.GetDistance(x, y, v.x, v.y)
end
function J.GetDistanceFromVectorToVector(v1, v2)
return J.GetDistance(v1.x, v1.y, v2.x, v2.y)
end
function J.GetAngleFromUnitToXY(unit, x, y)
return J.GetAngleFromVectorToXY(unit:GetLocation(), x, y)
end
function J.GetAngleFromUnitToVector(unit, v)
return J.GetAngleFromVectorToVector(unit:GetLocation(), v)
end
function J.GetAngleFromVectorToUnit(v, unit)
return J.GetAngleFromVectorToVector(v, unit:GetLocation())
end
function J.GetAngleFromUnitToUnit(unit1, unit2)
return J.GetAngleFromVectorToVector(unit1:GetLocation(), unit2:GetLocation())
end
function J.GetDistanceFromUnitToXY(unit, x, y)
return J.GetDistanceFromVectorToXY(unit:GetLocation(), x, y)
end
function J.GetDistanceFromUnitToUnit(unit1, unit2)
return J.GetDistanceFromVectorToVector(unit1:GetLocation(), unit2:GetLocation())
end
function J.GetDistanceFromUnitToVector(unit, vector)
return J.GetDistanceFromVectorToVector(unit:GetLocation(), vector)
end
function J.GetUnitFacingAngle(unit)
return J.GetAngleFromVectorToVector(RandomVector(0.0), unit:GetForwardVector())
end
function J.GetVectorFromVectorRotation(v, center, rotate)
local angle = J.GetAngleFromVectorToVector(center, v)
angle = angle + rotate
local r = J.GetDistanceFromVectorToVector(center, v)
return J.GetVectorFromVectorToAngleWithDistance(center, angle, r, nil)
end
function J.GetAngleBetweenTwoAngles(angleA, angleB)
--返回角A与角B之间的夹角
local a = math.rad(angleA)
local b = math.rad(angleB)
local r = math.abs( a - b )
if r > math.pi then
r = math.pi * 2 - r
end
return math.deg(r)
end
function J.GetDistanceFromPointToLine(x, y, x1, y1, x2, y2)
--过(x1,y1) (x2,y2)两点作直线,返回(x,y)到这条直线的距离
if x1 == x2 then
return math.abs( y - y1 )
elseif y1 == y2 then
return math.abs( x - x1 )
end
return J.GetDistance( ( y + ( x2 - x1 ) / ( y2 - y1 ) * x + ( y2 - y1 ) / ( x2 - x1 ) * x2 - y2 ) / ( ( y2 - y1 ) / ( x2 - x1 ) + ( x2 - x1 ) / ( y2 - y1 ) ), ( y2 - y1 ) / ( x2 - x1 ) * ( ( y + ( x2 - x1 ) / ( y2 - y1 ) * x + ( y2 - y1 ) / ( x2 - x1 ) * x2 - y2 ) / ( ( y2 - y1 ) / ( x2 - x1 ) + ( x2 - x1 ) / ( y2 - y1 ) ) ) + y2 - ( y2 - y1 ) / ( x2 - x1 ) * x2, x, y )
end
function J.PointInRectangle(p, p1, a, d, r)
local x = p.x
local y = p.y
local x1 = p1.x
local y1 = p1.y
--从(x1,y1)起向a方向作一条直线。若(x,y)到这条直线的直线距离小于d,且到(x1,y1)的距离小于r,则返回真
return J.GetDistanceFromPointToLine( x, y, x1, y1, x1 + math.cos( math.rad(a) ) * r, y1 + math.sin( math.rad(a) ) * r ) < d and J.GetDistance( x, y, x1, y1 ) < r and J.GetAngleBetweenTwoAngles( J.GetAngle( x1, y1, x, y ), a ) < 90
end
function J.GetVectorFromVectorToAngleWithDistance(v, a, d)
--从vector v开始,向a方向d距离的位置。
a = math.rad(a)
local newV = RandomVector(0.0)
newV.x = v.x + math.cos(a) * d
newV.y = v.y + math.sin(a) * d
return newV
end
function J.VectorToAngle(v)
return J.GetAngleFromVectorToVector(RandomVector(0.0), v)
end
function J.Cos(angle)
return math.cos(math.rad(angle))
end
function J.Sin(angle)
return math.sin(math.rad(angle))
end
function J.CosSin(angle)
return J.Cos(angle),J.Sin(angle)
end
function J.AngleToVector(angle)
local v=RandomVector(0.0)
v.x=CosSin(angle)
return v
end
function J.GetRandomPointInCircle(center, max, min)
min = min or 0
if max <= 1 then max = 1 end
if max < min then min, max = max, min end
local distribute = 1 / (max * max - min * min)
local r = math.sqrt(RandomFloat(0,1.0) / distribute + min * min)
local angle = RandomFloat(0,360)
return J.GetVectorFromVectorToAngleWithDistance(center, angle, r, nil)
end
return J
--[[
......
......@@ -91,7 +91,7 @@ local sUserKeyDir = Chat.GetUserKeyDir()
--'npc_dota_hero_legion_commander',
'npc_dota_hero_leshrac',
--'npc_dota_hero_lich',
'npc_dota_hero_life_stealer',
--'npc_dota_hero_life_stealer',
--'npc_dota_hero_lina',
--'npc_dota_hero_lion',
'npc_dota_hero_lone_druid',
......@@ -230,6 +230,7 @@ local sHasDevelopmentHeroList = {
"npc_dota_hero_templar_assassin",
"npc_dota_hero_razor",
"npc_dota_hero_mirana",
"npc_dota_hero_muerta",
}
......@@ -256,6 +257,7 @@ local sSecondList = {
"npc_dota_hero_centaur",
"npc_dota_hero_crystal_maiden",
"npc_dota_hero_zuus",
"npc_dota_hero_disruptor",
"npc_dota_hero_jakiro",
"npc_dota_hero_skywrath_mage",
"npc_dota_hero_lina",
......@@ -286,6 +288,7 @@ local sThirdList = {
"npc_dota_hero_axe",
"npc_dota_hero_slark",
"npc_dota_hero_juggernaut",
"npc_dota_hero_muerta",
}
local sFourthList = {
......@@ -343,6 +346,7 @@ local sPriestList = {
-- "npc_dota_hero_windrunner",
"npc_dota_hero_queenofpain",
"npc_dota_hero_disruptor",
"npc_dota_hero_muerta",
}
local sMageList = {
......@@ -408,7 +412,7 @@ local sCarryList = {
"npc_dota_hero_mirana",
"npc_dota_hero_naga_siren",
"npc_dota_hero_life_stealer",
"npc_dota_hero_muerta",
}
......@@ -451,9 +455,8 @@ local sMidList = {
"npc_dota_hero_nevermore",
"npc_dota_hero_razor",
"npc_dota_hero_sniper",
"npc_dota_hero_sniper",
"npc_dota_hero_viper",
"npc_dota_hero_viper",
"npc_dota_hero_muerta",
}
......
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