|
小弟在复制ICEFROG的无敌斩的时候遇到了难题,求解
[jass]
// Objects used:
// 'A0M1' = Omnislash (Juggernaut : Yurnero)
// 'Nbbc' = Juggernaut
// 'o003' = Spin Web
// 'e00C' = Stop looking at me swan!!
// 'A04R' = Marker (Nether Ward 4,Lightning Bolter,Nether Ward 3,Nether Ward 2,Vengeance Death caster,...)
// 'A05G' = Blade Fury (Juggernaut : Yurnero)
// DEBUG Trigger Number : 255
function Trig_Blade_Fury_Conditions takes nothing returns boolean
return GetSpellAbilityId()=='A0M1'
endfunction
function Omnislash_IsJugg takes nothing returns boolean
return GetUnitTypeId(GetTriggerUnit())=='Nbbc'
endfunction
function Omnislash_AntiSelect takes nothing returns nothing
call SelectUnitRemoveForPlayer(GetTriggerUnit(),GetOwningPlayer(GetTriggerUnit()))
endfunction
function Omnislash_Damage takes unit pOd,unit pFB returns nothing
local location ln3=GetUnitLoc(pFB)
local location lOD=GetUnitLoc(pOd)
local location liD=PolarProjectionBJ(ln3,50,GetRandomReal(0,360))
local effect lfx
call SetUnitPositionLocFacingBJ(pOd,liD,AngleBetweenPoints(lOD,ln3))
call SetUnitAnimation(pOd,"Attack")
call UnitDamageTargetBJ(pOd,pFB,GetRandomReal(150,250),ATTACK_TYPE_HERO,DAMAGE_TYPE_NORMAL)
set lfx=AddSpecialEffectTargetUnitBJ("chest",pOd,"Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl")
call RemoveLocation(ln3)
call RemoveLocation(lOD)
call RemoveLocation(liD)
call DestroyEffect(lfx)
endfunction
function Omnislash_Filter takes nothing returns boolean
if(GetUnitTypeId(GetFilterUnit())!='o003')then
if(GetUnitTypeId(GetFilterUnit())!='e00C')then
if(IsUnitAliveBJ(GetFilterUnit()))then
if(IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE)==false)then
if(GetUnitAbilityLevelSwapped('A04R',GetFilterUnit())!=1)then
return true
endif
endif
endif
endif
endif
return false
endfunction
function Omnislash_Strike takes unit pOd returns unit
local player lOf=GetOwningPlayer(pOd)
local unit lFB
local group lEw
local location lOD=GetUnitLoc(pOd)
local boolean lOF=false
set lEw=GetUnitsInRangeOfLocMatching(575,lOD,Condition(function Omnislash_Filter))
loop
exitwhen lOF
set lFB=GroupPickRandomUnit(lEw)
if(IsUnitVisible(lFB,lOf))then
if(IsUnitEnemy(lFB,lOf))then
set lOF=true
endif
endif
call GroupRemoveUnit(lEw,lFB)
if(IsUnitGroupEmptyBJ(lEw))then
if(lOF==false)then
set lFB=null
endif
set lOF=true
endif
endloop
call RemoveLocation(lOD)
call DestroyGroup(lEw)
set udg_u_DTAX_temp=lFB
return udg_u_DTAX_temp
endfunction
function Trig_Blade_Fury_Actions takes nothing returns nothing
local trigger lOG=CreateTrigger()
local unit lOd=GetTriggerUnit()
local player lOf=GetOwningPlayer(lOd)
local unit lFB=GetSpellTargetUnit()
local integer lMP=GetUnitAbilityLevel(lOd,'A0M1')
local integer lEq=2
local integer lEQ=3
local integer lOh=GetUnitAbilityLevel(lOd,'A05G')
if(lMP==2)then
set lEQ=5
endif
if(lMP==3)then
set lEQ=8
endif
if(lOh>0)then
call SetPlayerAbilityAvailable(lOf,'A05G',false)
endif
call SelectUnitRemoveForPlayer(lOd,lOf)
call SetUnitVertexColorBJ(lOd,100,100,100,50)
call SetUnitPathing(lOd,false)
call SetUnitInvulnerable(lOd,true)
call PolledWait(.01)
call TriggerRegisterPlayerSelectionEventBJ(lOG,lOf,true)
call TriggerAddCondition(lOG,Condition(function Omnislash_IsJugg))
call TriggerAddAction(lOG,function Omnislash_AntiSelect)
if(IsUnitAliveBJ(lOd))then
call Omnislash_Damage(lOd,lFB)
call PolledWait(.25)
loop
exitwhen lEq>lEQ
set lFB=Omnislash_Strike(lOd)
if(lFB!=null)then
if(IsUnitAliveBJ(lOd))then
call Omnislash_Damage(lOd,lFB)
call PolledWait(.25)
endif
else
set lEq=lEQ+1
endif
set lEq=lEq+1
endloop
endif
call DisableTrigger(lOG)
call SetUnitPathing(lOd,true)
call SetUnitInvulnerable(lOd,false)
call SetUnitScalePercent(lOd,100.,100.,100.)
call SetUnitVertexColorBJ(lOd,100,100,100,.0)
call SelectUnitAddForPlayer(lOd,lOf)
if(lOh>0)then
call UnitAddAbility(lOd,'A05G')
call SetUnitAbilityLevel(lOd,'A05G',lOh)
endif
call PolledWait(.01)
if(lOh>0)then
call SetPlayerAbilityAvailable(lOf,'A05G',true)
endif
endfunction
function StartTrigger_Blade_Fury takes nothing returns nothing
set gg_trg_Blade_Fury=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Blade_Fury,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_Blade_Fury,Condition(function Trig_Blade_Fury_Conditions))
call TriggerAddAction(gg_trg_Blade_Fury,function Trig_Blade_Fury_Actions)
endfunction
function InitTrig_Blade_Fury takes nothing returns nothing
endfunction
[/jass] |
|