117 lines
4.6 KiB
Lua
117 lines
4.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 ____modifier_general_fired = require("abilities.modifiers.modifier_general_fired")
|
|
local modifier_general_fired = ____modifier_general_fired.modifier_general_fired
|
|
local CARD_ID = 10
|
|
local DEBUFF_NAME = "modifier_card_10_debuff"
|
|
____exports.card_10 = __TS__Class()
|
|
local card_10 = ____exports.card_10
|
|
card_10.name = "card_10"
|
|
card_10.____file_path = "scripts/vscripts/cards/examples/card_10.lua"
|
|
__TS__ClassExtends(card_10, CardBase)
|
|
function card_10.prototype.GetModifierName(self)
|
|
return "modifier_card_10"
|
|
end
|
|
card_10 = __TS__Decorate(card_10, card_10, {RegisterCard}, {kind = "class", name = "card_10"})
|
|
____exports.card_10 = card_10
|
|
____exports.modifier_card_10 = __TS__Class()
|
|
local modifier_card_10 = ____exports.modifier_card_10
|
|
modifier_card_10.name = "modifier_card_10"
|
|
modifier_card_10.____file_path = "scripts/vscripts/cards/examples/card_10.lua"
|
|
__TS__ClassExtends(modifier_card_10, CardBaseModifier)
|
|
function modifier_card_10.prototype.getValue(self, key, fallback)
|
|
return self:getCardValue(key, fallback, CARD_ID)
|
|
end
|
|
function modifier_card_10.prototype.DeclareFunctions(self)
|
|
return {MODIFIER_EVENT_ON_ATTACK_LANDED, MODIFIER_PROPERTY_TOOLTIP}
|
|
end
|
|
function modifier_card_10.prototype.OnAttackLanded(self, event)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
local attacker = self:GetParent()
|
|
if not attacker or not IsValidEntity(attacker) or event.attacker ~= attacker then
|
|
return
|
|
end
|
|
local target = event.target
|
|
if not target or not IsValidEntity(target) or not target:IsAlive() then
|
|
return
|
|
end
|
|
if target:GetTeamNumber() == attacker:GetTeamNumber() then
|
|
return
|
|
end
|
|
local duration = self:getValue("debuff_duration", 3.5)
|
|
target:AddNewModifier(
|
|
attacker,
|
|
self:GetAbility(),
|
|
DEBUFF_NAME,
|
|
{duration = duration}
|
|
)
|
|
end
|
|
modifier_card_10 = __TS__Decorate(
|
|
modifier_card_10,
|
|
modifier_card_10,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_card_10"}
|
|
)
|
|
____exports.modifier_card_10 = modifier_card_10
|
|
____exports.modifier_card_10_debuff = __TS__Class()
|
|
local modifier_card_10_debuff = ____exports.modifier_card_10_debuff
|
|
modifier_card_10_debuff.name = "modifier_card_10_debuff"
|
|
modifier_card_10_debuff.____file_path = "scripts/vscripts/cards/examples/card_10.lua"
|
|
__TS__ClassExtends(modifier_card_10_debuff, CardBaseModifier)
|
|
function modifier_card_10_debuff.prototype.getValue(self, key, fallback)
|
|
return self:getCardValue(key, fallback, CARD_ID)
|
|
end
|
|
function modifier_card_10_debuff.prototype.IsDebuff(self)
|
|
return true
|
|
end
|
|
function modifier_card_10_debuff.prototype.IsPurgable(self)
|
|
return true
|
|
end
|
|
function modifier_card_10_debuff.prototype.DeclareFunctions(self)
|
|
return {MODIFIER_PROPERTY_INCOMING_DAMAGE_PERCENTAGE, MODIFIER_PROPERTY_TOOLTIP}
|
|
end
|
|
function modifier_card_10_debuff.prototype.GetModifierIncomingDamage_Percentage(self, event)
|
|
if not IsServer() then
|
|
return 0
|
|
end
|
|
local ownerHero = self:GetCaster()
|
|
if not ownerHero or not event.attacker or event.attacker ~= ownerHero then
|
|
return 0
|
|
end
|
|
local target = self:GetParent()
|
|
local firedModifier = target:FindModifierByName(modifier_general_fired.name)
|
|
local firedStacks = firedModifier and firedModifier:GetStackCount() or 0
|
|
if firedStacks <= 0 then
|
|
return 0
|
|
end
|
|
local cardMod = ownerHero:FindModifierByName("modifier_card_10")
|
|
local copies = math.max(
|
|
1,
|
|
math.floor(cardMod and cardMod:GetStackCount() or 0)
|
|
)
|
|
local incomingPerStackPct = self:getValue("incoming_damage_per_fired_stack_pct", 1)
|
|
local maxBonusPct = self:getValue("max_incoming_damage_bonus_pct", 80) * copies
|
|
local totalBonusPct = firedStacks * incomingPerStackPct * copies
|
|
return math.min(totalBonusPct, maxBonusPct)
|
|
end
|
|
modifier_card_10_debuff = __TS__Decorate(
|
|
modifier_card_10_debuff,
|
|
modifier_card_10_debuff,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_card_10_debuff"}
|
|
)
|
|
____exports.modifier_card_10_debuff = modifier_card_10_debuff
|
|
return ____exports
|