//TESH.scrollpos=-1
//TESH.alwaysfold=0
// Version 1.0.d
library CustomScript
globals
constant integer ABYSSE = 'Oaby'
constant integer NEIGE = 'Nsnw'
constant integer GLACE = 'Glav'//'Iice'
constant integer TERRE = 'Xdrt'
constant integer MARBRE_NOIR = 'Xblm'
constant integer BRIQUES = 'Xbtl'
constant integer MARBRE_BLANC = 'Xwmb'
constant integer DALLES_RONDES = 'Xrtl'
constant integer DALLES_CARRES = 'Xsqd'
constant integer HERBE = 'Zvin'
constant integer JARDIN = 'Xhdg'
constant integer LAVE = 'Dlav'
constant integer North_TERRE = 'Ndrt'
constant integer North_TERRE_SOMBRE = 'Ndrd'
constant integer North_ROCHERS = 'Nrck'
constant integer North_HERBE = 'Ngrs'
constant integer North_GLACE = 'Nice'
constant integer North_NEIGE = 'Nsnw'
constant integer North_NEIGE_ROC = 'Nsnr'
constant integer Icecr_TERRE = 'Idrt'
constant integer Icecr_TERRE_ROC = 'Idtr'
constant integer Icecr_GLACE_SOMBRE = 'Idki'
constant integer Icecr_BRIQUES_NOIRES = 'Ibkb'
constant integer Icecr_BRIQUES_RUN = 'Irbk'
constant integer Icecr_BRIQUES_EMP = 'Itbk'
constant integer Icecr_GLACE = 'Iice'
constant integer Icecr_CARRES_NOIRS = 'Ibsq'
constant integer Icecr_NEIGE = 'Isnw'
constant integer Iles_SABLE = 'Zsan'
constant integer FORME_CERCLE = 0
constant integer FORME_CARRE = 0
constant real Z_ECLAIR = 50.0
constant real CX_ARENE = 192.0
constant real CY_ARENE = -320.0
constant real DIM_ARENE = 27 * 128.0
constant real X_DUMMY = 3500.0
constant real Y_DUMMY = 2900.0
constant string EFFET_POUSSIERE = "Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl"
constant integer Gel = 'h003'
hashtable ht = InitHashtable()
endglobals
function void takes nothing returns nothing
endfunction
function Debug takes string s returns nothing
call BJDebugMsg(s)
endfunction
function Groupe takes nothing returns nothing
set bj_groupCountUnits = bj_groupCountUnits + 1
endfunction
function CountUnit takes group g returns integer
set bj_groupCountUnits = 0
call ForGroup( g, function Groupe )
return bj_groupCountUnits
endfunction
function GetSpellLvl takes nothing returns integer
return GetUnitAbilityLevel( GetSpellAbilityUnit(), GetSpellAbilityId())
endfunction
function IsUnitImmun takes unit u returns boolean
return GetUnitAbilityLevel( u, 'ACmi') > 0 or IsUnitType(u, UNIT_TYPE_MAGIC_IMMUNE)
endfunction
function IsUnitBoss takes unit u returns boolean
return GetUnitAbilityLevel( u, 'ACrk') > 0
endfunction
function IsDummyUnit takes unit u returns boolean
return GetUnitAbilityLevel(u,'Aloc') > 0
endfunction
function AddLife takes unit u, real r returns nothing
local integer i = GetHandleId(u)
call SetUnitState( u, UNIT_STATE_LIFE,GetUnitState(u, UNIT_STATE_LIFE) + r )
endfunction
function AddMana takes unit u, real r returns nothing
call SetUnitState( u, UNIT_STATE_MANA,GetUnitState(u, UNIT_STATE_MANA) + r )
endfunction
function Shake takes player p returns nothing
call CameraSetEQNoiseForPlayer( p, 5.00 )
call TriggerSleepAction( 0.2 )
call ResetToGameCameraForPlayer( p, 0 )
endfunction
function GetRandomLoc takes real x, real y, integer dist returns location
local real xt
local real yt
set xt = GetRandomInt( 20, dist) * Cos(GetRandomReal(0,bj_PI*2)) + x
set yt = GetRandomInt( 20, dist) * Sin(GetRandomReal(0,bj_PI*2)) + y
return Location(xt, yt)
endfunction
function GetUnitZ takes unit u returns real
local location loc = GetUnitLoc(u)
local real z = GetLocationZ(loc) + GetUnitFlyHeight(u)
call RemoveLocation(loc)
set loc = null
return z
endfunction
function Pos_Terrain takes real x returns real
if( ModuloReal(x,128) > 64 ) then
return x + 128 - ModuloReal(x,128)
else
return x - ModuloReal(x,128)
endif
endfunction
function GHId takes handle h returns integer
return GetHandleId(h)
endfunction
function SH takes string s returns integer
return StringHash(s)
endfunction
globals
constant integer KEY_CASTER = StringHash("Caster")
constant integer KEY_EFFECT = StringHash("Effect")
constant integer KEY_TARGET = StringHash("Target")
constant integer KEY_DAMAGE = StringHash("Damage")
constant integer KEY_DURATION = StringHash("Duration")
constant integer KEY_OBJ = StringHash("obj")
endglobals
//! textmacro SLR takes TYPEWORD, TYPE
function L$TYPEWORD$ takes integer key, integer subkey returns $TYPE$
return Load$TYPEWORD$( ht, key, subkey)
endfunction
function S$TYPEWORD$ takes $TYPE$ t, integer key, integer subKey returns nothing
call Save$TYPEWORD$( ht, key, subKey, t)
endfunction
function R$TYPEWORD$ takes integer key, integer subKey returns nothing
call RemoveSaved$TYPEWORD$( ht, key, subKey)
endfunction
//! endtextmacro
//! textmacro SLH takes TYPEWORD, TYPE
function L$TYPEWORD$ takes integer key, integer subkey returns $TYPE$
return Load$TYPEWORD$Handle( ht, key, subkey)
endfunction
function S$TYPEWORD$ takes $TYPE$ t, integer key, integer subKey returns nothing
call Save$TYPEWORD$Handle( ht, key, subKey, t)
endfunction
//! endtextmacro
//! runtextmacro SLR("Boolean", "boolean")
//! runtextmacro SLR("Integer", "integer")
//! runtextmacro SLR("Real", "real")
//! runtextmacro SLH("Effect", "effect")
//! runtextmacro SLH("Group", "group")
//! runtextmacro SLH("Lightning", "lightning")
//! runtextmacro SLH("Location", "location")
//! runtextmacro SLH("Player", "player")
//! runtextmacro SLH("Timer", "timer")
//! runtextmacro SLH("Trigger", "trigger")
//! runtextmacro SLH("Ubersplat", "ubersplat")
//! runtextmacro SLH("Unit", "unit")
function RHandle takes integer key, integer subKey returns nothing
call RemoveSavedHandle( ht, key, subKey)
endfunction
function FHashtable takes nothing returns nothing
call FlushParentHashtable(ht)
endfunction
function Flush takes integer key returns nothing
call FlushChildHashtable(ht, key)
endfunction
function Cond_Groupe_Ennem takes nothing returns boolean
local unit u = LUnit(GetHandleId(GetTriggeringTrigger()), SH("UniteGroupe"))
return ( (IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(u)) == true) and (GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) > 0) )
endfunction
function Int2Hexa takes integer i returns string
local integer a = i
local string s = ""
local string result = ""
if i > 15 then
set a = ModuloInteger(i,16)
set i = i/16
set result = Int2Hexa(i) + Int2Hexa(a )
elseif a > 0 and a < 10 then
set result = I2S(a )
elseif a == 10 then
set result = "a"
elseif a == 11 then
set result = "b"
elseif a == 12 then
set result = "c"
elseif a == 13 then
set result = "d"
elseif a == 14 then
set result = "e"
elseif a == 15 then
set result = "f"
else
set result = "0"
endif
return result
endfunction
//========== Trigger Temporaire ============//
function TimedTrigger_Actions takes nothing returns nothing
local timer t = GetExpiredTimer()
local trigger tr = LTrigger(GetHandleId(t), StringHash("Trigger"))
call DestroyTrigger(tr)
call Flush(GetHandleId(tr))
call DestroyTimer(t)
call Flush(GetHandleId(t))
endfunction
function TimedTrigger takes trigger tr, real duree returns nothing
local timer t = CreateTimer()
call STrigger(tr, GetHandleId(t), StringHash("Trigger"))
call TimerStart( t, duree, false, function TimedTrigger_Actions)
endfunction
//==//
function TimedTriggerDisable_Actions takes nothing returns nothing
local timer t = GetExpiredTimer()
local trigger tr = LTrigger(GetHandleId(t), StringHash("Trigger"))
call DisableTrigger(tr)
call Flush(GetHandleId(tr))
call DestroyTimer(t)
call Flush(GetHandleId(t))
endfunction
function TimedTriggerDisable takes trigger tr, real duree returns nothing
local timer t = CreateTimer()
call STrigger(tr, GetHandleId(t), StringHash("Trigger"))
call TimerStart( t, duree, false, function TimedTriggerDisable_Actions)
endfunction
//==========//
//function DestroySquel takes integer index, integer key, integer nb returns nothing
//local integer a = index
//local unit u = LUnit(key, SH("Squel"+I2S(index)))
//
//loop
////////exitwhen a == nb
//set u = LUnit( key, SH("Squel"+I2S(a+1)) )
//call SUnit(u, key, SH("Squel"+I2S(a)) )
//call SInteger( a, key, SH("Index"))
////call StoreInteger( udg_Spell, m, "Squel"+I2S(a), H2I(u) )
////call StoreInteger( udg_Spell, I2S(H2I(u)), "Index", a)
//set a = a + 1
//endloop
//call StoreInteger( udg_Spell, m, "Nb_squel", nb-1 )
//endfunction
//================================================//
// Fonctions Conditionnelles //
//================================================//
function UnitInInterval takes integer int, real angle, real xc, real yc, unit u returns boolean
local real aMax = ModuloReal(angle + int, 360)
local real aMin = ModuloReal(angle - int, 360)
local real an
local boolean ok = false
set an = ModuloReal(Rad2Deg(Atan2(GetUnitY(u) - yc, GetUnitX(u) - xc )), 360)
if( aMin > 360 - 2*int ) then
if( (an >= aMin and an < 361) or (an <= aMax and an > 0) ) then
set ok = true
else
set ok = false
endif
else
if( an > aMin and an < aMax) then
set ok = true
else
set ok = false
endif
endif
return ok
endfunction
function Dgts_Conditions takes nothing returns boolean
return GetEventDamageSource() == LUnit(GHId(GetTriggerUnit()), KEY_CASTER)
endfunction
function Dgts_Caster_Conditions takes nothing returns boolean
return GetEventDamageSource() == LUnit(GHId(GetTriggeringTrigger()), KEY_CASTER)
endfunction
function Attaquant_Caster_Conditions takes nothing returns boolean
return GetAttacker() == LUnit(GHId(GetTriggeringTrigger()), KEY_CASTER)
endfunction
function Attaquant_Target_Conditions takes nothing returns boolean
return GetAttacker() == LUnit(GHId(GetTriggeringTrigger()), KEY_CASTER)
endfunction
function Cond_Groupe_Ennemi takes nothing returns boolean
return ( (IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit()) ) == true) and (GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) > 0) and not IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) )
endfunction
function Cond_Groupe_Ennemi_Timer takes nothing returns boolean
local unit caster = LUnit(GHId(GetExpiredTimer()), KEY_CASTER)
return ( (IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(caster) ) == true) and (GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) > 0) and not IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) )
endfunction
function Cond_Groupe_Allie takes nothing returns boolean
return ( (IsUnitAlly(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit()) ) == true) and (GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) > 0) and not IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) )
endfunction
function Cond_Groupe_Dead takes nothing returns boolean
return GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) <= 0
endfunction
function Cond_Groupe_Terrestre takes nothing returns boolean
return GetUnitFlyHeight(GetFilterUnit()) < 10
endfunction
function Cond_Ennemi_Arene takes nothing returns boolean
return GetOwningPlayer(GetFilterUnit()) == Player(11)
endfunction
//================================================//
// Fonction : Attraction //
//================================================//
function Attraction_Actions takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer key = GetHandleId(t)
local integer i = LInteger(key,SH("Timer"))
local real xl = LReal(key, SH("xl"))
local real yl = LReal(key, SH("yl"))
local real distance = LReal(key, SH("Distance"))
local integer a = 1
local real angle
local integer vit = LInteger( key, SH("Vitesse"))
local unit target = LUnit(key, SH("Target"))
if (i < distance ) then
call SInteger(key, SH("Timer"), i + 1)
set angle = Atan2(GetUnitY(target) - yl, GetUnitX(target) - xl)
call SetUnitX(target, GetUnitX(target) - vit*Cos(angle))
call SetUnitY(target, GetUnitY(target) - vit*Sin(angle))
else
call DestroyTimer(t)
call Flush(key)
endif
endfunction
function Attraction takes real x, real y, unit target, real distance, integer vit returns nothing
local timer t = CreateTimer()
local integer key = GHId(t)
call SUnit(target, key, SH("Target") )
call SInteger(0, key, SH("Timer"))
call SReal(x, key, SH("xl"))
call SReal(y, key, SH("yl"))
call SReal(distance/vit, key, SH("Distance"))
call SInteger(vit, key, SH("Vitesse"))
call TimerStart (t, 0.03, true, function Attraction_Actions )
endfunction
//================================================//
// Fonction : Eclair //
//================================================//
function Eclair_Actions takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer key = GetHandleId(t)
local unit to = LUnit( key, KEY_TARGET)
local unit from = LUnit( key, KEY_CASTER)
local effect e
local lightning l = LLightning(key, StringHash("Lightning"))
local integer i = LInteger( key, StringHash("Timer"))
local integer d = LInteger( key, KEY_DURATION)
call SInteger( i+1, key, SH("Timer"))
if( i==0 or i==d-1 ) then
call SetLightningColor( l, 1.0, 1.0, 1.0, 0.33 )
elseif( i==1 or i==d-2 ) then
call SetLightningColor( l, 1.0, 1.0, 1.0, 0.66 )
elseif( i==2 ) then
call SetLightningColor( l, 1.0, 1.0, 1.0, 1.0 )
elseif ( i==d) then
set e = LEffect( key, KEY_EFFECT)
call DestroyEffect(e)
call DestroyLightning(l)
call DestroyTimer(t)
call Flush(key)
return
endif
call MoveLightningEx(l, true, GetUnitX(from), GetUnitY(from), GetUnitFlyHeight(from)+Z_ECLAIR, GetUnitX(to), GetUnitY(to), GetUnitFlyHeight(to)+Z_ECLAIR )
endfunction
function Eclair takes string codename, unit from, unit to, real duree, string model, string attach returns nothing
local timer t = CreateTimer()
local integer key = GHId(t)
local effect e = AddSpecialEffectTarget( model, to, attach)
local lightning l = AddLightningEx( codename, true, GetUnitX(from), GetUnitY(from), GetUnitZ(from)+Z_ECLAIR, GetUnitX(to), GetUnitY(to), GetUnitZ(to)+Z_ECLAIR )
if (duree < 0.2) then
set duree = 0.2
endif
call SetLightningColor( l, 1.0, 1.0, 1.0, 0.0 )
call SUnit( from, key, KEY_CASTER )
call SUnit( to, key, KEY_TARGET )
call SEffect( e, key, KEY_EFFECT )
call SLightning( l, key, StringHash("Lightning") )
call SInteger( 0, key, StringHash("Timer") )
call SInteger( R2I(duree/0.03), key, KEY_DURATION )
call TimerStart ( t, 0.03, true, function Eclair_Actions )
endfunction
//================================================//
// Fonctions : Effect //
//================================================//
function Effect_Actions takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer key = GHId(t)
local effect e = LEffect( key, SH("Effect"))
call DestroyEffect(e)
call DestroyTimer(t)
call Flush(key)
endfunction
function Effect takes string name, real x, real y, real duree returns nothing
local timer t = CreateTimer()
local integer key = GHId(t)
local effect e = AddSpecialEffect( name, x, y )
if (duree < 0.01) then
set duree = 0.01
endif
call SEffect( e, key, KEY_EFFECT )
call TimerStart (t , duree, false, function Effect_Actions)
endfunction
function EffectUnit takes string name, unit u, string attach, real duree returns nothing
local timer t = CreateTimer()
local integer key = GHId(t)
local effect e = AddSpecialEffectTarget( name, u, attach )
if (duree < 0.01) then
set duree = 0.01
endif
call SEffect( e, key, KEY_EFFECT )
call TimerStart (t , duree, false, function Effect_Actions)
endfunction
function SpellEffect takes integer id, effecttype et, real x, real y, real duree returns nothing
local timer t = CreateTimer()
local integer key = GHId(t)
local effect e = AddSpellEffectById( id, et, x, y )
if (duree < 0.01) then
set duree = 0.01
endif
call SEffect( e, key, KEY_EFFECT )
call TimerStart (t , duree, false, function Effect_Actions)
endfunction
function SpellEffectTarget takes integer id, effecttype et, unit u, string attach, real duree returns nothing
local timer t = CreateTimer()
local integer key = GHId(t)
local effect e = AddSpellEffectTargetById( id, et, u, attach )
if (duree < 0.01) then
set duree = 0.01
endif
call SEffect( e, key, KEY_EFFECT )
call TimerStart (t , duree, false, function Effect_Actions)
endfunction
//================================================//
// Fonctions : Attributs //
//================================================//
//! textmacro AddSkill takes SKILLWORD, SKILL
function Add$SKILLWORD$_Actions takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer key = GHId(t)
local integer i = LInteger( key, SH("Valeur"))
local unit u = LUnit( key, KEY_CASTER )
call SetHero$SKILL$( u, GetHero$SKILL$(u,true)-i, false)
call DestroyTimer(t)
call Flush(key)
endfunction
function Add$SKILLWORD$ takes unit u, integer i, real duree returns nothing
local timer t
call SetHero$SKILL$( u, GetHero$SKILL$(u,true) + i, false)
if (duree > 0) then
set t = CreateTimer()
call SUnit( u, GetHandleId(t), KEY_CASTER )
call SInteger( i, GetHandleId(t), StringHash("Valeur") )
call TimerStart (t , duree, false, function Add$SKILLWORD$_Actions)
endif
endfunction
//! endtextmacro
//! runtextmacro AddSkill("Force", "Str")
//! runtextmacro AddSkill("Agi", "Agi")
//! runtextmacro AddSkill("Int", "Int")
//================================================//
// Fonction : Modif Terrain //
//================================================//
function SetTerrainTimed_Actions takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer key = GetHandleId(t)
local real x = LReal( key, StringHash("x") )
local real y = LReal( key, StringHash("y") )
local integer forme = LInteger( key, StringHash("Forme") )
local integer ttype = LInteger( key, StringHash("Type") )
call SetTerrainType(x,y, ttype, -1, 1, forme)
call DestroyTimer(t)
call Flush(StringHash(R2S(x) + R2S(y)))
call Flush(key)
endfunction
function SetTerrainTimed takes real x, real y, integer ttype, integer forme, real duree returns boolean
local timer t
local integer key = StringHash(R2S(x) + R2S(y))
local boolean b = LBoolean(key, StringHash("Bool") )
if( b ) then
set t = LTimer( key, StringHash("Timer") )
else
set t = CreateTimer()
call SBoolean( true, key, StringHash("Bool") )
call STimer( t, key, StringHash("Timer") )
set key = GetHandleId(t)
call SInteger( GetTerrainType(x,y), key, StringHash("Type") )
call SInteger( forme, key, StringHash("Forme") )
call SReal( x, key, StringHash("x") )
call SReal( y, key, StringHash("y") )
endif
call SetTerrainType(x,y, ttype, -1, 1, forme)
call TimerStart (t, duree, false, function SetTerrainTimed_Actions )
return not b
endfunction
endlibrary
Name | Type | is_array | initial_value |
Attirer_Unite | timer | No | |
Btn_Difficulte | button | Yes | |
Btn_Msg_Predef | button | Yes | |
Cache | gamecache | No | |
Carac_Glow | boolean | Yes | |
Carac_Icone | imagefile | Yes | |
caster | unit | No | |
Chaine | string | No | |
Couloir | rect | Yes | |
Difficulte_Dlg | dialog | No | |
DimArene | integer | No | 28 |
DmgUnit | unit | Yes | |
Duree_partie | integer | Yes | |
Duree_partie_str | string | Yes | |
Entier | integer | No | |
Groupe_Arene | group | Yes | |
Groupe_Joueur | force | No | |
grpAdrenaline | group | No | |
Hero | unit | Yes | |
Heros | group | No | |
Heros_Resu | group | No | |
Heros_vivant | group | No | |
Jeu | gamecache | No | |
libCam_Angle_d_Attaque | integer | Yes | 304 |
libCam_Distance | integer | Yes | 1650 |
Ligne_Multiboard | integer | Yes | |
Liste_Objet | integer | Yes | |
loc | location | No | |
localPlayer | player | No | |
Marche | unit | Yes | |
Msg_Dlg | dialog | Yes | |
Nb_Joueur | integer | No | |
Nb_Joueur_Arene | integer | No | |
Nb_Porte | integer | No | |
Nb_Unites_Tuees | integer | Yes | |
Nb_Vote_Difficulte | integer | Yes | |
Niveau | integer | No | 1 |
objet | item | No | ItemNull |
p | integer | No | |
Pos_Caster | rect | Yes | |
Pos_central | rect | Yes | |
Pos_depart_Joueur | rect | Yes | |
Pos_Faible | rect | Yes | |
Pos_Fort | rect | Yes | |
Rage_ADRENALINE | real | No | 1.60 |
Rage_Hero | unit | Yes | |
Rage_Val | real | Yes | |
reel | real | No | |
Reg_Coin | rect | Yes | |
Round_window | timerdialog | No | |
Shop | group | No | |
Shopping_Timer | timer | No | |
Shopping_Window | timerdialog | No | |
Solo_mode | boolean | No | |
Son_a_jouer | sound | No | |
Spell | gamecache | No | |
Squel_Group | group | Yes | |
Squel_Nb | integer | Yes | |
Str_Difficulte | string | Yes | |
Str_Msg_Predef | string | Yes | |
Tablo_ppal | multiboard | No | |
target | unit | No | |
terArene | terraintype | Yes | |
terDalaran | terraintype | Yes | |
terIcecrown | terrainshape | Yes | |
terNorthrend | terrainshape | Yes | |
Terrain | terraintype | Yes | |
Terrain_Id | integer | Yes | |
test | string | No | |
Timer | timer | No | |
Timer_Difficulte | timer | No | |
tpsDebut | real | No | 60.00 |
tpsShopping | real | No | 55.00 |
trg_PrendObjet | trigger | No | |
unite | unit | No | |
Unite_Niveau | unitcode | Yes | |
uniteInvu | unit | No | |
unitImmun | unit | No | |
Vague_Unite | integer | No |
//TESH.scrollpos=0
//TESH.alwaysfold=0
library libCameraView
function Apply2ndPersonView_Actions takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LUnit( GetHandleId(t), StringHash("Unit") )
local real angle = GetUnitFacing(u)
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local player p = LPlayer( GetHandleId(t), StringHash("Player") )
call PanCameraToTimedForPlayer( p, x+100*Cos(Deg2Rad(angle)), y+100*Sin(Deg2Rad(angle)), 0.3 )
call SetCameraFieldForPlayer( p, CAMERA_FIELD_TARGET_DISTANCE, udg_libCam_Distance[GetPlayerId(p)+1], 0 )
call SetCameraFieldForPlayer( p, CAMERA_FIELD_ROTATION, angle, 0.8 )
call SetCameraFieldForPlayer( p, CAMERA_FIELD_ANGLE_OF_ATTACK, udg_libCam_Angle_d_Attaque[GetPlayerId(p)+1], 0 )
call SetCameraFieldForPlayer( p, CAMERA_FIELD_ZOFFSET, GetTerrainCliffLevel(x,y)*60, 0 )
endfunction
function Apply2ndPersonView takes player p, unit u returns nothing
local timer t = CreateTimer()
call SUnit( u, GetHandleId(t), StringHash("Unit") )
call SPlayer( p, GetHandleId(t), StringHash("Player") )
call TimerStart( t, 0.05, true, function Apply2ndPersonView_Actions )
endfunction
//===========================================================================
function InitTrig_Apply2ndPersonView takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=45
//TESH.alwaysfold=0
//! textmacro t_Timers takes NOM , PERIOD
library $NOM$ initializer init needs list
private struct Iterator
integer data = 0
boolexpr Boolexpr_trig
boolexpr TempCond
triggercondition Cond
Iterator next = 0
endstruct
globals
public constant real PERIOD = $PERIOD$ // must be a low period or it will be horribly inaccurate
endglobals
globals
private Iterator First
private Iterator Last
private Iterator Current
private Iterator Prev
private Iterator Remove = 0
private trigger Trig
private boolexpr RemoveCond
private boolexpr InitCond
private integer Size = -1
private timer Tim
endglobals
private function AddData takes integer data returns Iterator
local Iterator it = Iterator.create()
set it.data = data
set Last.next = it
set Last = it
return it
endfunction
// Ajoute un élément
public function Add takes code func, integer data returns nothing
local Iterator it = 0
set Size = Size + 1
if Size == 0 then
call TimerStart(Tim,PERIOD,true,null)
endif
// Création de l'élément et de sa condition
set it = AddData(data)
set it.TempCond = And(InitCond, Condition(func))
set it.Boolexpr_trig = And(it.TempCond, RemoveCond)
set it.Cond = TriggerAddCondition(Trig, it.Boolexpr_trig)
endfunction
// Donnée du pointeur courrant
public function GetData takes nothing returns integer
return Current.data
endfunction
// Suppression d'un élement de la liste
private function Delete takes nothing returns nothing
// Anti-Leak tout çaaa
call TriggerRemoveCondition(Trig, Remove.Cond)
call DestroyBoolExpr(Remove.Boolexpr_trig)
call DestroyBoolExpr(Remove.TempCond)
call Remove.destroy()
// La suppression a été effectué, on continue normalement
set Remove = 0
set Size = Size - 1
endfunction
private function End takes nothing returns boolean
set Prev.next = Current.next
// La condition ne peut pas être détruite immédiatement, sauf
// si l'élément est en fin de liste,
// elle sera détruite au prochain appel d'init
set Remove = Current
set Current = Prev.next
// Dernier Elément
if( Current == 0 ) then
set Last = Prev
// Suppression immédiate car dernière condition
if( Remove != 0 ) then
call Delete()
endif
endif
return false
endfunction
private function Init takes nothing returns boolean
if( Remove == 0) then
set Prev = Current
set Current = Current.next
else
call Delete()
endif
return true
endfunction
private function Init_Trig takes nothing returns boolean
if Size == -1 then
call PauseTimer(Tim)
endif
set Prev = First
set Current = Prev.next
return false
endfunction
public function init takes nothing returns nothing
// Deux élements vides pour simuler un départ à -1 et simplifier
// la destruction d'un élément
local Iterator it = Iterator.create()
set it.data = -2
set Last = it
set First = it
call AddData(-1)
set Tim = CreateTimer()
set Trig = CreateTrigger()
call TriggerAddCondition(Trig,Condition(function Init_Trig))
call TriggerRegisterTimerExpireEvent(Trig,Tim)
set RemoveCond = Condition(function End)
set InitCond = Condition(function Init)
call TimerStart(Tim, PERIOD, true, null)
endfunction
endlibrary
//! endtextmacro
//! runtextmacro t_Timers("T003", "0.03")
//! runtextmacro t_Timers("T01", "0.1")
//! runtextmacro t_Timers("T025", "0.25")
//! runtextmacro t_Timers("T05", "0.5")
//! runtextmacro t_Timers("T1", "1.0")
//! runtextmacro t_Timers("T15", "1.5")
library loopObject needs T003, T01, T025, T05, T1, T15
endlibrary
//TESH.scrollpos=131
//TESH.alwaysfold=0
//////////////////////////////////////////////////////////////////
//
// Comment l'utiliser ?
//
// Création d'un type de liste: (à n'appeler qu'une seule fois)
// //! runtextmacro LIST("integer", "0")
//
// Création d'une liste (exemple avec le type integer):
// local integerList list = integerList.create()
//
// Ajout d'un élément
// call list.add(10)
//
// Suppression d'un élément
// call list.delete(10)
//
// Suppression de tous les éléments
// call list.deleteAll()
//
// Nombre d'éléments de la liste
// local integer nbElem = list.getCount()
//
// Le parcours de la liste se fait avec les fonctions first, last, next et getCurrent
// o Accéder au premier élément
// set val = list.first()
//
// o Element suivant
// set val = list.next()
//
// o Dernier Element
// set val = list.last()
//
// o Elément courrant
// set val = list.getCurrent()
//
// Exemple de parcours, parcours de toute la liste:
//
// local tStruct val = l.first()
// loop
// exitwhen val == 0
//
// call val.exemple()
//
// set val = l.next()
// endloop
//
//////////////////////////////////////////////////////////////////
library list
//! textmacro LIST takes TYPE, NULL, DISPLAY
struct $TYPE$Node
$TYPE$ data = $NULL$
integer next = 0
endstruct
struct $TYPE$List
private $TYPE$Node header // Tete de la liste
private $TYPE$Node tail // Queue de la liste
private $TYPE$Node current// Elément courrant
private integer count // Nombre d'éléments
// Construct and initialize the list
static method create takes nothing returns thistype
local thistype l = thistype.allocate()
set l.header = 0
set l.tail = 0
set l.count = 0
set l.current = 0
return l
endmethod
method deleteAll takes nothing returns nothing
local $TYPE$Node node = 0
loop
exitwhen this.header == 0
set node = this.header
// Noeud suivant
set this.header = node.next
call node.destroy()
endloop
set this.header = 0
set this.tail = 0
set this.count = 0
endmethod
method add takes $TYPE$ elem returns nothing
local $TYPE$Node node = $TYPE$Node.create()
if( this.header == 0 ) then
set this.header = node
endif
set this.tail.next = node
set this.tail = node
set this.count = this.count + 1
set node.data = elem
set node.next = 0
endmethod
method delete takes $TYPE$ elem returns nothing
local $TYPE$Node node = 0
local $TYPE$Node prevNode = 0
// Cas le plus simple, c'est le premier élément de la liste
if( this.header.data == elem ) then
set node = this.header
// Un seul élément dans la liste
if( this.count == 1 ) then
set this.tail = node.next
endif
// Suppression du premier élément
set this.header = node.next
call node.destroy()
set this.count = this.count - 1
else
set prevNode = this.header
set node = prevNode.next
loop
exitwhen node == 0 or node.data == elem
set node = node.next
set prevNode = prevNode.next
endloop
if( node != 0 ) then
if( this.tail == node ) then
set this.tail = prevNode
endif
// Element trouvé
set prevNode.next = node.next
set this.count = this.count - 1
else
debug call BJDebugMsg("list::delete Element not found: "+$DISPLAY$(elem))
endif
endif
set this.current = this.header
endmethod
method getCount takes nothing returns integer
return this.count
endmethod
method onDestroy takes nothing returns nothing
call this.deleteAll()
call .destroy()
endmethod
method display takes nothing returns nothing
local $TYPE$Node node = this.header
local string result = ""
loop
exitwhen node == 0
set result = result + " " + $DISPLAY$(node.data)
set node = node.next
endloop
call BJDebugMsg("Length: " + I2S(this.count))
call BJDebugMsg(result)
endmethod
method getCurrent takes nothing returns $TYPE$
local $TYPE$ result = $NULL$
if( this.current != 0 ) then
set result = this.current.data
endif
return result
endmethod
// Renvoie l'élément suivant
method next takes nothing returns $TYPE$
local $TYPE$ result = $NULL$
if( this.current != 0 ) then
set this.current = this.current.next
set result = this.getCurrent()
endif
return result
endmethod
// Place le pointeur sur le premier élément et renvoie sa valeur
method first takes nothing returns $TYPE$
local $TYPE$ result = $NULL$
if( this.header != 0 ) then
set this.current = this.header
set result = this.header.data
endif
return result
endmethod
// Place le pointeur sur le dernier élément et renvoie sa valeur
method last takes nothing returns $TYPE$
local $TYPE$ result = $NULL$
if( this.tail != 0 ) then
set this.current = this.tail
set result = this.tail.data
endif
return result
endmethod
endstruct
//! endtextmacro
//! runtextmacro LIST("integer", "0", "I2S")
//! runtextmacro LIST("string", "\"\"", "")
endlibrary
//TESH.scrollpos=696
//TESH.alwaysfold=0
library libSpellEffect needs loopObject, libCastSpell
interface Spell
unit caster
unit target
real dmg
endinterface
function DistanceBetweenPointsEx takes real x1, real y1, real x2, real y2 returns real
local real dx = x1 - x2
local real dy = y1 - y2
return SquareRoot( dx * dx + dy * dy)
endfunction
function DistanceBetweenUnits takes unit u1, unit u2 returns real
local real dx = GetUnitX(u1) - GetUnitX(u2)
local real dy = GetUnitY(u1) - GetUnitY(u2)
return SquareRoot( dx * dx + dy * dy)
endfunction
//================================================//
// Fonction : Recul //
//================================================//
struct SRecul extends Spell
real height
real angle
integer vit
integer duree
integer i = 0
boolean vol = false
static method cycle takes nothing returns boolean
local thistype this = T003_GetData()
if ( .i < .duree) then
set .i = .i + 1
call SetUnitPosition(this.target, GetUnitX(this.target) + .vit*Cos(.angle), GetUnitY(this.target) + .vit*Sin(.angle))
if( .vol) then
if ( .i == .duree/4 ) then
call SetUnitFlyHeight( this.target, .height, (.height/6) / ((I2R(.duree)*0.03)/4) )
elseif ( .i == .duree/2) then
call SetUnitFlyHeight( this.target, .height- .height/5, (.height/6) / ((I2R(.duree)*0.03)/4) )
elseif ( .i == .duree-(.duree/4) ) then
call SetUnitFlyHeight( this.target, 0, (.height-.height/5) / ((I2R(.duree)*0.03)/4) )
endif
endif
else
call SetUnitPathing( this.target, true)
call SRecul.destroy(this)
return true
endif
return false
endmethod
endstruct
// Renvoie la durée du recul
function ReculAngle takes real angle, unit target, integer distance, real height, integer vit returns real
local SRecul obj = SRecul.create()
set obj.target = target
set obj.duree = distance/vit
set obj.vit = vit
set obj.angle = angle
set obj.height = height
call SetUnitPathing( target, false)
call T003_Add(function SRecul.cycle, obj)
if( height > 10 ) then
set obj.vol = true
call UnitAddAbility( target, 'Arav' )
call SetUnitFlyHeight( target, height- height/5, (height-height/5) / (((I2R(distance)/vit)*0.03)/4) )
call UnitRemoveAbility( target, 'Arav' )
endif
return I2R(obj.duree) * T003_PERIOD
endfunction
function Recul takes real xc, real yc, unit target, integer distance, real height, integer vit returns real
return ReculAngle( Atan2(GetUnitY(target) - yc, GetUnitX(target) - xc), target, distance, height, vit)
endfunction
//===========================================//
// Sort : Flamme //
//===========================================//
globals
constant string FLAMME_EFFECT = "Doodads\\Cinematic\\TownBurningFireEmitter\\TownBurningFireEmitter.mdl"
constant string FOUDRE_EFFECT = "Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl"
constant string METEOR_EFFECT = "Units\\Demon\\Infernal\\InfernalBirth.mdl"
constant real AOE_FLAMME = 90.0
endglobals
struct Flamme extends Spell
location loc
real duree
effect e
static method cycle takes nothing returns boolean
local thistype this = T05_GetData()
set .duree = .duree - T05_PERIOD
call DmgToArea( .loc, .caster, .dmg/2, AOE_FLAMME, false)
if( this.duree < 0 ) then
call DestroyEffect(.e)
call RemoveLocation(.loc)
call Flamme.destroy(this)
return true
endif
return false
endmethod
endstruct
function SEffect_Flamme takes unit u, real x, real y, real dmg, real duree returns nothing
local Flamme obj = Flamme.create()
set obj.loc = Location(x,y)
set obj.caster = u
set obj.dmg = dmg
set obj.duree = duree
set obj.e = AddSpecialEffectLoc( FLAMME_EFFECT, obj.loc )
call T05_Add(function Flamme.cycle, obj)
endfunction
//===========================================//
// Sort : Foudre //
//===========================================//
function SEffect_Foudre_Actions takes nothing returns nothing
local timer t = GetExpiredTimer()
call DestroyLightning( LLightning( GetHandleId(t), StringHash("Lightning")) )
call Flush( GetHandleId(t) )
call DestroyTimer(t)
endfunction
function SEffect_Foudre takes unit caster, real x, real y, real dmg, real dist returns nothing
local lightning l = AddLightningEx( "CLPB", true, x, y, 2000, x, y, 0)
local location loc = Location(x,y)
local timer t = CreateTimer()
call DestroyEffect( AddSpecialEffect( FOUDRE_EFFECT, x, y ) )
call PlaySoundBJ( gg_snd_LightningShieldTarget )
call DmgToAreaEffect( loc, caster, dmg, dist, true, "Abilities\\Weapons\\Bolt\\BoltImpact.mdl")
call RemoveLocation(loc)
call SLightning( l, GetHandleId(t), StringHash("Lightning") )
// Précision réquise, pas de timers génériques
call TimerStart( t, 0.3, false, function SEffect_Foudre_Actions )
endfunction
//============================================//
// Sort : Sarment //
//============================================//
globals
constant integer BUFF_SARMENT = 'BEer'
constant integer UNIT_SARMENT = 'h00A'
constant integer ABILITY_SARMENT = 'A096'
endglobals
struct Sarment extends Spell
integer duree
boolean txtFlo
boolean b = false
public method SetParam takes unit caster, unit target, real dmg, integer duree returns nothing
set this.caster = caster
set this.target = target
set this.dmg = dmg
set this.duree = duree
endmethod
static method cycle takes nothing returns boolean
local thistype this = T1_GetData()
if ( (GetUnitAbilityLevel(this.target, BUFF_SARMENT) < 1 or this.duree == 0) and .b ) then
call UnitRemoveAbility(this.target, BUFF_SARMENT)
call RInteger( GetHandleId(this.target), SH("SEffect__Sarment"))
call PauseUnit( this.target, false)
call Sarment.destroy(this)
return true
endif
set this.b = true
set this.duree = this.duree - 1
call DmgToUnit( this.caster, this.target, this.dmg, this.txtFlo)
return false
endmethod
endstruct
// Peut être dissipé
function SEffect_Sarment takes unit caster, unit target, real dmg, integer duree, boolean txt returns nothing
local Sarment obj = LInteger( GetHandleId(target), SH("SEffect__Sarment") )
local unit u
if( obj == 0 ) then
set obj = Sarment.create()
// Unité qui lance le sarment
set u = CreateUnit( GetOwningPlayer(caster), UNIT_SARMENT, GetUnitX(target), GetUnitY(target), 0)
call IssueTargetOrder( u, "entanglingroots", target )
call UnitApplyTimedLife( u, 'BTLF', 1.00 )
call SInteger( obj, GetHandleId(target) , SH("SEffect__Sarment") )
call PauseUnit( target, true )
call T1_Add(function Sarment.cycle, obj)
endif
call obj.SetParam( caster, target, dmg, duree )
set obj.txtFlo = txt
endfunction
//================================================//
// Fonction : Meteor //
//================================================//
struct Meteor extends Spell
boolean txt
real x
real y
real area
private static key s
static method cycle takes nothing returns nothing
local timer t = GetExpiredTimer()
local thistype this = LInteger( GetHandleId(t), SH("obj"))
local location loc = Location( this.x, this.y)
// Dommages du météores
call DmgToArea( loc, this.caster, this.dmg, this.area, this.txt )
// Suppression des données
call RemoveLocation(loc)
call Flush( GetHandleId(t) )
call Meteor.destroy(this)
endmethod
endstruct
function SEffect_Meteor takes unit caster, real x, real y, real dmg, boolean txt, real area returns nothing
local Meteor obj = Meteor.create()
local timer t = CreateTimer()
set obj.caster = caster
set obj.x = x
set obj.y = y
set obj.dmg = dmg
set obj.txt = txt
set obj.area = area
call DestroyEffect( AddSpecialEffect( METEOR_EFFECT, x, y ) )
call SInteger( obj, GetHandleId(t), SH("obj"))
// Précision réquise, pas de timers génériques
call TimerStart( t, 1.0, false, function Meteor.cycle )
endfunction
//================================================//
// Fonction : Get Total //
//================================================//
struct Gel extends Spell
real duree
effect e = null
static method cycle takes nothing returns boolean
local thistype this = T025_GetData()
set this.duree = this.duree - T025_PERIOD
if( this.duree < 0.0 ) then
call RInteger( GetHandleId(this.target), SH("GelTotal") )
call DestroyEffect(this.e)
call PauseUnit( this.target, false )
call RInteger( GetHandleId(this.target), SH("GelTotal"))
return true
endif
return false
endmethod
endstruct
// Ne peut être dissipé
function Gel_Total takes unit target, real duree returns nothing
local timer t
local Gel obj = LInteger( GetHandleId(target), SH("GelTotal") )
if( not IsUnitDeadBJ(target) ) then
if ( obj == 0 ) then
call PauseUnit( target, true)
set obj = Gel.create()
set obj.duree = duree - T025_PERIOD
set obj.target = target
set obj.e = AddSpecialEffectTarget("Abilities\\Spells\\Undead\\FreezingBreath\\FreezingBreathTargetArt.mdl", target, "origin")
set t = CreateTimer()
call SInteger( obj, GetHandleId(target), SH("GelTotal") )
call T025_Add(function Gel.cycle, obj)
else
set obj.duree = duree
endif
endif
endfunction
//================================================//
// Fonction : Vol de Mana //
//================================================//
// percent : entre 0.0 et 1.0
function SEffect_VolDeMana takes unit from, unit to, real val, real percent returns boolean
local real mana = GetUnitState(from, UNIT_STATE_MANA)
if( mana <= 0.0 ) then
return false // Unit sans mana
endif
if( mana < val ) then
set val = GetUnitState(from, UNIT_STATE_MANA) // Réajsutement du vol de mana
endif
call AddMana( from, -val )
call AddMana( to, val*percent )
return true
endfunction
//================================================//
// Fonction : Parasite //
//================================================//
struct Parasite extends Spell
integer summon
boolean txt
real duree
real dur
static method cycle takes nothing returns boolean
local thistype this = T1_GetData()
local real angle
local unit u
call DmgToUnit( this.caster, this.target, this.dmg, this.txt )
if( GetUnitState( this.target, UNIT_STATE_LIFE ) <= 0.0 ) then
set angle = Atan2( GetUnitY(this.target) - GetUnitY(this.caster), GetUnitX( this.target) - GetUnitY(this.target) )
set u = CreateUnit( GetOwningPlayer(this.caster), .summon, GetUnitX(this.target), GetUnitY(this.target), Rad2Deg(angle) )
call UnitApplyTimedLife( u, 'BTLF', this.dur )
set this.duree = 0.0
endif
set this.duree = this.duree - 1.0
if( this.duree < 0.0 ) then
call RInteger( GetHandleId(this.target), SH("SEFFECT_Parasite") )
call Parasite.destroy(this)
return true
endif
return false
endmethod
endstruct
// Ne peut être dissipé
// Une même cible ne peut avoir plusieurs effets parasites simultanément
//
// caster: source des dommages
// target: cible du parasite
// summon: id de l'unité à créer si la cible meurt
// dmg: nombre de dégâts par seconde que subit la cible
// txt: affichage des dommages en textes flottants
// duree: durée du sort
// dur: durée du parasite
function SEffect_Parasite takes unit caster, unit target, integer summon, real dmg, boolean txt, real duree, real dur returns nothing
local Parasite obj = LInteger( GetHandleId(target), SH("SEFFECT_Parasite") )
local boolean b = false
if( obj == 0 ) then
set obj = Parasite.create()
call SInteger( obj, GetHandleId(target), SH("SEFFECT_Parasite") )
set obj.target = target
set b = true
endif
set obj.caster = caster
set obj.summon = summon
set obj.dmg = dmg
set obj.txt = txt
set obj.dur = dur
set obj.duree = duree
if( b ) then
call T1_Add(function Parasite.cycle, obj)
endif
endfunction
//================================================//
// Fonction : Pluie //
//================================================//
struct Pluie
boolean txt
real x
real y
string e2
unit caster
real dmg
real dist
static method cycle takes nothing returns boolean
local timer t = GetExpiredTimer()
local Pluie this = LInteger( GetHandleId(t), StringHash("SEffect_Pluie") )
local location loc = Location( .x,.y)
call DmgToArea( loc, .caster, .dmg, .dist,.txt )
if( .e2 != "" ) then
call DestroyEffect( AddSpecialEffectLoc( .e2, loc) )
endif
call RemoveLocation(loc)
call Pluie.destroy(this)
call DestroyTimer(GetExpiredTimer())
call Flush( GetHandleId(t) )
return true
endmethod
endstruct
function SEffect_Pluie takes unit caster, real x, real y, real dmg, boolean txt, string e1, string e2, real delay, real dist returns nothing
local Pluie obj = Pluie.create()
local timer t = CreateTimer()
set obj.caster = caster
set obj.x = x
set obj.y = y
set obj.dmg = dmg
set obj.txt = txt
set obj.e2 = e2
set obj.dist = dist
call SInteger( obj, GetHandleId(t), StringHash("SEffect_Pluie") )
call DestroyEffect( AddSpecialEffect( e1, x, y ) )
call TimerStart( t, delay, false, function Pluie.cycle )
endfunction
//================================================//
// Fonction : Souffle //
//================================================//
struct structSouffle extends Spell
boolean txt
trigger trig
static method Actions takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local structSouffle this = LInteger( GetHandleId(t), SH("obj") )
local unit target = GetTriggerUnit()
if( GetEventDamageSource() !=.caster ) then
return
endif
//call Recul( GetUnitX(obj.caster), GetUnitY(obj.caster), target, 200, 0, 14)
call DisableTrigger(t)
call DmgToUnit( .caster, target, .dmg, true)
call EnableTrigger(t)
endmethod
static method End takes nothing returns nothing
local timer t = GetExpiredTimer()
local thistype this = LInteger( GetHandleId(t), SH("obj") )
call Flush(GetHandleId(t))
call Flush(GetHandleId(.trig))
call DestroyTrigger(.trig)
call DestroyTimer(t)
call thistype.destroy(this)
endmethod
endstruct
function SEffect_Souffle takes unit caster, real angle, real dist, real area, real dmg, boolean txt returns nothing
local trigger t = CreateTrigger()
local timer cpt = CreateTimer()
local real xc = GetUnitX(caster)
local real yc = GetUnitY(caster)
local real x = xc + dist * Cos(angle)
local real y = yc + dist * Sin(angle)
local location loc = Location(x,y)
local group g = null
local unit u = null
local structSouffle obj = structSouffle.create()
set Cond.condUnite = caster
set g = GetUnitsInRangeOfLocMatching(area, loc, Condition(function Cond.EnnemiVar))
call RemoveLocation(loc)
set obj.caster = caster
set obj.dmg = dmg
set obj.txt = txt
set obj.trig = t
// Déclencheur des dommages
call SInteger( obj, GetHandleId(t), SH("obj") )
call TriggerAddAction( t, function structSouffle.Actions)
// Timer pour terminer le sort
call SInteger( obj, GetHandleId(cpt), SH("obj"))
call TimerStart( cpt, 2.0, false, function structSouffle.End )
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit(g, u)
call TriggerRegisterUnitEvent(t, u, EVENT_UNIT_DAMAGED)
endloop
set t = null
set u = null
set g = null
set loc = null
endfunction
//================================================//
// Fonction : Adrénaline //
//================================================//
function Init_Adrenaline takes unit u returns nothing
local integer id = GetPlayerId(GetOwningPlayer(u))
set udg_Rage_Hero[id] = u
set udg_Rage_Val[id] = udg_Rage_ADRENALINE
call AddMana( u, -1000.0)
call GroupAddUnit( udg_grpAdrenaline, u)
call SetPlayerTechResearched( GetOwningPlayer(u), 'Rhse', 1)
call TriggerRegisterUnitEvent( gg_trg_Obj_heros_rage, u, EVENT_UNIT_PICKUP_ITEM )
endfunction
//================================================//
// Fonction : Bash!!! //
//================================================//
struct Bash extends Spell
timer t
effect e
static method Fin takes nothing returns nothing
local timer t = GetExpiredTimer()
local Bash this = LInteger( GetHandleId(t), SH("obj") )
call PauseUnit( .target, false)
call Flush( GetHandleId(t) )
call RInteger( GetHandleId(.target), SH("SEffect_Bash") )
call DestroyTimer(t)
call DestroyEffect(.e)
call Bash.destroy(this)
set t = null
endmethod
endstruct
function SEffect_Bash takes unit target, real duree returns nothing
local Bash obj = LInteger( GetHandleId(target), SH("SEffect_Bash") )
if( obj == 0) then
if (duree < 0.01) then
set duree = 0.01
endif
set obj = Bash.create()
set obj.t = CreateTimer()
set obj.target = target
call PauseUnit( target, true)
set obj.e = AddSpecialEffectTarget( "Abilities\\Spells\\Human\\Thunderclap\\ThunderclapTarget.mdl", target, "overhead" )
call SInteger( obj, GetHandleId(obj.t), SH("obj") )
call SInteger( obj, GetHandleId(target), SH("SEffect_Bash") )
endif
call TimerStart( obj.t , duree, false, function Bash.Fin )
endfunction
//================================================//
// Fonction : Eruption //
//================================================//
globals
constant integer UNIT_ERUPTION_FLAMME = 'h01G'
constant integer UNIT_ERUPTION_FLAMME_PETIT = 'h01H'
constant string ERUPTION_EXPLOSION = "Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl"
constant string EFFECT_ERUPTION = "Abilities\\Spells\\Other\\Volcano\\VolcanoDeath.mdl"
endglobals
struct Eruption extends Spell
real dot
boolean txt
real duree
boolean b = true
unit e1
unit e2
unit e3
unit e4
real x
real y
static method Explosion takes nothing returns nothing
local timer t = GetExpiredTimer()
local Eruption obj = LInteger( GetHandleId(t), SH("SEffect_Eruption"))
local location loc = Location(obj.x, obj.y)
call DestroyTimer(t)
set t = null
call DmgToArea( loc, obj.caster, obj.dmg, 180.0, obj.txt )
call SetTerrainTimed( obj.x, obj.y, LAVE, FORME_CARRE, obj.duree+1.0)
call DestroyEffect( AddSpecialEffect( EFFECT_ERUPTION, obj.x, obj.y) )
call RemoveLocation(loc)
set loc = null
call T1_Add(function Eruption.cycle, obj)
endmethod
static method cycle takes nothing returns boolean
local thistype this = T1_GetData()
local location loc = Location(this.x, this.y)
set this.duree = this.duree - 1.0
call DmgToArea( loc, this.caster, this.dot, 180.0, this.txt )
if( this.b ) then
set this.b = false
call RemoveUnit(this.e3)
//call RemoveUnit(this.e4)
set this.e3 = CreateUnit(GetOwningPlayer(this.caster), UNIT_ERUPTION_FLAMME, this.x+50.0*Cos(bj_PI/2.0), this.y+50.0*Sin(bj_PI/2.0), 45.0 )
//set this.e4 = CreateUnit(GetOwningPlayer(this.caster), UNIT_ERUPTION_FLAMME_PETIT, this.x+50.0*Cos(bj_PI/2.0), this.y+50.0*Sin(bj_PI/2.0), 45.0 )
else
set this.b = true
call RemoveUnit(this.e1)
//call RemoveUnit(this.e2)
set this.e1 = CreateUnit(GetOwningPlayer(this.caster), UNIT_ERUPTION_FLAMME, this.x+50.0*Cos(bj_PI/2.0), this.y+50.0*Sin(bj_PI/2.0), 45.0 )
//set this.e2 = CreateUnit(GetOwningPlayer(this.caster), UNIT_ERUPTION_FLAMME_PETIT, this.x+50.0*Cos(bj_PI/2.0), this.y+50.0*Sin(bj_PI/2.0), 45.0 )
endif
call RemoveLocation(loc)
set loc = null
if( this.duree < 0.0 ) then
call DestroyEffect( AddSpecialEffect( EFFECT_ERUPTION, this.x, this.y) )
call RemoveUnit(this.e1)
call RemoveUnit(this.e2)
call RemoveUnit(this.e3)
call RemoveUnit(this.e4)
call Eruption.destroy(this)
return true
endif
return false
endmethod
endstruct
function SEffect_Eruption takes unit caster, real x, real y, real dmg, real dot, real duree, boolean txt returns nothing
local Eruption obj = Eruption.create()
local timer t = CreateTimer()
set obj.caster = caster
set obj.dmg = dmg
set obj.dot = dot
set obj.txt = txt
set obj.duree = duree
set x = Pos_Terrain(x)
set y = Pos_Terrain(y)
set obj.x = x
set obj.y = y
call DestroyEffect( AddSpecialEffect(ERUPTION_EXPLOSION, x, y ) )
call SInteger( obj, GetHandleId(t), SH("SEffect_Eruption"))
call TimerStart( t, 1.0, false, function Eruption.Explosion)
endfunction
//================================================//
// Fonction : Drain de Vie //
//================================================//
struct DrainDeVie extends Spell
real fact = 0.0
real duree = 0.0
effect e = null
lightning l = null
static method cycle takes nothing returns boolean
local thistype this = T003_GetData()
local integer nbDrain = 0
if( ModuloReal(this.duree,0.50) < T003_PERIOD ) then
call DmgToUnit( this.caster, this.target, this.dmg, false)
call AddLife( this.caster, this.dmg*this.fact)
endif
call MoveLightningEx( this.l, true, GetUnitX(this.caster), GetUnitY(this.caster), GetUnitZ(this.caster)+Z_ECLAIR, GetUnitX(this.target), GetUnitY(this.target), GetUnitZ(this.target)+Z_ECLAIR)
set .duree = .duree - T003_PERIOD
if( .duree <= 0.0 or DistanceBetweenUnits(this.caster, this.target) > 900.0 or IsUnitDeadBJ(this.target) ) then
set nbDrain = LInteger( GetHandleId(this.caster), SH("draindevie__nbdrain"))
call SInteger( GetHandleId(this.caster), SH("draindevie__nbdrain"), nbDrain - 1)
if( (nbDrain - 1) == 0 ) then
call DestroyEffect( LEffect( GetHandleId(this.caster), SH("draindevie__effect")) )
endif
call GroupRemoveUnit( LGroup( GetHandleId(this.caster), SH("draindevie__cibles")), this.target)
call DestroyLightning(this.l)
call DestroyEffect(this.e)
call DrainDeVie.destroy(this)
return true
endif
return false
endmethod
endstruct
function SEffect_DrainDeVie takes unit caster, unit target, real dmg, real fact, real duree returns nothing
local DrainDeVie obj = DrainDeVie.create()
local effect e = null
local integer nbDrain = LInteger( GetHandleId(caster), SH("draindevie__nbdrain") )
local group g = null
set obj.caster = caster
set obj.target = target
if( LGroup( GetHandleId(caster), SH("draindevie__cibles") ) == null ) then
set g = CreateGroup()
call SGroup( g, GetHandleId(caster), SH("draindevie__cibles"))
else
set g = LGroup( GetHandleId(caster), SH("draindevie__cibles"))
endif
if( IsUnitInGroup(target, g) ) then
call DrainDeVie.destroy(obj)
return
endif
call GroupAddUnit(g, target)
set obj.e = AddSpecialEffectTarget( "Abilities\\Spells\\Other\\Drain\\DrainTarget.mdl", target, "origin")
set obj.l = AddLightningEx("DRAL", true, GetUnitX(caster), GetUnitY(caster), GetUnitZ(caster)+90, GetUnitX(target), GetUnitY(target), GetUnitZ(target)+Z_ECLAIR )
set obj.dmg = dmg
set obj.fact = fact
set obj.duree = duree
if( nbDrain == 0 ) then
set e = AddSpecialEffectTarget( "Abilities\\Spells\\Other\\Drain\\DrainCaster.mdl", caster, "origin")
call SEffect( e, GetHandleId(caster), SH("draindevie__effect") )
endif
call SInteger( nbDrain + 1, GetHandleId(caster), SH("draindevie__nbdrain") )
call T003_Add(function DrainDeVie.cycle, obj)
endfunction
//================================================//
// Fonction : Drain de Mana //
//================================================//
globals
constant integer KEY_DRAINMANA_NBDRAIN = StringHash("draindemana__nbdrain")
constant integer KEY_DRAINMANA_EFFECT = StringHash("draindemana__effect")
constant integer KEY_DRAINMANA_TARGETS = StringHash("draindemana__targets")
endglobals
struct DrainDeMana extends Spell
real fact = 0.0
real duree = 0.0
effect e = null
lightning l = null
static method cycle takes nothing returns boolean
local thistype this = T003_GetData()
local integer nbDrain = 0
if( ModuloReal(this.duree, 0.50) < T003_PERIOD ) then
call SEffect_VolDeMana( .target, .caster, .dmg, .fact)
endif
call MoveLightningEx( .l, true, GetUnitX(.caster), GetUnitY(.caster), GetUnitZ(.caster)+Z_ECLAIR, GetUnitX(.target), GetUnitY(.target), GetUnitZ(.target)+Z_ECLAIR)
set .duree = .duree - T003_PERIOD
if( .duree <= 0.0 or DistanceBetweenUnits(.caster, .target) > 900.0 or IsUnitDeadBJ(this.target) ) then
set nbDrain = LInteger( GetHandleId(.caster), KEY_DRAINMANA_NBDRAIN)
call SInteger( nbDrain - 1, GetHandleId(.caster), KEY_DRAINMANA_NBDRAIN )
if( (nbDrain - 1) == 0 ) then
call DestroyEffect( LEffect( GetHandleId(.caster), KEY_DRAINMANA_EFFECT) )
endif
call GroupRemoveUnit( LGroup( GetHandleId(.caster), KEY_DRAINMANA_TARGETS), this.target)
call DestroyLightning(.l)
call DestroyEffect(.e)
call DrainDeMana.destroy(this)
return true
endif
return false
endmethod
endstruct
function SEffect_DrainDeMana takes unit caster, unit target, real dmg, real fact, real duree returns nothing
local DrainDeMana obj
local effect e = null
local integer nbDrain = LInteger( GetHandleId(caster), KEY_DRAINMANA_NBDRAIN )
local group g = null
if( GetUnitState( target, UNIT_STATE_MAX_MANA) <= 0.0 ) then
return
endif
set obj = DrainDeMana.create()
set obj.caster = caster
set obj.target = target
if( LGroup( GetHandleId(caster), KEY_DRAINMANA_TARGETS) == null ) then
set g = CreateGroup()
call SGroup( g, GetHandleId(caster), KEY_DRAINMANA_TARGETS )
else
set g = LGroup( GetHandleId(caster), KEY_DRAINMANA_TARGETS)
endif
if( IsUnitInGroup(target, g) ) then
call DrainDeMana.destroy(obj)
return
endif
call GroupAddUnit(g, target)
set obj.e = AddSpecialEffectTarget( "Abilities\\Spells\\Other\\Drain\\ManaDrainTarget.mdl", target, "origin")
set obj.l = AddLightningEx("DRAM", true, GetUnitX(caster), GetUnitY(caster), GetUnitZ(caster)+90, GetUnitX(target), GetUnitY(target), GetUnitZ(target)+Z_ECLAIR )
set obj.dmg = dmg / 2.
set obj.fact = fact
set obj.duree = duree
if( nbDrain == 0 ) then
set e = AddSpecialEffectTarget( "Abilities\\Spells\\Other\\Drain\\ManaDrainCaster.mdl", caster, "origin")
call SEffect( e, GetHandleId(caster), KEY_DRAINMANA_EFFECT )
endif
call SInteger( nbDrain + 1, GetHandleId(caster), KEY_DRAINMANA_NBDRAIN )
call T003_Add(function DrainDeMana.cycle, obj)
endfunction
//===========================================================================
function InitTrig_libSpellEffect takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=4
//TESH.alwaysfold=0
//function DgtsCaster takes nothing returns boolean
// local string m = I2S(H2I(GetTriggerUnit()))
// return H2I(GetEventDamageSource() ) == GetStoredInteger( udg_Spell, m, "Caster")
//endfunction
library libCondition needs CustomScript
struct Cond
static unit condUnite
static method DgtsCaster takes nothing returns boolean
return GetEventDamageSource() == LUnit(GetHandleId(GetTriggeringTrigger()), KEY_CASTER)
endmethod
static method AttaquantCaster takes nothing returns boolean
return GetAttacker() == LUnit(GHId(GetTriggeringTrigger()), KEY_CASTER)
endmethod
static method AttaquantCasterVar takes nothing returns boolean
return GetAttacker() == Cond.condUnite
endmethod
static method AttaquantTarget takes nothing returns boolean
return GetAttacker() == LUnit(GHId(GetTriggeringTrigger()), KEY_TARGET)
endmethod
static method Ennemi takes nothing returns boolean
return ( (IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit()) ) == true) and (GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) > 0) and not IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) )
endmethod
static method EnnemiVar takes nothing returns boolean
return ( (IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(Cond.condUnite) ) == true) and (GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) > 0) and not IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) )
endmethod
static method Allie takes nothing returns boolean
return ( (IsUnitAlly(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit()) ) == true) and (GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) > 0) and not IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) )
endmethod
static method PlayerUnit takes nothing returns boolean
return ( GetOwningPlayer(GetTriggerUnit()) == GetOwningPlayer(GetFilterUnit()) and (GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) > 0) and not IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) )
endmethod
static method Alive takes nothing returns boolean
return GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) > 0
endmethod
static method Dead takes nothing returns boolean
return GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) <= 0
endmethod
static method Structure takes nothing returns boolean
return IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE)
endmethod
static method Terrestre takes nothing returns boolean
return GetUnitFlyHeight(GetFilterUnit()) < 10
endmethod
static method Mana takes nothing returns boolean
return GetUnitState(GetFilterUnit(), UNIT_STATE_MANA) > 0
endmethod
static method Invoque takes nothing returns boolean
return IsUnitType(GetFilterUnit(), UNIT_TYPE_SUMMONED)
endmethod
static method Immun takes nothing returns boolean
return IsUnitType(GetFilterUnit(), UNIT_TYPE_MAGIC_IMMUNE)
endmethod
static method Hero takes nothing returns boolean
return IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO)
endmethod
static method Dummy takes nothing returns boolean
return GetUnitAbilityLevel(GetFilterUnit(), 'Aloc') > 0
endmethod
endstruct
//===========================================================================
function InitTrig_libCondition takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library libCastSpell
function CastImmediateSpell takes unit caster, unit dummy, string spell returns nothing
call SetUnitX( dummy, GetUnitX(caster) )
call SetUnitY( dummy, GetUnitY(caster) )
call SetUnitOwner( dummy, GetOwningPlayer(caster), false)
call IssueImmediateOrder( dummy, spell)
call SetUnitX( dummy, X_DUMMY )
call SetUnitY( dummy, Y_DUMMY )
endfunction
//===========================================================================
function InitTrig_libCastSpell takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=27
//TESH.alwaysfold=0
library libDivers needs loopObject
globals
constant string COLOUR_YELLOW = "|cffffcc00"
constant string COLOUR_ORANGE = "|cffff8800"
constant string COLOUR_GREEN = "|cff66ff00"
constant string COLOUR_BLUE = "|cff3399ff"
constant integer PRIORITY_LOW = 1
constant integer PRIORITY_MEDIUM = 2
constant integer PRIORITY_HIGH = 3
constant real DUREE_MOYENNE_MSG = 10.0
group grpCanalisation = CreateGroup()
// Groupe
real grp_float = 0.0
unit grp_unit = null
unitstate grp_unitstate = UNIT_STATE_LIFE
endglobals
type Reels extends real array [20]
type tabEffect extends effect array [10]
struct UnitMsg
unit u
string msg
string color
real duree
texttag tt = CreateTextTag()
static method cycle takes nothing returns boolean
local thistype this = T003_GetData()
local location loc = Location( GetUnitX(.u) - 90.0, GetUnitY(.u) )
call DestroyTextTag(.tt)
set this.tt = CreateTextTagLocBJ( .color + .msg + "|r", loc, 218.00, 10.00, 100, 100, 100, 0 )
call SetTextTagPermanent( .tt, false )
call RemoveLocation(loc)
set loc = null
if( this.duree < 0.0 or IsUnitHidden(this.u) or IsUnitDeadBJ(this.u)) then
call RInteger( GetHandleId(.u), StringHash("UNIT_CHAT_MSG") )
call DestroyTextTag(.tt)
call UnitMsg.destroy(this)
return true
endif
set .duree = .duree - T003_PERIOD
return false
endmethod
endstruct
function DisplayUnitMsg takes unit u, string msg, string color, real duree returns nothing
local UnitMsg obj = LInteger( GetHandleId(u), StringHash("UNIT_CHAT_MSG") )
if( obj == 0 ) then
set obj = UnitMsg.create()
set obj.u = u
call T003_Add(function UnitMsg.cycle, obj)
call SInteger( obj, GetHandleId(u), StringHash("UNIT_CHAT_MSG") )
endif
if( duree > 0 ) then
set obj.duree = duree
else
set obj.duree = DUREE_MOYENNE_MSG
endif
set obj.color = color
set obj.msg = msg
endfunction
function ColoredString takes integer nbvaleur, integer nbvaleurmax returns string
local string s = null
local integer red = 255
local integer green = 0
local string r = "ff"
local string g = "00"
local integer a = 0
local integer aMax = R2I((I2R(nbvaleur)*30.0)/I2R(nbvaleurmax))
loop
exitwhen a == aMax
if StringLength(r ) == 1 then
set r = "0"+r
endif
if StringLength(g ) == 1 then
set g = "0"+g
endif
set s = s+"|cff"+r+g+"00l|r"
if green == 255 then
set red = red - 17
set r = Int2Hexa(red)
else
set green = green + 17
set g = Int2Hexa(green)
endif
set a = a + 1
endloop
return s
endfunction
function Degrade takes string str, integer nbvaleur, integer nbvaleurmax, real taille returns string
local string s = null
local integer red = 255
local integer green = 0
local string r = "ff"
local string g = "00"
local integer a = 0
local integer aMax = R2I((I2R(nbvaleur)*taille)/I2R(nbvaleurmax))
local integer inc = R2I(255/(taille/2))
loop
exitwhen a == aMax
if StringLength(r) == 1 then
set r = "0"+r
endif
if StringLength(g) == 1 then
set g = "0"+g
endif
set s = s+"|cff"+r+g+"00"+SubString(str, a, a+1)+"|r"
if green == 255 then
set red = red - inc
set r = Int2Hexa(red)
else
set green = green + inc
if green > 255 then
set green = 255
endif
set g = Int2Hexa(green)
endif
set a = a + 1
endloop
return s
endfunction
function AjustValMana takes unit u, real val returns real
local real mana = GetUnitState( u, UNIT_STATE_MANA)
if( val > mana ) then
return mana
endif
return val
endfunction
function LifeCost takes unit u, real val returns boolean
local boolean b = GetUnitState( u, UNIT_STATE_LIFE )-val > GetUnitState( u, UNIT_STATE_MAX_LIFE )*0.08
if( b ) then
call AddLife( u, -val)
else
call IssueImmediateOrder( u, "stop")
endif
return b
endfunction
function ManaCost takes unit u, real val returns boolean
local boolean b = GetUnitState( u, UNIT_STATE_MANA )-val > 0.0
if( b ) then
call AddMana( u, -val)
endif
return b
endfunction
//========== Canalisation de Héros ===========//
function Canalisation_Actions takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
call GroupRemoveUnit(grpCanalisation, GetTriggerUnit())
call DestroyTrigger(t)
set t = null
endfunction
function Canalisation takes unit u returns nothing
local trigger t = CreateTrigger()
call GroupAddUnit( grpCanalisation, u)
call TriggerAddAction( t, function Canalisation_Actions )
call TriggerRegisterUnitEvent( t, u, EVENT_UNIT_SPELL_ENDCAST )
endfunction
function IsUnitCanalisation takes unit u returns boolean
return IsUnitInGroup(u, grpCanalisation)
endfunction
//========== Fonctions de groupe ===========//
function grp_UnitInGroupWithMinProperty takes nothing returns nothing
local unit u = GetEnumUnit()
if GetUnitState(u, grp_unitstate) < grp_float then
set grp_float = GetUnitState(u, grp_unitstate)
set grp_unit = GetEnumUnit()
endif
set u = null
endfunction
function grp_UnitInGroupWithMaxProperty takes nothing returns nothing
local unit u = GetEnumUnit()
if GetUnitState(u, grp_unitstate) > grp_float then
set grp_float = GetUnitState(u, grp_unitstate)
set grp_unit = GetEnumUnit()
endif
set u = null
endfunction
function UnitInGroupWithMinMaxProperty takes group g, unitstate us, boolean min returns unit
if g == null or FirstOfGroup(g) == null then
return null
endif
set grp_unitstate = us
set grp_float = GetUnitState( FirstOfGroup(g), us)
set grp_unit = FirstOfGroup(g)
if min then
call ForGroup(g, function grp_UnitInGroupWithMinProperty)
else
call ForGroup(g, function grp_UnitInGroupWithMaxProperty)
endif
return grp_unit
endfunction
function UnitInLocRange takes unit caster, real range returns unit
local location loc = Location(GetUnitX(caster), GetUnitY(caster))
local group g = GetUnitsInRangeOfLocMatching( range, loc, Condition(function Cond.Alive))
local unit u
loop
set u = GroupPickRandomUnit(g)
exitwhen u == null or IsUnitEnemy( u, GetOwningPlayer(caster) )
call GroupRemoveUnit(g,u)
endloop
call RemoveLocation(loc)
set loc = null
return u
endfunction
//===========================================================================
function InitTrig_libDivers takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=36
//TESH.alwaysfold=0
library libDamage needs loopObject, libCondition
globals
// Simplification pour les dommages
constant damagetype DAMAGE_PHYSICAL = DAMAGE_TYPE_FORCE
constant damagetype DAMAGE_MAGICAL = DAMAGE_TYPE_NORMAL
constant damagetype DAMAGE_ALL = DAMAGE_TYPE_UNIVERSAL
endglobals
function TxtFlo takes string value, unit u, real r, real v, real b returns nothing
local texttag tt = CreateTextTagUnitBJ( value, u, 0.0, 10.0, r, v, b, 0.0 )
call SetTextTagPermanent( tt, false )
call SetTextTagVelocityBJ( tt, 64, 90 )
call SetTextTagFadepoint( tt, 1.00 )
call SetTextTagLifespan( tt, 1.50 )
endfunction
function TxtFloDmg takes string value, unit u, damagetype dmgType returns nothing
if( dmgType != DAMAGE_MAGICAL or not IsUnitType(GetFilterUnit(), UNIT_TYPE_MAGIC_IMMUNE)) then
call TxtFlo(value, u, 20,20,90)
endif
endfunction
// Default function for doing damage, deals magical damage
// unit from: source of damage
// unit to: target of damage
// unit dmg: amount of damage
// boolean txt: display floating text for damage ?
function DmgToUnit takes unit from, unit to, real dmg, boolean txt returns nothing
if (txt) then
call TxtFloDmg( I2S(R2I(dmg)), to, DAMAGE_MAGICAL)
endif
call UnitDamageTarget( from, to, dmg, false, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
endfunction
// like previous function but add a parameter for damage type
// damagetype dmgType: type of the damage
function DmgToUnitType takes unit from, unit to, real dmg, boolean txt, damagetype dmgType returns nothing
if (txt) then
call TxtFloDmg( I2S(R2I(dmg)), to, DAMAGE_MAGICAL)
endif
call UnitDamageTarget( from, to, dmg, false, false, ATTACK_TYPE_NORMAL, dmgType, WEAPON_TYPE_WHOKNOWS)
endfunction
function DmgToUnitEffect takes unit from, unit to, real dmg, boolean txt, string path returns nothing
call DmgToUnit(from, to, dmg, txt)
if( not IsUnitImmun(GetFilterUnit()) ) then
call DestroyEffect(AddSpecialEffectTarget( path, to, "origin"))
endif
endfunction
function DmgToUnitTypeEffect takes unit from, unit to, real dmg, boolean txt, damagetype dmgType, string path returns nothing
call DmgToUnitType(from, to, dmg, txt, dmgType)
if( dmgType != DAMAGE_MAGICAL or not IsUnitImmun(GetFilterUnit()) ) then
call DestroyEffect(AddSpecialEffectTarget( path, to, "origin"))
endif
endfunction
function DmgToAreaTypeEffect takes location loc, unit u, real value, real dist, boolean txt, string path, damagetype dmgType returns nothing
local group g
local unit t
set g = GetUnitsInRangeOfLocMatching(dist, loc, Condition(function Cond.Alive) )
loop
set t = FirstOfGroup(g)
exitwhen t == null
call GroupRemoveUnit( g, t)
if( IsUnitEnemy( t, GetOwningPlayer(u) ) ) then
if( path == "") then
if( dmgType == null ) then
call DmgToUnit( u, t, value, txt)
else
call DmgToUnitType( u, t, value, txt, dmgType)
endif
else
if( dmgType == null ) then
call DmgToUnitEffect( u, t, value, txt, path)
else
call DmgToUnitTypeEffect( u, t, value, txt, dmgType, path)
endif
endif
endif
endloop
call DestroyGroup(g)
set g = null
endfunction
function DmgToAreaType takes location loc, unit u, real value, real dist, boolean txt, damagetype dmgType returns nothing
call DmgToAreaTypeEffect( loc, u, value, dist, txt, "", dmgType)
endfunction
function DmgToAreaEffect takes location loc, unit u, real value, real dist, boolean txt, string path returns nothing
call DmgToAreaTypeEffect( loc, u, value, dist, txt, path, null)
endfunction
function DmgToArea takes location loc, unit u, real value, real dist, boolean txt returns nothing
call DmgToAreaTypeEffect( loc, u, value, dist, txt, "", null)
endfunction
struct Dgts_Commun
private group targets
private real dmg
private unit caster
private boolean txt
method onDestroy takes nothing returns nothing
call DestroyGroup(.targets)
endmethod
static method init takes unit caster, real dmg, boolean txt returns Dgts_Commun
local Dgts_Commun dgts = Dgts_Commun.create()
local integer a = 0
set dgts.targets = CreateGroup()
set dgts.caster = caster
set dgts.dmg = dmg
set dgts.txt = txt
return dgts
endmethod
method DmgUnit takes unit target returns boolean
local integer a = 0
local boolean b = false
if( not IsUnitInGroup(target, this.targets) ) then
set b = true
call GroupAddUnit(.targets, target)
call DmgToUnit( .caster, target, .dmg, .txt)
endif
return b
endmethod
endstruct
globals
constant integer KEY_DOT = StringHash("dot")
endglobals
struct DmgOnDur
unit caster
unit target
real dmg
boolean txt
real duree
real interval
string id
static method cycle takes nothing returns nothing
local timer t = GetExpiredTimer()
local thistype this = LInteger( GetHandleId(t), KEY_DOT )
call DmgToUnit( .caster, .target, .dmg, .txt )
set .duree = .duree - .interval
if( .duree < 0.0 or IsUnitDeadBJ(.target) ) then
call Flush( GetHandleId(t))
call RInteger( GetHandleId(.target), SH("DmgOnDur_"+.id) )
call RHandle( GetHandleId(.target), SH("DmgOnDur_"+.id) )
call DestroyTimer(t)
call DmgOnDur.destroy(this)
endif
endmethod
endstruct
function Dot takes unit caster, unit target, real dmg, real interval, real duration, boolean txt, string s returns nothing
local DmgOnDur obj = LInteger( GetHandleId(target), KEY_OBJ )
local timer t
if( obj == 0 or s == "") then
set obj = DmgOnDur.create()
set t = CreateTimer()
// Stocke l'objet avec le timer
call SInteger( obj, GetHandleId(t), KEY_DOT )
// Stocke le timer avec l'unité
call STimer( t, GetHandleId(target), SH("DmgOnDur_"+s) ) // <- stocke l'identifiant du timer dans la cible
// Stocke l'objet avec l'unité
call SInteger( obj, GetHandleId(target), SH("DmgOnDur_Obj_"+s) )
else
// Récupère le timer lié à l'unité
set t = LTimer( GetHandleId(target), SH("DmgOnDur_"+s) )
endif
set obj.caster = caster
set obj.target = target
set obj.id = s
set obj.interval = interval
set obj.duree = duration
set obj.dmg = dmg
set obj.txt = txt
call TimerStart(t, interval, true, function DmgOnDur.cycle )
endfunction
//===========================================================================
function InitTrig_libDamage takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library libBuff needs loopObject
globals
timer tBuff = CreateTimer()
endglobals
struct Buff
unit target
boolean positive = true
integer abilCode = 0
real duree = 0. // 0 -> illimité
integer callBack = 0
static method cycle takes nothing returns boolean
local thistype this = T01_GetData()
set .duree = .duree - 0.1
if( .duree < 0 ) then
call RInteger( GetHandleId(.target), StringHash("Buff_"+I2S(.abilCode)) )
call UnitRemoveAbility( .target, .abilCode)
//if( .callBack != 0) then
// call TimerStart( tBuff, 0, false, I2Code(.callBack))
//endif
return true // enlever le buff de la boucle
endif
return false
endmethod
//method AddCallBack takes code c returns nothing
// set .callBack = Code2I(c)
//endmethod
static method AddBuff takes unit u, boolean positive, integer abilCode, real duree returns Buff
local Buff obj = 0
if( GetUnitAbilityLevel( u, abilCode) > 0 ) then
set obj = LInteger( GetHandleId(u), StringHash("Buff_"+I2S(abilCode)) )
set obj.duree = duree
else
set obj = Buff.create()
set obj.target = u
set obj.positive = positive
set obj.abilCode = abilCode
set obj.duree = duree
call SInteger( obj, GetHandleId(u), StringHash("Buff_"+I2S(abilCode)) )
call UnitAddAbility( u, abilCode)
if( duree > 0. ) then
call T01_Add(function Buff.cycle, obj)
endif
endif
return obj
endmethod
static method HasBuff takes unit u, integer abilCode returns boolean
return GetUnitAbilityLevel( u, abilCode) > 0
endmethod
endstruct
endlibrary
//===========================================================================
function InitTrig_libBuff takes nothing returns nothing
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function UnActifBonsuStats takes unit u returns nothing
if( GetPlayerState(GetOwningPlayer(u), PLAYER_STATE_RESOURCE_LUMBER) == 1 ) then
if( IsUnitInGroup(GetTriggerUnit(), udg_grpAdrenaline) ) then
call UnitRemoveAbility( u, BONUS_STATS_ACTIF_ADR )
call UnitAddAbility( u, BONUS_STATS_ADR )
else
call UnitRemoveAbility( u, BONUS_STATS_ACTIF )
call UnitAddAbility( u, BONUS_STATS )
endif
endif
endfunction
function upStr takes nothing returns nothing
call DestroyEffect( AddSpecialEffectTarget( "Abilities\\Spells\\Items\\AIsm\\AIsmTarget.mdl", GetTriggerUnit(), "origin") )
call SetHeroStr( GetTriggerUnit(), GetHeroStr(GetTriggerUnit(), false)+2, true )
call UnActifBonsuStats(GetTriggerUnit())
endfunction
function upAgi takes nothing returns nothing
call DestroyEffect( AddSpecialEffectTarget( "Abilities\\Spells\\Items\\AIam\\AIamTarget.mdl", GetTriggerUnit(), "origin") )
call SetHeroAgi( GetTriggerUnit(), GetHeroAgi(GetTriggerUnit(), false)+2, true )
call UnActifBonsuStats(GetTriggerUnit())
endfunction
function upInt takes nothing returns nothing
call DestroyEffect( AddSpecialEffectTarget( "Abilities\\Spells\\Items\\AIim\\AIimTarget.mdl", GetTriggerUnit(), "origin") )
call SetHeroInt( GetTriggerUnit(), GetHeroInt(GetTriggerUnit(), false)+2, true )
call UnActifBonsuStats(GetTriggerUnit())
endfunction
//===========================================================================
function InitTrig_Bonus_Carac takes nothing returns nothing
endfunction
//TESH.scrollpos=6
//TESH.alwaysfold=0
library CreerHero needs libCameraView, libSpellEffect
globals
constant integer HERO_ADR1 = 'O004'
constant integer HERO_ANCIEN = 'N007'
constant integer BONUS_STATS = 'A015'
constant integer BONUS_STATS_ACTIF = 'A06T'
constant integer BONUS_STATS_ADR = 'A07E'
constant integer BONUS_STATS_ACTIF_ADR = 'A07D'
endglobals
function Creer_Hero takes integer Tunite, player p, integer ico returns nothing
local integer pi = GetConvertedPlayerId(p)
local location loc = GetRectCenter(udg_Pos_central[pi])
set udg_DmgUnit[pi-1] = CreateUnit( p, 'h01V', X_DUMMY, Y_DUMMY, 0)
set dropEnable[pi] = true
call RemoveUnit( udg_Hero[pi])
set udg_Hero[pi] = CreateUnitAtLoc( p, Tunite, loc, (90.00 + (36.00 * I2R(pi))) )
call PanCameraToTimedLocForPlayer( p, loc, 0.00 )
call DestroyEffect( AddSpecialEffectTarget( "Abilities\\Spells\\Human\\ReviveHuman\\ReviveHuman.mdl", udg_Hero[pi], "origin") )
call MultiboardSetItemStyleBJ( GetLastCreatedMultiboard(), 1, udg_Ligne_Multiboard[pi], true, true )
call MultiboardSetItemIconBJ( GetLastCreatedMultiboard(), 1, udg_Ligne_Multiboard[pi], udg_Carac_Icone[ico] )
set udg_Nb_Joueur_Arene = udg_Nb_Joueur_Arene + 1
call GroupAddUnit( udg_Heros, udg_Hero[pi] )
call GroupAddUnit( udg_Heros_vivant, udg_Hero[pi] )
//call Apply2ndPersonView( p, udg_Hero[pi] )
call RemoveLocation(loc)
//call SetHeroLevel( udg_Hero[pi], 3, false )
call MultiboardMinimize( GetLastCreatedMultiboard(), false )
call SetPlayerState( p, PLAYER_STATE_RESOURCE_GOLD, 150 )
call DisplayTextToForce( bj_FORCE_PLAYER[0], "|cff3399ff"+GetPlayerName(p)+"|r chooses the |cff66ff00"+GetUnitName(udg_Hero[pi])+"|r" )
call TriggerRegisterUnitEvent( gg_trg_Barre_de_vie, udg_Hero[pi], EVENT_UNIT_DAMAGED )
call TriggerRegisterUnitEvent( gg_trg_Bonus_Pierre_de_mana, udg_Hero[pi], EVENT_UNIT_HERO_LEVEL )
call TriggerRegisterUnitEvent( udg_trg_PrendObjet, udg_Hero[pi], EVENT_UNIT_PICKUP_ITEM )
if( udg_Carac_Glow[ico] ) then
call AddSpecialEffectTarget( "Aura.mdl", udg_Hero[pi], "origin" )
call SetUnitColor( udg_Hero[pi], GetPlayerColor(p) )
endif
if( Tunite == HERO_ADR1 ) then
call Init_Adrenaline(udg_Hero[pi])
call UnitAddAbility( udg_Hero[pi], BONUS_STATS_ADR )
else
if Tunite != HERO_ANCIEN then
call UnitAddAbility( udg_Hero[pi], BONUS_STATS )
endif
endif
endfunction
//===========================================================================
function InitTrig_Creer_Hero takes nothing returns nothing
endfunction
endlibrary
globals
trigger array tmsg_predef
endglobals
function Trig_Msg_Predef_Actions takes nothing returns nothing
local integer a = 0
call DialogClearBJ( udg_Msg_Dlg[GetPlayerId(GetTriggerPlayer())] )
loop
exitwhen a > 7
call DialogAddButtonBJ( udg_Msg_Dlg[GetPlayerId(GetTriggerPlayer())], udg_Str_Msg_Predef[a] )
set udg_Btn_Msg_Predef[GetPlayerId(GetTriggerPlayer()) * 10 + a] = GetLastCreatedButtonBJ()
set a = a + 1
endloop
call DialogSetMessageBJ( udg_Msg_Dlg[GetPlayerId(GetTriggerPlayer())], "TRIGSTR_2920" )
call DialogDisplayBJ( true, udg_Msg_Dlg[GetPlayerId(GetTriggerPlayer())], GetTriggerPlayer() )
endfunction
//===========================================================================
function InitTrig_Msg_Predef takes nothing returns nothing
endfunction
function Trig_Msg_Predef_Dlg_Actions takes nothing returns nothing
local integer a = 0
loop
exitwhen a > 6
if ( GetClickedButtonBJ() == udg_Btn_Msg_Predef[GetPlayerId(GetTriggerPlayer()) * 10 + a] ) then
call DisplayUnitMsg( udg_Hero[GetPlayerId(GetTriggerPlayer())+1], udg_Str_Msg_Predef[a], COLOUR_ORANGE, -1 )
return
else
endif
set a = a + 1
endloop
endfunction
//===========================================================================
function InitTrig_Msg_Predef_Dlg takes nothing returns nothing
set gg_trg_Msg_Predef_Dlg = CreateTrigger( )
call TriggerAddAction( gg_trg_Msg_Predef_Dlg, function Trig_Msg_Predef_Dlg_Actions )
endfunction
//TESH.scrollpos=3
//TESH.alwaysfold=0
library libBoss needs libSpellEffect
function GetChanelingHeroInRange takes unit boss, real range returns group
local group g1 = CreateGroup()
local group g2 = CreateGroup()
local unit u = null
call GroupAddGroup(grpCanalisation, g1)
loop
set u = FirstOfGroup(g1)
exitwhen u == null
call GroupRemoveUnit(g1, u)
if not (DistanceBetweenPointsEx( GetUnitX(boss), GetUnitY(boss), GetUnitX(u), GetUnitY(u)) > range) then
call GroupAddUnit(g2, u)
endif
endloop
call DestroyGroup(g1)
if FirstOfGroup(g2) == null then
call DestroyGroup(g2)
return null
endif
return g2
endfunction
function GetUnitsOfTypeIdOfPlayer takes integer unitid, player p returns group
local group g = CreateGroup()
set bj_groupEnumTypeId = unitid
call GroupClear(g)
call GroupEnumUnitsOfPlayer(g, p, And(filterGetUnitsOfTypeIdAll, Condition( function Cond.Alive) ))
return g
endfunction
endlibrary
//===========================================================================
function InitTrig_Fonctions_boss takes nothing returns nothing
endfunction
//TESH.scrollpos=55
//TESH.alwaysfold=0
library BossAraigneeNoire needs libVagueBoss, libBoss
globals
constant integer ID_SPELL_WEB = 'A02M'
constant integer ID_OEUF = 'nspg'//'h00X'
constant integer KB_ARAIGNEE_NOIRE = StringHash("boss_araigneenoire")
endglobals
struct AraigneeNoire extends Boss
integer idBoss = 'nspb'
timer tWeb = CreateTimer()
timer tOeuf = CreateTimer()
timer tPiege = CreateTimer()
static method cyclePiegeRets takes nothing returns nothing
local AraigneeNoire obj = LInteger( GetHandleId(GetExpiredTimer()), KB_ARAIGNEE_NOIRE)
local location loc = GetRandomLoc( GetUnitX(obj.boss), GetUnitY(obj.boss), 550 )
call b10PiegeRets( obj.boss, GetLocationX(loc), GetLocationY(loc))
call RemoveLocation(loc)
endmethod
method Web takes nothing returns nothing
local group g = GetUnitsInRectAll(gg_rct_Arene)
local unit u = null
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit( g, u)
if( IsUnitEnemy( u, GetOwningPlayer(this.boss)) ) then
call IssueTargetOrder( this.boss, "entanglingroots", FirstOfGroup(g) )
endif
endloop
call DestroyGroup(g)
endmethod
method Oeuf takes nothing returns nothing
local real angle = GetRandomReal( 0, 2*bj_PI )
local real x = GetUnitX(this.boss) + 220 * Cos(angle)
local real y = GetUnitY(this.boss) + 220 * Sin(angle)
if CountUnitsInGroup(GetUnitsOfTypeIdOfPlayer(ID_OEUF,Player(11))) < (udg_Nb_Porte*4+1) then
call UnitAddType( CreateUnit( Player(11), ID_OEUF, x, y, angle ), UNIT_TYPE_SUMMONED )
endif
endmethod
static method cycleWeb takes nothing returns nothing
local AraigneeNoire obj = LInteger( GetHandleId(GetExpiredTimer()), KB_ARAIGNEE_NOIRE )
call obj.Web()
endmethod
static method cycleOeuf takes nothing returns nothing
local AraigneeNoire obj = LInteger( GetHandleId(GetExpiredTimer()), KB_ARAIGNEE_NOIRE )
call obj.Oeuf()
endmethod
static method Mort takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local AraigneeNoire obj = LInteger( GetHandleId(t), KB_ARAIGNEE_NOIRE )
//local location loc = GetUnitLoc( obj.boss )
//local group g = GetUnitsInRangeOfLocAll( 1500, loc )
//local unit u = null
//call RemoveLocation(loc)
//set loc = null
//loop
//set u = FirstOfGroup(g)
//exitwhen u == null
//call GroupRemoveUnit(g,u)
//if( IsUnitAlly( u, GetOwningPlayer(obj.boss)) ) then
//call ExplodeUnitBJ(u)
// endif
//endloop
call RInteger( GetHandleId(obj.tWeb), KB_ARAIGNEE_NOIRE )
call RInteger( GetHandleId(obj.tOeuf), KB_ARAIGNEE_NOIRE )
call RInteger( GetHandleId(t), KB_ARAIGNEE_NOIRE )
call RInteger( GetHandleId(obj.tPiege), KB_ARAIGNEE_NOIRE )
call DestroyTimer( obj.tPiege)
call DestroyTrigger(t)
call DestroyTimer(obj.tWeb)
call DestroyTimer(obj.tOeuf)
call AraigneeNoire.destroy(obj)
endmethod
method init takes integer i returns unit
local trigger t = CreateTrigger()
set this.boss = CreateUnit( Player(11), .idBoss, 0, 0, 0.0 )
if( udg_Nb_Joueur < 2 ) then
call UnitRemoveAbility( this.boss, ID_SPELL_WEB )
call SetUnitState( this.boss, UNIT_STATE_MANA, GetUnitState( this.boss, UNIT_STATE_MAX_MANA)/2 )
endif
call SInteger( this, GetHandleId(this.tWeb), KB_ARAIGNEE_NOIRE)
call SInteger( this, GetHandleId(this.tOeuf), KB_ARAIGNEE_NOIRE)
call SInteger( this, GetHandleId(t), KB_ARAIGNEE_NOIRE)
call SInteger( this, GetHandleId(this.tPiege), KB_ARAIGNEE_NOIRE)
call TimerStart( this.tPiege, 11.0, true, function AraigneeNoire.cyclePiegeRets )
call TimerStart( this.tOeuf, 6.0, true, function AraigneeNoire.cycleOeuf )
call TriggerAddAction( t, function AraigneeNoire.Mort )
call TriggerRegisterUnitEvent( t, this.boss, EVENT_UNIT_DEATH )
return this.boss
endmethod
endstruct
//===========================================================================
function InitTrig_B1_AraigneeNoire takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=43
//TESH.alwaysfold=0
library BossSeigneurOgre needs libVagueBoss
globals
constant string EFFECT_GNOLL_LANCER = "units\\creeps\\Gnoll\\Gnoll.mdl"
constant integer ID_CATAPULTE = 'ocat'
constant integer KB_SEIGNEUR_OGRE = StringHash("boss__seigneurogre")
endglobals
struct SeigneurOgre extends Boss
integer idBoss = 'nogl'
trigger tAttacked = CreateTrigger()
unit cata
effect e
static method triggerAttacked takes nothing returns nothing
local SeigneurOgre obj = LInteger( GetHandleId(GetTriggeringTrigger()), KB_SEIGNEUR_OGRE )
if GetRandomInt(0,4) == 1 then
call IssueTargetOrder( obj.boss, "shockwave", GetAttacker() )
elseif GetRandomInt(0,4) == 1 then
call IssuePointOrder( obj.boss, "tornado", GetUnitX(GetAttacker()), GetUnitY(GetAttacker()) )
elseif GetRandomInt(0,3) == 1 then
call IssuePointOrder( obj.boss, "ward", GetUnitX(obj.boss)+100 * Cos(GetRandomReal(0, bj_PI*2)), GetUnitY(obj.boss)+100 * Sin(GetRandomReal(0, bj_PI*2)) )
endif
endmethod
static method Mort takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local SeigneurOgre obj = LInteger( GetHandleId(t), KB_SEIGNEUR_OGRE )
if( GetUnitState(obj.cata, UNIT_STATE_LIFE) > 0 ) then
call KillUnit(obj.cata)
endif
call Flush( GetHandleId(obj.tAttacked))
call Flush( GetHandleId(t))
call DestroyTrigger(obj.tAttacked)
call DestroyTrigger(t)
call SeigneurOgre.destroy(obj)
set t = null
endmethod
method init takes integer i returns unit
local trigger t = CreateTrigger()
set this.boss = CreateUnit( Player(11), .idBoss, 0, 0, 0.0 )
set udg_loc = GetRectCenter( udg_Reg_Coin[i] )
set this.cata = CreateUnit( Player(11), ID_CATAPULTE, GetLocationX(udg_loc), GetLocationY(udg_loc), 0.0 )
call IssueImmediateOrder(this.cata, "holdposition")
call SInteger( this, GetHandleId(this.tAttacked), KB_SEIGNEUR_OGRE)
call TriggerAddAction( this.tAttacked , function SeigneurOgre.triggerAttacked )
call TriggerRegisterUnitEvent( this.tAttacked , this.boss, EVENT_UNIT_ATTACKED )
call SInteger( this, GetHandleId(t), KB_SEIGNEUR_OGRE)
call TriggerAddAction( t, function SeigneurOgre.Mort )
call TriggerRegisterUnitEvent( t, this.boss, EVENT_UNIT_DEATH )
return this.boss
endmethod
endstruct
//===========================================================================
function InitTrig_B2_Seigneur_Ogre takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=19
//TESH.alwaysfold=0
library BossGolemGranit needs libVagueBoss
globals
constant integer UNIT_DEGATS_ROCHER = 'h011'
constant integer KB_GOLEM_GRANIT = StringHash("boss__golemgranit")
endglobals
struct Rocher extends Spell
location loc
unit dummy
static method cycle takes nothing returns boolean
local thistype this = T15_GetData()
call Effect( "Doodads\\Cinematic\\CavernDust\\CavernDust.mdl", GetLocationX(this.loc), GetLocationY(this.loc), 2.3 )
if( GetUnitState( this.caster, UNIT_STATE_LIFE ) <= 0 ) then
call RemoveLocation(this.loc)
call RemoveUnit(this.dummy )
call Rocher.destroy(this)
return true
endif
return false
endmethod
endstruct
type TabRocher extends Rocher array [6]
struct GolemGranit extends Boss
integer idBoss = 'nggr'
TabRocher tRocher
timer tStomp = CreateTimer()
trigger tAssom = CreateTrigger()
static method cycleStomp takes nothing returns nothing
local GolemGranit obj = LInteger( GetHandleId(GetExpiredTimer()), KB_GOLEM_GRANIT )
local location loc = GetUnitLoc( obj.boss )
local group g = GetUnitsInRangeOfLocAll( 320, loc )
local integer a = 0
local unit u = null
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit(g, u)
if( IsUnitEnemy( u, GetOwningPlayer(obj.boss)) ) then
set a = a + 1
endif
endloop
if( a > 1 ) then
call IssueImmediateOrder( obj.boss, "stomp")
endif
call DestroyGroup(g)
call RemoveLocation(loc)
endmethod
static method triggerAssom takes nothing returns nothing
local GolemGranit obj = LInteger( GetHandleId(GetTriggeringTrigger()), KB_GOLEM_GRANIT )
if( DistanceBetweenPointsEx( GetUnitX(obj.boss), GetUnitY(obj.boss), GetUnitX(GetAttacker()), GetUnitY(GetAttacker())) < 220.0 ) then
call IssueTargetOrder( obj.boss, "thunderbolt", GetAttacker() )
endif
endmethod
static method Mort takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local GolemGranit obj = LInteger( GetHandleId(t), KB_GOLEM_GRANIT )
call Flush( GetHandleId(obj.tStomp))
call Flush( GetHandleId(obj.tAssom))
call DestroyTimer(obj.tStomp)
call DestroyTrigger(obj.tAssom)
call Flush( GetHandleId(t))
call DestroyTrigger(t)
call TabRocher.destroy(obj.tRocher)
call GolemGranit.destroy(obj)
set t = null
endmethod
method init takes integer i returns unit
local Rocher obj
local trigger t = CreateTrigger()
local location loc
local integer a = 0
local unit u
set this.boss = CreateUnit( Player(11), .idBoss, 0, 0, 0.0 )
set this.tRocher = TabRocher.create()
call SInteger( this, GetHandleId(this.tStomp), KB_GOLEM_GRANIT)
call TimerStart( this.tStomp, 13.0, true, function GolemGranit.cycleStomp )
call SInteger( this, GetHandleId(this.tAssom ), KB_GOLEM_GRANIT)
call TriggerAddAction( this.tAssom , function GolemGranit.triggerAssom )
call TriggerRegisterUnitEvent( this.tAssom , this.boss, EVENT_UNIT_ATTACKED )
loop
exitwhen a == 7
set loc = GetRandomLoc( CX_ARENE, CY_ARENE, 1700 )
set obj = Rocher.create()
set this.tRocher[a] = obj
set u = CreateUnitAtLoc( Player(11), UNIT_DEGATS_ROCHER, loc, 0.0 )
call IssuePointOrder( u, "attackground", GetLocationX(loc)+20, GetLocationY(loc)+20 )
set obj.loc = loc
set obj.dummy = u
set obj.caster = this.boss
call T15_Add(function Rocher.cycle, obj)
set a = a + 1
endloop
call SInteger( this, GetHandleId(t), KB_GOLEM_GRANIT)
call TriggerAddAction( t, function GolemGranit.Mort )
call TriggerRegisterUnitEvent( t, this.boss, EVENT_UNIT_DEATH )
return this.boss
endmethod
endstruct
//===========================================================================
function InitTrig_B3_GolemGranit takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=51
//TESH.alwaysfold=0
library BossUrsaFurbolg needs libVagueBoss
globals
constant integer SORT_CHARGE_FURBOLG = 'A03N'
constant integer KB_URSA_FURBOLG = StringHash("boss__ursafurbolg")
constant integer KB_UF_CHUTE_ARBRE = StringHash("boss_ufchutearbre")
endglobals
struct Chute_Arbre extends Spell
location loc
destructable dest
timer tChute = CreateTimer()
real angle = GetRandomReal(0,2*bj_PI)
real dist = 0.0
group cibles = CreateGroup()
static method cycle takes nothing returns boolean
local thistype this = T025_GetData()
local real x = GetLocationX(this.loc) + this.dist * Cos(this.angle)
local real y = GetLocationY(this.loc) + this.dist * Sin(this.angle)
local location loc = Location(x,y)
local group g = null
local unit u = null
set Cond.condUnite = this.caster
set g = GetUnitsInRangeOfLocMatching( 180, loc, Condition(function Cond.EnnemiVar) )
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit(g,u)
if( not IsUnitInGroup(u, this.cibles) ) then
call GroupAddUnit(this.cibles,u)
call DmgToUnit( this.caster, u, this.dmg, true)
call SEffect_Bash( u, 2.0)
endif
endloop
call DestroyEffect( AddSpecialEffect( EFFET_POUSSIERE, x, y) )
call DestroyGroup(g)
set g = null
call RemoveLocation(loc)
set loc = null
set this.dist = this.dist + 62
if( this.dist > 400 ) then
call DestroyGroup(this.cibles)
call RemoveDestructable( this.dest )
call RemoveLocation( this.loc)
call Chute_Arbre.destroy(this)
return true
endif
return false
endmethod
static method cycleChute takes nothing returns nothing
local timer t = GetExpiredTimer()
local Chute_Arbre obj = LInteger( GetHandleId(t), KB_UF_CHUTE_ARBRE)
if( GetDestructableLife(obj.dest) > 0.0 ) then
call KillDestructable(obj.dest)
call T025_Add(function Chute_Arbre.cycle, obj)
else
call RemoveDestructable(obj.dest)
endif
call DestroyTimer(t)
set t = null
endmethod
method init takes nothing returns nothing
local location loc = GetRandomLoc( GetUnitX(this.caster), GetUnitY(this.caster), 700 )
set this.dest = CreateDestructable( 'ATtr', GetLocationX(loc), GetLocationY(loc), Rad2Deg(this.angle)+150.0, 2.2, 2)
set this.loc = loc
call SetDestructableAnimation( this.dest, "birth")
call SetDestructableAnimationSpeed( this.dest, 0.6 )
call SInteger( this, GetHandleId(this.tChute), KB_UF_CHUTE_ARBRE )
call TimerStart( this.tChute, 5.5, true, function Chute_Arbre.cycleChute )
endmethod
endstruct
struct UrsaFurbolg extends Boss
integer idBoss = 'nfra'
timer tCharge = CreateTimer()
timer tArbre = CreateTimer()
static method Mort takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local UrsaFurbolg obj = LInteger( GetHandleId(t), KB_URSA_FURBOLG )
call Flush( GetHandleId(obj.tCharge))
call Flush( GetHandleId(obj.tArbre))
call Flush( GetHandleId(t))
call DestroyTimer(obj.tCharge)
call DestroyTimer(obj.tArbre)
call DestroyTrigger(t)
call UrsaFurbolg.destroy(obj)
set t = null
endmethod
static method cycleArbre takes nothing returns nothing
local UrsaFurbolg obj = LInteger( GetHandleId(GetExpiredTimer()), KB_URSA_FURBOLG )
local Chute_Arbre arbre = Chute_Arbre.create()
set arbre.caster = obj.boss
set arbre.dmg = 200.0
call arbre.init()
endmethod
static method cycleCharge takes nothing returns nothing
local UrsaFurbolg obj = LInteger( GetHandleId(GetExpiredTimer()), KB_URSA_FURBOLG )
local unit u
local location loc = GetUnitLoc(obj.boss)
local group g = GetUnitsInRangeOfLocMatching( 350, loc, Condition(function Cond.Alive))
local group g2 = GetUnitsInRangeOfLocMatching( 650, loc, Condition(function Cond.Alive))
call GroupRemoveGroup( g, g2 )
call DestroyGroup(g)
call RemoveLocation(loc)
set loc = null
set g = null
loop
set u = FirstOfGroup(g2)
exitwhen u == null or IsUnitEnemy( u, GetOwningPlayer(obj.boss) )
call GroupRemoveUnit(g2,u)
endloop
call DestroyGroup(g2)
set g2 = null
if( u != null ) then
call IssueTargetOrder( obj.boss, "thunderbolt", u )
endif
endmethod
method init takes integer i returns unit
local trigger t = CreateTrigger()
set this.boss = CreateUnit( Player(11), .idBoss, 0, 0, 0.0 )
call SInteger( this, GetHandleId(this.tCharge), KB_URSA_FURBOLG )
call TimerStart( this.tCharge, 10.0, true, function UrsaFurbolg.cycleCharge )
call SInteger( this, GetHandleId(this.tArbre), KB_URSA_FURBOLG )
call TimerStart( this.tArbre, 5.0, true, function UrsaFurbolg.cycleArbre )
call SetUnitAbilityLevel( this.boss, SORT_CHARGE_FURBOLG, 3 )
call SInteger( this, GetHandleId(t), KB_URSA_FURBOLG )
call TriggerAddAction( t, function UrsaFurbolg.Mort )
call TriggerRegisterUnitEvent( t, this.boss, EVENT_UNIT_DEATH )
return this.boss
endmethod
endstruct
//===========================================================================
function InitTrig_B4_UrsaFurbolg takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=95
//TESH.alwaysfold=0
library BossWyrmTempete needs libVagueBoss
globals
constant string EFFECT_CIBLE_FOUDRE = "Abilities\\Spells\\Human\\FlameStrike\\FlameStrikeTarget.mdl"
constant integer FAUCON_INDOMPTABLE = 'nwe3'
constant integer NID_FAUCON_INDOMPTABLE = 'nhns'
constant integer KB_WYRM_TEMPETE = StringHash("boss__wyrmtempete")
endglobals
struct Foudre_Wyrm extends Spell
location loc
effect e
static method cycleFoudre takes nothing returns nothing
local timer t = GetExpiredTimer()
local Foudre_Wyrm obj = LInteger( GetHandleId(t), KB_WYRM_TEMPETE )
call DestroyEffect(obj.e)
call SEffect_Foudre( obj.caster, GetLocationX(obj.loc), GetLocationY(obj.loc), GetRandomReal(240, 280), 180 )
call DestroyTimer(t)
call Foudre_Wyrm.destroy(obj)
endmethod
method cycle takes nothing returns boolean
return false
endmethod
endstruct
struct WyrmTempete extends Boss
integer idBoss = 'nstw'
timer tFoudre = CreateTimer() // Foudre
timer tFaucon = CreateTimer() // Invocation des faucons
timer tSpirale = CreateTimer() // Sort spirale de foudre
unit nid = null
static method cycleSpirale takes nothing returns nothing
local WyrmTempete obj = LInteger( GetHandleId(GetExpiredTimer()), KB_WYRM_TEMPETE )
call bWyrm_SpiraleFoudre(obj.boss)
endmethod
static method cycleFaucon takes nothing returns nothing
local WyrmTempete obj = LInteger( GetHandleId(GetExpiredTimer()), KB_WYRM_TEMPETE )
local unit u = null
local integer nbFaucon
if( GetUnitState(obj.nid, UNIT_STATE_LIFE) <= 0 ) then
call PauseTimer(GetExpiredTimer())
return
endif
if CountUnitsInGroup(GetUnitsOfTypeIdOfPlayer(ID_OEUF,Player(11))) < (udg_Nb_Porte*4+1) then
set u = CreateUnit( Player(11), FAUCON_INDOMPTABLE, GetUnitX(obj.nid), GetUnitY(obj.nid) , 270.0 )
call UnitAddType( u, UNIT_TYPE_SUMMONED )
call RemoveGuardPosition(u)
call IssuePointOrder( u, "attack", GetUnitX(obj.boss), GetUnitY(obj.boss) )
endif
endmethod
static method Mort takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local WyrmTempete obj = LInteger( GetHandleId(t), KB_WYRM_TEMPETE )
if( GetUnitState(obj.nid, UNIT_STATE_LIFE) > 0 ) then
call KillUnit(obj.nid)
endif
call Flush( GetHandleId(obj.tFaucon))
call Flush( GetHandleId(obj.tFoudre))
call Flush( GetHandleId(obj.tSpirale))
call Flush( GetHandleId(t))
call DestroyTimer(obj.tFoudre)
call DestroyTimer(obj.tSpirale)
call DestroyTimer(obj.tFaucon)
call DestroyTrigger(t)
call WyrmTempete.destroy(obj)
set t = null
endmethod
static method cycleFoudre takes nothing returns nothing
local WyrmTempete boss = LInteger( GetHandleId(GetExpiredTimer()), KB_WYRM_TEMPETE )
local Foudre_Wyrm obj = Foudre_Wyrm.create()
local location loc = GetRandomLoc( GetUnitX(boss.boss), GetUnitY(boss.boss), 450)
local timer t = CreateTimer()
set obj.loc = loc
set obj.e = AddSpecialEffect( EFFECT_CIBLE_FOUDRE, GetLocationX(loc), GetLocationY(loc) )
set obj.caster = boss.boss
call SInteger( obj, GetHandleId(t), KB_WYRM_TEMPETE)
call TimerStart( t, 3.0, false, function Foudre_Wyrm.cycleFoudre )
endmethod
method init takes integer i returns unit
local trigger t = CreateTrigger()
local location loc = GetRectCenter( udg_Reg_Coin[i] )
set this.boss = CreateUnit( Player(11), .idBoss, 0, 0, 0.0 )
set this.nid = CreateUnit( Player(11), NID_FAUCON_INDOMPTABLE, GetLocationX(loc), GetLocationY(loc), GetRandomReal(0,2*bj_PI) )
call SInteger( this, GetHandleId(this.tFaucon), KB_WYRM_TEMPETE )
call TimerStart( this.tFaucon, 10.0, true, function WyrmTempete.cycleFaucon )
call SInteger( this, GetHandleId(this.tFoudre), KB_WYRM_TEMPETE )
call TimerStart( this.tFoudre, 2.5+udg_Nb_Porte*0.6, true, function WyrmTempete.cycleFoudre )
//call SInteger( GetHandleId(this.tSpirale)), "Wyrm Tempete", this )
//call TimerStart( this.tSpirale, 12.0, true, function WyrmTempete.cycleSpirale )
call SInteger( this, GetHandleId(t), KB_WYRM_TEMPETE )
call TriggerAddAction( t, function WyrmTempete.Mort )
call TriggerRegisterUnitEvent( t, this.boss, EVENT_UNIT_DEATH )
call RemoveLocation(loc)
return this.boss
endmethod
endstruct
//===========================================================================
function InitTrig_B5_WyrmTempete takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=79
//TESH.alwaysfold=0
library BossSeigneurArach needs libVagueBoss
globals
constant integer UNIT_SCARABE = 'n00K'
constant integer KB_SEIGNEUR_ARACH = StringHash("boss__seigneurarach")
endglobals
struct SeigneurArach extends Boss
integer idBoss = 'nano'
trigger tEnfoui = CreateTrigger()
trigger tBlizzard = CreateTrigger()
timer tScarab
timer tPoison = CreateTimer()
timer tTeleport = CreateTimer()
integer flagTeleport = 0
boolean flag = true
real dureeScarab
static method cycleTeleport takes nothing returns nothing
local timer t = GetExpiredTimer()
local SeigneurArach obj = LInteger( GetHandleId(t), KB_SEIGNEUR_ARACH )
local unit u = null
if obj.flagTeleport == 0 then
set obj.flagTeleport = 1
call UnitAddAbility( obj.boss, 'Abu5')
call IssueImmediateOrder( obj.boss, "burrow")
call TimerStart( obj.tTeleport, 2.50, false, function SeigneurArach.cycleTeleport)
elseif obj.flagTeleport == 1 then
set obj.flagTeleport = 2
set u = UnitInGroupWithMinMaxProperty(udg_Heros_vivant, UNIT_STATE_LIFE, true)
call SetUnitX( obj.boss, GetUnitX(u))
call SetUnitY( obj.boss, GetUnitY(u))
call IssueImmediateOrder( obj.boss, "unburrow")
call TimerStart( obj.tTeleport, 2.50, false, function SeigneurArach.cycleTeleport)
set u = null
else
set obj.flagTeleport = 0
call UnitRemoveAbility(obj.boss, 'Abu5')
call TimerStart( obj.tTeleport, GetRandomReal(6.0, 12.0), false, function SeigneurArach.cycleTeleport)
endif
endmethod
static method cycleScarab takes nothing returns nothing
local timer t = GetExpiredTimer()
local SeigneurArach obj = LInteger( GetHandleId(t), KB_SEIGNEUR_ARACH )
local unit u
local integer a = 0
local location loc
if( obj.dureeScarab < 0.0 ) then
call Flush( GetHandleId(t))
call DestroyTimer(t)
endif
loop
exitwhen a > 0
set loc = GetRandomLoc( GetUnitX(obj.boss), GetUnitY(obj.boss), 500 )
set u = CreateUnitAtLoc( GetOwningPlayer(obj.boss), UNIT_SCARABE,loc, GetRandomReal(0,360.0) )
call UnitAddType( u, UNIT_TYPE_SUMMONED )
call IssueImmediateOrder( u, "unburrow" )
call RemoveLocation(loc)
set a = a + 1
endloop
set obj.dureeScarab = obj.dureeScarab - 1.0
set loc = null
endmethod
static method triggerBlizzard takes nothing returns nothing
local SeigneurArach obj = LInteger( GetHandleId(GetTriggeringTrigger()), KB_SEIGNEUR_ARACH )
call IssueTargetOrder( obj.boss, "shockwave", GetAttacker() )
endmethod
static method cyclePoison takes nothing returns nothing
local SeigneurArach obj = LInteger( GetHandleId(GetExpiredTimer()), KB_SEIGNEUR_ARACH)
call IssueTargetOrder( obj.boss, "shadowstrike", UnitInGroupWithMinMaxProperty(udg_Heros_vivant, UNIT_STATE_LIFE, false) )
endmethod
static method Enfouissement takes nothing returns nothing
local SeigneurArach obj = LInteger( GetHandleId(GetTriggeringTrigger()), KB_SEIGNEUR_ARACH)
call DestroyTrigger(obj.tEnfoui)
set obj.dureeScarab = 9.0
set obj.tScarab = CreateTimer()
call SInteger( obj, GetHandleId(obj.tScarab), KB_SEIGNEUR_ARACH )
call TimerStart( obj.tScarab, 1.0, true, function SeigneurArach.cycleScarab )
if( obj.flag ) then
set obj.flag = false
set obj.tEnfoui = CreateTrigger()
call Flush( GetHandleId(obj.tEnfoui))
call SInteger( obj, GetHandleId(obj.tEnfoui), KB_SEIGNEUR_ARACH )
call TriggerAddAction( obj.tEnfoui , function SeigneurArach.Enfouissement )
call TriggerRegisterUnitStateEvent( obj.tEnfoui, obj.boss, UNIT_STATE_LIFE, LESS_THAN, GetUnitState(obj.boss, UNIT_STATE_MAX_LIFE)*0.33 )
endif
endmethod
static method Mort takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local SeigneurArach obj = LInteger( GetHandleId(t), KB_SEIGNEUR_ARACH )
call Flush( GetHandleId(obj.tPoison))
call Flush( GetHandleId(obj.tEnfoui))
call Flush( GetHandleId(obj.tBlizzard))
call Flush( GetHandleId(obj.tTeleport))
call Flush( GetHandleId(t))
call DestroyTimer(obj.tPoison)
call DestroyTimer(obj.tTeleport)
call DestroyTrigger(obj.tBlizzard)
call DestroyTrigger(obj.tEnfoui)
call DestroyTrigger(t)
call SeigneurArach.destroy(obj)
set t = null
endmethod
method init takes integer i returns unit
local trigger t = CreateTrigger()
set this.boss = CreateUnit( Player(11), .idBoss, 0, 0, 0.0 )
call UnitRemoveAbility(.boss, 'Abu5')
call SInteger( this, GetHandleId(this.tPoison), KB_SEIGNEUR_ARACH )
call TimerStart( this.tPoison, 10.0, true, function SeigneurArach.cyclePoison )
call SInteger( this, GetHandleId(this.tTeleport), KB_SEIGNEUR_ARACH )
call TimerStart( this.tTeleport, GetRandomReal(4.0, 22.0), false, function SeigneurArach.cycleTeleport )
call SInteger( this, GetHandleId(this.tEnfoui ), KB_SEIGNEUR_ARACH )
call TriggerAddAction( this.tEnfoui , function SeigneurArach.Enfouissement )
call TriggerRegisterUnitStateEvent( this.tEnfoui, this.boss, UNIT_STATE_LIFE, LESS_THAN, GetUnitState(this.boss, UNIT_STATE_MAX_LIFE)*0.66 )
call SInteger( this, GetHandleId(this.tBlizzard ), KB_SEIGNEUR_ARACH )
call TriggerAddAction( this.tBlizzard , function SeigneurArach.triggerBlizzard )
call TriggerRegisterUnitEvent( this.tBlizzard , this.boss, EVENT_UNIT_ATTACKED )
call SInteger( this, GetHandleId(t), KB_SEIGNEUR_ARACH )
call TriggerAddAction( t, function SeigneurArach.Mort )
call TriggerRegisterUnitEvent( t, this.boss, EVENT_UNIT_DEATH )
return this.boss
endmethod
endstruct
//===========================================================================
function InitTrig_B6_Seigneur_Arachnathid takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=16
//TESH.alwaysfold=0
library BossDrakeBleu needs libVagueBoss
globals
constant integer UNIT_DRAKE_GUERRIER = 'nbdw'
constant integer UNIT_DRAKE_PROPHETE = 'nbdo'
constant integer UNIT_DRAKE_SORCIER = 'nbds'
constant string EFFECT_APPARITION_DRAKE = "Abilities\\Spells\\Items\\TomeOfRetraining\\TomeOfRetrainingCaster.mdl"
constant string EFFECT_DIVISION_DRAKE = "Abilities\\Spells\\Undead\\DeathPact\\DeathPactTarget.mdl"
constant integer ABILITY_DRAKE_BLIZZARD = 'A053'
constant integer KB_DRAKE_BLEU = StringHash("boss__drakebleu")
endglobals
struct DrakeBleu extends Boss
integer idBoss = 'nbdm'
timer tDivision = CreateTimer()
unit draGuerrier
unit draProphete
unit draSorcier
integer gate
trigger tBlizzard = CreateTrigger()
static method triggerBlizzard takes nothing returns nothing
local DrakeBleu obj = LInteger( GetHandleId(GetTriggeringTrigger()), KB_DRAKE_BLEU )
call IssuePointOrder( obj.draSorcier, "blizzard", GetUnitX(GetAttacker()), GetUnitY(GetAttacker()) )
endmethod
static method Division takes nothing returns nothing
local timer t = GetExpiredTimer()
local DrakeBleu obj = LInteger( GetHandleId(t), KB_DRAKE_BLEU )
local real x = GetUnitX(obj.boss)
local real y = GetUnitY(obj.boss)
local real angle = Atan2( CY_ARENE - y, CX_ARENE - x)
local player p = GetOwningPlayer(obj.boss)
call Flush( GetHandleId(obj.tDivision))
call DestroyTimer(t)
call DestroyEffect( AddSpecialEffect( EFFECT_DIVISION_DRAKE, x, y ) )
set obj.draGuerrier = CreateUnit( p, UNIT_DRAKE_GUERRIER, x + 160 * Cos(angle+bj_PI/3), y + 160 * Sin(angle+bj_PI/3), Rad2Deg(angle) )
set obj.draProphete = CreateUnit( p, UNIT_DRAKE_PROPHETE, x + 160 * Cos(angle-bj_PI/3), y + 160 * Sin(angle-bj_PI/3), Rad2Deg(angle) )
set obj.draSorcier = CreateUnit( p, UNIT_DRAKE_SORCIER , x + 160 * Cos(-angle), y + 160 * Sin(-angle), Rad2Deg(angle) )
call DestroyEffect( AddSpecialEffect( EFFECT_APPARITION_DRAKE, x + 160 * Cos(angle+bj_PI/3), y + 160 * Sin(angle+bj_PI/3) ) )
call DestroyEffect( AddSpecialEffect( EFFECT_APPARITION_DRAKE, x + 160 * Cos(angle-bj_PI/3), y + 160 * Sin(angle-bj_PI/3) ) )
call DestroyEffect( AddSpecialEffect( EFFECT_APPARITION_DRAKE, x + 160 * Cos(-angle), y + 160 * Sin(-angle) ) )
call GroupAddUnit( udg_Groupe_Arene[obj.gate], obj.draGuerrier)
call GroupAddUnit( udg_Groupe_Arene[obj.gate], obj.draProphete)
call GroupAddUnit( udg_Groupe_Arene[obj.gate], obj.draSorcier)
call GroupRemoveUnit( udg_Groupe_Arene[obj.gate], obj.boss)
call RemoveUnit(obj.boss)
call SetUnitAbilityLevel( obj.draSorcier, ABILITY_DRAKE_BLIZZARD, 3)
call SInteger( obj, GetHandleId(obj.tBlizzard), KB_DRAKE_BLEU )
call TriggerAddAction( obj.tBlizzard, function DrakeBleu.triggerBlizzard )
call TriggerRegisterUnitEvent( obj.tBlizzard, obj.draGuerrier, EVENT_UNIT_ATTACKED)
set t = null
set p = null
endmethod
static method Mort takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local DrakeBleu obj = LInteger( GetHandleId(t), KB_DRAKE_BLEU )
call Flush( GetHandleId(t))
call DestroyTrigger(t)
call DrakeBleu.destroy(obj)
set t = null
endmethod
method init takes integer i returns unit
local trigger t = CreateTrigger()
set this.boss = CreateUnit( Player(11), .idBoss, 0, 0, 0.0 )
set this.gate = i
call SInteger( this, GetHandleId(this.tDivision), KB_DRAKE_BLEU)
call TimerStart( this.tDivision, 5.0, false, function DrakeBleu.Division )
return this.boss
endmethod
endstruct
//===========================================================================
function InitTrig_B7_Drake_Bleu takes nothing returns nothing
call Preload( EFFECT_APPARITION_DRAKE )
call Preload( EFFECT_DIVISION_DRAKE )
call Preload( "Units\\Creeps\\DragonSpawnPurple\\DragonSpawnPurple.mdl" )
call Preload( "Units\\Creeps\\DragonSpawnGreen\\DragonSpawnGreen.mdl" )
endfunction
endlibrary
//TESH.scrollpos=30
//TESH.alwaysfold=0
library BossPanda needs libVagueBoss
globals
constant integer KB_PANDA = StringHash("boss__panda")
endglobals
struct Panda extends Boss
integer idBoss = 'nfrp'
timer tDodo = CreateTimer()
timer tCrystal = CreateTimer()
static method cycleDodo takes nothing returns nothing
local Panda obj = LInteger( GetHandleId(GetExpiredTimer()), KB_PANDA)
call IssueImmediateOrder( obj.boss, "taunt")
endmethod
static method cycleCrystal takes nothing returns nothing
local Panda obj = LInteger( GetHandleId(GetExpiredTimer()), KB_PANDA)
local location loc = GetRandomLoc( GetUnitX(obj.boss), GetUnitY(obj.boss), 550 )
call CreateCrystalDeGlace( obj.boss, GetLocationX(loc), GetLocationY(loc), GetRandomReal(320., 360.))
call RemoveLocation(loc)
set loc = null
endmethod
static method Mort takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local Panda obj = LInteger( GetHandleId(t), KB_PANDA )
call Flush( GetHandleId(t))
call Flush( GetHandleId(obj.tDodo))
call Flush( GetHandleId(obj.tCrystal))
call DestroyTimer(obj.tDodo)
call DestroyTimer(obj.tCrystal)
call DestroyTrigger(t)
call Panda.destroy(obj)
set t = null
endmethod
method init takes integer i returns unit
local trigger t = CreateTrigger()
set this.boss = CreateUnit( Player(11), .idBoss, 0, 0, 0.0 )
call SInteger( this, GetHandleId(this.tDodo), KB_PANDA )
call TimerStart( this.tDodo, 20.0, true, function Panda.cycleDodo )
call SInteger( this, GetHandleId(this.tCrystal), KB_PANDA )
call TimerStart( this.tCrystal, 6.0, true, function Panda.cycleCrystal )
call SInteger( this, GetHandleId(t), KB_PANDA )
call TriggerAddAction( t, function Panda.Mort )
call TriggerRegisterUnitEvent( t, this.boss, EVENT_UNIT_DEATH )
return this.boss
endmethod
endstruct
//===========================================================================
function InitTrig_B8_Panda takes nothing returns nothing
call Preload(EFFECT_SOL_GELE)
endfunction
endlibrary
//TESH.scrollpos=48
//TESH.alwaysfold=0
library BossSeigneurCrypte needs libVagueBoss, SpellSautdAttaque
globals
constant integer SBIRE_SCARABEE = 'ucs2'
constant integer KB_SEIGNEUR_CRYPTE = StringHash("boss__seigneurcrype")
endglobals
function Cond_Scarabee takes nothing returns boolean
return GetUnitTypeId(GetFilterUnit()) == SBIRE_SCARABEE
endfunction
function GetRandomScarabee takes unit boss, real dist returns unit
local location loc = Location(GetUnitX(boss), GetUnitY(boss))
local group g = GetUnitsInRangeOfLocMatching( dist, loc, Condition(function Cond_Scarabee))
local unit u = FirstOfGroup(g)
call RemoveLocation(loc)
set loc = null
call DestroyGroup(g)
set g = null
return u
endfunction
function ExploScarab takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local unit u = GetTriggerUnit()
local unit caster = GetEventDamageSource()
local location loc = Location( GetUnitX(u), GetUnitY(u))
call DmgToArea( loc, caster, GetRandomReal(310, 350), 230, true)
call DestroyEffect( AddSpecialEffectLoc("Objects\\Spawnmodels\\Undead\\UndeadLargeDeathExplode\\UndeadLargeDeathExplode.mdl", loc) )
call RemoveUnit(u)
call RemoveLocation(loc)
set loc = null
set caster = null
set u = null
call DestroyTrigger(t)
set t = null
call Flush( GetHandleId(t))
endfunction
struct SeigneurCrypte extends Boss
integer idBoss = 'nmit'
timer tCharge = CreateTimer()
timer tInvoc = CreateTimer()
timer tPacte = CreateTimer()
timer tExplo = CreateTimer()
trigger tSaut = CreateTrigger()
timer cdSaut = CreateTimer()
static method cycleSaut takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local SeigneurCrypte obj = LInteger( GetHandleId(t), KB_SEIGNEUR_CRYPTE )
if ( GetUnitState(obj.boss, UNIT_STATE_MANA) >= 90.0 and TimerGetRemaining(obj.cdSaut) <= 0.0) then
call TimerStart(obj.cdSaut, 9.0, false, null)
call bCrypte_SautdAttaque( obj.boss, GetUnitLoc(GetAttacker()) )
call AddMana( obj.boss, -90)
endif
endmethod
static method cycleCharge takes nothing returns nothing
local SeigneurCrypte obj = LInteger( GetHandleId(GetExpiredTimer()), KB_SEIGNEUR_CRYPTE )
local unit u
local location loc = GetUnitLoc(obj.boss)
local group g = GetUnitsInRangeOfLocMatching( 400, loc, Condition(function Cond.Alive))
local group g2 = GetUnitsInRangeOfLocMatching( 650, loc, Condition(function Cond.Alive))
call GroupRemoveGroup( g, g2 )
call DestroyGroup(g)
call RemoveLocation(loc)
set loc = null
set g = null
loop
set u = FirstOfGroup(g2)
exitwhen u == null or IsUnitEnemy( u, GetOwningPlayer(obj.boss) )
call GroupRemoveUnit(g2,u)
endloop
call DestroyGroup(g2)
set g2 = null
if( u != null ) then
call IssueTargetOrder( obj.boss, "stomp", u )
endif
endmethod
static method cycleInvoc takes nothing returns nothing
local SeigneurCrypte obj = LInteger( GetHandleId(GetExpiredTimer()), KB_SEIGNEUR_CRYPTE )
local location loc = GetRandomLoc( GetUnitX(obj.boss), GetUnitY(obj.boss), 600)
local unit u = CreateUnit( GetOwningPlayer(obj.boss), SBIRE_SCARABEE, GetLocationX(loc), GetLocationY(loc), GetRandomReal(0,360))
call RemoveLocation(loc)
set loc = null
call RemoveGuardPosition(u)
call SetUnitAnimationByIndex(u, 9)
call UnitAddType( u, UNIT_TYPE_SUMMONED )
call IssuePointOrder( u, "attack", GetUnitX(obj.boss), GetUnitY(obj.boss) )
set u = null
endmethod
static method cyclePacte takes nothing returns nothing
local SeigneurCrypte obj = LInteger( GetHandleId(GetExpiredTimer()), KB_SEIGNEUR_CRYPTE )
local unit u = GetRandomScarabee( obj.boss, 350)
if( u != null) then
call IssueTargetOrder( obj.boss, "deathpact", u)
endif
endmethod
static method cycleExplo takes nothing returns nothing
local SeigneurCrypte obj = LInteger( GetHandleId(GetExpiredTimer()), KB_SEIGNEUR_CRYPTE )
local location loc = Location(GetUnitX(obj.boss), GetUnitY(obj.boss))
local group g = GetUnitsInRangeOfLocMatching( 1000, loc, Condition(function Cond_Scarabee))
local group g2 = null
local boolean b = false
local unit u = null
local trigger t = null
call RemoveLocation(loc)
set Cond.condUnite = obj.boss
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit(g,u)
set loc = Location(GetUnitX(u), GetUnitY(u))
set g2 = GetUnitsInRangeOfLocMatching( 230, loc, Condition(function Cond.EnnemiVar))
set b = CountUnit(g2) > 1
call DestroyGroup(g2)
call RemoveLocation(loc)
exitwhen b
endloop
call DestroyGroup(g)
set g = null
set g2 = null
if (b) then
call IssueTargetOrder( obj.boss, "thunderbolt", u)
set t = CreateTrigger()
call SUnit( obj.boss, GetHandleId(t), KEY_CASTER)
call TriggerRegisterUnitEvent( t, u, EVENT_UNIT_DAMAGED)
call TriggerAddCondition( t, Condition(function Cond.DgtsCaster))
call TriggerAddAction( t, function ExploScarab)
endif
endmethod
static method Mort takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local SeigneurCrypte obj = LInteger( GetHandleId(t), KB_SEIGNEUR_CRYPTE )
call Flush( GetHandleId(t))
call Flush( GetHandleId(obj.tCharge))
call Flush( GetHandleId(obj.tInvoc))
call Flush( GetHandleId(obj.tPacte))
call Flush( GetHandleId(obj.tExplo))
call Flush( GetHandleId(obj.tSaut))
call DestroyTimer(obj.tExplo)
call DestroyTimer(obj.tPacte)
call DestroyTimer(obj.tCharge)
call DestroyTimer(obj.tInvoc)
call DestroyTrigger(obj.tSaut)
call DestroyTimer(obj.cdSaut)
call DestroyTrigger(t)
call SeigneurCrypte.destroy(obj)
set t = null
endmethod
method init takes integer i returns unit
local trigger t = CreateTrigger()
set this.boss = CreateUnit( Player(11), .idBoss, 0, 0, 0.0 )
call SInteger( this, GetHandleId(this.tCharge), KB_SEIGNEUR_CRYPTE )
call TimerStart( this.tCharge, 9, true, function SeigneurCrypte.cycleCharge )
call SInteger( this, GetHandleId(this.tInvoc), KB_SEIGNEUR_CRYPTE )
call TimerStart( this.tInvoc, 9.0, true, function SeigneurCrypte.cycleInvoc )
call SInteger( this, GetHandleId(this.tPacte), KB_SEIGNEUR_CRYPTE )
call TimerStart( this.tPacte, 25.0, true, function SeigneurCrypte.cyclePacte )
call SInteger( this, GetHandleId(this.tExplo), KB_SEIGNEUR_CRYPTE )
call TimerStart( this.tExplo, 15.0, true, function SeigneurCrypte.cycleExplo )
call TimerStart( .cdSaut, 6.0, false, null)
call SInteger( this, GetHandleId(this.tSaut), KB_SEIGNEUR_CRYPTE )
call TriggerAddAction( this.tSaut , function SeigneurCrypte.cycleSaut )
call TriggerRegisterUnitEvent( this.tSaut, this.boss, EVENT_UNIT_ATTACKED )
call SInteger( this, GetHandleId(t), KB_SEIGNEUR_CRYPTE )
call TriggerAddAction( t, function SeigneurCrypte.Mort )
call TriggerRegisterUnitEvent( t, this.boss, EVENT_UNIT_DEATH )
return this.boss
endmethod
endstruct
//===========================================================================
function InitTrig_B9_Seigneur_des_cryptes takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=45
//TESH.alwaysfold=0
library BossGolemFer needs libVagueBoss
globals
constant integer ID_SPHERE_INSTABILITE = 'h01T'
constant integer KB_GOLEM_FER = StringHash("boss__golemfer")
endglobals
struct GolemFer extends Boss
integer idBoss = 'nwrg'
trigger tFissure = CreateTrigger()
timer tInstabilite = CreateTimer()
static method cycleInstabilite takes nothing returns nothing
local timer t = GetExpiredTimer()
local GolemFer obj = LInteger( GetHandleId(t), KB_GOLEM_FER )
local unit u = GroupPickRandomUnit(udg_Heros_vivant)
local real x = GetUnitX(u)
local real y = GetUnitY(u)
set u = CreateUnit( Player(11), ID_SPHERE_INSTABILITE, x, y, 0.0)
call SetUnitX(u, x)
call SetUnitY(u, y)
call UnitApplyTimedLife( u, 'BTLF', 10.00 )
call IssuePointOrder( u, "tranquility", x, y )
set u = null
set t = null
endmethod
static method cycleFissure takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local GolemFer obj = LInteger( GetHandleId(t), KB_GOLEM_FER )
local unit u = GetAttacker()
call IssuePointOrder( obj.boss, "thunderclap", GetUnitX(u), GetUnitY(u) )
set u = null
set t = null
endmethod
static method Mort takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local GolemFer obj = LInteger( GetHandleId(t), KB_GOLEM_FER )
call Flush( GetHandleId(obj.tFissure))
call Flush( GetHandleId(obj.tInstabilite))
call Flush( GetHandleId(t))
call DestroyTrigger(t)
call DestroyTrigger(obj.tFissure)
call DestroyTimer(obj.tInstabilite)
call GolemFer.destroy(obj)
set t= null
endmethod
method init takes integer i returns unit
local trigger t = CreateTrigger()
set this.boss = CreateUnit( Player(11), .idBoss, 0, 0, 0.0 )
call SInteger( this, GetHandleId(this.tInstabilite), KB_GOLEM_FER )
call TimerStart( this.tInstabilite, 9.0, true, function GolemFer.cycleInstabilite)
call SInteger( this, GetHandleId(this.tFissure), KB_GOLEM_FER )
call TriggerAddAction( this.tFissure , function GolemFer.cycleFissure )
call TriggerRegisterUnitEvent( this.tFissure, this.boss, EVENT_UNIT_ATTACKED )
call SInteger( this, GetHandleId(t), KB_GOLEM_FER )
call TriggerAddAction( t, function GolemFer.Mort )
call TriggerRegisterUnitEvent( t, this.boss, EVENT_UNIT_DEATH )
return this.boss
endmethod
endstruct
//===========================================================================
function InitTrig_B10_GolemFer takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=15
//TESH.alwaysfold=0
library BossSorcImperial needs libVagueBoss
globals
constant integer ID_BOULE_EXPLOSIVE = 'h01U'
constant integer KB_SORCIERE_IMPERIALE = StringHash("boss__sorciereimperiale")
endglobals
struct SorcImperial extends Boss
integer idBoss = 'nmsn'
timer tVagueMeteores = CreateTimer()
trigger tAttacked = CreateTrigger()
timer cdBouledefeu = CreateTimer()
unit lanceur = null
static method triggerAttacked takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local SorcImperial obj = LInteger( GetHandleId(t), KB_SORCIERE_IMPERIALE )
local unit target = GetAttacker()
// Boule de feu
if ( GetUnitState(obj.boss, UNIT_STATE_MANA) >= 80.0 and TimerGetRemaining(obj.cdBouledefeu) <= 0.0) then
call TimerStart(obj.cdBouledefeu, 6.0, false, null)
call SetUnitX(obj.lanceur, GetUnitX(obj.boss))
call SetUnitY(obj.lanceur, GetUnitY(obj.boss))
call IssueTargetOrder( obj.lanceur, "thunderbolt", target )
call AddMana(obj.boss, -80)
endif
set target = null
// Drain de mana
if( GetUnitState(obj.boss, UNIT_STATE_MANA) < 400.) then
call IssueTargetOrder( obj.boss, "steal", GetAttacker())
endif
// Drain de vie
call IssueTargetOrder( obj.boss, "thunderbolt", GetAttacker())
// Polymorphe
//call IssueTargetOrder( obj.boss, "polymorph", GetAttacker())
set t = null
endmethod
static method cycleVagueMeteores takes nothing returns nothing
local timer t = GetExpiredTimer()
local SorcImperial obj = LInteger( GetHandleId(t), KB_SORCIERE_IMPERIALE )
local unit u = GroupPickRandomUnit(udg_Heros_vivant)
if( ManaCost( obj.boss, 150.) ) then
call VagueMeteores_Actions( obj.boss, GetUnitX(u), GetUnitY(u), 550., 7)
endif
set u = null
set t = null
endmethod
static method Mort takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local SorcImperial obj = LInteger( GetHandleId(t), KB_SORCIERE_IMPERIALE )
call Flush( GetHandleId(obj.tVagueMeteores))
call Flush( GetHandleId(obj.tAttacked))
call Flush( GetHandleId(t))
call DestroyTrigger(t)
call DestroyTimer(obj.tVagueMeteores)
call DestroyTrigger(obj.tAttacked)
call DestroyTimer(obj.cdBouledefeu)
call RemoveUnit(obj.lanceur)
call SorcImperial.destroy(obj)
set t = null
endmethod
method init takes integer i returns unit
local trigger t = CreateTrigger()
set this.boss = CreateUnit( Player(11), .idBoss, 0, 0, 0.0 )
call SInteger( this, GetHandleId(this.tVagueMeteores), KB_SORCIERE_IMPERIALE)
call TimerStart( this.tVagueMeteores, 12.0, true, function SorcImperial.cycleVagueMeteores)
call SInteger( this, GetHandleId(this.tAttacked), KB_SORCIERE_IMPERIALE )
call TriggerRegisterUnitEvent( this.tAttacked, this.boss, EVENT_UNIT_ATTACKED )
call TriggerAddAction( this.tAttacked , function SorcImperial.triggerAttacked )
call TimerStart( .cdBouledefeu, 6.0, false, null)
call SInteger( this, GetHandleId(t), KB_SORCIERE_IMPERIALE )
call TriggerAddAction( t, function SorcImperial.Mort )
call TriggerRegisterUnitEvent( t, this.boss, EVENT_UNIT_DEATH )
set .lanceur = CreateUnit( Player(11), ID_BOULE_EXPLOSIVE, 0.0, 0.0, 0.0)
return .boss
endmethod
endstruct
//===========================================================================
function InitTrig_B11_Sorciere_Imperial takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=19
//TESH.alwaysfold=0
library BossIndomptable needs libVagueBoss
globals
constant integer FAUCON_INDOMPTABLE = 'nwe3'
constant integer NID_FAUCON_INDOMPTABLE = 'nhns'
endglobals
struct Indomptable extends Boss
integer idBoss = 'nowk'
unit nid = null
static method Mort takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local Indomptable obj = GetInteger( I2S(H2I(t)), "Indomptable" )
if( GetUnitState(obj.nid, UNIT_STATE_LIFE) > 0 ) then
call KillUnit(obj.nid)
endif
call FreeInteger( I2S(H2I(obj.tFaucon)), "Indomptable" )
call FreeInteger( I2S(H2I(t)), "Indomptable" )
call DestroyTimer(obj.tFaucon)
call DestroyTrigger(t)
call Indomptable.destroy(obj)
set t = null
endmethod
method init takes integer i returns unit
local location loc = GetRectCenter( udg_Reg_Coin[i] )
local trigger t = CreateTrigger()
set this.boss = CreateUnit( Player(11), .idBoss, 0, 0, 0.0 )
set this.nid = CreateUnit( Player(11), NID_FAUCON_INDOMPTABLE, GetLocationX(loc), GetLocationY(loc), GetRandomReal(0,2*bj_PI) )
call SetInteger( I2S(H2I(this.tFaucon)), "Indomptable", this )
call TimerStart( this.tFaucon, 10.0, true, function Indomptable.cycleFaucon )
call SetInteger( I2S(H2I(t)), "Indomptable", this )
call TriggerAddAction( t, function Indomptable.Mort )
call TriggerRegisterUnitEvent( t, this.boss, EVENT_UNIT_DEATH )
call RemoveLocation(loc)
return this.boss
endmethod
endstruct
//===========================================================================
function InitTrig_BX_Indomptable takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=44
//TESH.alwaysfold=0
library BossRevenantProf needs libVagueBoss
globals
endglobals
struct RevenantProf extends Boss
integer idBoss = 'nlrv'
timer tInvoc = CreateTimer()
timer tFletri = CreateTimer()
timer tDrain = CreateTimer()
static method cycleInvoc takes nothing returns nothing
local RevenantProf obj = GetInteger( I2S(H2I(GetExpiredTimer())), "RevenantProf")
call IssueImmediateOrder( obj.boss, "taunt")
endmethod
static method cycleFletri takes nothing returns nothing
local RevenantProf obj = GetInteger( I2S(H2I(GetExpiredTimer())), "RevenantProf")
local unit u = GroupPickRandomUnit(udg_Heros_vivant)
if( not IsUnitCanalisation(obj.boss)) then
call IssuePointOrder( obj.boss, "thunderclap", GetUnitX(u), GetUnitY(u) )
endif
set u = null
endmethod
static method cycleDrain takes nothing returns nothing
local RevenantProf obj = GetInteger( I2S(H2I(GetExpiredTimer())), "RevenantProf")
local unit u = GroupPickRandomUnit(udg_Heros_vivant)
if( not IsUnitCanalisation(obj.boss) and not IsUnitInGroup(u, H2G(GetInteger(I2S(H2I(obj.boss)), "draindevie__cibles"))) ) then
call IssueTargetOrder( obj.boss, "thunderbolt", u )
endif
set u = null
endmethod
static method Mort takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local RevenantProf obj = GetInteger( I2S(H2I(t)), "RevenantProf" )
call FreeInteger( I2S(H2I(t)), "RevenantProf" )
call FreeInteger( I2S(H2I(obj.tInvoc)), "RevenantProf" )
call FreeInteger( I2S(H2I(obj.tFletri)), "RevenantProf" )
call FreeInteger( I2S(H2I(obj.tDrain)), "RevenantProf" )
call DestroyTimer(obj.tDrain)
call DestroyTimer(obj.tInvoc)
call DestroyTimer(obj.tFletri)
call DestroyTrigger(t)
call RevenantProf.destroy(obj)
set t = null
endmethod
method init takes integer i returns unit
local trigger t = CreateTrigger()
set this.boss = CreateUnit( Player(11), .idBoss, 0, 0, 0.0 )
call SetInteger( I2S(H2I(this.tInvoc)), "RevenantProf", this )
call TimerStart( this.tInvoc, 35.0, true, function RevenantProf.cycleInvoc )
call SetInteger( I2S(H2I(this.tFletri)), "RevenantProf", this )
call TimerStart( this.tFletri, 12.0, true, function RevenantProf.cycleFletri )
call SetInteger( I2S(H2I(this.tDrain)), "RevenantProf", this )
call TimerStart( this.tDrain, 8.0, true, function RevenantProf.cycleDrain )
call SetInteger( I2S(H2I(t)), "RevenantProf", this )
call TriggerAddAction( t, function RevenantProf.Mort )
call TriggerRegisterUnitEvent( t, this.boss, EVENT_UNIT_DEATH )
return this.boss
endmethod
endstruct
//===========================================================================
function InitTrig_BX_RevenantProf takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library BossSeigneurNerub needs libVagueBoss
globals
endglobals
struct SeigneurNerub extends Boss
integer idBoss = 'nnws'
trigger tImpie = CreateTrigger()
timer tPiege = CreateTimer()
static method triggerMassImpie takes nothing returns nothing
local SeigneurNerub obj = LInteger( GetHandleId(GetTriggeringTrigger())), "SeigneurNerub" )
//call BJDebugMsg("sort")
call IssueImmediateOrder( obj.boss, "roar")
endmethod
static method cyclePiegeRets takes nothing returns nothing
local SeigneurNerub obj = LInteger( GetHandleId(GetExpiredTimer())), "SeigneurNerub")
local location loc = GetRandomLoc( GetUnitX(obj.boss), GetUnitY(obj.boss), 550 )
call b10PiegeRets( obj.boss, GetLocationX(loc), GetLocationY(loc))
call RemoveLocation(loc)
endmethod
static method Mort takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local SeigneurNerub obj = LInteger( GetHandleId(t)), "SeigneurNerub" )
call FreeInteger( GetHandleId(t)), "SeigneurNerub" )
call FreeInteger( GetHandleId(obj.tImpie)), "SeigneurNerub" )
call FreeInteger( GetHandleId(obj.tPiege)), "SeigneurNerub" )
call DestroyTrigger(t)
call DestroyTrigger(obj.tImpie)
call DestroyTimer( obj.tPiege)
call SeigneurNerub.destroy(obj)
set t = null
endmethod
method init takes integer i returns unit
local trigger t = CreateTrigger()
set this.boss = CreateUnit( Player(11), .idBoss, 0, 0, 0.0 )
call SInteger( GetHandleId(this.tImpie )), "SeigneurNerub", this )
call TriggerAddAction( this.tImpie , function SeigneurNerub.triggerMassImpie )
call TriggerRegisterUnitEvent( this.tImpie , this.boss, EVENT_UNIT_ATTACKED )
call SInteger( GetHandleId(this.tPiege)), "SeigneurNerub", this )
call TimerStart( this.tPiege, 7.0, true, function SeigneurNerub.cyclePiegeRets )
call SInteger( GetHandleId(t)), "SeigneurNerub", this )
call TriggerAddAction( t, function SeigneurNerub.Mort )
call TriggerRegisterUnitEvent( t, this.boss, EVENT_UNIT_DEATH )
return this.boss
endmethod
endstruct
//===========================================================================
function InitTrig_BX_Seigneur_Nerubien takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=6
//TESH.alwaysfold=0
globals
group deratiseur = null
timer timDeratisation = null
trigger tDeratisation = null
timerdialog tdlgDeratisation = null
endglobals
function Fin_Deratisation takes nothing returns nothing
local unit u
local player p
call DestroyTimer(timDeratisation)
loop
set u = FirstOfGroup(deratiseur)
exitwhen u == null
call GroupRemoveUnit( deratiseur, u)
call DestroyEffect(AddSpecialEffect( "Abilities\\Spells\\Items\\AIil\\AIilTarget.mdl", GetUnitX(u), GetUnitY(u)) )
call RemoveUnit(u)
endloop
call DestroyTrigger(tDeratisation)
set deratiseur = GetUnitsInRectMatching(gg_rct_Arene, Condition( function Cond_Ennemi_Arene))
loop
set u = FirstOfGroup(deratiseur)
exitwhen u == null
call GroupRemoveUnit( deratiseur, u)
call ExplodeUnitBJ(u)
endloop
set p = LeaderboardGetIndexedPlayerBJ( 1, tabScore)
call AdjustPlayerStateBJ( 300, p, PLAYER_STATE_RESOURCE_GOLD )
call DisplayTimedTextToForce( GetPlayersAll(), 12.00, GetPlayerName(p) + " is the winner !!")
call DestroyGroup(deratiseur)
call DestroyTimerDialog(tdlgDeratisation)
call LeaderboardClear(tabScore)
call DestroyLeaderboard(tabScore)
call ExecuteFunc("Niv_Bonus_Fin")
endfunction
function Cond_Rat_Meurt takes nothing returns boolean
return GetUnitTypeId(GetDyingUnit()) == 'nrat'
endfunction
function Rat_Meurt takes nothing returns nothing
local player p = GetOwningPlayer(GetKillingUnit())
set udg_loc = GetRandomLoc( CX_ARENE, CY_ARENE, 1600 )
call CreateUnit( Player(11), 'nrat', GetLocationX(udg_loc), GetLocationY(udg_loc), GetRandomReal(0,360) )
call RemoveLocation(udg_loc)
set score[GetPlayerId(p)] = score[GetPlayerId(p)] + 1
call LeaderboardSetPlayerItemValueBJ(p , tabScore, score[GetPlayerId(p)])
call LeaderboardSortItemsByValue( tabScore, false)
endfunction
function Gain_Deratisation takes nothing returns nothing
call DisplayTimedTextToForce( GetPlayersAll(), 12.00, " -The first place receives 300 golds")
endfunction
function Regles_Deratisation takes nothing returns nothing
call DisplayTimedTextToForce( GetPlayersAll(), 12.00, " -Destroy the most important number of rat in 30 seconds" )
call DisplayTimedTextToForce( GetPlayersAll(), 12.00, " -You have grenades for eliminate a lot of rats in one shot." )
endfunction
function grp_Deratisation_Actions takes nothing returns nothing
local integer a = GetPlayerId(GetOwningPlayer(GetEnumUnit()))
local unit u = null
call ShowUnit( GetEnumUnit(), false )
set u = CreateUnit( Player(a), 'zmar', CX_ARENE + 600 * Cos(((2*bj_PI)/udg_Nb_Joueur)*a+bj_PI/2.0), CY_ARENE + 600 * Sin(((2*bj_PI)/udg_Nb_Joueur)*a+bj_PI/2.0), 270.0)
call GroupAddUnit( deratiseur, u)
call PanCameraToForPlayer( Player(a), GetUnitX(u), GetUnitY(u) )
call PlayerSetLeaderboard(Player(a), tabScore)
call LeaderboardAddItem( tabScore, GetPlayerName(Player(a)), 0, Player(a))
call LeaderboardResizeBJ(tabScore)
set score[a] = 0
endfunction
function Init_Deratisation takes nothing returns nothing
local integer a = 1
set msgBonus = "Rat Extermination|r --( :)>"
set deratiseur = CreateGroup()
set tDeratisation = CreateTrigger()
set tabScore = CreateLeaderboard()
call LeaderboardSetLabel( tabScore, "Score")
call ForGroup( udg_Heros, function grp_Deratisation_Actions)
call LeaderboardDisplay( tabScore, true)
call TriggerRegisterAnyUnitEventBJ( tDeratisation, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( tDeratisation, Condition( function Cond_Rat_Meurt) )
call TriggerAddAction( tDeratisation, function Rat_Meurt)
endfunction
function Deratisation takes nothing returns nothing
local integer a = 0
local unit u = null
loop
exitwhen a > 100
set udg_loc = GetRandomLoc( CX_ARENE, CY_ARENE, 1600 )
set u = CreateUnit( Player(11), 'nrat', GetLocationX(udg_loc), GetLocationY(udg_loc), GetRandomReal(0,360) )
call RemoveLocation(udg_loc)
set a = a + 1
endloop
set timDeratisation = CreateTimer()
call TimerStart( timDeratisation, 30.0, false, function Fin_Deratisation)
set tdlgDeratisation = CreateTimerDialog(timDeratisation)
call TimerDialogDisplay( tdlgDeratisation, true)
call TimerDialogSetTitle( tdlgDeratisation, "Temps restant")
endfunction
//===========================================================================
function InitTrig_Deratisation takes nothing returns nothing
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
globals
timer timLapin = null
timerdialog tdlgLapin = null
trigger array tSelectLapin
endglobals
function grp_Fin_Lapin takes nothing returns nothing
call DestroyTrigger(tSelectLapin[GetPlayerId(GetOwningPlayer(GetEnumUnit()))])
endfunction
function Fin_Lapin takes nothing returns nothing
local unit u
local player p
local group g
call DestroyTimer(timDeratisation)
call ForGroup( udg_Heros, function grp_Fin_Lapin)
set g = GetUnitsInRectMatching(gg_rct_Arene, Condition( function Cond_Ennemi_Arene))
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit( g, u)
call ExplodeUnitBJ(u)
endloop
//=== Gain du niveau bonus ===
set p = LeaderboardGetIndexedPlayerBJ( 1, tabScore)
call UnitAddItemByIdSwapped( 'tkno', udg_Hero[GetPlayerId(p)+1] )
call DisplayTimedTextToForce( GetPlayersAll(), 12.00, GetPlayerName(p) + " is the winner !!")
//=== Nettoyage ===
call DestroyGroup(g)
call DestroyTimerDialog(tdlgLapin)
call LeaderboardClear(tabScore)
call DestroyLeaderboard(tabScore)
call EnableDragSelect( true, true )
call ExecuteFunc("Niv_Bonus_Fin")
endfunction
function Cond_Kill_Lapin takes nothing returns boolean
return GetUnitTypeId(GetTriggerUnit()) == 'necr'
endfunction
function Kill_Lapin takes nothing returns nothing
local player p = GetTriggerPlayer()
local unit u = GetTriggerUnit()
call ExplodeUnitBJ(GetTriggerUnit())
call SEffect_Foudre( udg_Hero[GetPlayerId(p)+1], GetUnitX(u), GetUnitY(u), 30, 120)
set udg_loc = GetRandomLoc( CX_ARENE, CY_ARENE, 1600 )
call CreateUnit( Player(11), 'necr', GetLocationX(udg_loc), GetLocationY(udg_loc), GetRandomReal(0,360))
call RemoveLocation(udg_loc)
set score[GetPlayerId(p)] = score[GetPlayerId(p)] + 1
call LeaderboardSetPlayerItemValueBJ(p , tabScore, score[GetPlayerId(p)])
call LeaderboardSortItemsByValue( tabScore, false)
endfunction
function Gain_Lapin takes nothing returns nothing
call DisplayTimedTextToForce( GetPlayersAll(), 12.00, " -The first place wins a level !")
endfunction
function Regles_Lapin takes nothing returns nothing
call DisplayTimedTextToForce( GetPlayersAll(), 12.00, " -Exterminate the highest number of rabbits in 30 seconds." )
call DisplayTimedTextToForce( GetPlayersAll(), 12.00, " -To eliminate a rabbit, click on it !" )
endfunction
function grp_Init_Lapin takes nothing returns nothing
local player p = GetOwningPlayer(GetEnumUnit())
call ShowUnit( GetEnumUnit(), false )
call PanCameraToForPlayer( p, CX_ARENE, CY_ARENE )
call PlayerSetLeaderboard(p, tabScore)
call LeaderboardAddItem( tabScore, GetPlayerName(p), 0, p)
call LeaderboardResizeBJ(tabScore)
set score[GetPlayerId(p)] = 0
set tSelectLapin[GetPlayerId(p)] = CreateTrigger()
call TriggerRegisterPlayerSelectionEventBJ( tSelectLapin[GetPlayerId(p)], p, true )
call TriggerAddAction(tSelectLapin[GetPlayerId(p)], function Kill_Lapin)
call TriggerAddCondition( tSelectLapin[GetPlayerId(p)], Condition( function Cond_Kill_Lapin) )
endfunction
function Init_Lapin takes nothing returns nothing
local integer a = 1
local unit u = null
set msgBonus = "Rabbit Hunting|r"
set tabScore = CreateLeaderboard()
call LeaderboardSetLabel( tabScore, "Score")
call ForGroup(udg_Heros, function grp_Init_Lapin)
call LeaderboardDisplay( tabScore, true)
endfunction
function Lapin takes nothing returns nothing
local integer a = 0
local unit u = null
loop
exitwhen a > 30
set udg_loc = GetRandomLoc( CX_ARENE, CY_ARENE, 1600 )
set u = CreateUnit( Player(11), 'necr', GetLocationX(udg_loc), GetLocationY(udg_loc), GetRandomReal(0,360) )
call RemoveLocation(udg_loc)
set a = a + 1
endloop
set timLapin = CreateTimer()
call TimerStart( timLapin, 30.0, false, function Fin_Lapin)
set tdlgLapin = CreateTimerDialog(timLapin)
call TimerDialogDisplay( tdlgLapin, true)
call TimerDialogSetTitle( tdlgLapin, "Temps restant")
call EnableDragSelect( false, false )
endfunction
//===========================================================================
function InitTrig_Lapin takes nothing returns nothing
endfunction
//TESH.scrollpos=14
//TESH.alwaysfold=0
globals
leaderboard tabScore = null
integer array score
string msgBonus
endglobals
function Niv_Bonus takes nothing returns nothing
local integer i = udg_Niveau
local string func = ""
local group g
local unit u = null
if i == 5 then
set func = "Deratisation"
elseif i == 9 then
set func = "Lapin"
else
call ExecuteFunc("Niv_Bonus_Fin")
endif
call TriggerExecute( gg_trg_Resu )
set g = GetUnitsInRectMatching(gg_rct_Arene, Condition(function Cond.Invoque) )
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit(g,u)
//call KillUnit(u)
call ShowUnit(u, false)
endloop
if func != "" then
call ExecuteFunc( "Init_"+func)
call DisplayTimedTextToForce( GetPlayersAll(), 15.00, "$ù*@?! "+Degrade( "Bonus Level", 12, 12, 12)+" &#'ù%" )
call DisplayTimedTextToForce( GetPlayersAll(), 15.00, " |cff3399ff"+msgBonus )
call DisplayTimedTextToForce( GetPlayersAll(), 15.00, " " )
call DisplayTimedTextToForce( GetPlayersAll(), 15.00, "|cffffcc00Rules:|r" )
call ExecuteFunc( "Regles_"+func)
call DisplayTimedTextToForce( GetPlayersAll(), 15.00, " " )
call DisplayTimedTextToForce( GetPlayersAll(), 15.00, "|cffffcc00Price:|r" )
call ExecuteFunc( "Gain_"+func)
call MultiboardDisplay( udg_Tablo_ppal, false)
call DisableTrigger( gg_trg_Drop_d_objets )
call DisableTrigger( gg_trg_Update_dead )
call TriggerSleepAction(12.00)
call DisplayTimedTextToForce( GetPlayersAll(), 5.00, " |cffff0000GO!|r" )
call ExecuteFunc(func)
endif
endfunction
function grp_Niv_Bonus_Fin takes nothing returns nothing
call ShowUnit( GetEnumUnit(), true )
endfunction
function Niv_Bonus_Fin takes nothing returns nothing
local integer a = 1
local group g = null
local unit u
set g = GetUnitsInRectMatching(gg_rct_Arene, Condition(function Cond.Invoque) )
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit(g,u)
//call KillUnit(u)
call ShowUnit(u, true)
endloop
call MultiboardDisplay( udg_Tablo_ppal, true)
call EnableTrigger( gg_trg_Drop_d_objets )
call EnableTrigger( gg_trg_Update_dead )
call ForGroup(udg_Heros, function grp_Niv_Bonus_Fin)
call TriggerSleepAction(5.00)
call TriggerExecute( gg_trg_Shopping )
endfunction
//===========================================================================
function InitTrig_Niv_Bonus_General takes nothing returns nothing
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
globals
itempool objClassiques = CreateItemPool()
itempool objUniques = CreateItemPool()
itempool objRunes = CreateItemPool()
itempool objOrbes = CreateItemPool()
itempool array objMagiques
endglobals
//! textmacro AjouterTObjet takes TYPE, VAR
function Ajouter$TYPE$ takes itempool ip, integer iMin, integer iMax returns nothing
local integer a = iMin
loop
exitwhen a > iMax
call ItemPoolAddItemType( ip, $VAR$[a], 1)
set a = a + 1
endloop
endfunction
//! endtextmacro
//! runtextmacro AjouterTObjet("Armure","armures")
//! runtextmacro AjouterTObjet("Casque","casques")
//! runtextmacro AjouterTObjet("Bouclier","boucliers")
//! runtextmacro AjouterTObjet("Arme","armes")
function Item_Pool takes nothing returns nothing
local itempool ip = null
local integer a = 0
//==== Objets magiques ====//
loop
exitwhen a > 3
set objMagiques[a] = CreateItemPool()
set ip = objMagiques[a]
call AjouterArmure(ip, a*4+1, (a+1)*4)
call AjouterCasque(ip, a*4+1, (a+1)*4)
call AjouterBouclier(ip, a*4+1, (a+1)*4)
call AjouterArme(ip, a*4+1, (a+1)*4)
set a = a + 1
endloop
set ip = objClassiques
//=== Bottes d'agilité ===//
call ItemPoolAddItemType( ip, 'rag1', 5) //le plus pourri
call ItemPoolAddItemType( ip, 'I01H', 3)
call ItemPoolAddItemType( ip, 'I01L', 2)
call ItemPoolAddItemType( ip, 'I01M', 1) //le best
//=== Gantelets de force ===//
call ItemPoolAddItemType( ip, 'rst1', 5)
call ItemPoolAddItemType( ip, 'I01I', 3)
call ItemPoolAddItemType( ip, 'I01J', 2)
call ItemPoolAddItemType( ip, 'I01K', 1)
//=== Manteau d'intelligence ===//
call ItemPoolAddItemType( ip, 'rin1', 5)
call ItemPoolAddItemType( ip, 'I01O', 3)
call ItemPoolAddItemType( ip, 'I01P', 2)
call ItemPoolAddItemType( ip, 'I01N', 1)
//=== Anneau de protection ===//
call ItemPoolAddItemType( ip, 'rde1', 5)
call ItemPoolAddItemType( ip, 'rde2', 4)
call ItemPoolAddItemType( ip, 'rde3', 2)
call ItemPoolAddItemType( ip, 'I01Q', 1)
//=== Collier de pouvoir ===//
call ItemPoolAddItemType( ip, 'cnob', 3)
call ItemPoolAddItemType( ip, 'I01S', 2)
call ItemPoolAddItemType( ip, 'I01R', 1)
//=== Griffes d'attaque ===//
call ItemPoolAddItemType( ip, 'rat3', 6)
call ItemPoolAddItemType( ip, 'rat6', 4)
call ItemPoolAddItemType( ip, 'rat9', 2)
call ItemPoolAddItemType( ip, 'ratc', 1)
//=== Fétiche de vitalité ===//
call ItemPoolAddItemType( ip, 'prvt', 4)
call ItemPoolAddItemType( ip, 'I01U', 2)
call ItemPoolAddItemType( ip, 'I01V', 1)
//=== Pendentif de mana ===//
call ItemPoolAddItemType( ip, 'penr', 4)
call ItemPoolAddItemType( ip, 'I01W', 2)
call ItemPoolAddItemType( ip, 'I01X', 1)
set ip = objRunes
//=== Runes de soins ===//
call ItemPoolAddItemType( ip, 'rhe1', 5)
call ItemPoolAddItemType( ip, 'rhe2', 4)
call ItemPoolAddItemType( ip, 'rhe3', 3)
call ItemPoolAddItemType( ip, 'I020', 2)
//=== Runes de mana ===//
call ItemPoolAddItemType( ip, 'rman', 5)
call ItemPoolAddItemType( ip, 'I01Z', 4)
call ItemPoolAddItemType( ip, 'I021', 3)
call ItemPoolAddItemType( ip, 'I022', 2)
set ip = objOrbes
//=== Orbes classiques ===//
call ItemPoolAddItemType( ip, 'ofir', 2)
call ItemPoolAddItemType( ip, 'oli2', 2)
call ItemPoolAddItemType( ip, 'ocor', 2)
call ItemPoolAddItemType( ip, 'oven', 2)
//=== Orbes diverses ===//
call ItemPoolAddItemType( ip, 'oslo', 1)
call ItemPoolAddItemType( ip, 'I026', 1) //Orbe de glace
call ItemPoolAddItemType( ip, 'I027', 1) //Orbe de grâce
call ItemPoolAddItemType( ip, 'I028', 1) //Orbe de malédiction
set ip = objUniques
call ItemPoolAddItemType( ip, 'I00H', 2)
call ItemPoolAddItemType( ip, 'I00K', 1)
call ItemPoolAddItemType( ip, 'I024', 2)
call ItemPoolAddItemType( ip, 'I00M', 2)
call ItemPoolAddItemType( ip, 'I00J', 2)
call ItemPoolAddItemType( ip, 'I00I', 2)
call ItemPoolAddItemType( ip, 'I023', 2)
call ItemPoolAddItemType( ip, 'I00G', 2)
call ItemPoolAddItemType( ip, 'I00L', 2)
call ItemPoolAddItemType( ip, 'ckng', 1)
call ItemPoolAddItemType( ip, 'ofro', 2)
call ItemPoolAddItemType( ip, 'ratf', 2)
call ItemPoolAddItemType( ip, 'modt', 2)
call ItemPoolAddItemType( ip, 'red4', 1)
call ItemPoolAddItemType( ip, 'desc', 1)
endfunction
function ItemPoolGetRandomItemType takes itempool ip returns integer
local item obj = PlaceRandomItem( ip, 0, 0)
local integer id = GetItemTypeId(obj)
call RemoveItem(obj)
set obj = null
return id
endfunction
//===========================================================================
function InitTrig_Item_Pool takes nothing returns nothing
endfunction
//TESH.scrollpos=15
//TESH.alwaysfold=0
function Trig_Drop_d_objets_Func038C takes nothing returns boolean
if ( ( GetOwningPlayer(GetDyingUnit()) == Player(11) ) ) then
return true
endif
if ( ( GetOwningPlayer(GetDyingUnit()) == Player(PLAYER_NEUTRAL_AGGRESSIVE) ) ) then
return true
endif
return false
endfunction
function Trig_Drop_d_objets_Conditions takes nothing returns boolean
if ( not ( IsUnitType(GetDyingUnit(), UNIT_TYPE_SUMMONED) == false ) ) then
return false
endif
if ( not Trig_Drop_d_objets_Func038C() ) then
return false
endif
return true
endfunction
function Trig_Drop_d_objets_Actions takes nothing returns nothing
local itempool ip
local item obj
local integer j = 1
local integer k = 85
local integer i = GetRandomInt(1,k)
local unit u = GetTriggerUnit()
local integer lvl = GetUnitLevel(u)
local integer l = 0
if( IsDummyUnit(u) or IsUnitType(GetFilterUnit(), UNIT_TYPE_SUMMONED) ) then
return
endif
if( IsUnitBoss(GetDyingUnit()) ) then
set j = 5
set k = 40
endif
// boucle pour les boss
loop
if( i <= 2 ) then
if( lvl < 5 ) then
set l = 9
elseif( lvl < 10 ) then
set l = 5
elseif( lvl < 15 ) then
set l = 2
else
set l = 0
endif
set l = GetRandomInt(l, 9)
if l > 5 then
set l = 0
elseif l > 2 then
set l = 1
elseif l > 0 then
set l = 2
else
set l = 3
endif
set ip = objMagiques[l]
call PlaceRandomItem( ip, GetUnitX(u), GetUnitY(u) )
elseif( i <= 5) then
set ip = objClassiques
call PlaceRandomItem( ip, GetUnitX(u), GetUnitY(u) )
elseif( i <= 8) then
set ip = objRunes
call PlaceRandomItem( ip, GetUnitX(u), GetUnitY(u) )
elseif( i <= 9) then
set ip = objOrbes
call PlaceRandomItem( ip, GetUnitX(u), GetUnitY(u) )
elseif( i <= 12 and IsUnitBoss(GetDyingUnit()) and lvl > 11) then
set ip = objUniques
set obj = PlaceRandomItem( ip, GetUnitX(u), GetUnitY(u) )
call ItemPoolRemoveItemType( ip, GetItemTypeId(obj) )
endif
set i = GetRandomInt(1,k)
set j = j - 1
exitwhen j == 0
endloop
endfunction
//===========================================================================
function InitTrig_Drop_d_objets takes nothing returns nothing
set gg_trg_Drop_d_objets = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Drop_d_objets, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Drop_d_objets, Condition( function Trig_Drop_d_objets_Conditions ) )
call TriggerAddAction( gg_trg_Drop_d_objets, function Trig_Drop_d_objets_Actions )
endfunction
//TESH.scrollpos=105
//TESH.alwaysfold=0
globals
// Inventaire héros
boolean array dropEnable
// Objets classés
integer array boucliers
integer array armures
integer array casques
integer array armes
integer array potions
string array labelTObjet
// itemtid
constant integer DIVERS = 0
constant integer ARMURE = 1
constant integer CASQUE = 2
constant integer BOUCLIER = 3
constant integer ARME = 4
constant integer POTION = 5
constant integer NB_ELEMENT = 5
endglobals
//! textmacro IsObjet takes TYPE, VAR
function Is$TYPE$ takes integer itemid returns boolean
local integer a = 1
loop
exitwhen a > $VAR$[0] or $VAR$[a] == itemid
set a = a + 1
endloop
return a <= $VAR$[0]
endfunction
//! endtextmacro
//! runtextmacro IsObjet("Armure","armures")
//! runtextmacro IsObjet("Casque","casques")
//! runtextmacro IsObjet("Bouclier","boucliers")
//! runtextmacro IsObjet("Arme","armes")
//! runtextmacro IsObjet("Potion","potions")
function GetTypeObjet takes item i returns integer
local integer itemid
if i == null then
return DIVERS
endif
set itemid = GetItemTypeId(i)
if IsArmure(itemid) then
return ARMURE
elseif IsCasque(itemid) then
return CASQUE
elseif IsBouclier(itemid) then
return BOUCLIER
elseif IsArme(itemid) then
return ARME
elseif IsPotion(itemid) then
return POTION
endif
return DIVERS
endfunction
function GetObjetValide takes unit u, integer limit_charge, item i returns item
local integer itemid = GetItemTypeId(i)
local item objet
local integer a = 0
loop
set objet = UnitItemInSlot(u, a)
exitwhen a > 5
if( GetItemTypeId(objet)== itemid and GetItemCharges(objet) < limit_charge and objet != i ) then
return objet
endif
set a = a + 1
endloop
return null
endfunction
function HasTypeObjet takes unit u, integer itemtid returns boolean
local integer a = 0
local item i = null
loop
set i = UnitItemInSlot(u, a)
exitwhen a > 5 or (GetTypeObjet(i) == itemtid and GetItemUserData(i) != 1)
set a = a + 1
endloop
return a < 6
endfunction
function PrendObjet takes nothing returns nothing
local item i = GetManipulatedItem()
local unit u = GetManipulatingUnit()
local integer itemtid = GetTypeObjet(i)
local integer pid = GetPlayerId(GetOwningPlayer(u))
local item objet = null // pour les popos
if( itemtid != DIVERS ) then
if( itemtid == POTION ) then
if UnitHasItemOfTypeBJ(GetTriggerUnit(), GetItemTypeId(i)) then
set objet = GetObjetValide(u, 3, i)
if objet != null and objet != i then
if GetItemCharges(objet)+GetItemCharges(i) <= 3 then
call SetItemCharges( objet, GetItemCharges(objet)+GetItemCharges(i) )
call RemoveItem(i)
else
call SetItemCharges(i, GetItemCharges(i) - (3 - GetItemCharges(objet)) )
call SetItemCharges(objet, 3)
endif
endif
endif
else
call SetItemUserData(i, 1)
if HasTypeObjet(u, itemtid) then
set dropEnable[pid] = false
call DisplayTextToPlayer( GetOwningPlayer(u), 0.0, 0.0, " |cffffcc00You can't wear 2 pieces of "+ labelTObjet[itemtid] +"|r")
call UnitRemoveItem(u, i)
endif
call SetItemUserData(i, 0)
endif
endif
endfunction
//===========================================================================
function InitTrig_Inventaire takes nothing returns nothing
local integer a = 0
set udg_trg_PrendObjet = CreateTrigger()
call TriggerAddAction( udg_trg_PrendObjet, function PrendObjet )
//== Armures ==
set armures[0] = 20 // Nombre d'armures
//Niv 1
set armures[1] = 'I000'
set armures[2] = 'I001'
set armures[3] = 'I002'
set armures[4] = 'I007'
//Niv 2
set armures[5] = 'I005'
set armures[6] = 'I006'
set armures[7] = 'I00A'
set armures[8] = 'I004'
//Niv 3
set armures[9] = 'I009'
set armures[10] = 'I00B'
set armures[11] = 'I00R'
set armures[12] = 'I008'
//Niv 4
set armures[13] = 'I00D'
set armures[14] = 'I00E'
set armures[15] = 'I00F'
set armures[16] = 'I003'
//Reliques
set armures[17] = 'rde4'
set armures[18] = 'I024'
set armures[19] = 'I023'
set armures[20] = 'I025'
//== Casques ==
set casques[0] = 18
//Niv 1
set casques[1] = 'I00O'
set casques[2] = 'I00P'
set casques[3] = 'I00Q'
set casques[4] = 'I00C'
//Niv 2
set casques[5] = 'I00T'
set casques[6] = 'I00S'
set casques[7] = 'I00Z'
set casques[8] = 'I00U'
//Niv 3
set casques[9] = 'I00X'
set casques[10] = 'I00Y'
set casques[11] = 'I00W'
set casques[12] = 'I00N'
//Niv 4
set casques[13] = 'I012'
set casques[14] = 'I00V'
set casques[15] = 'I010'
set casques[16] = 'I011'
//Reliques
set casques[17] = 'ckng'
set casques[18] = 'ratf'
//== Boucliers ==
set boucliers[0] = 17
//Niv 1
set boucliers[1] = 'I013'
set boucliers[2] = 'I014'
set boucliers[3] = 'I015'
set boucliers[4] = 'I016'
//Niv 2
set boucliers[5] = 'I017'
set boucliers[6] = 'I018'
set boucliers[7] = 'I019'
set boucliers[8] = 'I01A'
//Niv 3
set boucliers[9] = 'I01B'
set boucliers[10] = 'I01C'
set boucliers[11] = 'I01D'
set boucliers[12] = 'I01E'
//Niv 4
set boucliers[13] = 'I01G'
set boucliers[14] = 'I01Y'
set boucliers[15] = 'I01T'
set boucliers[16] = 'I01F'
//Reliques
set boucliers[17] = 'I00M'
//== Armes ==
set armes[0] = 22
//Niv 1
set armes[1] = 'I02B'
set armes[2] = 'I02C'
set armes[3] = 'I029'
set armes[4] = 'I02A'
//Niv 2
set armes[5] = 'I02D'
set armes[6] = 'I02G'
set armes[7] = 'I02F'
set armes[8] = 'I02E'
//Niv 3
set armes[9] = 'I02I'
set armes[10] = 'I02K'
set armes[11] = 'I02J'
set armes[12] = 'I02H'
//Niv 4
set armes[13] = 'I02L'
set armes[14] = 'I02O'
set armes[15] = 'I02N'
set armes[16] = 'I02M'
//Reliques
set armes[17] = 'ofro'
set armes[18] = 'modt'
set armes[19] = 'desc'
set armes[20] = 'I00K'
set armes[21] = 'I00G'
set armes[22] = 'I00L'
//== Potions ==
set potions[0] = 6
// Potions de soins
set potions[1] = 'pghe'
set potions[2] = 'pomn'
set potions[3] = 'phea'
// Potions de mana
set potions[4] = 'pinv'
set potions[5] = 'pgma'
set potions[6] = 'pman'
set labelTObjet[DIVERS] = "Miscellaneous"
set labelTObjet[ARMURE] = "Armor"
set labelTObjet[CASQUE] = "Helmet"
set labelTObjet[BOUCLIER] = "Shield"
set labelTObjet[ARME] = "Weapon"
set labelTObjet[POTION] = "Potion"
endfunction
//TESH.scrollpos=12
//TESH.alwaysfold=0
library libVagueUnit needs libVagueBoss
struct VagueUnite
integer lvl = udg_Niveau
method NextLevel takes nothing returns nothing
set .lvl = .lvl + 1
endmethod
method PreviousLevel takes nothing returns nothing
set .lvl = .lvl -1
if( .lvl < 1 ) then
set .lvl = 0
endif
endmethod
method GetNbGate takes nothing returns integer
if udg_Nb_Joueur < 3 then
return 0
elseif udg_Nb_Joueur < 5 then
return 1
elseif udg_Nb_Joueur < 8 then
return 2
else
return 3
endif
endmethod
method CreateBoss takes nothing returns nothing
local integer gate = .GetNbGate()
local integer a = 0
local unit u
local location loc
local string s
set udg_Nb_Porte = gate + 1
loop
exitwhen a > gate
set u = InitBoss( .lvl/4, a )
call RemoveGuardPosition(u)
set loc = GetRectCenter(udg_Couloir[a])
call SetUnitPositionLoc( u, loc)
call RemoveLocation(loc)
set loc = GetRectCenter(udg_Pos_Fort[a])
call IssuePointOrder( u, "move", GetLocationX(loc), GetLocationY(loc) )
call RemoveLocation(loc)
call GroupAddUnit( udg_Groupe_Arene[a], u )
set a = a + 1
endloop
set s = GetUnitName(u)
call DisplayTimedTextToForce( GetPlayersAll(), 12.00, ( "|cffffcc00--// Level Begin \\\\--" ) )
call DisplayTimedTextToForce( GetPlayersAll(), 12.00, ( "-"+SubStringBJ(s,1,5)+"|cffff3300"+SubStringBJ(s,6, StringLength(s)) ) )
set loc = null
endmethod
method CreateWave takes nothing returns nothing
local integer gate = .GetNbGate()
local integer a = 0
local unit u = CreateUnit( Player(PLAYER_NEUTRAL_PASSIVE), udg_Unite_Niveau[.lvl], -1000, 2700, 0.0 )
local string s = GetUnitName(u)
call RemoveUnit(u)
set udg_Nb_Porte = gate + 1
call DisplayTimedTextToForce( GetPlayersAll(), 12.00, ( "|cffffcc00--// Level Begin \\\\--" ) )
call DisplayTimedTextToForce( GetPlayersAll(), 12.00, ( "-"+SubStringBJ(s,1,3)+"|cff3399ff"+SubStringBJ(s,4, StringLength(s)) ) )
loop
exitwhen a > gate
call this.MeleeWave( ModuloInteger(.lvl,4), a)
call this.CasterWave( ModuloInteger(.lvl,4), a)
call this.ChiefWave( ModuloInteger(.lvl,4), a)
set a = a + 1
endloop
endmethod
method MeleeWave takes integer i, integer gate returns nothing
local unit u
local location loc
local integer a = 0
local integer aMax = 3
if ( i == 2 ) then
set a = 2
set aMax = 4
elseif( i == 3 ) then
set a = 2
set aMax = 3
endif
loop
exitwhen a > aMax
set loc = GetRectCenter(udg_Couloir[gate])
set u = CreateUnit( Player(11), udg_Unite_Niveau[.lvl+1-i], GetLocationX(loc), GetLocationY(loc), 270+gate*90 )
call RemoveLocation(loc)
call RemoveGuardPosition(u)
set loc = GetRectCenter(udg_Pos_Faible[gate*5+a])
call IssuePointOrder( u, "move", GetLocationX(loc), GetLocationY(loc) )
call RemoveLocation(loc)
call GroupAddUnit( udg_Groupe_Arene[gate], u )
set a = a + 1
endloop
set loc = null
endmethod
method CasterWave takes integer i, integer gate returns nothing
local location loc
local unit u
local integer a = 0
if( i < 2 ) then
return
endif
loop
exitwhen a == 2
set loc = GetRectCenter(udg_Couloir[gate])
set u = CreateUnit( Player(11), udg_Unite_Niveau[.lvl+2-i], GetLocationX(loc), GetLocationY(loc), 270+gate*90 )
call RemoveLocation(loc)
call RemoveGuardPosition(u)
set loc = GetRectCenter(udg_Pos_Caster[gate*2+a])
call IssuePointOrder( u, "move", GetLocationX(loc), GetLocationY(loc) )
call RemoveLocation(loc)
call GroupAddUnit( udg_Groupe_Arene[gate], u )
set a = a + 1
endloop
set loc = null
endmethod
method ChiefWave takes integer i, integer gate returns nothing
local location loc = GetRectCenter(udg_Couloir[gate])
local unit u
if( i < 3 ) then
return
endif
set u = CreateUnit( Player(11), udg_Unite_Niveau[.lvl+3-i], GetLocationX(loc), GetLocationY(loc), 270+gate*90 )
call RemoveLocation(loc)
call RemoveGuardPosition(u)
set loc = GetRectCenter(udg_Pos_Fort[gate])
call IssuePointOrder( u, "move", GetLocationX(loc), GetLocationY(loc) )
call RemoveLocation(loc)
call GroupAddUnit( udg_Groupe_Arene[gate], u )
set loc = null
endmethod
endstruct
//===========================================================================
function InitTrig_Vague_Unite takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=15
//TESH.alwaysfold=0
library libVagueBoss needs libSpellEffect
interface Boss
unit boss
method init takes integer i returns unit
endinterface
function InitBoss takes integer lvl, integer gate returns unit
local Boss b = 0
call StopMusicBJ( true )
call PlayThematicMusicBJ( "Sound\\Music\\mp3Music\\Orc3.mp3" )
if( lvl == 1 ) then
set b = AraigneeNoire.create()
elseif( lvl == 2 ) then
set b = SeigneurOgre.create()
elseif( lvl == 3 ) then
set b = GolemGranit.create()
elseif( lvl == 4 ) then
set b = UrsaFurbolg.create()
elseif( lvl == 5 ) then
set b = WyrmTempete.create()
elseif( lvl == 6 ) then
set b = SeigneurArach.create()
elseif( lvl == 7 ) then
set b = DrakeBleu.create()
elseif( lvl == 8 ) then
set b = Panda.create()
elseif( lvl == 9 ) then
set b = SeigneurCrypte.create()
elseif( lvl == 10 ) then
set b = GolemFer.create()
elseif( lvl == 11 ) then
set b = SorcImperial.create()
//Deprecated
//elseif( lvl == 97 ) then
//set b = RevenantProf.create()
//elseif( lvl == 98 ) then
//set b = Indomptable.create()
//elseif( lvl == 100 ) then
//set b = SeigneurNerub.create()
endif
if( b != 0 ) then
return b.init(gate)
endif
//call BJDebugMsg( "Jeu Fini")
return null
endfunction
//===========================================================================
function InitTrig_Vague_Boss takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=39
//TESH.alwaysfold=0
function b8Invocation_Morbide takes nothing returns nothing
endfunction
function bGolem_Assomoir takes nothing returns nothing
call ExecuteFunc("gaAssomoir")
endfunction
function bGolem_Choc takes nothing returns nothing
call ExecuteFunc("fdChoc_Psy")
endfunction
function bOgre_BaliseSerpent takes nothing returns nothing
endfunction
function bUrsa_Assomoir takes nothing returns nothing
call ExecuteFunc("gaAssomoir")
endfunction
function bWyrm_Chaine takes nothing returns nothing
call IssueTargetOrder( GetTriggerUnit(), "chainlightning", GetSpellTargetUnit())
endfunction
function bArach_Poison takes nothing returns nothing
endfunction
function bDrake_FeuSacre takes nothing returns nothing
endfunction
function bDrake_Blizzard takes nothing returns nothing
call ExecuteFunc("heBlizzard")
endfunction
function bDrake_Foudre takes nothing returns nothing
call SEffect_Foudre( GetSpellAbilityUnit(), GetUnitX(GetSpellTargetUnit()), GetUnitY(GetSpellTargetUnit()), 300, 250 )
endfunction
function bCrypte_PacteMaudit takes nothing returns nothing
endfunction
function bCrypte_VoileMortel takes nothing returns nothing
endfunction
function Souffle_de_feu takes nothing returns nothing
local unit u = GetTriggerUnit()
call IssueTargetOrder( u, "breathoffire", GetSpellTargetUnit())
endfunction
function bSorciere_Polymorphe takes nothing returns nothing
endfunction
function bSorciere_DrainDeVie takes nothing returns nothing
call SEffect_DrainDeVie( GetSpellAbilityUnit(), GetSpellTargetUnit(), 60., 2, 10.0 )
endfunction
function bSorciere_DrainDeMana takes nothing returns nothing
call SEffect_DrainDeMana( GetSpellAbilityUnit(), GetSpellTargetUnit(), 60., 1.5, 10.0 )
endfunction
//======= Sort de streum =========//
function FaiblesseAuto takes nothing returns nothing
call IssueTargetOrder( GetTriggerUnit(), "cripple", GetSpellTargetUnit())
endfunction
function EntravesTerrestre takes nothing returns nothing
call IssueTargetOrder( GetTriggerUnit(), "magicleash", GetSpellTargetUnit())
endfunction
function RugissementAuto takes nothing returns nothing
call IssueTargetOrder( GetTriggerUnit(), "roar", GetSpellTargetUnit())
endfunction
//===========================================================================
function InitTrig_Un_peu_tout takes nothing returns nothing
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
library SpellPiegeRets needs libSpellEffect
globals
constant integer ID_RETS = 'h01Q'
constant integer ID_RETS_MISSILE = 'h01P'
constant integer ID_RETS_POISON = 'h01R'
endglobals
function Piege_Rets takes nothing returns nothing
local unit u = null
if( GetOwningPlayer(GetTriggerUnit()) == Player(11) ) then
return
endif
set u = CreateUnit( Player(11), ID_RETS_POISON, GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()), 0.0)
call UnitApplyTimedLife( u, 'BTLF', 7.20)
call IssueTargetOrder( u, "shadowstrike", GetTriggerUnit() )
endfunction
struct PiegeRets extends Spell
unit dummy = null
real duree = 1.0
static method cycle takes nothing returns boolean
local thistype this = T025_GetData()
local trigger t = null
set this.duree = this.duree - T025_PERIOD
if( this.duree <= 0.0 ) then
call KillUnit(this.dummy)
set this.dummy = CreateUnit( GetOwningPlayer(this.caster), ID_RETS, GetUnitX(this.dummy), GetUnitY(this.dummy), 0.0)
call UnitApplyTimedLife( this.dummy, 'BTLF', 10.00)
set t = CreateTrigger()
call TriggerRegisterUnitInRangeSimple( t, 150, this.dummy )
call TriggerAddAction( t, function Piege_Rets )
call this.destroy()
return true
endif
return false
endmethod
endstruct
function b10PiegeRets takes unit u, real x, real y returns nothing
local PiegeRets obj = PiegeRets.create()
set obj.caster = u
set obj.dummy = CreateUnit( GetOwningPlayer(obj.caster), ID_RETS_MISSILE, x, y, 0.0)
//call UnitAddAbility( obj.dummy, 'Arav' )
call SetUnitFlyHeight(obj.dummy, 0, 1000.0)
call T025_Add(function PiegeRets.cycle, obj)
endfunction
endlibrary
//===========================================================================
function InitTrig_Piege_Rets takes nothing returns nothing
endfunction
//TESH.scrollpos=52
//TESH.alwaysfold=0
library SpellOndeOgre needs libSpellEffect
globals
constant string EFFECT_STOMP_OGRE = "Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl"
constant integer KS_ONDE_OGRE = StringHash("spell__ondeogre")
endglobals
struct OndeOgre extends Spell
real angle
real dist = 0.0
real xc
real yc
group g = CreateGroup()
static method cycle takes nothing returns boolean
local thistype this = T025_GetData()
local real x = this.xc + this.dist * Cos(this.angle)
local real y = this.yc + this.dist * Sin(this.angle)
local location loc = Location(x,y)
local group g = GetUnitsInRangeOfLocMatching(350, loc, And(Condition(function Cond.Alive), Not(Condition(function Cond.Structure))) )
local unit u
local player p = GetOwningPlayer(this.caster)
call RemoveLocation(loc)
if( this.dist < 800 ) then
call DestroyEffect( AddSpecialEffect( EFFECT_STOMP_OGRE, x, y) )
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit(g,u)
if( IsUnitEnemy( u, p) and not LBoolean( GetHandleId(u), KS_ONDE_OGRE ) ) then
call DmgToUnit( this.caster, u, this.dmg, true )
call Recul( x, y, u, 230, 0, 24 )
call SBoolean( true, GetHandleId(u), KS_ONDE_OGRE)
call GroupAddUnit(this.g,u)
endif
endloop
call DestroyGroup(g)
else
loop
set u = FirstOfGroup(this.g)
exitwhen u == null
call GroupRemoveUnit(this.g,u)
call RBoolean( GetHandleId(u), KS_ONDE_OGRE)
endloop
call DestroyGroup(this.g)
call OndeOgre.destroy(this)
return true
endif
set this.dist = this.dist + 240
return false
endmethod
endstruct
function bOgre_Onde takes nothing returns nothing
local OndeOgre obj = OndeOgre.create()
local unit caster = GetSpellAbilityUnit()
local location loc = GetSpellTargetLoc()
set obj.caster = caster
set obj.dmg = GetRandomReal(80,100)
set obj.xc = GetUnitX(caster)
set obj.yc = GetUnitY(caster)
set obj.angle = Atan2( GetLocationY(loc) - GetUnitY(caster), GetLocationX(loc) - GetUnitX(caster) )
call T025_Add(function OndeOgre.cycle, obj)
call RemoveLocation(loc)
set loc = null
set caster = null
endfunction
//===========================================================================
function InitTrig_Onde_Ogre takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=20
//TESH.alwaysfold=0
library SpellLancerGnoll needs libSpellEffect
globals
constant integer UNIT_LANCER_GNOLL = 'ngno'
endglobals
struct LancerGnoll extends Spell
unit gnoll
real dist = 0.0
boolean lance = true
boolean vol = false
boolean explode = true
real angle
real x
real y
static method cycle takes nothing returns boolean
local thistype this = T003_GetData()
local real x
local real y
local location loc
if( this.lance ) then
set this.lance = false
set this.gnoll = CreateUnit( GetOwningPlayer(this.caster), UNIT_LANCER_GNOLL, this.x, this.y, Rad2Deg(this.angle) )
call UnitAddType( this.gnoll, UNIT_TYPE_SUMMONED )
call UnitAddAbility( this.gnoll, 'Arav' )
call SetUnitFlyHeight( this.gnoll, 250.0, 20000.0 )
call UnitRemoveAbility( this.gnoll, 'Arav' )
set this.vol = true
elseif( this.vol ) then
call SetUnitFlyHeight( this.gnoll, 0.0, 400.0 )
set this.vol = false
else
set x = this.x + this.dist * Cos(this.angle)
set y = this.y + this.dist * Sin(this.angle)
call SetUnitX(this.gnoll, x)
call SetUnitY(this.gnoll, y)
if( this.dist > 580.0 and this.explode ) then
call DestroyEffect( AddSpecialEffect( "Objects\\Spawnmodels\\Human\\HumanLargeDeathExplode\\HumanLargeDeathExplode.mdl", x, y) )
set this.explode = false
set loc = Location(x,y)
call DmgToArea( loc, this.caster, this.dmg, 220.0, true)
call SetUnitExploded( this.gnoll, true)
call KillUnit(this.gnoll)
call LancerGnoll.destroy(this)
return true
endif
endif
set this.dist = this.dist + 28.0
return false
endmethod
endstruct
function bOgre_LancerGnoll takes nothing returns nothing
local LancerGnoll obj = LancerGnoll.create()
local location loc = GetSpellTargetLoc()
set obj.caster = GetSpellAbilityUnit()
set obj.angle = Atan2( GetLocationY(loc) - GetUnitY(obj.caster), GetLocationX(loc) - GetUnitX(obj.caster) )
set obj.x = GetUnitX(obj.caster) + 80.0 * Cos(obj.angle-bj_PI/2)
set obj.y = GetUnitY(obj.caster) + 80.0 * Sin(obj.angle-bj_PI/2)
set obj.angle = Atan2( GetLocationY(loc) - obj.y, GetLocationX(loc) - obj.x )
set obj.dmg = 135
call RemoveLocation(loc)
set loc = null
call T003_Add(function LancerGnoll.cycle, obj)
endfunction
//===========================================================================
function InitTrig_Lancer_Gnoll takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=43
//TESH.alwaysfold=0
library SpellChargeFurblog needs libSpellEffect, SpellAssomoir
struct ChargeFurbolg extends Spell
effect e
boolean b = true
static method cycle takes nothing returns boolean
local thistype this = T003_GetData()
local real xc = GetUnitX(this.caster)
local real yc = GetUnitY(this.caster)
local real xt = GetUnitX(this.target)
local real yt = GetUnitY(this.target)
local real angle = Atan2( yt - yc, xt - xc )
local real dist = DistanceBetweenPointsEx( xc, yc, xt, yt )
local real vit = 18.0
local location loc
if( dist > 120 ) then
call SetUnitAnimationByIndex( this.caster, 0 )
set xc = xc+vit*Cos(angle)
set yc = yc+vit*Sin(angle)
call SetUnitX( this.caster, xc )
call SetUnitY( this.caster, yc )
set loc = Location( xc, yc)
call DmgToArea( loc, this.caster, 22, 160, false)
call RemoveLocation(loc)
if( dist < 190 and this.b ) then
set this.b = false
call SetUnitAnimationByIndex( this.caster, 4 )
endif
else
call SetUnitTimeScalePercent( this.caster, 100 )
call DestroyEffect( this.e )
call SetUnitPathing( this.caster, true)
call SetUnitInvulnerable( this.caster, false)
call PauseUnit( this.caster, false)
call SetUnitAbilityLevel( this.caster, 'A03O', 2)
call IssueTargetOrder( this.caster, "tankloadpilot", this.target )
call ChargeFurbolg.destroy(this)
return true
endif
return false
endmethod
endstruct
function bUrsa_ChargeFurbolg takes nothing returns nothing
local ChargeFurbolg obj = ChargeFurbolg.create()
set obj.caster = GetTriggerUnit()
set obj.target = GetSpellTargetUnit()
set obj.dmg = GetRandomReal(140,160)
set obj.e = AddSpecialEffectTarget( "Abilities\\Spells\\Orc\\Shockwave\\ShockwaveMissile.mdl", obj.caster, "origin" )
call PauseUnit( obj.caster, true)
call SetUnitPathing( obj.caster, false)
call SetUnitInvulnerable( obj.caster, true)
call SetUnitTimeScalePercent( obj.caster, 140 )
call T003_Add(function ChargeFurbolg.cycle, obj)
endfunction
//===========================================================================
function InitTrig_Charge_Furbolg takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=13
//TESH.alwaysfold=0
library SpellSpiraleFoudre needs libSpellEffect
globals
constant string EFFECT_SPIRALE_FOUDRE = "Abilities\\Weapons\\FarseerMissile\\FarseerMissile.mdl"
endglobals
struct SpiraleFoudre extends Spell
real angle = 0.0
real dist = 30.0
real x // position initiale de la spirale
real y
integer i = 0
static method cycle takes nothing returns boolean
local thistype this = T003_GetData()
local real x = this.x + this.dist * Cos(this.angle)
local real y = this.y + this.dist * Sin(this.angle)
set this.dist = this.dist + 1.7
set this.angle = this.angle - 14.0 / this.dist
call DestroyEffect( AddSpecialEffect( EFFECT_SPIRALE_FOUDRE, x, y) )
set this.i = this.i + 1
if this.i == 10 then
set this.i = 0
set udg_loc = Location(x,y)
call DmgToAreaEffect( udg_loc, this.caster, this.dmg, 150, true, "Abilities\\Weapons\\Bolt\\BoltImpact.mdl")
call RemoveLocation(udg_loc)
endif
if this.dist > 750 then
return true
endif
return false
endmethod
endstruct
function bWyrm_SpiraleFoudre takes unit u returns nothing
local SpiraleFoudre obj = SpiraleFoudre.create()
set obj.caster = u
set obj.dmg = 200
set obj.x = GetUnitX(u)
set obj.y = GetUnitY(u)
call T003_Add(function SpiraleFoudre.cycle, obj)
endfunction
endlibrary
//===========================================================================
function InitTrig_Spirale_foudre takes nothing returns nothing
endfunction
//TESH.scrollpos=56
//TESH.alwaysfold=0
library SpellBlizzardArach needs libSpellEffect
function BlizzardArach_Actions takes nothing returns nothing
local timer t = GetExpiredTimer()
local BlizzardArach obj = LInteger( GetHandleId(t), StringHash("BlizzardArach") )
local real x = LReal( GetHandleId(t), StringHash("Blizzard_x") )
local real y = LReal( GetHandleId(t), StringHash("Blizzard_y") )
local location loc = Location(x,y)
local unit dummy = CreateUnit( GetOwningPlayer(obj.caster), UNIT_BLIZZARD, x, y, 0.0 )
call IssuePointOrder( dummy, "attackground", x, y )
call UnitApplyTimedLife( dummy, 'BTLF', 0.6 )
call SetUnitTimeScalePercent( dummy, 200 )
call DmgToArea( loc, obj.caster, obj.dmg, 160.0, true )
call DestroyEffect( AddSpecialEffect( "Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl", x, y ) )
call RemoveLocation(loc)
call DestroyTimer(t)
if( obj.detruire ) then
set obj.detruire = false
call RemoveLocation(obj.loc)
call BlizzardArach.destroy(obj)
endif
endfunction
struct BlizzardArach extends Spell
integer duree = 10 // en nombre d'éclat
location loc
real dist = 110.0
real angle
boolean detruire = false
static method cycle takes nothing returns boolean
local thistype this = T025_GetData()
local timer t
local real x
local real y
local real da
local integer a = 0
set this.dist = this.dist + 80.0
loop
exitwhen a == 1
set t = CreateTimer()
set da = GetRandomReal( -bj_PI/10.0, bj_PI/10.0 )
set x = GetLocationX(this.loc) + this.dist * Cos(this.angle+da)
set y = GetLocationY(this.loc) + this.dist * Sin(this.angle+da)
call DestroyEffect( AddSpecialEffect( "Abilities\\Spells\\Human\\Blizzard\\BlizzardTarget.mdl", x, y ) )
call SInteger( this, GetHandleId(t), StringHash("BlizzardArach") )
call SReal( x, GetHandleId(t), SH("Blizzard_x") )
call SReal( y, GetHandleId(t), SH("Blizzard_y") )
call TimerStart( t, 1.0, false, function BlizzardArach_Actions )
set a = a + 1
endloop
if( this.dist > 800.0 ) then
set this.detruire = true
return true
endif
return false
endmethod
endstruct
function bArach_Blizzard takes nothing returns nothing
local BlizzardArach obj = BlizzardArach.create()
local location loc = GetUnitLoc(GetSpellTargetUnit())
set obj.caster = GetTriggerUnit()
set obj.loc = GetUnitLoc(obj.caster)
set obj.dmg = GetRandomReal(160,190)
set obj.angle = Atan2( GetLocationY(loc) - GetUnitY(obj.caster), GetLocationX(loc) - GetUnitX(obj.caster) )
call T025_Add(function BlizzardArach.cycle, obj)
call RemoveLocation(loc)
set loc = null
endfunction
//===========================================================================
function InitTrig_Blizzard_Arach takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=33
//TESH.alwaysfold=0
library SpellEclatLunaire needs libSpellEffect
globals
constant string EFFECT_ECLAT_LUNAIRE = "Abilities\\Spells\\NightElf\\Starfall\\StarfallTarget.mdl"
endglobals
struct EclatLunaire extends Spell
real dur = 0.8
real duree
integer flag = 0
real factDmg
static method cycle takes nothing returns boolean
local thistype this = T01_GetData()
if( this.flag == 1) then
if( ModuloReal( this.dur, 1.5 ) < 0.1 ) then // Dot
call DmgToUnit( this.caster, this.target, this.dmg*this.factDmg, true )
endif
if( this.dur > this.duree or IsUnitDeadBJ(this.target) ) then // Fin du sort
call EclatLunaire.destroy(this)
return true
endif
set this.dur = this.dur + 0.1
elseif( this.flag == 0) then // Dmg Direct
call DestroyEffect( AddSpecialEffectTarget( EFFECT_ECLAT_LUNAIRE, this.target, "origin") )
set this.dur = this.dur - 0.1
if( this.dur < 0.0 ) then
set this.dur = 0.1
set this.flag = 1
call DmgToUnit( this.caster, this.target, this.dmg, true )
endif
endif
return false
endmethod
endstruct
function bDrake_EclatLunaire takes nothing returns nothing
local EclatLunaire obj = EclatLunaire.create()
set obj.caster = GetSpellAbilityUnit()
set obj.target = GetSpellTargetUnit()
set obj.duree = 4.5
set obj.dmg = GetRandomReal(230, 250)
set obj.factDmg = 0.5
call T01_Add(function EclatLunaire.cycle, obj)
endfunction
endlibrary
//===========================================================================
function InitTrig_Eclat_Lunaire takes nothing returns nothing
endfunction
//TESH.scrollpos=71
//TESH.alwaysfold=0
library SpellVagueDeGlace needs libSpellEffect
globals
constant integer UNIT_VAGUE_DE_GLACE = 'h00E'
endglobals
type BlocGlace extends unit array [8]
struct VagueDeGlace extends Spell
group g = CreateGroup()
BlocGlace blocGlace
real dist = 0.0
real angle
static method cycle takes nothing returns boolean
local thistype this = T003_GetData()
local integer a = 0
local location loc
local real x
local real y
local group g
local unit u = null
set this.dist = this.dist + 18.0
set Cond.condUnite = this.caster
loop
exitwhen a == 8
if( GetUnitState( this.blocGlace[a], UNIT_STATE_LIFE) > 0 ) then
set x = GetUnitX(this.blocGlace[a])+18.0*Cos(this.angle+a*(Deg2Rad(9.0)))
set y = GetUnitY(this.blocGlace[a])+18.0*Sin(this.angle+a*(Deg2Rad(9.0)))
set loc = Location(x, y)
call SetUnitX( this.blocGlace[a], x)
call SetUnitY( this.blocGlace[a], y)
set g = GetUnitsInRangeOfLocMatching(120, loc, Condition(function Cond.EnnemiVar))
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit(g,u)
if( not IsUnitInGroup(u,this.g) ) then
call GroupAddUnit(this.g, u)
call KillUnit(this.blocGlace[a])
call Gel_Total( u, 2.50)
call DmgToUnit( this.caster, u, this.dmg, true)
set u = null
endif
exitwhen u == null
endloop
endif
set a = a + 1
endloop
if( this.dist > 600.0 ) then
set a = 0
loop
exitwhen a == 8
call KillUnit(this.blocGlace[a])
set a = a + 1
endloop
call this.blocGlace.destroy()
call DestroyGroup(this.g)
call VagueDeGlace.destroy(this)
return true
endif
return false
endmethod
endstruct
function bPanda_VagueDeGlace takes nothing returns nothing
//local VagueDeGlace obj = VagueDeGlace.create()
//local real x = GetUnitX(GetSpellAbilityUnit())
//local real y = GetUnitY(GetSpellAbilityUnit())
//local location loc = GetUnitLoc(GetSpellTargetUnit())
//local real angle = Atan2( GetLocationY(loc) - y, GetLocationX(loc) - x) - 4*Deg2Rad(9)
//local player p = GetOwningPlayer(GetSpellAbilityUnit())
//local integer a = 0
//set obj.caster = GetSpellAbilityUnit()
//set obj.angle = angle
//set obj.dmg = GetRandomReal(350, 390)
//set obj.blocGlace = BlocGlace.create()
//loop
//exitwhen a == 8
//set angle = angle + Deg2Rad(9)
//set obj.blocGlace[a] = CreateUnit( p, UNIT_VAGUE_DE_GLACE, x+90*Cos(angle), y+90*Sin(angle), Rad2Deg(angle) )
//call SetUnitScalePercent( obj.blocGlace[a], 120.0, 120.0, 120.0)
//set a = a + 1
//endloop
//call T003_Add(function VagueDeGlace.cycle, obj)
endfunction
endlibrary
//===========================================================================
function InitTrig_Vague_de_glace takes nothing returns nothing
endfunction
//TESH.scrollpos=6
//TESH.alwaysfold=0
library SpellHibernation needs libSpellEffect
globals
constant string EFFECT_HIBERNATION = "Abilities\\Spells\\Undead\\Sleep\\SleepTarget.mdl"
endglobals
struct Hibernation extends Spell
real duree = 15.0
effect e
static method cycle takes nothing returns boolean
local thistype this = T05_GetData()
call AddLife( this.caster, this.dmg)
call AddMana( this.caster, this.dmg/3.0)
set this.duree = this.duree - T05_PERIOD
if( this.duree < 0.0 or not IsUnitCanalisation(this.caster) ) then
call DestroyEffect(this.e)
call Hibernation.destroy(this)
return true
endif
return false
endmethod
endstruct
function bPanda_Hibernation takes nothing returns nothing
local Hibernation obj = Hibernation.create()
set obj.caster = GetSpellAbilityUnit()
set obj.dmg = 200.0
set obj.e = AddSpecialEffectTarget(EFFECT_HIBERNATION, obj.caster, "overhead")
call Canalisation(obj.caster)
call T05_Add( function Hibernation.cycle, obj)
endfunction
endlibrary
//===========================================================================
function InitTrig_Hibernation takes nothing returns nothing
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
library SpellCrystalDeGlace needs libSpellEffect
globals
constant integer UNIT_CRYSTAL_DE_GLACE = 'h01L'
constant string EFFECT_SOL_GELE = "Abilities\\Weapons\\FrostWyrmMissile\\FrostWyrmMissile.mdl"
endglobals
struct CrystalDeGlace extends Spell
real duree = 10.0
real x
real y
integer flag = 0
static method cycle takes nothing returns boolean
local thistype this = T05_GetData()
local location loc = null
if( this.flag == 0 ) then
call DestroyEffect( AddSpecialEffect(EFFECT_SOL_GELE, this.x-64, this.y+64))
call SetTerrainTimed( this.x-64, this.y+64, GLACE, 1, this.duree )
elseif( this.flag == 1 ) then
call DestroyEffect( AddSpecialEffect(EFFECT_SOL_GELE, this.x-64, this.y-64))
call SetTerrainTimed( this.x-64, this.y-64, GLACE, 1, this.duree )
elseif( this.flag == 2 ) then
call DestroyEffect( AddSpecialEffect(EFFECT_SOL_GELE, this.x+64, this.y-64))
call SetTerrainTimed( this.x+64, this.y-64, GLACE, 1, this.duree )
elseif( this.flag == 3 ) then
call DestroyEffect( AddSpecialEffect(EFFECT_SOL_GELE, this.x+64, this.y+64))
call SetTerrainTimed( this.x+64, this.y+64, GLACE, 1, this.duree )
elseif( this.flag == 4 ) then
set loc = Location(this.x, this.y)
call DmgToArea( loc, this.caster, this.dmg, GetRandomReal(320,360), true)
call RemoveLocation(loc)
call DestroyEffect( AddSpecialEffect( "Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl", this.x, this.y))
set this.target = CreateUnit( GetOwningPlayer(this.caster), UNIT_CRYSTAL_DE_GLACE, this.x, this.y, 320.0)
endif
set this.flag = this.flag + 1
set this.duree = this.duree - T05_PERIOD
if( this.duree < 0.0 ) then
set loc = Location(this.x, this.y)
call DmgToArea( loc, this.caster, this.dmg, GetRandomReal(360,420), true)
call RemoveLocation(loc)
call RemoveUnit(this.target)
call DestroyEffect( AddSpecialEffect( "Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl", this.x, this.y))
call CrystalDeGlace.destroy(this)
set loc = null
return true
endif
return false
endmethod
endstruct
function CreateCrystalDeGlace takes unit caster, real x, real y, real dmg returns nothing
local CrystalDeGlace obj = CrystalDeGlace.create()
set obj.caster = caster
set obj.x = Pos_Terrain(x)+64.0
set obj.y = Pos_Terrain(y)+64.0
set obj.dmg = dmg
call T05_Add(function CrystalDeGlace.cycle, obj)
endfunction
endlibrary
//===========================================================================
function InitTrig_Crystal_de_Glace takes nothing returns nothing
endfunction
//TESH.scrollpos=20
//TESH.alwaysfold=0
library SpellSautdAttaque needs libSpellEffect, SpellChocPsy
struct SautdAttaque extends Spell
static method cycle takes nothing returns boolean
local thistype this = T025_GetData()
if( GetUnitAbilityLevel(.caster, 'Arav') == 0) then
call Choc_Psy(.caster, .dmg)
call DestroyEffect(AddSpecialEffect(FOUDRE_EFFECT, GetUnitX(.caster), GetUnitY(.caster)) )
call SetUnitInvulnerable(.caster, false)
call SetUnitPathing( .caster, true)
call SetUnitAnimationByIndex( .caster, 4)
call PauseUnit(.caster, false)
call SautdAttaque.destroy(this)
return true
endif
return false
endmethod
endstruct
function bCrypte_SautdAttaque takes unit caster, location loc returns nothing
local SautdAttaque obj = SautdAttaque.create()
local real angle = Atan2( GetLocationY(loc) - GetUnitY(caster), GetLocationX(loc) - GetUnitX(caster))
local real x = GetUnitX(caster) - 100 * Cos(angle)
local real y = GetUnitY(caster) - 100 * Sin(angle)
local real dist = DistanceBetweenPointsEx( GetUnitX(caster), GetUnitY(caster), GetLocationX(loc), GetLocationY(loc))
call RemoveLocation(loc)
set loc = null
call Recul( x, y, caster, R2I(dist), 200., 20)
set obj.caster = caster
set obj.dmg = 200.0
call PauseUnit(caster, true)
call SetUnitInvulnerable(caster, true)
call SetUnitPathing( caster, false)
call SetUnitAnimationByIndex( caster, 6)
call T025_Add(function SautdAttaque.cycle, obj)
endfunction
endlibrary
//===========================================================================
function InitTrig_Saut_d_attaque takes nothing returns nothing
endfunction
//TESH.scrollpos=27
//TESH.alwaysfold=0
library SpellChargeSCryptes needs libSpellEffect, SpellAssomoir
globals
constant string EFFET_CHARGE_CIBLE = "Abilities\\Spells\\Undead\\Impale\\ImpaleHitTarget.mdl"
constant string EFFET_CHARGE = "Abilities\\Spells\\Undead\\Impale\\ImpaleMissTarget.mdl"
endglobals
struct ChargeScryptes extends Spell
boolean b = true
integer flag = 0
real xt
real yt
real duree = 0.0
group cibles = CreateGroup()
static method cycle takes nothing returns boolean
local thistype this = T003_GetData()
local real xc = GetUnitX(this.caster)
local real yc = GetUnitY(this.caster)
local real dist = DistanceBetweenPointsEx( xc, yc, this.xt, this.yt )
local real vit = 22.0
local location loc = null
local group g = null
local unit u = null
local real angle = Atan2( this.yt - GetUnitY(this.caster), this.xt - GetUnitX(this.caster) )
set this.duree = this.duree + T003_PERIOD
if( .flag == 0 ) then
if( this.duree > 0.9 ) then
call SetUnitInvulnerable( this.caster, true)
call SetUnitAnimationByIndex( this.caster, 9 )
set this.flag = 2
set this.duree = 0.0
endif
elseif( .flag == 2 ) then
set xc = xc + vit * Cos(angle)
set yc = yc + vit * Sin(angle)
call SetUnitX( this.caster, xc )
call SetUnitY( this.caster, yc )
if( this.duree > 0.12 ) then
call DestroyEffect( AddSpecialEffect( EFFET_CHARGE, xc, yc) )
set Cond.condUnite = this.caster
set loc = Location( xc, yc)
set g = GetUnitsInRangeOfLocMatching( 180, loc, Condition(function Cond.EnnemiVar) )
call RemoveLocation(loc)
set loc = null
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit(g,u)
if( not IsUnitInGroup(u, this.cibles) ) then
call GroupAddUnit(this.cibles,u)
call DmgToUnitEffect( this.caster, u, this.dmg*0.4, true, EFFET_CHARGE_CIBLE)
endif
endloop
call DestroyGroup(g)
set g = null
set this.duree = 0.0
endif
if( dist < 40 ) then
call SetUnitAnimationByIndex( this.caster, 7 )
set loc = Location( this.xt, this.yt)
call DmgToArea( loc, this.caster, this.dmg, 250, true)
call RemoveLocation(loc)
set loc = null
set this.flag = 3
set this.duree = 0.0
endif
elseif( this.flag == 3 ) then
if( this.duree > 0.9 ) then
call SetUnitInvulnerable( this.caster, false)
call SetUnitPathing( this.caster, true)
call PauseUnit( this.caster, false)
call DestroyGroup(this.cibles)
call ChargeScryptes.destroy(this)
return true
endif
endif
return false
endmethod
endstruct
function bCrypte_ChargeSCryptes takes nothing returns nothing
local ChargeScryptes obj = ChargeScryptes.create()
set obj.caster = GetTriggerUnit()
set obj.xt = GetUnitX(GetSpellTargetUnit())
set obj.yt = GetUnitY(GetSpellTargetUnit())
set obj.dmg = GetRandomReal(360,400)
call PauseUnit( obj.caster, true)
call SetUnitPathing( obj.caster, false)
call SetUnitAnimationByIndex( obj.caster, 8)
call T003_Add(function ChargeScryptes.cycle, obj)
endfunction
//===========================================================================
function InitTrig_Charge_SCryptes takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=51
//TESH.alwaysfold=0
library SpellInstabilite needs libSpellEffect
struct InstabiliteAme extends Spell
real dist = 0.0
real angle
lightning l
real x
real y
static method cycle takes nothing returns boolean
local thistype this = T003_GetData()
local real x = this.x + this.dist * Cos( this.angle )
local real y = this.y + this.dist * Sin( this.angle )
if( this.dist > 140.0 ) then
call InstabiliteAme.destroy(this)
call DestroyLightning( this.l )
return true
endif
set this.dist = this.dist + 20.0
call DestroyEffect( AddSpecialEffect( "Abilities\\Spells\\Orc\\LightningBolt\\LightningBoltMissile.mdl", x, y ) )
call MoveLightningEx( this.l, true, GetUnitX(.caster), GetUnitY(.caster), GetUnitZ(.caster)+Z_ECLAIR, x, y, Z_ECLAIR )
if ModuloReal( this.dist, 40.0) == 20.0 then
set udg_loc = Location(x,y)
call DmgToArea( udg_loc, .caster, .dmg, 110, false)
call RemoveLocation(udg_loc)
endif
return false
endmethod
endstruct
struct Instabilite extends Spell
real dur = 9.8
real x
real y
static method cycle takes nothing returns boolean
local thistype this = T025_GetData()
local InstabiliteAme obj = InstabiliteAme.create()
local real angle = GetRandomReal( 0, 2*bj_PI )
local real dist = GetRandomReal( 0, 175.0)
set this.dur = this.dur - 0.25
set obj.caster = .caster
set obj.dmg = .dmg
set obj.angle = GetRandomReal( 0, bj_PI*2 )
set obj.x = this.x + dist * Cos( angle ) // CosGetUnitX(this.caster) + dist * Cos( angle )
set obj.y = this.y + dist * Sin( angle ) // GetUnitY(this.caster) + dist * Sin( angle )
set obj.l = AddLightningEx( "CLPB", true, GetUnitX(.caster), GetUnitY(.caster), GetUnitZ(.caster)+Z_ECLAIR, obj.x, obj.y, Z_ECLAIR )
call T003_Add(function InstabiliteAme.cycle, obj)
if( GetUnitState( .caster, UNIT_STATE_LIFE ) <= 0.0 or .dur < 0.3) then
call Instabilite.destroy(this)
return true
endif
return false
endmethod
endstruct
function bGolemF_Instabilite takes nothing returns nothing
local Instabilite obj = Instabilite.create()
local location loc = GetSpellTargetLoc()
set obj.caster = GetTriggerUnit()
set obj.x = GetLocationX(loc)
set obj.y = GetLocationY(loc)
set obj.dmg = 50.0
call RemoveLocation(loc)
call T025_Add(function Instabilite.cycle, obj)
endfunction
//===========================================================================
function InitTrig_Instabilite takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=23
//TESH.alwaysfold=0
library SpellFissure needs libSpellEffect
globals
constant integer ID_FISSURE = 'h01O'
endglobals
struct Fissure extends Spell
unit u = null
real dist = 90.
real angle = 0.0
real x
real y
real duree = 15.0
boolean simple = true // true -> sort unité, false -> sort boss
real distMax = 800
static method cycleUnite takes nothing returns boolean
return Fissure.cycle(T01_GetData())
endmethod
static method cycleBoss takes nothing returns boolean
return Fissure.cycle(T003_GetData())
endmethod
static method cycle takes Fissure this returns boolean
local real x = .x + .dist * Cos(.angle)
local real y = .y + .dist * Sin(.angle)
call SetUnitX( .u, x)
call SetUnitY( .u, y)
if ModuloReal(.dist, 120.) == 0. then
set x = Pos_Terrain(x)
set y = Pos_Terrain(y)
call SEffect_Flamme( .caster, x, y, .dmg, .duree)
if( not .simple) then
call SetTerrainTimed( x, y, LAVE, 1, .duree )
endif
endif
set .dist = .dist + 15
if( .dist > .distMax) then
if( not .simple ) then
call KillUnit(.u)
endif
call Fissure.destroy(this)
return true
endif
return false
endmethod
endstruct
function bGolemF_Fissure takes nothing returns nothing
local Fissure obj = Fissure.create()
local location loc = GetSpellTargetLoc()
set obj.caster = GetSpellAbilityUnit()
set obj.dmg = 200.0
set obj.x = GetUnitX(obj.caster)
set obj.y = GetUnitY(obj.caster)
set obj.angle = Atan2( GetLocationY(loc) - obj.y, GetLocationX(loc) - obj.x )
set obj.u = CreateUnit( GetOwningPlayer(obj.caster), ID_FISSURE, obj.x, obj.y, Rad2Deg(obj.angle) )
set obj.distMax = 1200
set obj.simple = false
call RemoveLocation(loc)
set loc = null
call T003_Add(function Fissure.cycleBoss, obj)
endfunction
endlibrary
//===========================================================================
function InitTrig_Fissure takes nothing returns nothing
endfunction
//TESH.scrollpos=29
//TESH.alwaysfold=0
library SpellFoudreBleu needs libSpellEffect
globals
constant string EFFECT_FOUDRE_BLEU = "Doodads\\Cinematic\\TownBurningFireEmitterBlue\\TownBurningFireEmitterBlue.mdl"
constant string BUFF_FOUDRE_BLEU = "Abilities\\Spells\\Human\\Feedback\\SpellBreakerAttack.mdl"
endglobals
struct FoudreBleu extends Spell
real x
real y
real duree = 15.0
effect e1
effect e2
effect e3
static method cycle takes nothing returns boolean
local thistype this = T05_GetData()
local location loc = Location(.x,.y)
local group g = null
local unit u = null
set Cond.condUnite = .caster
set g = GetUnitsInRangeOfLocMatching(220, loc, Condition(function Cond.EnnemiVar))
call RemoveLocation(loc)
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit(g,u)
call AddMana(u, -50)
call DestroyEffect( AddSpecialEffectTarget(BUFF_FOUDRE_BLEU, u, "origin"))
endloop
set .duree = .duree - T05_PERIOD
call DestroyGroup(g)
set g = null
set loc = null
if( .duree < 0.0 ) then
call DestroyEffect(.e1)
call DestroyEffect(.e2)
call DestroyEffect(.e3)
call FoudreBleu.destroy(this)
return true
endif
return false
endmethod
endstruct
function bGolemF_FoudreBleu takes nothing returns nothing
local FoudreBleu obj = FoudreBleu.create()
local unit u = GetSpellTargetUnit()
local real x = GetUnitX(u)
local real y = GetUnitY(u)
set obj.caster = GetSpellAbilityUnit()
set obj.dmg = 200.0
set obj.x = x
set obj.y = y
set obj.e1 = AddSpecialEffect( EFFECT_FOUDRE_BLEU, x+80*Cos(bj_PI*2/3), y+80*Sin(bj_PI*2/3))
set obj.e2 = AddSpecialEffect( EFFECT_FOUDRE_BLEU, x+80*Cos(bj_PI/3), y+80*Sin(bj_PI/3))
set obj.e3 = AddSpecialEffect( EFFECT_FOUDRE_BLEU, x+80*Cos(-bj_PI/2), y+80*Sin(-bj_PI/2))
call SEffect_Foudre( obj.caster, x, y, GetRandomReal(160, 200), 220 )
call T05_Add(function FoudreBleu.cycle, obj)
endfunction
endlibrary
//===========================================================================
function InitTrig_Foudre_Bleu takes nothing returns nothing
endfunction
//TESH.scrollpos=12
//TESH.alwaysfold=0
library SpellBouleExplosive needs libSpellEffect
struct FireBallDmg extends Spell
real duree = 5.0
location loc = null
static method cycle takes nothing returns boolean
local thistype this = T05_GetData()
call DmgToArea( .loc, .caster, .dmg, .220, true)
set .duree = .duree - T05_PERIOD
if( .duree < 0.0 ) then
call RemoveLocation(.loc)
call this.destroy()
return false
endif
return true
endmethod
endstruct
function BouleExplosive_Actions takes nothing returns nothing
local unit target = GetTriggerUnit()
local unit caster = GetEventDamageSource()
local real x = GetUnitX(target)
local real y = GetUnitY(target)
local integer a = 1
local FireBallDmg fireBall = FireBallDmg.create()
// Damage of the fireball on duration
set fireBall.loc = Location(x, y)
set fireBall.dmg = 350.0
set fireBall.caster = caster
// Fire effect on the ground
call Effect(FLAMME_EFFECT, x, y, 5.0)
loop
exitwhen a > 5
call Effect(FLAMME_EFFECT, x+AOE_FLAMME*Cos(Deg2Rad(a*72)), y+AOE_FLAMME*Sin(Deg2Rad(a*72)), 5.0)
set a = a + 1
endloop
// Cleaning
call DestroyTrigger(GetTriggeringTrigger())
call RHandle( GetHandleId(target), KEY_CASTER )
endfunction
function bSorciere_Bouledefeu takes nothing returns nothing
local trigger t = CreateTrigger()
local unit caster = GetSpellAbilityUnit()
call SUnit( caster, GetHandleId(GetSpellTargetUnit()), KEY_CASTER)
call TriggerAddAction( t, function BouleExplosive_Actions )
call TriggerRegisterUnitEvent( t, GetSpellTargetUnit() , EVENT_UNIT_DAMAGED )
call TriggerAddCondition(t, Condition( function Dgts_Conditions ) )
endfunction
endlibrary
//===========================================================================
function InitTrig_Boule_de_feu takes nothing returns nothing
endfunction
//TESH.scrollpos=9
//TESH.alwaysfold=0
library SpellDissuasion needs libSpellEffect
globals
constant integer UNIT_DISSUASION = 'h019'
constant string EFFECT_DISSUASION = "Abilities\\Spells\\Orc\\Disenchant\\DisenchantSpecialArt.mdl"
constant integer KS_DISSUASION = StringHash("spell__dissuasion")
endglobals
type ameDissuasion extends unit array [3]
struct Dissuasion extends Spell
trigger t = CreateTrigger()
real dur = 10.0
real dist = 130.0
real angle
ameDissuasion ames
integer flag = 0 // 0:circle, 1:charge, 2: charge apres explo
static method ChangeFlag takes nothing returns nothing
local Dissuasion obj = LInteger( GetHandleId(GetTriggeringTrigger()), KS_DISSUASION)
set obj.flag = 1
endmethod
static method cycle takes nothing returns boolean
local thistype this = T003_GetData()
local integer a = 0
local real x
local real y
local unit u
local real dist
local real angle
set this.dur = this.dur - T003_PERIOD
if( this.dur < 0.0 or GetUnitState(this.target, UNIT_STATE_LIFE) <= 0.0 ) then
loop
exitwhen a == ameDissuasion.size
call KillUnit(this.ames[a])
set a = a + 1
endloop
call RInteger( GetHandleId(this.t), KS_DISSUASION)
call RInteger( GetHandleId(this.target), KS_DISSUASION)
call DestroyTrigger(this.t)
call Dissuasion.destroy(this)
return true
endif
if( this.flag == 0 ) then
set this.angle = this.angle + Deg2Rad(8.0)
loop
exitwhen a == ameDissuasion.size
set x = GetUnitX(this.target) + this.dist * Cos((a*((bj_PI*2)/3))+this.angle)
set y = GetUnitY(this.target) + this.dist * Sin((a*((bj_PI*2)/3))+this.angle)
call SetUnitX( this.ames[a], x )
call SetUnitY( this.ames[a], y )
set a = a + 1
endloop
else
loop
exitwhen a == ameDissuasion.size
set angle = (a*((bj_PI*2)/3))+this.angle
set x = GetUnitX(this.target) - this.dist * Cos(angle)
set y = GetUnitY(this.target) - this.dist * Sin(angle)
set dist = DistanceBetweenPointsEx( GetUnitX(this.ames[a]), GetUnitY(this.ames[a]), x, y)
if( dist < this.dist and this.flag == 1 ) then
set this.flag = 2
call DmgToUnit( this.caster, this.target, this.dmg, true)
call DestroyEffect( AddSpecialEffect( EFFECT_DISSUASION, GetUnitX(this.target), GetUnitY(this.target)) )
elseif( dist > this.dist and this.flag == 2) then
set this.flag = 0
set this.angle = this.angle + bj_PI
endif
if( this.flag != 0 ) then
set x = GetUnitX(this.ames[a]) - 18.0 * Cos(angle)
set y = GetUnitY(this.ames[a]) - 18.0 * Sin(angle)
endif
call SetUnitX( this.ames[a], x )
call SetUnitY( this.ames[a], y )
set a = a + 1
endloop
endif
return false
endmethod
endstruct
function Dissuasion_Actions takes unit caster, unit target, real dmg, real dur returns nothing
local Dissuasion obj = LInteger( GetHandleId(target), KS_DISSUASION )
local integer a = 0
local real x
local real y
local real angle = (bj_PI*2) / 3.0
if( obj == 0 ) then
set obj = Dissuasion.create()
set obj.ames = ameDissuasion.create()
set obj.target = target
call SInteger( obj, GetHandleId(obj.target), KS_DISSUASION )
set obj.angle = angle
loop
exitwhen a == ameDissuasion.size
set angle = Deg2Rad(I2R(a)*120)
set x = GetUnitX(obj.target) + obj.dist * Cos(angle)
set y = GetUnitY(obj.target) + obj.dist * Sin(angle)
set obj.ames[a] = CreateUnit( GetOwningPlayer(GetSpellAbilityUnit()), UNIT_DISSUASION, x, y, Rad2Deg(angle)+90.0 )
set a = a + 1
endloop
call SInteger( obj, GetHandleId(obj.t), KS_DISSUASION )
call SUnit( obj.target, GetHandleId(obj.t), KEY_TARGET)
call TriggerRegisterAnyUnitEventBJ( obj.t, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( obj.t, Condition( function Cond.AttaquantTarget ))
call TriggerAddAction( obj.t, function Dissuasion.ChangeFlag )
call T003_Add(function Dissuasion.cycle, obj)
endif
set obj.caster = caster
set obj.dmg = dmg
set obj.dur = dur
endfunction
function bSorciere_Dissuasion takes nothing returns nothing
call Dissuasion_Actions( GetSpellAbilityUnit(), GetSpellTargetUnit(), GetRandomReal(350., 450.), 8.0)
endfunction
//===========================================================================
function InitTrig_Dissuasion takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=27
//TESH.alwaysfold=0
library SpellVagueMeteores needs libSpellEffect
globals
constant string EFFECT_VAGUE_METEORES = "Abilities\\Weapons\\RedDragonBreath\\RedDragonMissile.mdl"
endglobals
struct VagueMeteores extends Spell
Reels pts // index pair: x, index impair: y
real duree = 0.0
integer i = 0
integer nbMeteores = 0
real angle = bj_PI/2.
real dist = 220.
boolean fireEffect = true
static method cycle takes nothing returns boolean
local thistype this = T003_GetData()
local integer a = 0
local real x = 0.
local real y = 0.
local boolean b = false
set .dist = .dist - 2
set .angle =.angle - 14.0 / .dist
set .duree = .duree + T003_PERIOD
// Nouveau météore
if( .duree < .nbMeteores*T003_PERIOD*12 and ModuloReal( .duree, T003_PERIOD*12) == T003_PERIOD ) then
set .i = .i + 1
endif
// Avertisseurs en spirale
loop
exitwhen a == .i
if( .dist + a * 12 * 2 > 0 ) then
if( .fireEffect ) then
set .fireEffect = false
set x = .pts[a * 2] + (.dist + a * 12 * 2) * Cos(.angle)
set y = .pts[a * 2 + 1] + (.dist + a * 12 * 2) * Sin(.angle)
call DestroyEffect( AddSpecialEffect( EFFECT_VAGUE_METEORES, x, y) )
else
set .fireEffect = true
endif
elseif( .dist + a*12*2 == -2) then
call SEffect_Meteor( .caster, .pts[a*2], .pts[a*2+1], .dmg, true, 270.)
if( a == .i-1) then
set b = true
endif
endif
set a = a + 1
endloop
if( b ) then
call VagueMeteores.destroy(this)
return true
endif
return false
endmethod
endstruct
//==========
// nbmeteores: valeur max : 10
//==========
function VagueMeteores_Actions takes unit caster, real x, real y, real dmg, integer nbmeteores returns nothing
local VagueMeteores obj = VagueMeteores.create()
local integer a = 0
if( nbmeteores > 10 ) then
set nbmeteores = 10
endif
loop
exitwhen a == nbmeteores
set udg_loc = GetRandomLoc(x, y, 350)
set obj.pts[a*2] = GetLocationX(udg_loc)
set obj.pts[a*2+1] = GetLocationY(udg_loc)
call RemoveLocation(udg_loc)
set a = a + 1
endloop
set obj.caster = caster
set obj.dmg = dmg
set obj.nbMeteores = nbmeteores
call T003_Add(function VagueMeteores.cycle, obj)
endfunction
endlibrary
//===========================================================================
function InitTrig_VagueMeteores takes nothing returns nothing
endfunction
//TESH.scrollpos=27
//TESH.alwaysfold=0
library SpellMEssaimPutride needs libSpellEffect
globals
constant integer UNITE_ESSAIM = 'h016'
endglobals
struct MEssaimPutride extends Spell
integer duree = 5
real angle = Deg2Rad(105.0)
static method cycle takes nothing returns boolean
local thistype this = T025_GetData()
local real x = GetUnitX(this.caster)
local real y = GetUnitY(this.caster)
local unit u = CreateUnit( GetOwningPlayer(this.caster), UNITE_ESSAIM, x, y, 0.0 )
call UnitApplyTimedLife( u, 'BTLF', 3.00 )
call IssuePointOrder(u, "carrionswarm", x + 400 * Cos(this.angle), y + 400 * Sin(this.angle) )
call SEffect_Souffle( u, this.angle, 400.0, 450.0, this.dmg, true)
set u = CreateUnit( GetOwningPlayer(this.caster), UNITE_ESSAIM, x, y, 0.0 )
call UnitApplyTimedLife( u, 'BTLF', 3.0 )
call IssuePointOrder(u, "carrionswarm", x + 400 * Cos(-this.angle+bj_PI), y + 400 * Sin(-this.angle+bj_PI) )
call SEffect_Souffle( u, -this.angle+bj_PI, 400.0, 450.0, this.dmg, true)
set this.duree = this.duree - 1
set this.angle = this.angle + Deg2Rad(30.0)
if( this.duree < 0 ) then
call MEssaimPutride.destroy(this)
return true
endif
return false
endmethod
endstruct
function b8MassEssaimPutride takes nothing returns nothing
local MEssaimPutride obj = MEssaimPutride.create()
set obj.caster = GetTriggerUnit()
set obj.dmg = GetRandomReal(280.0,320.0)
call T025_Add(function MEssaimPutride.cycle, obj)
endfunction
//===========================================================================
function InitTrig_Cercle_Essaim_Putride takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=21
//TESH.alwaysfold=0
library SpellInvocOrcSquel needs libSpellEffect
globals
constant integer ID_ORCSQUEL = 'nsko'
endglobals
struct InvocOrcSquel extends Spell
real duree = 15.0
effect e
static method cycle takes nothing returns boolean
local thistype this = T1_GetData()
local location loc = GetRandomLoc( GetUnitX(this.caster), GetUnitY(this.caster), 1000 )
local unit u = CreateUnitAtLoc( GetOwningPlayer(this.caster), ID_ORCSQUEL, loc, GetRandomReal( 0, 360) )
call RemoveLocation(loc)
set loc = GetUnitLoc(GroupPickRandomUnit(udg_Heros_vivant))
call IssuePointOrder( u, "attack", GetLocationX(loc), GetLocationY(loc))
call UnitAddType( u, UNIT_TYPE_SUMMONED )
call RemoveLocation(loc)
set loc = null
set u = null
set this.duree = this.duree - T1_PERIOD
if( this.duree < 0.0 or not IsUnitCanalisation(this.caster) ) then
call DestroyEffect(this.e)
call InvocOrcSquel.destroy(this)
return false
endif
return true
endmethod
endstruct
function b13InvocOrcSquel takes nothing returns nothing
local InvocOrcSquel obj = InvocOrcSquel.create()
set obj.caster = GetSpellAbilityUnit()
set obj.dmg = 300.0
set obj.e = AddSpecialEffectTarget("Abilities\\Spells\\Undead\\Unsummon\\UnsummonTarget.mdl", obj.caster, "origin")
call Canalisation(obj.caster)
call T1_Add(function InvocOrcSquel.cycle, obj)
endfunction
endlibrary
//===========================================================================
function InitTrig_Invoc_OrcSquel takes nothing returns nothing
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
library SpellPluieEtoile needs libSpellEffect
struct PluieEtoile extends Spell
real angle
real dist = 0.0
real x
real y
integer flag = 0
static method cycle takes nothing returns boolean
local thistype this = T01_GetData()
if( this.dist > 200.0 ) then
set this.flag = this.flag + 1
set this.x = this.x + this.dist * Cos(this.angle)
set this.y = this.y + this.dist * Sin(this.angle)
call SEffect_Pluie( this.caster, this.x, this.y, this.dmg, true, EFFECT1_SOUVENIR_ASTRAL , EFFECT2_SOUVENIR_ASTRAL, 0.9, 220.0 )
set this.dist = 0.0
if( this.flag == 3 ) then
call PluieEtoile.destroy(this)
return true
endif
endif
set this.dist = this.dist + 75.0
return false
endmethod
endstruct
function laPluieEtoile takes nothing returns nothing
local PluieEtoile obj = PluieEtoile.create()
local location loc = GetSpellTargetLoc()
local real lvl = GetSpellLvl()
set obj.caster = GetSpellAbilityUnit()
set obj.x = GetUnitX(obj.caster)
set obj.y = GetUnitY(obj.caster)
set obj.angle = Atan2( GetLocationY(loc) - obj.y, GetLocationX(loc) - obj.x )
set obj.dmg = GetHeroInt(obj.caster,true)* R2I((lvl+1)/2) + 40 * lvl
call T01_Add(function PluieEtoile.cycle, obj)
call RemoveLocation(loc)
set loc = null
endfunction
//===========================================================================
function InitTrig_Pluie_d_etoiles takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
function lbBrumeCeleste takes nothing returns nothing
local unit caster = GetSpellAbilityUnit()
local real lvl = GetSpellLvl()
local real duree = 15 + I2R(GetHeroInt(caster,true))/20.0
local location loc = GetSpellTargetLoc()
local unit u = CreateUnit( GetOwningPlayer(caster), 'u007', GetLocationX(loc), GetLocationY(loc), 0.0 )
call UnitApplyTimedLife(u, 'CLPB', duree)
call SetUnitAbilityLevel( u, 'A04D', R2I(lvl))
call RemoveLocation(loc)
set loc = null
set u = null
set caster = null
endfunction
//===========================================================================
function InitTrig_Brume_Celeste takes nothing returns nothing
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function lcProtectionStellaire takes nothing returns nothing
local unit caster = GetSpellAbilityUnit()
local real lvl = GetSpellLvl()
local real duree = 20 + I2R(GetHeroInt(caster,true))/40.0
local location loc = GetSpellTargetLoc()
local unit u = CreateUnit( GetOwningPlayer(caster), 'u008', GetLocationX(loc), GetLocationY(loc), 0.0 )
call UnitApplyTimedLife(u, 'CLPB', duree)
call SetUnitAbilityLevel( u, 'A04J', R2I(lvl))
call RemoveLocation(loc)
set loc = null
set u = null
set caster = null
endfunction
//===========================================================================
function InitTrig_Protection_Stellaire takes nothing returns nothing
endfunction
function ldSanctuaireAstre takes nothing returns nothing
local unit caster = GetSpellAbilityUnit()
local real lvl = GetSpellLvl()
local real duree = 20 + I2R(GetHeroInt(caster,true))/40.0
local location loc = GetSpellTargetLoc()
local unit u = CreateUnit( GetOwningPlayer(caster), 'u006', GetLocationX(loc), GetLocationY(loc), 0.0 )
call UnitApplyTimedLife(u, 'CLPB', duree)
call SetUnitAbilityLevel( u, 'A049', R2I(lvl))
call RemoveLocation(loc)
set loc = null
set u = null
set caster = null
endfunction
//===========================================================================
function InitTrig_Sanctuaire_des_Astres takes nothing returns nothing
endfunction
//TESH.scrollpos=81
//TESH.alwaysfold=0
library SpellSouvenirAstral needs libSpellEffect
globals
constant integer UNITE_SOUVENIR_ASTRAL = 'h015'
constant string EFFECT1_SOUVENIR_ASTRAL = "Abilities\\Spells\\NightElf\\Starfall\\StarfallTarget.mdl"
constant string EFFECT2_SOUVENIR_ASTRAL = "Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl"
constant string EFFECT_SOUVENIR_ASTRAL = "SouvenirAstral.mdl"
endglobals
struct SouvenirAstral extends Spell
unit u1
unit u2
real dist
real x
real y
real angle
real lvl
static method cycle takes nothing returns boolean
local thistype this = T003_GetData()
local real dist
local real r
local real angle
local Dgts_Commun dgts
local location loc
local group g
local unit u
if( ModuloReal( this.dist, 60.0 ) < 3.0 and this.dist>100.0 ) then
set r = (0.96/0.03)
set dist = this.dist - r * 3.0
set angle = this.angle - r * 20.0 / this.dist
call SEffect_Pluie( this.caster, this.x + dist * Cos(angle) , this.y + dist * Sin(angle), this.dmg, true, EFFECT1_SOUVENIR_ASTRAL , EFFECT2_SOUVENIR_ASTRAL, 0.9, 250 )
call SEffect_Pluie( this.caster, this.x + dist * Cos(angle+bj_PI), this.y + dist * Sin(angle+bj_PI), this.dmg, true, EFFECT1_SOUVENIR_ASTRAL , EFFECT2_SOUVENIR_ASTRAL, 0.9, 250 )
endif
if( this.dist < 60.0 ) then
set Cond.condUnite = this.caster
set loc = Location(this.x,this.y)
set g = GetUnitsInRangeOfLocMatching(550, loc, Condition(function Cond.EnnemiVar) )
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit(g,u)
if( GetUnitState( u, UNIT_STATE_MANA ) > 0 ) then
call DmgToUnit( this.caster, u, GetUnitState( u, UNIT_STATE_MANA) * (this.lvl*0.12), true)
call AddMana( u, - (GetUnitState( u, UNIT_STATE_MANA) * (this.lvl*0.12)) )
else
call DmgToUnit( this.caster, u, GetUnitState( u, UNIT_STATE_LIFE) * (this.lvl*0.06), true )
endif
endloop
call DestroyEffect( AddSpecialEffect( EFFECT_SOUVENIR_ASTRAL , this.x, this.y) )
call DestroyGroup(g)
call RemoveLocation(loc)
set loc = null
set g = null
call KillUnit(this.u1)
call KillUnit(this.u2)
call SouvenirAstral.destroy(this)
return true
endif
set this.dist = this.dist - 3.0
set this.angle = this.angle - 20.0 / this.dist
call SetUnitX(this.u1, this.x + this.dist * Cos(this.angle) )
call SetUnitY(this.u1, this.y + this.dist * Sin(this.angle) )
call SetUnitX(this.u2, this.x + this.dist * Cos(bj_PI+this.angle) )
call SetUnitY(this.u2, this.y + this.dist * Sin(bj_PI+this.angle) )
return false
endmethod
endstruct
function leSouvenirAstral takes nothing returns nothing
local integer lvl = GetSpellLvl()
local location loc = GetSpellTargetLoc()
local real x = GetLocationX(loc)
local real y = GetLocationY(loc)
local SouvenirAstral obj = SouvenirAstral.create()
call RemoveLocation(loc)
set loc = null
set obj.caster = GetSpellAbilityUnit()
set obj.lvl = GetSpellLvl()
set obj.x = x
set obj.y = y
set obj.u1 = CreateUnit( GetOwningPlayer(obj.caster), UNITE_SOUVENIR_ASTRAL, x + 550 * Cos(bj_PI/3), y + 550 * Sin(bj_PI/3), 0 )
set obj.u2 = CreateUnit( GetOwningPlayer(obj.caster), UNITE_SOUVENIR_ASTRAL, x + 550 * Cos(bj_PI+bj_PI/3), y + 550 * Sin(bj_PI+bj_PI/3), 0 )
set obj.dist = 550.0
set obj.angle = bj_PI/3
set obj.dmg = GetHeroInt( obj.caster, true) * (obj.lvl+1)
call SetUnitColor( obj.u1, PLAYER_COLOR_LIGHT_BLUE )
call SetUnitColor( obj.u2, PLAYER_COLOR_LIGHT_BLUE )
call T003_Add(function SouvenirAstral.cycle, obj)
endfunction
//===========================================================================
function InitTrig_Souvenir_Astral takes nothing returns nothing
call Preload(EFFECT1_SOUVENIR_ASTRAL)
call Preload(EFFECT2_SOUVENIR_ASTRAL)
call Preload(EFFECT_SOUVENIR_ASTRAL)
endfunction
endlibrary
//TESH.scrollpos=9
//TESH.alwaysfold=0
library SpellSacrificeSylvestre needs libSpellEffect
struct SacrificeSylvestre extends Spell
real duree = 10.0
static method cycle takes nothing returns boolean
local thistype this = T025_GetData()
call AddLife(this.caster, this.dmg)
set this.duree = this.duree - 0.25
if( this.duree < 0.0 or GetUnitState(this.caster, UNIT_STATE_LIFE) < 1) then
call SacrificeSylvestre.destroy(this)
return true
endif
return false
endmethod
endstruct
function aaSacrificeSylvestre takes nothing returns nothing
local SacrificeSylvestre obj = SacrificeSylvestre.create()
local integer lvl = GetSpellLvl()
set obj.caster = GetSpellAbilityUnit()
set obj.dmg = (lvl * 60 + GetHeroAgi(obj.caster, true) * 5 + 20) / (obj.duree*4.0)
call T025_Add(function SacrificeSylvestre.cycle, obj)
endfunction
endlibrary
//===========================================================================
function InitTrig_Sacrifice_Sylvestre takes nothing returns nothing
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
library SpellEnchantedForest needs libSpellEffect
globals
constant integer UNIT_ENCHANTED_FOREST = 'n006'
integer array UNIT_ENT_EF
constant integer KS_ENCHANTED_FOREST = StringHash("spell__enchantedforest")
endglobals
struct EnchantedForest extends Spell
real duree = 0.0
real interval = 0.0
timer action = CreateTimer()
timer anim = CreateTimer()
unit foret = null
integer lvl
static method EndAnim takes nothing returns nothing
local timer t = GetExpiredTimer()
local EnchantedForest obj = LInteger(GetHandleId(t), KS_ENCHANTED_FOREST)
call SetUnitTimeScalePercent( obj.foret, 80.0-obj.lvl)
call Flush( GetHandleId(t) )
call DestroyTimer(t)
set t = null
endmethod
static method Actions takes nothing returns nothing
local EnchantedForest obj = LInteger(GetHandleId(GetExpiredTimer()), KS_ENCHANTED_FOREST)
call obj.cycle()
endmethod
method cycle takes nothing returns boolean
local unit u = null
local location loc = null
local real angle = 0.0
if( not IsUnitHidden(this.caster) ) then
set u = CreateUnit(GetOwningPlayer(this.caster), UNIT_ENT_EF[.lvl-1], GetUnitX(this.foret)+200*Cos(bj_PI/3+bj_PI), GetUnitY(this.foret)+200*Sin(bj_PI/3+bj_PI), 270)
set loc = GetUnitRallyPoint(this.foret)
set angle = Atan2(GetLocationY(loc) - GetUnitY(this.foret), GetLocationX(loc) - GetUnitX(this.foret) )
call UnitAddType( u, UNIT_TYPE_SUMMONED)
call UnitApplyTimedLife( u, 'BTLF', 12)
if( loc != null ) then
call SetUnitPosition( u, GetUnitX(this.foret)+200*Cos(angle), GetUnitY(this.foret)+200*Sin(angle) )
call IssuePointOrderLoc( u, "attack", loc)
call RemoveLocation(loc)
set loc = null
endif
set u = null
set this.duree = this.duree - this.interval
if( this.duree < 0.0 or GetUnitState( .foret, UNIT_STATE_LIFE) <= 0.) then
call KillUnit(this.foret)
call DestroyTimer(this.action)
call DestroyTimer(this.anim)
call EnchantedForest.destroy(this)
return false
endif
endif
return true
endmethod
endstruct
function abEnchantedForest takes nothing returns nothing
local EnchantedForest obj = EnchantedForest.create()
local unit caster = GetSpellAbilityUnit()
local location loc = GetSpellTargetLoc()
local real xt = GetLocationX(loc)
local real yt = GetLocationY(loc)
local integer lvl = GetSpellLvl()
call RemoveLocation(loc)
set obj.caster = caster
set obj.duree = 30 + GetHeroInt(caster, true)/5
set obj.interval = 5 - lvl * 0.5
set obj.lvl = lvl
set obj.foret = CreateUnit( GetOwningPlayer(caster), UNIT_ENCHANTED_FOREST, xt, yt, 0)
call SetUnitTimeScalePercent( obj.foret, 600.0)
call SInteger( obj, GetHandleId(obj.action), KS_ENCHANTED_FOREST)
call TimerStart( obj.action, obj.interval, true, function EnchantedForest.Actions)
call UnitApplyTimedLife( obj.foret, 'BTLF', obj.duree+obj.interval+0.5 )
call SInteger( obj, GetHandleId(obj.anim), KS_ENCHANTED_FOREST )
call TimerStart( obj.anim, 3.0, false, function EnchantedForest.EndAnim)
set loc = null
set caster = null
endfunction
endlibrary
//===========================================================================
function InitTrig_Enchanted_Forest takes nothing returns nothing
set UNIT_ENT_EF[0] = 'e002'
set UNIT_ENT_EF[1] = 'e00A'
set UNIT_ENT_EF[2] = 'e00B'
set UNIT_ENT_EF[3] = 'e00C'
set UNIT_ENT_EF[4] = 'e00D'
set UNIT_ENT_EF[5] = 'e00E'
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function End_Metamorphosis takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = LUnit( GetHandleId(t), KEY_CASTER)
local integer flag = LInteger( GetHandleId(t), StringHash("flag"))
if( GetPlayerState(GetOwningPlayer(u), PLAYER_STATE_RESOURCE_LUMBER) >= 1 ) then
call UnitAddAbility( u, BONUS_STATS_ACTIF )
else
call UnitAddAbility( u, BONUS_STATS )
endif
if flag == 0 then
call SInteger( 1, GetHandleId(t), StringHash("flag"))
call TimerStart( t, 60.5, false, function End_Metamorphosis)
else
call Flush( GetHandleId(t))
call DestroyTimer(t)
endif
set t = null
endfunction
function aeMetamorphosis takes nothing returns nothing
local unit caster = GetSpellAbilityUnit()
local timer t = CreateTimer()
call SUnit( caster, GetHandleId(t), KEY_CASTER)
call SInteger( 0, GetHandleId(t), StringHash("flag") )
call TimerStart( t, 1.8, false, function End_Metamorphosis)
endfunction
//===========================================================================
function InitTrig_Metamorphose takes nothing returns nothing
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Frappe_Ancien_Actions takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local integer m = GetHandleId(t)
local unit ancien = LUnit(m, KEY_CASTER)
local unit u = LUnit(m, StringHash("Cible1"))
local real xc = GetUnitX(ancien)
local real yc = GetUnitY(ancien)
local real x
local real y
local integer a = 1
local real angle
call DestroyTrigger(t)
loop
exitwhen u == null
set x = GetUnitX(u)
set y = GetUnitY(u)
set angle = ModuloReal(Atan2(y - yc, x - xc ) - Deg2Rad(60), 2*bj_PI)
call Recul( x+20*Cos(angle), y+20*Sin(angle), u, GetRandomInt(280,380), GetRandomReal(100,140), GetRandomInt(18,22) )
call DmgToUnit( ancien, u, 40, true)
call DestroyEffect( AddSpecialEffectTarget( "Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl", u, "origin") )
set a = a + 1
set u = LUnit( m, StringHash("Cible"+I2S(a)))
endloop
call Flush(m)
set t = null
endfunction
function Frappe_Ancien takes nothing returns nothing
local unit ancien = GetAttacker()
local unit target = GetTriggerUnit()
local real xt = GetUnitX(target)
local real yt = GetUnitY(target)
local group cibles = GetUnitsInRangeOfLocMatching( 320, GetUnitLoc(ancien), Condition(function Cond_Groupe_Allie) )
local integer nb_unit = CountUnit(cibles)
local integer a = 1
local integer inc = 1
local real angle = ModuloReal(Rad2Deg(Atan2(yt - GetUnitY(ancien), xt - GetUnitX(ancien) )) - 40, 360 )
local unit u
local trigger t = CreateTrigger()
local integer m = GetHandleId(t)
loop
exitwhen a > nb_unit
set u = FirstOfGroup( cibles)
call GroupRemoveUnit( cibles, u)
if( UnitInInterval( 90, angle, GetUnitX(ancien), GetUnitY(ancien), u)) then
call SUnit( u, m, StringHash("Cible"+I2S(inc)))
set inc = inc + 1
endif
set a = a + 1
endloop
call SUnit( ancien, m, KEY_CASTER )
call TriggerAddAction( t, function Frappe_Ancien_Actions )
call TriggerAddCondition( t, Condition(function Dgts_Caster_Conditions) )
call TriggerRegisterUnitEvent( t, target , EVENT_UNIT_DAMAGED )
endfunction
function Init_Frappe_Ancien takes unit ancien returns nothing
local trigger t = CreateTrigger()
call SUnit( ancien, GetHandleId(t), KEY_CASTER)
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( t, Condition(function Attaquant_Caster_Conditions) )
call TriggerAddAction( t, function Frappe_Ancien )
endfunction
//===========================================================================
function InitTrig_Frappe_Ancien takes nothing returns nothing
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
library SpellBalayage needs libSpellEffect
struct Balayage extends Spell
real dist = 50.0
real range
real angle
real angleFin
lightning l
integer i = 2
Dgts_Commun dgts
static method cycle takes nothing returns boolean
local thistype this = T003_GetData()
local real semiDist = this.dist/2
local real x = GetUnitX(this.caster) + this.dist * Cos( this.angle )
local real y = GetUnitY(this.caster) + this.dist * Sin( this.angle )
local real x2 = GetUnitX(this.caster) + semiDist * Cos( this.angle )
local real y2 = GetUnitY(this.caster) + semiDist * Sin( this.angle )
local group g
local location loc
local unit u = null
set .i = .i + 1
if( .i == 5 ) then
set .i = 0
set loc = GetUnitLoc( this.caster )
set g = GetUnitsInRangeOfLocMatching( this.dist, loc, And(Condition(function Cond.Alive), Not(Condition(function Cond.Structure))) )
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit( g, u)
if( IsUnitEnemy( u, GetOwningPlayer(this.caster) ) and UnitInInterval( 10, Rad2Deg(this.angle), GetUnitX(this.caster), GetUnitY(this.caster), u ) ) then
if( this.dgts.DmgUnit(u) ) then
call DestroyEffect( AddSpecialEffect("Abilities\\Weapons\\Bolt\\BoltImpact.mdl", GetUnitX(u), GetUnitY(u) ) )
endif
endif
endloop
call RemoveLocation(loc)
call DestroyGroup(g)
endif
call DestroyEffect( AddSpecialEffect( "Abilities\\Spells\\Orc\\LightningBolt\\LightningBoltMissile.mdl", x, y ) )
call MoveLightningEx( this.l, true, GetUnitX(this.caster) + 80 * Cos(this.angle), GetUnitY(this.caster) + 80 * Sin(this.angle), 120.0, x, y, Z_ECLAIR )
set this.angle = this.angle - Deg2Rad(4.0)
if( this.angle > this.angleFin ) then
if( this.dist < this.range ) then
set this.dist = this.dist + 25.0
endif
else
if( this.dist > 50.0 ) then
set this.dist = this.dist - 25.0
else
call DestroyLightning( this.l )
call Balayage.destroy(this)
call Dgts_Commun.destroy(this.dgts)
return true
endif
endif
return false
endmethod
endstruct
function oaBalayage takes nothing returns nothing
local integer lvl = GetSpellLvl()
local Balayage bal = Balayage.create()
local location loc = GetSpellTargetLoc()
local real x
local real y
local Dgts_Commun dg = Dgts_Commun.create()
call dg.init(bal.caster, 40, true)
call dg.DmgUnit(bal.caster)
set bal.caster = GetSpellAbilityUnit()
set bal.dmg = 30 + GetHeroStr( bal.caster, true) * lvl
set bal.range = 550
set bal.angle = Atan2(GetLocationY(loc) - GetUnitY(bal.caster), GetLocationX(loc) - GetUnitX(bal.caster) ) + bj_PI / 2
set bal.angleFin = bal.angle - ( bj_PI - Deg2Rad( ((bal.range - bal.dist ) / 25.0 ) * 4.0 ) )
set x = GetUnitX(bal.caster) + 80 * Cos(bal.angle)
set y = GetUnitY(bal.caster) + 80 * Sin(bal.angle)
set bal.l = AddLightningEx( "CLPB", true, x, y, 120.0, GetUnitX(bal.caster)+bal.dist*Cos(bal.angle), GetUnitY(bal.caster)+bal.dist*Sin(bal.angle), Z_ECLAIR )
set bal.dgts = Dgts_Commun.init( bal.caster, bal.dmg, true )
call T003_Add(function Balayage.cycle, bal)
endfunction
//===========================================================================
function InitTrig_Balayage takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
function obExpiation takes nothing returns nothing
local unit caster = GetSpellAbilityUnit()
local unit target = GetSpellTargetUnit()
local integer lvl = GetSpellLvl()
if( IsUnitEnemy( target, GetOwningPlayer(caster)) and not IsUnitType(target, UNIT_TYPE_SUMMONED)) then
call DmgToUnit( caster, target, GetRandomReal( 1, 40+10*lvl + (GetHeroInt(caster, true)/3) * lvl), true)
endif
endfunction
//===========================================================================
function InitTrig_Purge takes nothing returns nothing
endfunction
//TESH.scrollpos=59
//TESH.alwaysfold=0
library SpellLightningSnake needs libSpellEffect
globals
constant string EFFECT_LIGHTNING_SNAKE = "Abilities\\Weapons\\FarseerMissile\\FarseerMissile.mdl"
endglobals
struct LightningSnake extends Spell
real angle = 0.0
real x // position initiale
real y
real dur = 0.0
Reels dist_angles
integer i = 0 // nbre de serpents
static method cycle takes nothing returns boolean
local thistype this = T003_GetData()
local unit u = null
local real x = 0.0
local real y = 0.0
local integer a = 0
if( ModuloReal( .dur, T003_PERIOD * 10) == T003_PERIOD ) then
set .dist_angles[.i*2] = 0.0
set .dist_angles[.i*2+1] = GetRandomReal(.angle-Deg2Rad(12.0), .angle+Deg2Rad(12.0))
set this.i = this.i + 1
endif
set .dur = .dur - T003_PERIOD
loop
exitwhen a == .i
set .dist_angles[a*2] = .dist_angles[a*2] + 32.0
if .dist_angles[a*2] > 800.0 then
set .i = .i - 1
set .dist_angles[a*2] = .dist_angles[.i*2]
set .dist_angles[a*2+1] = .dist_angles[.i*2+1]
set a = a - 1
else
set x = .x + .dist_angles[a*2] * Cos(.dist_angles[a*2+1])
set y = .y + .dist_angles[a*2] * Sin(.dist_angles[a*2+1])
call DestroyEffect(AddSpecialEffect( EFFECT_LIGHTNING_SNAKE, x, y))
if ModuloReal(.dur, T003_PERIOD * 4) == T003_PERIOD then
set udg_loc = Location(x, y)
call DmgToArea( udg_loc, .caster, .dmg, 110, false)
call RemoveLocation(udg_loc)
endif
endif
set a = a + 1
endloop
if( .dur < 0. or not IsUnitCanalisation(this.caster) ) then
call LightningSnake.destroy(this)
return true
endif
return false
endmethod
endstruct
function odLightningSnake takes nothing returns nothing
local LightningSnake obj = LightningSnake.create()
local unit u = GetSpellAbilityUnit()
local location loc = GetSpellTargetLoc()
local real angle = Atan2( GetLocationY(loc)-GetUnitY(u), GetLocationX(loc) - GetUnitX(u))
set obj.caster = u
set obj.dmg = GetSpellLvl() * 10 + GetHeroAgi(obj.caster, true) / 8. // 15 -> 125 dmg/sec
set obj.x = GetUnitX(u)
set obj.y = GetUnitY(u)
set obj.angle = angle
set obj.dur = 6. + GetHeroInt(u, true) / 8
set obj.dur = obj.dur - ModuloReal(obj.dur, T003_PERIOD)
call Canalisation(obj.caster)
call T003_Add(function LightningSnake.cycle, obj)
endfunction
endlibrary
//===========================================================================
function InitTrig_Serpent_de_foudre takes nothing returns nothing
call Preload(EFFECT_LIGHTNING_SNAKE)
endfunction
//TESH.scrollpos=11
//TESH.alwaysfold=0
library SpellStorm needs libSpellEffect
struct Storm extends Spell
integer duree
static method cycle takes nothing returns boolean
local thistype this = T025_GetData()
set udg_loc = GetRandomLoc( GetUnitX(this.caster), GetUnitY(this.caster), 480 )
call SEffect_Foudre( this.caster, GetLocationX(udg_loc), GetLocationY(udg_loc), this.dmg, 180)
call RemoveLocation(udg_loc)
set this.duree = this.duree - 1
if( this.duree == 0 or not IsUnitCanalisation(.caster)) then
call Storm.destroy(this)
if( .duree == 0 ) then
call IssueImmediateOrder(.caster, "stop") // Arrêter la canalisation
endif
return true
endif
return false
endmethod
endstruct
function ofStorm takes nothing returns nothing
local Storm obj = Storm.create()
local integer lvl = GetSpellLvl()
set obj.caster = GetSpellAbilityUnit()
set obj.duree = lvl * 10 + 20 + GetHeroInt(obj.caster, true) / 6
set obj.dmg = GetHeroStr(obj.caster, true) * (2 + lvl)
call Canalisation( obj.caster )
call T025_Add(function Storm.cycle, obj)
endfunction
//===========================================================================
function InitTrig_Storm takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=4
//TESH.alwaysfold=0
function baTornado_strike takes nothing returns nothing
local unit caster = GetSpellAbilityUnit()
local player p = GetOwningPlayer(caster)
local real xc = GetUnitX(caster)
local real yc = GetUnitY(caster)
local location loc = Location(xc, yc)
local group cibles = GetUnitsInRangeOfLocMatching(260, loc, And(Condition(function Cond_Groupe_Ennemi), Not(Condition(function Cond.Immun))) )
local unit u = null
local integer lvl = GetUnitAbilityLevel( caster, GetSpellAbilityId())
local real dmg = lvl * 35 + GetHeroStr(caster, true) * R2I((lvl+1)/2)
call RemoveLocation(loc)
set loc = null
call IssueImmediateOrder( caster, "stop" )
call SetUnitAnimationByIndex( caster, 6 )
loop
set u = FirstOfGroup(cibles)
exitwhen u == null
call GroupRemoveUnit( cibles, u)
call PlaySoundOnUnitBJ( gg_snd_HeavySlice, 80, u )
call Recul( GetUnitX(caster), GetUnitY(caster), u, 90, 0, 15)
call DestroyEffect( AddSpecialEffectTarget("Objects\\Spawnmodels\\Human\\HumanBlood\\HumanBloodFootman.mdl", u, "origin"))
call DmgToUnit( caster, u, dmg, true )
endloop
call DestroyGroup(cibles)
call PolledWait(0.1)
call SetUnitAnimationByIndex( caster, 0 )
set p = null
set cibles = null
set caster = null
set u = null
endfunction
//===========================================================================
function InitTrig_Tornado_Strike takes nothing returns nothing
endfunction
//TESH.scrollpos=60
//TESH.alwaysfold=0
library SpellLameDansante needs libSpellEffect
globals
constant integer UNIT_LAME_DANSANTE = 'h004'
endglobals
struct LameDansante extends Spell
real cx1
real cy1
real cx2
real cy2
unit lame
integer b
real angle
real duree = 0.0
static method cycle takes nothing returns boolean
local thistype this = T003_GetData()
local real xu
local real yu
local location loc = Location( GetUnitX(this.lame), GetUnitY(this.lame) )
local real angle
call DmgToAreaType( loc, this.caster, this.dmg, 160, false, DAMAGE_PHYSICAL)
call RemoveLocation(loc)
set this.duree = this.duree + 1
if ( this.duree < 18) then
set xu = this.cx1 + 200*Cos(this.angle-(this.b*Deg2Rad(this.duree*7)))
set yu = this.cy1 + 200*Sin(this.angle-(this.b*Deg2Rad(this.duree*7)))
call SetUnitX(this.lame, xu)
call SetUnitY(this.lame, yu)
elseif ( this.duree < 55 ) then
set angle = this.angle-(this.b*bj_PI/3)
set xu = this.cx2 + 200*Cos(angle+(this.b*Deg2Rad((this.duree+1)*7)))
set yu = this.cy2 + 200*Sin(angle+(this.b*Deg2Rad((this.duree+1)*7)))
call SetUnitX(this.lame, xu)
call SetUnitY(this.lame, yu)
elseif( DistanceBetweenPointsEx( GetUnitX(this.lame), GetUnitY(this.lame), GetUnitX(this.caster), GetUnitY(this.caster)) < 80 ) then
call RemoveUnit(this.lame)
call LameDansante.destroy(this)
return true
else
set angle = Atan2(GetUnitY(this.caster) - GetUnitY(this.lame), GetUnitX(this.caster) - GetUnitX(this.lame) )
call SetUnitX(this.lame, GetUnitX(this.lame) + 25*Cos(angle))
call SetUnitY(this.lame, GetUnitY(this.lame) + 25*Sin(angle))
endif
return false
endmethod
endstruct
function bbLame_dansante takes nothing returns nothing
local LameDansante obj
local unit caster = GetTriggerUnit()
local real xc = GetUnitX(caster)
local real yc = GetUnitY(caster)
local location loc = GetSpellTargetLoc()
local real angle = Atan2(GetLocationY(loc) - yc, GetLocationX(loc) - xc )
local real lvl = GetSpellLvl()
local real dmg = I2R(GetHeroAgi(caster, true)) / (12.0 - (lvl/1.6) )
local real an
local integer b = -1
local integer a = 1
call RemoveLocation(loc)
loop
exitwhen a == lvl + 2
set obj = LameDansante.create()
set obj.caster = caster
set obj.dmg = dmg
set obj.b = b
set obj.lame = CreateUnit( GetOwningPlayer(caster), UNIT_LAME_DANSANTE, xc, yc, 270.00)
set obj.cx1 = xc + 200 * Cos(angle-(bj_PI/6)*b)
set obj.cy1 = yc + 200 * Sin(angle-(bj_PI/6)*b)
set obj.cx2 = xc + 500 * Cos(angle+(bj_PI/12)*b)
set obj.cy2 = yc + 500 * Sin(angle+(bj_PI/12)*b)
set obj.angle = angle + (bj_PI-(bj_PI/6)*b)
set b = -b
set a = a + 1
call T003_Add(function LameDansante.cycle, obj)
endloop
endfunction
//===========================================================================
function InitTrig_Lame_Dansante takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=67
//TESH.alwaysfold=0
function Cross_flash_Actions takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer m =GetHandleId(t)
local unit caster = LUnit( m, KEY_CASTER)
local unit target = LUnit( m, KEY_TARGET)
local integer i = LInteger( m, StringHash("Timer") )
local real xc
local real yc
local real xi
local real yi
local real dmg = LReal(m, StringHash("Dmg"))
local real angle = LReal(m, StringHash("Angle"))
local real vit = LReal(m, StringHash("Vitesse"))
local effect e
local location loc = null
call SInteger( i + 1, m, StringHash("Timer") )
if ( i <= 4 ) then
return
elseif (i==5) then
set xi = GetUnitX(target) + 700*Cos(angle+bj_PI)
set yi = GetUnitY(target) + 700*Sin(angle+bj_PI)
call AddSpecialEffect( "Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl", xi, yi)
set e = AddSpecialEffectTarget( "Abilities\\Spells\\Orc\\Shockwave\\ShockwaveMissile.mdl", caster, "origin")
call SEffect(e, m, KEY_EFFECT)
call SetUnitX(caster, xi)
call SetUnitY(caster, yi)
call SReal( xi, m, StringHash("xi"))
call SReal( yi, m, StringHash("yi"))
call SetUnitAnimationByIndex( caster, 8 )
elseif (i <= 1000/vit ) then
call SetUnitX(caster, GetUnitX(caster)+vit*Cos(angle) )
call SetUnitY(caster, GetUnitY(caster)+vit*Sin(angle) )
set loc = Location(GetUnitX(caster), GetUnitY(caster))
call DmgToArea( loc, caster, GetHeroAgi(caster,true)/6, 160, false)
call RemoveLocation(loc)
if (i==28) then
call SetUnitAnimationByIndex( caster, 6 )
elseif (i==43) then
call PlaySoundOnUnitBJ( gg_snd_HeavySlice, 100, target )
set loc = Location(GetUnitX(target), GetUnitY(target))
call DmgToArea( loc, caster, dmg, 180, true)
call RemoveLocation(loc)
endif
else
call SetUnitAnimationByIndex( caster, 0 )
call AddSpecialEffect( "Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl", GetUnitX(caster), GetUnitY(caster) )
set xc = LReal( m, StringHash("xc"))
set yc = LReal( m, StringHash("yc"))
call AddSpecialEffect( "Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl", xc, yc)
call DestroyEffect( LEffect( m, KEY_EFFECT) )
call SetUnitPathing(caster, true)
call SetUnitInvulnerable( caster, false)
call SetUnitX(caster, xc)
call SetUnitY(caster, yc)
call PauseUnit(target, false)
call PauseUnit(caster, false)
call Flush(m)
call DestroyTimer(t)
endif
set loc = null
set caster = null
set target = null
endfunction
function bdCross_flash takes nothing returns nothing
local unit caster = GetTriggerUnit()
local real xc = GetUnitX(caster)
local real yc = GetUnitY(caster)
local unit target = GetSpellTargetUnit()
local integer a = 1
local real angle = Atan2(GetUnitY(target) - yc, GetUnitX(target) - xc )
local integer lvl = GetSpellLvl()
local real dmg = R2I((lvl+3)/2)*GetHeroAgi(caster, true)+lvl*60+40
local timer t = CreateTimer()
local integer m = GetHandleId(t)
call PauseUnit(target, true)
call PauseUnit(caster, true)
call SetUnitPathing(caster, false)
call SetUnitInvulnerable( caster, true)
call SUnit( caster, m, KEY_CASTER)
call SUnit( target, m, KEY_TARGET)
call SReal( dmg, m, StringHash("Dmg"))
call SReal( angle, m, StringHash("Angle"))
call SReal( 18, m, StringHash("Vitesse"))
call SReal( xc, m, StringHash("xc"))
call SReal( yc, m, StringHash("yc"))
call SInteger( 1, m, StringHash("Timer"))
call AddSpecialEffect( "Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl", xc, yc)
call TimerStart (t , 0.02,true ,function Cross_flash_Actions )
endfunction
//===========================================================================
function InitTrig_Cross_Flash takes nothing returns nothing
endfunction
//TESH.scrollpos=73
//TESH.alwaysfold=0
library SpellLanceFlamme needs libSpellEffect
globals
constant integer UNIT_LANCE_FLAMME = 'h01S'
constant integer CASTER_LANCE_FLAMME = 'h01J'
constant integer SPELL_SOUFFLE = 'A05E'
endglobals
struct AmeLFlamme extends Spell
LanceFlamme ptr
real angle
static method cycle takes nothing returns boolean
local thistype this = T003_GetData()
call SetUnitX( this.caster, GetUnitX(this.caster) + 20.0 * Cos(this.angle) )
call SetUnitY( this.caster, GetUnitY(this.caster) + 20.0 * Sin(this.angle) )
if( GetUnitState(this.caster, UNIT_STATE_LIFE) <= 0 ) then
call AmeLFlamme.destroy(this)
return true
endif
return false
endmethod
endstruct
struct LanceFlamme extends Spell
real angle
real duree
integer cpt = 0
integer sens = 1
group g = CreateGroup()
unit u = null
location loc = null
integer lvl
static method cycle takes nothing returns boolean
local thistype this = T003_GetData()
local real x = GetUnitX(this.caster)
local real y = GetUnitY(this.caster)
local unit u
local AmeLFlamme obj = AmeLFlamme.create()
set obj.angle = this.angle + Deg2Rad(this.cpt * 4.5)
set obj.caster = CreateUnit( GetOwningPlayer(this.caster), UNIT_LANCE_FLAMME, x, y, Rad2Deg(obj.angle))
call SetUnitX( obj.caster, x+60 * Cos(obj.angle) )
call SetUnitY( obj.caster, y+60 * Sin(obj.angle) )
call UnitApplyTimedLife( obj.caster, 'BTLF', 0.97)
set obj.ptr = this
call T003_Add(function AmeLFlamme.cycle, obj)
set this.cpt = this.cpt + this.sens
if ( this.cpt == (4 * this.sens) ) then
set this.sens = -this.sens
//===//
if( this.sens < 0 ) then
call RemoveUnit(this.u)
set this.u = CreateUnit( GetOwningPlayer(this.caster), CASTER_LANCE_FLAMME, GetUnitX(this.caster), GetUnitY(this.caster), Rad2Deg(this.angle) )
call SetUnitAbilityLevel( this.u, SPELL_SOUFFLE, this.lvl)
call IssuePointOrder( this.u , "breathoffire", GetLocationX(this.loc), GetLocationY(this.loc) )
endif
endif
set this.duree = this.duree - T003_PERIOD
if( this.duree < 0.0 or not IsUnitCanalisation(this.caster) ) then
call DestroyGroup(this.g)
call RemoveUnit(this.u)
call RemoveLocation(this.loc)
set this.loc = null
call LanceFlamme.destroy(this)
return true
endif
return false
endmethod
endstruct
function nbLanceFlamme takes nothing returns nothing
local LanceFlamme obj = LanceFlamme.create()
set obj.caster = GetSpellAbilityUnit()
set obj.duree = 4.0
set obj.loc = GetSpellTargetLoc()
set obj.lvl = GetSpellLvl()
set obj.angle = Atan2(GetLocationY(obj.loc) - GetUnitY(obj.caster), GetLocationX(obj.loc) - GetUnitX(obj.caster) )
set obj.u = CreateUnit( GetOwningPlayer(obj.caster), CASTER_LANCE_FLAMME, GetUnitX(obj.caster), GetUnitY(obj.caster), Rad2Deg(obj.angle) )
call IssuePointOrder( obj.u , "breathoffire", GetLocationX(obj.loc), GetLocationY(obj.loc) )
call SetUnitAbilityLevel( obj.u, SPELL_SOUFFLE, obj.lvl)
call Canalisation(obj.caster)
call T003_Add(function LanceFlamme.cycle, obj)
endfunction
endlibrary
//===========================================================================
function InitTrig_Lance_Flamme takes nothing returns nothing
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
library SpellDeflagration needs libSpellEffect
globals
constant integer UNIT_DEFLAGRATION = 'h01D'
endglobals
function naDeflagration takes nothing returns nothing
local location loc = GetSpellTargetLoc()
local unit caster = GetSpellAbilityUnit()
local real angle = Atan2( GetLocationY(loc) - GetUnitY(caster), GetLocationX(loc) - GetUnitX(caster))
local real x = GetLocationX(loc) - 100 * Cos(angle)
local real y = GetLocationY(loc) - 100 * Sin(angle)
local real dmg = 30 * GetSpellLvl()
local group g = GetUnitsInRangeOfLocMatching( 200, loc, Condition(function Cond.Ennemi) )
local unit u = null
local unit dummy = CreateUnit( GetOwningPlayer(caster), UNIT_DEFLAGRATION, x, y, Rad2Deg(angle) )
call DmgToArea( loc, caster, dmg, 210, true)
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit(g, u)
call SEffect_Bash( u, 0.5+GetSpellLvl() )
call Recul( GetUnitX(dummy), GetUnitY(dummy), u, 50, 0, 8 )
endloop
call UnitApplyTimedLife( dummy, 'BTLF', 5.0 )
call RemoveLocation(loc)
set loc = null
//call PlaySoundBJ( gg_snd_BuildingDeathLargeHuman )
endfunction
endlibrary
//===========================================================================
function InitTrig_Deflagration_Char takes nothing returns nothing
endfunction
//TESH.scrollpos=24
//TESH.alwaysfold=0
library SpellRecouvrement needs libSpellEffect
globals
constant integer EFFECT_RECOUVREMENT = 'h01I'
endglobals
struct Recouvrement extends Spell
real duree = 15.0
integer flag = 0
static method cycle takes nothing returns boolean
local thistype this = T01_GetData()
call AddLife( this.caster, GetUnitState(this.caster, UNIT_STATE_MAX_LIFE)*this.dmg)
call AddMana( this.caster, GetUnitState(this.caster, UNIT_STATE_MAX_MANA)*this.dmg)
if( this.flag == 0 and this.duree < 14.6) then
call SetUnitTimeScalePercent( this.target, 9.0 )
set this.flag = 1
endif
if( this.flag == 1 and this.duree < 0.2) then
call SetUnitTimeScalePercent( this.target, 100.0 )
set this.flag = 2
endif
set this.duree = this.duree - T01_PERIOD
if( this.duree < 0.0 or not IsUnitCanalisation(this.caster) ) then
call SetUnitTimeScalePercent( this.target, 100.0)
call UnitApplyTimedLife(this.target, 'BTLF', 2.0) // pour éviter les bugs graphiques
call Recouvrement.destroy(this)
return true
endif
return false
endmethod
endstruct
function ndRecouvrement takes nothing returns nothing
local Recouvrement obj = Recouvrement.create()
set obj.caster = GetSpellAbilityUnit()
set obj.target = CreateUnit(GetOwningPlayer(obj.caster), EFFECT_RECOUVREMENT, GetUnitX(obj.caster), GetUnitY(obj.caster), GetUnitFacing(obj.caster))
call SetUnitX(obj.target, GetUnitX(obj.caster))
call SetUnitY(obj.target, GetUnitY(obj.caster))
set obj.dmg = (GetSpellLvl() * 0.01 + 0.01)/10.0
call Canalisation(obj.caster)
call T01_Add(function Recouvrement.cycle, obj)
endfunction
endlibrary
//===========================================================================
function InitTrig_Recouvrement takes nothing returns nothing
endfunction
//TESH.scrollpos=6
//TESH.alwaysfold=0
library SpellVaguePsionique needs libSpellEffect
globals
constant integer BUFF_PSIONIC_WAVE = 'A094'
endglobals
struct VaguePsionique extends Spell
static method cycle takes nothing returns boolean
local thistype this = T1_GetData()
local unit u = null
call Buff.AddBuff(u, true, BUFF_PSIONIC_WAVE, T1_PERIOD )
return false
endmethod
endstruct
function ncVaguePsionique takes nothing returns nothing
local VaguePsionique obj = VaguePsionique.create()
local real x = GetUnitX(GetSpellAbilityUnit())
local real y = GetUnitY(GetSpellAbilityUnit())
call T1_Add(function VaguePsionique.cycle, obj)
endfunction
endlibrary
//===========================================================================
function InitTrig_Vague_Psionique takes nothing returns nothing
endfunction
//TESH.scrollpos=60
//TESH.alwaysfold=0
library SpellBombardementNuc needs libSpellEffect
globals
constant integer UNIT_OGIVE = 'h01F'
constant string OGIVE_EXPLOSION = "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl"
endglobals
struct Ogive extends Spell
real dmg
real x
real y
static method Boom takes nothing returns nothing
local timer t = GetExpiredTimer()
local Ogive obj = LInteger( GetHandleId(t), StringHash("spell__ogive"))
local location loc = Location(obj.x, obj.y)
call UnitApplyTimedLife(obj.caster, 'BTLF', 2.0)
call DestroyEffect( AddSpecialEffectLoc(OGIVE_EXPLOSION, loc) )
call DmgToArea( loc, obj.caster, obj.dmg, 250.0, true)
call Ogive.destroy(obj)
call RemoveLocation(loc)
call DestroyTimer(t)
set t = null
set loc = null
endmethod
endstruct
struct BombardementNuc extends Spell
real duree
location cible
static method cycle takes nothing returns boolean
local thistype this = T05_GetData()
local Ogive obj = Ogive.create()
local real x = GetLocationX(this.cible)
local real y = GetLocationY(this.cible)
local location loc = GetRandomLoc( x, y, 600)
local timer t = CreateTimer()
local real dist = DistanceBetweenPointsEx( GetLocationX(loc), GetLocationY(loc), x, y)
set obj.dmg = this.dmg
set obj.caster = CreateUnit( GetOwningPlayer(this.caster), UNIT_OGIVE, x, y, GetRandomReal(0,360.0) )
set obj.x = GetLocationX(loc)
set obj.y = GetLocationY(loc)
call IssuePointOrder( obj.caster, "attackground", GetLocationX(loc), GetLocationY(loc))
call SInteger( obj, GetHandleId(t), StringHash("spell__ogive") )
call TimerStart( t, 0.7+0.2*(dist/600), false, function Ogive.Boom)
call RemoveLocation(loc)
set loc = null
set this.duree = this.duree - T05_PERIOD
if( this.duree < 0.0 or not IsUnitCanalisation(this.caster) ) then
call IssueImmediateOrder( this.caster, "stop")
call RemoveLocation(this.cible)
call BombardementNuc.destroy(this)
return true
endif
return false
endmethod
endstruct
function neBombardementNuc takes nothing returns nothing
local BombardementNuc obj = BombardementNuc.create()
set obj.caster = GetSpellAbilityUnit()
set obj.dmg = GetSpellLvl()*40.0
set obj.duree = 20.0// + GetHeroInt(obj.caster,true)/15
set obj.cible = GetSpellTargetLoc()
call Canalisation(obj.caster)
call T05_Add(function BombardementNuc.cycle, obj)
endfunction
endlibrary
//===========================================================================
function InitTrig_Bombardement_Nucleaire takes nothing returns nothing
endfunction
//TESH.scrollpos=12
//TESH.alwaysfold=0
library SpellNueePoison needs libSpellEffect
globals
constant integer UNIT_NUEE_POISON = 'h01E'
endglobals
struct NueePoison extends Spell
endstruct
function ncNueePoison takes nothing returns nothing
local NueePoison obj = NueePoison.create()
local real x = GetUnitX(GetSpellAbilityUnit())
local real y = GetUnitY(GetSpellAbilityUnit())
local location loc = GetSpellTargetLoc()
local real angle = Atan2( GetLocationY(loc) - y, GetLocationX(loc) - x)
set obj.caster = GetSpellAbilityUnit()
set obj.target = CreateUnit( GetOwningPlayer(obj.caster), UNIT_NUEE_POISON, x, y, Rad2Deg(angle))
call SetUnitX( obj.target, x )
call SetUnitY( obj.target, y )
call IssuePointOrder( obj.target, "shockwave", GetLocationX(loc), GetLocationY(loc) )
call UnitApplyTimedLife( obj.target, 'BTLF', 5.0 )
call RemoveLocation(loc)
set loc = null
//call T003_Add(function NueePoison.cycle, obj)
endfunction
endlibrary
//===========================================================================
function InitTrig_Canon_Atomique takes nothing returns nothing
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
library SpellLienSombre needs libSpellEffect
globals
constant integer BUFF_LIEN_SOMBRE = 'B003'
constant string EFFECT_LIEN_SOMBRE = "Abilities\\Spells\\Undead\\CarrionSwarm\\CarrionSwarmDamage.mdl"
constant integer KS_LIEN_SOMBRE = StringHash("spell__liensombre")
endglobals
struct LienSombre extends Spell
trigger t = CreateTrigger()
trigger inv = CreateTrigger()
endstruct
function Cond_UniteInvoque takes nothing returns boolean
return GetUnitTypeId(GetFilterUnit()) == 'n001'
endfunction
function LienSombre_Summon takes nothing returns nothing
local unit u = GetTriggerUnit()
local LienSombre obj = LInteger( GetHandleId(u), KS_LIEN_SOMBRE )
call SInteger( obj, GetHandleId(GetSummonedUnit()), KS_LIEN_SOMBRE)
call TriggerRegisterUnitEvent( obj.t, GetSummonedUnit(), EVENT_UNIT_DAMAGED )
endfunction
function LienSombre_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local LienSombre obj = LInteger( GetHandleId(u), KS_LIEN_SOMBRE )
local group g
if ( GetUnitAbilityLevel(obj.target, BUFF_LIEN_SOMBRE) < 1 ) then
call DestroyTrigger(GetTriggeringTrigger())
call DestroyTrigger(obj.inv)
call RInteger( GetHandleId(obj.caster), KS_LIEN_SOMBRE)
set g = GetUnitsOfPlayerMatching(GetOwningPlayer(u), And(Condition(function Cond.Alive),Condition(function Cond_UniteInvoque)) )
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit( g, u)
call RInteger( GetHandleId(u), KS_LIEN_SOMBRE )
endloop
call DestroyGroup(g)
call LienSombre.destroy(obj)
return
endif
call DmgToUnit( u, obj.target, GetEventDamage()*obj.dmg, false )
call DestroyEffect( AddSpecialEffectTarget( EFFECT_LIEN_SOMBRE, obj.target, "overhead" ))
endfunction
function ibLienSombre takes nothing returns nothing
local LienSombre obj = LienSombre.create()
local group g = GetUnitsOfPlayerMatching(GetOwningPlayer(GetTriggerUnit()), Condition(function Cond.Invoque) )
local unit u = null
set obj.caster = GetTriggerUnit()
set obj.target = GetSpellTargetUnit()
set obj.dmg = GetUnitAbilityLevel( obj.caster, GetSpellAbilityId()) * 0.3 + 0.2
call SInteger( obj, GetHandleId(obj.caster), KS_LIEN_SOMBRE )
call TriggerAddAction( obj.inv, function LienSombre_Summon )
call TriggerRegisterUnitEvent( obj.inv, obj.caster, EVENT_UNIT_SUMMON )
call TriggerAddAction( obj.t, function LienSombre_Actions )
call TriggerRegisterUnitEvent( obj.t, obj.caster, EVENT_UNIT_DAMAGED )
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit( g, u)
call SInteger( obj, GetHandleId(u), KS_LIEN_SOMBRE )
call TriggerRegisterUnitEvent( obj.t, u, EVENT_UNIT_DAMAGED )
endloop
call DestroyGroup(g)
endfunction
//===========================================================================
function InitTrig_LienSombre takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
globals
constant string EFFECT_LIEN_OMBRE = "Abilities\\Spells\\Other\\ANsa\\ANsaTarget.mdl"
constant string EFFECT_LIEN_OMBRE_TARGET = "Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosDone.mdl"
endglobals
function idLiendOmbre takes nothing returns nothing
local unit caster = GetSpellAbilityUnit()
local location loc = GetUnitLoc(caster)
local group g = GetUnitsInRangeOfLocMatching( 650, loc, Condition(function Cond.Allie) )
local group g2 = null
local unit u = null
local unit u2 = null
local real leech = 0.0
local real dmg = GetSpellLvl()*60+GetHeroInt(caster, true)/2
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit(g,u)
set loc = GetUnitLoc(u)
//call AddSpecialEffectLoc( EFFECT_LIEN_OMBRE , loc)
set Cond.condUnite = u
set g2 = GetUnitsInRangeOfLocMatching( 230+GetHeroAgi(caster,true), loc, And(Condition(function Cond.EnnemiVar), Not(Condition(function Cond.Immun))) )
loop
set u2 = FirstOfGroup(g2)
exitwhen u2 == null
call GroupRemoveUnit(g2,u2)
call DmgToUnit( caster, u2, dmg, false)
call Eclair( "AFOD", u, u2, 0.4, EFFECT_LIEN_OMBRE_TARGET, "origin")
set leech = leech + dmg/2
endloop
if( leech != 0.0) then
call Eclair( "AFOD", caster, u, 0.4, EFFECT_LIEN_OMBRE_TARGET, "overfeet")
call AddLife( u, leech)
call TxtFlo( I2S(R2I(leech)), u, 20, 90, 20 )
set leech = 0.0
endif
call DestroyGroup(g2)
call RemoveLocation(loc)
endloop
call DestroyGroup(g)
set g = null
set g2 = null
set loc = null
endfunction
//===========================================================================
function InitTrig_Lien_d_ombre takes nothing returns nothing
endfunction
//TESH.scrollpos=70
//TESH.alwaysfold=0
library SpellColereDeFeu needs libSpellEffect
globals
constant integer UNIT_COLERE_DE_FEU = 'h00R'
endglobals
struct ColereDeFeuAme extends Spell
real dist
real angle
unit dummy
real dur = 0.9
static method cycle takes nothing returns boolean
local thistype this = T003_GetData()
local real x
local real y
local location loc
set this.dur = this.dur - 0.03
if( this.dur < 0.0 ) then
set loc = Location( GetUnitX(.dummy), GetUnitY(.dummy) )
call DmgToArea( loc, this.caster, this.dmg, 90, true )
call RemoveLocation(loc)
call ColereDeFeuAme.destroy(this)
call KillUnit(this.dummy)
return true
endif
if( this.dur > 0.7 ) then
set this.dist = this.dist + 2.0
else
set this.dist = this.dist + 8.0
endif
call SetUnitX( this.dummy, GetUnitX(this.caster) + this.dist * Cos( this.angle ) )
call SetUnitY( this.dummy, GetUnitY(this.caster) + this.dist * Sin( this.angle ) )
return false
endmethod
endstruct
struct ColereDeFeu extends Spell
real dur = 4.0
real angle
static method cycle takes nothing returns boolean
local thistype this = T01_GetData()
local ColereDeFeuAme obj
local integer a = 0
set this.angle = this.angle + Deg2Rad(3.0)
call SetUnitFacing( this.caster, Rad2Deg(this.angle) )
loop
exitwhen a == 2
set obj = ColereDeFeuAme.create()
set obj.angle = GetRandomReal( this.angle, this.angle+Deg2Rad(8.0) )
set obj.dist = GetRandomReal( -50, 450 )
set obj.caster = this.caster
set obj.dmg = this.dmg
set obj.dummy = CreateUnit( GetOwningPlayer(this.caster), UNIT_COLERE_DE_FEU, GetUnitX(this.caster), GetUnitY(this.caster), Rad2Deg(obj.angle) )
call T003_Add(function ColereDeFeuAme.cycle, obj)
set a = a + 1
endloop
set this.dur = this.dur - 0.10
if( this.dur < 0.0 or not IsUnitCanalisation(this.caster) ) then
call ColereDeFeu.destroy(this)
return true
endif
return false
endmethod
endstruct
function ibColereDeFeu takes nothing returns nothing
local ColereDeFeu obj = ColereDeFeu.create()
local location loc = GetSpellTargetLoc()
set obj.caster = GetTriggerUnit()
set obj.dmg = GetSpellLvl() * 10 + GetHeroInt( obj.caster, true )/(7-GetSpellLvl()/2) + 2
set obj.angle = Atan2(GetLocationY(loc) - GetUnitY(obj.caster), GetLocationX(loc) - GetUnitX(obj.caster) ) - bj_PI / 3
call SetUnitFacing( obj.caster, Rad2Deg(obj.angle) )
call Canalisation(obj.caster)
call T01_Add(function ColereDeFeu.cycle, obj)
call RemoveLocation(loc)
set loc = null
endfunction
//===========================================================================
function InitTrig_Colere_de_Feu takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library SpellTransfertMana needs libSpellEffect
globals
constant string EFFECT_TRANSFERT_MANA = "Abilities\\Spells\\NightElf\\ManaBurn\\ManaBurnTarget.mdl"
constant integer ABILITY_TRANSFERT_MANA = 'A02Q'
endglobals
function TransfertMana takes nothing returns nothing
local unit caster = GetTriggerUnit()
local unit target = GetSpellTargetUnit()
local unit hero = udg_Hero[GetConvertedPlayerId(GetOwningPlayer(caster))]
local real dmg = GetUnitAbilityLevel( hero, ABILITY_TRANSFERT_MANA) * 40
if( GetUnitState( target, UNIT_STATE_MANA ) <= 0.0 ) then
call IssueImmediateOrder( caster, "stop")
return
endif
call Eclair( "MBUR", target, caster, 0.6, EFFECT_TRANSFERT_MANA, "origin" )
call Eclair( "MBUR", caster, hero, 0.6, EFFECT_TRANSFERT_MANA, "origin" )
call SEffect_VolDeMana( target, hero, dmg, 1.0 )
endfunction
//===========================================================================
function InitTrig_Transfert_de_Mana takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=83
//TESH.alwaysfold=0
library SpellJetDEpine needs libSpellEffect
globals
constant integer UNIT_JET_DEPINE = 'h000'
constant string EFFECT_JET_DEPINE = "Abilities\\Spells\\Human\\ManaFlare\\ManaFlareBoltImpact.mdl"
endglobals
struct JetDEpineAme extends Spell
real dist = 20.0
real angle
unit dummy = null
static method cycle takes nothing returns boolean
local thistype this = T003_GetData()
local real x = GetUnitX(this.caster) + this.dist * Cos(this.angle+Deg2Rad(this.dist/2))
local real y = GetUnitY(this.caster) + this.dist * Sin(this.angle+Deg2Rad(this.dist/2))
call SetUnitX(this.dummy, x)
call SetUnitY(this.dummy, y)
set this.dist = this.dist + 16.0
if( this.dist > 400 ) then
call RemoveUnit(this.dummy)
set this.dummy = null
call JetDEpineAme.destroy(this)
return true
endif
return false
endmethod
endstruct
struct JetDEpine extends Spell
real duree = 0.0
static method cycle takes nothing returns boolean
local thistype this = T01_GetData()
local real x = GetUnitX(this.caster)
local real y = GetUnitY(this.caster)
local group cibles
local group g2
local location loc = Location(x, y)
local unit u
set cibles = GetUnitsInRangeOfLocMatching( 200*this.duree, loc, Condition(function Cond.Alive))
set g2 = GetUnitsInRangeOfLocMatching( 200*(this.duree-1), loc, Condition(function Cond.Alive))
call GroupRemoveGroup( g2, cibles )
call RemoveLocation(loc)
set loc = null
loop
set u = FirstOfGroup(cibles)
exitwhen u == null
call GroupRemoveUnit( cibles, u)
if( IsUnitEnemy( u, GetOwningPlayer(this.caster)) ) then
call DestroyEffect( AddSpecialEffectTarget( EFFECT_JET_DEPINE, u, "origin" ) )
call DmgToUnit( this.caster, u, this.dmg, true )
endif
endloop
call DestroyGroup(cibles)
call DestroyGroup(g2)
set cibles = null
set g2 = null
set this.duree = this.duree + 1.0
if( this.duree >= 3.0 ) then
call JetDEpine.destroy(this)
return true
endif
return false
endmethod
endstruct
function eaJet_d_epine takes nothing returns nothing
local JetDEpine obj = JetDEpine.create()
local JetDEpineAme ame
local unit caster = GetTriggerUnit()
local real xc = GetUnitX(caster)
local real yc = GetUnitY(caster)
local unit u
local integer a = 1
local integer lvl = GetSpellLvl()
set obj.dmg = (lvl*0.5 + 1.0) * GetHeroAgi(caster, true) + lvl * 25
set obj.caster = GetTriggerUnit()
loop
exitwhen a > 18
set ame = JetDEpineAme.create()
set ame.dummy = CreateUnit(GetOwningPlayer(caster), UNIT_JET_DEPINE, xc + 20 *Cos(Deg2Rad(a*20)), yc + 20*Sin(Deg2Rad(a*20)), a*20)
set ame.angle = Deg2Rad(a*20)
set ame.caster = obj.caster
call T003_Add(function JetDEpineAme.cycle, ame)
set a = a + 1
endloop
call T01_Add(function JetDEpine.cycle, obj)
call Shake(GetOwningPlayer(obj.caster))
endfunction
//===========================================================================
function InitTrig_Jet_d_epine takes nothing returns nothing
call Preload("Objects\\Spawnmodels\\NightElf\\EntBirthTarget\\EntBirthTarget.mdl")
endfunction
endlibrary
//TESH.scrollpos=30
//TESH.alwaysfold=0
function Lierre_Empoisonne_Actions takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer m = GetHandleId(t)
local unit caster = LUnit(m, KEY_CASTER)
local unit lierre = LUnit(m, StringHash("Lierre"))
local integer i = LInteger( m, StringHash("i"))
local integer duree = LInteger( m, KEY_DURATION)
local real dmg = LReal( m, KEY_DAMAGE)
local real xt = GetUnitX(lierre)
local real yt = GetUnitY(lierre)
local location target
local integer a = 1
call SInteger( i+1, m, StringHash("i") )
if( i > duree) then
call DestroyUbersplat( LUbersplat( m, StringHash("Ubersplat")) )
call KillUnit(lierre)
set lierre = null
call DestroyTimer(t)
set t = null
call Flush(m)
return
endif
loop
exitwhen a > 1
set target = GetRandomLoc(xt, yt, 170)
call DmgToArea( target, caster, dmg, 80, true)
call DestroyEffect( AddSpecialEffect( "Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl", GetLocationX(target), GetLocationY(target)) )
call RemoveLocation(target)
set a = a + 1
endloop
set target = null
endfunction
function ebLierre_Empoisonne takes nothing returns nothing
local timer t = CreateTimer()
local integer m = GetHandleId(t)
local unit caster = GetTriggerUnit()
local location loc = GetSpellTargetLoc()
local real xt = GetLocationX(loc)
local real yt = GetLocationY(loc)
local integer lvl = GetUnitAbilityLevel( caster, GetSpellAbilityId())
local real dmg = lvl * 15 + GetHeroStr(caster, true) * (lvl*0.2+1.0)
local integer duree = lvl + 7
local unit lierre = CreateUnit( GetOwningPlayer(caster), 'h00B', xt, yt, 0)
local ubersplat us = CreateUbersplat( xt, yt, "EMDB", 255, 255, 255, 255, false, false)
call SetUbersplatRenderAlways( us, true )
call SUnit( caster, m, StringHash("Caster"))
call SUnit( lierre, m, StringHash("Lierre"))
call SUbersplat( us, m, StringHash("Ubersplat"))
call SInteger( 0, m, StringHash("i"))
call SInteger( duree, m, KEY_DURATION)
call SReal( dmg, m, KEY_DAMAGE)
call TimerStart( t, 0.4, true, function Lierre_Empoisonne_Actions)
call RemoveLocation(loc)
set loc = null
set lierre = null
set us = null
set caster = null
set t = null
endfunction
//===========================================================================
function InitTrig_Lierre_Empoisonne takes nothing returns nothing
endfunction
//TESH.scrollpos=81
//TESH.alwaysfold=0
library SpellMurDeRonce needs libSpellEffect
globals
constant integer UNIT_MUR_DE_RONCE = 'h009'
endglobals
type Ronce extends unit array [5]
struct MurDeRonce extends Spell
Ronce ronce
real duree
group targets = CreateGroup()
method Enraciner takes unit ronce returns nothing
local location loc = GetUnitLoc(ronce)
local group g
local unit u = null
set Cond.condUnite = this.caster
set g = GetUnitsInRangeOfLocMatching(220, loc, And(Condition(function Cond.EnnemiVar), Condition(function Cond.Terrestre)) )
call RemoveLocation(loc)
set loc = null
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit(g, u)
if ( GetUnitAbilityLevel(u, BUFF_SARMENT) < 1 and not IsUnitInGroup(u, this.targets)) then
call GroupAddUnit( this.targets, u)
if( IsUnitBoss(u) ) then
call SEffect_Sarment( this.caster, u, this.dmg, 3, true)
else
call SEffect_Sarment( this.caster, u, this.dmg, 5, true)
endif
endif
endloop
call DestroyGroup(g)
set g = null
set u = null
endmethod
static method cycle takes nothing returns boolean
local thistype this = T1_GetData()
local integer a = 1
local unit u = null
set this.duree = this.duree - T1_PERIOD
loop
exitwhen a ==5
call this.Enraciner( this.ronce[a])
set a = a + 1
endloop
if( this.duree < 0.0 ) then
call DestroyGroup(this.targets)
set a = 0
loop
exitwhen a == 5
call KillUnit(this.ronce[a])
set a = a + 1
endloop
call Ronce.destroy(this.ronce)
call MurDeRonce.destroy(this)
return true
endif
return false
endmethod
endstruct
function edMurDeRonce takes nothing returns nothing
local MurDeRonce obj = MurDeRonce.create()
local location loc = GetSpellTargetLoc()
local real x = GetLocationX(loc)
local real y = GetLocationY(loc)
local integer lvl = GetSpellLvl()
local real angle
local integer a = 0
local unit u
call RemoveLocation(loc)
set loc = null
set obj.ronce = Ronce.create()
set obj.caster = GetSpellAbilityUnit()
set obj.dmg = (GetHeroInt(obj.caster, true) + GetHeroStr(obj.caster, true)) * (lvl*0.2 + 0.6)
set obj.duree = lvl + 9
set angle = Atan2(y - GetUnitY(obj.caster), x - GetUnitX(obj.caster) ) + bj_PI/2
set x = x - 90 * Cos(angle)
set y = y - 90 * Sin(angle)
loop
exitwhen a == 5
set u = CreateUnit( GetOwningPlayer(obj.caster), UNIT_MUR_DE_RONCE, x + (a-1)*90*Cos(angle), y + (a-1)*90*Sin(angle), GetRandomInt(0,360) )
set obj.ronce[a] = u
set a = a + 1
endloop
call T1_Add(function MurDeRonce.cycle, obj)
endfunction
endlibrary
//===========================================================================
function InitTrig_Mur_de_Ronce takes nothing returns nothing
endfunction
//TESH.scrollpos=99
//TESH.alwaysfold=0
globals
constant real Tornade_Distance = 200
constant integer Tornade_Speed = 7
endglobals
function Tornade_Action takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer m = GetHandleId(t)
local unit caster = LUnit( m, KEY_CASTER)
local integer i = LInteger( m, StringHash("i"))
local integer j
local real dmg = LReal( m, KEY_DAMAGE)
local real xc = LReal( m, StringHash("LocX"))
local real yc = LReal( m, StringHash("LocY"))
local real x
local real y
local real xu
local real yu
local integer a = 1
local integer k = 0
local unit tornade
local real angle
local group cibles
local location loc
if( i > 480 ) then
set j = LInteger(m, StringHash("j"))
if( j == LInteger(m, KEY_DURATION) - 1 ) then
loop
exitwhen a > 3
set tornade = LUnit( m, StringHash("Tornade"+I2S(a)))
call KillUnit(tornade)
set a = a + 1
endloop
call DestroyTimer(t)
call Flush(m)
return
endif
set i = 0
call SInteger( 0, m, StringHash("i"))
call SInteger( j + 1, m, StringHash("j"))
endif
if ( i < 180 or i > 300 ) then
if( i > 300 ) then
set k = 1
endif
call SInteger( i + Tornade_Speed, m, StringHash("i"))
loop
exitwhen a > 3
set tornade = LUnit(m, StringHash("Tornade"+I2S(a)) )
set x = LReal( m, StringHash("CentreX"+I2S(a+k)) )
set y = LReal( m, StringHash("CentreY"+I2S(a+k)) )
set angle = LReal( m, StringHash("Angle"+I2S(a)) )
set xu = x + Tornade_Distance * Cos(angle + Deg2Rad(i))
set yu = y + Tornade_Distance * Sin(angle + Deg2Rad(i))
call SetUnitX(tornade, xu)
call SetUnitY(tornade, yu)
if( ModuloInteger(i,14) == 0 and i > 30 and i < 450) then
set loc = Location(xu, yu)
call DmgToArea( loc, caster, dmg, 250, false)
call RemoveLocation(loc)
endif
set a = a + 1
endloop
else
call SInteger( i + Tornade_Speed/2, m, StringHash("i") )
loop
exitwhen a > 3
set tornade = LUnit( m, StringHash("Tornade"+I2S(a)) )
set angle = LReal( m, StringHash("Angle"+I2S(a)) )
set xu = xc + (Tornade_Distance*2)*Cos(angle+Deg2Rad(i))
set yu = yc + (Tornade_Distance*2)*Sin(angle+Deg2Rad(i))
call SetUnitX(tornade, xu)
call SetUnitY(tornade, yu)
if( ModuloInteger(i,2) == 0) then
set loc = Location(xu, yu)
call DmgToArea( loc, caster, dmg, 260,false)
call RemoveLocation(loc)
endif
set a = a + 1
endloop
endif
endfunction
function eeWind_Dancer takes nothing returns nothing
local unit Caster = GetTriggerUnit()
local location loc = GetSpellTargetLoc()
local real xt = GetLocationX(loc)
local real yt = GetLocationY(loc)
local unit u
local integer a = 1
local integer duree = 4 + GetSpellLvl() * 2
local real dmg = GetHeroInt( Caster, true) + GetSpellLvl() * 1.5
local timer t = CreateTimer()
local integer m = GetHandleId(t)
call RemoveLocation(loc)
call SUnit( Caster, m, KEY_CASTER)
call SInteger( duree, m, KEY_DURATION)
call SReal( xt, m, StringHash("LocX"))
call SReal( yt, m, StringHash("LocY"))
call SInteger( 0, m, StringHash("i"))
call SInteger( 0, m, StringHash("j"))
call SReal( dmg, m, KEY_DAMAGE)
loop
exitwhen a > 3
set u = CreateUnit(GetOwningPlayer(Caster),'ntor', xt, yt, 270.00)
call SUnit( u, m, StringHash("Tornade"+I2S(a)) )
call SReal( xt + Tornade_Distance * Cos(Deg2Rad((a*120)-60)), m, StringHash("CentreX"+I2S(a)) )
call SReal( yt + Tornade_Distance * Sin(Deg2Rad((a*120)-60)), m, StringHash("CentreY"+I2S(a)) )
call SReal( Deg2Rad((a+1)*120), m, StringHash("Angle"+I2S(a)) )
set a = a + 1
endloop
call SReal( LReal(m, StringHash("CentreX1")),m, StringHash("CentreX4") )
call SReal( LReal(m, StringHash("CentreY1")),m, StringHash("CentreY4") )
call TimerStart (t , 0.03,true ,function Tornade_Action )
set loc = null
endfunction
//===========================================================================
function InitTrig_Wind_Dancer takes nothing returns nothing
endfunction
//TESH.scrollpos=54
//TESH.alwaysfold=0
library SpellEpieuDeGlace needs libSpellEffect
globals
constant integer UNIT_EPIEU_DE_GLACE = 'h00E'
endglobals
struct EpieuDeGlace extends Spell
unit dummy
real vit = 30.0
real duree
real area
method FreezeArea takes nothing returns nothing
local location loc = Location( GetUnitX(this.target), GetUnitY(this.target) )
local group g = GetUnitsInRangeOfLocMatching(190, loc, Condition(function Cond.Alive ))
local unit u
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit( g, u)
if( IsUnitEnemy( u, GetOwningPlayer(this.caster)) ) then
call DmgToUnit( this.caster, u, this.dmg, true )
if( IsUnitBoss(u) ) then
call Gel_Total( u, this.duree/2 )
else
call Gel_Total( u, this.duree )
endif
endif
endloop
call DestroyGroup(g)
call RemoveLocation(loc)
endmethod
static method cycle takes nothing returns boolean
local thistype this = T003_GetData()
local real angle = Atan2( GetUnitY(this.target) - GetUnitY(this.dummy), GetUnitX(this.target) - GetUnitX(this.dummy) )
local real x = GetUnitX(this.dummy) + this.vit * Cos(angle)
local real y = GetUnitY(this.dummy) + this.vit * Sin(angle)
local real dx = GetUnitX(this.target) - GetUnitX(this.dummy)
local real dy = GetUnitY(this.target) - GetUnitY(this.dummy)
local real dist = SquareRoot( dx * dx + dy * dy)
call SetUnitX( this.dummy, x )
call SetUnitY( this.dummy, y )
if( dist < 50.0 ) then
call this.FreezeArea()
call EpieuDeGlace.destroy(this)
call KillUnit(this.dummy)
return true
endif
return false
endmethod
endstruct
function haEpieuDeGlace takes nothing returns nothing
local EpieuDeGlace obj = EpieuDeGlace.create()
local unit u = GetSpellAbilityUnit()
local real angle = Atan2( GetUnitY(GetSpellTargetUnit()) - GetUnitY(u), GetUnitX(GetSpellTargetUnit()) - GetUnitX(u) )
local integer lvl = GetSpellLvl()
set obj.dmg = lvl * 30 + GetHeroAgi(obj.caster,true) * (lvl*0.5 + 1.0)
set obj.caster = u
set obj.target = GetSpellTargetUnit()
set obj.duree = 2.0 + lvl*0.5 + GetHeroAgi(obj.caster,true)/(40-lvl*2)
set obj.dummy = CreateUnit( GetOwningPlayer(u), UNIT_EPIEU_DE_GLACE, GetUnitX(u), GetUnitY(u), Rad2Deg(angle) )
set obj.area = 200 + GetHeroAgi(obj.caster,true)
call T003_Add(function EpieuDeGlace.cycle, obj)
endfunction
//===========================================================================
function InitTrig_Epieu_de_Glace takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=9
//TESH.alwaysfold=0
library SpellNova needs libSpellEffect
globals
constant integer UNIT_NOVA = 'h002'
endglobals
function hbNova takes nothing returns nothing
local trigger t
local unit caster = GetTriggerUnit()
local unit dummy
local real x = GetUnitX(caster)
local real y = GetUnitY(caster)
local location loc = Location(x,y)
local integer lvl = GetSpellLvl()
local real dmg = lvl * 15 + GetHeroInt(caster, true) * R2I(lvl/2+1) + 10
set dummy = CreateUnit( GetOwningPlayer(caster), UNIT_NOVA, x, y, 0.0 )
call IssuePointOrder( dummy, "attackground", x, y )
call UnitApplyTimedLife( dummy, 'BTLF', 0.2 )
call ShowUnit(dummy, false)
call PolledWait(0.2)
call ShowUnit(dummy, true)
call DmgToArea( loc, caster, dmg, 420.0, true )
call RemoveLocation(loc)
endfunction
//===========================================================================
function InitTrig_Nova takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=48
//TESH.alwaysfold=0
library SpellBlocDeGlace needs libSpellEffect
globals
constant integer UNIT_BLOC_DE_GLACE = 'h013'
constant integer BUFF_BLOC_DE_GLACE = 'B00E'
constant string EFFECT_BLOC_DE_GLACE = "Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl"
endglobals
struct BlocDeGlace extends Spell
real duree
unit bloc
location loc = null
static method cycle takes nothing returns boolean
local thistype this = T05_GetData()
local player p = GetOwningPlayer(this.caster)
local group g = GetUnitsInRangeOfLocMatching( 420, this.loc, Condition(function Cond.Alive))
local unit u
loop
set u = GroupPickRandomUnit(g)
exitwhen u == null or IsUnitEnemy( u, p )
call GroupRemoveUnit(g,u)
endloop
if( u != null ) then
call IssueTargetOrder( u, "attack", this.bloc)
endif
set this.duree = this.duree - T05_PERIOD
if ( this.duree < 0.0 or GetUnitState( this.bloc, UNIT_STATE_LIFE) <= 0 ) then
call UnitRemoveBuffBJ( 'B00T', this.target )
call DmgToArea(this.loc, this.caster, this.dmg, 250, true)
call SetUnitPathing( this.target, true)
call BlocDeGlace.destroy(this)
call DestroyEffect( AddSpecialEffect( EFFECT_BLOC_DE_GLACE, GetUnitX(this.bloc), GetUnitY(this.bloc) ) )
call RemoveUnit(this.bloc)
call RemoveLocation(this.loc)
return true
endif
return false
endmethod
endstruct
function hcBlocDeGlace takes nothing returns nothing
local BlocDeGlace obj = BlocDeGlace.create()
local unit target = GetSpellTargetUnit()
local integer lvl = GetSpellLvl()
local real x
local real y
set obj.caster = GetSpellAbilityUnit()
set obj.duree = 10
set obj.dmg = 12 + lvl*8 + GetHeroStr(obj.caster, true) * (1.5+(lvl-1)*0.5)
set x = Pos_Terrain(GetUnitX(target))+64.0
set y = Pos_Terrain(GetUnitY(target))+64.0
set obj.loc = Location(x,y)
call SetUnitPathing( target, false)
set obj.target = target
set obj.bloc = CreateUnit( GetOwningPlayer(obj.caster), UNIT_BLOC_DE_GLACE, x, y, 270.0 )
call UnitApplyTimedLife( obj.bloc, BUFF_BLOC_DE_GLACE, obj.duree )
call SetUnitX(target, x)
call SetUnitY(target, y)
call SetTerrainTimed( x-64, y-64, GLACE, 1, obj.duree+0.3 )
call SetTerrainTimed( x+64, y-64, GLACE, 1, obj.duree+0.3 )
call SetTerrainTimed( x-64, y+64, GLACE, 1, obj.duree+0.3 )
call SetTerrainTimed( x+64, y+64, GLACE, 1, obj.duree+0.3 )
call DestroyEffect( AddSpecialEffect( EFFECT_BLOC_DE_GLACE, x, y ) )
set target = null
call T05_Add(function BlocDeGlace.cycle, obj)
endfunction
//===========================================================================
function InitTrig_Bloc_de_Glace takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=15
//TESH.alwaysfold=0
library SpellTourmentEsprit needs libSpellEffect
globals
constant integer UNIT_SPELL_TOURMENT_ESPRIT = 'h00Y'
endglobals
struct TourmentEsprit extends Spell
unit dummy = null
static method cycle takes nothing returns boolean
local thistype this = T003_GetData()
local real angle = Atan2( GetUnitY(this.caster) - GetUnitY(this.dummy), GetUnitX(this.caster) - GetUnitX(this.dummy) )
local real x = GetUnitX( this.dummy ) + 25.0 * Cos(angle)
local real y = GetUnitY( this.dummy ) + 25.0 * Sin(angle)
local real dx = GetUnitX(this.caster) - GetUnitX(this.dummy)
local real dy = GetUnitY(this.caster) - GetUnitY(this.dummy)
local real dist = SquareRoot( dx * dx + dy * dy)
if( dist < 80.0 ) then
call SEffect_VolDeMana( this.target, this.caster, this.dmg, 1.0 )
call KillUnit(this.dummy)
call TourmentEsprit.destroy(this)
return true
endif
call SetUnitX( this.dummy, x )
call SetUnitY( this.dummy, y )
call SetUnitFacing( this.dummy, Rad2Deg(angle) )
return false
endmethod
endstruct
function hdTourmentEsprit takes nothing returns nothing
local TourmentEsprit obj = TourmentEsprit.create()
set obj.caster = GetTriggerUnit()
set obj.target = GetSpellTargetUnit()
set obj.dummy = CreateUnit( GetOwningPlayer(obj.caster), UNIT_SPELL_TOURMENT_ESPRIT, GetUnitX(obj.target), GetUnitY(obj.target), 0.0 )
set obj.dmg = GetHeroInt( obj.caster, true) * R2I((GetSpellLvl()+1)/2+1)
call T003_Add(function TourmentEsprit.cycle, obj)
endfunction
//===========================================================================
function InitTrig_Tourment_Esprit takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=92
//TESH.alwaysfold=0
library SpellBlizzard needs libSpellEffect
globals
constant integer UNIT_BLIZZARD = 'h00U'
constant integer UNIT_EFFECT_BLIZZARD = 'h01A'
endglobals
function Blizzard_Actions takes nothing returns nothing
local timer t = GetExpiredTimer()
local Blizzard obj = LInteger( GetHandleId(t), StringHash("Blizzard") )
local real x = LReal( GetHandleId(t), StringHash("Blizzard_x") )
local real y = LReal( GetHandleId(t), StringHash("Blizzard_y") )
local location loc = Location(x,y)
local unit dummy = CreateUnit( GetOwningPlayer(obj.caster), UNIT_BLIZZARD, x, y, 0.0 )
call IssuePointOrder( dummy, "attackground", x, y )
call UnitApplyTimedLife( dummy, 'BTLF', 0.6 )
call SetUnitTimeScalePercent( dummy, 200 )
call DmgToArea( loc, obj.caster, obj.dmg, 180.0, true )
call DestroyEffect( AddSpecialEffect( "Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl", x, y ) )
call RemoveLocation(loc)
call DestroyTimer(t)
if( obj.detruire ) then
set obj.detruire = false
call RemoveLocation(obj.loc)
call Blizzard.destroy(obj)
endif
endfunction
struct Blizzard extends Spell
integer duree = 38 // en nombre d'éclat
location loc
boolean detruire = false
boolean destEffect = false
static method cycle takes nothing returns boolean
local thistype this = T05_GetData()
local timer t
local real dist
local real angle
local real x
local real y
local integer a = 0
loop
exitwhen a == 1
set t = CreateTimer()
set dist = GetRandomReal( 0, 350 )
set angle = GetRandomReal( 0, 2*bj_PI )
set x = GetLocationX(this.loc) + dist * Cos(angle)
set y = GetLocationY(this.loc) + dist * Sin(angle)
call DestroyEffect( AddSpecialEffect( "Abilities\\Spells\\Human\\Blizzard\\BlizzardTarget.mdl", x, y ) )
call SInteger( this, GetHandleId(t), StringHash("Blizzard") )
call SReal( x, GetHandleId(t), StringHash("Blizzard_x") )
call SReal( y, GetHandleId(t), StringHash("Blizzard_y") )
call TimerStart( t, 1.0, false, function Blizzard_Actions )
set a = a + 1
endloop
set this.duree = this.duree - 1
if( this.duree == 1 or not IsUnitCanalisation(this.caster) ) then
set this.detruire = true
set this.destEffect = true
return true
endif
return false
endmethod
endstruct
struct effectBlizzard extends Spell
Blizzard ptrBlizzard
real angle = bj_PI/2
static method cycle takes nothing returns boolean
local thistype this = T025_GetData()
local unit caster = this.ptrBlizzard.caster
local real x = GetUnitX(caster) + 100.0 * Cos(this.angle)
local real y = GetUnitY(caster) + 100.0 * Sin(this.angle)
local unit u = CreateUnit( GetOwningPlayer( this.ptrBlizzard.caster), UNIT_EFFECT_BLIZZARD, x, y, 0.0 )
set this.angle = this.angle + Deg2Rad(20.0)
call SetUnitFlyHeight( u, 2000.0, 900.0)
call UnitApplyTimedLife( u, 'BTLF', 2.3 )
if( this.ptrBlizzard.destEffect ) then
call effectBlizzard.destroy(this)
return true
endif
return false
endmethod
endstruct
function heBlizzard takes nothing returns nothing
local Blizzard obj = Blizzard.create()
local effectBlizzard effBli = effectBlizzard.create()
set obj.caster = GetTriggerUnit()
set obj.loc = GetSpellTargetLoc()
set obj.dmg = GetSpellLvl() * 80 + GetHeroInt( obj.caster, true ) / 2
set obj.duree = obj.duree + GetHeroAgi(obj.caster, true) / 7
call Canalisation(obj.caster)
call T05_Add(function Blizzard.cycle, obj)
set effBli.ptrBlizzard = obj
call T025_Add(function effectBlizzard.cycle, effBli)
endfunction
//===========================================================================
function InitTrig_Blizzard takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=22
//TESH.alwaysfold=0
function Jet_de_Roche_Actions takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local unit target = GetTriggerUnit()
local unit caster = LUnit( GetHandleId(t), KEY_CASTER)
local real dmg = LReal( GetHandleId(t), KEY_DAMAGE)
call DisableTrigger(t)
call DmgToUnit(caster, target, dmg, true)
call EnableTrigger(t)
endfunction
function maJetDeRoche takes nothing returns nothing
local trigger t
local integer m
local unit caster = GetTriggerUnit()
local integer lvl = GetUnitAbilityLevel( caster, GetSpellAbilityId())
local real dmg = lvl * 30 + 10 + GetHeroStr(caster, true) * (lvl * 0.4 + 0.6)
local location loc = GetSpellTargetLoc()
local group g = GetUnitsInRangeOfLocMatching(400, loc, Condition(function Cond_Groupe_Ennemi))
local unit u = null
local unit dummy = null
if( not LifeCost( caster, 60 + lvl * 25) ) then
call DestroyGroup(g)
set g = null
return
endif
set dummy = CreateUnit( GetOwningPlayer(caster), 'h012', 0, 0, GetUnitFacing(caster) )
call SetUnitX(dummy, GetUnitX(caster))
call SetUnitY(dummy, GetUnitY(caster))
call IssuePointOrder( dummy, "healingspray", GetLocationX(loc), GetLocationY(loc))
call UnitApplyTimedLife( dummy, 'BTLF', 3.0)
call RemoveLocation(loc)
set loc = null
set t = CreateTrigger()
set m = GetHandleId(t)
call SUnit( dummy, m, KEY_CASTER)
call SReal( dmg, m, KEY_DAMAGE)
call TimedTrigger(t, 3.0)
call TriggerAddAction( t, function Jet_de_Roche_Actions )
call TriggerAddCondition(t, Condition( function Dgts_Caster_Conditions ) )
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit(g, u)
call TriggerRegisterUnitEvent( t, u , EVENT_UNIT_DAMAGED )
endloop
call DestroyGroup(g)
set g = null
set dummy = null
endfunction
//===========================================================================
function InitTrig_Jet_de_Roche takes nothing returns nothing
endfunction
//TESH.scrollpos=13
//TESH.alwaysfold=0
library SpellOndeSismique needs libSpellEffect
globals
constant integer EFFECT_ONDE_SISMIQUE = 'h00G'
endglobals
struct OndeSismique extends Spell
real vit
real x
real y
real angle
real duree
real dist
real area_dec
unit e
group g = CreateGroup()
integer i = 0
static method cycle takes nothing returns boolean
local thistype this = T003_GetData()
local real x = GetUnitX(this.e)
local real y = GetUnitY(this.e)
local location loc = null
local group g
local unit u
local real angle
set this.i = this.i + 1
if( this.i <= this.dist/this.vit) then
set Cond.condUnite = this.caster
set loc = Location(x,y)
set g = GetUnitsInRangeOfLocMatching(250-this.i*this.area_dec, loc, And( And(Condition(function Cond.EnnemiVar), Condition(function Cond.Terrestre)), Not(Condition(function Cond.Immun)) ) )
call RemoveLocation(loc)
set loc = null
call SetUnitX(this.e, x + this.vit * Cos(this.angle))
call SetUnitY(this.e, y + this.vit * Sin(this.angle))
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit(g, u)
if( not IsUnitInGroup( u, this.g) ) then
call GroupAddUnit( this.g, u)
set angle = Atan2(GetUnitY(u) - this.y, GetUnitX(u) - this.x )
call Recul( this.x, this.y, u, 200, 0, 30)
call SEffect_Bash(u, this.duree)
call DmgToUnit( this.caster, u, this.dmg, true)
endif
endloop
call DestroyGroup(g)
set g = null
else
call DestroyGroup(this.g)
call OndeSismique.destroy(this)
return true
endif
set loc = null
return false
endmethod
endstruct
function mbOndeSismique takes nothing returns nothing
local OndeSismique obj = 0
local integer lvl = GetSpellLvl()
local location loc = GetSpellTargetLoc()
if( not LifeCost( GetSpellAbilityUnit(), 50 + lvl * 15) ) then
call RemoveLocation(loc)
set loc = null
return
endif
set obj = OndeSismique.create()
set obj.caster = GetSpellAbilityUnit()
set obj.dmg = lvl * 30 + GetHeroStr(obj.caster, true)
set obj.duree = 0.2 + lvl * 0.2 + I2R(GetHeroAgi(obj.caster,true)) * I2R(lvl)/100
set obj.x = GetUnitX(obj.caster)
set obj.y = GetUnitY(obj.caster)
set obj.angle = Atan2(GetLocationY(loc) - obj.y, GetLocationX(loc) - obj.x )
set obj.vit = 50.0
set obj.dist = 500.0
set obj.area_dec = (250-100) / (obj.dist/obj.vit)
set obj.e = CreateUnit(GetOwningPlayer(obj.caster), EFFECT_ONDE_SISMIQUE, obj.x+120*Cos(obj.angle), obj.y + 120*Sin(obj.angle), Rad2Deg(obj.angle))
call RemoveLocation(loc)
set loc = null
call T003_Add(function OndeSismique.cycle, obj)
endfunction
endlibrary
//===========================================================================
function InitTrig_Onde_de_choc takes nothing returns nothing
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
library SpellIncineration needs libSpellEffect
globals
constant integer BUFF_Incineration = 'BEim'
constant integer KS_INCINERATION = StringHash("spell__incineration")
endglobals
struct Incineration extends Spell
real regen = 0.0
method Unactif takes nothing returns nothing
local location loc = null
if( not IsUnitHidden(this.caster) ) then
set loc = GetUnitLoc(this.caster)
call DmgToAreaEffect( loc, this.caster, this.dmg, 190, false, "Abilities\\Spells\\NightElf\\Immolation\\ImmolationDamage.mdl")
call RemoveLocation(loc)
set loc = null
endif
endmethod
static method cycle takes nothing returns boolean
local thistype this = T05_GetData()
if( GetUnitAbilityLevel( this.caster, BUFF_Incineration) < 1 or IsUnitDeadBJ(this.caster) ) then
call this.Unactif()
else
call AddLife( this.caster, this.regen)
endif
return false
endmethod
endstruct
function mcIncinerationLearn takes unit u, integer lvl returns nothing
local Incineration obj = LInteger( GetHandleId(u), KS_INCINERATION)
if( obj == 0 ) then
set obj = Incineration.create()
set obj.caster = u
call SInteger( obj, GetHandleId(u), KS_INCINERATION )
call T05_Add(function Incineration.cycle, obj)
endif
set obj.dmg = 2 + lvl * 2
set obj.regen = 10 + lvl * 10
endfunction
function mcIncineration takes nothing returns nothing
endfunction
//===========================================================================
function InitTrig_Incineration_Fusion takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=55
//TESH.alwaysfold=0
library SpellMeteorGolem needs libSpellEffect
globals
constant integer UNIT_METEOR_FIRE = 'h01C'
constant integer UNIT_METEOR_ROCHE = 'h01K'
constant integer KS_METEOR_GOLEM = StringHash("spell__MeteorGolem")
endglobals
struct MeteorGolem extends Spell
real x
real y
real duree
boolean b = true
static method Crash takes nothing returns nothing
local timer t = GetExpiredTimer()
local MeteorGolem obj = LInteger( GetHandleId(t) , KS_METEOR_GOLEM)
local unit u
local player p = GetOwningPlayer(obj.caster)
local real x = obj.x
local real y = obj.y
local integer a = 0
call DestroyTimer(t)
set t = null
call Flush( GetHandleId(t) )
set u = CreateUnit( p, UNIT_METEOR_FIRE, x, y, 270.0 )
call UnitApplyTimedLife( u, 'BTLF', obj.duree)
loop
exitwhen a == 5
set u = CreateUnit( p, UNIT_METEOR_FIRE, x+100*Cos(Deg2Rad(90+a*72.0)), y+100*Sin(Deg2Rad(90+a*72.0)), 270.0 )
call UnitApplyTimedLife( u, 'BTLF', obj.duree)
set u = CreateUnit( p, UNIT_METEOR_FIRE, x+170*Cos(Deg2Rad(54+a*72.0)), y+170*Sin(Deg2Rad(54+a*72.0)), 270.0 )
call UnitApplyTimedLife( u, 'BTLF', obj.duree)
set a = a + 1
endloop
set u = CreateUnit( p, UNIT_METEOR_ROCHE, x, y, 270 )
call UnitApplyTimedLife( u, 'BTLF', 1.5)
call IssuePointOrder( u, "attackground", x+80*Cos(4.2), y+80*Sin(4.2))
set u = CreateUnit( p, UNIT_METEOR_ROCHE, x, y, 270 )
call UnitApplyTimedLife( u, 'BTLF', 1.5)
call IssuePointOrder( u, "attackground", x+170*Cos(5.6), y+170*Sin(5.6))
set u = CreateUnit( p, UNIT_METEOR_ROCHE, x, y, 270 )
call UnitApplyTimedLife( u, 'BTLF', 1.5)
call IssuePointOrder( u, "attackground", x+200*Cos(0.2), y+200*Sin(0.2))
set u = CreateUnit( p, UNIT_METEOR_ROCHE, x, y, 270 )
call UnitApplyTimedLife( u, 'BTLF', 1.5)
call IssuePointOrder( u, "attackground", x+80*Cos(1.7), y+80*Sin(1.7))
call T1_Add(function MeteorGolem.cycle, obj)
endmethod
static method cycle takes nothing returns boolean
local thistype this = T1_GetData()
local location loc = Location(this.x,this.y)
if (this.b) then
set this.b = false
return false
endif
call DmgToArea( loc, this.caster, this.dmg, 240.0, false )
call RemoveLocation(loc)
set loc = null
set this.duree = this.duree - T1_PERIOD
if( this.duree <= 0.0 ) then
call MeteorGolem.destroy(this)
return true
endif
return false
endmethod
endstruct
function mdMeteorGolem takes nothing returns nothing
local MeteorGolem obj = 0
local integer lvl = GetSpellLvl()
local real dmg = 0.0
local location loc = GetSpellTargetLoc()
local timer t = null
if( not LifeCost( GetSpellAbilityUnit(), 140 + lvl * 30) ) then
call RemoveLocation(loc)
set loc = null
return
endif
set t = CreateTimer()
set dmg = lvl * 50 + GetHeroInt(GetSpellAbilityUnit(), true)*R2I((lvl+1)/2+1) + 80
set obj = MeteorGolem.create()
set obj.caster = GetSpellAbilityUnit()
set obj.x = GetLocationX(loc)
set obj.y = GetLocationY(loc)
set obj.duree = 5.0
set obj.dmg = lvl * 30 + 10
call SEffect_Meteor( obj.caster, GetLocationX(loc), GetLocationY(loc), dmg, true, 240)
call RemoveLocation(loc)
set loc = null
call SInteger( obj, GetHandleId(t), KS_METEOR_GOLEM)
call TimerStart( t, 0.7, false, function MeteorGolem.Crash )
endfunction
endlibrary
//===========================================================================
function InitTrig_Meteor_Golem takes nothing returns nothing
endfunction
//TESH.scrollpos=28
//TESH.alwaysfold=0
library SpellEruption needs libSpellEffect
globals
constant integer KS_ERUPTION = StringHash("spell__eruption")
endglobals
struct SpEruption extends Spell
timer t = CreateTimer()
real x
real y
integer duree // en nbre d'éruptions
real dot
static method Actions takes nothing returns nothing
local SpEruption obj = LInteger( GetHandleId(GetExpiredTimer()), KS_ERUPTION)
local real r
if( obj.duree > 0 and IsUnitCanalisation(obj.caster) ) then
set obj.duree = obj.duree - 1
call TimerStart( obj.t, 0.6, false, function SpEruption.Actions)
call obj.cycle()
else
call IssueImmediateOrder( obj.caster, "stop")
call DestroyTimer(obj.t)
call SpEruption.destroy(obj)
endif
endmethod
method cycle takes nothing returns boolean
local location loc = GetRandomLoc( this.x, this.y, 305)
call SEffect_Eruption( this.caster, GetLocationX(loc), GetLocationY(loc), this.dmg, this.dot, 7.0, true )
call RemoveLocation(loc)
set loc = null
return true
endmethod
endstruct
function meEruption takes nothing returns nothing
local SpEruption obj = 0
local location loc = null
local integer lvl = GetSpellLvl()
if( not LifeCost( GetSpellAbilityUnit(), 200 + lvl * 45) ) then
return
endif
set obj = SpEruption.create()
set loc = GetSpellTargetLoc()
set obj.caster = GetSpellAbilityUnit()
set obj.dmg = lvl * 55 + GetHeroInt(obj.caster, true)
set obj.dot = lvl * 40
set obj.duree = 20 + GetHeroInt(obj.caster, true)/10
set obj.x = GetLocationX(loc)
set obj.y = GetLocationY(loc)
call RemoveLocation(loc)
set loc = null
call Canalisation( obj.caster)
call SInteger( obj, GetHandleId(obj.t), KS_ERUPTION )
call TimerStart( obj.t, 0.1, false, function SpEruption.Actions)
endfunction
endlibrary
//===========================================================================
function InitTrig_Eruption takes nothing returns nothing
endfunction
//TESH.scrollpos=37
//TESH.alwaysfold=0
library SpellAttraction needs libSpellEffect
globals
constant string EFFECT_ATTRACTION_SORT = "Abilities\\Spells\\Other\\HowlOfTerror\\HowlTarget.mdl"
endglobals
struct AttractionSort extends Spell
player p
effect e
method cycle takes nothing returns boolean
return true
endmethod
endstruct
function AttractionSort_Actions takes nothing returns nothing
local timer t = GetExpiredTimer()
local AttractionSort obj = LInteger( GetHandleId(t), StringHash("AttractionSort") )
call SetUnitOwner( obj.target, obj.p, false)
call DestroyEffect(obj.e)
call DestroyTimer(t)
call RInteger(GetHandleId(t), StringHash("AttractionSort") )
call AttractionSort.destroy(obj)
endfunction
function caAttractionSort takes nothing returns nothing
local AttractionSort obj = AttractionSort.create()
local real duree = 0.0
local timer t = CreateTimer()
local location loc = GetUnitLoc(GetSpellTargetUnit())
local group g = GetUnitsInRangeOfLocMatching( 250, loc, Condition( function Cond.Ennemi) )
local unit u = null
set obj.caster = GetTriggerUnit()
set obj.target = GetSpellTargetUnit()
set obj.e = AddSpecialEffectTarget( EFFECT_ATTRACTION_SORT, obj.target, "origin" )
set obj.p = GetOwningPlayer(obj.target)
set duree = GetSpellLvl() * 1.5 + 3.5 + GetHeroAgi(obj.caster,true)/(15-GetSpellLvl())
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit(g, u)
call IssueTargetOrder( u, "attack", obj.target )
call IssueTargetOrder( obj.target, "attack", u )
endloop
call DestroyGroup(g)
call SetUnitOwner( obj.target, Player(PLAYER_NEUTRAL_AGGRESSIVE), false)
call RemoveLocation(loc)
call SInteger( obj, GetHandleId(t), StringHash("AttractionSort") )
call TimerStart (t, duree, false , function AttractionSort_Actions )
set g = null
set loc = null
endfunction
//===========================================================================
function InitTrig_Attraction takes nothing returns nothing
call Preload(EFFECT_ATTRACTION_SORT)
endfunction
endlibrary
//TESH.scrollpos=95
//TESH.alwaysfold=0
library SpellDarkBond needs libSpellEffect
globals
constant string DARK_BOND_EFFECT = "Abilities\\Spells\\Undead\\Cripple\\CrippleTarget.mdl"
endglobals
struct DarkBond_Link
lightning l = null
effect e = null
unit target = null
endstruct
type ListLink extends DarkBond_Link array [10]
struct DarkBond extends Spell
ListLink lLink
integer N = 0 // Nombre d'unité touchées
real duree
static method cycle takes nothing returns boolean
local thistype this = T003_GetData()
local DarkBond_Link link
local unit u
local integer a = 0
local location locA = GetUnitLoc(this.caster)
local location locB
local integer b = 1
local real ang = Deg2Rad(GetUnitFacing(this.caster))
loop
exitwhen a == this.N
set link = this.lLink[a]
set u = link.target
call MoveLightningEx( link.l, true, GetUnitX(this.caster)+35*Cos(ang+bj_PI*0.4*b), GetUnitY(this.caster)+35*Sin(ang+bj_PI*0.4*b), GetUnitZ(this.caster)+170, GetUnitX(u), GetUnitY(u), GetUnitZ(u)+Z_ECLAIR )
set b = 0 - b
if ( ModuloReal(this.duree, 1.0) >= 0.0 and ModuloReal(this.duree, 1.0) < 0.03 ) then
call DmgToUnit( this.caster, u, this.dmg, true)
endif
set locB = GetUnitLoc(u)
if ( GetUnitState(u, UNIT_STATE_LIFE) <= 0 or DistanceBetweenPoints( locA, locB) > 900) then
call DestroyEffect( link.e )
call DestroyLightning( link.l )
set this.lLink[a] = this.lLink[this.N-1]
set this.N = this.N - 1
set a = a - 1
endif
call RemoveLocation( locB )
set a = a + 1
endloop
call RemoveLocation( locA )
set this.duree = this.duree - T003_PERIOD
if( this.duree < 0.0 or this.N == 0 or not IsUnitCanalisation(this.caster) ) then
set a = 0
loop
exitwhen a == this.N
set link = this.lLink[a]
call DestroyEffect( link.e )
call DestroyLightning( link.l )
call DarkBond_Link.destroy( link)
set a = a + 1
endloop
call IssueImmediateOrder( this.caster, "stop" )
call DarkBond.destroy(this)
return true
endif
return false
endmethod
endstruct
function cbDark_Bond takes nothing returns nothing
local DarkBond obj = DarkBond.create()
local location loc = GetSpellTargetLoc()
local group g = GetUnitsInRangeOfLocMatching(200, loc, Condition(function Cond.Ennemi))
local integer nb_unit = CountUnit(g)
local integer lvl = GetSpellLvl()
local unit u = null
local DarkBond_Link link
set obj.lLink = ListLink.create()
set obj.caster = GetTriggerUnit()
set obj.dmg = GetHeroStr(obj.caster, true) * (0.8+0.2*lvl) + 15 * lvl
set obj.duree = 6.0
if( nb_unit > lvl/2 + 2) then
set nb_unit = lvl/2 + 2
endif
loop
set u = FirstOfGroup(g)
exitwhen obj.N == nb_unit or u == null
call GroupRemoveUnit( g, u)
if( not IsUnitImmun(u) ) then
set link = DarkBond_Link.create()
set link.target = u
set link.l = AddLightningEx("AFOD", true, GetUnitX(obj.caster), GetUnitY(obj.caster),GetUnitZ(obj.caster)+170, GetUnitX(u), GetUnitY(u), GetUnitFlyHeight(u)+Z_ECLAIR )
set link.e = AddSpecialEffectTarget( "Abilities\\Spells\\Undead\\Cripple\\CrippleTarget.mdl", u, "origin" )
set obj.lLink[obj.N] = link
set obj.N = obj.N + 1
endif
endloop
if( obj.N != 0 ) then
call Canalisation(obj.caster)
call T003_Add(function DarkBond.cycle, obj)
else
call IssueImmediateOrder( obj.caster, "stop" )
endif
call DestroyGroup(g)
call RemoveLocation(loc)
set g = null
set loc = null
endfunction
//===========================================================================
function InitTrig_Lien_Noir takes nothing returns nothing
call Preload(DARK_BOND_EFFECT)
endfunction
endlibrary
//TESH.scrollpos=52
//TESH.alwaysfold=0
function Cannalisation_Condition takes nothing returns boolean
local integer abilityId = GetSpellAbilityId()
return abilityId != 'A00Q' and abilityId != 'A03K' and abilityId != 'A03L' and abilityId != 'A03J'
endfunction
globals
constant string CHANNEL_EFFECT = "Abilities\\Spells\\Demon\\DarkConversion\\ZombifyTarget.mdl"
constant integer KS_LEVEL_CANNA = StringHash("Level_Canna")
constant integer KS_TRIGGER_CANNA = StringHash("Trigger_Canna")
endglobals
function Cannalisation_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local integer m = GetHandleId( caster )
local location loc = GetUnitLoc(caster)
local group cibles = GetUnitsInRangeOfLocMatching(650, loc, Condition(function Cond_Groupe_Ennemi))
local integer level = LInteger(m, KS_LEVEL_CANNA)
local integer nb_unit = 0
local unit u = null
local integer dmg = GetHeroInt(caster, true)+level*15
call RemoveLocation(loc)
set loc = null
if ( GetUnitAbilityLevel(caster, 'Bmfl') < 1) then
call RInteger( m, KS_LEVEL_CANNA)
call RHandle( m, KS_TRIGGER_CANNA)
call DestroyTrigger(GetTriggeringTrigger() )
return
endif
loop
set u = FirstOfGroup(cibles)
exitwhen u == null
call GroupRemoveUnit( cibles, u)
call PolledWait(0.1)
if( not IsUnitImmun(u) ) then
call Eclair( "MFPB", caster, u, 0.5, "Abilities\\Spells\\Demon\\DarkConversion\\ZombifyTarget.mdl", "origin" )
call DmgToUnit( caster, u, dmg, true )
set nb_unit = nb_unit + 1
endif
endloop
if( nb_unit > 0 ) then
call AddMana( caster, (dmg*nb_unit)/5 )
call TxtFlo( I2S((dmg*nb_unit)/5), caster, 80, 10, 90 )
endif
call DestroyGroup(cibles)
set cibles = null
endfunction
function ccCannalisation takes nothing returns nothing
local trigger t
local unit caster = GetTriggerUnit()
local integer m = GetHandleId(caster)
local integer level = GetUnitAbilityLevel( GetTriggerUnit(), GetSpellAbilityId())
if( GetSpellAbilityId()=='A03J' or GetSpellAbilityId()=='A03k' or GetSpellAbilityId()=='A03L' ) then
return
endif
if ( GetUnitAbilityLevel(caster, 'Bmfl') < 1 ) then
if( HaveSavedHandle( ht, m, KS_TRIGGER_CANNA) ) then
call DestroyTrigger( LTrigger( m, KS_TRIGGER_CANNA) )
endif
set t = CreateTrigger()
call SInteger( level, m, KS_LEVEL_CANNA)
call STrigger( t, m, KS_TRIGGER_CANNA)
call TriggerAddAction( t, function Cannalisation_Actions )
call TriggerAddCondition( t, Condition(function Cannalisation_Condition) )
call TriggerRegisterUnitEvent( t, caster , EVENT_UNIT_SPELL_EFFECT )
endif
endfunction
//===========================================================================
function InitTrig_Canalisation takes nothing returns nothing
call Preload(CHANNEL_EFFECT)
endfunction
//TESH.scrollpos=54
//TESH.alwaysfold=0
globals
constant string EFFECT_TARGET_NOVA_MORTELLE = "Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl"
constant string EFFECT_AREA_NOVA_MORTELLE = "Abilities\\Spells\\Undead\\FreezingBreath\\FreezingBreathMissile.mdl"
constant string EFFECT_SPECIAL_NOVA_MORTELLE = "Objects\\Spawnmodels\\Human\\HumanBlood\\BloodElfSpellThiefBlood.mdl"
constant integer BUFF_NOVA_MORTELLE = 'B006'
endglobals
function Death_nova_Actions takes nothing returns nothing
local integer m = GetHandleId(GetTriggeringTrigger())
local unit caster = LUnit( m, KEY_CASTER)
local unit target = GetTriggerUnit()
local real dmg = LReal( m, KEY_DAMAGE)
local location loc
if ( GetUnitAbilityLevel(target, BUFF_NOVA_MORTELLE) < 1 ) then
call Flush(m)
call DestroyTrigger(GetTriggeringTrigger() )
return
endif
call DestroyEffect( AddSpecialEffectTarget( EFFECT_TARGET_NOVA_MORTELLE, target, "origin") )
call DestroyEffect( AddSpecialEffectTarget( EFFECT_AREA_NOVA_MORTELLE, target, "origin") )
set loc = Location(GetUnitX(target), GetUnitY(target))
call DmgToArea( loc, caster, dmg, 350.0, true)
call RemoveLocation(loc)
set loc = null
endfunction
function Barbs_Actions takes nothing returns nothing
local integer m = GetHandleId(GetTriggeringTrigger())
local unit caster = LUnit( m, KEY_CASTER)
local unit target = GetTriggerUnit()
local real dmg = LReal( m, KEY_DAMAGE)
if ( GetUnitAbilityLevel(target, BUFF_NOVA_MORTELLE) < 1 ) then
call Flush(m)
call DestroyTrigger(GetTriggeringTrigger() )
return
endif
call DisableTrigger(GetTriggeringTrigger())
call DmgToUnit( caster, target, GetEventDamage()*dmg, true )
call EnableTrigger(GetTriggeringTrigger())
call DestroyEffect( AddSpecialEffectTarget( EFFECT_SPECIAL_NOVA_MORTELLE, target, "origin") )
endfunction
function cdDeath_nova takes nothing returns nothing
local trigger t
local integer m
local unit target = GetSpellTargetUnit()
local unit caster = GetTriggerUnit()
local integer lvl = GetSpellLvl()
if ( GetUnitAbilityLevel(target, BUFF_NOVA_MORTELLE) < 1 ) then
set t = CreateTrigger()
set m = GetHandleId(t)
call SUnit( caster, m, KEY_CASTER)
call SReal( I2R(GetHeroAgi(caster, true))/100.0, m, KEY_DAMAGE )
call TriggerSleepAction(0.00)
call TriggerAddAction( t, function Barbs_Actions )
call TriggerRegisterUnitEvent( t, target , EVENT_UNIT_DAMAGED )
set t = CreateTrigger()
set m = GetHandleId(t)
call SUnit( GetTriggerUnit(), m, KEY_CASTER)
call SReal( GetHeroInt(caster, true)*R2I((lvl+1)/2+1) + lvl*40 + 20 , m, KEY_DAMAGE )
call TriggerAddAction( t, function Death_nova_Actions )
call TriggerRegisterUnitStateEvent(t, target, UNIT_STATE_LIFE, LESS_THAN, 5)
endif
endfunction
//===========================================================================
function InitTrig_Nova_Mortelle takes nothing returns nothing
call Preload(EFFECT_TARGET_NOVA_MORTELLE)
call Preload(EFFECT_AREA_NOVA_MORTELLE)
call Preload(EFFECT_SPECIAL_NOVA_MORTELLE)
endfunction
//TESH.scrollpos=95
//TESH.alwaysfold=0
library RituelMalefique needs libSpellEffect
struct RituelMalAme extends Spell
unit ame
real angle
real vie
real dist
RituelMal rm
method init takes unit ame, real angle, real vie, real dist, RituelMal rm returns nothing
set this.ame = ame
set this.angle = angle
set this.vie = vie
set this.dist = dist
set this.rm = rm
endmethod
static method cycle takes nothing returns boolean
local thistype this = T003_GetData()
if( this.dist < 50.0 ) then
call AddLife( this.rm.caster, this.vie * this.rm.page)
call TxtFlo( I2S(R2I(this.vie * this.rm.page)), this.rm.caster, 20, 90, 20 )
call KillUnit(this.ame)
call RituelMalAme.destroy(this)
return true
endif
set this.dist = this.dist - 1.5
set this.angle = this.angle - 14.0 / this.dist
call SetUnitX(this.ame, GetUnitX(this.rm.caster) + this.dist * Cos(this.angle) )
call SetUnitY(this.ame, GetUnitY(this.rm.caster) + this.dist * Sin(this.angle) )
return false
endmethod
endstruct
struct RituelMal extends Spell
timer t = CreateTimer()
integer range
integer duree // nbre de vague
real page
real x
real y
static method cycle takes nothing returns boolean
local thistype this = T15_GetData()
local location loc = GetUnitLoc(this.caster)
local group cibles = GetUnitsInRangeOfLocMatching( this.range, loc, And(Condition(function Cond.Alive), Not(Condition(function Cond.Structure))) )
local unit u
local RituelMalAme rma
local real x
local real y
local real z
local real angle
local location l1
local location l2
local unit ame
if( not IsUnitCanalisation(this.caster) or this.duree==0 or GetUnitState(this.caster,UNIT_STATE_LIFE) < 1) then
call DestroyTimer(this.t)
call DestroyGroup(cibles)
call RemoveLocation(loc)
call RituelMal.destroy(this)
return true
endif
loop
set u = FirstOfGroup(cibles)
exitwhen u == null
if( IsUnitEnemy( u, GetOwningPlayer( this.caster)) ) then
set x = GetUnitX(u)
set y = GetUnitY(u)
set z = GetUnitState( u, UNIT_STATE_MAX_LIFE) * this.dmg
set angle = Atan2( y - this.y, x - this.x )
set l1 = Location( this.x, this.y)
set l2 = Location( x, y)
set rma = RituelMalAme.create()
set ame = CreateUnit( GetOwningPlayer(this.caster), 'h008', x, y, Rad2Deg(angle) )
call rma.init( ame, angle, z, DistanceBetweenPoints(l1, l2), this )
call DmgToUnit( this.caster, u, z, true)
call RemoveLocation(l1)
call RemoveLocation(l2)
call T003_Add(function RituelMalAme.cycle, rma )
endif
call GroupRemoveUnit( cibles, u)
endloop
call DestroyGroup(cibles)
call RemoveLocation(loc)
set cibles = null
set loc = null
set this.duree = this.duree - 1
return false
endmethod
endstruct
function ceRituel_des_damnes takes nothing returns nothing
local integer lvl
local RituelMal rm = RituelMal.create()
set rm.caster = GetTriggerUnit()
set lvl = GetUnitAbilityLevel( rm.caster, GetSpellAbilityId())
set rm.dmg = (5.0 + lvl * 0.5)/100
set rm.range = 550 + GetHeroStr(rm.caster, true)
set rm.duree = 9 + 1*lvl
set rm.page = 0.2
set rm.x = GetUnitX(rm.caster)
set rm.y = GetUnitY(rm.caster)
call Canalisation(rm.caster)
call T15_Add(function RituelMal.cycle, rm)
endfunction
//===========================================================================
function InitTrig_Rituel_Malefique takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library SpellPreparation needs libDamage, libSpellEffect, libCondition
globals
constant string PREPARATION_EFFECT = "Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl"
constant integer KS_PREPARATION = StringHash("spell__preparation")
endglobals
struct PreparationTarget
unit target = null
trigger tDamage = null
triggercondition tDamageCond = null
Preparation ptrPrep = 0
method onDestroy takes nothing returns nothing
call Flush(GetHandleId(.tDamage))
call TriggerRemoveCondition(.tDamage, .tDamageCond)
call DestroyTrigger(.tDamage)
endmethod
endstruct
struct Preparation extends Spell
trigger tAttack = null
triggercondition tCond = null
integerList targets = 0
group gTargets = CreateGroup()
method onDestroy takes nothing returns nothing
local PreparationTarget pt = 0
call RInteger( GetHandleId(.tAttack), KEY_CASTER )
call RInteger( GetHandleId(.caster), KS_PREPARATION )
loop
call BJDebugMsg(I2S(.targets.getCount()))
exitwhen .targets.getCount() == 0
set pt = .targets.first()
call .targets.delete(pt)
call pt.destroy()
endloop
call TriggerRemoveCondition(.tAttack, .tCond)
call DestroyTrigger(.tAttack)
call DestroyGroup(.gTargets)
endmethod
endstruct
function Dgts_Preparation takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local PreparationTarget pt = LInteger( GetHandleId(t), KS_PREPARATION )
local Preparation p = pt.ptrPrep
local unit target = GetTriggerUnit()
local location loc = GetUnitLoc(target)
call DisableTrigger(t)
call DestroyEffect( AddSpecialEffectTarget( PREPARATION_EFFECT, target, "origin" ) )
call DmgToArea( loc, p.caster, p.dmg, 200, true )
call Preparation.destroy(p)
call RemoveLocation(loc)
call Shake(GetOwningPlayer(p.caster))
set loc = null
set target = null
set t = null
endfunction
function Preparation_Actions takes nothing returns nothing
local Preparation p = LInteger( GetHandleId(GetAttacker()), KS_PREPARATION )
local PreparationTarget pt = 0
local unit target = GetTriggerUnit()
if( not IsUnitInGroup( target, p.gTargets)) then
call GroupAddUnit( p.gTargets, target)
// Instance pour les effets du sort
set pt = PreparationTarget.create()
// Création du déclencheur pour cette cible
set pt.tDamage = CreateTrigger()
call TriggerAddAction( pt.tDamage, function Dgts_Preparation )
call TriggerRegisterUnitEvent( pt.tDamage, target, EVENT_UNIT_DAMAGED )
set pt.tDamageCond = TriggerAddCondition(pt.tDamage, Condition( function Cond.DgtsCaster ) )
set pt.ptrPrep = p
// Lie le caster au trigger pour la condition
call SUnit( GetAttacker(), GetHandleId(pt.tDamage), KEY_CASTER)
// Lie la struct au trigger
call SInteger( pt, GetHandleId(pt.tDamage), KS_PREPARATION)
// Ajout du déclencheur à la liste
call p.targets.add(pt)
endif
set target = null
endfunction
function faPreparation takes nothing returns nothing
local unit caster = GetTriggerUnit()
local integer lvl = GetUnitAbilityLevel( caster, GetSpellAbilityId())
local real dmg = lvl * 25 + GetHeroStr(caster, true) * R2I((lvl+1)/2)
local Preparation prep = LInteger( GetHandleId(caster), KS_PREPARATION )
if( prep == 0 ) then
set prep = Preparation.create()
set prep.tAttack = CreateTrigger()
set prep.caster = caster
set prep.targets = integerList.create()
call SInteger( prep, GetHandleId(caster), KS_PREPARATION)
call SUnit( caster, GetHandleId(prep.tAttack), KEY_CASTER )
call TriggerAddAction( prep.tAttack, function Preparation_Actions )
call TriggerRegisterAnyUnitEventBJ( prep.tAttack, EVENT_PLAYER_UNIT_ATTACKED )
set prep.tCond = TriggerAddCondition( prep.tAttack, Condition( function Cond.AttaquantCaster ) )
endif
set prep.dmg = dmg
endfunction
//===========================================================================
function InitTrig_Preparation_2 takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=61
//TESH.alwaysfold=0
library SpellPreparation needs libDamage, libSpellEffect, libCondition
globals
constant string PREPARATION_EFFECT = "Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl"
constant integer KS_PREPARATION = StringHash("spell__preparation")
endglobals
struct Preparation extends Spell
trigger tAttack = null
triggercondition tCond = null
method onDestroy takes nothing returns nothing
call RInteger( GetHandleId(.tAttack), KEY_CASTER )
call RInteger( GetHandleId(.caster), KS_PREPARATION )
call TriggerRemoveCondition(.tAttack, .tCond)
call DestroyTrigger(.tAttack)
endmethod
endstruct
function Dgts_Preparation takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local Preparation p = LInteger( GetHandleId(t), KS_PREPARATION)
local unit target = GetTriggerUnit()
local location loc = GetUnitLoc(target)
call DisableTrigger(t)
call DestroyEffect( AddSpecialEffectTarget( PREPARATION_EFFECT, target, "origin" ) )
call DmgToArea( loc, p.caster, p.dmg, 200, true )
call Preparation.destroy(p)
call RemoveLocation(loc)
call Shake(GetOwningPlayer(p.caster))
set loc = null
set target = null
set t = null
endfunction
function Preparation_Actions takes nothing returns nothing
local Preparation p = LInteger( GetHandleId(GetAttacker()), KS_PREPARATION )
local unit target = GetTriggerUnit()
local trigger tDamage = CreateTrigger()
// Trigger for spell effect
call TriggerRegisterUnitEvent( tDamage, target, EVENT_UNIT_DAMAGED )
set p.tCond = TriggerAddCondition(tDamage, Condition( function Cond.DgtsCaster ) )
call TriggerAddAction( tDamage, function Dgts_Preparation )
// link the caster to the trigger for the condition
call SUnit( GetAttacker(), GetHandleId(tDamage), KEY_CASTER)
// link the struct to the trigger
call SInteger( p, GetHandleId(tDamage), KS_PREPARATION)
call TimedTrigger( tDamage, 1.0)
set target = null
set tDamage = null
endfunction
function faPreparation takes nothing returns nothing
local unit caster = GetTriggerUnit()
local integer lvl = GetUnitAbilityLevel( caster, GetSpellAbilityId())
local real dmg = lvl * 25 + GetHeroStr(caster, true) * R2I((lvl+1)/2)
local Preparation prep = LInteger( GetHandleId(caster), KS_PREPARATION )
if( prep == 0 ) then
set prep = Preparation.create()
set prep.tAttack = CreateTrigger()
set prep.caster = caster
call SInteger( prep, GetHandleId(caster), KS_PREPARATION)
call SUnit( caster, GetHandleId(prep.tAttack), KEY_CASTER )
call TriggerAddAction( prep.tAttack, function Preparation_Actions )
call TriggerRegisterAnyUnitEventBJ( prep.tAttack, EVENT_PLAYER_UNIT_ATTACKED )
set prep.tCond = TriggerAddCondition( prep.tAttack, Condition( function Cond.AttaquantCaster ) )
endif
set prep.dmg = dmg
endfunction
//===========================================================================
function InitTrig_Preparation takes nothing returns nothing
call Preload(PREPARATION_EFFECT)
call Preload("Abilities\\Spells\\Human\\Avatar\\AvatarCaster.mdl")
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library SpellLiberationDEnergie needs libSpellEffect
struct Liberation_Denergie extends Spell
endstruct
function Liberation_Denergie_Actions takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local Liberation_Denergie obj = LInteger( GetHandleId(t), StringHash("obj") )
local unit target = GetTriggerUnit()
local location loc = GetUnitLoc(target)
local group cibles = GetUnitsInRangeOfLocMatching(350, loc, And(Condition(function Cond.Allie), Not(Condition(function Cond.Immun))) )
local unit u
call GroupRemoveUnit( cibles, target)
loop
set u = FirstOfGroup(cibles)
exitwhen u == null
call GroupRemoveUnit( cibles, u)
call Eclair( "CLPB", target, u, 0.5, "Abilities\\Weapons\\Bolt\\BoltImpact.mdl", "origin")
call DmgToUnit( obj.caster, u, obj.dmg, true )
endloop
call DestroyGroup(cibles)
call Flush( GetHandleId(t) )
call DestroyTrigger(t)
call RemoveLocation(loc)
set t = null
set loc = null
endfunction
function fbLiberation_Denergie takes nothing returns nothing
local trigger t = CreateTrigger()
local Liberation_Denergie obj = Liberation_Denergie.create()
set obj.caster = GetSpellAbilityUnit()
set obj.dmg = 10 + GetSpellLvl() * 25 + GetHeroInt(obj.caster,true) * R2I(GetSpellLvl()/2+1)
call SInteger( obj, GetHandleId(t), StringHash("obj"))
call SUnit( obj.caster, GetHandleId(t), KEY_CASTER)
call TriggerAddAction( t, function Liberation_Denergie_Actions )
call TriggerRegisterUnitEvent( t, GetSpellTargetUnit() , EVENT_UNIT_DAMAGED )
call TriggerAddCondition(t, Condition( function Cond.DgtsCaster ) )
endfunction
//===========================================================================
function InitTrig_Liberation_d_energie takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Fin_Force_des_dieux takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer m = GetHandleId(t)
local unit caster = LUnit(m, KEY_CASTER)
local integer str = LInteger( GetHandleId(caster), StringHash("Force_de_Dieux_bonus"))
call SetHeroStr( caster, GetHeroStr(caster, false)-str, false)
call DestroyTimer(t)
call Flush(m)
endfunction
function fcForce_des_dieux takes nothing returns nothing
local timer t = CreateTimer()
local integer m = GetHandleId(t)
local unit caster = GetTriggerUnit()
local integer lvl = GetUnitAbilityLevel( caster, GetSpellAbilityId())
local integer force_add
local real duree = 15.0
local integer x
if ( GetUnitAbilityLevel(GetTriggerUnit(), 'Broa') >= 1 ) then
set x = LInteger(GetHandleId(caster), StringHash("Force_de_Dieux_bonus"))
call SetHeroStr( caster, GetHeroStr(caster, false)-x, false)
call DestroyTimer( LTimer(GetHandleId(caster), StringHash("Force _de_Dieux")) )
endif
set force_add = R2I( I2R(12 + lvl *8)/100.00 * I2R(GetHeroStr(caster, false)) )
call STimer( t, GetHandleId(caster), StringHash("Force _de_Dieux"))
call SInteger( force_add, GetHandleId(caster), StringHash("Force_de_Dieux_bonus"))
call SetHeroStr( caster, GetHeroStr(caster, false) + force_add, false)
call SUnit( caster, m, KEY_CASTER)
call TimerStart( t, duree, false, function Fin_Force_des_dieux)
endfunction
//===========================================================================
function InitTrig_Force_des_Dieux takes nothing returns nothing
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
library SpellChocPsy needs libSpellEffect
function Choc_Psy takes unit caster, real dmg returns nothing
local player p = GetOwningPlayer(caster)
local real xc = GetUnitX(caster)
local real yc = GetUnitY(caster)
local location loc = Location(xc, yc)
local group g = null
local unit u = null
set Cond.condUnite = caster
set g = GetUnitsInRangeOfLocMatching(350, loc, And(Condition(function Cond.EnnemiVar), And(Condition(function Cond.Terrestre), Not(Condition( function Cond.Immun)))) )
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit( g, u)
call Recul( GetUnitX(caster), GetUnitY(caster), u, 220, 180, 20)
call DmgToUnitType( caster, u, dmg, true, DAMAGE_PHYSICAL )
endloop
call DestroyGroup(g)
call RemoveLocation(loc)
set loc = null
set g = null
endfunction
function fdChoc_Psy takes nothing returns nothing
local unit caster = GetTriggerUnit()
local real dmg = GetSpellLvl()*30 + GetHeroStr( caster, true) * R2I((GetSpellLvl()+3)/2) + 20
call Choc_Psy(caster, dmg)
call Shake(GetOwningPlayer(caster))
endfunction
endlibrary
//===========================================================================
function InitTrig_Choc_Terrestre takes nothing returns nothing
endfunction
//TESH.scrollpos=21
//TESH.alwaysfold=0
function Dgts_Marteau_de_thor takes nothing returns nothing
local unit target = GetTriggerUnit()
local real xt = GetUnitX(target)
local real yt = GetUnitY(target)
local integer m = GetHandleId( target )
local unit caster = LUnit( m, KEY_CASTER)
local real lvl = GetUnitAbilityLevel(caster, 'A035')
local real dmg = GetHeroInt(caster, true) * (lvl+2)/2 + lvl * 55
call DestroyTrigger(GetTriggeringTrigger() )
if ( GetUnitAbilityLevel(caster, 'B00A') >= 1 ) then
call SEffect_Foudre( caster, xt, yt, dmg, 250 + GetHeroStr(caster, true)/3 )
call Shake(GetOwningPlayer(caster))
endif
call Flush(m)
endfunction
function Marteau_de_thor_Actions takes nothing returns nothing
local integer m = GetHandleId(GetTriggeringTrigger())
local integer m2 = GetHandleId(GetTriggerUnit())
local unit caster = LUnit( m, KEY_CASTER)
local trigger trig = CreateTrigger()
if ( GetUnitAbilityLevel(caster, 'B00A') < 1 ) then
call Flush(m)
call DestroyTrigger(GetTriggeringTrigger() )
return
endif
call SUnit( caster, m2, KEY_CASTER)
call TriggerAddAction( trig, function Dgts_Marteau_de_thor )
call TriggerRegisterUnitEvent( trig, GetTriggerUnit() , EVENT_UNIT_DAMAGED )
call TriggerAddCondition(trig, Condition( function Dgts_Conditions ) )
call TimedTrigger(trig, 3.0)
endfunction
function feMarteau_de_thor takes nothing returns nothing
local trigger t
local integer m
if ( GetUnitAbilityLevel(GetTriggerUnit(), 'B00A') < 1 ) then
set t = CreateTrigger()
set m = GetHandleId(t)
call SUnit( GetTriggerUnit(), m, KEY_CASTER)
call TriggerAddAction( t, function Marteau_de_thor_Actions )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition(t, Condition( function Attaquant_Caster_Conditions ) )
endif
endfunction
//===========================================================================
function InitTrig_Marteau_De_Thor takes nothing returns nothing
endfunction
//TESH.scrollpos=38
//TESH.alwaysfold=0
globals
unit array CASTER_FAIBLESSE
integer id_cFaiblesse = 0
constant integer BUFF_FAIBLESSE = 'Bcri'
constant integer KS_FAIBLESSE = StringHash("spell__faiblesse")
endglobals
function Faiblesse_Fin takes nothing returns nothing
local timer t = GetExpiredTimer()
local group g = LGroup( GetHandleId(t), KS_FAIBLESSE)
local unit u = null
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit(g, u)
call UnitRemoveAbility( u, BUFF_FAIBLESSE)
endloop
call DestroyGroup(g)
call DestroyTimer(t)
call Flush(GetHandleId(t))
set g = null
set t = null
endfunction
function jaFaiblesse takes nothing returns nothing
local unit caster = GetSpellAbilityUnit()
local real dur = I2R(GetHeroAgi(caster,true))/15 + 10
local unit u = GetSpellTargetUnit()
local location loc = GetUnitLoc(u)
local group g = GetUnitsInRangeOfLocMatching( 220+I2R(GetHeroAgi(caster,true)), loc, Condition(function Cond.Ennemi))
local group g2 = CreateGroup()
local timer t = CreateTimer()
call GroupAddGroup( g, g2)
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit(g, u)
call SetUnitAbilityLevel( CASTER_FAIBLESSE[id_cFaiblesse], 'Scri', GetSpellLvl())
call IssueTargetOrder( CASTER_FAIBLESSE[id_cFaiblesse], "cripple", u)
set id_cFaiblesse = ModuloInteger(id_cFaiblesse+1,12)
endloop
call DestroyGroup(g)
set g = null
set t = CreateTimer()
call SGroup( g2, GetHandleId(t), KS_FAIBLESSE)
call TimerStart( t, dur, false, function Faiblesse_Fin)
endfunction
//===========================================================================
function InitTrig_Faiblesse takes nothing returns nothing
local integer a = 0
loop
exitwhen a > 12
set CASTER_FAIBLESSE[a] = CreateUnit( Player(0), 'h01N', X_DUMMY, Y_DUMMY, 0.0)
set a = a + 1
endloop
endfunction
//TESH.scrollpos=35
//TESH.alwaysfold=0
library SpellVolMacabre needs libSpellEffect
globals
constant string EFFECT_VOL_MACABRE = "Objects\\Spawnmodels\\Undead\\UndeadDissipate\\UndeadDissipate.mdl"
constant string EFFECT_CASTER_VOL_MACABRE = "Abilities\\Spells\\Undead\\DeathCoil\\DeathCoilMissile.mdl"
constant integer KS_VOL_MACABRE = StringHash("spell__volmacabre")
endglobals
struct VolMacabre extends Spell
timer t = CreateTimer()
static method Action takes nothing returns nothing
local VolMacabre obj = LInteger( GetHandleId(GetExpiredTimer()), KS_VOL_MACABRE)
call obj.cycle()
endmethod
method cycle takes nothing returns boolean
local location loc = GetUnitLoc(this.caster)
local group g = GetUnitsInRangeOfLocMatching( 700, loc, And( Condition(function Cond.Dead), And(Not(Condition(function Cond.Hero)), Not(Condition(function Cond.Dummy))) ) )
local unit u = null
call RemoveLocation(loc)
set u = FirstOfGroup(g)
call DestroyGroup(g)
if( u != null and GetUnitState( this.caster, UNIT_STATE_LIFE) > 0 and not(IsUnitHidden(this.caster)) )then
call DestroyEffect( AddSpecialEffect( EFFECT_VOL_MACABRE, GetUnitX(u), GetUnitY(u)) )
call RemoveUnit(u)
call AddLife( this.caster, this.dmg)
call AddMana( this.caster, this.dmg)
call DestroyEffect( AddSpecialEffect( EFFECT_CASTER_VOL_MACABRE, GetUnitX(this.caster), GetUnitY(this.caster)) )
endif
set loc = null
set g = null
set u = null
return true
endmethod
endstruct
function fVolMacabre takes nothing returns nothing
local VolMacabre obj = LInteger( GetHandleId(GetTriggerUnit()), KS_VOL_MACABRE)
local integer lvl = GetLearnedSkillLevel()
if( obj == 0 ) then
set obj = VolMacabre.create()
set obj.caster = GetTriggerUnit()
call SInteger( obj, GetHandleId(obj.caster), KS_VOL_MACABRE)
call SInteger( obj, GetHandleId(obj.t), KS_VOL_MACABRE)
call TimerStart( obj.t, 15.0, true, function VolMacabre.Action )
endif
set obj.dmg = lvl * 35 + GetHeroInt( obj.caster, true)
endfunction
endlibrary
//===========================================================================
function InitTrig_Vol_Macabre takes nothing returns nothing
endfunction
//TESH.scrollpos=6
//TESH.alwaysfold=0
function InvocationSquelette takes unit caster, integer level, real x, real y returns nothing
local player p = GetOwningPlayer(caster)
local integer nb_squel = udg_Squel_Nb[GetPlayerId(p)]
local group g = udg_Squel_Group[GetPlayerId(p)]
local unit u
local integer Tunit
local integer i = GetRandomInt(1,R2I((level+1)/2))
debug call BJDebugMsg( I2S(nb_squel) + " ; lvl:" + I2S(level) )
if ( nb_squel > level ) then
debug call BJDebugMsg("lol")
set u = UnitInGroupWithMinMaxProperty( g, UNIT_STATE_LIFE, true)
call GroupRemoveUnit(g,u)
call KillUnit(u)
set udg_Squel_Nb[GetPlayerId(p)] = udg_Squel_Nb[GetPlayerId(p)] - 1
endif
if ( i==1) then
set Tunit = 'n008'
elseif( i==2) then
set Tunit = 'n00M'
else
set Tunit = 'u009'
endif
set udg_Squel_Nb[GetPlayerId(p)] = udg_Squel_Nb[GetPlayerId(p)] + 1
set u = CreateUnit( p, Tunit, x, y, 64)
call GroupAddUnit( g, u)
call UnitAddType( u, UNIT_TYPE_SUMMONED )
endfunction
function jcInvocationMorbide takes nothing returns nothing
local unit caster = GetSpellAbilityUnit()
local location loc = GetUnitLoc(caster)
local group g = GetUnitsInRangeOfLocMatching( 700, loc, And( Condition(function Cond.Dead), And(Not(Condition(function Cond.Hero)), Not(Condition(function Cond.Dummy))) ) )
local unit u = null
set u = FirstOfGroup(g)
if u == null then
call IssueImmediateOrder( caster, "stop")
call AddMana(caster, 125)
else
call RemoveUnit(u)
call InvocationSquelette( caster, GetSpellLvl(), GetUnitX(u), GetUnitY(u) )
endif
call DestroyGroup(g)
call RemoveLocation(loc)
set g = null
set loc = null
endfunction
//===========================================================================
function InitTrig_Invocation_de_Squel takes nothing returns nothing
endfunction
//TESH.scrollpos=42
//TESH.alwaysfold=0
function Maudit_Conditions takes nothing returns boolean
return IsUnitEnemy(GetTriggerUnit(), GetOwningPlayer(GetAttacker())) == true
endfunction
function Dgts_Maudit takes nothing returns nothing
local unit target = GetTriggerUnit()
local integer m = GetHandleId(target)
local integer page = LInteger(m, StringHash("pourcentage"))
local real dmg = GetEventDamage() * (I2R(page)/100)
call DestroyTrigger(GetTriggeringTrigger() )
if ( GetUnitAbilityLevel(target, 'B00O') < 1) then
return
else
call DmgToUnit( GetEventDamageSource(), target, dmg, false)
endif
endfunction
function Maudit_Actions takes nothing returns nothing
local integer m = GetHandleId(GetTriggerUnit())
local trigger t
if ( GetUnitAbilityLevel(GetTriggerUnit(), 'B00O') < 1) then
call Flush(m)
call DestroyTrigger(GetTriggeringTrigger() )
else
set t = CreateTrigger()
call TriggerAddAction( t, function Dgts_Maudit )
call TriggerRegisterUnitEvent( t, GetTriggerUnit() , EVENT_UNIT_DAMAGED )
endif
endfunction
function jdMaudit takes nothing returns nothing
local trigger t
local integer m
local integer level = GetUnitAbilityLevel( GetTriggerUnit(), GetSpellAbilityId())
local location loc = GetSpellTargetLoc()
local group cibles = GetUnitsInRangeOfLocMatching(220 + GetHeroAgi(GetTriggerUnit(),true), loc, Condition(function Cond_Groupe_Ennemi))
local integer a = 1
local unit u
local integer nb_unit = CountUnit(cibles)
call RemoveLocation(loc)
set loc = null
loop
exitwhen a > nb_unit
set u = FirstOfGroup(cibles)
call GroupRemoveUnit( cibles, u)
if ( GetUnitAbilityLevel(u, 'B00O') < 1 ) then
set t = CreateTrigger()
set m = GetHandleId(u)
call SInteger( 30+level*16, m, StringHash("pourcentage") )
call TriggerAddAction( t, function Maudit_Actions )
call TriggerRegisterUnitEvent( t, u, EVENT_UNIT_ATTACKED )
call TriggerAddCondition(t, Condition( function Maudit_Conditions ) )
endif
set a = a + 1
endloop
call DestroyGroup(cibles)
set cibles = null
endfunction
//===========================================================================
function InitTrig_Maudit takes nothing returns nothing
endfunction
//TESH.scrollpos=67
//TESH.alwaysfold=0
library SpellFluxDArance needs libSpellEffect
globals
constant integer UNIT_FLUX_ARCANE = 'n00D'
endglobals
struct FluxArcaneAme extends Spell
real dist = 100.0
real angle
unit dummy
integer i = 0
static method cycle takes nothing returns boolean
local thistype this = T003_GetData()
local real x
local real y
local group g
local location loc
local unit u
set .i = .i + 1
if( .i > 40 ) then // Durée de la descente
set this.dist = this.dist + 10
if( this.dist > 750 ) then
call FluxArcaneAme.destroy(this)
call KillUnit(this.dummy)
return true
endif
set x = GetUnitX(this.caster) + this.dist * Cos( this.angle )
set y = GetUnitY(this.caster) + this.dist * Sin( this.angle )
call SetUnitX( this.dummy, x )
call SetUnitY( this.dummy, y )
if( ModuloInteger( .i, 3) == 0 ) then
set loc = Location(x,y)
set g = GetUnitsInRangeOfLocMatching( 120, loc, Condition(function Cond.Alive) )
set u = FirstOfGroup(g)
if( u != null and IsUnitEnemy( u, GetOwningPlayer(this.caster)) ) then
call SEffect_Parasite( this.caster, u, UNIT_FLUX_ARCANE , this.dmg/4, true, 5.0, 30.0 )
call DmgToArea( loc, this.caster, this.dmg, 160, true )
set this.dist = 750
endif
call RemoveLocation(loc)
call DestroyGroup(g)
endif
endif
return false
endmethod
endstruct
struct FluxDArcane extends Spell
real dur
trigger t = CreateTrigger()
static method cycle takes nothing returns boolean
local thistype this = T01_GetData()
local FluxArcaneAme obj = FluxArcaneAme.create()
local real angle = GetRandomReal( 0, 2*bj_PI )
local real x = GetUnitX(this.caster) + obj .dist * Cos( angle )
local real y = GetUnitY(this.caster) + obj .dist * Sin( angle )
set this.dur = this.dur - 0.10
set obj.caster = this.caster
set obj.angle = angle
set obj.dmg = this.dmg
set obj.dummy = CreateUnit( GetOwningPlayer(this.caster), 'h00P', x, y, Rad2Deg(angle) )
call UnitAddAbility( obj.dummy, 'Arav' )
call SetUnitFlyHeight( obj.dummy, -100, 700 )
call T003_Add(function FluxArcaneAme.cycle, obj)
if( this.dur < 0.0 or not IsUnitCanalisation(this.caster) ) then
call IssueImmediateOrder( this.caster, "stop")
call FluxDArcane.destroy(this)
return true
endif
return false
endmethod
endstruct
function jeFluxDArcane takes nothing returns nothing
local FluxDArcane obj = FluxDArcane.create()
set obj.caster = GetTriggerUnit()
set obj.dmg = GetSpellLvl() * 45 + 15
set obj.dur = 15.0 + I2R(GetHeroInt(obj.caster, true))/30.0
call Canalisation(obj.caster)
call T01_Add(function FluxDArcane.cycle, obj)
endfunction
//===========================================================================
function InitTrig_Flux_d_arcane takes nothing returns nothing
endfunction
endlibrary
library SpellAssomoir needs libSpellEffect
function gaAssomoir takes nothing returns nothing
local unit caster = GetTriggerUnit()
local unit target = GetSpellTargetUnit()
local integer lvl = GetSpellLvl()
local real dmg = lvl * 70 + GetHeroStr(caster, true) * R2I((lvl/2+1))
call DestroyEffect( AddSpecialEffectTarget( "Abilities\\Weapons\\RockBoltMissile\\RockBoltMissile.mdl", target, "origin") )
call DmgToUnit( caster, target, dmg, true)
call Recul( GetUnitX(caster), GetUnitY(caster), target, 280, 0, 28 )
if( GetRandomInt(0,1) == 1 ) then
call SEffect_Bash( target, 3.0 )
endif
endfunction
//===========================================================================
function InitTrig_Assomoir takes nothing returns nothing
endfunction
endlibrary
function gbFeuSacre takes nothing returns nothing
local unit caster = GetTriggerUnit()
local integer lvl = GetSpellLvl()
local real dmg = lvl * 135
local unit target = GetSpellTargetUnit()
call DestroyEffect( AddSpecialEffectTarget( "Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl", target, "origin" ) )
if( IsUnitAlly(target,GetOwningPlayer(caster)) ) then
set dmg = dmg + GetHeroInt( caster, true ) * R2I((lvl+1)/2)
call AddLife( target, dmg )
call TxtFlo( I2S(R2I(dmg)), target, 20, 90, 20 )
else
set dmg = dmg + GetHeroStr( caster, true ) * R2I((lvl+1)/2)
call DmgToUnit( caster, target, dmg/2, true )
endif
endfunction
//===========================================================================
function InitTrig_Feu_Sacre takes nothing returns nothing
endfunction
//TESH.scrollpos=51
//TESH.alwaysfold=0
function Benediction_Condition takes nothing returns boolean
return IsUnitAlly( GetCaster(I2S(H2I(GetTriggeringTrigger()))), GetOwningPlayer(GetTriggerUnit()) )
endfunction
function Benediction_Out_Range takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer m = GetHandleId(t)
local unit caster = GetCaster(m)
local unit target = GetTarget(m)
local location locA = GetUnitLoc(caster)
local location locB = GetUnitLoc(target)
local trigger tr = H2Tr(GetInteger(m,"Trigger"))
if( DistanceBetweenPoints(locA,locB) > GetInteger(m,"Distance") ) then
call DestroyTimer(t)
call FlushStoredMission(udg_Spell,m)
call FlushStoredMission(udg_Spell,GetHandleId(tr)))
call DestroyTrigger(tr)
endif
call RemoveLocation(locA)
call RemoveLocation(locB)
endfunction
function Benediction_Actions takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local integer m = GetHandleId(t)
local unit caster = GetCaster(m)
local unit u = GetTriggerUnit()
local integer lvl = GetUnitAbilityLevel( caster, 'A028')
local integer page = lvl * 50
local timer ti = null
call DestroyTrigger(t)
if( GetRandomInt(0,100) < page ) then
call SetUnitState( u, UNIT_STATE_LIFE, GetUnitState(u,UNIT_STATE_MAX_LIFE)*0.5)
call SpellEffectTarget( 'A028', EFFECT_TYPE_SPECIAL, u, "origin", 3)
set ti = H2Ti(GetInteger(m,"Timer"))
call FlushStoredMission(udg_Spell, m)
call FlushStoredMission(udg_Spell, GetHandleId(ti)))
call DestroyTimer(ti)
endif
endfunction
function Benediction takes nothing returns nothing
local integer m = GetHandleId(GetTriggeringTrigger())
local unit caster = GetCaster(m)
local unit target = GetTriggerUnit()
local timer t = CreateTimer()
local trigger tr = CreateTrigger()
set m = GetHandleId(tr))
call SetCaster(m,caster)
call StoreInteger( udg_Spell, m, "Timer", H2I(t) )
call TriggerAddAction( tr, function Benediction_Actions)
call TriggerRegisterUnitStateEvent( tr, target, UNIT_STATE_LIFE, LESS_THAN, 10)
set m = GetHandleId(t))
call SetCaster(m,caster)
call SetTarget(m,target)
call StoreInteger( udg_Spell, m, "Trigger", H2I(tr) )
call StoreInteger( udg_Spell, m, "Distance", 800)
call TimerStart( t, 2.00, true, function Benediction_Out_Range )
endfunction
function Init_Benediction takes unit palouf returns nothing
local trigger t = CreateTrigger()
local integer m = GetHandleId(t)
call SetCaster(m,palouf)
call TriggerAddAction( t, function Benediction)
call TriggerAddCondition( t, Condition(function Benediction_Condition))
call TriggerRegisterUnitInRange( t, palouf , 800, null )
endfunction
//===========================================================================
function InitTrig_Benediction takes nothing returns nothing
endfunction
//TESH.scrollpos=45
//TESH.alwaysfold=0
library SpellProtectionDivine needs libSpellEffect
globals
constant string EFFET_PROTECTION_DIVINE = "Abilities\\Spells\\Orc\\Reincarnation\\ReincarnationTarget.mdl"
constant integer BUFF_PROTECTION_DIVINE = 'B00C'
constant integer KS_PROTECTION_DIVINE = StringHash("spell__protectiondivine")
endglobals
struct ProtectionDivine extends Spell
static method Resu takes nothing returns nothing
local timer t = GetExpiredTimer()
local ProtectionDivine obj = LInteger( GetHandleId(t), KS_PROTECTION_DIVINE )
//call BJDebugMsg( "Resurection" )
call ReviveHero( obj.target, GetUnitX(obj.target), GetUnitY(obj.target), true )
call GroupAddUnit( udg_Heros_vivant, obj.target)
call GroupRemoveUnit( udg_Heros_Resu, obj.target)
//call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 3, udg_Ligne_Multiboard[GetPlayerId(GetOwningPlayer(obj.target))+1], " " + I2S(GetPlayerScore(GetOwningPlayer(obj.target), PLAYER_SCORE_UNITS_KILLED)) )
call DestroyTimer(t)
call Flush( GetHandleId(t))
call ProtectionDivine.destroy(obj)
endmethod
static method Resurection takes nothing returns nothing
local ProtectionDivine obj = LInteger( GetHandleId(GetTriggerUnit()), KS_PROTECTION_DIVINE )
local timer t
call SInteger( 0, GetHandleId(obj.target), KS_PROTECTION_DIVINE )
call DestroyTrigger(GetTriggeringTrigger())
if ( GetUnitAbilityLevel(obj.target, BUFF_PROTECTION_DIVINE) < 1 ) then
call ProtectionDivine.destroy(obj)
return
endif
//call BJDebugMsg( "Resu" )
call KillUnit(obj.target)
call GroupAddUnit( udg_Heros_Resu, obj.target)
set t = CreateTimer()
call EffectUnit( EFFET_PROTECTION_DIVINE, obj.target, "origin", 7.0 )
call TimerStart( t, 7.0, false, function ProtectionDivine.Resu )
call SInteger( obj, GetHandleId(t), KS_PROTECTION_DIVINE)
endmethod
endstruct
function gdProtectionDivine takes nothing returns nothing
local ProtectionDivine obj = LInteger( GetHandleId(GetSpellTargetUnit()), KS_PROTECTION_DIVINE )
local trigger t
if ( obj == 0 ) then
set obj = ProtectionDivine.create()
set obj.target = GetSpellTargetUnit()
call DisplayTextToPlayer( GetOwningPlayer(obj.target), 0, 0,"Vous êtes sous protection divine, à votre mort, vous reviendrez à la vie.")
call DisplayTextToPlayer( GetOwningPlayer(obj.target), 0, 0, "You are under divine protection, when killed, your hero will come back to life.")
set t = CreateTrigger()
call TriggerAddAction( t, function ProtectionDivine.Resurection )
call TriggerRegisterUnitStateEvent(t, obj.target, UNIT_STATE_LIFE, LESS_THAN, 5)
call SInteger( obj, GetHandleId(obj.target), KS_PROTECTION_DIVINE )
endif
set obj.caster = GetTriggerUnit()
endfunction
//===========================================================================
function InitTrig_Protection_Divine takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=36
//TESH.alwaysfold=0
library SpellFaveurDesDieux needs libSpellEffect
globals
constant integer UNIT_FAVEUR_DIEUX = 'h00Z'
constant integer DUMMY_FAVEUR_DIEUX = 'h012'
constant integer ABIL1_FAVEUR_DIEUX = 'A03I'
constant integer ABIL2_FAVEUR_DIEUX = 'A03G'
endglobals
struct FaveurDesDieux extends Spell
real duree
real angle = 0.0
unit uHeal
unit uDmg
static method cycle takes nothing returns boolean
local thistype this = T01_GetData()
local unit u
local real x
local real y
local integer a = 0
loop
exitwhen a == 2
set x = GetUnitX(this.caster) + 220 * Cos(.angle+bj_PI*a)
set y = GetUnitY(this.caster) + 220 * Sin(.angle+bj_PI*a)
set u = CreateUnit( GetOwningPlayer(this.caster), UNIT_FAVEUR_DIEUX, x, y, Rad2Deg(.angle) )
call SetUnitFlyHeight( u, 1200.0, 700 )
call UnitApplyTimedLife( u, 'BTLF', 1.7 )
set a = a + 1
endloop
set .angle = .angle + Deg2Rad(12.0)
set .duree = .duree - T01_PERIOD
if( .duree < 0.0 or not IsUnitCanalisation(this.caster) ) then
call RemoveUnit( this.uHeal )
call RemoveUnit( this.uDmg )
call FaveurDesDieux.destroy(this)
return true
endif
return false
endmethod
endstruct
function geFaveurDesDieux takes nothing returns nothing
local FaveurDesDieux obj = FaveurDesDieux.create()
local integer lvl = GetSpellLvl()
set obj.caster = GetTriggerUnit()
set obj.duree = 15.0
set obj.uDmg = CreateUnit( GetOwningPlayer(obj.caster), DUMMY_FAVEUR_DIEUX, GetUnitX(obj.caster), GetUnitY(obj.caster), 0.0 )
call SetUnitAbilityLevel( obj.uDmg, ABIL1_FAVEUR_DIEUX, lvl )
call IssueImmediateOrder(obj.uDmg, "starfall" )
set obj.uHeal = CreateUnit( GetOwningPlayer(obj.caster), DUMMY_FAVEUR_DIEUX, GetUnitX(obj.caster), GetUnitY(obj.caster), 0.0 )
call IssueImmediateOrder(obj.uHeal, "resurrection" )
call SetUnitAbilityLevel( obj.uHeal, ABIL2_FAVEUR_DIEUX, lvl )
call Canalisation( obj.caster)
call T01_Add(function FaveurDesDieux.cycle, obj)
endfunction
//===========================================================================
function InitTrig_FaveurDesDieux takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=7
//TESH.alwaysfold=0
globals
constant integer SOUFFLE_FEU_SPELL = 'A08T'
constant integer SOUFFLE_FEU_UNIT = 'h020'
endglobals
function paSouffleDeFeu takes nothing returns nothing
local unit caster = GetSpellAbilityUnit()
local real x
local real y
local unit u = null
local real angle
local integer lvl = GetSpellLvl()
local real dmg = GetHeroStr(caster, true) * (0.2 + lvl*0.8)
set udg_loc = GetSpellTargetLoc()
set x = GetLocationX(udg_loc)
set y = GetLocationY(udg_loc)
set angle = Atan2( y-GetUnitY(caster), x-GetUnitX(caster))
set u = CreateUnit( GetOwningPlayer(caster), SOUFFLE_FEU_UNIT, GetUnitX(caster), GetUnitY(caster), Rad2Deg(angle))
call UnitApplyTimedLife( u, 'BTLF', 3.00 )
call IssuePointOrder(u, "breathoffire", x + 200 * Cos(angle), y + 200 * Sin(angle) )
call SEffect_Souffle( u, angle, 200.0, 450.0, dmg, true)
call RemoveLocation(udg_loc)
endfunction
//===========================================================================
function InitTrig_Souffle_de_feu takes nothing returns nothing
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
library SpellCauterisation needs libSpellEffect
function pcCauterisation takes nothing returns nothing
local unit caster = GetSpellAbilityUnit()
local unit target = GetSpellTargetUnit()
local integer lvl = GetSpellLvl()
local real heal = lvl * 100 + GetHeroInt(caster, true) * 5
local real dmg = (lvl * 60) / 9
call AddLife(target, heal)
call Dot( udg_DmgUnit[GetPlayerId(GetOwningPlayer(caster))], target, dmg, 0.5, 10, false, "")
call Buff.AddBuff( target, false, 'A090', 10.)
endfunction
endlibrary
//===========================================================================
function InitTrig_Cauterisation takes nothing returns nothing
endfunction
//TESH.scrollpos=72
//TESH.alwaysfold=0
library SpellFireBlades needs libSpellEffect
globals
constant integer BUFF_FIRE_BLADES = 'B00X'
constant string EFFECT_FIRE_BLADES = "Abilities\\Spells\\Other\\Incinerate\\FireLordDeathExplode.mdl"
constant string EFFECT_WEAPON_FIRE_BLADES = "Abilities\\Spells\\Other\\BreathOfFire\\BreathOfFireDamage.mdl"
constant integer SPELL_FIRE_BLADES = 'A08X'
constant integer KS_FIRE_BLADES = StringHash("spell__fireblades")
endglobals
struct FireBlades extends Spell
effect e1 = null // Effet lame gauche
effect e2 = null // Effet lame droite
trigger t // Déclencheur d'attauque
endstruct
function Dgts_FireBlades takes nothing returns nothing
local unit target = GetTriggerUnit()
local trigger t = GetTriggeringTrigger()
local unit caster = LUnit(GetHandleId(t), KEY_CASTER)
local integer lvl = GetUnitAbilityLevel( caster, SPELL_FIRE_BLADES)
local real dmg = GetHeroAgi(caster, true) * (lvl * 0.8 + 0.2)
local real dmgDot = GetHeroStr(caster, true) / (5.5 - lvl * 0.5)
local real range = 220 + GetHeroAgi(caster, true)
local group g = null
local unit u = null
call DestroyTrigger(t)
set udg_loc = GetUnitLoc(target)
set g = GetUnitsInRangeOfLocMatching(range, udg_loc, And(Condition(function Cond.Alive), Not(Condition(function Cond.Immun))) )
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit( g, u)
if( IsUnitEnemy( u, GetOwningPlayer(caster) ) ) then
call DmgToUnit( caster, u, dmg, true)
call Dot( udg_DmgUnit[GetPlayerId(GetOwningPlayer(caster))], u, dmgDot, 1, 6., true, "Fire_Blades")
call Buff.AddBuff( u, false, 'A093', 5.)
endif
endloop
call RemoveLocation(udg_loc)
call DestroyGroup(g)
set g = null
call DestroyEffect( AddSpecialEffectTarget( EFFECT_FIRE_BLADES, target, "origin"))
call Flush( GetHandleId(t) )
endfunction
function FireBlades_Actions takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local unit caster = LUnit( GetHandleId(t), KEY_CASTER)
local FireBlades obj = LInteger( GetHandleId(caster), KS_FIRE_BLADES )
if ( GetUnitAbilityLevel(caster, BUFF_FIRE_BLADES) < 1 ) then
call DestroyEffect(obj.e1)
call DestroyEffect(obj.e2)
call DisableTrigger(t)
return
endif
set t = CreateTrigger()
call SUnit( caster, GetHandleId(t), KEY_CASTER )
call TimedTrigger(t, 3) // Déclencheur détruit au bout de 3 sec
call TriggerAddAction( t, function Dgts_FireBlades )
call TriggerRegisterUnitEvent( t, GetTriggerUnit(),EVENT_UNIT_DAMAGED )
call TriggerAddCondition( t, Condition( function Cond.DgtsCaster ) )
endfunction
function Test takes nothing returns nothing
call BJDebugMsg( "Kikou")
endfunction
function pdFireBlades takes nothing returns nothing
local unit caster = GetSpellAbilityUnit()
local integer lvl = GetSpellLvl()
local FireBlades obj = LInteger( GetHandleId(caster), KS_FIRE_BLADES )
//local code c = function FireBlades_Actions
local integer trig
local Buff pBuff = Buff.AddBuff( caster, true, 'A092', 10)
//call pBuff.AddCallBack( function Test)
if( obj != 0 ) then
call EnableTrigger(obj.t)
else
set obj = FireBlades.create()
set obj.t = CreateTrigger()
call SInteger( obj, GetHandleId(caster), KS_FIRE_BLADES)
call SUnit( caster, GetHandleId(obj.t), KEY_CASTER )
call TriggerAddAction( obj.t, function FireBlades_Actions )
call TriggerRegisterAnyUnitEventBJ( obj.t, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition(obj.t, Condition( function Cond.AttaquantCaster ) )
endif
set obj.e1 = AddSpecialEffectTarget( EFFECT_WEAPON_FIRE_BLADES, caster, "weapon l")
set obj.e2 = AddSpecialEffectTarget( EFFECT_WEAPON_FIRE_BLADES, caster, "weapon r")
endfunction
endlibrary
//===========================================================================
function InitTrig_FireBlades takes nothing returns nothing
endfunction
//TESH.scrollpos=143
//TESH.alwaysfold=0
library SpellPhenixSlash needs libSpellEffect
globals
constant integer FLAG_JUMP = 1
constant integer FLAG_SLASH = 2
constant integer ID_PANDA_VOLANT = 'h01Z'
constant string EFFECT_PHENIX_SLASH = "Abilities\\Spells\\Other\\Doom\\DoomDeath.mdl"
endglobals
struct PhenixSlash extends Spell
integer flag = 0
boolean inPart = false
location targetLoc
unit unitAir
real cpt = 0.
boolean hit = false
integer duree = 0
method GetTargetAngle takes nothing returns real
return Atan2( GetLocationY(.targetLoc)-GetUnitY(.caster), GetLocationX(.targetLoc)-GetUnitX(.caster))
endmethod
method GetTargetDist takes unit u returns real
return DistanceBetweenPointsEx( GetUnitX(u), GetUnitY(u), GetLocationX(.targetLoc), GetLocationY(.targetLoc))
endmethod
method GetTargetUnitAngle takes nothing returns real
return Atan2( GetUnitY(.target)-GetUnitY(.caster), GetUnitX(.target)-GetUnitX(.caster))
endmethod
method GetTargetUnitDist takes nothing returns real
return DistanceBetweenPointsEx( GetUnitX(.caster), GetUnitY(.caster), GetUnitX(.target), GetUnitY(.target))
endmethod
// Déterminé la position à atteindre pr attaquer l'unité
method SelectLoc takes nothing returns nothing
local real x = GetUnitX(.caster)
local real y = GetUnitY(.caster)
local real xt = GetUnitX(.target)
local real yt = GetUnitY(.target)
local real angle = Atan2( yt-y, xt-x)
local real dist = DistanceBetweenPointsEx( x, y, xt, yt)
// choisir la position derrière l'unité
if( dist < 400 ) then
set .targetLoc = Location( xt + 250 * Cos(angle), yt + 250 * Sin(angle))
else // choisir la position devant l'unité
set .targetLoc = Location( xt - 250 * Cos(angle), yt - 250 * Sin(angle))
endif
endmethod
method JumpPart takes nothing returns boolean
local real angle = .GetTargetAngle()
local real dist = .GetTargetDist(.unitAir)
if( not .inPart ) then
set .inPart = true
call .SelectLoc()
call SetUnitX( .unitAir, GetUnitX(.caster))
call SetUnitY( .unitAir, GetUnitY(.caster))
set angle = .GetTargetAngle()
set dist = .GetTargetDist(.unitAir)
call ShowUnit(.unitAir, true)
call UnitAddAbility( .unitAir, 'Aloc')
call SetUnitFacing( .unitAir, Rad2Deg(angle))
set .cpt = ReculAngle( angle, .unitAir, R2I(dist), 400., 16)
call ShowUnit(.caster, false)
call SetUnitX( .caster, GetLocationX(.targetLoc))
call SetUnitY( .caster, GetLocationY(.targetLoc))
call SetUnitFacing( .caster, Rad2Deg(Atan2( GetUnitY(.target)-GetLocationY(.targetLoc), GetUnitX(.target)-GetLocationX(.targetLoc))) )
else
set .cpt = .cpt - T003_PERIOD
if( .cpt < 0. ) then
set .inPart = false
call ShowUnit(.unitAir, false)
call ShowUnit(.caster, true)
return true
endif
endif
return false
endmethod
method SlashPart takes nothing returns boolean
local real dist = .GetTargetUnitDist()
local real angle = .GetTargetUnitAngle()
local real distLoc = .GetTargetDist(.caster)
local real angleLoc = .GetTargetAngle()
if( not .inPart ) then
// Cible trop éloignée
if( dist > 400 ) then
return true
endif
set .inPart = true
// Animation épée en avant
call SetUnitAnimationByIndex( .caster, 5)
call .SelectLoc()
else
call SetUnitFacing( .caster, Rad2Deg(angle))
call SetUnitX( .caster, GetUnitX(.caster) + 16 * Cos(angleLoc))
call SetUnitY( .caster, GetUnitY(.caster) + 16 * Sin(angleLoc))
if( dist < 100 and not .hit) then
set .hit = true
call DestroyEffect(AddSpecialEffectTarget( EFFECT_PHENIX_SLASH, .target, "origin"))
set udg_loc = GetUnitLoc(.target)
call DmgToArea( udg_loc, .caster, 50., 220, true)
call RemoveLocation(udg_loc)
endif
if( distLoc < 50. ) then
set .hit = false
set .inPart = false
return true
endif
endif
return false
endmethod
static method cycle takes nothing returns boolean
local thistype this = T003_GetData()
if( .flag == FLAG_JUMP ) then
if( .JumpPart()) then
set .flag = .flag + 1
endif
elseif ( .flag == FLAG_SLASH ) then
if( .SlashPart()) then
set .target = UnitInLocRange( .caster, 600)
if( .duree >= 4 or .target == null) then
set .flag = .flag +1
else
set .duree = .duree + 1
set .flag = FLAG_JUMP
endif
endif
else
call PauseUnit(.caster, false)
call ResetUnitAnimation(.caster)
call IssueImmediateOrder(.caster, "stop")
return true
endif
return false
endmethod
endstruct
function pfPhenixSlash takes nothing returns nothing
local PhenixSlash obj =PhenixSlash.create()
set obj.caster = GetTriggerUnit()
set obj.target = GetSpellTargetUnit()
set obj.flag = FLAG_JUMP
call PauseUnit(obj.caster, true)
set obj.unitAir = CreateUnit( GetOwningPlayer(obj.caster), ID_PANDA_VOLANT, GetUnitX(obj.caster), GetUnitY(obj.caster), 0)
call ShowUnit( obj.unitAir, false)
call T003_Add(function PhenixSlash.cycle, obj)
endfunction
//===========================================================================
function InitTrig_Frappe_du_Phenix takes nothing returns nothing
endfunction
endlibrary
function Depression_Recul takes nothing returns nothing
local unit caster = GetTriggerUnit()
local string m = I2S(H2I(caster))
local integer i = GetStoredInteger(udg_Spell,m,"Timer")
local integer dmg = GetHeroStr(caster, true)
local unit target = GetEventDamageSource()
call DmgToUnit( caster, target, I2R(dmg), true)
call EffectUnit( "Abilities\\Weapons\\Bolt\\BoltImpact.mdl", target, "origin", 0.5 )
call Recul( GetUnitX(caster), GetUnitY(caster), target, 200, 0, 20 )
endfunction
function Depression_Actions takes nothing returns nothing
local timer t = GetExpiredTimer()
local string m = I2S(H2I(t))
local unit u = GetUnit(m,"Caster")
local string m2 = I2S(H2I(u))
local integer i = GetStoredInteger(udg_Spell,m,"Timer")
local integer nb_unit = GetStoredInteger(udg_Spell,m,"Nb_Unit")
local player p = GetOwningPlayer(u)
local real xc = GetStoredReal(udg_Spell,m,"xc")
local real yc = GetStoredReal(udg_Spell,m,"yc")
local unit dummy
local integer a = 1
local real angle
if (i < 500 and xc == GetUnitX(u) and yc == GetUnitY(u) ) then
call StoreInteger(udg_Spell,m,"Timer", i + 1)
loop
exitwhen a > nb_unit
set dummy = GetUnit(m,"u"+I2S(a))
set angle = Atan2(GetUnitY(dummy) - yc, GetUnitX(dummy) - xc)
call SetUnitX( dummy, GetUnitX(dummy) - 3*Cos(angle) )
call SetUnitY( dummy, GetUnitY(dummy) - 3*Sin(angle) )
set a = a + 1
endloop
else
call DestroyTimer(t)
call DestroyTrigger( H2Tr(GetStoredInteger(udg_Spell,m,"Trigger")) )
call DestroyTrigger(GetTriggeringTrigger())
call FlushStoredMission(udg_Spell,m)
endif
endfunction
function Depression takes nothing returns nothing
local unit caster = GetTriggerUnit()
local player p = GetOwningPlayer(caster)
local real xc = GetUnitX(caster)
local real yc = GetUnitY(caster)
local group cibles = GetUnitsInRangeOfLocMatching(350, Location(xc, yc), Condition(function Cond_Groupe_Ennemi))
local timer t = CreateTimer()
local trigger trig = CreateTrigger()
local string m = I2S(H2I(t))
local integer a = 1
set bj_groupCountUnits = 0
set bj_wantDestroyGroup = true
call ForGroup( cibles, function Groupe )
loop
exitwhen a > bj_groupCountUnits
call StoreInteger(udg_Spell,m,"u"+I2S(a),H2I(FirstOfGroup(cibles)))
call GroupRemoveUnit( cibles, FirstOfGroup(cibles))
set a = a + 1
endloop
call StoreInteger(udg_Spell,m,"Trigger",H2I(trig))
call StoreInteger(udg_Spell,m,"Caster",H2I(caster))
call StoreInteger(udg_Spell,m,"Timer", 0)
call StoreInteger(udg_Spell,m,"Nb_Unit", bj_groupCountUnits)
call StoreReal(udg_Spell,m,"xc", xc)
call StoreReal(udg_Spell,m,"yc", yc)
call TimerStart (t , 0.02,true ,function Depression_Actions )
set m = I2S(H2I(caster))
call StoreInteger(udg_Spell,m,"Timer", 0)
call TriggerAddAction( trig, function Depression_Recul )
call TriggerRegisterUnitEvent( trig, caster , EVENT_UNIT_DAMAGED )
endfunction
//===========================================================================
function InitTrig_Depression takes nothing returns nothing
endfunction
//TESH.scrollpos=3
//TESH.alwaysfold=0
function kaDeflagration takes nothing returns nothing
local unit caster = GetTriggerUnit()
local location loc = GetUnitLoc(caster)
local group g = GetUnitsInRangeOfLocMatching( 360, loc, Condition(function Cond.Ennemi))
local unit u = null
local real lvl = GetSpellLvl()
local real dmg = GetHeroStr(caster, true) * R2I((lvl+1)/2) + 35 * lvl
call KillUnit( CreateUnit( GetOwningPlayer(caster), 'h014', GetUnitX(caster), GetUnitY(caster), 270.0 ) )
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit(g,u)
call DmgToUnit( caster, u, dmg, true )
endloop
call RemoveLocation(loc)
call DestroyGroup(g)
set g = null
set loc = null
set u = null
endfunction
//===========================================================================
function InitTrig_Deflagration takes nothing returns nothing
endfunction
//TESH.scrollpos=32
//TESH.alwaysfold=0
library SpellBoomerang needs libSpellEffect
globals
constant integer UNIT_SPELL_BOOMERANG = 'h00W'
constant string EFFECT_SPELL_BOOMERANG = "Abilities\\Weapons\\VengeanceMissile\\VengeanceMissile.mdl"
endglobals
struct Boomerang extends Spell
unit dummy
lightning l1
lightning l2
lightning l3
real x
real y
real dist = 0.0
real lAngle = 0.0
real angle = 0.0
integer i = 0
integer j = 0
boolean circle = false
group cibles = CreateGroup()
real burn = 0.0
method MoveEffect takes lightning l, real x, real y, real i returns nothing
local real x2 = x + 100.0 * Cos(this.lAngle+Deg2Rad(i*120.0))
local real y2 = y + 100.0 * Sin(this.lAngle+Deg2Rad(i*120.0))
call MoveLightning( l, true, x, y, x2, y2 )
set .i = .i + 1
if( this.i == 2 ) then
call DestroyEffect( AddSpecialEffect( EFFECT_SPELL_BOOMERANG, x2, y2) )
set .i = 0
endif
endmethod
static method cycle takes nothing returns boolean
local thistype this = T003_GetData()
local real x = this.x + this.dist * Cos(this.angle)
local real y = this.y + this.dist * Sin(this.angle)
local unit u
local group g
local location loc = Location(x,y)
local real dmg = this.burn
set Cond.condUnite = this.caster
set g = GetUnitsInRangeOfLocMatching( 190, loc, And(Condition(function Cond.EnnemiVar), Condition(function Cond.Mana)) )
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit(g,u)
if( not IsUnitInGroup( u, this.cibles) ) then
call GroupAddUnit(this.cibles, u)
set dmg = AjustValMana( u, dmg)
call DmgToUnit( this.caster, u, dmg*this.dmg, true)
call AddMana( u, -dmg)
call DestroyEffect( AddSpecialEffectTarget( "Abilities\\Spells\\Human\\Feedback\\ArcaneTowerAttack.mdl", u, "origin") )
call DestroyEffect( AddSpecialEffectTarget( "Abilities\\Spells\\Undead\\OrbOfDeath\\OrbOfDeathMissile.mdl", u, "origin") )
endif
endloop
call DestroyGroup(g)
call RemoveLocation(loc)
set g = null
set loc = null
call SetUnitX( this.dummy, x)
call SetUnitY( this.dummy, y)
call this.MoveEffect( this.l1, x, y, 0 )
call this.MoveEffect( this.l2, x, y, 1 )
call this.MoveEffect( this.l3, x, y, 2 )
set this.lAngle = this.lAngle - Deg2Rad(8.0)
if( not this.circle ) then
set this.dist = this.dist + 21.0
if( this.dist > 650.0 ) then
set this.x = this.x + this.dist * Cos(this.angle+Deg2Rad(20.0))
set this.y = this.y + this.dist * Sin(this.angle+Deg2Rad(20.0))
set this.angle = this.angle - Deg2Rad( 80.0 )
set this.dist = 200.0
set this.circle = true
endif
else
set this.j = this.j + 1
if( this.j > 31 ) then
set this.angle = Atan2( GetUnitY(this.caster) - y, GetUnitX(this.caster) - x )
set this.x = GetUnitX(this.dummy)
set this.y = GetUnitY(this.dummy)
set this.dist = 21.0
if( DistanceBetweenPointsEx( this.x, this.y, GetUnitX(this.caster), GetUnitY(this.caster)) < 80.0 ) then
call DestroyGroup(this.cibles)
call KillUnit( this.dummy )
call DestroyLightning(this.l1)
call DestroyLightning(this.l2)
call DestroyLightning(this.l3)
call Boomerang.destroy(this)
return true
endif
else
set this.angle = this.angle + Deg2Rad(7.0)
endif
endif
return false
endmethod
endstruct
function kbBoomerang takes nothing returns nothing
local Boomerang obj = Boomerang.create()
local location loc = GetSpellTargetLoc()
set obj.caster = GetTriggerUnit()
set obj.dmg = GetSpellLvl() * 0.3 + 0.7
set obj.burn = (GetSpellLvl() * 0.4 + 0.6) * GetHeroAgi( obj.caster, true) + 50
set obj.x = GetUnitX(obj.caster)
set obj.y = GetUnitY(obj.caster)
set obj.angle = Atan2( GetLocationY(loc) - obj.y, GetLocationX(loc) - obj.x )
set obj.dummy = CreateUnit( GetOwningPlayer(obj.caster), UNIT_SPELL_BOOMERANG, obj.x, obj.y, Rad2Deg(obj.angle) )
set obj.l1 = AddLightning( "AFOD", true, obj.x, obj.y, obj.x + 100.0 * Cos(obj.lAngle), obj.y + 100.0 * Sin(obj.lAngle) )
set obj.l2 = AddLightning( "AFOD", true, obj.x, obj.y, obj.x + 100.0 * Cos(obj.lAngle), obj.y + 100.0 * Sin(obj.lAngle+Deg2Rad(120.0)) )
set obj.l3 = AddLightning( "AFOD", true, obj.x, obj.y, obj.x + 100.0 * Cos(obj.lAngle), obj.y + 100.0 * Sin(obj.lAngle+Deg2Rad(240.0)) )
call T003_Add(function Boomerang.cycle, obj)
call RemoveLocation(loc)
set loc = null
endfunction
//===========================================================================
function InitTrig_Boomerang takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=23
//TESH.alwaysfold=0
library SpellMagnetisme needs libSpellEffect
globals
constant integer UNIT_MAGNETISME = 'o001'
constant integer BUFF_MAGNETISME = 'BNms'
constant integer KS_MAGNETISME = StringHash("spell__magnetisme")
endglobals
struct Magnetisme extends Spell
unit u1
unit u2
unit u3
trigger t = CreateTrigger()
timer cooldown = CreateTimer()
static method Dmg takes nothing returns nothing
local Magnetisme obj = LInteger( GetHandleId(GetTriggerUnit()), KS_MAGNETISME )
local unit target = GetEventDamageSource()
local real dmg = GetEventDamage()*1.33
if( GetUnitState( target, UNIT_STATE_LIFE) > 0.0 and not IsDummyUnit(target) and IsUnitEnemy(target, GetOwningPlayer(obj.caster)) and TimerGetRemaining(obj.cooldown) <= 0.0) then
call TimerStart(obj.cooldown, 0.08, false, null)
call Eclair( "CLPB", obj.caster, target, 0.3, "Abilities\\Weapons\\Bolt\\BoltImpact.mdl", "origin")
call DmgToUnit( obj.caster, target, dmg, false )
endif
endmethod
static method cycle takes nothing returns boolean
local thistype this = T003_GetData()
local real xc = GetUnitX(this.caster)
local real yc = GetUnitY(this.caster)
if( IsUnitHidden(this.caster) and not IsUnitHidden(this.u1)) then
call ShowUnit(this.u1, false)
call ShowUnit(this.u2, false)
call ShowUnit(this.u3, false)
elseif( not IsUnitHidden(this.caster) and IsUnitHidden(this.u1) ) then
call ShowUnit(this.u1, true)
call ShowUnit(this.u2, true)
call ShowUnit(this.u3, true)
endif
call SetUnitPosition( this.u1, xc, yc)
call SetUnitFacing( this.u1, GetUnitFacing(this.u1) + 3.0 )
call SetUnitPosition( this.u2, xc, yc)
call SetUnitFacing( this.u2, GetUnitFacing(this.u2) + 3.0 )
call SetUnitPosition( this.u3, xc, yc)
call SetUnitFacing( this.u3, GetUnitFacing(this.u3) + 3.0 )
if( GetUnitAbilityLevel( this.caster, BUFF_MAGNETISME) < 1 ) then
call RemoveUnit(this.u1)
call RemoveUnit(this.u2)
call RemoveUnit(this.u3)
call DestroyTrigger(this.t)
call DestroyTimer(this.cooldown)
call Magnetisme.destroy(this)
return true
endif
return false
endmethod
endstruct
function kcMagnetisme takes nothing returns nothing
local Magnetisme obj
local unit caster = GetSpellAbilityUnit()
local player p = GetOwningPlayer(caster)
local real xc = GetUnitX(caster)
local real yc = GetUnitY(caster)
set obj = Magnetisme.create()
set obj.caster = caster
set obj.u1 = CreateUnit( p, UNIT_MAGNETISME, xc, yc, 0)
set obj.u2 = CreateUnit( p, UNIT_MAGNETISME, xc, yc, 120)
set obj.u3 = CreateUnit( p, UNIT_MAGNETISME, xc, yc, 240)
call SInteger( obj, GetHandleId(caster), KS_MAGNETISME)
call TriggerAddAction( obj.t, function Magnetisme.Dmg)
call TriggerRegisterUnitEvent( obj.t, caster, EVENT_UNIT_DAMAGED)
call T003_Add(function Magnetisme.cycle, obj)
endfunction
//===========================================================================
function InitTrig_Magnetisme takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=12
//TESH.alwaysfold=0
library SpellBarriereDeFoudre needs libSpellEffect
globals
constant integer UNITE_BARRIERE_DE_FOUDRE = 'h017'
endglobals
struct BarriereDeFoudre extends Spell
real dur = 14.9
real dist = 245.0
static method cycle takes nothing returns boolean
local thistype this = T15_GetData()
local unit u = null
local location loc = GetUnitLoc(this.caster)
local group g1
local group g2
set Cond.condUnite = this.caster
set g2 = GetUnitsInRangeOfLocMatching( 260, loc, Condition(function Cond.EnnemiVar))
call RemoveLocation(loc)
set loc = null
loop
set u = FirstOfGroup(g2)
exitwhen u == null
call GroupRemoveUnit(g2, u)
call SEffect_Foudre( this.caster, GetUnitX(u), GetUnitY(u), this.dmg, 10.0)
endloop
call DestroyGroup(g2)
set g2 = null
set this.dur = this.dur - T15_PERIOD
if( this.dur < 0.0 ) then
call BarriereDeFoudre.destroy(this)
return true
endif
return false
endmethod
endstruct
struct BarriereDeFoudreAme extends Spell
real angle
lightning l
real dur
real sens
BarriereDeFoudre obj
static method cycle takes nothing returns boolean
local thistype this = T003_GetData()
local real x1 = GetUnitX(this.obj.caster) + (this.obj.dist+this.sens*20.0) * Cos(this.angle)
local real y1 = GetUnitY(this.obj.caster) + (this.obj.dist+this.sens*20.0) * Sin(this.angle)
local real x2 = GetUnitX(this.obj.caster) + (this.obj.dist+this.sens*20.0) * Cos(this.angle+Deg2Rad(72.0)*this.sens)
local real y2 = GetUnitY(this.obj.caster) + (this.obj.dist+this.sens*20.0) * Sin(this.angle+Deg2Rad(72.0)*this.sens)
set this.angle = this.angle + Deg2Rad(5.0-this.sens)*this.sens
call SetUnitX( this.caster, x1)
call SetUnitY( this.caster, y1)
call MoveLightningEx( this.l, true, x1, y1, Z_ECLAIR, x2, y2, Z_ECLAIR )
set this.dur = this.dur - T003_PERIOD
if( this.dur < 0.0 ) then
call KillUnit(this.caster)
call DestroyLightning(this.l)
call BarriereDeFoudreAme.destroy(this)
return true
endif
return false
endmethod
endstruct
function kdGardeFoudre takes nothing returns nothing
local BarriereDeFoudre obj = BarriereDeFoudre.create()
local BarriereDeFoudreAme ame = 0
local integer a = 0
local real ang
local real x = GetUnitX(GetSpellAbilityUnit())
local real y = GetUnitY(GetSpellAbilityUnit())
local integer nb = 5
set obj.caster = GetSpellAbilityUnit()
set obj.dmg = 10 + GetSpellLvl() * 15 + GetHeroStr(obj.caster, true) * (0.7 + GetSpellLvl()*0.1)
loop
exitwhen a == nb
set ame = BarriereDeFoudreAme.create()
set ame.angle = a*Deg2Rad(360/nb)
set ang = (a+1)*Deg2Rad(360/nb)
set ame.dur = obj.dur
set ame.obj = obj
set ame.sens = 1.0
set ame.caster = CreateUnit( GetOwningPlayer(obj.caster), UNITE_BARRIERE_DE_FOUDRE, x + obj.dist*Cos(ame.angle), y + obj.dist*Sin(ame.angle), 0.0 )
set ame.l = AddLightningEx( "CLPB", true, x + obj.dist*Cos(ame.angle), y + obj.dist*Sin(ame.angle), Z_ECLAIR, x + obj.dist*Cos(ang), y + obj.dist*Sin(ang), Z_ECLAIR )
call T003_Add(function BarriereDeFoudreAme.cycle, ame)
set a = a + 1
endloop
loop
exitwhen a == 0
set ame = BarriereDeFoudreAme.create()
set ame.angle = a*Deg2Rad(360/nb)
set ang = (a-1)*Deg2Rad(360/nb)
set ame.dur = obj.dur
set ame.obj = obj
set ame.sens = -1.0
set ame.caster = CreateUnit( GetOwningPlayer(obj.caster), UNITE_BARRIERE_DE_FOUDRE, x + obj.dist*Cos(ame.angle), y + obj.dist*Sin(ame.angle), 0.0 )
set ame.l = AddLightningEx( "CLPB", true, x + obj.dist*Cos(ame.angle), y + obj.dist*Sin(ame.angle), Z_ECLAIR, x + obj.dist*Cos(ang), y + obj.dist*Sin(ang), Z_ECLAIR )
call T003_Add(function BarriereDeFoudreAme.cycle, ame)
set a = a - 1
endloop
call T15_Add(function BarriereDeFoudre.cycle, obj)
endfunction
//===========================================================================
function InitTrig_Barrier_de_Foudre takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=78
//TESH.alwaysfold=0
function Dgts_Veng_Glace takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer m = GetHandleId(t)
local real x = LReal( m, StringHash("x") )
local real y = LReal( m, StringHash("y") )
local unit caster = LUnit( m, KEY_CASTER)
local real dmg = LReal( m, KEY_DAMAGE )
local location loc = Location(x,y)
local unit dummy = CreateUnit( GetOwningPlayer(caster), UNIT_BLIZZARD, x, y, 0.0 )
call IssuePointOrder( dummy, "attackground", x, y )
call UnitApplyTimedLife( dummy, 'BTLF', 0.6 )
call SetUnitTimeScalePercent( dummy, 200 )
call DmgToArea( loc, caster, dmg, 290.0, true )
call DestroyEffect( AddSpecialEffect( "Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl", x, y ) )
call RemoveLocation(loc)
call DestroyTimer(t)
set loc = null
set t = null
endfunction
function Dgts_Vengeance takes nothing returns nothing
local unit target = GetTriggerUnit()
local real xt = GetUnitX(target)
local real yt = GetUnitY(target)
local integer m = GetHandleId( target )
local unit caster = LUnit( m, KEY_CASTER)
local real lvl = GetUnitAbilityLevel(caster, 'A03T')
local real dmg = 0.0
local location loc = GetUnitLoc(target)
local integer i = GetRandomInt(0,2)
local timer t = CreateTimer()
local integer m2 = GetHandleId(t)
local group g = null
local unit u = null
call DestroyTrigger(GetTriggeringTrigger() )
if ( GetUnitAbilityLevel(caster, 'B00R') >= 1 ) then
if( i==0 ) then
set dmg = GetHeroInt(caster, true) * R2I(lvl/2+2) + lvl * 55
call SEffect_Meteor( caster, GetLocationX(loc), GetLocationY(loc), dmg, true, 290)
elseif( i==1 ) then
set dmg = GetHeroInt(caster, true) * R2I((lvl+3)/2) + lvl * 40
call SEffect_Foudre( caster, GetLocationX(loc), GetLocationY(loc), dmg, 290 )
set Cond.condUnite = caster
set g = GetUnitsInRangeOfLocMatching( 290, loc, Condition(function Cond.EnnemiVar) )
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit(g,u)
call SEffect_Bash( u, 1.0)
endloop
call DestroyGroup(g)
set g = null
else
set dmg = GetHeroInt(caster, true) * R2I((lvl+3)/2) + lvl * 40
call DestroyEffect( AddSpecialEffect( "Abilities\\Spells\\Human\\Blizzard\\BlizzardTarget.mdl", GetLocationX(loc), GetLocationY(loc) ) )
call SUnit( caster, m2, KEY_CASTER)
call SReal( GetLocationX(loc), m2, StringHash("x"))
call SReal( GetLocationY(loc), m2, StringHash("y"))
call SReal( dmg, m2, KEY_DAMAGE )
call TimerStart( t, 1.0, false, function Dgts_Veng_Glace )
endif
endif
call RemoveLocation(loc)
call RInteger( m, KEY_CASTER)
endfunction
function Vengeance_Actions takes nothing returns nothing
local integer m = GetHandleId(GetTriggeringTrigger())
local integer m2 = GetHandleId(GetTriggerUnit())
local unit caster = LUnit( m, KEY_CASTER)
local trigger trig = CreateTrigger()
if ( GetUnitAbilityLevel(caster, 'B00R') < 1 ) then
call Flush(m)
call DestroyTrigger(GetTriggeringTrigger() )
return
endif
call SUnit( caster, m2, KEY_CASTER)
call TriggerAddAction( trig, function Dgts_Vengeance )
call TriggerRegisterUnitEvent( trig, GetTriggerUnit() , EVENT_UNIT_DAMAGED )
call TriggerAddCondition(trig, Condition( function Dgts_Conditions ) )
call TimedTrigger(trig, 2.0)
endfunction
function keVengeance takes nothing returns nothing
local trigger t
local integer m
if ( GetUnitAbilityLevel(GetTriggerUnit(), 'B00R') < 1 ) then
set t = CreateTrigger()
set m = GetHandleId(t)
call SUnit( GetTriggerUnit(), m, KEY_CASTER)
call TriggerAddAction( t, function Vengeance_Actions )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition(t, Condition( function Attaquant_Caster_Conditions ) )
endif
endfunction
//===========================================================================
function InitTrig_Vengeance takes nothing returns nothing
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
globals
unit array Sorceress_Phoenix
endglobals
function qaPhoenix takes nothing returns nothing
local unit caster = GetSpellAbilityUnit()
local unit phoenix = GetSummonedUnit()
set Sorceress_Phoenix[GetPlayerId(GetOwningPlayer(caster))] = phoenix
call UnitAddType(phoenix, UNIT_TYPE_SUMMONED)
if( IsUnitType(phoenix, UNIT_TYPE_SUMMONED) ) then
debug call BJDebugMsg("kikou")
endif
endfunction
//===========================================================================
function InitTrig_Phoenix takes nothing returns nothing
local integer a = 0
loop
set Sorceress_Phoenix[a] = null
set a = a + 1
exitwhen a > 9
endloop
endfunction
function qbPhoenixStrike takes nothing returns nothing
local unit caster = GetSpellAbilityUnit()
local unit phoenix = Sorceress_Phoenix[GetPlayerId(GetOwningPlayer(caster))]
call IssueTargetOrder( phoenix, "unstableconcoction", GetSpellTargetUnit())
endfunction
//===========================================================================
function InitTrig_Phoenix_Strike takes nothing returns nothing
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function qdIncendiaryBall takes nothing returns nothing
local Fissure obj = Fissure.create()
local location loc = GetSpellTargetLoc()
local integer lvl = GetSpellLvl()
set obj.caster = GetSpellAbilityUnit()
set obj.dmg = (lvl*0.2 + 0.6) * GetHeroInt(obj.caster, true)
set obj.duree = 10 + GetHeroAgi(obj.caster, true) / (16-lvl)
set obj.x = GetUnitX(obj.caster)
set obj.y = GetUnitY(obj.caster)
set obj.angle = Atan2( GetLocationY(loc) - obj.y, GetLocationX(loc) - obj.x )
call RemoveLocation(loc)
set loc = null
call T01_Add(function Fissure.cycleUnite, obj)
endfunction
//===========================================================================
function InitTrig_Boule_Incendiaire takes nothing returns nothing
endfunction
//TESH.scrollpos=36
//TESH.alwaysfold=0
library SpellPhoenixShield needs libSpellEffect
globals
constant integer BUFF_PHOENIX_SHIELD = 'Binf'
constant integer KS_PHOENIX_SHIELD = StringHash("spell__phoenixshield")
endglobals
struct PhoenixShield extends Spell
real heal = 0.0
effect e
static method cycle takes nothing returns boolean
local thistype this = T1_GetData()
if( GetUnitAbilityLevel(.target, BUFF_PHOENIX_SHIELD) < 1 or IsUnitDeadBJ(.target) ) then
call DestroyEffect(.e)
return true
endif
// Régénération
call AddLife( .target, .heal)
// Dégâts
set udg_loc = GetUnitLoc(.target)
call DmgToAreaEffect( udg_loc, .caster, .dmg, 190, false, "Abilities\\Spells\\NightElf\\Immolation\\ImmolationDamage.mdl" )
call RemoveLocation(udg_loc)
return false
endmethod
endstruct
function qePhoenixShield takes nothing returns nothing
local PhoenixShield obj = 0
local real lvl = GetSpellLvl()
local boolean doLoop = false
// Inutile de relancer le sort s'il est déjà actif sur l'unité
if( GetUnitAbilityLevel(obj.target, BUFF_PHOENIX_SHIELD) >= 1 ) then
set obj = LInteger( GetHandleId(GetSpellAbilityUnit()), KS_PHOENIX_SHIELD)
else
set obj = PhoenixShield.create()
set obj.target = GetSpellTargetUnit()
set obj.e = AddSpecialEffectTarget( "Abilities\\Spells\\Other\\ImmolationRed\\ImmolationRedTarget.mdl", obj.target, "chest")
call SInteger( obj, GetHandleId(obj.target), KS_PHOENIX_SHIELD)
set doLoop = true
endif
set obj.caster = GetSpellAbilityUnit()
set obj.dmg = 3 + lvl * 7 + GetHeroStr(obj.caster, true) / (8-lvl)
set obj.heal = 2 + GetHeroInt(obj.caster, true) / (15-lvl)
if doLoop then
call T1_Add(function PhoenixShield.cycle, obj)
endif
endfunction
endlibrary
//===========================================================================
function InitTrig_Phoenix_Shield takes nothing returns nothing
endfunction
//TESH.scrollpos=38
//TESH.alwaysfold=0
library SpellMultishot needs libSpellEffect, SpellIgniteArrows
globals
constant integer ABILITY_MULTISHOT = 'A02E'
endglobals
function Dgts_Multishot takes nothing returns nothing
local unit target = GetTriggerUnit()
local trigger t = GetTriggeringTrigger()
local unit caster = LUnit(GetHandleId(t), KEY_CASTER)
local integer lvl = GetUnitAbilityLevel(caster, ABILITY_MULTISHOT)
local real dmg = lvl * 50 + GetHeroStr(caster,true)
local real cc = 100 - LReal(GetHandleId(caster), StringHash("Coup_Critique"))
local real fact = I2R(GetHeroAgi(caster,true))/100 //GetReal(GetHandleId(caster)),"Facteur_CC")
call DestroyTrigger(t)
if ( GetUnitAbilityLevel(caster, BUFF_IGNITE_ARROWS) >= 1 ) then
call Ignite_Arrows_Expl( caster, target, 3 )
endif
if( GetRandomReal(0,100) > cc ) then
call DmgToUnit(caster, target, dmg+dmg*fact, false)
call TxtFlo( I2S(R2I(dmg+dmg*fact))+"!", target, 100,0,0)
else
call DmgToUnit( caster, target, dmg, true)
endif
call Flush(GetHandleId(t))
endfunction
function raMultishot takes nothing returns nothing
local trigger t
local unit caster = GetTriggerUnit()
local location loc = GetUnitLoc(caster)
local group g = GetUnitsInRangeOfLocMatching( 710, loc, And(Condition(function Cond.Ennemi), Not(Condition(function Cond.Immun))) )
local unit u = null
call RemoveLocation(loc)
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit( g, u)
set t = CreateTrigger()
call TimedTrigger( t, 4.0 )
call SUnit( caster, GetHandleId(t), KEY_CASTER)
call TriggerAddAction( t, function Dgts_Multishot )
call TriggerRegisterUnitEvent( t, u, EVENT_UNIT_DAMAGED )
call TriggerAddCondition( t, Condition( function Cond.DgtsCaster ) )
endloop
call DestroyGroup(g)
set loc = null
set g = null
endfunction
//===========================================================================
function InitTrig_Multishot takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=30
//TESH.alwaysfold=0
function Cold_Arrows_Actions takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local integer m = GetHandleId(t)
local unit target = GetTriggerUnit()
local unit caster = LUnit( m, KEY_CASTER)
local real dmg = LReal( m, KEY_DAMAGE)
local real duree = LReal( m, KEY_DURATION)
local real cc = 100 - LReal(GetHandleId(caster),StringHash("Coup_Critique"))
local real fact = I2R(GetHeroAgi(caster,true))/100 //GetReal(GetHandleId(caster)),"Facteur_CC")
call Gel_Total(target, duree)
call DisableTrigger(t)
if( GetRandomReal(0,100) > cc ) then
call DmgToUnit(caster, target, dmg+dmg*fact, false)
call TxtFlo( I2S(R2I(dmg+dmg*fact))+"!", target, 100,0,0)
else
call DmgToUnit(caster, target, dmg, true)
endif
call EnableTrigger(t)
call DestroyTrigger(t)
call Flush(m)
endfunction
function rbCold_Arrows takes nothing returns nothing
local trigger t
local integer m
local unit caster = GetTriggerUnit()
local integer lvl = GetSpellLvl()
local real dmg = lvl * 60
local real duree = lvl * 0.3 + GetHeroInt(caster,true)/(40-lvl*2) + 0.6
local location loc = GetSpellTargetLoc()
local group cibles = GetUnitsInRangeOfLocMatching(255, loc, And(Condition(function Cond_Groupe_Ennemi), Not(Condition(function Cond.Immun))) )
local unit u = null
call RemoveLocation(loc)
set loc = null
loop
set u = FirstOfGroup(cibles)
exitwhen u == null
call GroupRemoveUnit(cibles, u)
set t = CreateTrigger()
set m = GetHandleId(t)
call SUnit( caster, m, KEY_CASTER)
call SReal( dmg, m, KEY_DAMAGE)
call SReal( duree, m, KEY_DURATION)
call TimedTrigger(t, 3.00)
call TriggerAddAction( t, function Cold_Arrows_Actions )
call TriggerAddCondition(t, Condition( function Dgts_Caster_Conditions ) )
call TriggerRegisterUnitEvent( t, u , EVENT_UNIT_DAMAGED )
endloop
call DestroyGroup(cibles)
set cibles = null
endfunction
//===========================================================================
function InitTrig_Cold_Arrows takes nothing returns nothing
endfunction
//TESH.scrollpos=70
//TESH.alwaysfold=0
library SpellIgniteArrows needs libSpellEffect
globals
constant integer BUFF_IGNITE_ARROWS = 'B002'
constant integer SPHERE_IGNITE_ARROWS = 'A01Z'
constant integer ABILITY_IGNITE_ARROWS = 'A01X'
constant integer KS_IGNITE_ARROWS = StringHash("spell_ignitearrows")
endglobals
function Ignite_Arrows_Expl takes unit caster, unit target, integer i returns nothing
local integer lvl = GetUnitAbilityLevel(caster, ABILITY_IGNITE_ARROWS)
local real dmg = (lvl * 20.0 + GetHeroAgi(caster,true))/I2R(i)
local location loc = GetUnitLoc(target)
local group cibles = GetUnitsInRangeOfLocMatching(190 + GetHeroStr(caster,true), loc, And(Condition(function Cond.Allie), Not(Condition(function Cond.Immun))) )
local unit u = null
local real cc = 100 - LReal(GetHandleId(caster), StringHash("Coup_Critique") )
local real fact = I2R(GetHeroAgi(caster,true)) / 100 //GetReal(I2S(H2I(caster)),"Facteur_CC")
//if( i == 1 ) then // Annule le coup critique
// set cc = 100
//endif
call SpellEffect( ABILITY_IGNITE_ARROWS, EFFECT_TYPE_AREA_EFFECT, GetUnitX(target), GetUnitY(target), 3)
loop
set u = FirstOfGroup(cibles)
exitwhen u == null
call GroupRemoveUnit( cibles, u)
if( GetRandomReal(0,100) > cc ) then
call DmgToUnit(caster, u, dmg+dmg*fact, false)
call TxtFlo( I2S(R2I(dmg+dmg*fact))+"!", u, 100,0,0)
else
call DmgToUnit( caster, u, dmg, true)
endif
endloop
call DestroyGroup(cibles)
call RemoveLocation(loc)
set cibles = null
set loc = null
endfunction
function Dgts_Ignite_Arrows takes nothing returns nothing
local unit target = GetTriggerUnit()
local trigger t = GetTriggeringTrigger()
local unit caster = LUnit(GetHandleId(t), KEY_CASTER)
call DestroyTrigger(t)
call Ignite_Arrows_Expl( caster, target, 1 )
call Flush( GetHandleId(t) )
endfunction
function Ignite_Arrows_Actions takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local unit caster = LUnit( GetHandleId(t), KEY_CASTER)
if ( GetUnitAbilityLevel(caster, BUFF_IGNITE_ARROWS) < 1 ) then
call UnitRemoveAbility(caster, SPHERE_IGNITE_ARROWS )
call Flush( GetHandleId(t) )
call DestroyTrigger(t)
set t = null
return
endif
set t = CreateTrigger()
call SUnit( caster, GetHandleId(t), KEY_CASTER )
call TimedTrigger(t, 3) // Déclencheur détruit au bout de 3 sec
call TriggerAddAction( t, function Dgts_Ignite_Arrows )
call TriggerRegisterUnitEvent( t, GetTriggerUnit(),EVENT_UNIT_DAMAGED )
call TriggerAddCondition( t, Condition( function Cond.DgtsCaster ) )
endfunction
function rdIgnite_Arrows takes nothing returns nothing
local trigger t
local unit u = GetTriggerUnit()
local trigger trig = LTrigger( GetHandleId(u), KS_IGNITE_ARROWS )
if ( GetUnitAbilityLevel( u, BUFF_IGNITE_ARROWS) < 1 ) then
if( trig != null ) then
call DestroyTrigger(trig)
endif
call UnitAddAbility( u, SPHERE_IGNITE_ARROWS )
set t = CreateTrigger()
call STrigger( t, GetHandleId(u), KS_IGNITE_ARROWS)
call SUnit( u, GetHandleId(t), KEY_CASTER)
call TriggerAddAction( t, function Ignite_Arrows_Actions )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition(t, Condition( function Cond.AttaquantCaster ) )
endif
endfunction
//===========================================================================
function InitTrig_Ignite_Arrows takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=7
//TESH.alwaysfold=0
library SpellAppelleNature needs libSpellEffect
globals
constant string EFFET_APPELLE_NATURE = "Abilities\\Spells\\Orc\\AncestralSpirit\\AncestralSpiritCaster.mdl"
constant string EFFET_MORT_APPELLE_NATURE = "Abilities\\Spells\\NightElf\\FaerieDragonInvis\\FaerieDragon_Invis.mdl"//"Abilities\\Spells\\Items\\AIlm\\AIlmTarget.mdl"
constant string EFFET_HERO_APPELLE_NATURE = "Abilities\\Spells\\NightElf\\Starfall\\StarfallCaster.mdl"
integer array UNIT_TYPE_APPELLE_NATURE
endglobals
function Disparition_AppelleNature takes nothing returns nothing
local unit u = GetTriggerUnit()
call DestroyEffect( AddSpecialEffect( EFFET_MORT_APPELLE_NATURE, GetUnitX(u), GetUnitY(u) ) )
call RemoveUnit(u)
call DestroyTrigger( GetTriggeringTrigger() )
endfunction
struct AppelleNature extends Spell
real duree
integer lvl
effect e
static method cycle takes nothing returns boolean
local thistype this = T1_GetData()
local unit u = null
local trigger t = CreateTrigger()
local real angle
local real x
local real y
local integer a = 0
local location loc = GetUnitLoc(this.caster)
local group g = null
set Cond.condUnite = this.caster
set g = GetUnitsInRangeOfLocMatching( 900, loc, And(Condition(function Cond.EnnemiVar), Condition(function Cond.Terrestre)) )
call RemoveLocation(loc)
set loc = null
if( FirstOfGroup(g) != null ) then
set u = GroupPickRandomUnit(g)
set angle = GetRandomReal(0,2*bj_PI)
set x = GetUnitX(u) + 220.0 * Cos( angle )
set y = GetUnitY(u) + 220.0 * Sin( angle )
set angle = Rad2Deg(angle) + 180.0
set u = CreateUnit( GetOwningPlayer(this.caster), UNIT_TYPE_APPELLE_NATURE[0], x, y, angle )
call SetUnitVertexColor( u, 255, 255, 255, 110 )
call SetUnitPathing( u, false )
call UnitApplyTimedLife( u, 'BTLF', 2.6 )
call EffectUnit( EFFET_APPELLE_NATURE, u, "origin", 4.0 )
call TriggerRegisterUnitEvent( t, u, EVENT_UNIT_DEATH )
call TriggerAddAction( t, function Disparition_AppelleNature)
endif
call DestroyGroup(g)
set g = null
set .duree = .duree - 1.0
if( .duree < 0.0 or not IsUnitCanalisation(this.caster) ) then
call DestroyEffect(.e)
call AppelleNature.destroy(this)
return true
endif
return false
endmethod
endstruct
function reAppelNature takes nothing returns nothing
local AppelleNature obj = AppelleNature.create()
set obj.caster = GetSpellAbilityUnit()
set obj.lvl = GetSpellLvl()
set obj.duree = 20.0 + GetHeroInt(obj.caster, true) / 24
set obj.e = AddSpecialEffectTarget( EFFET_HERO_APPELLE_NATURE, obj.caster, "origin" )
call Canalisation(obj.caster)
call T1_Add(function AppelleNature.cycle, obj)
endfunction
//===========================================================================
function InitTrig_Appel_de_la_Nature takes nothing returns nothing
set UNIT_TYPE_APPELLE_NATURE[0] = 'n00C'
//set UNIT_TYPE_APPELLE_NATURE[2] = '0001'
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
function daDeathly_strike takes nothing returns nothing
local trigger t = CreateTrigger()
local unit target = GetSpellTargetUnit()
local unit caster = GetTriggerUnit()
local integer lvl = GetUnitAbilityLevel(caster, GetSpellAbilityId())
local real dmg = GetHeroInt(caster, true) * (1+(lvl-1)*0.8) + 30
call Eclair( "AFOD", caster, target, 0.25, "Abilities\\Spells\\Demon\\DemonBoltImpact\\DemonBoltImpact.mdl", "origin" )
if ( GetUnitState( target, UNIT_STATE_LIFE) > GetUnitState( target, UNIT_STATE_MAX_LIFE)/2 ) then
call AddLife( caster, dmg )
call TxtFlo( I2S(R2I(dmg)), caster, 20, 90, 20 )
set dmg = dmg*2
endif
call DmgToUnit( caster, target, dmg, false)
call TxtFlo( I2S(R2I(dmg)), target, 20, 20, 90 )
endfunction
//===========================================================================
function InitTrig_Choc_mortelle takes nothing returns nothing
endfunction
//TESH.scrollpos=32
//TESH.alwaysfold=0
library SpellFureur needs libSpellEffect, SpellIgniteArrows
globals
unit CASTER_FUREUR
endglobals
function Dgts_Fureur takes nothing returns nothing
local unit target = GetTriggerUnit()
local trigger t = GetTriggeringTrigger()
local unit caster = LUnit( GetHandleId(t), KEY_CASTER)
local real dmg = LReal( GetHandleId(t), KEY_DAMAGE)
local real dur = LReal( GetHandleId(t), KEY_DURATION)
call DisableTrigger(t)
call DmgToUnit( caster, target, dmg, true)
call SEffect_Bash( target, dur)
call EnableTrigger(t)
endfunction
function dbFureur takes nothing returns nothing
local trigger t = CreateTrigger()
local unit caster = GetSpellAbilityUnit()
local real lvl = GetSpellLvl()
local location loc = GetUnitLoc(caster)
local group g = GetUnitsInRangeOfLocMatching( 350, loc, And(Condition(function Cond.Ennemi), Not(Condition(function Cond.Immun))) )
local unit u = null
call RemoveLocation(loc)
set loc = null
call SetUnitTimeScalePercent( caster, 180.0)
call TriggerSleepAction(0.80)
call SetUnitTimeScalePercent( caster, 100.0)
call CastImmediateSpell( caster, CASTER_FUREUR, "fanofknives")
call TimedTrigger( t, 2.0 )
call SUnit( CASTER_FUREUR, GetHandleId(t), KEY_CASTER )
call SReal( lvl * 30 + GetHeroAgi(caster,true)*(1+(lvl-1)/5), GetHandleId(t), KEY_DAMAGE)
call SReal( lvl * 0.4 + GetHeroAgi(caster,true)/(50-lvl*2) + 0.6, GetHandleId(t), KEY_DURATION)
call TriggerAddAction( t, function Dgts_Fureur )
call TriggerAddCondition( t, Condition( function Cond.DgtsCaster ) )
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit( g, u)
call TriggerRegisterUnitEvent( t, u, EVENT_UNIT_DAMAGED )
endloop
call DestroyGroup(g)
set g = null
endfunction
//===========================================================================
function InitTrig_Fureur takes nothing returns nothing
set CASTER_FUREUR = CreateUnit( Player(0), 'h012', X_DUMMY, Y_DUMMY, 0.0)
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Attaque_Vampirique_Conditions takes nothing returns boolean
local integer m = GetPlayerId(GetOwningPlayer(GetAttacker()))
if ( HaveSavedHandle(ht, StringHash("Vamp"+I2S(m)), KEY_CASTER) ) then
return GetAttacker() == LUnit( StringHash("Vamp"+I2S(m)), KEY_CASTER)
else
return false
endif
endfunction
function Dgts_Vamp takes nothing returns nothing
local unit target = GetTriggerUnit()
local integer m = GetHandleId( target )
local unit caster = LUnit( m, KEY_CASTER)
local integer level = LInteger(m, StringHash("Level"))
local real dmg = GetHeroStr(caster, true)
local real leech = (GetEventDamage()+dmg) * (I2R(5*level+5)/100)
local real mana = I2R(level)*1.5 + 8
call Flush(m)
call DestroyTrigger(GetTriggeringTrigger() )
if( GetUnitState(caster, UNIT_STATE_MANA) >= mana) then
call AddMana( caster, -mana)
call AddLife( caster, leech )
call DmgToUnit( caster, target, dmg, false)
call TxtFlo( I2S(R2I(GetEventDamage()+dmg)), target, 20, 20, 90 )
call TxtFlo( I2S(R2I(leech)) , caster, 20, 90, 20 )
call SpellEffectTarget( 'A00A', EFFECT_TYPE_TARGET, target, "origin", 2.00)
endif
endfunction
function Attaque_Vampirique_Actions takes nothing returns nothing
local integer m = GetPlayerId(GetOwningPlayer(GetAttacker()))
local integer m2 = GetHandleId(GetTriggerUnit())
local unit caster = LUnit( StringHash("Vamp" + I2S(m)), KEY_CASTER)
local trigger trig = CreateTrigger()
local integer level = LInteger( StringHash("Vamp" + I2S(m)), StringHash("Level"))
if ( GetUnitAbilityLevel(caster, 'BIpv') < 1) then
call Flush(StringHash("Vamp" + I2S(m)))
call DestroyTrigger(GetTriggeringTrigger() )
return
endif
call SUnit( caster, m2, KEY_CASTER)
call SInteger( level, m2, StringHash("Level"))
call TriggerAddAction( trig, function Dgts_Vamp )
call TriggerRegisterUnitEvent( trig, GetTriggerUnit() , EVENT_UNIT_DAMAGED )
call TriggerAddCondition(trig, Condition( function Dgts_Conditions ) )
endfunction
function dcAttaque_Vampirique takes nothing returns nothing
local trigger t = CreateTrigger()
local integer m = GetPlayerId(GetOwningPlayer(GetTriggerUnit()))
local integer level = GetUnitAbilityLevel( GetSpellAbilityUnit(), GetSpellAbilityId())
call SUnit( GetTriggerUnit(), StringHash("Vamp" + I2S(m)), KEY_CASTER)
call SInteger( level, StringHash("Vamp" + I2S(m)), StringHash("Level") )
if ( HaveSavedBoolean( ht, StringHash("Vamp" + I2S(m)), StringHash("Bool")) == false ) then
call SBoolean( true, StringHash("Vamp" + I2S(m)), StringHash("Bool"))
call TriggerAddAction( t, function Attaque_Vampirique_Actions )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition(t, Condition( function Attaque_Vampirique_Conditions ) )
endif
endfunction
//===========================================================================
function InitTrig_Attaque_Vampirique takes nothing returns nothing
endfunction
//TESH.scrollpos=90
//TESH.alwaysfold=0
function Drain_Massif_Action takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer m = GetHandleId(t)
local integer i = LInteger( m, StringHash("Timer"))
local integer nb_unit = LInteger( m, StringHash("Nb_Unit"))
local integer level = LInteger( m, StringHash("Level"))
local unit caster = LUnit(m,KEY_CASTER)
local real xc = GetUnitX(caster)
local real yc = GetUnitY(caster)
local real xt
local real yt
local player p = GetOwningPlayer(caster)
local unit u
local integer a = 1
local integer b = 1
local lightning l
local real leech = GetHeroInt(caster, true)+level*12
local location l1 = null
local location l2 = null
call SInteger( i + 1, m, StringHash("Timer"))
if ( ModuloInteger(i,50) == 0 ) then
call AddLife( caster, (leech*nb_unit)/3 )
call TxtFlo( I2S(R2I((leech*nb_unit)/3)), caster, 20, 90, 20 )
endif
loop
exitwhen a > nb_unit
set u = LUnit( m, StringHash("u"+I2S(a)))
set xt = GetUnitX(u)
set yt = GetUnitY(u)
set l = LLightning( m, StringHash("Lightning"+I2S(a)))
call MoveLightningEx( l, true, xc, yc, GetUnitZ(caster)+90,xt, yt, GetUnitZ(u)+Z_ECLAIR)
if ( ModuloInteger(i,50) == 0 ) then
call DmgToUnit( caster, u, leech, true )
endif
set l1 = GetUnitLoc(caster)
set l2 = GetUnitLoc(u)
if ( GetUnitState(u, UNIT_STATE_LIFE) <= 0 or DistanceBetweenPoints(l1, l2) > 900) then
set b = a
call DestroyEffect( LEffect(m, StringHash("Effect"+I2S(b))) )
call DestroyLightning(l)
loop
exitwhen b == nb_unit
call SUnit( LUnit(m, StringHash("u"+I2S(b+1))), m, StringHash("u"+I2S(b)) )
call SLightning( LLightning( m, StringHash("Lightning"+I2S(b+1)) ), m, StringHash("Lightning"+I2S(b)) )
call SEffect( LEffect( m, StringHash("Effect"+I2S(b+1))), m, StringHash("Effect"+I2S(b)) )
set b = b + 1
endloop
set nb_unit = nb_unit - 1
set a = a - 1
call SInteger( nb_unit, m, StringHash("Nb_Unit"))
endif
call RemoveLocation(l1)
call RemoveLocation(l2)
set a = a + 1
endloop
set l1 = null
set l2 = null
if( i == 300 or GetUnitState(caster, UNIT_STATE_LIFE) <= 0 or nb_unit == 0) then
set a = 1
loop
exitwhen a > nb_unit
call DestroyEffect( LEffect(m, StringHash("Effect"+I2S(a))) )
call DestroyLightning( LLightning( m, StringHash("Lightning"+I2S(a))) )
set a = a + 1
endloop
call DestroyTimer(t)
call Flush(m)
endif
endfunction
function ddDrain_Massif takes nothing returns nothing
local unit caster = GetTriggerUnit()
local player p = GetOwningPlayer(caster)
local real xc = GetUnitX(caster)
local real yc = GetUnitY(caster)
local real xt
local real yt
local location spell = GetSpellTargetLoc()
local unit u
local group cibles = GetUnitsInRangeOfLocMatching(210, spell, And( Condition(function Cond_Groupe_Ennemi), Not(Condition(function Cond.Immun))) )
local effect e
local integer nb_unit = CountUnit(cibles)
local integer level = GetUnitAbilityLevel( GetTriggerUnit(), GetSpellAbilityId())
local timer t = CreateTimer()
local integer m = GetHandleId(t)
local integer a = 1
if ( nb_unit > level/2+2 ) then
set nb_unit = level/2 + 2
endif
loop
exitwhen a > nb_unit
set u = FirstOfGroup(cibles)
call SUnit( u, m, StringHash("u"+I2S(a)) )
call GroupRemoveUnit( cibles, u)
set xt = GetUnitX(u)
set yt = GetUnitY(u)
call SLightning( AddLightningEx("DRAL", true, xc, yc, GetUnitZ(caster)+90, xt, yt, GetUnitZ(u)+Z_ECLAIR ), m, StringHash("Lightning"+I2S(a)) )
set e = AddSpecialEffectTarget( "Abilities\\Spells\\Other\\Drain\\DrainTarget.mdl", u, "origin" )
call SEffect( e, m, StringHash("Effect"+I2S(a)) )
set a = a + 1
endloop
call SUnit( caster, m, KEY_CASTER)
call SInteger( 0, m, StringHash("Timer"))
call SInteger( level, m, StringHash("Level"))
call SInteger( nb_unit, m, StringHash("Nb_Unit"))
call TimerStart (t , 0.02,true ,function Drain_Massif_Action )
call RemoveLocation(spell)
call DestroyGroup(cibles)
set cibles = null
set spell = null
endfunction
//===========================================================================
function InitTrig_Drain_Massif takes nothing returns nothing
endfunction
//TESH.scrollpos=21
//TESH.alwaysfold=0
library SpellRainOfMeteor needs libSpellEffect
struct RainOfMeteor extends Spell
integer duree
boolean quake = true
static method cycle takes nothing returns boolean
local thistype this = T05_GetData()
local location loc = GetRandomLoc( GetUnitX(this.caster), GetUnitY(this.caster), 450)
local player p = GetOwningPlayer(this.caster)
call SEffect_Meteor( this.caster, GetLocationX(loc), GetLocationY(loc), this.dmg, true, 290)
call RemoveLocation(loc)
if ( this.quake ) then
set this.quake = false
call CameraSetEQNoiseForPlayer( p, 5.00 )
endif
set this.duree = this.duree - 1
if ( this.duree==0 or not IsUnitCanalisation(this.caster) ) then
call ResetToGameCameraForPlayer( p, 0 )
call Meteor.destroy(this)
return true
endif
return false
endmethod
endstruct
function deRainOfMeteor takes nothing returns nothing
local RainOfMeteor obj = RainOfMeteor.create()
local integer lvl = GetUnitAbilityLevel(GetTriggerUnit(), GetSpellAbilityId())
set obj.caster = GetSpellAbilityUnit()
set obj.duree = 40 + GetHeroAgi(obj.caster, true)/12
set obj.dmg = lvl * 60 + GetHeroStr(obj.caster, true)
call Canalisation( obj.caster )
call T05_Add(function RainOfMeteor.cycle, obj)
endfunction
//===========================================================================
function InitTrig_Pluie_de_meteore takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
globals
constant string EFFECT_BLESSURE_OUVERTE = "Objects\\Spawnmodels\\Human\\HumanBlood\\HumanBloodFootman.mdl"
endglobals
function saBlessureOuverte takes nothing returns nothing
local unit caster = GetSpellAbilityUnit()
local unit target = GetSpellTargetUnit()
local integer lvl = GetSpellLvl()
local real dmg = lvl * 25 + GetHeroAgi(caster, true) * R2I(lvl/2+1)
call DmgToUnit( caster, target, dmg, true )
call DestroyEffect( AddSpecialEffectTarget( EFFECT_BLESSURE_OUVERTE, target, "origin") )
set caster = null
set target = null
endfunction
//===========================================================================
function InitTrig_Blessure_Ouverte takes nothing returns nothing
endfunction
//TESH.scrollpos=12
//TESH.alwaysfold=0
library SpellFolieFurieuse needs libSpellEffect
globals
constant integer KS_FOLIE_FURIEUSE = StringHash("spell__foliefurieuse")
endglobals
struct FolieFurieuse extends Spell
real dur = 8.0
static method cycle takes nothing returns boolean
local thistype this = T1_GetData()
set this.dur = this.dur - 1.0
if( this.dur <= 0.0 ) then
set udg_Rage_Val[GetPlayerId(GetOwningPlayer(this.caster))] = udg_Rage_ADRENALINE
call RInteger( GetHandleId(this.caster), KS_FOLIE_FURIEUSE)
call FolieFurieuse.destroy(this)
return true
endif
return false
endmethod
endstruct
function scFolieFurieuse takes nothing returns nothing
local FolieFurieuse obj = LInteger(GetHandleId(GetSpellAbilityUnit()), KS_FOLIE_FURIEUSE)
if( obj == 0 ) then
set obj = FolieFurieuse.create()
set obj.caster = GetSpellAbilityUnit()
call SInteger( obj, GetHandleId(GetSpellAbilityUnit()), KS_FOLIE_FURIEUSE)
set udg_Rage_Val[GetPlayerId(GetOwningPlayer(obj.caster))] = udg_Rage_ADRENALINE * 1.5
call T1_Add(function FolieFurieuse.cycle, obj)
else
set obj.dur = 8.0
endif
endfunction
//===========================================================================
function InitTrig_Folie_Furieuse takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
function sdMorsureProfonde takes nothing returns nothing
local unit caster = GetSpellAbilityUnit()
local unit target = GetSpellTargetUnit()
local integer lvl = GetSpellLvl()
local real dmg = lvl * 50 + GetHeroStr(caster, true) * lvl + 100
call DmgToUnit( caster, target, dmg, true )
//call DestroyEffect( AddSpecialEffectTarget( EFFECT_BLESSURE_OUVERTE, target, "origin") )
set caster = null
set target = null
endfunction
//===========================================================================
function InitTrig_Morsure_Profonde takes nothing returns nothing
endfunction
//TESH.scrollpos=18
//TESH.alwaysfold=0
library SpellExplosionDeRage needs libSpellEffect
globals
constant integer UNIT_BEAM = 'h018'
constant integer KS_EXPLOSIONDERAGE = StringHash("spell__ExplosionDeRage")
endglobals
struct ExplosionDeRage extends Spell
real angle
method LaserBeam takes nothing returns nothing
local real x
local real y
local unit u
set x = GetUnitX(this.caster)
set y = GetUnitY(this.caster)
set u = CreateUnit( GetOwningPlayer(this.caster), UNIT_BEAM, 0.0, 0.0, Rad2Deg(this.angle) )
call SetUnitX( u, x+50*Cos(this.angle) )
call SetUnitY( u, y+50*Sin(this.angle) )
call SetUnitTimeScalePercent( u, 150 )
call DmgToUnit( this.caster, this.target, this.dmg, true)
call UnitApplyTimedLife( u, 'BTLF', 2.0 )
set u = null
endmethod
static method Beam takes nothing returns nothing
local timer t = GetExpiredTimer()
local ExplosionDeRage obj = LInteger( GetHandleId(t), KS_EXPLOSIONDERAGE )
call obj.LaserBeam()
call DestroyTimer(t)
set t = null
endmethod
static method cycle takes nothing returns boolean
local thistype this = T1_GetData()
local real x
local real y
local location loc
local group g
local timer t
if( not IsUnitCanalisation(this.caster) or GetUnitState( this.caster, UNIT_STATE_MANA) < 0.1 ) then
call SetUnitAnimationByIndex( this.caster, 6 )
call ExplosionDeRage.destroy(this)
return true
endif
set x = GetUnitX(this.caster)
set y = GetUnitY(this.caster)
set loc = Location(x,y)
set Cond.condUnite = this.caster
set g = GetUnitsInRangeOfLocMatching( 700.0, loc, Condition( function Cond.EnnemiVar) )
set this.target = GroupPickRandomUnit(g)
if( this.target != null ) then
set this.angle = Atan2( GetUnitY(this.target) - GetUnitY(this.caster), GetUnitX(this.target) - GetUnitX(this.caster))
call SetUnitAnimationByIndex( this.caster, 7 )
call SetUnitFacing( this.caster, Rad2Deg(this.angle) )
set t = CreateTimer()
call SInteger( this, GetHandleId(t), KS_EXPLOSIONDERAGE )
call TimerStart( t, 0.55, false, function ExplosionDeRage.Beam )
call AddMana( this.caster, -0.5)
endif
call DestroyGroup(g)
call RemoveLocation(loc)
set g = null
set loc = null
set t = null
return false
endmethod
endstruct
function seExplosionDeRage takes nothing returns nothing
local ExplosionDeRage obj = ExplosionDeRage.create()
set obj.caster = GetSpellAbilityUnit()
set obj.dmg = GetSpellLvl() * 75 + 100
call AddMana( obj.caster, 6.0)
call Canalisation(obj.caster)
call T1_Add(function ExplosionDeRage.cycle, obj)
endfunction
//===========================================================================
function InitTrig_Explosion_de_rage takes nothing returns nothing
endfunction
endlibrary
function Aura_Fleurie_Actions takes nothing returns nothing
local timer t = GetExpiredTimer()
local string m = I2S(H2I(t))
call RemoveUnit(GetUnit(m,"Fleur"))
call DestroyTimer(t)
call FlushStoredMission(udg_Spell, m)
endfunction
function Aura_Fleurie takes nothing returns nothing
local timer t = GetExpiredTimer()
local string m = I2S(H2I(t))
local unit caster = GetCaster(m)
local real duree = 15 //GetHeroInt(caster,true)
local real x = GetUnitX(caster)
local real y = GetUnitY(caster)
local unit u
if( not GetBoolean(m,"On/Off") ) then
return
endif
set x = Pos_Terrain(x)
set y = Pos_Terrain(y)
if( SetTerrainTimed( x, y, Herbe(), FormeCercle(), duree) ) then
set t = CreateTimer()
set m = I2S(H2I(t))
set u = CreateUnit( Player(0), 'h00I'+GetRandomInt(0,2), x-50+GetRandomReal(0,100), y-50+GetRandomReal(0,100), GetRandomInt(0,360) )
call StoreInteger( udg_Spell, m, "Fleur", H2I(u))
call TimerStart( t, duree, false, function Aura_Fleurie_Actions)
endif
endfunction
function Init_Aura_Fleurie takes unit u returns nothing
local trigger t = CreateTrigger()
local timer ti = CreateTimer()
local string m = I2S(H2I(ti))
call StoreString( udg_Spell, I2S(H2I(t)), "Timer", m)
call TriggerRegisterUnitEvent( t, u, EVENT_UNIT_DEATH )
call SetCaster( m,u)
call StoreBoolean( udg_Spell, m, "On/Off", true)
call TimerStart( ti, 0.4, true, function Aura_Fleurie )
endfunction
//===========================================================================
function InitTrig_Aura_Fleurie takes nothing returns nothing
endfunction
function Creer_Flamme takes real x, real y, player p returns nothing
set x = Pos_Terrain(x)
set y = Pos_Terrain(y)
if( GetTerrainType(x,y) == Herbe() and not GetBoolean(R2S(x)+R2S(y), "Occupé") ) then
call StoreReal(udg_Spell, "Tempo", "x", x)
call StoreReal(udg_Spell, "Tempo", "y", y)
call StoreReal(udg_Spell, "Tempo", "Player", H2I(p))
call ExecuteFunc("Flamme_Propagation")
endif
endfunction
function Flamme_Propagation_Actions takes nothing returns nothing
local timer t = GetExpiredTimer()
local string m = I2S(H2I(t))
local real x = GetReal(m,"x")
local real y = GetReal(m,"y")
local string m2 = R2S(x) + R2S(y)
local unit feu = GetUnit(m,"Feu")
local integer i = GetInteger(m,"i")
local boolean b = false
local player p = GetOwningPlayer(feu)
local integer a = 1
call StoreInteger( udg_Spell, m, "i", i+1)
loop
exitwhen a > 8
call Creer_Flamme(x+128.0*Cos(Deg2Rad(a*45)),y+128.0*Sin(Deg2Rad(a*45)),p)
set a = a + 1
endloop
if( GetTerrainType(x,y) != Herbe() ) then
call DestroyTimer(t)
call FlushStoredMission(udg_Spell, m)
call FlushStoredBoolean(udg_Spell, m2, "Occupé")
call RemoveUnit(feu)
endif
endfunction
function Flamme_Propagation takes nothing returns nothing
local real x = GetReal("Tempo", "x")
local real y = GetReal("Tempo", "y")
local player p = H2P(GetInteger("Tempo", "Player"))
local unit feu = CreateUnit(Player(0), 'h00L', x, y, GetRandomInt(0,360) )
local timer t = CreateTimer()
local string m = I2S(H2I(t))
local string m2 = R2S(x) + R2S(y)
call DisplayTextToPlayer(Player(0), 0, 0, R2S(x))
call DisplayTextToPlayer(Player(0), 0, 0, R2S(y))
call FlushStoredMission(udg_Spell, "Tempo")
call StoreInteger( udg_Spell, m, "Feu", H2I(feu))
call StoreInteger( udg_Spell, m, "i", 0)
call StoreReal( udg_Spell, m, "x", x)
call StoreReal( udg_Spell, m, "y", y)
call StoreBoolean( udg_Spell, m2, "Occupé", true)
call TimerStart( t, 0.75, true, function Flamme_Propagation_Actions)
endfunction
function Propagation_Actions takes nothing returns nothing
endfunction
function Propagation takes nothing returns nothing
endfunction
//===========================================================================
function InitTrig_Propagation takes nothing returns nothing
endfunction
//TESH.scrollpos=22
//TESH.alwaysfold=0
function adEvolutionNaturelle takes nothing returns nothing
endfunction
function beAveuglement takes nothing returns nothing
endfunction
function ecChaleur takes nothing returns nothing
endfunction
function gcGroupHealing takes nothing returns nothing
endfunction
function iaConfusionEsprit takes nothing returns nothing
endfunction
function icTraqueurCorrompu takes nothing returns nothing
endfunction
function ieInvoquerDemon takes nothing returns nothing
endfunction
function ocToucheSpirituel takes nothing returns nothing
endfunction
function pbIvresse takes nothing returns nothing
endfunction
function sbDevorer takes nothing returns nothing
endfunction
//==== Objets ====//
function Boucliermagique takes nothing returns nothing
endfunction
//===========================================================================
function InitTrig_Void takes nothing returns nothing
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Frost_Armor_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local string m = I2S(H2I( caster ))
local unit target = GetEventDamageSource()
local integer lvl = GetInteger(m, "Level_Frost")
local real dmg = lvl * 8
if ( GetUnitAbilityLevel(caster, 'BUfa') < 1) then
call FlushStoredInteger(udg_Spell,m,"Level_Frost")
call FlushStoredInteger(udg_Spell,m,"Trigger_Frost")
call DestroyTrigger(GetTriggeringTrigger() )
return
endif
call BJDebugMsg("DOT")
call Dot( caster, target, dmg, 1, 5, true, "GLACE")
endfunction
function hcFrost_Armor takes nothing returns nothing
local trigger t
local unit caster = GetTriggerUnit()
local string m = I2S(H2I(caster))
local integer lvl = GetSpellLvl()
local unit u = CreateUnit( GetOwningPlayer(caster), 'h00N', GetUnitX(caster), GetUnitY(caster), 0)
call IssueTargetOrder( u, "frostarmor", caster)
call UnitApplyTimedLife( u, 'BTLF', 2)
if ( GetUnitAbilityLevel(caster, 'BUfa') < 1 ) then
if( HaveStoredInteger( udg_Spell, m, "Trigger_Frost") ) then
call DestroyTrigger( H2Tr(GetInteger( m, "Trigger_Frost")) )
endif
set t = CreateTrigger()
call StoreInteger( udg_Spell, m, "Level_Frost", lvl )
call StoreInteger( udg_Spell, m, "Trigger_Frost", H2I(t) )
call TriggerAddAction( t, function Frost_Armor_Actions )
call TriggerRegisterUnitEvent( t, caster , EVENT_UNIT_DAMAGED )
endif
endfunction
//===========================================================================
function InitTrig_Armure_de_Glace takes nothing returns nothing
endfunction
function Barre takes nothing returns nothing
local timer t = GetExpiredTimer()
local string m = I2S(H2I(t))
local unit caster = GetUnit( m, "Caster")
local string h = GetStoredString( udg_Spell, m, "Handle")
local real bouclier = GetStoredReal( udg_Spell, h, "Bouclier")
local real bouclier_m = GetStoredReal( udg_Spell, h, "Bouclier_Max")
local texttag text
local string barre = "|cffff1111"
local integer valeur = R2I(0.4 * ((bouclier*100)/bouclier_m))
local integer a = 0
local integer i = GetStoredInteger( udg_Spell, m, "Timer")
local location loc = Location( GetUnitX(caster) - 90.0, GetUnitY(caster) )
local unit u
call StoreInteger( udg_Spell,m, "Timer", i+1 )
loop
exitwhen a > 39
if ( a == valeur) then
set barre = barre + "|r"+"|cffbababa"
endif
set barre = barre + "'"
set a = a + 1
endloop
call DestroyTextTag( H2T(GetStoredInteger(udg_Spell, m, "Text")) )
set text = CreateTextTagLocBJ( barre, loc, 218.00, 10.00, 100, 100, 100, 0 )
call SetTextTagPermanentBJ( text, false )
call StoreInteger( udg_Spell,m, "Text", H2I(text) )
call RemoveLocation(loc)
set loc = null
if( bouclier <= 0) then
set a = 1
loop
exitwhen a > 3
call RemoveUnit( GetUnit(m, "u"+I2S(a)) )
set a = a + 1
endloop
call DestroyTextTag( H2T(GetStoredInteger(udg_Spell, m, "Text")) )
call DestroyTimer(t)
call FlushStoredMission(udg_Spell,m)
call FlushStoredMission(udg_Spell,h)
endif
set a = 1
loop
exitwhen a > 3
set u = GetUnit(m,"u"+I2S(a))
call SetUnitX(u, GetUnitX(caster) + 70*Cos(Deg2Rad(i*4+a*120)) )
call SetUnitY(u, GetUnitY(caster) + 70*Sin(Deg2Rad(i*4+a*120)) )
set a = a + 1
endloop
endfunction
function Bouclier_d_os_Fin takes nothing returns nothing
local timer t = GetExpiredTimer()
local string m = I2S(H2I(t))
local unit u = GetUnit( m, "Caster")
local real vie = GetReal( m, "Vie")
call SetUnitState( u, UNIT_STATE_LIFE, GetUnitState(u, UNIT_STATE_LIFE) + vie )
call FlushStoredMission(udg_Spell,m)
call DestroyTimer(t)
endfunction
function Bouclier_d_os_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local string m = I2S(H2I( caster ))
local real bouclier = GetStoredReal( udg_Spell, m, "Bouclier")
local timer t = CreateTimer()
local string m2 = I2S(H2I(t))
local integer a = 1
call StoreReal( udg_Spell, m, "Bouclier", bouclier - GetEventDamage() )
if( GetUnitState( caster, UNIT_STATE_LIFE) > GetEventDamage() ) then
call StoreInteger( udg_Spell, m2, "Caster", H2I(caster) )
call StoreReal( udg_Spell, m2, "Vie", GetEventDamage() )
call TimerStart ( t, 0.01, false, function Bouclier_d_os_Fin )
else
call AddLife(caster, GetEventDamage())
endif
if ( GetStoredReal( udg_Spell, m, "Bouclier") < 0.00 ) then
call DestroyTrigger(GetTriggeringTrigger() )
endif
endfunction
function dbBouclier_d_os takes nothing returns nothing
local trigger t = CreateTrigger()
local timer tim = CreateTimer()
local unit caster = GetTriggerUnit()
local string m = I2S(H2I(caster))
local string m2
local texttag text = CreateTextTag()
local integer a = 1
local unit u
local integer lvl = GetUnitAbilityLevel( GetTriggerUnit(), GetSpellAbilityId())
if ( HaveStoredBoolean( udg_Spell, m, "Bool") == false ) then
call StoreBoolean( udg_Spell, m, "Bool" , true )
call StoreInteger( udg_Spell, m, "Caster", H2I(caster) )
call StoreReal( udg_Spell, m, "Bouclier", R2I(lvl/2+2)*GetHeroAgi(caster, true)+lvl*50 )
call StoreReal( udg_Spell, m, "Bouclier_Max", R2I(lvl/2+2)*GetHeroAgi(caster, true)+lvl*50 )
call TriggerAddAction( t, function Bouclier_d_os_Actions )
call TriggerRegisterUnitEvent( t, GetTriggerUnit() , EVENT_UNIT_DAMAGED )
set m2 = I2S(H2I(tim ))
loop
exitwhen a > 3
set u = CreateUnit(GetOwningPlayer(caster),'h010', GetUnitX(caster) + 70*Cos(Deg2Rad(a*120)), GetUnitY(caster) + 70*Sin(Deg2Rad(a*120)), a*120 )
call StoreInteger( udg_Spell, m2, "u"+I2S(a), H2I(u) )
set a = a + 1
endloop
call StoreString( udg_Spell, m2, "Handle", m )
call StoreInteger( udg_Spell,m2, "Caster", H2I(GetTriggerUnit()) )
call StoreInteger( udg_Spell,m2, "Timer", 0 )
call StoreInteger( udg_Spell,m2, "Text", H2I(text) )
call TimerStart (tim , 0.02,true ,function Barre )
else
call StoreReal( udg_Spell, m, "Bouclier", R2I(lvl/2+2)*GetHeroAgi(caster, true)+lvl*50 )
call StoreReal( udg_Spell, m, "Bouclier_Max", R2I(lvl/2+2)*GetHeroAgi(caster, true)+lvl*50 )
endif
endfunction
//===========================================================================
function InitTrig_Bouclier_d_os takes nothing returns nothing
endfunction
//TESH.scrollpos=60
//TESH.alwaysfold=0
function Eclair_Chaine takes nothing returns string
return "AFOD" //Renvoi le code pour le model d'eclair
endfunction
function Effet_Chaine takes nothing returns string
return "Abilities\\Spells\\Orc\\FeralSpirit\\feralspirittarget.mdl" //Effet qui s'applique sur les unités ciblées
endfunction
function Portee_Chaine takes integer lvl returns integer
local integer array range
set range[1] = 300
set range[2] = 330
//set range[X] = Y
//Copier et coller la ligne précédente en enlevant les "//" pour les level au delà du 2eme
return range[lvl]
endfunction
function Nb_Cible_Chaine takes integer lvl returns integer
local integer array nb_cible
set nb_cible[1] = 3
set nb_cible[2] = 4
//set nb_cible[X] = Y
//Copier et coller la ligne précédente en enlevant les "//" pour les level au delà du 2eme
return nb_cible[lvl]
endfunction
function Chaine_Conditions takes nothing returns boolean
local boolean b
local timer t = GetExpiredTimer()
local string m = I2S(H2I(t))
local unit caster = GetUnit(m,"Caster")
local integer data = GetUnitUserData(GetFilterUnit())
set b = IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(caster) )
set b = b and GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) > 0
if ( b and data != 1) then
call StoreInteger(udg_Spell,m,"Target",H2I(GetFilterUnit()))
endif
return ( b and data != 1)
endfunction
function Chaine_Actions takes nothing returns nothing
local timer t = GetExpiredTimer()
local string m = I2S(H2I(t))
local unit caster = GetUnit(m,"Caster")
local unit target = GetUnit(m,"Target")
local integer nb_unit = GetStoredInteger(udg_Spell,m,"Nb_Unit")
local integer data_nb_unit = GetStoredInteger(udg_Spell,m,"Data_Nb_Unit")
local integer lvl = GetStoredInteger(udg_Spell,m,"Level")
local integer a = 1
local group g = GetUnitsInRangeOfLocMatching(Portee_Chaine(lvl), GetUnitLoc(target), Condition(function Chaine_Conditions))
local unit u = target
if ( IsUnitGroupEmptyBJ(g) == false and nb_unit < data_nb_unit ) then
set target = GetUnit(m,"Target")
set nb_unit = nb_unit + 1
call StoreInteger(udg_Spell,m,"Nb_Unit", nb_unit)
call StoreInteger(udg_Spell,m,"u"+I2S(nb_unit),H2I(target))
//call DmgToUnit( caster,
call SetUnitUserData(target, 1)
call Eclair( Eclair_Chaine(), u, target, 0.3, Effet_Chaine(), "origin" )
else
loop
exitwhen a > nb_unit
call SetUnitUserData(GetUnit(m, "u"+I2S(a)), 0)
set a = a + 1
endloop
call DestroyTimer(t)
call DestroyTrigger(GetTriggeringTrigger())
call FlushStoredMission(udg_Spell,m)
endif
call DestroyGroup(g)
endfunction
function Chaine takes nothing returns nothing
local unit caster = GetTriggerUnit()
local player p = GetOwningPlayer(caster)
local unit target = GetSpellTargetUnit()
local integer nb_unit = 1
local integer lvl = GetUnitAbilityLevel( GetTriggerUnit(), GetSpellAbilityId())
local integer data_nb_unit = Nb_Cible_Chaine(lvl)
local timer t = CreateTimer()
local string m = I2S(H2I(t))
local integer a = 2
call StoreInteger(udg_Spell,m,"u1",H2I(target))
call TxtFlo( "TOI !!", target, 20, 20, 90 )
call SetUnitUserData(target, 1)
call Eclair( Eclair_Chaine(), caster, target, 0.25, Effet_Chaine(), "origin" )
call StoreInteger(udg_Spell,m,"Level",lvl)
call StoreInteger(udg_Spell,m,"Caster",H2I(caster))
call StoreInteger(udg_Spell,m,"Target",H2I(target))
call StoreInteger(udg_Spell,m,"Nb_Unit", nb_unit)
call StoreInteger(udg_Spell,m,"Data_Nb_Unit", data_nb_unit)
call TimerStart (t , 0.25,true ,function Chaine_Actions )
endfunction
//===========================================================================
function InitTrig_Chaine_de_truc takes nothing returns nothing
endfunction
//TESH.scrollpos=9
//TESH.alwaysfold=0
function Distorsion_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local string m = I2S(H2I( caster ))
local unit target = GetEventDamageSource()
local real dmg = GetStoredReal(udg_Spell, m, "Dmg")
if ( GetRandomInt(1,2) == 1 ) then
call AddLife( caster, GetEventDamage() )
call Eclair( "CLPB", caster, target, 1, "Abilities\\Weapons\\Bolt\\BoltImpact.mdl", "origin" )
call DmgToUnit( caster, target, dmg, false )
call TxtFlo( "|cff3333dd"+I2S(R2I(dmg))+"|r |cffff1111miss|r", target, 100, 100, 100 )
endif
if ( ( GetUnitAbilityLevel(caster, 'BNms') < 1) ) then
call FlushStoredMission(udg_Spell,m)
call DestroyTrigger(GetTriggeringTrigger() )
endif
endfunction
function Distorsion takes nothing returns nothing
local trigger t
local unit caster = GetTriggerUnit()
local string m = I2S(H2I(caster))
local integer lvl = GetUnitAbilityLevel( caster, GetSpellAbilityId())
if ( GetUnitAbilityLevel(caster, 'BNms') < 1 ) then
set t = CreateTrigger()
call StoreReal( udg_Spell, m, "Dmg", lvl * 10 + GetHeroStr(caster,true) )
call StoreInteger( udg_Spell, m, "Caster", H2I(caster) )
call TriggerAddAction( t, function Distorsion_Actions )
call TriggerRegisterUnitEvent( t, caster , EVENT_UNIT_DAMAGED )
endif
endfunction
//===========================================================================
function InitTrig_Distorsion takes nothing returns nothing
endfunction
function jaExplo_morb takes nothing returns nothing
local unit caster = GetTriggerUnit()
local integer lvl = GetSpellLvl()
local real dmg = R2I((lvl+1)/2) * GetHeroInt(caster, true) + 10 + 20*lvl
local location loc = GetSpellTargetLoc()
local group corpse = GetUnitsInRangeOfLocMatching( 180, loc, Condition(function Cond.Dead))
local unit u
call RemoveLocation(loc)
loop
set u = FirstOfGroup(corpse)
exitwhen u == null
call GroupRemoveUnit( corpse, u)
set loc = Location(GetUnitX(u),GetUnitY(u))
call DmgToArea( loc, caster, dmg, 190, true)
call DestroyEffect( AddSpecialEffect( "Objects\\Spawnmodels\\Human\\HumanLargeDeathExplode\\HumanLargeDeathExplode.mdl", GetUnitX(u), GetUnitY(u)) )
call RemoveUnit(u)
call RemoveLocation(loc)
endloop
call DestroyGroup(corpse)
set corpse = null
set loc = null
endfunction
//===========================================================================
function InitTrig_Explosion_Morbide takes nothing returns nothing
endfunction
function Dgts_Furie takes nothing returns nothing
local unit target = GetTriggerUnit()
local string m = I2S(H2I(target ))
local unit caster = GetUnit( m, "Caster")
local real dmg = GetEventDamage()*(1-(GetUnitState(caster, UNIT_STATE_LIFE)/GetUnitState(caster, UNIT_STATE_MAX_LIFE)))
call DmgToUnit( target, caster, dmg, false)
call TxtFlo( I2S(R2I(GetEventDamage()+dmg)), target, 20, 20, 90 )
call AddSpecialEffectTarget( "Abilities\\Spells\\Other\\Doom\\DoomDeath.mdl", target, "origin" )
call FlushStoredMission(udg_Spell,m)
call DestroyTrigger(GetTriggeringTrigger() )
call Shake(GetOwningPlayer(GetEventDamageSource() ))
endfunction
function Furie_Actions takes nothing returns nothing
local string m = I2S(H2I(GetTriggeringTrigger() ))
local string m2 = I2S(H2I( GetTriggerUnit()))
local unit caster = GetUnit( m, "Caster")
local integer t = GetStoredInteger(udg_Spell, m, "Timer")
local trigger trig = CreateTrigger()
if ( GetUnitAbilityLevel(caster, 'Bbsk') < 1) then
call FlushStoredMission(udg_Spell,m)
call DestroyTrigger(GetTriggeringTrigger() )
return
endif
call StoreInteger( udg_Spell, m2, "Caster", H2I(caster) )
call TriggerAddAction( trig, function Dgts_Furie )
call TriggerRegisterUnitEvent( trig, GetTriggerUnit() , EVENT_UNIT_DAMAGED )
call TriggerAddCondition(trig, Condition( function Dgts_Conditions ) )
endfunction
function Furie takes nothing returns nothing
local trigger t = CreateTrigger()
local string m = I2S(H2I(t))
call StoreInteger( udg_Spell, m, "Caster", H2I(GetTriggerUnit()) )
call TriggerAddAction( t, function Furie_Actions )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition(t, Condition( function Attaquant_Caster_Conditions ) )
endfunction
//===========================================================================
function InitTrig_Furie takes nothing returns nothing
endfunction
function Incompetence_Actions takes nothing returns nothing
local string m = I2S(H2I(GetTriggeringTrigger() ))
local unit caster = GetUnit( m, "Caster")
local unit target = GetUnit( m, "Target")
local integer dmg = GetHeroInt(caster, true)*2
if ( GetUnitAbilityLevel(target, 'Bprg') < 1 ) then
call FlushStoredMission(udg_Spell,m)
call DestroyTrigger(GetTriggeringTrigger() )
return
endif
call UnitDamageTargetBJ( caster, target, dmg, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
call TxtFlo( I2S(R2I(dmg)), target, 20, 20, 90 )
call AddSpecialEffect( "Abilities\\Spells\\Undead\\Impale\\ImpaleHitTarget.mdl", GetUnitX(target), GetUnitY(target) )
call UnitRemoveAbility(target, 'Bprg')
call PauseUnit(target, true)
call TriggerSleepAction( 2)
call PauseUnit(target, false)
endfunction
function Incompetence takes nothing returns nothing
local trigger t
local string m
local unit target = GetSpellTargetUnit()
if ( GetUnitAbilityLevel(target, 'Bprg') < 1 ) then
set t = CreateTrigger()
set m = I2S(H2I(t))
call StoreInteger( udg_Spell, m, "Caster", H2I(GetTriggerUnit()) )
call StoreInteger( udg_Spell, m, "Target", H2I(target) )
call TriggerAddAction( t, function Incompetence_Actions )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition(t, Condition( function Attaquant_Target_Conditions ) )
endif
endfunction
//===========================================================================
function InitTrig_Incompetence takes nothing returns nothing
endfunction
function Lien_d_invoc_Conditions takes nothing returns boolean
local string m = I2S(GetPlayerId(GetOwningPlayer(GetAttacker())) )
if (HaveStoredInteger(udg_Spell, "Lien"+m, "Invoc") ) then
return H2I(GetAttacker()) == GetStoredInteger( udg_Spell, "Lien"+m, "Invoc")
else
return false
endif
endfunction
function Lien_d_invoc_Actions takes nothing returns nothing
local string m = I2S(GetPlayerId(GetOwningPlayer(GetAttacker())) )
local unit caster = GetUnit( "Lien"+m, "Caster")
if ( GetUnitState(caster, UNIT_STATE_MANA) < 10 )then
call KillUnit( GetAttacker() )
call FlushStoredMission(udg_Spell,"Lien"+m)
call DestroyTrigger(GetTriggeringTrigger() )
endif
call TriggerSleepAction( 0.30)
call SetUnitState( caster, UNIT_STATE_MANA,GetUnitState(caster, UNIT_STATE_MANA) - 10.00 )
call UnitDamageTargetBJ( GetAttacker(), GetTriggerUnit(), GetHeroInt(caster, true)*2, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
call TxtFlo( I2S(GetHeroInt(caster, true)*2), GetTriggerUnit(), 20, 20, 90 )
endfunction
function Lien_d_invoc takes nothing returns nothing
local trigger t = CreateTrigger()
local string m = I2S(GetPlayerId(GetOwningPlayer(GetTriggerUnit())) )
call StoreInteger( udg_Spell, "Lien"+m, "Caster", H2I(GetSummoningUnit()) )
call StoreInteger( udg_Spell, "Lien"+m, "Invoc" , H2I(GetSummonedUnit()) )
if ( HaveStoredBoolean( udg_Spell, "Lien"+m, "Bool") == false ) then
call StoreBoolean( udg_Spell, "Lien"+m, "Bool" , true )
call TriggerAddAction( t, function Lien_d_invoc_Actions )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition(t, Condition( function Lien_d_invoc_Conditions ) )
endif
endfunction
//===========================================================================
function InitTrig_Lien_d_invoc takes nothing returns nothing
endfunction
//TESH.scrollpos=75
//TESH.alwaysfold=0
function Vitesse_Orbe takes nothing returns integer
return 7
endfunction
function Orbe_de_Glace_Actions takes nothing returns nothing
local timer t = GetExpiredTimer()
local string m = I2S(H2I(t))
local unit caster = GetUnit(m, "Caster")
local unit orbe = GetUnit(m, "Orbe")
local integer i = GetInteger( m, "i")
local integer vit = Vitesse_Orbe()
local real duree = GetReal( m, "Duree")
local real dmg = GetReal( m, "Dmg")
local real angle = GetReal( m, "Angle")
local boolean b = GetBoolean( m, "Orbe_Ppal")
local group cibles
local integer a = 1
local integer nb_unit
local unit u
call StoreInteger( udg_Spell, m, "i", i+1 )
if( (b and i > 800/vit) or ( not b and i > 500/vit) ) then
call KillUnitAL(orbe)
call FlushStoredMission( udg_Spell, m)
call DestroyTimer(t)
return
endif
if not b then
set vit = 9
endif
call SetUnitX(orbe, GetUnitX(orbe) + vit * Cos(angle) )
call SetUnitY(orbe, GetUnitY(orbe) + vit * Sin(angle) )
if( ModuloInteger(i,10)==0 ) then
if(b) then
set cibles = GetUnitsInRangeOfLocMatching( 125, GetUnitLoc(orbe), Condition(function Cond_Groupe_Ennemi_Timer) )
else
set cibles = GetUnitsInRangeOfLocMatching( 60, GetUnitLoc(orbe), Condition(function Cond_Groupe_Ennemi_Timer) )
endif
set nb_unit = CountUnit(cibles)
loop
exitwhen a > nb_unit
set u = FirstOfGroup(cibles)
call GroupRemoveUnit(cibles, u)
//if( Dgts_Commun( m, caster, u, dmg, true) ) then
call Gel_Total( u, duree)
if( not b) then
call StoreInteger( udg_Spell, m, "i", 9999 )
endif
//endif
set a = a + 1
endloop
call DestroyGroup(cibles)
endif
if(b and ModuloInteger(i,4)==0) then
set dmg = GetReal( m, "Dmg2")
set t = CreateTimer()
set m = I2S(H2I(t))
set u = CreateUnit( GetOwningPlayer(caster), 'h00F', GetUnitX(orbe), GetUnitY(orbe), i*7)
call StoreInteger( udg_Spell, m, "Orbe", H2I(u) )
call StoreInteger( udg_Spell, m, "Caster", H2I(caster) )
call StoreInteger( udg_Spell, m, "i", 0 )
call StoreReal( udg_Spell, m, "Dmg", dmg )
call StoreReal( udg_Spell, m, "Angle", Deg2Rad(I2R(i*7)) )
call StoreReal( udg_Spell, m, "Duree", duree )
call StoreBoolean( udg_Spell, m, "Orbe_Ppal", false)
call TimerStart( t, 0.02, true, function Orbe_de_Glace_Actions )
endif
endfunction
function Orbe_de_Glace takes nothing returns nothing
local timer t = CreateTimer()
local string m = I2S(H2I(t))
local unit caster = GetTriggerUnit()
local real xc = GetUnitX(caster)
local real yc = GetUnitY(caster)
local integer lvl = GetUnitAbilityLevel( caster, GetSpellAbilityId())
local real dmg = lvl * 30
local real dmg2 = lvl * 20
local real duree = lvl * 1.2
local real angle = Atan2(GetLocationY(GetSpellTargetLoc()) - yc, GetLocationX(GetSpellTargetLoc()) - xc )
local unit orbe = CreateUnit( GetOwningPlayer(caster), 'h00E', xc+50*Cos(angle), yc+50*Sin(angle), Rad2Deg(angle) )
call StoreInteger( udg_Spell, m, "Caster", H2I(caster) )
call StoreInteger( udg_Spell, m, "Orbe", H2I(orbe) )
call StoreInteger( udg_Spell, m, "i", 0 )
call StoreReal( udg_Spell, m, "Angle", angle )
call StoreReal( udg_Spell, m, "Dmg", dmg )
call StoreReal( udg_Spell, m, "Dmg2", dmg2 )
call StoreReal( udg_Spell, m, "Duree", duree )
call StoreBoolean( udg_Spell, m, "Orbe_Ppal", true)
call TimerStart( t, 0.02, true, function Orbe_de_Glace_Actions )
endfunction
//===========================================================================
function InitTrig_Orbe_de_Glace takes nothing returns nothing
endfunction
//TESH.scrollpos=5
//TESH.alwaysfold=0
function Phenix_Actions takes nothing returns nothing
local timer t = GetExpiredTimer()
local string m = I2S(H2I(t))
local unit caster = GetUnit(m, "Caster")
local unit target = GetUnit(m, "Target")
local location loc = GetLocation( m, "Loc")
local real x = GetLocationX(loc)
local real y = GetLocationY(loc)
local real dmg1 = GetReal( m, "Dmg1")
call CreateUnit( GetOwningPlayer(caster), 'h00C', x, y, GetRandomReal(0, 360) )
call DmgToArea( loc, caster, dmg1, 160, true)
call FlushStoredMission( udg_Spell, m)
call DestroyTimer(t)
endfunction
function Phenix_Effet_Actions takes nothing returns nothing
local timer t = GetExpiredTimer()
local string m = I2S(H2I(t))
local unit caster = GetUnit(m, "Caster")
local location loc = GetRandomLoc( GetUnitX(caster), GetUnitY(caster), 460)
local integer i = GetInteger( m, "i")
local timer tb = CreateTimer()
local string mb = I2S(H2I(tb))
local integer nb_phenix = GetInteger( m, "Nb_Phenix")
if( i > nb_phenix) then
call FlushStoredMission( udg_Spell, m)
call DestroyTimer(t)
return
endif
call Effect( "Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl", GetLocationX(loc), GetLocationY(loc),3.0 )
call StoreInteger( udg_Spell, m, "i", i+1)
call StoreInteger( udg_Spell, mb, "Caster", H2I(caster) )
call StoreInteger( udg_Spell, mb, "Target", GetInteger(m, "Target") )
call StoreInteger( udg_Spell, mb, "Loc", H2I(loc) )
call StoreReal( udg_Spell, mb, "Dmg1", GetReal(m, "Dmg1") )
call StoreReal( udg_Spell, mb, "Dmg2", GetReal(m, "Dmg2") )
call TimerStart( tb, 0.3, false, function Phenix_Actions )
endfunction
function Phenix takes nothing returns nothing
local timer t = CreateTimer()
local string m = I2S(H2I(t))
local unit caster = GetTriggerUnit()
local unit target = GetSpellTargetUnit()
local integer lvl = GetUnitAbilityLevel( caster, GetSpellAbilityId())
local real dmg1 = lvl*30 + GetHeroInt(caster, true)
local real dmg2 = lvl*20 + GetHeroInt(caster, true)
local integer nb_phenix = 10
call StoreInteger( udg_Spell, m, "Caster", H2I(caster) )
call StoreInteger( udg_Spell, m, "Target", H2I(target) )
call StoreInteger( udg_Spell, m, "Nb_Phenix", nb_phenix )
call StoreInteger( udg_Spell, m, "i", 0 )
call StoreReal( udg_Spell, m, "Dmg1", dmg1)
call StoreReal( udg_Spell, m, "Dmg2", dmg2)
call TimerStart( t, 0.25, true, function Phenix_Effet_Actions )
endfunction
//===========================================================================
function InitTrig_Phenix takes nothing returns nothing
endfunction
//TESH.scrollpos=24
//TESH.alwaysfold=0
function Phenix_Charge_Actions takes nothing returns nothing
local unit summon = GetTriggerUnit()
local unit caster = udg_Hero[GetConvertedPlayerId(GetOwningPlayer(summon))]
local string m = I2S(H2I(caster))+"Phenix"
local integer lvl = GetInteger( m, "Lvl")
call UnitRemoveAbility( caster, 'A01T')
call UnitAddAbility( caster, 'A01U')
call SetUnitAbilityLevel( caster, 'A01U', lvl)
call DestroyTrigger(GetTriggeringTrigger())
call FlushStoredMission( udg_Spell, m)
endfunction
function Phenix_Charge takes nothing returns nothing
local unit summon = GetTriggerUnit()
local unit caster = GetSummoningUnit()
local integer lvl = GetUnitAbilityLevel( caster, GetSpellAbilityId())
local real dmg = GetHeroAgi( caster, true) + lvl * 30
local trigger t = CreateTrigger()
local string m = I2S(H2I(caster))+"Phenix"
call UnitRemoveAbility( caster, 'A01U')
call UnitAddAbility( caster, 'A01T')
call SetUnitAbilityLevel( summon, 'A01S', lvl)
call IssueTargetOrder( summon, "move", caster)
call StoreInteger( udg_Spell, m, "Lvl", lvl)
call StoreInteger( udg_Spell, m, "Phenix", H2I(summon))
call StoreReal( udg_Spell, m, "Dmg", dmg)
call TriggerAddAction( t, function Phenix_Charge_Actions )
call TriggerRegisterUnitEvent( t,summon, EVENT_UNIT_DEATH)
endfunction
//===========================================================================
function InitTrig_Phenix_Charge takes nothing returns nothing
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Poison_Actions takes nothing returns nothing
local timer t = GetExpiredTimer()
local string m = I2S(H2I(t))
local integer i = GetStoredInteger(udg_Spell,m,"Timer")
local unit caster = GetUnit(m,"Caster")
local unit target = GetUnit(m,"Target")
local real dmg = (I2R(GetHeroInt(caster, true))/1000) * (GetUnitState(target, UNIT_STATE_MAX_LIFE))
if ( GetUnitAbilityLevel(target, 'Bcri') < 1) then
call FlushStoredMission(udg_Spell,m)
call DestroyTimer(t)
return
endif
call DmgToUnit( caster, target, dmg, true )
endfunction
function Poison takes nothing returns nothing
local unit caster = GetTriggerUnit()
local integer a = 1
local timer t = CreateTimer()
local string m = I2S(H2I(t))
call StoreInteger(udg_Spell,m,"Caster",H2I(caster))
call StoreInteger(udg_Spell,m,"Target",H2I(GetSpellTargetUnit()))
call TimerStart (t , 2.00,true ,function Poison_Actions )
endfunction
//===========================================================================
function InitTrig_Poison takes nothing returns nothing
endfunction
function Remission_Actions takes nothing returns nothing
local unit target = GetTriggerUnit()
local string m = I2S(H2I( target ))
local unit caster = GetUnit( m, "Caster")
local group cibles = GetUnitsInRangeOfLocMatching(300+GetHeroInt(caster,true), GetUnitLoc(target), Condition(function Cond_Groupe_Allie))
local integer nb_unit = CountUnit(cibles)
local integer a = 1
local unit u
local real vie = GetReal(m,"Vie")
if ( GetUnitAbilityLevel(target, 'B009') < 1 ) then
call FlushStoredMission(udg_Spell,m)
call DestroyTrigger(GetTriggeringTrigger() )
return
endif
loop
exitwhen a > nb_unit
set u = FirstOfGroup(cibles)
call GroupRemoveUnit( cibles, u)
call EffectUnit( "Abilities\\Spells\\Human\\Heal\\HealTarget.mdl", u, "origin", 1 )
call AddLife( u, vie )
call TxtFlo( I2S(R2I(vie)), u, 20, 90, 20 )
set a = a + 1
endloop
call DestroyGroup(cibles)
endfunction
function gcRemission takes nothing returns nothing
local trigger t
local unit target = GetSpellTargetUnit()
local unit caster = GetTriggerUnit()
local string m = I2S(H2I(target))
local real vie = GetSpellLvl() * 8
if ( GetUnitAbilityLevel(target, 'Bply') < 1 ) then
set t = CreateTrigger()
call StoreInteger( udg_Spell, m, "Caster", H2I(caster) )
call StoreReal( udg_Spell, m, "Vie", vie )
call TriggerAddAction( t, function Remission_Actions )
call TriggerRegisterUnitEvent( t, target , EVENT_UNIT_DAMAGED )
endif
endfunction
//===========================================================================
function InitTrig_Remission takes nothing returns nothing
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Represailles_Dmg takes integer lvl, unit h returns real //Les dommages du sort
return I2R( lvl * GetHeroAgi(h, true) + lvl*10 )
endfunction
function Represailles_Snd takes nothing returns sound //Le son lors de l'attaque
return gg_snd_FeralSpiritTarget1
endfunction
function Represailles_Actions takes nothing returns nothing
local timer t = GetExpiredTimer()
local string m = I2S(H2I(t))
local unit caster = GetUnit( m, "Caster")
local unit target = GetUnit( m, "Target")
local integer i = GetStoredInteger(udg_Spell,m,"Timer")
local real xi
local real yi
local real angle = GetStoredReal(udg_Spell,m,"Angle")
local real vit = GetStoredReal(udg_Spell,m,"Vitesse")
local integer lvl = GetStoredInteger(udg_Spell, m, "Level")
local effect e
call StoreInteger(udg_Spell,m,"Timer",i+1 )
if ( i <= 4) then
return
elseif (i==5) then
set xi = GetUnitX(target) + 100*Cos(angle)
set yi = GetUnitY(target) + 100*Sin(angle)
set e = AddSpecialEffect( "Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl", xi, yi)
call StoreInteger(udg_Spell,m,"Effect",H2I(e))
call SetUnitX(caster, xi)
call SetUnitY(caster, yi)
elseif ( i <= 11) then
return
elseif (i == 12 ) then
call PlaySoundOnUnitBJ( Represailles_Snd(), 100, target )
call SetUnitAnimationByIndex( caster, 5 )
call DmgToUnit( caster, target, Represailles_Dmg(lvl, caster), true) //
call Recul( GetUnitX(caster), GetUnitY(caster), target, 500, 0, 40)
elseif ( i <= 18) then
return
else
call SetUnitAnimationByIndex( caster, 0 )
call DestroyEffect( H2E(GetStoredInteger( udg_Spell, m, "Effect")) )
call SetUnitPathing(caster, true)
call SetUnitInvulnerable( caster, false)
call FlushStoredMission(udg_Spell,m)
call DestroyTimer(t)
endif
endfunction
function Represailles takes nothing returns nothing
local unit caster = GetTriggerUnit()
local real xc = GetUnitX(caster)
local real yc = GetUnitY(caster)
local unit target = GetSpellTargetUnit()
local integer a = 1
local real angle = Atan2(GetUnitY(target) - yc, GetUnitX(target) - xc )
local integer level = GetUnitAbilityLevel( GetTriggerUnit(), GetSpellAbilityId())
local timer t = CreateTimer()
local string m = I2S(H2I(t))
call SetUnitPathing(caster, false)
call SetUnitInvulnerable( caster, true)
call StoreInteger(udg_Spell,m,"Caster",H2I(caster))
call StoreInteger(udg_Spell,m,"Target",H2I(target))
call StoreReal(udg_Spell,m,"Angle",angle)
call StoreInteger(udg_Spell,m,"Timer", 1)
call StoreInteger( udg_Spell, m, "Level", level )
call AddSpecialEffect( "Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl", xc, yc)
call TimerStart (t , 0.02,true ,function Represailles_Actions )
endfunction
//===========================================================================
function InitTrig_Represailles takes nothing returns nothing
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Slash takes nothing returns nothing
local unit caster = GetTriggerUnit()
local player p = GetOwningPlayer(caster)
local real xc = GetUnitX(caster)
local real yc = GetUnitY(caster)
local group cibles = GetUnitsInRangeOfLocMatching(320, Location(xc, yc), Condition(function Cond_Groupe_Ennemi))
local integer a = 1
local integer nb_unit = CountUnit(cibles)
local unit u
local integer level = GetUnitAbilityLevel( caster, GetSpellAbilityId())
loop
exitwhen a > nb_unit
set u = FirstOfGroup(cibles)
call PlaySoundOnUnitBJ( gg_snd_HeavySlice, 80, u )
if( UnitInInterval( 75, GetUnitFacing(caster),GetUnitX(caster), GetUnitY(caster), u) == true) then
call Recul( GetUnitX(caster), GetUnitY(caster), u, 90, 0, 30)
call EffectUnit( "Objects\\Spawnmodels\\Human\\HumanBlood\\HumanBloodFootman.mdl", u, "origin", 2 )
call DmgToUnit( caster, u, GetHeroStr(caster, true)*level + 30*level, true )
endif
call GroupRemoveUnit( cibles, u)
set a = a + 1
endloop
call DestroyGroup(cibles)
endfunction
//===========================================================================
function InitTrig_Slash takes nothing returns nothing
endfunction
function Sphere_Distance takes nothing returns real
return 160.00
endfunction
function Sphere_Speed takes nothing returns integer
return 4
endfunction
function Sphere_Mouvement takes nothing returns nothing
local timer t = GetExpiredTimer()
local string m = I2S(H2I(t))
local integer i = GetStoredInteger(udg_Spell,m,"Timer")
local unit u = GetUnit(m,"Caster")
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local integer a = 1
local unit s
call StoreInteger(udg_Spell,m,"Timer",i+Sphere_Speed() )
if (i < 721) then
loop
exitwhen a > 6
set s = GetUnit(m,"Sphere"+I2S(a))
call SetUnitPosition(s, x + Sphere_Distance()*Cos(Deg2Rad(i+a*60)), y + Sphere_Distance()*Sin(Deg2Rad(i+a*60)) )
set a = a + 1
endloop
elseif (i < 721+(Sphere_Distance()/Sphere_Speed()) ) then
loop
exitwhen a > 6
set s = GetUnit(m,"Sphere"+I2S(a))
call SetUnitPosition(s, x + (Sphere_Distance()-(i-720)*Sphere_Speed())*Cos(Deg2Rad(a*60)), y + (Sphere_Distance()-(i-720)*Sphere_Speed())*Sin(Deg2Rad(a*60)) )
set a = a + 1
endloop
else
call AddSpecialEffect( "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl", x, y)
call SetUnitInvulnerable(u,true)
call UnitDamagePointLoc( u, 0.00, 250, Location(x,y), 100.00, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
call SetUnitInvulnerable(u,false)
loop
exitwhen a > 6
set s = GetUnit(m,"Sphere"+I2S(a))
call RemoveUnit(s)
set a = a + 1
endloop
call DestroyTimer(t)
call FlushStoredMission(udg_Spell,m)
endif
endfunction
function Sphere takes nothing returns nothing
local unit Caster = GetTriggerUnit()
local real xc = GetUnitX(Caster)
local real yc = GetUnitY(Caster)
local unit u
local integer a = 1
local timer t = CreateTimer()
local string m = I2S(H2I(t))
call StoreInteger(udg_Spell,m,"Caster",H2I(Caster))
call StoreInteger(udg_Spell,m,"Timer", 0)
loop
exitwhen a > 6
set u = CreateUnit(GetOwningPlayer(Caster),'hsor', xc + Sphere_Distance()*Cos(Deg2Rad(a*60)), yc + Sphere_Distance()*Sin(Deg2Rad(a*60)), 270.00)
call StoreInteger(udg_Spell,m,"Sphere"+I2S(a),H2I(u))
set a = a + 1
endloop
call TimerStart (t , 0.02,true ,function Sphere_Mouvement )
endfunction
//===========================================================================
function InitTrig_Sphere takes nothing returns nothing
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Static_field takes nothing returns nothing
local unit caster = GetTriggerUnit()
local player p = GetOwningPlayer(caster)
local real xc = GetUnitX(caster)
local real yc = GetUnitY(caster)
local integer level = GetUnitAbilityLevel( GetTriggerUnit(), GetSpellAbilityId())
local group g = GetUnitsInRangeOfLocMatching(200+level*GetHeroInt(caster, true), Location(xc, yc), Condition(function Cond_Groupe_Ennemi))
local integer a = 1
local unit u
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit(g,u)
call DestroyEffect( AddSpecialEffectTarget("Abilities\\Weapons\\Bolt\\BoltImpact.mdl", u, "origin") )
call DmgToUnit( caster, u, GetUnitState(u, UNIT_STATE_LIFE)*0.25, true )
endloop
call DestroyGroup(g)
set g = null
set u = null
endfunction
//===========================================================================
function InitTrig_Static_Field takes nothing returns nothing
endfunction
//TESH.scrollpos=24
//TESH.alwaysfold=0
function CreateObjectWithCharges takes unit u, integer t, integer nb_charge returns nothing
local item objet = CreateItem(t, GetUnitX(u), GetUnitY(u))
call SetItemCharges( objet, nb_charge)
if( UnitAddItem( u, objet) == false) then
call RemoveItem(objet)
call DisplayTextToPlayer(GetOwningPlayer(u),0,0, "Inventaire plein")
endif
endfunction
function InventairePlein takes unit u returns boolean
local item objet = CreateItem('ckng', GetUnitX(u), GetUnitY(u))
local boolean b = UnitAddItem( u, objet)
call RemoveItem(objet)
return b == false
endfunction
function Suce_Ame takes nothing returns nothing
local unit caster = GetTriggerUnit()
local group cibles = GetUnitsInRangeOfLocMatching(200, GetSpellTargetLoc(), Condition(function Cond_Groupe_Dead))
local integer nb_unit = CountUnit(cibles)
local integer lvl = GetUnitAbilityLevel( caster, GetSpellAbilityId())
local integer nb_charge = 0
local integer obj_charge = 0
local integer limit_charge = 5 // <-- NOMBRE MAX DE CHARGES
local integer type_objet = 'ckng' // <-- ID DE L OBJET
local integer max_unit = lvl + 1 // <-- EQUATION PR LE NBRE MAX D UNITE
local item objet
local integer a = 0
local unit u
loop
exitwhen a > nb_unit or a > max_unit
set u = FirstOfGroup(cibles)
call GroupRemoveUnit(cibles, u)
set nb_charge = GetUnitLevel(u) + nb_charge
set a = a +1
endloop
set a = 0
call DisplayTextToPlayer(Player(0),0,0,"Charges: "+I2S(nb_charge))
loop
exitwhen nb_charge == 0
//set objet = GetObjetValide( caster, limit_charge, 'ckng')
if( objet != null) then
set obj_charge = GetItemCharges(objet)
if( limit_charge - obj_charge >= nb_charge) then
call SetItemCharges( objet, obj_charge + nb_charge)
set nb_charge = 0
else
set nb_charge = nb_charge - (limit_charge - obj_charge)
call SetItemCharges( objet, limit_charge)
endif
elseif ( InventairePlein(caster) == false) then
call CreateObjectWithCharges( caster, type_objet, 0 )
else
set nb_charge = 0
call DisplayTextToPlayer(GetOwningPlayer(caster),0,0, "Inventaire plein")
endif
endloop
endfunction
//===========================================================================
function InitTrig_Suce_Ame takes nothing returns nothing
endfunction
//TESH.scrollpos=45
//TESH.alwaysfold=0
library SpellTelekinesieMassive needs libSpellEffect
struct TMassiveAme extends Spell
real dist = 220.0
real angle
unit dummy
integer i = 0
real sens = 1.0
method cycle takes nothing returns boolean
local real x = GetUnitX(this.caster) + this.dist * Cos( this.angle )
local real y = GetUnitY(this.caster) + this.dist * Sin( this.angle )
set this.angle = this.angle + .sens * Deg2Rad(6.0)
set .i = .i + 1
if( .i == 200 ) then
call KillUnit( this.dummy )
call TMassiveAme.destroy(this)
return false
else
call SetUnitX( this.dummy, x )
call SetUnitY( this.dummy, y )
call SetUnitFacing( this.dummy, Rad2Deg(this.angle) + 90 )
endif
return true
endmethod
endstruct
struct TMassive extends Spell
integer i = 0
method cycle takes nothing returns boolean
local TMassiveAme tma
local real x
local real y
local integer a = 0
loop
exitwhen a > 1
set tma = TMassiveAme.create()
set tma.caster = this.caster
set tma.angle = a * 180
set x = GetUnitX( this.caster ) + tma.dist * Cos( tma.angle )
set y = GetUnitY( this.caster ) + tma.dist * Sin( tma.angle )
set tma.dummy = CreateUnit( GetOwningPlayer(this.caster), 'h00O', x, y, Rad2Deg(tma.angle) + 90 )
call UnitAddAbility( tma.dummy, 'Arav' )
call SetUnitFlyHeight( tma.dummy, 1200, 200 )
//call libSpellEffect_LoopSpellMini_add(tma)
set a = a + 1
endloop
set tma.sens = -1.0
set .i = .i + 1
if( .i == 50 ) then
call TMassive.destroy(this)
return false
endif
return true
endmethod
endstruct
function TelekinesieMassive takes nothing returns nothing
local TMassive tm = TMassive.create()
set tm.caster = GetTriggerUnit()
debug call BJDebugMsg("Desactivé")
//call libSpellEffect_LoopSpellMiddle_add(tm)
endfunction
//===========================================================================
function InitTrig_Telekinesie_Massive takes nothing returns nothing
endfunction
endlibrary
//TESH.scrollpos=47
//TESH.alwaysfold=0
function Unstable_sphere_Actions takes nothing returns nothing
local timer t = GetExpiredTimer()
local string m = I2S(H2I(t))
local unit caster = GetUnit( m, "Caster")
local integer i = GetStoredInteger(udg_Spell,m,"Timer")
local real xu
local real yu
local unit sphere = GetUnit(m, "Sphere")
local real xs = GetUnitX(sphere)
local real ys = GetUnitY(sphere)
local real xe
local real ye
local real angle = GetStoredReal(udg_Spell,m,"Angle")
local lightning eclair
local integer a = 1
local integer b = 1
call StoreInteger(udg_Spell,m,"Timer",i+1 )
if ( i < 70) then
call SetUnitX(sphere, xs + 10*Cos(angle))
call SetUnitY(sphere, ys + 10*Sin(angle))
if( ModuloInteger(i,3)==0) then
call Effect( "Abilities\\Weapons\\VengeanceMissile\\VengeanceMissile.mdl", xs, ys, 0.01)
endif
loop
exitwhen a > 2
set xe = xs + (200*Sin(Deg2Rad(i*8))) * Cos(angle+b*(bj_PI/2))
set ye = ys + (200*Sin(Deg2Rad(i*8))) * Sin(angle+b*(bj_PI/2))
set eclair = H2L(GetStoredInteger(udg_Spell,m, "Eclair"+I2S(a)))
call MoveLightning( eclair, true, xs, ys, xe, ye)
call DmgToArea( Location(xe, ye), caster, 5, 120, false)
if( ModuloInteger(i,3)==0) then
call Effect( "Abilities\\Weapons\\VengeanceMissile\\VengeanceMissile.mdl", xe, ye, 0.01)
endif
set a = a + 1
set b = -b
endloop
call DmgToArea( Location(xs, ys), caster, 5, 160, false)
else
call RemoveUnit(sphere)
call DestroyLightning(H2L(GetStoredInteger(udg_Spell,m, "Eclair")))
call DestroyLightning(H2L(GetStoredInteger(udg_Spell,m, "Eclair1")))
call DestroyLightning(H2L(GetStoredInteger(udg_Spell,m, "Eclair2")))
call DestroyTimer(t)
call FlushStoredMission(udg_Spell,m)
endif
endfunction
function Unstable_sphere takes nothing returns nothing
local unit caster = GetTriggerUnit()
local real xc = GetUnitX( GetTriggerUnit())
local real yc = GetUnitY( GetTriggerUnit())
local real angle = Atan2(GetLocationY(GetSpellTargetLoc()) - yc, GetLocationX(GetSpellTargetLoc()) - xc )
local integer a = 1
local timer t = CreateTimer()
local string m = I2S(H2I(t))
call StoreInteger(udg_Spell,m,"Sphere",H2I(CreateUnit(GetOwningPlayer(caster),'h006', xc, yc, 270.00)))
call StoreReal(udg_Spell,m,"Angle", angle )
call StoreInteger(udg_Spell,m,"Timer", 1)
call StoreInteger(udg_Spell,m,"Caster", H2I(caster))
loop
exitwhen a == 3
call StoreInteger(udg_Spell,m,"Eclair"+I2S(a),H2I(AddLightning("AFOD", true, xc,yc,xc,yc)))
set a = a + 1
endloop
call TimerStart(t ,0.02 ,true ,function Unstable_sphere_Actions)
endfunction
//===========================================================================
function InitTrig_Unstable_Sphere takes nothing returns nothing
endfunction
function Cond_Groupe_Vortex takes nothing returns boolean
local timer t = GetExpiredTimer()
local string m = I2S(H2I(t))
local unit caster = GetUnit(m,"Caster")
return ( (IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(caster) ) == true) and (GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) > 0) and not GetStoredBoolean( udg_Spell, I2S(H2I(GetFilterUnit())),"Bash"))
endfunction
function Vortex_Actions takes nothing returns nothing
local timer t = GetExpiredTimer()
local string m = I2S(H2I(t))
local unit caster = GetUnit(m,"Caster")
local integer i = GetStoredInteger(udg_Spell,m,"Timer")
local real xt = GetStoredReal(udg_Spell,m,"xt")
local real yt = GetStoredReal(udg_Spell,m,"yt")
local unit u
local integer a = 1
local real angle
local group cibles = GetUnitsInRangeOfLocMatching(400, Location(xt,yt), Condition(function Cond_Groupe_Vortex))
local integer nb_unit = CountUnit(cibles)
call GroupRemoveGroup( GetUnitsInRangeOfLocAll(50, Location(xt,yt)), cibles)
call StoreInteger(udg_Spell,m,"Timer",i+1 )
if ( i<=40) then
loop
exitwhen a > nb_unit
set u = FirstOfGroup(cibles)
set angle = Atan2(yt - GetUnitY(u), xt - GetUnitX(u))
call Attraction( xt, yt, u, 120, 7)
call GroupRemoveUnit( cibles, u)
set a = a + 1
endloop
set cibles = GetUnitsInRangeOfLocAll(70, Location(xt,yt))
set nb_unit = CountUnit(cibles)
set a = 1
loop
exitwhen a > nb_unit
set u = FirstOfGroup(cibles)
call Recul( xt, yt, u, GetRandomInt(220,380), 180, 12)
call SEffect_Bash( u, 2)
call DmgToUnit( caster, u, 76, true)
call GroupRemoveUnit( cibles, u)
set a = a + 1
endloop
else
call RemoveUnit(GetUnit(m,"Vortex"))
call DestroyEffect( H2E(GetStoredInteger(udg_Spell, m, "Effect")) )
call DestroyTimer(t)
call FlushStoredMission(udg_Spell,m)
endif
endfunction
function Vortex takes nothing returns nothing
local unit caster = GetTriggerUnit()
local player p = GetOwningPlayer(caster)
local real xt = GetLocationX(GetSpellTargetLoc())
local real yt = GetLocationY(GetSpellTargetLoc())
local unit u
local real angle = Atan2(yt - GetUnitY(caster), xt - GetUnitX(caster))
local effect e
local timer t = CreateTimer()
local string m = I2S(H2I(t))
local integer a = 1
set u = CreateUnit( p, 'o000', xt+200*Cos(angle+Deg2Rad(180)),yt+200*Sin(angle+Deg2Rad(180)), Rad2Deg(angle))
set e = AddSpecialEffect( "Abilities\\Spells\\Human\\FlameStrike\\FlameStrikeTarget.mdl", xt, yt)
call StoreInteger(udg_Spell,m,"Effect",H2I(e))
call StoreInteger(udg_Spell,m,"Vortex",H2I(u))
call StoreInteger(udg_Spell,m,"Caster",H2I(caster))
call StoreInteger(udg_Spell,m,"Timer", 1)
call StoreReal(udg_Spell,m,"xt", xt)
call StoreReal(udg_Spell,m,"yt", yt)
call TimerStart (t , 0.5,true ,function Vortex_Actions )
endfunction
//===========================================================================
function InitTrig_Vortex takes nothing returns nothing
endfunction
//TESH.scrollpos=17
//TESH.alwaysfold=0
function dgUnstableSphere takes nothing returns nothing
endfunction
function dcUnstableField takes nothing returns nothing
endfunction
// _______________
//-----------------------Piège de Foudre------------------//
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
function daStormTrap takes nothing returns nothing
local player p = GetOwningPlayer(GetTriggerUnit())
local unit dummy
set dummy = CreateUnitAtLoc( p, 'e003', GetSpellTargetLoc(),0 )
call SetUnitAnimation( dummy, "death" )
call UnitApplyTimedLife( dummy, 'BTLF', 20.00 )
set dummy = CreateUnitAtLoc( p, 'h00E', GetSpellTargetLoc(), 0 )
call UnitApplyTimedLife( dummy, 'BTLF', 20.00 )
call IssueImmediateOrder( dummy, "immolation" )
endfunction
// ___________
//-----------------------ThunderWave------------------//
// ¯¯¯¯¯¯¯¯¯¯¯
function deThunderWave takes nothing returns nothing
local player p = GetOwningPlayer(GetTriggerUnit())
local unit dummy
local real x = GetUnitX(GetTriggerUnit())
local real y = GetUnitY(GetTriggerUnit())
local real angle = Atan2(GetLocationY(GetSpellTargetLoc()) - y, GetLocationX(GetSpellTargetLoc()) - x )
set dummy = CreateUnit( p, 'h00D', x, y, angle + (30 * bj_PI) / 180 )
call UnitApplyTimedLife( dummy, 'BTLF', 1.50 )
call IssuePointOrder( dummy, "impale", 50 * Cos(angle + (30 * bj_PI) / 180)+x, 50 * Sin(angle + (30 * bj_PI) / 180)+y )
set dummy = CreateUnit( p, 'h00D', x, y, angle )
call UnitApplyTimedLife( dummy, 'BTLF', 1.50 )
call IssuePointOrder( dummy, "impale", 50 * Cos(angle)+x, 50 * Sin(angle)+y )
set dummy = CreateUnit( p, 'h00D', x, y, angle - (30 * bj_PI) / 180 )
call UnitApplyTimedLife( dummy, 'BTLF', 1.50 )
call IssuePointOrder( dummy, "impale", 50 * Cos(angle - (30 * bj_PI) / 180)+x, 50 * Sin(angle - (30 * bj_PI) / 180)+y )
endfunction
// ______
//-----------------------Vortex------------------//
// ¯¯¯¯¯¯
function dbVortex takes nothing returns nothing
local player p = GetOwningPlayer(GetTriggerUnit())
local unit dummy
local real x = GetUnitX(GetTriggerUnit())
local real y = GetUnitY(GetTriggerUnit())
local integer a = 1
loop
exitwhen a > 8 + I2R(udg_Niveaux_sorts_entier[( 290 + GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit())) )])
call AddSpecialEffectTarget( "Abilities\\Spells\\Human\\ControlMagic\\ControlMagicTarget.mdl", GetTriggerUnit(), "overhead" )
set dummy = CreateUnit( p, 'o00D', GetRandomReal(ModuloReal( (a - 1) * 140, 240), ModuloReal( a * 140, 240)) * Cos(GetRandomReal(0 , 2 * bj_PI))+x, GetRandomReal(ModuloReal( (a - 1) * 140, 240), ModuloReal( a * 140, 240)) * Sin(GetRandomReal(0 , 2 * bj_PI))+y, 0 )
call IssueImmediateOrder( dummy, "stomp" )
call UnitApplyTimedLife( dummy, 'BTLF', 0.3 )
call AddSpecialEffect( "Units\\NightElf\\Wisp\\WispExplode.mdl", GetUnitX(dummy), GetUnitY(dummy) )
call AddSpecialEffect( "Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl", GetUnitX(dummy), GetUnitY(dummy) )
call TriggerSleepAction( 0.20 )
set a = a + 1
endloop
endfunction
// ____________________
//-----------------------Projection de Foudre------------------//
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
function ddStormProjection takes nothing returns nothing
local player p = GetOwningPlayer(GetTriggerUnit())
local unit dummy = CreateUnitAtLoc( p, 'h00B', GetSpellTargetLoc(), 0 )
call IssueImmediateOrder( dummy, "immolation" )
call UnitApplyTimedLife( dummy, 'BTLF', 10.00 + I2R(udg_Niveaux_sorts_entier[( 290 + GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit())) )]) * 2 )
endfunction
// _______________
//-----------------------Sphere d'éclair------------------//
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
function dgUnstableSpher takes nothing returns nothing
local player p = GetOwningPlayer(GetTriggerUnit())
local integer a = 1
local unit array dummy
local lightning array light
local real x = GetUnitX(GetTriggerUnit())
local real y = GetUnitY(GetTriggerUnit())
loop
exitwhen a > 6
call AddSpecialEffect( "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl", 520*Cos((a*60)*bj_PI/180)+x, 520*Sin((a*60)*bj_PI/180)+y )
set a = a + 1
endloop
call TriggerSleepAction( 0.20 )
set a = 1
loop
exitwhen a > 6
set dummy[a] = CreateUnit( p, 'n00A', 520*Cos((a*60)*bj_PI/180)+x, 520*Sin((a*60)*bj_PI/180)+y, 0)
set a = a + 1
endloop
call TriggerSleepAction( 0.20 )
set light[a] = AddLightningEx( "FORK", true, GetUnitX(dummy[a]), GetUnitY(dummy[a]), GetLocationZ(Location(GetUnitX(dummy[a])+50,GetUnitY(dummy[a]))), GetUnitX(dummy[a+1]), GetUnitY(dummy[a+1]), GetLocationZ(Location(GetUnitX(dummy[a+1]),GetUnitY(dummy[a+1])))+50 )
call TriggerSleepAction( 0.20 )
set dummy[7] = CreateUnit( p, 'n009', x, y, 0 )
call TriggerSleepAction( 10.00 )
call RemoveUnit( dummy[7] )
set a = 1
loop
exitwhen a > 6
call RemoveUnit( dummy[a] )
call DestroyLightning( light[a] )
set a = a + 1
endloop
endfunction
//===========================================================================
function InitTrig_Sort_de_Foudre takes nothing returns nothing
endfunction
//TESH.scrollpos=63
//TESH.alwaysfold=0
function caMeteor takes nothing returns nothing
endfunction
function ccForetenchante takes nothing returns nothing
endfunction
function ceMetamorphosis takes nothing returns nothing
endfunction
// ____________
//-----------------------Jet d'épines------------------//
// ¯¯¯¯¯¯¯¯¯¯¯¯
function cbThornThrow takes nothing returns nothing
local integer a = 1
local player p = GetOwningPlayer(GetTriggerUnit())
local unit dummy
local real x = GetUnitX(GetTriggerUnit())
local real y = GetUnitY(GetTriggerUnit())
loop
exitwhen a > 18
set dummy = CreateUnit( p, 'h008', x, y, 0 )
call IssueImmediateOrder( dummy, "immolation" )
call UnitApplyTimedLife( dummy, 'BTLF', 1.00 )
call IssuePointOrder( dummy, "move", x + 460 * Cos( ((a * 20) * bj_PI) / 180 ), y + 460 * Sin( ((a*20) * bj_PI) /180) )
set a = a + 1
endloop
endfunction
// ___________
//-----------------------Raise earth------------------//
// ¯¯¯¯¯¯¯¯¯¯¯
function cdRaiseEarth takes nothing returns nothing
local player p = GetOwningPlayer(GetTriggerUnit())
local unit dummy = CreateUnitAtLoc( p, 'h00H', GetSpellTargetLoc(), 0 )
call IssueImmediateOrder( dummy, "immolation" )
call IssuePointOrderLocBJ( dummy, "earthquake", GetUnitLoc(dummy) )
call UnitApplyTimedLife( dummy, 'BTLF', 12.00 )
endfunction
// ___________
//-----------------------Earth Quake------------------//
// ¯¯¯¯¯¯¯¯¯¯¯
function cgEarthQuake takes nothing returns nothing
local integer a = 1
local player p = GetOwningPlayer(GetTriggerUnit())
local unit dummy
local real x = GetUnitX(GetTriggerUnit())
local real y = GetUnitY(GetTriggerUnit())
loop
exitwhen a > 4
set dummy = CreateUnit( p, 'h00F', x + GetRandomReal( (a-1) * 180, a * 180) * Cos(GetRandomReal(0, 6.30)), y + GetRandomReal( (a-1) * 180, a * 180) * Sin(GetRandomReal(0, 6.30)), 0 )
call IssueImmediateOrder( dummy, "immolation" )
call UnitApplyTimedLife( dummy, 'BTLF', 20.00 )
call IssuePointOrderLoc( dummy, "earthquake", GetUnitLoc(dummy) )
call TriggerSleepAction( 1.00 )
set a = a + 1
endloop
endfunction
// __________
//-----------------------Apocalypse------------------//
// ¯¯¯¯¯¯¯¯¯¯
function chApocalypse takes nothing returns nothing
local integer a = 1
local player p = GetOwningPlayer(GetTriggerUnit())
local unit dummy
local real x = GetLocationX(GetSpellTargetLoc())
local real y = GetLocationY(GetSpellTargetLoc())
loop
exitwhen a > 14
set dummy = CreateUnit( p, 'h00G', x + GetRandomReal(60,280) * Cos(GetRandomReal( ModuloReal( (a-1) * 120,360), ModuloReal( a*120,360))), y + GetRandomReal(60,280) * Sin(GetRandomReal( ModuloReal( (a-1) * 120,360), ModuloReal( a*120,360))), 0 )
call UnitApplyTimedLife( dummy, 'BTLF', 1.00 )
call IssuePointOrderLoc( dummy, "dreadlordinferno", GetUnitLoc(dummy) )
call TriggerSleepAction( ( 0.80 - ( I2R(a) / 20.00 ) ) )
set a = a + 1
endloop
endfunction
//===========================================================================
function InitTrig_Sort_Terrestre takes nothing returns nothing
endfunction
//TESH.scrollpos=94
//TESH.alwaysfold=0
function fbParalysis takes nothing returns nothing
endfunction
function fcSwiftness takes nothing returns nothing
endfunction
function fhAxonatos takes nothing returns nothing
endfunction
// ____________
//-----------------------Tir Multiple------------------//
// ¯¯¯¯¯¯¯¯¯¯¯¯
function fdMultishot takes nothing returns nothing
local player p = GetOwningPlayer(GetTriggerUnit())
local unit dummy
local integer a = 1
local real x = GetUnitX(GetTriggerUnit())
local real y = GetUnitY(GetTriggerUnit())
loop
exitwhen a > 3
set dummy = CreateUnit( p, 'o00C', x, y, 0 )
call SetUnitAnimation( GetTriggerUnit(), "attack" )
call IssueImmediateOrder( dummy, "fanofknives" )
call UnitApplyTimedLife( dummy, 'BTLF', 1 )
call TriggerSleepAction( 0.80 )
set a = a + 1
endloop
endfunction
// ____________
//-----------------------Bombardement------------------//
// ¯¯¯¯¯¯¯¯¯¯¯¯
function faBombardement takes nothing returns nothing
local player p = GetOwningPlayer(GetTriggerUnit())
local unit dummy
local integer a = 1
local real x = GetLocationX(GetSpellTargetLoc())
local real y = GetLocationY(GetSpellTargetLoc())
local effect array speffect
loop
exitwhen a > 10
set speffect[a] = AddSpecialEffect( "Abilities\\Spells\\Undead\\FreezingBreath\\FreezingBreathTargetArt.mdl", GetRandomReal(40,260)*Cos(GetRandomReal(0,bj_PI))+x, GetRandomReal(40,260)*Sin(GetRandomReal(0,bj_PI))+y )
call TriggerSleepAction( 0.00 )
set a = a + 1
endloop
call TriggerSleepAction( 5.00 )
set a = 1
loop
exitwhen a > 10
call DestroyEffect( speffect[a] )
call TriggerSleepAction( 0.00 )
set a = a + 1
endloop
endfunction
// ______________
//-----------------------Attaque éclair------------------//
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
function fgAttaqueeclair takes nothing returns nothing
local player p = GetOwningPlayer(GetTriggerUnit())
local unit dummy
local integer a = 1
local real x1 = GetLocationX(GetSpellTargetLoc())
local real y1 = GetLocationY(GetSpellTargetLoc())
local real x2 = GetUnitX(GetTriggerUnit())
local real y2 = GetUnitY(GetTriggerUnit())
loop
exitwhen a > 5
call AddSpecialEffectTarget( "Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl", GetTriggerUnit(), "origin" )
call SetUnitPosition( GetTriggerUnit(), GetRandomReal(250,600)*Cos(GetRandomReal(0,2*bj_PI))+x1, GetRandomReal(250,600)*Sin(GetRandomReal(0,2*bj_PI))+y1 )
set dummy = CreateUnitAtLoc( p, 'o00A', GetUnitLoc(GetTriggerUnit()), 0 )
call SetUnitAnimation( GetTriggerUnit(), "attack" )
call IssuePointOrder( dummy, "healingspray", x1, y1 )
call UnitApplyTimedLife( dummy, 'BTLF', 1.20 )
call TriggerSleepAction( 1.00 )
set a = a + 1
endloop
call AddSpecialEffectTarget( "Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl", GetTriggerUnit(), "origin" )
call SetUnitPosition( GetTriggerUnit(), x2, y2 )
endfunction
// ________
//-----------------------Esquiver------------------//
// ¯¯¯¯¯¯¯¯
function Esquiver takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit v = GetAttacker()
local real x
local real y
local real a
if(GetUnitAbilityLevel(u, 'Bbsk') < 1)then
call DestroyTrigger(GetTriggeringTrigger())
endif
call TriggerSleepAction( 0.20 )
set x = GetUnitX(u)
set y = GetUnitY(u)
set a = Atan2(y-GetUnitY(v), x-GetUnitX(v) )
call AddSpecialEffectTarget("Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl",u,"origin")
call SetUnitPosition (u , 140*Cos(a)+x,140*Sin(a)+y)
endfunction
function feEscape takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerAddAction( t, function Esquiver )
call TriggerRegisterUnitEvent( t, GetSpellAbilityUnit() , EVENT_UNIT_ATTACKED )
endfunction
//===========================================================================
function InitTrig_Sort_d_agilite takes nothing returns nothing
endfunction
//TESH.scrollpos=50
//TESH.alwaysfold=0
function aaBerzerker takes nothing returns nothing
endfunction
function abPiegedinferno takes nothing returns nothing
endfunction
//-----------------------Mur de Flammes------------------//
// **************
function aeMurdeflammes takes nothing returns nothing
local real x = GetLocationX(GetSpellTargetLoc())
local real y = GetLocationY(GetSpellTargetLoc())
local real angle = ( GetUnitFacing(GetTriggerUnit()) - 90.00 )
local integer a = 1
local player p = GetOwningPlayer(GetTriggerUnit())
local unit dummy
call TriggerSleepAction( 0.20 )
loop
exitwhen a > 3
set dummy = CreateUnit( p, 'h00A', (-42+a*84)*CosBJ(angle)+x, (-42+a*84)*SinBJ(angle)+y, 0 )
call IssueImmediateOrder( dummy, "immolation" )
call UnitApplyTimedLife( dummy, 'BTLF', ( 8.00 + I2R(udg_Niveaux_sorts_entier[( 50 + GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit())) )]) ) )
set dummy = CreateUnit( p, 'h00A', (42+a*-84)*CosBJ(angle)+x, (42+a*-84)*SinBJ(angle)+y, 0 )
call IssueImmediateOrder( dummy, "immolation" )
call UnitApplyTimedLife( dummy, 'BTLF', ( 8.00 + I2R(udg_Niveaux_sorts_entier[( 50 + GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit())) )]) ) )
call TriggerSleepAction( 0.20 )
set a = a + 1
endloop
endfunction
// __________
//-----------------------Chaos Rain------------------//
// ¯¯¯¯¯¯¯¯¯¯
function agChaosRain takes nothing returns nothing
local player p = GetOwningPlayer(GetTriggerUnit())
local integer a = 1
local real x = GetUnitX(GetTriggerUnit())
local real y = GetUnitY(GetTriggerUnit())
local unit dummy
loop
exitwhen a > 36
set dummy = CreateUnit( p, 'o008', (580-(a*12))*CosBJ((a*(10+(0.65*a))))+x, (580-(a*12))*SinBJ((a*(10+(0.65*a))))+y, 0 )
call IssuePointOrderLoc( dummy, "dreadlordinferno", GetUnitLoc(dummy) )
call UnitApplyTimedLifeBJ( 2.00 , 'BTLF', dummy )
call TriggerSleepAction( 0.00 )
set a = a + 1
endloop
endfunction
//-----------------------HellFire------------------//
// ********
function ahHellFire takes nothing returns nothing
local player p = GetOwningPlayer(GetTriggerUnit())
local integer a = 1
local unit zepo = GetSpellAbilityUnit()
local real x = GetUnitX(zepo)
local real y = GetUnitY(zepo)
local unit array dummy
loop
exitwhen a > 2
set dummy[a] = CreateUnit( p, 'o007', (GetRandomReal(80,520))*CosBJ(GetRandomReal((a-1)*180, a*180))+x , GetRandomReal(80,520)*SinBJ(GetRandomInt((a-1)*180,a*180))+y, 0)
call IssueImmediateOrderBJ( dummy[a], "immolation" )
call UnitApplyTimedLife( dummy[a] , 'BTLF', 20 )
set a = a + 1
endloop
set a = 1
loop
exitwhen a > 4
call AddSpecialEffectLoc("Abilities\\Spells\\Other\\Doom\\DoomDeath.mdl" , GetUnitLoc(dummy[1]))
call TriggerSleepAction( 2.10 )
call AddSpecialEffectLoc("Abilities\\Spells\\Other\\Doom\\DoomDeath.mdl" , GetUnitLoc(dummy[2]))
call TriggerSleepAction( 3.40 )
set a = a + 1
endloop
call RemoveUnit(dummy[1])
call RemoveUnit(dummy[2])
endfunction
// ______________
//-----------------------Rage du phénix------------------//
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
function adRageduphenix takes nothing returns nothing
local player p = GetOwningPlayer(GetTriggerUnit())
local integer a = 1
local real x = GetUnitX(GetTriggerUnit())
local real y = GetUnitY(GetTriggerUnit())
local location loc
local unit zepo = GetSpellTargetUnit()
local unit array dummy
loop
exitwhen a > 12
set loc = Location(GetRandomReal(80 , 320)*Cos(GetRandomReal(0, 2 * bj_PI))+x, GetRandomReal(80 , 320)*Sin(GetRandomReal(0, 2 * bj_PI))+y )
call AddSpecialEffectLoc( "Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl" , loc )
call TriggerSleepAction( 0.1 )
set dummy[a] = CreateUnit( p, 'h003', GetLocationX(loc) , GetLocationY(loc) , GetRandomReal(0, 2 * bj_PI) )
call SetUnitFacing( dummy[a], (Atan2( GetUnitY(zepo) - y, GetUnitX(zepo) - x) * 180) / bj_PI )
set a = a + 1
endloop
call TriggerSleepAction( 0.80 )
set a = 1
loop
exitwhen a > 12
call UnitRemoveAbility( dummy[a],'Aphx')
call IssueTargetOrderBJ( dummy[a], "unstableconcoction", zepo )
call TriggerSleepAction( 0.00 )
set a = a + 1
endloop
call TriggerSleepAction( 0.20 )
set a = 1
loop
exitwhen a> 12
call RemoveUnit( dummy[a] )
set a = a + 1
endloop
call UnitRemoveBuffBJ( 'BEer', GetTriggerUnit() )
endfunction
//===========================================================================
function InitTrig_Sort_de_feu takes nothing returns nothing
endfunction
//TESH.scrollpos=190
//TESH.alwaysfold=0
function bbFreeze takes nothing returns nothing
endfunction
//-----------------------Ice Shard------------------//
// *********
function bcIceShards takes nothing returns nothing
local player p = GetOwningPlayer(GetTriggerUnit())
local unit dummy
local integer a = 1
local real x = GetLocationX(GetSpellTargetLoc())
local real y = GetLocationY(GetSpellTargetLoc())
loop
exitwhen a > 6 + I2R(udg_Niveaux_sorts_entier[( 110 + GetConvertedPlayerId(p) )])
set dummy = CreateUnit(p,'o00D', GetRandomReal(0,160)*Cos(GetRandomReal(0, 2*bj_PI))+x, GetRandomReal(0,160)*Sin(GetRandomReal(0, 2*bj_PI))+y, 0 )
call IssuePointOrder( dummy, "dreadlordinferno", GetUnitX(dummy), GetUnitY(dummy) )
call UnitApplyTimedLife( dummy, 'BTLF', 1.00 )
call TriggerSleepAction( GetRandomReal( 0.1, 0.4))
set a = a + 1
endloop
endfunction
//-----------------------Boule de Gel------------------//
// ************
// Projette des boule de glaces dans toutes les directions
function bfBouledeglace takes nothing returns nothing
local player p = GetOwningPlayer(GetTriggerUnit())
local integer a = 1
local unit dummy
loop
exitwhen a > 50 + (10 * I2R(udg_Niveaux_sorts_entier[( 110 + GetConvertedPlayerId(p) )]) )
set dummy = CreateUnit( p, 'h004', GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()), a * 36 )
call IssueImmediateOrder( dummy, "immolation" )
call UnitApplyTimedLife( dummy , 'BTLF', 2.00 )
call IssuePointOrder( dummy, "move", 1100 * Cos(((a * 36)*bj_PI)/180)+GetUnitX(GetTriggerUnit()) , 1100 * Sin(((a * 36)*bj_PI)/180)+GetUnitY(GetTriggerUnit()))
call TriggerSleepAction( 0.00 )
set a = a + 1
endloop
endfunction
//-----------------------Vague de Glace------------------//
// **************
// Crée une ligne de nova dans la direction ciblé
function beVaguedeglace takes nothing returns nothing
local player p = GetOwningPlayer(GetTriggerUnit())
local integer a = 1
local unit array dummy
local real x = GetUnitX(GetTriggerUnit())
local real y = GetUnitY(GetTriggerUnit())
local real face = Atan2(GetLocationY(GetSpellTargetLoc()) - y, GetLocationX(GetSpellTargetLoc()) - x )
call TriggerSleepAction( 0.20 )
loop
exitwhen a > 4
set dummy[a] = CreateUnit( p, 'o00K', (160*a) * Cos(face) + x, (160*a) * Sin(face) + y, 0 )
set a = a + 1
endloop
set a = 1
loop
exitwhen a > 4
call IssueTargetOrder( dummy[a] , "frostnova", dummy[a] )
call TriggerSleepAction( 0.00 )
set a = a + 1
endloop
endfunction
//-----------------------Explosion de Glace------------------//
// ******************
function ExplosiondeGlace takes nothing returns nothing
local player p = GetOwningPlayer(GetTriggerUnit())
local integer a = 1
local integer b = 1
local unit dummy
loop
exitwhen a > 5
set b = 1
loop
exitwhen b > 5
set dummy = CreateUnit( p, 'h005', 130 * Cos((( b * 72 ) * bj_PI) / 180)+GetUnitX(GetTriggerUnit()), 130 * Sin((( b * 72 ) * bj_PI) / 180)+GetUnitY(GetTriggerUnit()) ,0 )
call IssueImmediateOrder( dummy, "immolation" )
call UnitApplyTimedLife( dummy, 'BTLF', 0.20 )
set b = b + 1
endloop
call TriggerSleepAction( 0.25 )
set b = 1
loop
exitwhen b > 5
set dummy = CreateUnit( p, 'h005', 280 * Cos(((b*72)*bj_PI)/180)+GetUnitX(GetTriggerUnit()),280*Sin(((b*72)*bj_PI)/180)+GetUnitY(GetTriggerUnit()), 0 )
call IssueImmediateOrder( dummy, "immolation" )
call UnitApplyTimedLife( dummy, 'BTLF', 0.20 )
set dummy = CreateUnit( p, 'h005', 280 * Cos(((b*72-12)*bj_PI)/180)+GetUnitX(GetTriggerUnit()),280*Sin(((b*72-12)*bj_PI)/180)+GetUnitY(GetTriggerUnit()), 0 )
call IssueImmediateOrder( dummy, "immolation" )
call UnitApplyTimedLife( dummy, 'BTLF', 0.20 )
set dummy = CreateUnit( p, 'h005', 280 * Cos(((b*72+12)*bj_PI)/180)+GetUnitX(GetTriggerUnit()),280*Sin(((b*72+12)*bj_PI)/180)+GetUnitY(GetTriggerUnit()), 0 )
call IssueImmediateOrder( dummy, "immolation" )
call UnitApplyTimedLife( dummy, 'BTLF', 0.20 )
set b = b + 1
endloop
call TriggerSleepAction( 0.25 )
set b = 1
loop
exitwhen b > 5
set dummy = CreateUnit( p, 'h005', 440 * Cos(((b*72)*bj_PI)/180)+GetUnitX(GetTriggerUnit()),440* Sin(((b*72) * bj_PI) / 180)+GetUnitY(GetTriggerUnit()), 0 )
call IssueImmediateOrder( dummy, "immolation" )
call UnitApplyTimedLife( dummy, 'BTLF', 0.20 )
set dummy = CreateUnit( p, 'h005', 440 * Cos(((b*72-12)*bj_PI)/180)+GetUnitX(GetTriggerUnit()),440* Sin(((b*72-12) * bj_PI) / 180)+GetUnitY(GetTriggerUnit()), 0 )
call IssueImmediateOrder( dummy, "immolation" )
call UnitApplyTimedLife( dummy, 'BTLF', 0.20 )
set dummy = CreateUnit( p, 'h005', 440 * Cos(((b*72-22)*bj_PI)/180)+GetUnitX(GetTriggerUnit()),440* Sin(((b*72-22) * bj_PI) / 180)+GetUnitY(GetTriggerUnit()), 0 )
call IssueImmediateOrder( dummy, "immolation" )
call UnitApplyTimedLife( dummy, 'BTLF', 0.20 )
set dummy = CreateUnit( p, 'h005', 440 * Cos(((b*72+12)*bj_PI)/180)+GetUnitX(GetTriggerUnit()),440* Sin(((b*72+12) * bj_PI) / 180)+GetUnitY(GetTriggerUnit()), 0 )
call IssueImmediateOrder( dummy, "immolation" )
call UnitApplyTimedLife( dummy, 'BTLF', 0.20 )
set dummy = CreateUnit( p, 'h005', 440 * Cos(((b*72+22)*bj_PI)/180)+GetUnitX(GetTriggerUnit()),440* Sin(((b*72+22) * bj_PI) / 180)+GetUnitY(GetTriggerUnit()), 0 )
call IssueImmediateOrder( dummy, "immolation" )
call UnitApplyTimedLife( dummy, 'BTLF', 0.20 )
set b = b + 1
endloop
call TriggerSleepAction( 0.25 )
set a = a + 1
endloop
endfunction
//-----------------------Mur de Glace------------------//
// ************
function baMurdeGlace takes nothing returns nothing
local location l = GetSpellTargetLoc()
local real x = GetLocationX(l)
local real y = GetLocationY(l)
local real x2 = GetUnitX(GetTriggerUnit())
local real y2 = GetUnitY(GetTriggerUnit())
local integer a = 1
local player p = GetOwningPlayer(GetTriggerUnit())
local real face = Atan2(y - y2, x - x2 ) - (bj_PI / 2 )
local unit dummy
loop
exitwhen a > 3
set dummy = CreateUnit( p, 'h006', (-45 + a * 90) * Cos(face)+x, (-45 + a * 90) * Sin(face)+y, a * 1.23 )
call UnitApplyTimedLife( dummy, 'BTLF', 12.00 + I2R(udg_Niveaux_sorts_entier[( 110 + GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit())) )]) )
set dummy = CreateUnit( p, 'h006', ( 45 - a * 90) * Cos(face)+x, ( 45 - a * 90) * Sin(face)+y, a * 0.86 )
call UnitApplyTimedLife( dummy, 'BTLF', 12.00 + I2R(udg_Niveaux_sorts_entier[( 110 + GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit())) )]) )
call PlaySoundAtPointBJ( gg_snd_FreezingBreathTarget1, 100, l, 0 )
call TriggerSleepAction( 0.20 )
set a = a + 1
endloop
endfunction
//-----------------------Blizzard------------------//
// ********
function bgBlizzard takes nothing returns nothing
local player p = GetOwningPlayer(GetTriggerUnit())
local real x = GetLocationX(GetSpellTargetLoc())
local real y = GetLocationY(GetSpellTargetLoc())
local unit dummy
local integer a = 1
local integer b
local real random
local real randomangle
local real x2
local real y2
loop
exitwhen a > 10
set random = GetRandomReal( 0, 320)
set randomangle = GetRandomReal(0 , 360)
set x2 = random * Cos(randomangle)+x
set y2 = random * Sin(randomangle)+y
call AddSpecialEffect( "Abilities\\Spells\\Human\\Blizzard\\BlizzardTarget.mdl", x2, y2 )
call TriggerSleepAction( 0.30 )
set dummy = CreateUnit( p, 'o00D', x2, y2, 0 )
call IssueTargetOrder( dummy, "frostnova", dummy )
call UnitApplyTimedLife( dummy, 'BTLF', 1.00 )
call TriggerSleepAction( 0.20 )
set b = 1
loop
exitwhen b > 10
set dummy = CreateUnit( p, 'h005', 60 * Cos((b * 36 * bj_PI) / 180)+x2, 60 * Sin((b * 36 * bj_PI) / 180)+y2, 0 )
call IssueImmediateOrder( dummy, "immolation" )
call UnitApplyTimedLife( dummy, 'BTLF', 0.30 )
call IssuePointOrder( dummy, "move", 170 * Cos((b * 36 * bj_PI) / 180)+x2, 170 * Sin((b * 36 * bj_PI) / 180)+y2 )
set b = b + 1
endloop
set a = a + 1
endloop
endfunction
//-----------------------Explosion de Glace------------------//
// ******************
function bhExplosiondeGlace takes nothing returns nothing
local player p = GetOwningPlayer(GetTriggerUnit())
local integer a = 1
local unit dummy
loop
exitwhen a > 8 + (2 * I2R(udg_Niveaux_sorts_entier[( 150 + GetConvertedPlayerId(p) )]) )
set dummy = CreateUnit( p, 'e002', GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()), 0 )
call IssuePointOrder( dummy, "attackground", GetUnitX(dummy), GetUnitY(dummy) )
call SetUnitScalePercent( dummy, 210, 210, 210)
call TriggerSleepAction( 1.00 )
set a = a + 1
endloop
endfunction
//===========================================================================
function InitTrig_Sort_de_Glace takes nothing returns nothing
endfunction
//TESH.scrollpos=59
//TESH.alwaysfold=0
//function action_1 takes nothing returns nothing
//local string s = "Action 1"
//local integer m = GetHandleId(GetTriggeringTrigger())
//
//call TriggerRemoveAction( GetTriggeringTrigger(), H2Ta(GetInteger(m, "Action")) )
//////call DisplayTextToPlayer(Player(0),0,0,s)
//endfunction
//
//function action_2 takes nothing returns nothing
//local string s = "Action 2"
//
//call DisplayTextToPlayer(Player(0),0,0,s)
////call DestroyTrigger(GetTriggeringTrigger())
//endfunction
//
//function Boutton_test_1 takes nothing returns nothing
//local trigger t = CreateTrigger()
//local string m = I2S(H2I(t))
//local triggeraction ta = TriggerAddAction( t, function action_1 )
//call StoreInteger( udg_Spell, m, "Action", H2I(ta))
//
//call TriggerAddAction( t, function action_2 )
//call TriggerRegisterUnitEvent( t, GetTriggerUnit(), EVENT_UNIT_DAMAGED )
//endfunction
//
//function Boutton_test_2 takes nothing returns nothing
//local trigger t = CreateTrigger()
////call TriggerAddAction( t, function action_1 )
//call TriggerAddAction( t, function action_2 )
//call TriggerRegisterUnitEvent( t, GetTriggerUnit(), EVENT_UNIT_DAMAGED )
//endfunction
struct test extends Spell
integer i= 1
real sens = -1.0
boolean b = true
real a = 0.0
static method cycle takes nothing returns boolean
local thistype this = T003_GetData()
local real vit = Sin((.i*0.1)-bj_PI/2)*20
local real vitvol = Cos((.i*0.1)+bj_PI/2)*20
set .i = .i + 1
//if( this.x > 1.0 ) then
//set this.x = this.x - 2.0
//endif
set this.a = this.a + Deg2Rad(1.0)
call SetUnitX( this.target, GetUnitX(this.target)+vit*Cos(this.a))
call SetUnitY( this.target, GetUnitY(this.target)+vit*Sin(this.a))
call SetUnitFlyHeight( this.target, 700*this.sens, RAbsBJ(vitvol/0.03) )
if( (not (.b) and vitvol < 0 ) or ( .b and vitvol > 0) ) then
set this.sens = this.sens * -1
set .b = not .b
call BJDebugMsg( "i: "+I2S(.i) )
endif
return true
endmethod
endstruct
function Boutton_test_3 takes nothing returns nothing
local test obj
local integer a = 0
loop
exitwhen a > 10
set obj = test.create()
set obj.target = CreateUnit( Player(0), 'h01M', -900, 0, 0)
set obj.a = (bj_PI/5)*a
call T003_Add(function test.cycle, obj)
set a = a + 1
endloop
endfunction
//===========================================================================
function InitTrig_Test takes nothing returns nothing
endfunction
function Trig_D__clencheur_sans_titre_001_Conditions takes nothing returns boolean
if ( not ( IsUnitGroupEmptyBJ(GetLastCreatedGroup()) == true ) ) then
return false
endif
if ( not ( UnitHasItemOfTypeBJ(GetTriggerUnit(), 'texp') == true ) ) then
return false
endif
return true
endfunction
function Trig_D__clencheur_sans_titre_001_Func004002 takes nothing returns nothing
call DoNothing( )
endfunction
function Trig_D__clencheur_sans_titre_001_Actions takes nothing returns nothing
call KillUnit( GetEnumUnit() )
call ForGroupBJ( GetUnitsOfTypeIdAll('nwe3'), function Trig_D__clencheur_sans_titre_001_Func004002 )
call SetItemCharges( GetLastCreatedItem(), GetItemCharges(GetLastCreatedItem()) )
call IssueImmediateOrderBJ( GetLastCreatedUnit(), "holdposition" )
call SetPlayerTechResearchedSwap( 'Rhcd', 1, Player(0) )
endfunction
//===========================================================================
function InitTrig_D__clencheur_sans_titre_001 takes nothing returns nothing
set gg_trg_D__clencheur_sans_titre_001 = CreateTrigger( )
call TriggerAddCondition( gg_trg_D__clencheur_sans_titre_001, Condition( function Trig_D__clencheur_sans_titre_001_Conditions ) )
call TriggerAddAction( gg_trg_D__clencheur_sans_titre_001, function Trig_D__clencheur_sans_titre_001_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
library ModifTerrain needs CustomScript
function PutIcecrownTree takes nothing returns nothing
local location loc = GetDestructableLoc(GetEnumDestructable())
call CreateDestructableLoc( 'ITtw', loc, GetRandomDirectionDeg(), 1.10, GetRandomInt(0,9))
call RemoveDestructable( GetEnumDestructable() )
call RemoveLocation(loc)
set loc = null
endfunction
function PutDalaranTree takes nothing returns nothing
local location loc = GetDestructableLoc(GetEnumDestructable())
call CreateDestructableLoc( 'YTct', loc, GetRandomDirectionDeg(), 1.10, GetRandomInt(0,9))
call RemoveDestructable( GetEnumDestructable() )
call RemoveLocation(loc)
set loc = null
endfunction
function PutSunkenRuinsTree takes nothing returns nothing
local location loc = GetDestructableLoc(GetEnumDestructable())
call CreateDestructableLoc( 'ZTtw', loc, GetRandomDirectionDeg(), 1.10, GetRandomInt(0,9))
call RemoveDestructable( GetEnumDestructable() )
call RemoveLocation(loc)
set loc = null
endfunction
function C takes integer i, integer j returns integer
return ((i+j)*(i+j+1))/2+j //-> Coordonnées 1 dimension en 2 dimensions
endfunction
function Enregistrer_Case takes integer i, integer j, integer t returns nothing
local integer a = 0
local integer id = C(i,j)
loop
exitwhen udg_terDalaran[a] == t
set a = a + 1
endloop
set udg_Terrain[id] = t
set udg_Terrain_Id[id] = a
endfunction
function Generer_Terrain takes nothing returns nothing
local real a = 0
local real b = 0
local real x = Pos_Terrain(CX_ARENE - DIM_ARENE/2)
local real y = Pos_Terrain(CY_ARENE + DIM_ARENE/2)
loop
exitwhen a == 28
loop
exitwhen b == 28
call Enregistrer_Case( R2I(a), R2I(b), GetTerrainType(x+128*a, y-128*b))
set b = b + 1
endloop
set b = 0
set a = a + 1
endloop
endfunction
function ModifierTerrain takes integer tiles returns nothing
local integer a = 0
local integer b = 0
local integer array terType
local real x = Pos_Terrain(CX_ARENE - DIM_ARENE/2)
local real y = Pos_Terrain(CY_ARENE + DIM_ARENE/2)
if( tiles == 1 ) then
call EnumDestructablesInRectAll( gg_rct_Terrain, function PutIcecrownTree )
loop
exitwhen a == 5
set terType[a] = udg_terNorthrend[a]
set a = a + 1
endloop
elseif( tiles == 2 ) then
call EnumDestructablesInRectAll( gg_rct_Terrain, function PutIcecrownTree )
loop
exitwhen a == 5
set terType[a] = udg_terIcecrown[a]
set a = a + 1
endloop
elseif( tiles == 3 ) then
call EnumDestructablesInRectAll( gg_rct_Terrain, function PutSunkenRuinsTree )
loop
exitwhen a == 5
set terType[a] = udg_terArene[a]
set a = a + 1
endloop
else
call EnumDestructablesInRectAll( gg_rct_Terrain, function PutDalaranTree )
loop
exitwhen a == 5
set terType[a] = udg_terDalaran[a]
set a = a + 1
endloop
endif
set a = 0
loop
exitwhen a == 27
loop
exitwhen b == 27
call SetTerrainType(x+128*a, y-128*b, terType[udg_Terrain_Id[C(a,b)]], -1, 1, 1)
set b = b + 1
endloop
set b = 0
set a = a + 1
endloop
endfunction
function Trig_Init_Terrain_Actions takes nothing returns nothing
call Generer_Terrain()
endfunction
//===========================================================================
function InitTrig_Init_Terrain takes nothing returns nothing
set gg_trg_Init_Terrain = CreateTrigger( )
call TriggerAddAction( gg_trg_Init_Terrain, function Trig_Init_Terrain_Actions )
set udg_terDalaran[0] = MARBRE_NOIR
set udg_terDalaran[1] = BRIQUES
set udg_terDalaran[2] = DALLES_CARRES
set udg_terDalaran[3] = JARDIN
set udg_terDalaran[4] = MARBRE_BLANC
set udg_terNorthrend[0] = North_TERRE_SOMBRE
set udg_terNorthrend[1] = North_ROCHERS
set udg_terNorthrend[2] = GLACE
set udg_terNorthrend[3] = TERRE
set udg_terNorthrend[4] = North_NEIGE
set udg_terIcecrown[0] = North_NEIGE
set udg_terIcecrown[1] = Icecr_BRIQUES_RUN
set udg_terIcecrown[2] = Icecr_CARRES_NOIRS
set udg_terIcecrown[3] = TERRE
set udg_terIcecrown[4] = GLACE
set udg_terArene[0] = Iles_SABLE
set udg_terArene[1] = Iles_SABLE
set udg_terArene[2] = Iles_SABLE
set udg_terArene[3] = TERRE
set udg_terArene[4] = Iles_SABLE
endfunction
endlibrary
//TESH.scrollpos=42
//TESH.alwaysfold=0
function C takes integer i, integer j returns integer
return ((i+j)*(i+j+1))/2+j //-> Coordonnées 1 dimension en 2 dimensions
endfunction
function Enregistrer_Case takes integer i, integer j, integer t returns nothing
set udg_Terrain[C(i,j)] = t
call SetTerrainType( Tx(i), Ty(j), udg_Terrain[C(i,j)], -1, 1, FORME_CARRE )
endfunction
function Quart_Terrain takes integer x, integer y returns nothing
local real xa = CX_ARENE
local real ya = CY_ARENE
local integer dim = udg_DimArene
local real dx = I2R(dim)/2.0-0.5
local real dy = I2R(dim)/2.0-0.5
local integer i
local integer j
call Creer_Case(x,y, DALLES_RONDES)
call Creer_Case(x+1*x,y, BRIQUES)
call Creer_Case(x,y+1*y, MARBRE_BLANC)
call Creer_Case(x+1*x,y+1*y, DALLES_CARRES)
call Creer_Case(x+2*x,y+0*y, MARBRE_NOIR)
call Creer_Case(x+2*x,y+1*y, MARBRE_NOIR)
call Creer_Case(x+2*x,y+2*y, MARBRE_NOIR)
call Creer_Case(x+1*x,y+2*y, MARBRE_NOIR)
call Creer_Case(x+0*x,y+2*y, MARBRE_NOIR)
//=========================//
call Creer_Case(x+3*x,y+0*y, BRIQUES)
call Creer_Case(x+4*x,y+0*y, BRIQUES)
call Creer_Case(x+3*x,y+1*y, DALLES_CARRES)
call Creer_Case(x+4*x,y+1*y, DALLES_CARRES)
call Creer_Case(x+3*x,y+2*y, BRIQUES)
call Creer_Case(x+4*x,y+2*y, BRIQUES)
call Creer_Case(x+0*x,y+3*y, BRIQUES)
call Creer_Case(x+0*x,y+4*y, BRIQUES)
call Creer_Case(x+1*x,y+3*y, DALLES_CARRES)
call Creer_Case(x+1*x,y+4*y, DALLES_CARRES)
call Creer_Case(x+2*x,y+3*y, BRIQUES)
call Creer_Case(x+2*x,y+4*y, BRIQUES)
//=========================//
call Creer_Case(x+4*x,y+3*y, JARDIN)
call Creer_Case(x+3*x,y+3*y, JARDIN)
call Creer_Case(x+3*x,y+4*y, JARDIN)
//=========================//
endfunction
function Trig_Init_Terrain_Actions takes nothing returns nothing
call Quart_Terrain( 1, 1 )
call Quart_Terrain( 1, -1 )
call Quart_Terrain( -1, 1 )
call Quart_Terrain( -1, -1 )
call SetTerrainTimed( Pos_Terrain(CX_ARENE), Pos_Terrain(CY_ARENE), GLACE, 1, 30.0 )
endfunction
//===========================================================================
function InitTrig_Init_Terrain_Copier takes nothing returns nothing
set gg_trg_Init_Terrain_Copier = CreateTrigger( )
call TriggerAddAction( gg_trg_Init_Terrain_Copier, function Trig_Init_Terrain_Actions )
endfunction