|
楼主 |
发表于 2007-1-18 08:24:33
|
显示全部楼层
引用第4楼hackwaly于2007-01-16 14:49发表的:
Red Wolf是在做那个直线(不跟踪目标的)火球术吗?我想要。
嗯俄~~
这个是以前写的冰弹技能
遇到障碍物或敌方单位造成小范围伤害+减速和一定几率冰封
function IceBoltEnumDamage takes nothing returns boolean
local unit targ = GetFilterUnit()
local unit u
if IsUnitEnemy(GetEnumUnit(), GetOwningPlayer(udg_TempUnit)) and not IsUnitType(GetEnumUnit(), UNIT_TYPE_STRUCTURE) then
set u = CreateUnit(Player(15),'E003',GetUnitX(targ),GetUnitY(targ),0)
call UnitApplyTimedLife(u,'BHwe',0.3)
call UnitAddAbility(u,'A05G')
call SetUnitAbilityLevel(u,'A05G',udg_TempInt-'A05A'+1)
call UnitAddAbility(u,'A05E')
call SetUnitAbilityLevel(u,'A05E',udg_TempInt2)
call UnitRemoveAbility(u,'A05G')
call IssueTargetOrderById(u,851983,targ)//attack
call SpellDamage(udg_TempUnit,targ,udg_TempReal)
if GetRandomInt(0,99)<udg_TempInt3 then
set u = CreateUnit(Player(15),'e002',GetUnitX(targ),GetUnitY(targ),0)
call UnitApplyTimedLife(u,'BHwe',0.3)
call UnitAddAbility(u,'A05H')
call IssueTargetOrderById(u,851983,targ)//attack
endif
endif
set targ=null
set u=null
return false
endfunction
function IceBoltDamage takes unit u returns nothing
local integer tm = GetStoredInteger(udg_GC,"IceBolt"+I2S(h2i(u)),"Timer")
local integer trg = GetStoredInteger(udg_GC,"IceBolt"+I2S(h2i(u)),"Trigger")
set udg_TempUnit = i2u(GetStoredInteger(udg_GC,"IceBolt"+I2S(h2i(u)),"Caster"))
call DestroyEffect(i2ef(GetStoredInteger(udg_GC,"IceBolt"+I2S(h2i(u)),"BoltEffect")))
call UnitApplyTimedLife(u,'BHwe',1.5)
if GetUnitAbilityLevel(udg_TempUnit,'A05B') >0 then
set udg_TempInt = 'A05B'
set udg_TempInt2 = GetUnitAbilityLevel(udg_TempUnit,'A05B')
set udg_TempInt3 = udg_TempInt2*5+5
set udg_TempReal = udg_TempInt2*100+300
else
set udg_TempInt = 'A05A'
set udg_TempInt2 = GetUnitAbilityLevel(udg_TempUnit,'A05A')
set udg_TempInt3 = 0
set udg_TempReal = udg_TempInt2*100
endif
call GroupEnumUnitsInRange(udg_TempGroup,GetUnitX(u),GetUnitY(u),150.0,Condition(function IceBoltEnumDamage))
call DestroyTimer(i2tm(tm))
call TriggerRemoveCondition(i2tg(trg),i2tc(GetStoredInteger(udg_GC,"IceBolt"+I2S(h2i(u)),"TriggerCondition")))
call DestroyTrigger(i2tg(trg))
call FlushStoredMission(udg_GC,"IceBolt"+I2S(h2i(u)))
call FlushStoredMission(udg_GC,"IceBolt"+I2S(tm))
call FlushStoredMission(udg_GC,"IceBolt"+I2S(trg))
endfunction
function IceBolt_DestCheck takes nothing returns nothing
set udg_TempBool = true
endfunction
function IceBoltMove takes nothing returns nothing
local unit u = i2u(GetStoredInteger(udg_GC,"IceBolt"+I2S(h2i(GetExpiredTimer())),"IceBolt"))
local real f = GetUnitFacing(u)
local real x = GetUnitX(u)+20*Cos(f*bj_PI/180.0)
local real y = GetUnitY(u)+20*Sin(f*bj_PI/180.0)
call SetUnitX(u,x)
call SetUnitY(u,y)
if IsTerrainPathable(x,y,PATHING_TYPE_WALKABILITY) then
call IceBoltDamage(u)
else
set udg_TempBool = false
call SetRect(udg_TempRect,x-50,y-50,x+50,y+50)
call EnumDestructablesInRect(udg_TempRect,null,function IceBolt_DestCheck)
if udg_TempBool then
call IceBoltDamage(u)
endif
endif
set u = null
endfunction
function IceBolt_WithIn takes nothing returns boolean
local integer iu = GetStoredInteger(udg_GC,"IceBolt"+I2S(h2i(GetTriggeringTrigger())),"IceBolt")
if GetTriggerEventId()==ConvertGameEvent(4) then
call IceBoltDamage(i2u(iu))
elseif IsUnitEnemy(GetTriggerUnit(), GetOwningPlayer(i2u(iu))) or IsUnitType(GetTriggerUnit(), UNIT_TYPE_STRUCTURE) then
call IceBoltDamage(i2u(iu))
endif
return false
endfunction
function Skill_IceBolt takes nothing returns nothing
local unit u = GetTriggerUnit()
local location p = GetSpellTargetLoc()
local timer tm = CreateTimer()
local trigger trg = CreateTrigger()
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local real f = bj_RADTODEG * Atan2(GetLocationY(p)-y, GetLocationX(p)-x)
local unit u2 = CreateUnit(GetOwningPlayer(u),'e000',x,y,f)
local effect eff = AddSpecialEffectTarget("Abilities\\\\Spells\\\\Other\\\\FrostBolt\\\\FrostBoltMissile.mdl",u2,"origin")
call TimerStart(tm,0.02,true,function IceBoltMove)
call TriggerRegisterUnitInRange(trg,u2,50,null)
call TriggerRegisterTimerEvent(trg,1.5,false)
call StoreInteger(udg_GC,"IceBolt"+I2S(h2i(u2)),"Trigger",h2i(trg))
call StoreInteger(udg_GC,"IceBolt"+I2S(h2i(u2)),"TriggerCondition",h2i(TriggerAddCondition(trg,Condition(function IceBolt_WithIn))))
call StoreInteger(udg_GC,"IceBolt"+I2S(h2i(u2)),"Timer",h2i(tm))
call StoreInteger(udg_GC,"IceBolt"+I2S(h2i(u2)),"BoltEffect",h2i(eff))
call StoreInteger(udg_GC,"IceBolt"+I2S(h2i(u2)),"Caster",h2i(u))
call StoreInteger(udg_GC,"IceBolt"+I2S(h2i(trg)),"IceBolt",h2i(u2))
call StoreInteger(udg_GC,"IceBolt"+I2S(h2i(tm)),"IceBolt",h2i(u2))
call RemoveLocation(p)
set u=null
set u2=null
set p=null
set tm=null
set trg=null
set eff=null
endfunction |
|