-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathfight_simul.lua
103 lines (83 loc) · 3.83 KB
/
fight_simul.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
-------------------------------------------------------------------------------
--- AUTHOR: Nostrademous
--- GITHUB REPO: https://github.com/Nostrademous/Dota2-FullOverwrite
-------------------------------------------------------------------------------
_G._savedEnv = getfenv()
module( "fight_simul", package.seeall )
-------------------------------------------------------------------------------
local skills = {
bloodseeker = {
"bloodseeker_bloodrage",
"bloodseeker_blood_bath",
"bloodseeker_thirst",
"bloodseeker_rupture"
},
lion = {
"lion_impale",
"lion_voodoo",
"lion_mana_drain",
"lion_finger_of_death"
},
lina = {
"lina_light_strike_array",
"lina_dragon_slave",
"lina_fiery_soul",
"lina_laguna_blade"
}
}
function considerAbility(ability, hTarget)
if not ability then return 0, 0, 0, 0, 0 end
local channelTime = ability:GetChannelTime()
if not ability:IsPassive() and ability:IsFullyCastable() and (not channelTime > 0) then
local actualOneTimeCastDmg = ability:GetEstimatedDamageToTarget(hTarget, 10.0, ability:GetDamageType())
return actualOneTimeCastDmg, ability:GetManaCost(), ability:GetCastPoint(), 0, ability:GetCooldown() --FIXME: Duration
end
if ability:IsFullyCastable() and channelTime > 0 then
local actualOneTimeCastDmg = ability:GetEstimatedDamageToTarget(hTarget, channelTime, ability:GetDamageType())
return actualOneTimeCastDmg, ability:GetManaCost(), ability:GetCastPoint(), channelTime, ability:GetCooldown()
end
if ability:IsPassive() or ability:IsToggle() then
-- check if it provides a buff
end
return 0, 0, 0, 0, 0
end
function getLinaDmg(duration, hero, target)
local manaPool = hero:GetMana()
local abilityQ = hero:GetAbilityByName(skills.lina[1])
local abilityW = hero:GetAbilityByName(skills.lina[2])
local abilityE = hero:GetAbilityByName(skills.lina[3])
local abilityR = hero:GetAbilityByName(skills.lina[4])
local rightClickDmg = hero:GetAttackDamage()
local rightClickCastPoint = hero:GetAttackPoint()
local qDmg, qMC, qCP, qDur, qCD = considerAbility(abilityQ, target)
local wDmg, wMC, wCP, wDur, wCD = considerAbility(abilityW, target)
local eDmg, eMC, eCP, eDur, eCD = considerAbility(abilityE, target)
local rDmg, rMC, rCP, rDur, rCD = considerAbility(abilityR, target)
local comboTimeToCast = qCP + wCP + eCP + rCP
local comboDamage = qDmg + wDmg + eDmg + rDmg
local comboManaCost = qMc + wMC + eMC + rMC
local startTime = 0
local totalDmg = 0
while startTime < duration do
considerAbility(abilityQ)
totalDmg = totalDmg + target:GetActualIncomingDamage(rightClickDmg, DAMAGE_TYPE_PHYSICAL)
startTime = startTime + rightClickDmg
end
return totalDmg
end
function estimateRightClickDamage( hHero, hTarget, fDuration )
if hTarget == nil or hTarget:IsNull() or not hTarget:IsAlive() then return 0 end
local actualDmg = hTarget:GetActualIncomingDamage(hHero:GetAttackDamage(), DAMAGE_TYPE_PHYSICAL)
local numHits = math.floor(fDuration/hHero:GetSecondsPerAttack())
return actualDmg*numHits
end
function estimateTimeToKill(hero, target)
if target == nil or target:IsNull() or not target:IsAlive() then return 10000 end
local rightClickDmg = hero:GetAttackDamage()
local rightClickCastPoint = hero:GetAttackPoint()
local actualDmg = target:GetActualIncomingDamage(rightClickDmg, DAMAGE_TYPE_PHYSICAL)
local numHits = math.ceil(target:GetHealth()/actualDmg)
return hero:GetSecondsPerAttack()*(numHits-1) + rightClickCastPoint
end
-------------------------------------------------------------------------------
for k,v in pairs( fight_simul ) do _G._savedEnv[k] = v end