|
发表于 2008-8-4 11:00:25
|
显示全部楼层
这个…………………………
转过来的:
[codes=jass]
//***************************************************************************
//* Single Cast to Plurality Cast *
//* Edit by feelerly,Provide by 堕落圣童 *
//* 2008.01.26 *
//***************************************************************************
// 单体技能变群体技能,只需要一个辅助单位(单位有魔法值),便可以释放技能了.十分简单
function AbilityPlayerEnemy takes nothing returns boolean
return IsUnitHidden(GetFilterUnit()) == false and IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) == false and IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()), GetOwningPlayer(GetTriggerUnit())) == true and GetFilterUnit() != GetSpellTargetUnit()
endfunction
function AbilityPlayerAlly takes nothing returns boolean
return IsUnitHidden(GetFilterUnit()) == false and IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) == false and IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()), GetOwningPlayer(GetTriggerUnit())) == false and GetFilterUnit() != GetSpellTargetUnit()
endfunction
function AbilityCastCounts takes nothing returns nothing
local unit u = CreateUnit(GetOwningPlayer(GetTriggerUnit()),GetHandleInteger(GetTriggerUnit(),"CastUnit"),GetUnitX(GetTriggerUnit()),GetUnitY(GetTriggerUnit()),0.00)
call UnitAddAbility( u, GetSpellAbilityId() )
call SetUnitMoveSpeed( u, 0.00 )
call ShowUnit( u, false )
call SetUnitAbilityLevel( u, GetSpellAbilityId(), GetUnitAbilityLevel(GetTriggerUnit(), GetSpellAbilityId()) )
call UnitApplyTimedLife( u, 'BHwe', 15.00 )
if GetUnitFlyHeight(GetTriggerUnit()) != 0.00 then
call UnitAddAbility(u, 'Arav' )
call UnitRemoveAbility( u, 'Arav' )
call SetUnitFlyHeight( u, GetUnitFlyHeight(GetTriggerUnit()), 0.00 )
endif
call IssueTargetOrder( u, GetHandleString(GetTriggerUnit(),"CurrentOrder"), GetEnumUnit() )
set u = null
endfunction
function AbilityGo_AnyOne takes integer id,location l,real d,integer count returns nothing
local group g = null
local group fg = null
local player p1 = GetOwningPlayer(GetTriggerUnit())
local player p2 = GetOwningPlayer(GetSpellTargetUnit())
if p1 != null and p2 != null then
// 以释放技能目标为准选取其他单位,比如,如果技能目标与释放者同一个玩家,则就选择同属一个玩
// 或联盟的单位,让辅助单位施法,一般这类技能是辅助技能;反之则选敌人.
if p1 == p2 then
set g = GetUnitsInRangeOfLocMatching(d,l,Condition(function AbilityPlayerAlly))
call GroupRemoveUnit(g,GetSpellTargetUnit())
endif
if p1 != p2 then
if IsPlayerAlly(p1,p2)==true then
set g = GetUnitsInRangeOfLocMatching(d,l,Condition(function AbilityPlayerAlly))
elseif IsPlayerEnemy(p1,p2)==true then
set g = GetUnitsInRangeOfLocMatching(d,l,Condition(function AbilityPlayerEnemy))
call GroupRemoveUnit(g,GetTriggerUnit())
endif
call GroupRemoveUnit(g,GetSpellTargetUnit())
endif
call SetHandleString( GetTriggerUnit(),"CurrentOrder",OrderId2StringBJ(GetUnitCurrentOrder(GetTriggerUnit())) )
if id == 0 then
call SetHandleInteger( GetTriggerUnit(),"CastUnit", 'e000' )
else
call SetHandleInteger( GetTriggerUnit(),"CastUnit", id )
endif
if CountUnitsInGroup(g) > count then
set fg = GetRandomSubGroup(count, g)
call ForGroup( fg, function AbilityCastCounts )
else
call ForGroup( g, function AbilityCastCounts )
endif
endif
call SetHandleString( GetTriggerUnit(),"CurrentOrder", null)
set l = null
call DestroyGroup( g )
call DestroyGroup( fg )
set g = null
set fg = null
set p1 = null
set p2 = null
endfunction
[/codes] |
|