123 lines
4.8 KiB
Lua
123 lines
4.8 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 ____crit_mult = require("utils.crit_mult")
|
|
local addCritMult = ____crit_mult.addCritMult
|
|
local CARD_ID = 74
|
|
local ARMOR_RECALC_INTERVAL = 0.25
|
|
--- Раз в секунду подтягиваем крит-мульт к актуальному уровню карты (без полного пересоздания модификатора).
|
|
local CRIT_MULT_RESYNC_INTERVAL = 1
|
|
local LOG = "[card_74]"
|
|
____exports.card_74 = __TS__Class()
|
|
local card_74 = ____exports.card_74
|
|
card_74.name = "card_74"
|
|
card_74.____file_path = "scripts/vscripts/cards/examples/card_74.lua"
|
|
__TS__ClassExtends(card_74, CardBase)
|
|
function card_74.prototype.GetModifierName(self)
|
|
return "modifier_card_74"
|
|
end
|
|
card_74 = __TS__Decorate(card_74, card_74, {RegisterCard}, {kind = "class", name = "card_74"})
|
|
____exports.card_74 = card_74
|
|
____exports.modifier_card_74 = __TS__Class()
|
|
local modifier_card_74 = ____exports.modifier_card_74
|
|
modifier_card_74.name = "modifier_card_74"
|
|
modifier_card_74.____file_path = "scripts/vscripts/cards/examples/card_74.lua"
|
|
__TS__ClassExtends(modifier_card_74, CardBaseModifier)
|
|
function modifier_card_74.prototype.getValue(self, key, fallback)
|
|
return self:getCardValue(key, fallback, CARD_ID)
|
|
end
|
|
function modifier_card_74.prototype.OnCustomCreated(self, _params)
|
|
local hero = self:GetParent()
|
|
addCritMult(
|
|
nil,
|
|
hero,
|
|
self:getScaledCardValue("crit_mult_bonus_pct", 30)
|
|
)
|
|
end
|
|
function modifier_card_74.prototype.OnCustomRefresh(self, _params)
|
|
local hero = self:GetParent()
|
|
if not hero or not IsValidEntity(hero) then
|
|
return
|
|
end
|
|
addCritMult(
|
|
nil,
|
|
hero,
|
|
self:getValue("crit_mult_bonus_pct", 30)
|
|
)
|
|
end
|
|
function modifier_card_74.prototype.IsAura(self)
|
|
return not self:GetParent():PassivesDisabled()
|
|
end
|
|
function modifier_card_74.prototype.GetAuraRadius(self)
|
|
return self:getValue("aura_radius", 1000)
|
|
end
|
|
function modifier_card_74.prototype.GetModifierAura(self)
|
|
return ____exports.modifier_card_74_armor_reduce.name
|
|
end
|
|
function modifier_card_74.prototype.GetAuraSearchTeam(self)
|
|
return DOTA_UNIT_TARGET_TEAM_ENEMY
|
|
end
|
|
function modifier_card_74.prototype.GetAuraDuration(self)
|
|
return 0
|
|
end
|
|
function modifier_card_74.prototype.GetAuraSearchFlags(self)
|
|
return DOTA_UNIT_TARGET_FLAG_NONE
|
|
end
|
|
function modifier_card_74.prototype.GetAuraSearchType(self)
|
|
return DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC
|
|
end
|
|
modifier_card_74 = __TS__Decorate(
|
|
modifier_card_74,
|
|
modifier_card_74,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_card_74"}
|
|
)
|
|
____exports.modifier_card_74 = modifier_card_74
|
|
____exports.modifier_card_74_armor_reduce = __TS__Class()
|
|
local modifier_card_74_armor_reduce = ____exports.modifier_card_74_armor_reduce
|
|
modifier_card_74_armor_reduce.name = "modifier_card_74_armor_reduce"
|
|
modifier_card_74_armor_reduce.____file_path = "scripts/vscripts/cards/examples/card_74.lua"
|
|
__TS__ClassExtends(modifier_card_74_armor_reduce, CardBaseModifier)
|
|
function modifier_card_74_armor_reduce.prototype.getCardCopiesFromOwner(self)
|
|
local owner = self:GetCaster()
|
|
if not owner or not IsValidEntity(owner) then
|
|
return 1
|
|
end
|
|
local cardMod = owner:FindModifierByName("modifier_card_74")
|
|
return math.max(
|
|
1,
|
|
math.floor(cardMod and cardMod:GetStackCount() or 0)
|
|
)
|
|
end
|
|
function modifier_card_74_armor_reduce.prototype.getValue(self, key, fallback)
|
|
return self:getCardValue(key, fallback, CARD_ID) * self:getCardCopiesFromOwner()
|
|
end
|
|
function modifier_card_74_armor_reduce.prototype.IsHidden(self)
|
|
return false
|
|
end
|
|
function modifier_card_74_armor_reduce.prototype.DeclareFunctions(self)
|
|
return {MODIFIER_PROPERTY_PHYSICAL_ARMOR_BONUS}
|
|
end
|
|
function modifier_card_74_armor_reduce.prototype.GetModifierPhysicalArmorBonus(self)
|
|
local parent = self:GetParent()
|
|
local baseArmor = parent:GetPhysicalArmorBaseValue()
|
|
return -baseArmor * (self:getValue("enemy_armor_reduction_pct", 20) / 100)
|
|
end
|
|
modifier_card_74_armor_reduce = __TS__Decorate(
|
|
modifier_card_74_armor_reduce,
|
|
modifier_card_74_armor_reduce,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_card_74_armor_reduce"}
|
|
)
|
|
____exports.modifier_card_74_armor_reduce = modifier_card_74_armor_reduce
|
|
return ____exports
|