85 lines
3.1 KiB
Lua
85 lines
3.1 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 ____ability_stacking_crit = require("abilities.modifiers.ability_stacking_crit")
|
|
local modifier_stacking_crit = ____ability_stacking_crit.modifier_stacking_crit
|
|
local CARD_ID = 64
|
|
____exports.card_64 = __TS__Class()
|
|
local card_64 = ____exports.card_64
|
|
card_64.name = "card_64"
|
|
card_64.____file_path = "scripts/vscripts/cards/examples/card_64.lua"
|
|
__TS__ClassExtends(card_64, CardBase)
|
|
function card_64.prototype.GetModifierName(self)
|
|
return "modifier_card_64"
|
|
end
|
|
card_64 = __TS__Decorate(card_64, card_64, {RegisterCard}, {kind = "class", name = "card_64"})
|
|
____exports.card_64 = card_64
|
|
____exports.modifier_card_64 = __TS__Class()
|
|
local modifier_card_64 = ____exports.modifier_card_64
|
|
modifier_card_64.name = "modifier_card_64"
|
|
modifier_card_64.____file_path = "scripts/vscripts/cards/examples/card_64.lua"
|
|
__TS__ClassExtends(modifier_card_64, CardBaseModifier)
|
|
function modifier_card_64.prototype.getValue(self, key, fallback)
|
|
return self:getCardValue(key, fallback, CARD_ID)
|
|
end
|
|
function modifier_card_64.prototype.OnCustomCreated(self, params)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
end
|
|
function modifier_card_64.prototype.OnCustomRefresh(self, params)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
end
|
|
function modifier_card_64.prototype.DeclareFunctions(self)
|
|
return {MODIFIER_EVENT_ON_ATTACK_START}
|
|
end
|
|
function modifier_card_64.prototype.OnAttackStart(self, params)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
local attacker = self:GetParent()
|
|
if not attacker or not IsValidEntity(attacker) or not attacker:IsRealHero() then
|
|
return
|
|
end
|
|
if params.attacker ~= attacker then
|
|
return
|
|
end
|
|
local target = params.target
|
|
if not target or not IsValidEntity(target) or target:IsNull() or not target:IsAlive() then
|
|
return
|
|
end
|
|
if target:GetTeamNumber() == attacker:GetTeamNumber() then
|
|
return
|
|
end
|
|
local hpThresholdPct = self:getValue("hp_threshold_pct", 25)
|
|
local targetHpPct = target:GetHealthPercent()
|
|
local stackingCrit = modifier_stacking_crit:GetForUnit(attacker)
|
|
if not stackingCrit then
|
|
return
|
|
end
|
|
if targetHpPct <= hpThresholdPct then
|
|
stackingCrit:ForceNextCritOnTarget(target)
|
|
return
|
|
end
|
|
stackingCrit:ForceNextCritOnTarget(nil)
|
|
end
|
|
modifier_card_64 = __TS__Decorate(
|
|
modifier_card_64,
|
|
modifier_card_64,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_card_64"}
|
|
)
|
|
____exports.modifier_card_64 = modifier_card_64
|
|
return ____exports
|