307 lines
11 KiB
Lua
307 lines
11 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 __TS__Delete = ____lualib.__TS__Delete
|
|
local __TS__SparseArrayNew = ____lualib.__TS__SparseArrayNew
|
|
local __TS__SparseArrayPush = ____lualib.__TS__SparseArrayPush
|
|
local __TS__SparseArraySpread = ____lualib.__TS__SparseArraySpread
|
|
local __TS__Number = ____lualib.__TS__Number
|
|
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_fire_punishment = __TS__Class()
|
|
local ability_fire_punishment = ____exports.ability_fire_punishment
|
|
ability_fire_punishment.name = "ability_fire_punishment"
|
|
ability_fire_punishment.____file_path = "scripts/vscripts/abilities/heroes/smaug/ability_fire_punishment.lua"
|
|
__TS__ClassExtends(ability_fire_punishment, BaseAbility)
|
|
function ability_fire_punishment.prototype.GetIntrinsicModifierName(self)
|
|
return ____exports.modifier_fire_punishment_orb.name
|
|
end
|
|
function ability_fire_punishment.prototype.GetProjectileName(self)
|
|
return "particles/econ/items/gyrocopter/hero_gyrocopter_gyrotechnics/gyro_base_attack.vpcf"
|
|
end
|
|
function ability_fire_punishment.prototype.OnOrbFire(self, params)
|
|
EmitSoundOn(
|
|
"Hero_Jakiro.LiquidFire",
|
|
self:GetCaster()
|
|
)
|
|
end
|
|
function ability_fire_punishment.prototype.OnOrbImpact(self, params)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
local caster = self:GetCaster()
|
|
local duration = self:GetDuration()
|
|
local radius = self:GetSpecialValueFor("radius")
|
|
local enemies = FindUnitsInRadius(
|
|
caster:GetTeamNumber(),
|
|
params.target:GetAbsOrigin(),
|
|
nil,
|
|
radius,
|
|
DOTA_UNIT_TARGET_TEAM_ENEMY,
|
|
bit.bor(
|
|
bit.bor(DOTA_UNIT_TARGET_HERO, DOTA_UNIT_TARGET_BASIC),
|
|
DOTA_UNIT_TARGET_BUILDING
|
|
),
|
|
DOTA_UNIT_TARGET_FLAG_NONE,
|
|
FIND_ANY_ORDER,
|
|
false
|
|
)
|
|
for ____, enemy in ipairs(enemies) do
|
|
enemy:AddNewModifier(caster, self, ____exports.modifier_fire_punishment_fire.name, {duration = duration})
|
|
end
|
|
local effectCast = ParticleManager:CreateParticle("particles/units/heroes/hero_jakiro/jakiro_liquid_fire_explosion.vpcf", PATTACH_ABSORIGIN_FOLLOW, params.target)
|
|
ParticleManager:SetParticleControl(
|
|
effectCast,
|
|
1,
|
|
Vector(radius, radius, radius)
|
|
)
|
|
ParticleManager:ReleaseParticleIndex(effectCast)
|
|
EmitSoundOn("Hero_Jakiro.LiquidFire", caster)
|
|
end
|
|
ability_fire_punishment = __TS__Decorate(
|
|
ability_fire_punishment,
|
|
ability_fire_punishment,
|
|
{registerAbility(nil)},
|
|
{kind = "class", name = "ability_fire_punishment"}
|
|
)
|
|
____exports.ability_fire_punishment = ability_fire_punishment
|
|
____exports.modifier_fire_punishment_fire = __TS__Class()
|
|
local modifier_fire_punishment_fire = ____exports.modifier_fire_punishment_fire
|
|
modifier_fire_punishment_fire.name = "modifier_fire_punishment_fire"
|
|
modifier_fire_punishment_fire.____file_path = "scripts/vscripts/abilities/heroes/smaug/ability_fire_punishment.lua"
|
|
__TS__ClassExtends(modifier_fire_punishment_fire, BaseModifier)
|
|
function modifier_fire_punishment_fire.prototype.____constructor(self, ...)
|
|
BaseModifier.prototype.____constructor(self, ...)
|
|
self.debuffMagic = 0
|
|
end
|
|
function modifier_fire_punishment_fire.prototype.IsHidden(self)
|
|
return false
|
|
end
|
|
function modifier_fire_punishment_fire.prototype.IsDebuff(self)
|
|
return true
|
|
end
|
|
function modifier_fire_punishment_fire.prototype.IsStunDebuff(self)
|
|
return false
|
|
end
|
|
function modifier_fire_punishment_fire.prototype.IsPurgable(self)
|
|
return true
|
|
end
|
|
function modifier_fire_punishment_fire.prototype.GetAttributes(self)
|
|
return MODIFIER_ATTRIBUTE_MULTIPLE
|
|
end
|
|
function modifier_fire_punishment_fire.prototype.OnCreated(self)
|
|
local ability = self:GetAbility()
|
|
if not ability then
|
|
return
|
|
end
|
|
local damage = ability:GetSpecialValueFor("damage")
|
|
self.debuffMagic = ability:GetSpecialValueFor("debuff_magic")
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
local caster = self:GetCaster()
|
|
if not caster then
|
|
return
|
|
end
|
|
self.damageTable = {
|
|
victim = self:GetParent(),
|
|
attacker = caster,
|
|
damage = damage + caster:GetAttackDamage() * (ability:GetSpecialValueFor("pct_dmg") / 100),
|
|
damage_type = ability:GetAbilityDamageType(),
|
|
ability = ability
|
|
}
|
|
self:StartIntervalThink(0.5)
|
|
end
|
|
function modifier_fire_punishment_fire.prototype.OnRefresh(self)
|
|
local ability = self:GetAbility()
|
|
if not ability or not self.damageTable then
|
|
return
|
|
end
|
|
local damage = ability:GetSpecialValueFor("damage")
|
|
self.debuffMagic = ability:GetSpecialValueFor("debuff_magic")
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
self.damageTable.damage = damage
|
|
end
|
|
function modifier_fire_punishment_fire.prototype.DeclareFunctions(self)
|
|
return {MODIFIER_PROPERTY_MAGICAL_RESISTANCE_BONUS}
|
|
end
|
|
function modifier_fire_punishment_fire.prototype.GetModifierMagicalResistanceBonus(self)
|
|
return self.debuffMagic
|
|
end
|
|
function modifier_fire_punishment_fire.prototype.OnIntervalThink(self)
|
|
if not IsServer() or not self.damageTable then
|
|
return
|
|
end
|
|
ApplyDamage(self.damageTable)
|
|
end
|
|
function modifier_fire_punishment_fire.prototype.GetEffectName(self)
|
|
return "particles/units/heroes/hero_jakiro/jakiro_liquid_fire_debuff.vpcf"
|
|
end
|
|
function modifier_fire_punishment_fire.prototype.GetEffectAttachType(self)
|
|
return PATTACH_ABSORIGIN_FOLLOW
|
|
end
|
|
modifier_fire_punishment_fire = __TS__Decorate(
|
|
modifier_fire_punishment_fire,
|
|
modifier_fire_punishment_fire,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_fire_punishment_fire"}
|
|
)
|
|
____exports.modifier_fire_punishment_fire = modifier_fire_punishment_fire
|
|
____exports.modifier_fire_punishment_orb = __TS__Class()
|
|
local modifier_fire_punishment_orb = ____exports.modifier_fire_punishment_orb
|
|
modifier_fire_punishment_orb.name = "modifier_fire_punishment_orb"
|
|
modifier_fire_punishment_orb.____file_path = "scripts/vscripts/abilities/heroes/smaug/ability_fire_punishment.lua"
|
|
__TS__ClassExtends(modifier_fire_punishment_orb, BaseModifier)
|
|
function modifier_fire_punishment_orb.prototype.____constructor(self, ...)
|
|
BaseModifier.prototype.____constructor(self, ...)
|
|
self.cast = false
|
|
self.records = {}
|
|
end
|
|
function modifier_fire_punishment_orb.prototype.IsHidden(self)
|
|
return true
|
|
end
|
|
function modifier_fire_punishment_orb.prototype.IsDebuff(self)
|
|
return false
|
|
end
|
|
function modifier_fire_punishment_orb.prototype.IsPurgable(self)
|
|
return false
|
|
end
|
|
function modifier_fire_punishment_orb.prototype.GetAttributes(self)
|
|
return MODIFIER_ATTRIBUTE_PERMANENT
|
|
end
|
|
function modifier_fire_punishment_orb.prototype.OnCreated(self)
|
|
self.ability = self:GetAbility()
|
|
self.cast = false
|
|
self.records = {}
|
|
end
|
|
function modifier_fire_punishment_orb.prototype.DeclareFunctions(self)
|
|
return {
|
|
MODIFIER_EVENT_ON_ATTACK_LANDED,
|
|
MODIFIER_PROPERTY_PROCATTACK_FEEDBACK,
|
|
MODIFIER_EVENT_ON_ATTACK_RECORD_DESTROY,
|
|
MODIFIER_EVENT_ON_ORDER,
|
|
MODIFIER_PROPERTY_PROJECTILE_NAME
|
|
}
|
|
end
|
|
function modifier_fire_punishment_orb.prototype.OnAttackLanded(self, event)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
if event.attacker ~= self:GetParent() then
|
|
return
|
|
end
|
|
if self:GetParent():IsIllusion() then
|
|
return
|
|
end
|
|
if self:GetParent():PassivesDisabled() then
|
|
return
|
|
end
|
|
if self:ShouldLaunch(event.target) then
|
|
self.records[event.record] = true
|
|
if self.ability and self.ability.OnOrbFire then
|
|
self.ability:OnOrbFire(event)
|
|
end
|
|
end
|
|
self.cast = false
|
|
end
|
|
function modifier_fire_punishment_orb.prototype.GetModifierProcAttack_Feedback(self, event)
|
|
if not IsServer() then
|
|
return 0
|
|
end
|
|
if self:GetParent():PassivesDisabled() then
|
|
return 0
|
|
end
|
|
if self.ability and self.ability.OnOrbImpact then
|
|
self.ability:OnOrbImpact(event)
|
|
end
|
|
return 0
|
|
end
|
|
function modifier_fire_punishment_orb.prototype.OnAttackRecordDestroy(self, event)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
__TS__Delete(self.records, event.record)
|
|
end
|
|
function modifier_fire_punishment_orb.prototype.GetModifierProjectileName(self)
|
|
if not self.ability or not self.ability.GetProjectileName then
|
|
return ""
|
|
end
|
|
local ____opt_0 = self:GetCaster()
|
|
local aggroTarget = ____opt_0 and ____opt_0:GetAggroTarget()
|
|
if aggroTarget and self:ShouldLaunch(aggroTarget) then
|
|
return self.ability:GetProjectileName()
|
|
end
|
|
return ""
|
|
end
|
|
function modifier_fire_punishment_orb.prototype.ShouldLaunch(self, target)
|
|
if not target or not self.ability then
|
|
return false
|
|
end
|
|
if self:GetParent():PassivesDisabled() then
|
|
return false
|
|
end
|
|
if self.ability:GetAutoCastState() then
|
|
if self.ability.CastFilterResultTarget ~= nil then
|
|
if self.ability:CastFilterResultTarget(target) == UF_SUCCESS then
|
|
self.cast = true
|
|
end
|
|
else
|
|
local ____UnitFilter_5 = UnitFilter
|
|
local ____array_4 = __TS__SparseArrayNew(
|
|
target,
|
|
self.ability:GetAbilityTargetTeam(),
|
|
self.ability:GetAbilityTargetType(),
|
|
self.ability:GetAbilityTargetFlags()
|
|
)
|
|
local ____opt_2 = self:GetCaster()
|
|
__TS__SparseArrayPush(
|
|
____array_4,
|
|
____opt_2 and ____opt_2:GetTeamNumber() or DOTA_TEAM_NEUTRALS
|
|
)
|
|
local nResult = ____UnitFilter_5(__TS__SparseArraySpread(____array_4))
|
|
if nResult == UF_SUCCESS then
|
|
self.cast = true
|
|
end
|
|
end
|
|
end
|
|
if self.cast and self.ability:IsFullyCastable() and not self:GetParent():IsSilenced() then
|
|
return true
|
|
end
|
|
return false
|
|
end
|
|
function modifier_fire_punishment_orb.prototype.FlagExist(self, a, b)
|
|
local numA = __TS__Number(a)
|
|
local numB = __TS__Number(b)
|
|
local p = 1
|
|
local c = 0
|
|
local d = numB
|
|
local valA = numA
|
|
local valB = numB
|
|
while valA > 0 and valB > 0 do
|
|
local ra = valA % 2
|
|
local rb = valB % 2
|
|
if ra + rb > 1 then
|
|
c = c + p
|
|
end
|
|
valA = (valA - ra) / 2
|
|
valB = (valB - rb) / 2
|
|
p = p * 2
|
|
end
|
|
return c == d
|
|
end
|
|
modifier_fire_punishment_orb = __TS__Decorate(
|
|
modifier_fire_punishment_orb,
|
|
modifier_fire_punishment_orb,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_fire_punishment_orb"}
|
|
)
|
|
____exports.modifier_fire_punishment_orb = modifier_fire_punishment_orb
|
|
return ____exports
|