main.j
how to select speller see unit
how to select enemy see speller
JASS:
globals
hashtable timerTable = InitHashtable()
endglobals
function killEffect takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer tid = GetHandleId(t)
local effect eff =LoadEffectHandle(timerTable,tid,1)
call DestroyEffect(eff)
call FlushChildHashtable(timerTable,tid)
call DestroyTimer(t)
endfunction
function makeSafeEffectAtPoint takes string effL,location p,real during returns nothing
local timer t= CreateTimer()
local integer tid= GetHandleId(t)
// call AddSpecialEffectLoc( "Abilities\\Spells\\Human\\Resurrect\\ResurrectCaster.mdl" ,p2)
local effect eff = AddSpecialEffectLoc(effL,p)
// 不清掉点,需要自己清除
call SaveEffectHandle(timerTable,tid,1,eff)
call TimerStart(t,during,false,function killEffect)
endfunction
function killTag takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer tid = GetHandleId(t)
local texttag tag =LoadTextTagHandle(timerTable,tid,1)
call DestroyTextTag(tag)
call FlushChildHashtable(timerTable,tid)
call DestroyTimer(t)
endfunction
function makeSafeText takes string text ,location p,real during returns nothing
local timer t= CreateTimer()
local integer tid= GetHandleId(t)
local texttag tag =CreateTextTagLocBJ(text,p,300,12,255,0,0,1)
// 不清掉点,需要自己清除
call SaveTextTagHandle(timerTable,tid,1,tag)
call TimerStart(t,during,false,function killTag)
endfunction
how to select speller see unit
JASS:
function Trig_see_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A001'
endfunction
function Trig_see_Func001A takes nothing returns nothing
local location p1=GetUnitLoc(GetTriggerUnit())
local location p2=GetUnitLoc(GetEnumUnit())
local real faceAngel = AngleBetweenPoints(p1,p2)
local real dangerAngel = GetUnitFacing(GetTriggerUnit())
local real rs
if (faceAngel< 0 ) then
set faceAngel = 360 + faceAngel
endif
set rs = faceAngel - dangerAngel
if(rs <0 ) then
set rs = - rs
endif
if(rs > 180) then
set rs = 360 - rs
endif
if(rs<=70 and IsUnitEnemy(GetEnumUnit(),GetOwningPlayer(GetTriggerUnit()))) then
call makeSafeEffectAtPoint("Abilities\\Spells\\Undead\\Darksummoning\\DarkSummonTarget.mdl" ,p2,1)
elseif (IsUnitEnemy(GetEnumUnit(),GetOwningPlayer(GetTriggerUnit()))) then
call makeSafeText( R2S(faceAngel) +"-"+R2S(dangerAngel)+ "=" +R2S(rs),p2,2)
endif
call RemoveLocation(p1)
call RemoveLocation(p2)
endfunction
function Trig_see_Actions takes nothing returns nothing
call ForGroupBJ( GetUnitsInRectAll(GetPlayableMapRect()), function Trig_see_Func001A )
endfunction
//===========================================================================
function InitTrig_see takes nothing returns nothing
set gg_trg_see = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_see, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_see, Condition( function Trig_see_Conditions ) )
call TriggerAddAction( gg_trg_see, function Trig_see_Actions )
endfunction
[ATTACH type="full"]446022[/ATTACH]
JASS:
function Trig_face_Func001A_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A000' ) ) then
return false
endif
return true
endfunction
function Trig_face_Func001A takes nothing returns nothing
local location p1=GetUnitLoc(GetTriggerUnit())
local location p2=GetUnitLoc(GetEnumUnit())
local real faceAngel = GetUnitFacing(GetEnumUnit())
local real dangerAngel = AngleBetweenPoints(p2,p1)
local real rs
if (dangerAngel< 0 ) then
// call makeSafeEffectAtPoint("Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl" ,p2,1)
set dangerAngel = 360 + dangerAngel
endif
set rs = faceAngel - dangerAngel
if(rs <0 ) then
set rs = - rs
endif
if(rs > 180) then
set rs = 360 - rs
endif
if(rs<=30 and IsUnitEnemy(GetEnumUnit(),GetOwningPlayer(GetTriggerUnit()))) then
call makeSafeEffectAtPoint("Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl" ,p2,1)
elseif (IsUnitEnemy(GetEnumUnit(),GetOwningPlayer(GetTriggerUnit()))) then
call makeSafeText( R2S(faceAngel) +"-"+R2S(dangerAngel)+ "=" +R2S(rs),p2,2)
endif
call RemoveLocation(p1)
call RemoveLocation(p2)
endfunction
function Trig_face_Actions takes nothing returns nothing
call ForGroupBJ( GetUnitsInRectAll(GetPlayableMapRect()), function Trig_face_Func001A )
endfunction
//===========================================================================
function InitTrig_face takes nothing returns nothing
set gg_trg_face = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_face, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_face, Condition( function Trig_face_Func001A_Conditions ) )
call TriggerAddAction( gg_trg_face, function Trig_face_Actions )
endfunction