附 代码一则 有相关基础的人可以观看一下
function Trig_Remilia01_Conditions takes nothing returns boolean
return GetSpellAbilityId()=='A0CD'
endfunction
function Trig_Remilia01_Main takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer task = GetHandleId(t)
local unit caster = LoadUnitHandle(udg_ht,task,0)
local unit u = LoadUnitHandle(udg_ht,task,1)
local unit v
local group m = LoadGroupHandle(udg_ht,task,2)
local group g
local boolexpr iff = GetPlayerFilter(GetOwningPlayer(caster))
local real ox = GetUnitX(u)
local real oy = GetUnitY(u)
local real px
local real py
local real a = LoadReal(udg_ht,task,0)
local real d = LoadReal(udg_ht,task,1)
local integer level = LoadInteger(udg_ht,task,0)
local integer i = LoadInteger(udg_ht,task,1)
local boolean k = false
local real damage
//========
if i>0 then
set px = ox + d*Cos(a)
set py = oy + d*Sin(a)
if i / 4 * 4 == i then
call DestroyEffect(AddSpecialEffect("BatAppear.mdx",px,py))
endif
if IsTerrainPathable(px,py,PATHING_TYPE_FLYABILITY)==false then
call SetUnitX(u,px)
call SetUnitY(u,py)
call SaveInteger(udg_ht,task,1,i - 1)
else
call SaveInteger(udg_ht,task,1,0)
endif
set g = CreateGroup()
call GroupEnumUnitsInRange(g,px,py,90.0,iff)
loop
set v = FirstOfGroup(g)
exitwhen v == null
call GroupRemoveUnit(g,v)
if IsUnitAliveBJ(v) and IsUnitType(v,UNIT_TYPE_STRUCTURE)==false and IsUnitInGroup(v,m)==false then
call GroupAddUnit(m,v)//伤害过的单位增加到单位组
set damage = 50+level*70+2.6*GetHeroInt(caster,true)
if IsUnitType(v,UNIT_TYPE_HERO) then
call UnitMagicDamageTarget(caster,v,damage,1)
set k = true
else
call UnitMagicDamageTarget(caster,v,damage*0.30,5)
endif
endif
endloop
call DestroyGroup(g)
if k then
call KillUnit(u)
call SaveInteger(udg_ht,task,1,0)
endif
else
if IsUnitAliveBJ(u) then
call RemoveUnit(u)
endif
call DestroyTimer(t)
call DestroyGroup(m)
call FlushChildHashtable(udg_ht,task)
endif
//========
set t = null
set caster = null
set u = null
set v = null
set m = null
set g = null
set iff = null
endfunction
function Trig_Remilia01_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local unit u
local real ox = GetUnitX(caster)
local real oy = GetUnitY(caster)
local real tx = GetSpellTargetX()
local real ty = GetSpellTargetY()
local real a = Atan2(ty-oy,tx-ox)
local integer level = GetUnitAbilityLevel(caster,'A0CD')
local group m = CreateGroup()//已经伤害过的单位保存于此
local timer t = CreateTimer()
local integer task = GetHandleId(t)
//========
local real abilitycooldownlv01 = 5
local real abilitycooldownlv02 = 5
local real abilitycooldownlv03 = 5
local real abilitycooldownlv04 = 5
if UnitHasItemOfTypeBJ(caster, 'I00B') then
if GetUnitAbilityLevel(caster,GetSpellAbilityId()) == 1 then
call Item_HeroAbilityCoolDownReset(caster,GetSpellAbilityId(),abilitycooldownlv01)
elseif GetUnitAbilityLevel(caster,GetSpellAbilityId()) == 2 then
call Item_HeroAbilityCoolDownReset(caster,GetSpellAbilityId(),abilitycooldownlv02)
elseif GetUnitAbilityLevel(caster,GetSpellAbilityId()) == 3 then
call Item_HeroAbilityCoolDownReset(caster,GetSpellAbilityId(),abilitycooldownlv03)
elseif GetUnitAbilityLevel(caster,GetSpellAbilityId()) == 4 then
call Item_HeroAbilityCoolDownReset(caster,GetSpellAbilityId(),abilitycooldownlv04)
endif
endif
//========
set u = CreateUnit(GetOwningPlayer(caster),'n029',ox,oy,bj_RADTODEG*a)
set caster = null
set u = null
set m = null
set t = null
endfunction
function InitTrig_Remilia01 takes nothing returns nothing
endfunction
==========================
其余招收
主策