|
发表于 2007-3-18 10:19:32
|
显示全部楼层
这个是我做过的冰弹的代码,实现原理是差不多的,就是轨迹不一样,伤害部分不用看了,是利用工程升级来实现冰封效果的
没什么时间,不然可以帮你做下
[codes=jass]
function IceBoltEnumDamage takes nothing returns boolean
local unit targ = GetFilterUnit()
local unit u
if IsUnitEnemy(targ, GetOwningPlayer(udg_TempUnit)) and not IsUnitType(targ, 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 UnitAddAbility(u,'A05E')
call SetUnitAbilityLevel(u,'A05E',udg_TempInt)
call UnitRemoveAbility(u,'A05G')
call IssueTargetOrderById(u,851983,targ)//attack
call SpellDamage(udg_TempUnit,targ,udg_TempReal)
if GetRandomInt(0,99)<udg_TempInt2 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 integer trg returns nothing
local unit u = i2u(GetStoredInteger(udg_GC,I2S(trg),"IceBolt"))
local integer tm = GetStoredInteger(udg_GC,I2S(trg),"Timer")
set udg_TempUnit = i2u(GetStoredInteger(udg_GC,I2S(trg),"Caster"))
call DestroyEffect(i2ef(GetStoredInteger(udg_GC,I2S(trg),"BoltEffect")))
call UnitApplyTimedLife(u,'BHwe',1.5)
set udg_TempInt = GetUnitAbilityLevel(udg_TempUnit,'A05A')
set udg_TempInt2 = udg_TempInt*5+5
set udg_TempReal = udg_TempInt*50+100
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,I2S(trg),"TriggerCondition")))
call DestroyTrigger(i2tg(trg))
call FlushStoredMission(udg_GC,I2S(tm))
call FlushStoredMission(udg_GC,I2S(trg))
set u = null
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,I2S(h2i(GetExpiredTimer())),"IceBolt"))
local integer trg = GetStoredInteger(udg_GC,I2S(h2i(GetExpiredTimer())),"Trigger")
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(trg)
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(trg)
endif
endif
set u = null
endfunction
function IceBolt_WithIn takes nothing returns boolean
local integer iu = GetStoredInteger(udg_GC,I2S(h2i(GetTriggeringTrigger())),"IceBolt")
if GetTriggerEventId()==ConvertGameEvent(4) then
call IceBoltDamage(h2i(GetTriggeringTrigger()))
elseif IsUnitEnemy(GetTriggerUnit(), GetOwningPlayer(i2u(iu))) or IsUnitType(GetTriggerUnit(), UNIT_TYPE_STRUCTURE) then
call IceBoltDamage(h2i(GetTriggeringTrigger()))
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("Iceblock.mdl",u2,"origin")
//call SetUnitScale(u2,0.8,0.8,0.8)
call TimerStart(tm,0.02,true,function IceBoltMove)
call TriggerRegisterUnitInRange(trg,u2,50,null)
call TriggerRegisterTimerEvent(trg,1.5,false)
call StoreInteger(udg_GC,I2S(h2i(tm)),"Trigger",h2i(trg))
call StoreInteger(udg_GC,I2S(h2i(tm)),"IceBolt",h2i(u2))
call StoreInteger(udg_GC,I2S(h2i(trg)),"TriggerCondition",h2i(TriggerAddCondition(trg,Condition(function IceBolt_WithIn))))
call StoreInteger(udg_GC,I2S(h2i(trg)),"Timer",h2i(tm))
call StoreInteger(udg_GC,I2S(h2i(trg)),"BoltEffect",h2i(eff))
call StoreInteger(udg_GC,I2S(h2i(trg)),"Caster",h2i(u))
call StoreInteger(udg_GC,I2S(h2i(trg)),"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
function HeroSkill1_Conditions takes nothing returns boolean
local integer id = GetSpellAbilityId()
if id == 'A05A' then
call Skill_IceBolt()
endif
return false
endfunction
function InitTrig_HeroSkill1 takes nothing returns nothing
local trigger trg = CreateTrigger()
call TriggerRegisterPlayerUnitEventSimple( trg, Player(0), EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(trg, Condition(function HeroSkill1_Conditions))
set trg = null
endfunction[/codes] |
|