Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function U.CanDodgeIncomingProjectile(npcBot, delaySeconds, invulnerabilitySeconds)
- local projectileSpeeds = {
- ['vengefulspirit_magic_missile'] = 1250,
- ['sniper_assassinate'] = 2500,
- ['chaos_knight_chaos_bolt'] = 1000,
- ['alchemist_unstable_concoction_throw'] = 900,
- ['sven_storm_hammer'] = 1000,
- ['skeleton_king_hellfire_blast'] = 1000
- }
- local incProj = npcBot:GetIncomingTrackingProjectiles()
- for _,p in pairs(incProj)
- do
- local projectileSpeed = projectileSpeeds[p.ability:GetName()]
- if not p.is_attack and projectileSpeed ~= nil then
- local distance = GetUnitToLocationDistance(npcBot, p.location)
- local hitTime = distance / projectileSpeed
- if hitTime > delaySeconds and hitTime < delaySeconds + invulnerabilitySeconds then
- npcBot:ActionImmediate_Chat( "Dodging: " .. p.ability:GetName() , true );
- return true;
- end
- end
- end
- end
- -----
- local manta=IsItemAvailable("item_manta");
- if manta~=nil and manta:IsFullyCastable()
- then
- if mutil.CanDodgeIncomingProjectile(bot, 0, 0.1)
- then
- bot:Action_UseAbility(manta);
- return;
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement