刀塔2英雄熊猫酒仙醉拳技能的LUA代码
时间: 2024-03-01 21:56:16 浏览: 139
以下是熊猫酒仙在刀塔2游戏中醉拳技能的LUA代码:
```
function drunken_haze_cast( keys )
local caster = keys.caster
local target = keys.target
local ability = keys.ability
local sound_cast = keys.sound_cast
local modifier_haze = keys.modifier_haze
-- Play cast sound
EmitSoundOn(sound_cast, target)
-- Apply Drunken Haze modifier
ability:ApplyDataDrivenModifier(caster, target, modifier_haze, {})
-- Reduce target's accuracy
target:SetAttackCapability(DOTA_UNIT_CAP_NO_ATTACK)
end
function drunken_haze_attack_land( keys )
local caster = keys.caster
local target = keys.target
local ability = keys.ability
local sound_miss = keys.sound_miss
local modifier_haze = keys.modifier_haze
local accuracy_reduction_pct = ability:GetLevelSpecialValueFor("accuracy_reduction_pct", ability:GetLevel() - 1)
-- Check if target is affected by Drunken Haze
if target:HasModifier(modifier_haze) then
-- Roll chance to miss
if RollPercentage(100 - accuracy_reduction_pct) then
-- Play miss sound
EmitSoundOn(sound_miss, target)
-- Remove Drunken Haze modifier
target:RemoveModifierByName(modifier_haze)
-- Restore target's accuracy
target:SetAttackCapability(DOTA_UNIT_CAP_MELEE_ATTACK)
end
end
end
```
这段代码实现了熊猫酒仙醉拳技能的两个效果:对目标施加醉酒效果并降低其攻击精度,以及攻击命中时有一定概率使目标失误并解除醉酒效果。
阅读全文