139 lines
4.8 KiB
Lua
139 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 ____dota_ts_adapter = require("lib.dota_ts_adapter")
|
|
local BaseItem = ____dota_ts_adapter.BaseItem
|
|
local registerAbility = ____dota_ts_adapter.registerAbility
|
|
local registerModifier = ____dota_ts_adapter.registerModifier
|
|
local BaseModifier = ____dota_ts_adapter.BaseModifier
|
|
____exports.item_bearstbow = __TS__Class()
|
|
local item_bearstbow = ____exports.item_bearstbow
|
|
item_bearstbow.name = "item_bearstbow"
|
|
item_bearstbow.____file_path = "scripts/vscripts/items/default_items/item_bearstbow.lua"
|
|
__TS__ClassExtends(item_bearstbow, BaseItem)
|
|
function item_bearstbow.prototype.GetIntrinsicModifierName(self)
|
|
return "modifier_item_bearstbow"
|
|
end
|
|
item_bearstbow = __TS__Decorate(
|
|
item_bearstbow,
|
|
item_bearstbow,
|
|
{registerAbility(nil)},
|
|
{kind = "class", name = "item_bearstbow"}
|
|
)
|
|
____exports.item_bearstbow = item_bearstbow
|
|
____exports.modifier_item_bearstbow = __TS__Class()
|
|
local modifier_item_bearstbow = ____exports.modifier_item_bearstbow
|
|
modifier_item_bearstbow.name = "modifier_item_bearstbow"
|
|
modifier_item_bearstbow.____file_path = "scripts/vscripts/items/default_items/item_bearstbow.lua"
|
|
__TS__ClassExtends(modifier_item_bearstbow, BaseModifier)
|
|
function modifier_item_bearstbow.prototype.IsHidden(self)
|
|
return true
|
|
end
|
|
function modifier_item_bearstbow.prototype.IsDebuff(self)
|
|
return false
|
|
end
|
|
function modifier_item_bearstbow.prototype.IsPurgable(self)
|
|
return false
|
|
end
|
|
function modifier_item_bearstbow.prototype.OnCreated(self)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
end
|
|
function modifier_item_bearstbow.prototype.DeclareFunctions(self)
|
|
return {
|
|
MODIFIER_EVENT_ON_ATTACK,
|
|
MODIFIER_PROPERTY_ATTACKSPEED_BONUS_CONSTANT,
|
|
MODIFIER_PROPERTY_ATTACK_RANGE_BONUS,
|
|
MODIFIER_PROPERTY_PREATTACK_BONUS_DAMAGE,
|
|
MODIFIER_PROPERTY_STATS_AGILITY_BONUS,
|
|
MODIFIER_PROPERTY_STATS_STRENGTH_BONUS,
|
|
MODIFIER_PROPERTY_STATS_INTELLECT_BONUS,
|
|
MODIFIER_PROPERTY_HEALTH_BONUS
|
|
}
|
|
end
|
|
function modifier_item_bearstbow.prototype.GetModifierAttackSpeedBonus_Constant(self)
|
|
return self:GetAbility():GetSpecialValueFor("attack_speed")
|
|
end
|
|
function modifier_item_bearstbow.prototype.GetModifierAttackRangeBonus(self)
|
|
if not self:GetParent():IsRangedAttacker() then
|
|
return 0
|
|
end
|
|
return self:GetAbility():GetSpecialValueFor("attack_range")
|
|
end
|
|
function modifier_item_bearstbow.prototype.GetModifierBonusStats_Strength(self)
|
|
return self:GetAbility():GetSpecialValueFor("strength")
|
|
end
|
|
function modifier_item_bearstbow.prototype.GetModifierBonusStats_Agility(self)
|
|
return self:GetAbility():GetSpecialValueFor("agility")
|
|
end
|
|
function modifier_item_bearstbow.prototype.GetModifierBonusStats_Intellect(self)
|
|
return self:GetAbility():GetSpecialValueFor("intellect")
|
|
end
|
|
function modifier_item_bearstbow.prototype.GetModifierHealthBonus(self)
|
|
return self:GetAbility():GetSpecialValueFor("health")
|
|
end
|
|
function modifier_item_bearstbow.prototype.OnAttack(self, event)
|
|
if not IsServer() then
|
|
return
|
|
end
|
|
local attacker = event.attacker
|
|
local target = event.target
|
|
if not attacker or not target then
|
|
return
|
|
end
|
|
if not attacker:IsRealHero() then
|
|
return
|
|
end
|
|
if attacker ~= self:GetParent() then
|
|
return
|
|
end
|
|
if not attacker:IsRangedAttacker() then
|
|
return
|
|
end
|
|
if event.no_attack_cooldown then
|
|
return
|
|
end
|
|
local radius = self:GetParent():GetAttackRangeBuffer() + self:GetParent():GetBaseAttackRange()
|
|
local units = FindUnitsInRadius(
|
|
attacker:GetTeamNumber(),
|
|
attacker:GetAbsOrigin(),
|
|
nil,
|
|
radius,
|
|
DOTA_UNIT_TARGET_TEAM_ENEMY,
|
|
DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC + DOTA_UNIT_TARGET_BUILDING,
|
|
DOTA_UNIT_TARGET_FLAG_MAGIC_IMMUNE_ENEMIES + DOTA_UNIT_TARGET_FLAG_FOW_VISIBLE,
|
|
FIND_CLOSEST,
|
|
false
|
|
)
|
|
local attackCount = 0
|
|
for ____, unit in ipairs(units) do
|
|
if unit and not unit:IsNull() and unit ~= target and unit:IsAlive() then
|
|
attacker:PerformAttack(
|
|
unit,
|
|
true,
|
|
true,
|
|
true,
|
|
false,
|
|
true,
|
|
false,
|
|
false
|
|
)
|
|
attackCount = attackCount + 1
|
|
end
|
|
if attackCount >= self:GetAbility():GetSpecialValueFor("attack_count") then
|
|
break
|
|
end
|
|
end
|
|
end
|
|
modifier_item_bearstbow = __TS__Decorate(
|
|
modifier_item_bearstbow,
|
|
modifier_item_bearstbow,
|
|
{registerModifier(nil)},
|
|
{kind = "class", name = "modifier_item_bearstbow"}
|
|
)
|
|
____exports.modifier_item_bearstbow = modifier_item_bearstbow
|
|
return ____exports
|