274 lines
9.8 KiB
Lua
274 lines
9.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 ____dota_ts_adapter = require("lib.dota_ts_adapter")
|
|
local BaseAbility = ____dota_ts_adapter.BaseAbility
|
|
local BaseModifier = ____dota_ts_adapter.BaseModifier
|
|
local registerAbility = ____dota_ts_adapter.registerAbility
|
|
local registerModifier = ____dota_ts_adapter.registerModifier
|
|
____exports.ability_yuki_challenge = __TS__Class()
|
|
local ability_yuki_challenge = ____exports.ability_yuki_challenge
|
|
ability_yuki_challenge.name = "ability_yuki_challenge"
|
|
ability_yuki_challenge.____file_path = "scripts/vscripts/abilities/heroes/yuki-onna/ability_yuki_challenge.lua"
|
|
__TS__ClassExtends(ability_yuki_challenge, BaseAbility)
|
|
function ability_yuki_challenge.prototype.OnSpellStart(self)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
local target = self:GetCursorTarget()
|
|
if not target then
|
|
return
|
|
end
|
|
target:AddNewModifier(
|
|
self:GetCaster(),
|
|
self,
|
|
____exports.modifier_challenge_debuff.name,
|
|
{duration = self:GetSpecialValueFor("duration")}
|
|
)
|
|
end
|
|
ability_yuki_challenge = __TS__Decorate(
|
|
ability_yuki_challenge,
|
|
ability_yuki_challenge,
|
|
{registerAbility(nil)},
|
|
{kind = "class", name = "ability_yuki_challenge"}
|
|
)
|
|
____exports.ability_yuki_challenge = ability_yuki_challenge
|
|
____exports.modifier_challenge_debuff = __TS__Class()
|
|
local modifier_challenge_debuff = ____exports.modifier_challenge_debuff
|
|
modifier_challenge_debuff.name = "modifier_challenge_debuff"
|
|
modifier_challenge_debuff.____file_path = "scripts/vscripts/abilities/heroes/yuki-onna/ability_yuki_challenge.lua"
|
|
__TS__ClassExtends(modifier_challenge_debuff, BaseModifier)
|
|
function modifier_challenge_debuff.prototype.____constructor(self, ...)
|
|
BaseModifier.prototype.____constructor(self, ...)
|
|
self.interval = 0
|
|
self.dmgPerAtr = 0
|
|
self.fullDamage = 0
|
|
end
|
|
function modifier_challenge_debuff.prototype.IsHidden(self)
|
|
return false
|
|
end
|
|
function modifier_challenge_debuff.prototype.IsPurgable(self)
|
|
return false
|
|
end
|
|
function modifier_challenge_debuff.prototype.IsDebuff(self)
|
|
return true
|
|
end
|
|
function modifier_challenge_debuff.prototype.IsBuff(self)
|
|
return false
|
|
end
|
|
function modifier_challenge_debuff.prototype.RemoveOnDeath(self)
|
|
return true
|
|
end
|
|
function modifier_challenge_debuff.prototype.DeclareFunctions(self)
|
|
return {MODIFIER_PROPERTY_DISABLE_HEALING}
|
|
end
|
|
function modifier_challenge_debuff.prototype.CheckState(self)
|
|
return {
|
|
[MODIFIER_STATE_MUTED] = true,
|
|
[MODIFIER_STATE_SILENCED] = true,
|
|
[MODIFIER_STATE_STUNNED] = true,
|
|
[MODIFIER_STATE_ROOTED] = true,
|
|
[MODIFIER_STATE_DISARMED] = true
|
|
}
|
|
end
|
|
function modifier_challenge_debuff.prototype.GetEffectName(self)
|
|
return "particles/econ/items/winter_wyvern/winter_wyvern_ti7/wyvern_cold_embrace_ti7buff.vpcf"
|
|
end
|
|
function modifier_challenge_debuff.prototype.GetDisableHealing(self)
|
|
return 1
|
|
end
|
|
function modifier_challenge_debuff.prototype.OnCreated(self)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
self.parent = self:GetParent()
|
|
if not self.parent or not self.parent:IsRealHero() then
|
|
return
|
|
end
|
|
local ability = self:GetAbility()
|
|
if not ability then
|
|
return
|
|
end
|
|
local hero = self.parent
|
|
if not hero.yuki_challenge then
|
|
hero.yuki_challenge = 100
|
|
end
|
|
local primaryAttribute = hero:GetPrimaryAttribute()
|
|
local primaryStatValue = hero:GetPrimaryStatValue()
|
|
self.interval = ability:GetSpecialValueFor("interval")
|
|
self.dmgPerAtr = ability:GetSpecialValueFor("dmg_per_atr")
|
|
local yukiChallenge = hero.yuki_challenge
|
|
self.fullDamage = self.dmgPerAtr * primaryStatValue * (yukiChallenge / 100)
|
|
self:StartIntervalThink(self.interval)
|
|
EmitSoundOn("Hero_Winter_Wyvern.ColdEmbrace", hero)
|
|
end
|
|
function modifier_challenge_debuff.prototype.OnRefresh(self)
|
|
self:OnCreated()
|
|
end
|
|
function modifier_challenge_debuff.prototype.OnIntervalThink(self)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
local ability = self:GetAbility()
|
|
local caster = self:GetCaster()
|
|
if not ability or not caster or not self.parent then
|
|
return
|
|
end
|
|
local intervalDur = self.interval / ability:GetSpecialValueFor("duration")
|
|
local damage = self.fullDamage * intervalDur
|
|
ApplyDamage({
|
|
victim = self.parent,
|
|
attacker = caster,
|
|
damage = damage,
|
|
damage_type = DAMAGE_TYPE_PURE,
|
|
ability = ability
|
|
})
|
|
end
|
|
function modifier_challenge_debuff.prototype.OnDestroy(self)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
if self.parent then
|
|
StopSoundOn("Hero_Winter_Wyvern.ColdEmbrace", self.parent)
|
|
if not self.parent:IsAlive() then
|
|
local ability = self:GetAbility()
|
|
if ability then
|
|
self.parent.yuki_challenge = self.parent.yuki_challenge - ability:GetSpecialValueFor("dmg_reduce")
|
|
end
|
|
return
|
|
end
|
|
local ability = self:GetAbility()
|
|
if ability then
|
|
self.parent.yuki_challenge = self.parent.yuki_challenge + ability:GetSpecialValueFor("dmg_incr")
|
|
local caster = self:GetCaster()
|
|
if caster then
|
|
local existing = self.parent:FindModifierByName(____exports.modifier_challenge_buff.name)
|
|
if existing then
|
|
existing:AddCompletedTrialStack()
|
|
else
|
|
local modif = self.parent:AddNewModifier(caster, ability, ____exports.modifier_challenge_buff.name, {})
|
|
if modif ~= nil then
|
|
modif:AddCompletedTrialStack()
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
modifier_challenge_debuff = __TS__Decorate(
|
|
modifier_challenge_debuff,
|
|
modifier_challenge_debuff,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_challenge_debuff"}
|
|
)
|
|
____exports.modifier_challenge_debuff = modifier_challenge_debuff
|
|
____exports.modifier_challenge_buff = __TS__Class()
|
|
local modifier_challenge_buff = ____exports.modifier_challenge_buff
|
|
modifier_challenge_buff.name = "modifier_challenge_buff"
|
|
modifier_challenge_buff.____file_path = "scripts/vscripts/abilities/heroes/yuki-onna/ability_yuki_challenge.lua"
|
|
__TS__ClassExtends(modifier_challenge_buff, BaseModifier)
|
|
function modifier_challenge_buff.prototype.____constructor(self, ...)
|
|
BaseModifier.prototype.____constructor(self, ...)
|
|
self.lockedFlatBonus = 0
|
|
end
|
|
function modifier_challenge_buff.prototype.IsHidden(self)
|
|
return false
|
|
end
|
|
function modifier_challenge_buff.prototype.IsPurgable(self)
|
|
return true
|
|
end
|
|
function modifier_challenge_buff.prototype.IsDebuff(self)
|
|
return false
|
|
end
|
|
function modifier_challenge_buff.prototype.IsBuff(self)
|
|
return true
|
|
end
|
|
function modifier_challenge_buff.prototype.RemoveOnDeath(self)
|
|
return false
|
|
end
|
|
function modifier_challenge_buff.prototype.OnCreated(self)
|
|
self.lockedFlatBonus = 0
|
|
self.primaryAttribute = nil
|
|
local parent = self:GetParent()
|
|
if parent and parent:IsRealHero() then
|
|
self.primaryAttribute = parent:GetPrimaryAttribute()
|
|
end
|
|
end
|
|
function modifier_challenge_buff.prototype.DeclareFunctions(self)
|
|
return {MODIFIER_PROPERTY_STATS_STRENGTH_BONUS, MODIFIER_PROPERTY_STATS_AGILITY_BONUS, MODIFIER_PROPERTY_STATS_INTELLECT_BONUS, MODIFIER_PROPERTY_TOOLTIP}
|
|
end
|
|
function modifier_challenge_buff.prototype.OnTooltip(self)
|
|
return math.max(
|
|
0,
|
|
math.floor(self:GetStackCount())
|
|
)
|
|
end
|
|
function modifier_challenge_buff.prototype.AddCompletedTrialStack(self)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
local parent = self:GetParent()
|
|
if not parent or not parent:IsRealHero() then
|
|
return
|
|
end
|
|
local hero = parent
|
|
if self.primaryAttribute == nil then
|
|
self.primaryAttribute = hero:GetPrimaryAttribute()
|
|
end
|
|
self.lockedFlatBonus = self.lockedFlatBonus + self:ComputeFlatBonusForOneStack(hero)
|
|
self:SyncLockedBonusToStackCount()
|
|
end
|
|
function modifier_challenge_buff.prototype.SyncLockedBonusToStackCount(self)
|
|
self:SetStackCount(math.max(
|
|
0,
|
|
math.floor(self.lockedFlatBonus)
|
|
))
|
|
end
|
|
function modifier_challenge_buff.prototype.ComputeFlatBonusForOneStack(self, hero)
|
|
local ability = self:GetAbility()
|
|
local caster = self:GetCaster()
|
|
if not ability then
|
|
return 0
|
|
end
|
|
local pct = ability:GetSpecialValueFor("bonus_main")
|
|
if caster and caster:HasScepter() then
|
|
pct = pct + ability:GetSpecialValueFor("main_pct")
|
|
end
|
|
if pct <= 0 then
|
|
return 0
|
|
end
|
|
local primaryValue = hero:GetPrimaryStatValue()
|
|
return math.floor(primaryValue * (pct / 100))
|
|
end
|
|
function modifier_challenge_buff.prototype.GetLockedBonusForPrimaryStat(self)
|
|
return self.lockedFlatBonus
|
|
end
|
|
function modifier_challenge_buff.prototype.GetModifierBonusStats_Strength(self)
|
|
if self.primaryAttribute == DOTA_ATTRIBUTE_STRENGTH or self.primaryAttribute == DOTA_ATTRIBUTE_ALL then
|
|
return self:GetLockedBonusForPrimaryStat()
|
|
end
|
|
return 0
|
|
end
|
|
function modifier_challenge_buff.prototype.GetModifierBonusStats_Agility(self)
|
|
if self.primaryAttribute == DOTA_ATTRIBUTE_AGILITY or self.primaryAttribute == DOTA_ATTRIBUTE_ALL then
|
|
return self:GetLockedBonusForPrimaryStat()
|
|
end
|
|
return 0
|
|
end
|
|
function modifier_challenge_buff.prototype.GetModifierBonusStats_Intellect(self)
|
|
if self.primaryAttribute == DOTA_ATTRIBUTE_INTELLECT or self.primaryAttribute == DOTA_ATTRIBUTE_ALL then
|
|
return self:GetLockedBonusForPrimaryStat()
|
|
end
|
|
return 0
|
|
end
|
|
modifier_challenge_buff = __TS__Decorate(
|
|
modifier_challenge_buff,
|
|
modifier_challenge_buff,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_challenge_buff"}
|
|
)
|
|
____exports.modifier_challenge_buff = modifier_challenge_buff
|
|
return ____exports
|