Created
August 12, 2014 19:04
-
-
Save Numbers11/49b5355592f95ae94720 to your computer and use it in GitHub Desktop.
Without debug output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ | |
Use like this: | |
1. Create scalingdamage.lua in scripts/vscripts, copy the content of this file in | |
2. require('scalingdamage') on top of your addon_game_mode.lua file | |
3. In KV files, use like this: | |
"RunScript" | |
{ | |
"ScriptFile" "scripts/vscripts/scalingdamage.lua" | |
"Function" "DealScalingDamage" | |
"Target" "TARGET" | |
"UnitStat" "TARGET" //Which units stats should be used? TARGET or CASTER | |
"Stat" "Intelligence" //Other possible values: MaxHealth, Health, Mana, MaxMana, Armor, PrimaryAttribute, Intelligence, Agiliy, Strength | |
"DamageType" "Pure" //Magical, Pure, Composite, Physical, HpRemoval | |
"Factor" "1.5" | |
} | |
]] | |
function DealScalingDamage(keys) | |
--local stat = 'Get' .. keys.Stat -- lolwhynot | |
local table = {} | |
-- local statval = statunit[stat](self) | |
-- print('!! '.. statval) | |
-- if keys.StatUnit == "TARGET" then | |
-- local statunit = keys.target | |
-- else | |
-- local statunit = keys.caster | |
-- end | |
local statunit = keys.caster | |
if keys.UnitStat == "TARGET" then | |
statunit = keys.target | |
end | |
table.victim = keys.target | |
table.attacker = keys.caster | |
if keys.Stat == "MaxHealth" then | |
table.damage = keys.Factor * statunit:GetMaxHealth() | |
elseif keys.Stat == "Health" then | |
table.damage = keys.Factor * statunit:GetHealth() | |
elseif keys.Stat == "Mana" then | |
table.damage = keys.Factor * statunit:GetMana() | |
elseif keys.Stat == "MaxMana" then | |
table.damage = keys.Factor * statunit:GetMaxMana() | |
elseif keys.Stat == "Armor" then | |
table.damage = keys.Factor * statunit:GetPhysicalArmorValue() | |
elseif keys.Stat == "PrimaryAttribute" then | |
table.damage = keys.Factor * statunit:GetPrimaryAttribute() | |
elseif keys.Stat == "Intelligence" then | |
table.damage = keys.Factor * statunit:GetIntellect() | |
elseif keys.Stat == "Strength" then | |
table.damage = keys.Factor * statunit:GetStrength() | |
elseif keys.Stat == "Agility" then | |
table.damage = keys.Factor * statunit:GetAgility() | |
end | |
if keys.DamageType == "Pure" then | |
table.damage_type = DAMAGE_TYPE_PURE | |
elseif keys.DamageType == "Magical" then | |
table.damage_type = DAMAGE_TYPE_MAGICAL | |
elseif keys.DamageType == "Physical" then | |
table.damage_type = DAMAGE_TYPE_PHYSICAL | |
elseif keys.DamageType == "Composite" then | |
table.damage_type = DAMAGE_TYPE_COMPOSITE | |
elseif keys.DamageType == "HpRemoval" then | |
table.damage_type = DAMAGE_TYPE_HP_REMOVAL | |
end | |
-- {victim = keys.target, attacker = keys.caster, damage = keys.Damage, damage_type = keys.DamageType} | |
--print('---SCALING DAMAGE FUNCTION---') | |
--PrintTable(keys) | |
--print('-----------------------------') | |
--PrintTable(table) | |
--print('-----------------------------') | |
ApplyDamage(table) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment