initial commit
This commit is contained in:
59
aghanim_singleplayer/scripts/vscripts/modifiers/modifier_ascension_armor.lua
Executable file
59
aghanim_singleplayer/scripts/vscripts/modifiers/modifier_ascension_armor.lua
Executable file
@@ -0,0 +1,59 @@
|
||||
|
||||
modifier_ascension_armor = class({})
|
||||
|
||||
-----------------------------------------------------------------------------------------
|
||||
|
||||
function modifier_ascension_armor:constructor()
|
||||
self.flArmor = 0
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------------------
|
||||
|
||||
function modifier_ascension_armor:IsPurgable()
|
||||
return false
|
||||
end
|
||||
|
||||
----------------------------------------
|
||||
|
||||
function modifier_ascension_armor:OnCreated( kv )
|
||||
self:OnRefresh( kv )
|
||||
end
|
||||
|
||||
----------------------------------------
|
||||
|
||||
function modifier_ascension_armor:OnRefresh( kv )
|
||||
if self:GetAbility() == nil then
|
||||
return
|
||||
end
|
||||
|
||||
local nDepth = 0
|
||||
local depth = CustomNetTables:GetTableValue( "encounter_state", "depth" )
|
||||
if depth ~= nil then
|
||||
nDepth = depth["1"]
|
||||
end
|
||||
|
||||
local min_bonus_armor = self:GetAbility():GetSpecialValueFor( "min_bonus_armor" )
|
||||
local max_bonus_armor = self:GetAbility():GetSpecialValueFor( "max_bonus_armor" )
|
||||
|
||||
-- 2 is the min depth for encounters, 17 is the max
|
||||
-- Hardcoded since we don't have access to GameRules.Aghanim on the client
|
||||
self.flArmor = LerpClamp( ( nDepth - 2.0 ) / ( 17.0 - 2.0 ), min_bonus_armor, max_bonus_armor )
|
||||
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
function modifier_ascension_armor:DeclareFunctions()
|
||||
local funcs =
|
||||
{
|
||||
MODIFIER_PROPERTY_PHYSICAL_ARMOR_BONUS,
|
||||
}
|
||||
return funcs
|
||||
end
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
function modifier_ascension_armor:GetModifierPhysicalArmorBonus( params )
|
||||
return self.flArmor
|
||||
end
|
||||
Reference in New Issue
Block a user