/
modifier_fullness.lua
73 lines (55 loc) · 1.42 KB
/
modifier_fullness.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
modifier_fullness = class({})
LinkLuaModifier("modifier_hungry", "modifiers/modifier_hungry.lua", LUA_MODIFIER_MOTION_NONE )
function modifier_fullness:IsHidden()
return false
end
function modifier_fullness:DeclareFunctions()
return { MODIFIER_PROPERTY_HEALTH_REGEN_CONSTANT }
end
function modifier_fullness:GetTexture()
return "custom_folder/modifier_fullness"
end
function modifier_fullness:OnCreated( data )
if IsServer() then
local caster = self:GetParent()
caster.fullness_count = 1
end
end
function modifier_fullness:OnRefresh( data )
if IsServer() then
local caster = self:GetParent()
if not caster.fullness_count then
caster.fullness_count = 1
else
caster.fullness_count = caster.fullness_count + 1
if caster.fullness_count == 4 then
AddFullnessAbility("wellness_man",caster)
end
end
end
end
function modifier_fullness:GetModifierConstantHealthRegen()
return 3
end
function modifier_fullness:OnDestroy()
if IsServer() then
self:GetParent():AddNewModifier(self:GetParent(), nil, "modifier_hungry", {})
end
end
function modifier_fullness:RemoveOnDeath()
return false
end
function AddFullnessAbility(name,caster)
if not caster:FindAbilityByName(name) then
for i = 0, 12 do
if not caster:GetAbilityByIndex(i) then
local ability = caster:AddAbility(name)
ability:SetLevel(1)
return nil
end
end
end
end
--function modifier_fullness:IsDebuff()
-- return false
--end