- 3 Июн 2017
- 45
- 0
- Проект
- Dotomemium Phoenix
Хочу сделать абилку, чтобы давала стаки всех статов каждый раз, когда герой получает урон при хп <200. Не работает
Код:
"zenkai"
{
// General
//-------------------------------------------------------------------------------------------------------------
"BaseClass" "ability_datadriven"
"AbilityBehavior" "DOTA_ABILITY_BEHAVIOR_PASSIVE"
"AbilityType" "DOTA_ABILITY_TYPE_ULTIMATE"
"SpellImmunityType" "SPELL_IMMUNITY_ENEMIES_NO"
"FightRecapLevel" "2"
"AbilityTextureName" "skeleton_king_reincarnation"
// Time
//-------------------------------------------------------------------------------------------------------------
"AbilityCooldown" "260 160 60"
// Cost
//-------------------------------------------------------------------------------------------------------------
"AbilityManaCost" "160"
// Stats
//-------------------------------------------------------------------------------------------------------------
"AbilityModifierSupportValue" "0.2" // Slow isn't the main function of this ability.
"AbilitySpecial"
{
"01"
{
"var_type" "FIELD_INTEGER"
"reward_damage" "2 3 5 8"
}
}
"precache"
{
"soundfile" "soundevents/game_sounds_heroes/game_sounds_skeletonking.vsndevts"
"particle" "particles/units/heroes/hero_skeletonking/wraith_king_reincarnate.vpcf"
"particle" "particles/units/heroes/hero_skeletonking/skeleton_king_death.vpcf"
"particle" "particles/units/heroes/hero_skeletonking/wraith_king_reincarnate_slow_debuff.vpcf"
}
"Modifiers"
{
"modifier_reincarnation"
{
"Passive" "1"
"IsHidden" "1"
"OnTakeDamage"
{
"RunScript"
{
"ScriptFile" "heroes/hero_skeleton_king/reincarnation.lua"
"Function" "Reincarnation"
"RewardDamage" "%reward_damage"
}
}
}
"modifier_duel_damage_datadriven"
{
"Attributes" "MODIFIER_ATTRIBUTE_PERMANENT"
"Properties"
{
"MODIFIER_PROPERTY_STATS_STRENGTH_BONUS" "1"
"MODIFIER_PROPERTY_STATS_AGILITY_BONUS" "1"
"MODIFIER_PROPERTY_STATS_INTELLECT_BONUS" "1"
}
}
}
}
Код:
function Reincarnation( event )
local caster = event.caster
local casterHP = caster:GetHealth()
local ability = keys.ability
local modifier_duel = "modifier_duel_datadriven"
if casterHP <= 200 then
if not caster:HasModifier(modifier_duel_damage) then
ability:ApplyDataDrivenModifier(caster, caster, modifier_duel_damage, {})
end
local duel_stacks = caster:GetModifierStackCount(modifier_duel_damage, ability) + keys.RewardDamage
caster:SetModifierStackCount(modifier_duel_damage, ability, duel_stacks)
caster:RemoveModifierByName(modifier_duel)
end
end