Skip to content

Commit

Permalink
Change think method since it only runs once (#633)
Browse files Browse the repository at this point in the history
Change shielder think method since it only runs once
  • Loading branch information
chrisinajar authored Apr 23, 2017
1 parent 93debbd commit 37c2500
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions game/scripts/vscripts/units/shielder.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,18 @@ function Spawn (entityKeyValues)
thisEntity:SetContextThink( "ShielderThink", partial(ShielderThink, thisEntity) , 1)
print("Starting AI for " .. thisEntity:GetUnitName() .. " " .. thisEntity:GetEntityIndex())
--Timers:CreateTimer(1, thisEntity:OnHurt(HurtHandler(keys)))

ABILITY_shield = thisEntity:FindAbilityByName("boss_shielder_shield")

local phaseController = thisEntity:AddNewModifier(thisEntity, ABILITY_shield, "modifier_boss_phase_controller", {})
phaseController:SetPhases({ 66, 33 })
phaseController:SetAbilities({
"boss_shielder_shield"
})


end

function ShielderThink (thisEntity)
thisEntity:OnHurt(function (keys)
HurtHandler(keys)
end)
if not GLOBAL_origin then
GLOBAL_origin = thisEntity:GetAbsOrigin()
end
local distance = (GLOBAL_origin - thisEntity:GetAbsOrigin()):Length()
if distance > 1000 then
ExecuteOrderFromTable({
UnitIndex = thisEntity:entindex(),
OrderType = DOTA_UNIT_ORDER_MOVE_TO_POSITION,
Position = GLOBAL_origin, --Optional. Only used when targeting the ground
Queue = 0 --Optional. Used for queueing up abilities
})
return 5
end
return 0
thisEntity:OnHurt(HurtHandler)
end

function HurtHandler (keys)
Expand Down Expand Up @@ -66,8 +48,6 @@ function HurtHandler (keys)
thisEntity.currentDamage[playerIndex] = thisEntity.currentDamage[playerIndex] - damage
end)

print(thisEntity.currentDamage[playerIndex])

local maxDamage, key = -math.huge
for k, v in pairs(thisEntity.currentDamage) do
if v > maxDamage then
Expand Down

0 comments on commit 37c2500

Please sign in to comment.