98 lines
3.6 KiB
Lua
98 lines
3.6 KiB
Lua
local ____lualib = require("lualib_bundle")
|
|
local __TS__Class = ____lualib.__TS__Class
|
|
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
local __TS__Decorate = ____lualib.__TS__Decorate
|
|
local ____exports = {}
|
|
local ____CardSystem = require("cards.CardSystem")
|
|
local CardBase = ____CardSystem.CardBase
|
|
local RegisterCard = ____CardSystem.RegisterCard
|
|
local ____CardBaseModifier = require("cards.CardBaseModifier")
|
|
local CardBaseModifier = ____CardBaseModifier.CardBaseModifier
|
|
local ____dota_ts_adapter = require("lib.dota_ts_adapter")
|
|
local registerModifier = ____dota_ts_adapter.registerModifier
|
|
local ____vampirism = require("utils.vampirism")
|
|
local precacheVampirismParticle = ____vampirism.precacheVampirismParticle
|
|
local ____heal_tracker = require("utils.heal_tracker")
|
|
local HealWithBattlePass = ____heal_tracker.HealWithBattlePass
|
|
local CARD_ID = 34
|
|
____exports.card_34 = __TS__Class()
|
|
local card_34 = ____exports.card_34
|
|
card_34.name = "card_34"
|
|
card_34.____file_path = "scripts/vscripts/cards/examples/card_34.lua"
|
|
__TS__ClassExtends(card_34, CardBase)
|
|
function card_34.prototype.GetModifierName(self)
|
|
return "modifier_card_34"
|
|
end
|
|
card_34 = __TS__Decorate(card_34, card_34, {RegisterCard}, {kind = "class", name = "card_34"})
|
|
____exports.card_34 = card_34
|
|
____exports.modifier_card_34 = __TS__Class()
|
|
local modifier_card_34 = ____exports.modifier_card_34
|
|
modifier_card_34.name = "modifier_card_34"
|
|
modifier_card_34.____file_path = "scripts/vscripts/cards/examples/card_34.lua"
|
|
__TS__ClassExtends(modifier_card_34, CardBaseModifier)
|
|
function modifier_card_34.prototype.Precache(self, context)
|
|
precacheVampirismParticle(nil, context)
|
|
end
|
|
function modifier_card_34.prototype.getValue(self, key, fallback)
|
|
return self:getCardValue(key, fallback, CARD_ID)
|
|
end
|
|
function modifier_card_34.prototype.DeclareFunctions(self)
|
|
return {MODIFIER_EVENT_ON_DEATH, MODIFIER_PROPERTY_TOOLTIP}
|
|
end
|
|
function modifier_card_34.prototype.OnDeath(self, event)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
local hero = self:GetParent()
|
|
local deadUnit = event.unit
|
|
if not hero or not IsValidEntity(hero) or not deadUnit or not IsValidEntity(deadUnit) then
|
|
return
|
|
end
|
|
if event.attacker ~= hero then
|
|
return
|
|
end
|
|
if deadUnit:GetTeamNumber() == hero:GetTeamNumber() then
|
|
return
|
|
end
|
|
local copies = self:getCardCopies()
|
|
local healFromEnemyPct = self:getValue("heal_from_enemy_max_hp_pct", 15) * copies
|
|
local healFromAttackDamagePct = self:getValue("heal_from_attack_damage_pct", 100) * copies
|
|
local healFromEnemy = deadUnit:GetMaxHealth() * (healFromEnemyPct / 100)
|
|
local attackDamage = hero:GetAverageTrueAttackDamage(deadUnit)
|
|
local healFromAttack = attackDamage * (healFromAttackDamagePct / 100)
|
|
local totalHeal = healFromEnemy + healFromAttack
|
|
if totalHeal <= 0 then
|
|
return
|
|
end
|
|
HealWithBattlePass(
|
|
nil,
|
|
hero,
|
|
healFromEnemy,
|
|
nil,
|
|
hero
|
|
)
|
|
SendOverheadEventMessage(
|
|
nil,
|
|
OVERHEAD_ALERT_HEAL,
|
|
hero,
|
|
totalHeal,
|
|
hero:GetPlayerOwner()
|
|
)
|
|
local pfx = ParticleManager:CreateParticle("particles/units/heroes/hero_bloodseeker/bloodseeker_bloodbath.vpcf", PATTACH_ABSORIGIN_FOLLOW, hero)
|
|
ParticleManager:SetParticleControl(
|
|
pfx,
|
|
0,
|
|
hero:GetAbsOrigin()
|
|
)
|
|
ParticleManager:ReleaseParticleIndex(pfx)
|
|
EmitSoundOn("hero_bloodseeker.bloodRite.silence", hero)
|
|
end
|
|
modifier_card_34 = __TS__Decorate(
|
|
modifier_card_34,
|
|
modifier_card_34,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_card_34"}
|
|
)
|
|
____exports.modifier_card_34 = modifier_card_34
|
|
return ____exports
|