Files
2HUCardTDGame/game/scripts/vscripts/abilities/ability_lua/modifier_nazrin_01.lua
2021-11-10 08:48:00 -05:00

102 lines
3.2 KiB
Lua
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
modifier_nazrin_01 = class({})
local public = modifier_nazrin_01
--------------------------------------------------------------------------------
function public:IsDebuff()
return false
end
--------------------------------------------------------------------------------
function public:IsHidden()
return true
end
--------------------------------------------------------------------------------
function public:IsPurgable()
return false
end
function public:GetTexture()
return "touhoutd/thtd_nazrin_01"
end
--------------------------------------------------------------------------------
function public:DeclareFunctions()
local funcs = {
MODIFIER_EVENT_ON_ATTACK_LANDED,
}
return funcs
end
function public:OnAttackLanded( params )
if IsServer() then
-- 必须加下下面判断否则会对所有单位攻击都有效因lua这个是按事件处理和KV的不同只要是攻击这个行为就会触发事件所以尽量不要使用lua的OnXXX事件方式
if params.attacker ~= self:GetParent() or self:GetParent():IsIllusion() then return end
if self:GetParent():PassivesDisabled() then return end
-- PrintTable(params)
-- [VScript] attacker:
-- [VScript] basher_tested: false
-- [VScript] cost: 0
-- [VScript] damage: 4
-- [VScript] damage_category: 1
-- [VScript] damage_flags: 0
-- [VScript] damage_type: 1
-- [VScript] diffusal_applied: false
-- [VScript] distance: 0
-- [VScript] do_not_consume: false
-- [VScript] fail_type: 0
-- [VScript] gain: 0
-- [VScript] heart_regen_applied: false
-- [VScript] ignore_invis: false
-- [VScript] issuer_player_index: 0
-- [VScript] mkb_tested: false
-- [VScript] new_pos: Vector 0000000003530FA8 [0.000000 0.000000 0.000000]
-- [VScript] no_attack_cooldown: false
-- [VScript] order_type: 0
-- [VScript] original_damage: 4
-- [VScript] process_procs: true
-- [VScript] ranged_attack: true
-- [VScript] record: 1
-- [VScript] reincarnate: false
-- [VScript] stout_tested: false
-- [VScript] target:
local caster = params.attacker
local target = params.target
local ability = self:GetAbility()
if SpawnSystem.IsUnLimited then
if caster:HasModifier("modifier_byakuren_03_buff") then
local targets = THTD_FindUnitsInRadius(caster,target:GetOrigin(),400)
local damage = caster:GetGold()*caster:THTD_GetStar()*caster.thtd_byakuren_buff_nazrin
for k,v in pairs(targets) do
local DamageTable = {
ability = ability,
victim = v,
attacker = caster,
damage = damage,
damage_type = DAMAGE_TYPE_PHYSICAL,
damage_flags = DOTA_DAMAGE_FLAG_NONE
}
UnitDamageTarget(DamageTable)
end
end
return
end
if GameRules:GetCustomGameDifficulty() >= FUNNY_MODE then return end
if RollPercentage(ability:GetSpecialValueFor("bonus_chance")) then
local gold = math.floor(caster:THTD_GetPower() * ability:GetSpecialValueFor("power_percent")/100 + ability:GetSpecialValueFor("bonus_gold"))
THTD_ModifyGoldEx(caster:GetPlayerOwnerID(), gold , true, DOTA_ModifyGold_CreepKill)
SendOverheadEventMessage(caster:GetPlayerOwner(), OVERHEAD_ALERT_GOLD, target, gold, caster:GetPlayerOwner() )
caster:EmitSound("Sound_THTD.thtd_nazrin_01")
end
end
end