Commit 7725cdd2 authored by JoyJ's avatar JoyJ

improve centaur W and Q

parent 1e0b77f8
...@@ -155,7 +155,7 @@ function X.ConsiderQ() ...@@ -155,7 +155,7 @@ function X.ConsiderQ()
local nManaCost = abilityQ:GetManaCost() local nManaCost = abilityQ:GetManaCost()
local nDamage = abilityQ:GetAbilityDamage() local nDamage = abilityQ:GetAbilityDamage()
local nDamageType = DAMAGE_TYPE_MAGICAL local nDamageType = DAMAGE_TYPE_MAGICAL
local nInRangeEnemyList = bot:GetNearbyHeroes( nRadius, true, BOT_MODE_NONE ) local nInRangeEnemyList = bot:GetNearbyHeroes( nRadius + 300, true, BOT_MODE_NONE )
local hCastTarget local hCastTarget
local sCastMotive local sCastMotive
...@@ -175,17 +175,17 @@ function X.ConsiderQ() ...@@ -175,17 +175,17 @@ function X.ConsiderQ()
--攻击敌人时 --攻击敌人时
if J.IsGoingOnSomeone( bot ) if J.IsGoingOnSomeone( bot )
then then
local loc = J.GetCorrectLoc(botTarget, nCastPoint)
if J.IsValidHero( botTarget ) if J.IsValidHero( botTarget )
and J.IsInRange( botTarget, bot, nRadius - 90 ) and J.GetDistanceFromUnitToVector(bot, loc) < nRadius
and J.CanCastOnNonMagicImmune( botTarget ) and J.CanCastOnNonMagicImmune( botTarget )
and (not J.IsDisabled( botTarget ) or J.GetRemainStunTime(botTarget)<0.5) and (not J.IsDisabled( botTarget ) or J.GetRemainStunTime(botTarget)< nCastPoint + 0.5)
then then
hCastTarget = botTarget hCastTarget = botTarget
sCastMotive = 'Q-先手'..J.Chat.GetNormName( hCastTarget ) sCastMotive = 'Q-先手'..J.Chat.GetNormName( hCastTarget )
return BOT_ACTION_DESIRE_HIGH, sCastMotive return BOT_ACTION_DESIRE_HIGH, sCastMotive
end end
end end
--打肉时 --打肉时
if bot:GetActiveMode() == BOT_MODE_ROSHAN if bot:GetActiveMode() == BOT_MODE_ROSHAN
...@@ -233,24 +233,30 @@ function X.ConsiderW() ...@@ -233,24 +233,30 @@ function X.ConsiderW()
return BOT_ACTION_DESIRE_HIGH, aTarget, "W-攻击当前目标" return BOT_ACTION_DESIRE_HIGH, aTarget, "W-攻击当前目标"
end end
if (J.IsPushing( bot ) or J.IsDefending( bot )) and nHP > 0.7 if (J.IsPushing( bot ) or J.IsDefending( bot ) or J.IsLaning(bot)) and nHP > 0.7
then then
local creeps = bot:GetNearbyLaneCreeps( castRange, true ) local creeps = bot:GetNearbyLaneCreeps( castRange + 300, true )
if #creeps >= 2 and creeps[1] ~= nil and not creeps[1]:HasModifier( "modifier_fountain_glyph" )
then local maxHit = 0
return BOT_ACTION_DESIRE_HIGH, creeps[1], "W-推进" local maxHitCreep = nil
for creep in creeps do
local hit = 0
local kill = 0
for cr in creeps do
if cr~=creep and J.GetDistanceFromUnitToUnit(cr,creep) < nRadius then
hit = hit + 1
if creep:GetHealth() < nDamage then
kill = kill + 1
end
end
end
if maxHit < hit and kill > 0 then
maxHit = hit
maxHitCreep = creep
end
end end
end if maxHitCreep then return BOT_ACTION_DESIRE_HIGH, maxHitCreep, "W-推进" end
if J.IsLaning( bot ) and nHP > 0.5 then
local creeps = bot:GetNearbyLaneCreeps( castRange, true )
if #creeps > 1 then
for i=1, #creeps do
if J.WillMagicKillTarget(bot, creeps[i], nDamage, nCastPoint) then
return BOT_ACTION_DESIRE_HIGH, creeps[i], "W-对线"
end
end
end
end end
if J.IsGoingOnSomeone( bot ) if J.IsGoingOnSomeone( bot )
...@@ -295,6 +301,8 @@ function X.ConsiderR() ...@@ -295,6 +301,8 @@ function X.ConsiderR()
if npcAlly ~= nil if npcAlly ~= nil
and npcAlly:IsAlive() and npcAlly:IsAlive()
and nHP < 0.2 and npcAlly:WasRecentlyDamagedByAnyHero(2.0) and nHP < 0.2 and npcAlly:WasRecentlyDamagedByAnyHero(2.0)
and not npcAlly:IsStunned()
and npcAlly:GetCurrentMovementSpeed() < 500
then then
return BOT_ACTION_DESIRE_HIGH, "R-帮助队友逃跑" return BOT_ACTION_DESIRE_HIGH, "R-帮助队友逃跑"
end end
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
--- mid, mage, priest --- mid, mage, priest
---------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------
local X = {} local X = {}
local bDebugMode = ( 10 == 10 ) local bDebugMode = ( 1 == 10 )
local bot = GetBot() local bot = GetBot()
local J = require( GetScriptDirectory()..'/FunLib/jmz_func' ) local J = require( GetScriptDirectory()..'/FunLib/jmz_func' )
......
...@@ -699,8 +699,8 @@ function X.ConsiderGrimstrokeStrokeOfFate( bot ) ...@@ -699,8 +699,8 @@ function X.ConsiderGrimstrokeStrokeOfFate( bot )
local nAoeLoc = J.GetAoeEnemyHeroLocation( bot, nCastRange, nRadius, 2 ) local nAoeLoc = J.GetAoeEnemyHeroLocation( bot, nCastRange, nRadius, 2 )
if nAoeLoc ~= nil if nAoeLoc ~= nil
and J.IsAllowedToSpam( bot, nManaCost * 0.72 ) and nSkillLV > 1
and nMP > 0.38 and J.IsAllowedToSpam( bot, nManaCost )
then then
nTargetLocation = nAoeLoc nTargetLocation = nAoeLoc
return BOT_ACTION_DESIRE_HIGH, nTargetLocation, "StrokeOfFate-Harass" return BOT_ACTION_DESIRE_HIGH, nTargetLocation, "StrokeOfFate-Harass"
...@@ -710,9 +710,8 @@ function X.ConsiderGrimstrokeStrokeOfFate( bot ) ...@@ -710,9 +710,8 @@ function X.ConsiderGrimstrokeStrokeOfFate( bot )
then then
nAoeLoc = J.GetAoeEnemyHeroLocation( bot, nCastRange, nRadius, 1 ) nAoeLoc = J.GetAoeEnemyHeroLocation( bot, nCastRange, nRadius, 1 )
if nAoeLoc ~= nil if nAoeLoc ~= nil
and J.IsAllowedToSpam( bot, nManaCost * 0.72 ) and nSkillLV > 1
and nMP > 0.58 and nMP > 0.9
and not nEnemyHeroesInRange[1]:HasModifier( 'modifier_templar_assassin_refraction_absorb' )
then then
nTargetLocation = nAoeLoc nTargetLocation = nAoeLoc
return BOT_ACTION_DESIRE_HIGH, nTargetLocation, "StrokeOfFate-Harass" return BOT_ACTION_DESIRE_HIGH, nTargetLocation, "StrokeOfFate-Harass"
...@@ -748,9 +747,9 @@ function X.ConsiderGrimstrokeStrokeOfFate( bot ) ...@@ -748,9 +747,9 @@ function X.ConsiderGrimstrokeStrokeOfFate( bot )
end end
if ( J.IsPushing( bot ) or J.IsDefending( bot ) or J.IsFarming( bot ) ) if J.IsPushing( bot ) or J.IsDefending( bot ) or J.IsFarming( bot ) or (J.IsLaning(bot) and bot:GetAssignedLane() == LANE_MID)
and J.IsAllowedToSpam( bot, nManaCost * 0.72 ) and J.IsAllowedToSpam( bot, nManaCost )
and nSkillLV >= 2 and DotaTime() > 8 * 60 and nSkillLV >= 2
then then
local nEnemyCreeps = bot:GetNearbyLaneCreeps( nCastRange + nRadius, true ) local nEnemyCreeps = bot:GetNearbyLaneCreeps( nCastRange + nRadius, true )
if #nEnemyCreeps >= 3 if #nEnemyCreeps >= 3
...@@ -769,7 +768,7 @@ function X.ConsiderGrimstrokeStrokeOfFate( bot ) ...@@ -769,7 +768,7 @@ function X.ConsiderGrimstrokeStrokeOfFate( bot )
if J.IsFarming( bot ) if J.IsFarming( bot )
and not ( J.IsPushing( bot ) or J.IsDefending( bot ) ) and not ( J.IsPushing( bot ) or J.IsDefending( bot ) )
and J.IsAllowedToSpam( bot, nManaCost * 0.25 ) and J.IsAllowedToSpam( bot, nManaCost )
and nSkillLV >= 3 and nSkillLV >= 3
and #nEnemyHeroesInRange == 0 and #nEnemyHeroesInRange == 0
and #nAlliedHeroesInRange <= 2 and #nAlliedHeroesInRange <= 2
...@@ -788,7 +787,6 @@ function X.ConsiderGrimstrokeStrokeOfFate( bot ) ...@@ -788,7 +787,6 @@ function X.ConsiderGrimstrokeStrokeOfFate( bot )
end end
end end
end end
if bot:GetActiveMode() == BOT_MODE_ROSHAN if bot:GetActiveMode() == BOT_MODE_ROSHAN
and nMP >= 0.78 and nMP >= 0.78
...@@ -801,7 +799,6 @@ function X.ConsiderGrimstrokeStrokeOfFate( bot ) ...@@ -801,7 +799,6 @@ function X.ConsiderGrimstrokeStrokeOfFate( bot )
end end
end end
return BOT_ACTION_DESIRE_NONE, nil return BOT_ACTION_DESIRE_NONE, nil
end end
...@@ -1019,11 +1016,11 @@ function X.ConsiderGrimstrokeDarkPortrait( bot ) ...@@ -1019,11 +1016,11 @@ function X.ConsiderGrimstrokeDarkPortrait( bot )
if nMostDangerousEnemy ~= nil if nMostDangerousEnemy ~= nil
and J.IsInRange( nMostDangerousEnemy, bot, nCastRange ) and J.IsInRange( nMostDangerousEnemy, bot, nCastRange )
and J.IsGoingOnSomeone(bot)
then then
return BOT_ACTION_DESIRE_HIGH, nMostDangerousEnemy, "DarkPortrait-Battle:"..J.Chat.GetNormName( nMostDangerousEnemy ) return BOT_ACTION_DESIRE_HIGH, nMostDangerousEnemy, "DarkPortrait-Battle:"..J.Chat.GetNormName( nMostDangerousEnemy )
end end
if J.IsGoingOnSomeone( bot ) if J.IsGoingOnSomeone( bot )
then then
if J.IsValidHero( botTarget ) if J.IsValidHero( botTarget )
......
...@@ -3472,6 +3472,13 @@ function J.FilterGroup(nList,func) ...@@ -3472,6 +3472,13 @@ function J.FilterGroup(nList,func)
return newGroup return newGroup
end end
function J.MergeGroup(nList,...)
local args = {...}
for a in arg do
table.insert(nList,a)
end
end
function J.Not(f) function J.Not(f)
return function(...) return function(...)
return not f(...) return not f(...)
...@@ -3479,7 +3486,7 @@ function J.Not(f) ...@@ -3479,7 +3486,7 @@ function J.Not(f)
end end
function J.And(...) function J.And(...)
local funcList=table.unpack(...) local funcList={...}
return function(...) return function(...)
for _,func in pairs(funcList) do for _,func in pairs(funcList) do
if not func(...) then if not func(...) then
...@@ -3491,7 +3498,7 @@ function J.And(...) ...@@ -3491,7 +3498,7 @@ function J.And(...)
end end
function J.Or(...) function J.Or(...)
local funcList=table.unpack(...) local funcList={...}
return function(...) return function(...)
for _,func in pairs(funcList) do for _,func in pairs(funcList) do
if func(...) then if func(...) then
...@@ -3503,10 +3510,14 @@ function J.Or(...) ...@@ -3503,10 +3510,14 @@ function J.Or(...)
end end
function J.GetAngle(x1,y1,x2,y2) function J.GetAngle(x1,y1,x2,y2)
return math.deg(math.atan2( y2 - y1, x2 - x1 )) if math.atan2 then
return math.deg(math.atan2( y2 - y1, x2 - x1 ))
else
return math.deg(math.atan( y2 - y1, x2 - x1 ))
end
end end
function J.GetDistance(x1, y1, x2, y2) function J.GetDistanceFromXYToXY(x1, y1, x2, y2)
return math.sqrt(( x1 - x2 )*( x1 - x2 ) + ( y1 - y2 ) * ( y1 - y2 )) return math.sqrt(( x1 - x2 )*( x1 - x2 ) + ( y1 - y2 ) * ( y1 - y2 ))
end end
...@@ -3523,15 +3534,15 @@ function J.GetAngleFromVectorToVector(v1, v2) ...@@ -3523,15 +3534,15 @@ function J.GetAngleFromVectorToVector(v1, v2)
end end
function J.GetDistanceFromVectorToXY(v, x, y) function J.GetDistanceFromVectorToXY(v, x, y)
return J.GetDistance(v.x, v.y, x, y) return J.GetDistanceFromXYToXY(v.x, v.y, x, y)
end end
function J.GetDistanceFromXYToVector(x, y, v) function J.GetDistanceFromXYToVector(x, y, v)
return J.GetDistance(x, y, v.x, v.y) return J.GetDistanceFromXYToXY(x, y, v.x, v.y)
end end
function J.GetDistanceFromVectorToVector(v1, v2) function J.GetDistanceFromVectorToVector(v1, v2)
return J.GetDistance(v1.x, v1.y, v2.x, v2.y) return J.GetDistanceFromXYToXY(v1.x, v1.y, v2.x, v2.y)
end end
function J.GetAngleFromUnitToXY(unit, x, y) function J.GetAngleFromUnitToXY(unit, x, y)
...@@ -3593,7 +3604,7 @@ function J.GetDistanceFromPointToLine(x, y, x1, y1, x2, y2) ...@@ -3593,7 +3604,7 @@ function J.GetDistanceFromPointToLine(x, y, x1, y1, x2, y2)
elseif y1 == y2 then elseif y1 == y2 then
return math.abs( x - x1 ) return math.abs( x - x1 )
end 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 ) return J.GetDistanceFromXYToXY( ( 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 end
function J.PointInRectangle(p, p1, a, d, r) function J.PointInRectangle(p, p1, a, d, r)
...@@ -3613,6 +3624,7 @@ function J.GetVectorFromVectorToAngleWithDistance(v, a, d) ...@@ -3613,6 +3624,7 @@ function J.GetVectorFromVectorToAngleWithDistance(v, a, d)
newV.y = v.y + math.sin(a) * d newV.y = v.y + math.sin(a) * d
return newV return newV
end end
function J.VectorToAngle(v) function J.VectorToAngle(v)
return J.GetAngleFromVectorToVector(RandomVector(0.0), v) return J.GetAngleFromVectorToVector(RandomVector(0.0), v)
end end
...@@ -3647,6 +3659,33 @@ function J.DebugMessage(str,b) ...@@ -3647,6 +3659,33 @@ function J.DebugMessage(str,b)
end end
end end
function J.FindAoeLocationForLinearSkill(data)
local range = data.range or 600
local radius = data.range or 200
local castPoint = data.castPoint or 0.5
local projSpeed = data.projSpeed or 1000
local onlyHero = data.onlyHero or true
local bot = GetBot()
local loc=data.loc or bot:GetLocation()
local enemyHeroes = bot:GetNearbyHeroes( range, true, BOT_MODE_NONE )
local creeps = bot:GetNearbyLaneCreeps( range + nRadius, true )
--AOE
local most=0
local nAoeLoc
for i=1,36 do
local angle = 10 * i
local hitEnemy = J.FilterGroup(nEnemyHeroesInRange,function(u)
return J.IsValidHero(u) and not u:IsMagicImmune()
and J.PointInRectangle(u:GetLocation(),bot:GetLocation(),angle,nCastRange,nRadius)
end)
if #hitEnemy>most then
most=#hitEnemy
nAoeLoc=J.GetVectorFromVectorToAngleWithDistance(bot:GetLocation(), angle, nCastRange - 100)
end
end
end
return J return J
--[[ --[[
......
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