//TESH.scrollpos=1655
//TESH.alwaysfold=0
//Cuadrado
function Cuadrado takes real num returns real
return num * num
endfunction
//Dañar Area
function wwAreaDam takes real dam, unit agresor, real x, real y, real area returns nothing
local unit u
local player p = GetOwningPlayer(agresor)
call GroupEnumUnitsInRange(udg_wwG, x, y, area, null)
loop
set u = FirstOfGroup(udg_wwG)
exitwhen u == null
call GroupRemoveUnit(udg_wwG, u)
if IsUnitEnemy(u, p) then
call UnitDamageTarget(agresor, u, dam, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_LIGHTNING, WEAPON_TYPE_WHOKNOWS)
endif
endloop
set p = null
endfunction
//Unidad en area semirectangular
function wwUnidadEnArea takes unit u, real X1, real Y1, real X2, real Y2 returns boolean
local real K
local real F
local real XP = (GetUnitX(u) - (X1+X2)/2)
local real YP = (GetUnitY(u) - (Y1+Y2)/2)
local real DX = X1-X2
local real DY = Y1-Y2
local boolean control = false
if (RAbsBJ(DX) >= RAbsBJ(DY)) then
set F = (XP*DY)/DX
set K = RAbsBJ(DX*0.08)
if (YP <= (F + K)) then
if (YP >= (F - K)) then
set control = true
endif
endif
else
set F = (YP*DX)/DY
set K = RAbsBJ(DY*0.08)
if (XP <= (F + K)) then
if (XP >= (F - K)) then
set control = true
endif
endif
endif
return control
endfunction
//[Libreria] (jass) CAMPOS DE FUERZA 1.4 por WonderWoman
//**************************************************
//INSTALACION (o como se llame):
//Copiar todo el codigo al Codigo del Guion Personalizado.
//Crear las 4 variables globales usadas por el sistema con el editor de variables:
// <nombre de variable> <tipo de variable>
// WWdeto Detonador Formacion[1]
// WWhl Tabla hash
// WWhp Tabla hash
// WWhu Tabla hash
//
//No requiere newgen, se puede usar con el Editor de Mundos generico
////****FUNCIONES AUXILIARES****
//FUNCION DE MODULO
function wwModulo takes real r1, real r2 returns real
return SquareRoot((r1 * r1) + (r2 * r2))
endfunction
////****POLOS CARGADOS****
// h 1 1 = [entero] numero de polos
// h x 0 = [entero] ID de polo (acceso con id de unidad) x = id de unidad
// h y 2 = [real] carga del polo (acceso con id de polo) y = id de polo
// h y 3 = [booleana] polo activo (acceso con id de polo)
// h y 4 = [unidad] ID de unidad (acceso con id de polo)
// h y 6 = [booleana] Polo selectivo (acceso con id de polo)
//FUNCION CREADORA DE POLO
function wwPoloCrear takes unit u, real carga, boolean ps returns nothing
local integer UniHand
local integer PoloN
set UniHand = GetHandleId(u)
if (GetUnitState(u, UNIT_STATE_LIFE) > 0) then
if (LoadBoolean(udg_WWhp, (LoadInteger(udg_WWhp, UniHand ,0)), 3) == false) then
set PoloN = (LoadInteger(udg_WWhp, 1, 1) + 1)
//...........................................
call SaveInteger(udg_WWhp, UniHand, 0, PoloN)
call SaveReal(udg_WWhp, PoloN, 2, carga)
call SaveBoolean(udg_WWhp, PoloN, 3, true)
call SaveUnitHandle(udg_WWhp, PoloN, 4, u)
call SaveBoolean(udg_WWhp, PoloN, 6, ps)
//...........................................
call SaveInteger(udg_WWhp, 1, 1, PoloN)
endif
endif
endfunction
//FUNCION DE CAMBIO DE PARAMETROS DE POLO
function wwPoloParametros takes unit u, real carga, boolean ps returns nothing
local integer UniHand
local integer PoloN
set UniHand = GetHandleId(u)
if (LoadBoolean(udg_WWhp, (LoadInteger(udg_WWhp, UniHand ,0)), 3) == true) then
set PoloN = LoadInteger(udg_WWhp, UniHand ,0)
//...........................................
call SaveReal(udg_WWhp, PoloN, 2, carga)
call SaveBoolean(udg_WWhp, PoloN, 6, ps)
endif
endfunction
//FUNCION DESTRUCTORA DE POLO
function wwPoloDestruir takes unit u returns nothing
local integer UniHand
local integer PoloN
local integer PoloUlt
set UniHand = GetHandleId(u)
if (LoadBoolean(udg_WWhp, (LoadInteger(udg_WWhp, UniHand ,0)), 3) == true) then
set PoloN = LoadInteger(udg_WWhp, UniHand ,0)
set PoloUlt = LoadInteger(udg_WWhp, 1, 1)
//...........................................
call SaveInteger(udg_WWhp, GetHandleId(LoadUnitHandle(udg_WWhp, PoloUlt,4)), 0, PoloN)
call SaveReal(udg_WWhp, PoloN, 2, LoadReal(udg_WWhp, PoloUlt,2))
call SaveBoolean(udg_WWhp, PoloN, 3, LoadBoolean(udg_WWhp, PoloUlt,3))
call SaveUnitHandle(udg_WWhp, PoloN, 4, LoadUnitHandle(udg_WWhp, PoloUlt,4))
call SaveBoolean(udg_WWhp, PoloN, 6, LoadBoolean(udg_WWhp, PoloUlt,6))
//...........................................
call SaveInteger(udg_WWhp, UniHand, 0, 0)
call SaveReal(udg_WWhp, PoloUlt, 2, 0.00)
call SaveBoolean(udg_WWhp, PoloUlt, 3, false)
call SaveUnitHandle(udg_WWhp, PoloUlt, 4, null)
call SaveBoolean(udg_WWhp, PoloUlt, 6, false)
//...........................................
call SaveInteger(udg_WWhp, 1, 1, (PoloUlt - 1))
endif
endfunction
////****LINEAS DE CARGA****
// h 1 1 = [entero] numero de lineas
// h x 0 = [entero] ID de linea (acceso con id de unidad1) x = id de unidad
// h y 2 = [real] carga lineal (acceso con id de linea) y = id de linea
// h y 3 = [booleana] linea activa (acceso con id de linea)
// h y 4 = [unidad] ID de unidad1 (acceso con id de linea)
// h y 5 = [unidad] ID de unidad2 (acceso con id de linea)
// h y 6 = [booleana] Linea selectiva (acceso con id de linea)
//FUNCION CREADORA DE LINEA
function wwLineaCrear takes unit u1, unit u2, real carga, boolean ls returns nothing
local integer UniHand
local integer LineaN
set UniHand = GetHandleId(u1)
if ((GetUnitState(u1, UNIT_STATE_LIFE) > 0) and (GetUnitState(u2, UNIT_STATE_LIFE) > 0))then
if (LoadBoolean(udg_WWhl, (LoadInteger(udg_WWhl, UniHand ,0)), 3) == false) then
set LineaN = (LoadInteger(udg_WWhl, 1, 1) + 1)
//...........................................
call SaveInteger(udg_WWhl, UniHand, 0, LineaN)
call SaveReal(udg_WWhl, LineaN, 2, carga)
call SaveBoolean(udg_WWhl, LineaN, 3, true)
call SaveUnitHandle(udg_WWhl, LineaN, 4, u1)
call SaveUnitHandle(udg_WWhl, LineaN, 5, u2)
call SaveBoolean(udg_WWhl, LineaN, 6, ls)
//...........................................
call SaveInteger(udg_WWhl, 1, 1, LineaN)
endif
endif
endfunction
//FUNCION DE CAMBIO DE PARAMETROS DE LINEA DE CARGA
function wwLineaParametros takes unit u, real carga, boolean ls returns nothing
local integer UniHand
local integer LineaN
set UniHand = GetHandleId(u)
if (LoadBoolean(udg_WWhl, (LoadInteger(udg_WWhl, UniHand ,0)), 3) == true) then
set LineaN = LoadInteger(udg_WWhl, UniHand ,0)
//...........................................
call SaveReal(udg_WWhl, LineaN, 2, carga)
call SaveBoolean(udg_WWhl, LineaN, 6, ls)
endif
endfunction
//FUNCION DESTRUCTORA DE LINEA DE CARGA
function wwLineaDestruir takes unit u returns nothing
local integer UniHand
local integer LineaN
local integer LineaUlt
set UniHand = GetHandleId(u)
if (LoadBoolean(udg_WWhl, (LoadInteger(udg_WWhl, UniHand ,0)), 3) == true) then
set LineaN = LoadInteger(udg_WWhl, UniHand ,0)
set LineaUlt = LoadInteger(udg_WWhl, 1, 1)
//...........................................
call SaveInteger(udg_WWhl, GetHandleId(LoadUnitHandle(udg_WWhl, LineaUlt,4)), 0, LineaN)
call SaveReal(udg_WWhl, LineaN, 2, LoadReal(udg_WWhl, LineaUlt,2))
call SaveBoolean(udg_WWhl, LineaN, 3, LoadBoolean(udg_WWhl, LineaUlt,3))
call SaveUnitHandle(udg_WWhl, LineaN, 4, LoadUnitHandle(udg_WWhl, LineaUlt,4))
call SaveUnitHandle(udg_WWhl, LineaN, 5, LoadUnitHandle(udg_WWhl, LineaUlt,5))
call SaveBoolean(udg_WWhl, LineaN, 6, LoadBoolean(udg_WWhl, LineaUlt,6))
//...........................................
call SaveInteger(udg_WWhl, UniHand, 0, 0)
call SaveReal(udg_WWhl, LineaUlt, 2, 0.00)
call SaveBoolean(udg_WWhl, LineaUlt, 3, false)
call SaveUnitHandle(udg_WWhl, LineaUlt, 4, null)
call SaveUnitHandle(udg_WWhl, LineaUlt, 5, null)
call SaveBoolean(udg_WWhl, LineaUlt, 6, false)
//...........................................
call SaveInteger(udg_WWhl, 1, 1, (LineaUlt - 1))
endif
endfunction
////****FISICA****
//FUNCION DE FUERZA
function wwFisicaCampoDeFuerza takes nothing returns nothing
local integer UniCant
local integer i = 1
local integer PoloCant
local integer LineaCant
local integer j
local real DfX
local real DfY
local real X
local real Y
local real array Xp
local real array Yp
local real array X1
local real array Y1
local real array X2
local real array Y2
local real Xrel
local real Yrel
local real array Pendiente
local real array PendInv
local real array Seno
local real array Coseno
local real Ordenada
local real Xcort
local real Ycort
local real array Xmax
local real LimInicial
local real LimFinal
local real Calc1
local real Calc2
local real CamEx
local real CamEy
local real h
local real Vx
local real Vy
local real Modu
local real Modu2
local real Fuerza
local real Aux
local real Peso
local unit u
local integer array JugPolo
local integer array JugLinea
local boolean control
set UniCant = LoadInteger(udg_WWhu, 1, 1)
set PoloCant = LoadInteger(udg_WWhp, 1, 1)
set LineaCant = LoadInteger(udg_WWhl, 1, 1)
//Bucles de constantes de operacion
loop
exitwhen i > PoloCant
set JugPolo[i] = GetPlayerId(GetOwningPlayer(LoadUnitHandle(udg_WWhp, i, 4)))
set Xp[i] = GetUnitX(LoadUnitHandle(udg_WWhp, i, 4))
set Yp[i] = GetUnitY(LoadUnitHandle(udg_WWhp, i, 4))
set i = i + 1
endloop
set i = 1
loop
exitwhen i > LineaCant
set JugLinea[i] = GetPlayerId(GetOwningPlayer(LoadUnitHandle(udg_WWhl, i, 4)))
set X1[i] = GetUnitX(LoadUnitHandle(udg_WWhl, i, 4))
set Y1[i] = GetUnitY(LoadUnitHandle(udg_WWhl, i, 4))
set X2[i] = GetUnitX(LoadUnitHandle(udg_WWhl, i, 5))
set Y2[i] = GetUnitY(LoadUnitHandle(udg_WWhl, i, 5))
if X1[i] > X2[i] then
set Aux = X1[i]
set X1[i] = X2[i]
set X2[i] = Aux
set Aux = Y1[i]
set Y1[i] = Y2[i]
set Y2[i] = Aux
endif
set DfX = X2[i] - X1[i]
set DfY = Y2[i] - Y1[i]
set control = false
if DfX > 0 or DfX < 0 then
set Pendiente[i] = (DfY / DfX)
set control = true
else
set Pendiente[i] = 99999.99
endif
if DfY > 0 or DfY < 0 then
set PendInv[i] = -(DfX / DfY)
set control = true
else
set PendInv[i] = -99999.99
endif
set Xmax[i] = wwModulo(DfX, DfY)
if control then
set Coseno[i] = -DfX / Xmax[i]
set Seno[i] = DfY / Xmax[i]
else
set Coseno[i] = 0.78
set Seno[i] = 0.78
endif
set i = i + 1
endloop
set i = 1
//Bucle de calculo de aceleracion
loop
exitwhen i > UniCant
set u = LoadUnitHandle(udg_WWhu, i, 4)
set Peso = LoadReal(udg_WWhu, i, 2)
set Vx = LoadReal(udg_WWhu, i, 5)
set Vy = LoadReal(udg_WWhu, i, 6)
set X = GetUnitX(u)
set Y = GetUnitY(u)
//Fisica de Polos
if not(LoadBoolean(udg_WWhu, i, 7)) then
set j = 1
loop
exitwhen j > PoloCant
if ( not(LoadBoolean(udg_WWhp, j, 6)) or (IsUnitEnemy(u, Player(JugPolo[j])) == true) ) then
if (LoadUnitHandle(udg_WWhp, j, 4) != u) then
set DfX = (Xp[j] - X)
set DfY = (Yp[j] - Y)
set Modu2 = (DfX * DfX) + (DfY * DfY)
set Aux = (LoadReal(udg_WWhp, j, 2) * Peso)
if Modu2 > 1600.00 and Modu2 < 0.05 * Aux * Aux then
set Modu = SquareRoot(Modu2)
set Fuerza = (Aux / Modu2)
set Aux = (Fuerza) / Modu
set Vx = Vx - DfX * Aux
set Vy = Vy - DfY * Aux
endif
endif
endif
set j = j + 1
endloop
//Fisica de Lineas de Carga
set j = 1
loop
exitwhen j > LineaCant
if ( not(LoadBoolean(udg_WWhl, j, 6)) or (IsUnitEnemy(u, Player(JugLinea[j])) == true) ) then
if ((u != LoadUnitHandle(udg_WWhl, j, 5)) and (u != LoadUnitHandle(udg_WWhl, j, 4))) then
if ( IsUnitInRangeXY(u, (X1[j] + X2[j])/2,(Y1[j] + Y2[j])/2, RAbsBJ(0.04*(LoadReal(udg_WWhl, j, 2) * Peso)) + Xmax[j])) then
//COORDENADAS RELATIVAS Y ORDENADA AL ORIGEN
set Xrel = (X - X1[j])
set Yrel = (Y - Y1[j])
set Ordenada = Yrel - (Xrel * PendInv[j])
//PUNTOS DE CORTE CON LA RECTA Y DISTANCIA A LA MISMA
set Xcort = Ordenada / (Pendiente[j] - PendInv[j])
set Ycort = Xcort * Pendiente[j]
set h = wwModulo((Xrel-Xcort), (Yrel-Ycort))
//LIMITES DE INTEGRACION
set Aux = (X2[j] - X1[j])
if Aux > 0 then
set LimInicial = -(Xcort * Xmax[j]) / Aux
else
set LimInicial = 99999.99
endif
set LimFinal = Xmax[j] + LimInicial
//INTEGRALES DE LINEA PARA CALCULAR FUERZA VECTORIAL
set Calc1 = wwModulo(LimFinal, h)
set Calc2 = wwModulo(LimInicial, h)
if h > 0.50 then
set CamEy = ((LimFinal / (Calc1 * h)) - (LimInicial / (Calc2 * h)))
else
set CamEy = 999.00
endif
set CamEx = (1 / Calc1) - (1 / Calc2)
//CORRECCION DE ERROR DE DIRECCION
if ((Pendiente[j] * Xrel)) > Yrel then
set CamEy = -CamEy
endif
if ((CamEy < 0.20) and (CamEy > -0.20)) then
//MATRIZ DE ROTACION
set Aux = CamEx
set CamEx = (Coseno[j] * CamEx) + (Seno[j] * CamEy)
set CamEy = -(Seno[j] * Aux) + (Coseno[j] * CamEy)
//CALCULO DE CONSTANTES QUE SALEN FUERA DE LA INTEGRAL (MULTIPLICADOR)
set Aux = (LoadReal(udg_WWhl, j, 2) * Peso) / 1000.00
set Vx = Vx - (CamEx * Aux)
set Vy = Vy - (CamEy * Aux)
endif
endif
endif
endif
set j = j + 1
endloop
endif
set Modu = SquareRoot((Vx * Vx) + (Vy * Vy))
set Aux = Modu - (20/Peso)
if (Aux > 0 and Modu > 0) then
//multiplicador de velocidad terminal
set Modu = LoadReal(udg_WWhu, 4, 1) * Aux / Modu
set Vx = Vx * Modu
set Vy = Vy * Modu
set X = (X + Vx / LoadReal(udg_WWhu, 3, 1))
set Y = (Y + Vy / LoadReal(udg_WWhu, 3, 1))
else
set Vx = 0
set Vy = 0
endif
call SaveReal(udg_WWhu, i, 5, Vx)
call SaveReal(udg_WWhu, i, 6, Vy)
if not(IsTerrainPathable(X, Y, PATHING_TYPE_FLYABILITY)) then
call SetUnitX(u, X)
call SetUnitY(u, Y)
endif
set i = i + 1
endloop
set u = null
endfunction
////****UNIDADES****
// h 1 1 = [entero] numero de USs (unidad en sistema)
// h x 0 = [entero] ID de US (acceso con id de unidad) x = id de unidad
// h y 2 = [real] peso de unidad (acceso con id de US) y = id de US
// h y 3 = [booleana] US activa (acceso con id de US)
// h y 4 = [unidad] unidad (acceso con id de US)
// h y 5 = [real] velocidad en X (acceso con id de US)
// h y 6 = [real] velocidad en Y (acceso con id de US)
// h y 7 = [booleana] unidad inmune, no es afectada por los polos y lineas pero se le puede aplicar fuerza
// h y 8 = [booleana] unidad protegida, al morir no es removida del sistema si es true (acceso con id de US)
//FUNCION PARA AGREGAR UNIDAD AL SISTEMA
function wwUnidadAgregar takes unit u, real peso, boolean p, boolean i returns nothing
local integer UniHand
local integer UniNum
set UniHand = GetHandleId(u)
if (LoadBoolean(udg_WWhu, (LoadInteger(udg_WWhu, UniHand ,0)), 3) == false) then
if (GetUnitState(u, UNIT_STATE_LIFE) > 0) then
set UniNum = (LoadInteger(udg_WWhu, 1, 1) + 1)
//...........................................
call SaveInteger(udg_WWhu, UniHand, 0, UniNum)
call SaveReal(udg_WWhu, UniNum, 2, peso)
call SaveBoolean(udg_WWhu, UniNum, 3, true)
call SaveUnitHandle(udg_WWhu, UniNum, 4, u)
call SaveReal(udg_WWhu, UniNum, 5, 0.00)
call SaveReal(udg_WWhu, UniNum, 6, 0.00)
call SaveBoolean(udg_WWhu, UniNum, 7, i)
call SaveBoolean(udg_WWhu, UniNum, 8, p)
//...........................................
call SaveInteger(udg_WWhu, 1, 1, UniNum)
endif
endif
endfunction
//FUNCION DE CAMBIO DE PARAMETROS DE UNIDAD
function wwUnidadParametros takes unit u, real peso, boolean p, boolean i returns nothing
local integer UniHand
local integer UniNum
set UniHand = GetHandleId(u)
if (LoadBoolean(udg_WWhu, (LoadInteger(udg_WWhu, UniHand ,0)), 3) == true) then
set UniNum = LoadInteger(udg_WWhu, UniHand ,0)
//...........................................
call SaveReal(udg_WWhu, UniNum, 2, peso)
call SaveBoolean(udg_WWhu, UniNum, 8, p)
call SaveBoolean(udg_WWhu, UniNum, 7, i)
endif
endfunction
//FUNCION PARA QUITAR UNIDAD DEL SISTEMA
function wwUnidadQuitar takes unit u returns nothing
local integer UniHand
local integer UniNum
local integer UniUlt
set UniHand = GetHandleId(u)
if (LoadBoolean(udg_WWhu, (LoadInteger(udg_WWhu, UniHand ,0)), 3) == true) then
set UniNum = LoadInteger(udg_WWhu, UniHand ,0)
set UniUlt = LoadInteger(udg_WWhu, 1, 1)
//...........................................
call SaveInteger(udg_WWhu, GetHandleId(LoadUnitHandle(udg_WWhu, UniUlt,4)), 0, UniNum)
call SaveReal(udg_WWhu, UniNum, 2, LoadReal(udg_WWhu, UniUlt,2))
call SaveBoolean(udg_WWhu, UniNum, 3, LoadBoolean(udg_WWhu, UniUlt,3))
call SaveUnitHandle(udg_WWhu, UniNum, 4, LoadUnitHandle(udg_WWhu, UniUlt,4))
call SaveReal(udg_WWhu, UniNum, 5, LoadReal(udg_WWhu, UniUlt,5))
call SaveReal(udg_WWhu, UniNum, 6, LoadReal(udg_WWhu, UniUlt,6))
call SaveBoolean(udg_WWhu, UniNum, 7, LoadBoolean(udg_WWhu, UniUlt,7))
call SaveBoolean(udg_WWhu, UniNum, 8, LoadBoolean(udg_WWhu, UniUlt,8))
//...........................................
call SaveInteger(udg_WWhu, UniHand, 0, 0)
call SaveReal(udg_WWhu, UniUlt, 2, 0.00)
call SaveBoolean(udg_WWhu, UniUlt, 3, false)
call SaveUnitHandle(udg_WWhu, UniUlt, 4, null)
call SaveReal(udg_WWhu, UniUlt, 5, 0.00)
call SaveReal(udg_WWhu, UniUlt, 6, 0.00)
call SaveBoolean(udg_WWhu, UniUlt, 7, false)
call SaveBoolean(udg_WWhu, UniUlt, 8, false)
//...........................................
call SaveInteger(udg_WWhu, 1, 1, (UniUlt - 1))
endif
endfunction
//FUNCION DE EVENTO DE MUERTE PARA UNIDADES NO PROTEGIDAS
function wwUnidadMuerte takes nothing returns nothing
local unit u
set u = GetTriggerUnit()
if (LoadBoolean(udg_WWhu, GetHandleId(u),8) == false) then
call wwUnidadQuitar(u)
endif
set u = null
endfunction
//FUNCION PARA ACELERAR UNIDAD CON COORDENADAS POLARES EN GRADOS
function wwUnidadAcelerarPolarG takes unit u, real direccion, real ac returns nothing
local integer UniHand
local integer UniNum
set UniHand = GetHandleId(u)
if (LoadBoolean(udg_WWhu, (LoadInteger(udg_WWhu, UniHand ,0)), 3) == true) then
set UniNum = LoadInteger(udg_WWhu, UniHand ,0)
//...........................................
call SaveReal(udg_WWhu, UniNum, 5, (LoadReal(udg_WWhu, UniNum,5) + (Cos(direccion/bj_RADTODEG) * ac * LoadReal(udg_WWhu, 3, 1))) )
call SaveReal(udg_WWhu, UniNum, 6, (LoadReal(udg_WWhu, UniNum,6) + (Sin(direccion/bj_RADTODEG) * ac * LoadReal(udg_WWhu, 3, 1))) )
endif
endfunction
//FUNCION PARA ACELERAR UNIDAD CON COORDENADAS POLARES EN RADIANES
function wwUnidadAcelerarPolarR takes unit u, real direccion, real ac returns nothing
local integer UniHand
local integer UniNum
set UniHand = GetHandleId(u)
if (LoadBoolean(udg_WWhu, (LoadInteger(udg_WWhu, UniHand ,0)), 3) == true) then
set UniNum = LoadInteger(udg_WWhu, UniHand ,0)
//...........................................
call SaveReal(udg_WWhu, UniNum, 5, (LoadReal(udg_WWhu, UniNum,5) + (Cos(direccion) * ac * LoadReal(udg_WWhu, 3, 1))) )
call SaveReal(udg_WWhu, UniNum, 6, (LoadReal(udg_WWhu, UniNum,6) + (Sin(direccion) * ac * LoadReal(udg_WWhu, 3, 1))) )
endif
endfunction
//FUNCION PARA ACELERAR UNIDAD CON COORDENADAS CARTESIANAS
function wwUnidadAcelerarCartesiana takes unit u, real acx, real acy returns nothing
local integer UniHand
local integer UniNum
set UniHand = GetHandleId(u)
if (LoadBoolean(udg_WWhu, (LoadInteger(udg_WWhu, UniHand ,0)), 3) == true) then
set UniNum = LoadInteger(udg_WWhu, UniHand ,0)
//...........................................
call SaveReal(udg_WWhu, UniNum, 5, (LoadReal(udg_WWhu, UniNum,5) + acx * LoadReal(udg_WWhu, 3, 1)) )
call SaveReal(udg_WWhu, UniNum, 6, (LoadReal(udg_WWhu, UniNum,6) + acy * LoadReal(udg_WWhu, 3, 1)) )
endif
endfunction
////****COMANDOS****
//FUNCION DE INICIO DEL SISTEMA
function wwComandoInicio takes real frecuencia returns nothing
if (frecuencia > 100.00) then
set frecuencia = 100.00
elseif (frecuencia < 10.00) then
set frecuencia = 10.00
endif
set udg_WWhp = InitHashtable()
set udg_WWhu = InitHashtable()
set udg_WWhl = InitHashtable()
call SaveReal(udg_WWhu, 3, 1, (frecuencia / 20.00))
call SaveReal(udg_WWhu, 4, 1, 1.00-(0.50 / frecuencia))
set udg_WWdeto[0] = CreateTrigger()
call DisableTrigger(udg_WWdeto[0])
call TriggerRegisterTimerEvent(udg_WWdeto[0], (1.00 / frecuencia), true)
call TriggerAddAction(udg_WWdeto[0], function wwFisicaCampoDeFuerza)
set udg_WWdeto[1] = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(udg_WWdeto[1], EVENT_PLAYER_UNIT_DEATH)
call TriggerAddAction(udg_WWdeto[1], function wwUnidadMuerte)
endfunction
//FUNCION PARA ACTIVAR EL SISTEMA
function wwComandoActivar takes nothing returns nothing
call EnableTrigger(udg_WWdeto[0])
endfunction
//FUNCION PARA DESACTIVAR EL SISTEMA
function wwComandoDesactivar takes nothing returns nothing
call FlushChildHashtable(udg_WWhu, 5)
call FlushChildHashtable(udg_WWhu, 6)
call DisableTrigger(udg_WWdeto[0])
endfunction
//****************************************************************
//Fin de la libreria
//****************************************************************
//Funcion GetUnitCollisionSize de Vexorian
function GetUnitCollisionSize takes unit u returns integer
local integer i=0
local real x=GetUnitX(u)
local real y=GetUnitY(u)
local integer inc=32
loop
loop
exitwhen not(IsUnitInRangeXY(u,x+i,y,0))
set i=i+inc
endloop
set i=i-inc
set inc=inc/2
exitwhen (inc==0) or not(IsUnitInRangeXY(u,x+i+1,y,0) )
endloop
return i
endfunction
//CONCURSO DE BOSSES PARA WORDLEDIT.NET
//===========================================================================
//Funciones Auxiliares
function wwMod takes real a, real b returns real
return SquareRoot(a*a + b*b)
endfunction
function Sonido3d takes string ruta, real x, real y, integer volumen returns nothing
local sound sonido=CreateSound(ruta,false, true, false, 10, 10, "DefaultEAXON")
call SetSoundPosition(sonido, x, y, 100)
call SetSoundVolume(sonido, volumen)
call StartSound(sonido)
call KillSoundWhenDone(sonido)
set sonido = null
endfunction
function PreloadSound takes string snd returns nothing
local sound s = CreateSound( snd, false, false, false, 127, 127, "" )
call TriggerSleepAction( 0.0 )
call SetSoundVolume( s, 0 )
call StartSound( s )
call KillSoundWhenDone( s )
set s = null
endfunction
//===========================================================================
//Spells
////Spell 1
function SP1push takes nothing returns nothing
local timer tim = GetExpiredTimer()
local integer hand = GetHandleId(tim)
local integer i = LoadInteger(udg_wwS, hand, 0)
local integer j = 1
local unit u
local real face
local real tiempo = LoadReal(udg_wwS, hand, -1)
loop
exitwhen j > i
set u = LoadUnitHandle(udg_wwS, hand, j)
set face = LoadReal(udg_wwS, hand, -1-j)
call SetUnitX(u, GetUnitX(u)+(Cos(face)*(10*(tiempo+0.3))))
call SetUnitY(u, GetUnitY(u)+(Sin(face)*(10*(tiempo+0.3))))
set j = j + 1
endloop
call SaveReal(udg_wwS, hand, -1, tiempo - 0.03)
if tiempo <= 0.03 then
call PauseTimer(tim)
call DestroyTimer(tim)
call FlushChildHashtable(udg_wwS, hand)
endif
set u = null
set tim = null
endfunction
function SP1aux takes nothing returns nothing
local timer tim = GetExpiredTimer()
local timer timpush
local integer i = 0
local integer hand = GetHandleId(tim)
local integer puntero
local unit u
local unit dum = LoadUnitHandle(udg_wwS, hand, 5)
local real x = LoadReal(udg_wwS, hand, 1) + LoadReal(udg_wwS, hand, 3)
local real y = LoadReal(udg_wwS, hand, 2) + LoadReal(udg_wwS, hand, 4)
local boolean control = false
if wwMod(x-GetLocationX(udg_Centro), y-GetLocationY(udg_Centro)) > 830.0 then
set control = true
endif
call SetUnitX(dum, x)
call SetUnitY(dum, y)
call SaveReal(udg_wwS, hand, 1, x)
call SaveReal(udg_wwS, hand, 2, y)
call SetUnitFacing(dum, GetUnitFacing(dum) + 4.0)
call GroupEnumUnitsInRange(udg_wwG, x, y, 60.0, null)
loop
set u = FirstOfGroup(udg_wwG)
exitwhen u == null
call GroupRemoveUnit(udg_wwG, u)
if IsUnitEnemy(u, udg_JUGADOR) and GetUnitState(u, UNIT_STATE_LIFE) > 0 then
set control = true
endif
endloop
if control then
call GroupEnumUnitsInRange(udg_wwG, x, y, 140.0, null)
set timpush = CreateTimer()
set puntero = GetHandleId(timpush)
call SaveReal(udg_wwS, puntero, -1, 0.9)
loop
set u = FirstOfGroup(udg_wwG)
exitwhen u == null
call GroupRemoveUnit(udg_wwG, u)
if IsUnitEnemy(u, udg_JUGADOR) and GetUnitState(u, UNIT_STATE_LIFE) > 0 then
call UnitDamageTarget(udg_Heroe, u, 70.0, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_LIGHTNING, WEAPON_TYPE_WHOKNOWS)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Other\\Cleave\\CleaveDamageTarget.mdl" , u,"chest"))
set i = i + 1
call SaveUnitHandle(udg_wwS, puntero, i, u)
call SaveReal(udg_wwS, puntero, -1-i, Atan2(GetUnitY(u) - y, GetUnitX(u) - x))
endif
endloop
call Sonido3d("Abilities\\Spells\\Human\\StormBolt\\StormBoltLaunch.wav", x, y, 127)
call SaveInteger(udg_wwS, puntero, 0, i)
call TimerStart(timpush, 0.03, true, function SP1push)
call KillUnit(dum)
call PauseTimer(tim)
call DestroyTimer(tim)
call FlushChildHashtable(udg_wwS, hand)
endif
set tim = null
set timpush = null
set dum = null
endfunction
function SP1con takes nothing returns boolean
return GetSpellAbilityId() == 'AAH1'
endfunction
function SP1acc takes nothing returns nothing
local timer tim = CreateTimer()
local integer puntero = GetHandleId(tim)
local real x1 = GetSpellTargetX()
local real y1 = GetSpellTargetY()
local unit u = GetTriggerUnit()
local real x2 = GetUnitX(u)
local real y2 = GetUnitY(u)
local real dist = wwMod(x1-x2,y1-y2)
call SaveReal(udg_wwS, puntero, 1, x2)
call SaveReal(udg_wwS, puntero, 2, y2)
call SaveReal(udg_wwS, puntero, 3, 25*(x1-x2)/dist)
call SaveReal(udg_wwS, puntero, 4, 25*(y1-y2)/dist)
call SaveUnitHandle(udg_wwS, puntero, 5, CreateUnit(udg_JUGADOR, 'us01', x2, y2, 0.0))
call SetUnitTimeScale(LoadUnitHandle(udg_wwS, puntero, 5), 3.0)
call TimerStart(tim, 0.03, true, function SP1aux)
call Sonido3d("Abilities\\Spells\\Undead\\DeathCoil\\DeathCoilMissileLaunch1.wav", x2, y2, 50)
set tim = null
set u = null
endfunction
function SP1ini takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function SP1con ) )
call TriggerAddAction( t, function SP1acc )
call Preload("Abilities\\Spells\\Other\\Cleave\\CleaveDamageTarget.mdl")
call PreloadSound("Abilities\\Spells\\Undead\\DeathCoil\\DeathCoilMissileLaunch1.wav")
call PreloadSound("Abilities\\Spells\\Human\\StormBolt\\StormBoltLaunch.wav")
set t = null
endfunction
////Spell 2
function IsUnitBuffed takes unit u returns boolean
return GetUnitAbilityLevel (u,'BB02') > 0
endfunction
function GetUnitCharges takes unit u returns integer
return LoadInteger(udg_wwHT,GetHandleId(u),0)
endfunction
function SetText takes string str, real x, real y, real z , real fsize , boolean per , real ls , real fp , integer red , integer blue , integer green , integer alpha returns texttag
set bj_lastCreatedTextTag = CreateTextTag()
call SetTextTagText( bj_lastCreatedTextTag, str, fsize * 0.023 / 10)
call SetTextTagPos( bj_lastCreatedTextTag, x , y , z)
call SetTextTagColor( bj_lastCreatedTextTag, red, blue, green, alpha)
call SetTextTagPermanent( bj_lastCreatedTextTag, per)
call SetTextTagLifespan( bj_lastCreatedTextTag, ls)
call SetTextTagFadepoint( bj_lastCreatedTextTag, fp )
return bj_lastCreatedTextTag
endfunction
function Loop takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer id = GetHandleId(t)
local unit u = LoadUnitHandle (udg_wwHT,id,0)
local player p = GetOwningPlayer(u)
local real h = 50 + 50 * GetUnitCharges(u)
local unit f
if not IsUnitBuffed(u) then
call GroupEnumUnitsInRange(bj_lastCreatedGroup,GetUnitX(u),GetUnitY(u),300.0,null)
loop
set f = FirstOfGroup(bj_lastCreatedGroup)
exitwhen f == null
call GroupRemoveUnit(bj_lastCreatedGroup,f)
if IsUnitAlly(f,p) and GetWidgetLife(f) > 0.405 and not IsUnitType(f,UNIT_TYPE_STRUCTURE) and not IsUnitHidden(f) and f != u then
call SetWidgetLife(f, GetWidgetLife(f) + h)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl",f,"origin"))
endif
endloop
call PauseTimer(t)
call DestroyTimer(t)
call FlushChildHashtable (udg_wwHT,id)
call FlushChildHashtable (udg_wwHT,GetHandleId(u))
endif
set t = null
set u = null
set p = null
endfunction
function SpellApply takes nothing returns nothing
local unit u = GetSpellTargetUnit()
local timer t = CreateTimer()
local integer c = GetUnitCharges(u) + 1
local texttag txt
if c == 1 then
call SaveUnitHandle (udg_wwHT,GetHandleId(t),0,u)
call SaveInteger (udg_wwHT,GetHandleId(u),0,1)
call TimerStart(t,0.05,true,function Loop)
elseif c <= 3 then
call SaveInteger (udg_wwHT,GetHandleId(u),0,c)
else
set c = 3
endif
set txt = SetText (I2S(c)+ "!",GetUnitX(u),GetUnitY(u),100,10,false,2.5,1.,0,255,0,255)
call SetTextTagVisibility(txt, GetLocalPlayer()==GetOwningPlayer(u))
set u = null
set t = null
set txt = null
endfunction
function CuracionAct takes nothing returns boolean
if GetSpellAbilityId() == 'AAH2' then
call SpellApply()
endif
return false
endfunction
function SP2ini takes nothing returns nothing
local trigger t = CreateTrigger( )
set udg_wwHT = InitHashtable()
call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition( t, Condition( function CuracionAct ))
set t = null
endfunction
////Spell 3
function SP3push takes nothing returns nothing
local timer tim = GetExpiredTimer()
local integer hand = GetHandleId(tim)
local unit u = LoadUnitHandle(udg_wwS, hand, 3)
local real fuerza = LoadReal(udg_wwS, hand, 2)
local real face = LoadReal(udg_wwS, hand, 1)
call SetUnitX(u, GetUnitX(u)+Cos(face)*fuerza)
call SetUnitY(u, GetUnitY(u)+Sin(face)*fuerza)
call SetUnitFacing(u, face * 180 / bj_PI)
call SaveReal(udg_wwS, hand, 2, fuerza - 0.5)
if fuerza <= 7.0 then
call PauseTimer(tim)
call DestroyTimer(tim)
call FlushChildHashtable(udg_wwS, hand)
endif
set u = null
set tim = null
endfunction
function SP3con takes nothing returns boolean
return GetSpellAbilityId() == 'AAH3'
endfunction
function SP3acc takes nothing returns nothing
local timer tim = CreateTimer()
local integer puntero = GetHandleId(tim)
local unit u = GetTriggerUnit()
call SaveReal(udg_wwS, puntero, 1, (bj_PI/180.0) * GetUnitFacing(u))
call SaveReal(udg_wwS, puntero, 2, 22.0)
call SaveUnitHandle(udg_wwS, puntero, 3, u)
call TimerStart(tim, 0.03, true, function SP3push)
call IssueImmediateOrder( u, "stop" )
set tim = null
set u = null
endfunction
function SP3ini takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function SP3con ) )
call TriggerAddAction( t, function SP3acc )
set t = null
endfunction
////Spell 4
function wwFilt takes nothing returns boolean
return GetFilterUnit()!= udg_wwU and GetWidgetLife(GetFilterUnit())>.405 and IsUnitEnemy(GetFilterUnit(),GetOwningPlayer( udg_wwU)) and not IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE)
endfunction
function wwCondicion takes nothing returns boolean
return GetSpellAbilityId() == 'AAH4'
endfunction
function AddFlyUnit takes unit u returns nothing
call UnitAddAbility(u,'Amrf')
call UnitRemoveAbility(u,'Amrf')
endfunction
function wwCallback takes nothing returns boolean
local unit a
local unit dum
local real x
local real y
local real xa
local real ya
local real xl
local real yl
local real ang
local real cos
local real sin
local sound sonido
local real porcent
//STRUCT
local timer t = GetExpiredTimer()
local integer hand = GetHandleId(t)
//
local real dx = LoadReal(udg_wwAH, hand, 1)
local real dy = LoadReal(udg_wwAH, hand, 2)
local real dxt = LoadReal(udg_wwAH, hand, 3)
local real dyt = LoadReal(udg_wwAH, hand, 4)
local real dxd = LoadReal(udg_wwAH, hand, 5)
local real dyd = LoadReal(udg_wwAH, hand, 6)
local real dxv = LoadReal(udg_wwAH, hand, 7)
local real dyv = LoadReal(udg_wwAH, hand, 8)
local real dang = LoadReal(udg_wwAH, hand, 9)
local real dang2 = LoadReal(udg_wwAH, hand, 10)
local real dcos = LoadReal(udg_wwAH, hand, 11)
local real dsin = LoadReal(udg_wwAH, hand, 12)
local real dmtime = LoadReal(udg_wwAH, hand, 13)
local real dctime = LoadReal(udg_wwAH, hand, 14)
local real daceleration = LoadReal(udg_wwAH, hand, 15)
local real ddamage = LoadReal(udg_wwAH, hand, 16)
local real dspeed = LoadReal(udg_wwAH, hand, 17)
local real dpercent = LoadReal(udg_wwAH, hand, 18)
local unit du = LoadUnitHandle(udg_wwAH, hand, 19)
local unit dtarg = LoadUnitHandle(udg_wwAH, hand, 20)
local unit ddummy = LoadUnitHandle(udg_wwAH, hand, 21)
local boolean dactive = LoadBoolean(udg_wwAH, hand, 22)
set dctime=dctime+0.04
set dxd = GetUnitX(ddummy)
set dyd = GetUnitY(ddummy)
if dtarg != null and GetWidgetLife(dtarg)>.405 then
set dang = Atan2(GetUnitY(dtarg)-dyd,GetUnitX(dtarg)-dxd)*bj_RADTODEG
endif
call SetUnitFacing(ddummy,dang)
//MACRO DE VELOCIDAD INICIO
set porcent = 0
if dtarg != null and GetWidgetLife(dtarg)>.405 then
set udg_wwL = GetUnitLoc(ddummy)
set udg_wwLL = GetUnitLoc(dtarg)
if GetLocationX( udg_wwL) < GetLocationX( udg_wwLL) then
set dxv = ( dxv + daceleration/2)
else
set dxv = ( dxv - daceleration/2)
endif
if ( GetLocationY( udg_wwL) < GetLocationY( udg_wwLL) ) then
set dyv = ( dyv + daceleration/2)
else
set dyv = ( dyv - daceleration/2)
endif
call RemoveLocation( udg_wwL)
call RemoveLocation( udg_wwLL)
else
set dxv = dxv + daceleration*Cos(dang*bj_DEGTORAD)
set dyv = dyv + daceleration*Sin(dang*bj_DEGTORAD)
endif
set dxv = dxv + (dspeed*dpercent-dspeed)*Cos(dang*bj_DEGTORAD)
set dyv = dyv + (dspeed*dpercent-dspeed)*Sin(dang*bj_DEGTORAD)
if RAbsBJ(dxv) > 28 or RAbsBJ(dyv) > 28 then
if ( dxv > 28) or ( dxv < -28) then
set porcent = RAbsBJ(dxv/28)-1.00
set dxv = dxv - dxv*porcent
set dyv = dyv - dyv*porcent
endif
if ( dyv > 28) or ( dyv < -28) then
set porcent = RAbsBJ(dyv/28)-1.00
set dxv = dxv - dxv*porcent
set dyv = dyv - dyv*porcent
endif
endif
//MACRO DE VELOCIDAD FIN
set x = dxd+dxv
set y = dyd+dyv
if IsTerrainPathable(x,y, PATHING_TYPE_WALKABILITY) == true then
set dang2 = Atan2(y-dyd,x-dxd)*bj_RADTODEG
set dang = -dang2
set dcos = Cos(dang*bj_DEGTORAD)
set dsin = Sin(dang*bj_DEGTORAD)
set dxv = 0
set dyv = 0
//MACRO DE VELOCIDAD INICIO
set porcent = 0
if dtarg != null and GetWidgetLife(dtarg)>.405 then
set udg_wwL = GetUnitLoc(ddummy)
set udg_wwLL = GetUnitLoc(dtarg)
if GetLocationX( udg_wwL) < GetLocationX( udg_wwLL) then
set dxv = ( dxv + daceleration/2)
else
set dxv = ( dxv - daceleration/2)
endif
if ( GetLocationY( udg_wwL) < GetLocationY( udg_wwLL) ) then
set dyv = ( dyv + daceleration/2)
else
set dyv = ( dyv - daceleration/2)
endif
call RemoveLocation( udg_wwL)
call RemoveLocation( udg_wwLL)
else
set dxv = dxv + daceleration*Cos(dang*bj_DEGTORAD)
set dyv = dyv + daceleration*Sin(dang*bj_DEGTORAD)
endif
set dxv = dxv + (dspeed*dpercent-dspeed)*Cos(dang*bj_DEGTORAD)
set dyv = dyv + (dspeed*dpercent-dspeed)*Sin(dang*bj_DEGTORAD)
if RAbsBJ(dxv) > 28 or RAbsBJ(dyv) > 28 then
if ( dxv > 28) or ( dxv < -28) then
set porcent = RAbsBJ(dxv/28)-1.00
set dxv = dxv - dxv*porcent
set dyv = dyv - dyv*porcent
endif
if ( dyv > 28) or ( dyv < -28) then
set porcent = RAbsBJ(dyv/28)-1.00
set dxv = dxv - dxv*porcent
set dyv = dyv - dyv*porcent
endif
endif
//MACRO DE VELOCIDAD FIN
set x = dxd+dxv
set y = dyd+dyv
if IsTerrainPathable(x,y, PATHING_TYPE_WALKABILITY) == true then
set dang = dang - 180.
set dcos = Cos(dang*bj_DEGTORAD)
set dsin = Sin(dang*bj_DEGTORAD)
set dxv = 0
set dyv = 0
//MACRO DE VELOCIDAD INICIO
set porcent = 0
if dtarg != null and GetWidgetLife(dtarg)>.405 then
set udg_wwL = GetUnitLoc(ddummy)
set udg_wwLL = GetUnitLoc(dtarg)
if GetLocationX( udg_wwL) < GetLocationX( udg_wwLL) then
set dxv = ( dxv + daceleration/2)
else
set dxv = ( dxv - daceleration/2)
endif
if ( GetLocationY( udg_wwL) < GetLocationY( udg_wwLL) ) then
set dyv = ( dyv + daceleration/2)
else
set dyv = ( dyv - daceleration/2)
endif
call RemoveLocation( udg_wwL)
call RemoveLocation( udg_wwLL)
else
set dxv = dxv + daceleration*Cos(dang*bj_DEGTORAD)
set dyv = dyv + daceleration*Sin(dang*bj_DEGTORAD)
endif
set dxv = dxv + (dspeed*dpercent-dspeed)*Cos(dang*bj_DEGTORAD)
set dyv = dyv + (dspeed*dpercent-dspeed)*Sin(dang*bj_DEGTORAD)
if RAbsBJ(dxv) > 28 or RAbsBJ(dyv) > 28 then
if ( dxv > 28) or ( dxv < -28) then
set porcent = RAbsBJ(dxv/28)-1.00
set dxv = dxv - dxv*porcent
set dyv = dyv - dyv*porcent
endif
if ( dyv > 28) or ( dyv < -28) then
set porcent = RAbsBJ(dyv/28)-1.00
set dxv = dxv - dxv*porcent
set dyv = dyv - dyv*porcent
endif
endif
//MACRO DE VELOCIDAD FIN
set x = dxd+dxv
set y = dyd+dyv
if IsTerrainPathable(x,y, PATHING_TYPE_WALKABILITY) == true then
set dang = -dang
set dcos = Cos(dang*bj_DEGTORAD)
set dsin = Sin(dang*bj_DEGTORAD)
set dxv = 0
set dyv = 0
//MACRO DE VELOCIDAD INICIO
set porcent = 0
if dtarg != null and GetWidgetLife(dtarg)>.405 then
set udg_wwL = GetUnitLoc(ddummy)
set udg_wwLL = GetUnitLoc(dtarg)
if GetLocationX( udg_wwL) < GetLocationX( udg_wwLL) then
set dxv = ( dxv + daceleration/2)
else
set dxv = ( dxv - daceleration/2)
endif
if ( GetLocationY( udg_wwL) < GetLocationY( udg_wwLL) ) then
set dyv = ( dyv + daceleration/2)
else
set dyv = ( dyv - daceleration/2)
endif
call RemoveLocation( udg_wwL)
call RemoveLocation( udg_wwLL)
else
set dxv = dxv + daceleration*Cos(dang*bj_DEGTORAD)
set dyv = dyv + daceleration*Sin(dang*bj_DEGTORAD)
endif
set dxv = dxv + (dspeed*dpercent-dspeed)*Cos(dang*bj_DEGTORAD)
set dyv = dyv + (dspeed*dpercent-dspeed)*Sin(dang*bj_DEGTORAD)
if RAbsBJ(dxv) > 28 or RAbsBJ(dyv) > 28 then
if ( dxv > 28) or ( dxv < -28) then
set porcent = RAbsBJ(dxv/28)-1.00
set dxv = dxv - dxv*porcent
set dyv = dyv - dyv*porcent
endif
if ( dyv > 28) or ( dyv < -28) then
set porcent = RAbsBJ(dyv/28)-1.00
set dxv = dxv - dxv*porcent
set dyv = dyv - dyv*porcent
endif
endif
//MACRO DE VELOCIDAD FIN
set x = dxd+dxv
set y = dyd+dyv
endif
endif
endif
if dctime > 5.0 or dactive == true or IsTerrainPathable(x,y,PATHING_TYPE_WALKABILITY) == true then
if dactive == false then
set dum = CreateUnitAtLoc(GetOwningPlayer(du), 'e001', GetUnitLoc(ddummy), GetUnitFacing(du))
call SetUnitScale(dum,1.5,1.5,1.5)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\Mortar\\MortarMissile.mdl",dum,"origin"))
call DestroyEffect(AddSpecialEffectTarget("war3mapImported\\ExplodeGroundEX.mdx",dum,"origin"))
call UnitApplyTimedLife(dum,'e001',1.2)
set dum = null
endif
set dtarg = null
call KillUnit(ddummy)
call RemoveUnit(ddummy)
call PauseTimer(t)
call DestroyTimer(t)
call FlushChildHashtable(udg_wwAH, hand)
return true
else
call SetUnitX(ddummy,x)
call SetUnitY(ddummy,y)
if dtarg == null or GetWidgetLife(dtarg)<=.405 then
call GroupClear( udg_wwG)
call GroupEnumUnitsInRange( udg_wwG,GetUnitX(ddummy),GetUnitY(ddummy),380,Condition(function wwFilt))
if FirstOfGroup( udg_wwG) != null then
set sonido = CreateSound("war3mapImported\\Homing.wav",false, false, false, 10, 10, "DefaultEAXON")
call AttachSoundToUnit(sonido, du)
call SetSoundVolume(sonido, 127)
call StartSound(sonido)
call KillSoundWhenDone(sonido)
set dtarg = FirstOfGroup( udg_wwG)
call DestroyEffect(AddSpecialEffectTarget("UI\\Feedback\\TargetPreSelected\\TargetPreSelected.mdl",dtarg,"origin"))
call DestroyEffect(AddSpecialEffectTarget("UI\\Feedback\\Confirmation\\Confirmation.mdl",dtarg,"overhead"))
endif
endif
call GroupClear( udg_wwG)
call GroupEnumUnitsInRange( udg_wwG,GetUnitX(ddummy),GetUnitY(ddummy),125,Condition(function wwFilt))
if FirstOfGroup( udg_wwG) != null then
call GroupClear( udg_wwG)
call GroupEnumUnitsInRange( udg_wwG,GetUnitX(ddummy),GetUnitY(ddummy),280,Condition(function wwFilt))
loop
set a = FirstOfGroup( udg_wwG)
call GroupRemoveUnit( udg_wwG,a)
exitwhen a == null
set xa = GetUnitX(a)
set ya = GetUnitY(a)
set ang = Atan2(dyd-ya,dxd-xa)
set cos = Cos(ang)
set sin = Sin(ang)
set xl = (xa-dspeed*cos)
set yl = (ya-dspeed*sin)
call UnitDamageTarget(du,a,200.0,false,false,ATTACK_TYPE_MAGIC,DAMAGE_TYPE_MAGIC,null)
if IsTerrainPathable(xl,yl, PATHING_TYPE_WALKABILITY) != true then
call SetUnitPosition(a,xl,yl)//Un empuje que se da a la unidad por la explosion
endif
endloop
set dum = CreateUnitAtLoc(GetOwningPlayer(du), 'e001', GetUnitLoc(ddummy), GetUnitFacing(du))
call SetUnitScale(dum,1.5,1.5,1.5)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\Mortar\\MortarMissile.mdl",dum,"origin"))
call DestroyEffect(AddSpecialEffectTarget("war3mapImported\\ExplodeGroundEX.mdx",dum,"origin"))
call UnitApplyTimedLife(dum,'e001',1.2)
set dum = null
set dactive = true
endif
if daceleration < 10.0 then
set daceleration = daceleration + 0.05//Acumulacion de aceleracion
endif
if dspeed < 18.0 then
set dspeed = dspeed*dpercent//Acumulacion de velocidad
endif
endif
set sonido = null
set t = null
call SaveReal(udg_wwAH, hand, 1, dx)
call SaveReal(udg_wwAH, hand, 2, dy)
call SaveReal(udg_wwAH, hand, 3, dxt)
call SaveReal(udg_wwAH, hand, 4, dyt)
call SaveReal(udg_wwAH, hand, 5, dxd)
call SaveReal(udg_wwAH, hand, 6, dyd)
call SaveReal(udg_wwAH, hand, 7, dxv)
call SaveReal(udg_wwAH, hand, 8, dyv)
call SaveReal(udg_wwAH, hand, 9, dang)
call SaveReal(udg_wwAH, hand, 10, dang2)
call SaveReal(udg_wwAH, hand, 11, dcos)
call SaveReal(udg_wwAH, hand, 12, dsin)
call SaveReal(udg_wwAH, hand, 13, dmtime)
call SaveReal(udg_wwAH, hand, 14, dctime)
call SaveReal(udg_wwAH, hand, 15, daceleration)
call SaveReal(udg_wwAH, hand, 16, ddamage)
call SaveReal(udg_wwAH, hand, 17, dspeed)
call SaveReal(udg_wwAH, hand, 18, dpercent)
call SaveUnitHandle(udg_wwAH, hand, 19, du)
set du = null
call SaveUnitHandle(udg_wwAH, hand, 20, dtarg)
set dtarg = null
call SaveUnitHandle(udg_wwAH, hand, 21, ddummy)
set ddummy = null
call SaveBoolean(udg_wwAH, hand, 22, dactive)
return false
endfunction
function StartPaloma takes unit u, unit targ, real ang, integer hand returns nothing
local sound sonido
local unit du = u
local unit dtarg = targ
local real dx = GetUnitX(du)
local real dy = GetUnitY(du)
local real dang = ang*bj_RADTODEG
local real dcos = Cos(dang*bj_DEGTORAD)
local real dsin = Sin(dang*bj_DEGTORAD)
local real dspeed =7//Velocidad inicial del misil
local real dpercent =1.02//Porcentage que aumentara el misil durante el trnascurso del tiempo
local real dxv = dspeed*Cos(dang*bj_DEGTORAD)
local real dyv = dspeed*Sin(dang*bj_DEGTORAD)
local unit ddummy = CreateUnit(GetOwningPlayer(du),'e001',dx,dy,dang)
local real dxd = GetUnitX(ddummy)
local real dyd = GetUnitY(ddummy)
set udg_wwU = du
call SetUnitScale(ddummy,2.1,2.1,2.1)
call AddSpecialEffectTarget("units\\critters\\SnowOwl\\SnowOwl.mdl",ddummy,"origin")
call SetUnitVertexColor(ddummy,150,150,255,255)
call SetUnitFlyHeight(ddummy,50.,0)
call AddFlyUnit(ddummy)
set sonido=CreateSound("war3mapImported\\Paloma.WAV",false, false, false, 10, 10, "DefaultEAXON")
call AttachSoundToUnit(sonido, du)
call SetSoundVolume(sonido, 77)
call StartSound(sonido)
call KillSoundWhenDone(sonido)
set sonido = null
call SaveReal(udg_wwAH, hand, 1, dx)
call SaveReal(udg_wwAH, hand, 2, dy)
call SaveReal(udg_wwAH, hand, 5, dxd)
call SaveReal(udg_wwAH, hand, 6, dyd)
call SaveReal(udg_wwAH, hand, 7, dxv)
call SaveReal(udg_wwAH, hand, 8, dyv)
call SaveReal(udg_wwAH, hand, 9, dang)
call SaveReal(udg_wwAH, hand, 11, dcos)
call SaveReal(udg_wwAH, hand, 12, dsin)
call SaveReal(udg_wwAH, hand, 17, dspeed)
call SaveReal(udg_wwAH, hand, 18, dpercent)
call SaveUnitHandle(udg_wwAH, hand, 19, du)
set du = null
call SaveUnitHandle(udg_wwAH, hand, 20, dtarg)
set dtarg = null
call SaveUnitHandle(udg_wwAH, hand, 21, ddummy)
set ddummy = null
endfunction
function Paloma_Bomba takes nothing returns nothing
local unit u
local unit targ
local real x
local real y
local real xl
local real yl
local real ang
local timer t = CreateTimer()
set u = GetTriggerUnit()
set targ = GetSpellTargetUnit()
set udg_wwL = GetSpellTargetLoc()
set x = GetUnitX(u)
set y = GetUnitY(u)
set xl = GetLocationX( udg_wwL)
set yl = GetLocationY( udg_wwL)
set ang = Atan2(yl-y,xl-x)
call RemoveLocation( udg_wwL)
call DestroyEffect(AddSpecialEffect("UI\\Feedback\\Confirmation\\Confirmation.mdl",xl,yl))
call StartPaloma(u,targ,ang,GetHandleId(t))
call TimerStart(t, 0.04, true, function wwCallback)
set targ = null
set u = null
set t = null
endfunction
function SP4ini takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t,Filter(function wwCondicion))
call TriggerAddAction(t,function Paloma_Bomba)
set udg_wwAH = InitHashtable()
call Preload("units\\critters\\SnowOwl\\SnowOwl.mdl")
call Preload("UI\\Feedback\\TargetPreSelected\\TargetPreSelected.mdl")
call Preload("UI\\Feedback\\Confirmation\\Confirmation.mdl")
call Preload("Abilities\\Weapons\\Mortar\\MortarMissile.mdl")
call Preload("war3mapImported\\ExplodeGroundEX.mdx")
call PreloadSound("war3mapImported\\Paloma.WAV")
call PreloadSound("war3mapImported\\Homing.wav")
set t = null
endfunction
//===========================================================================
//Funciones de Terreno
function wwRellenarFila takes integer fila, integer terreno, integer c1, integer c2, integer c3, integer c4, integer c5, integer c6, integer c7, integer c8, integer c9, integer c10, integer c11, integer c12, integer c13, integer c14, integer c15 returns nothing
local integer filareal = terreno * 15 + fila
call SaveInteger(udg_wwT, filareal, 1, c1)
call SaveInteger(udg_wwT, filareal, 2, c2)
call SaveInteger(udg_wwT, filareal, 3, c3)
call SaveInteger(udg_wwT, filareal, 4, c4)
call SaveInteger(udg_wwT, filareal, 5, c5)
call SaveInteger(udg_wwT, filareal, 6, c6)
call SaveInteger(udg_wwT, filareal, 7, c7)
call SaveInteger(udg_wwT, filareal, 8, c8)
call SaveInteger(udg_wwT, filareal, 9, c9)
call SaveInteger(udg_wwT, filareal, 10, c10)
call SaveInteger(udg_wwT, filareal, 11, c11)
call SaveInteger(udg_wwT, filareal, 12, c12)
call SaveInteger(udg_wwT, filareal, 13, c13)
call SaveInteger(udg_wwT, filareal, 14, c14)
call SaveInteger(udg_wwT, filareal, 15, c15)
endfunction
function wwTerrenos takes nothing returns nothing
local integer X0 = 0
local integer t1
local integer t2
local integer t3
local integer t4
local integer t5
local integer t6
local integer t7
local integer t8
local integer t9
local integer ter
//TERRENO 0 (ARENA)
set t1 = 'Zdrt' //Tierra Ruinas sumergidas
set t2 = 'Zdtr' //Tierra agreste Ruinas sumergidas
set t3 = 'Zsan' //Arena Ruinas sumergidas
set ter = 0
call SaveInteger(udg_wwT, 0, ter, 'LRaa') //Rayos de luz
//...........................01.02.03.04.05.06.07.08.09.10.11.12.13.14.15
call wwRellenarFila( 1, ter, X0,X0,X0,X0,X0,X0,X0,t1,X0,X0,X0,X0,X0,X0,X0)
call wwRellenarFila( 2, ter, X0,X0,X0,X0,t2,t2,t2,t2,t1,t1,t3,X0,X0,X0,X0)
call wwRellenarFila( 3, ter, X0,X0,X0,t2,t2,t2,t2,t2,t2,t1,t1,t3,X0,X0,X0)
call wwRellenarFila( 4, ter, X0,X0,t2,t2,t3,t2,t2,t2,t2,t3,t1,t1,t3,X0,X0)
call wwRellenarFila( 5, ter, X0,t2,t3,t2,t2,t2,t2,t2,t2,t2,t2,t1,t3,t2,X0)
call wwRellenarFila( 6, ter, X0,t2,t2,t2,t2,t2,t1,t2,t2,t2,t2,t1,t2,t2,X0)
call wwRellenarFila( 7, ter, X0,t2,t2,t2,t2,t1,t2,t2,t2,t2,t2,t2,t2,t2,X0)
call wwRellenarFila( 8, ter, t3,t2,t2,t3,t2,t2,t3,t2,t1,t2,t2,t2,t2,t2,t2)
call wwRellenarFila( 9, ter, X0,t2,t2,t3,t1,t3,t3,t3,t3,t2,t2,t3,t3,t2,X0)
call wwRellenarFila(10, ter, X0,t1,t2,t2,t3,t3,t3,t1,t3,t2,t2,t2,t2,t2,X0)
call wwRellenarFila(11, ter, X0,t1,t3,t2,t2,t1,t1,t1,t2,t2,t2,t2,t2,t3,X0)
call wwRellenarFila(12, ter, X0,X0,t2,t2,t2,t2,t3,t3,t2,t2,t1,t1,t2,X0,X0)
call wwRellenarFila(13, ter, X0,X0,X0,t3,t2,t2,t2,t2,t2,t2,t1,t1,X0,X0,X0)
call wwRellenarFila(14, ter, X0,X0,X0,X0,t1,t3,t2,t2,t2,t2,t2,X0,X0,X0,X0)
call wwRellenarFila(15, ter, X0,X0,X0,X0,X0,X0,X0,t1,X0,X0,X0,X0,X0,X0,X0)
//TERRENO 1 (HIERBA)
set t1 = 'Agrs' //Hierba Ashenvale
set t2 = 'Zdrg' //Tierra con hierba Ruinas sumergidas
set t3 = 'Agrd' //Hierba desigual Ashenvale
set ter = 1
call SaveInteger(udg_wwT, 0, ter, 'RLlr') //Lluvia ligera
//...........................01.02.03.04.05.06.07.08.09.10.11.12.13.14.15
call wwRellenarFila( 1, ter, X0,X0,X0,X0,X0,X0,X0,t1,X0,X0,X0,X0,X0,X0,X0)
call wwRellenarFila( 2, ter, X0,X0,X0,X0,t2,t2,t2,t3,t2,t1,t3,X0,X0,X0,X0)
call wwRellenarFila( 3, ter, X0,X0,X0,t2,t2,t2,t3,t3,t2,t1,t1,t3,X0,X0,X0)
call wwRellenarFila( 4, ter, X0,X0,t3,t2,t3,t2,t1,t1,t3,t3,t1,t1,t3,X0,X0)
call wwRellenarFila( 5, ter, X0,t2,t3,t2,t2,t1,t2,t1,t1,t1,t2,t1,t3,t2,X0)
call wwRellenarFila( 6, ter, X0,t1,t1,t2,t1,t2,t1,t2,t1,t2,t2,t1,t2,t2,X0)
call wwRellenarFila( 7, ter, X0,t1,t2,t2,t2,t1,t2,t2,t2,t3,t3,t2,t2,t2,X0)
call wwRellenarFila( 8, ter, t3,t2,t2,t3,t2,t2,t3,t3,t1,t2,t2,t2,t1,t3,t3)
call wwRellenarFila( 9, ter, X0,t2,t2,t3,t1,t3,t2,t3,t3,t2,t2,t3,t3,t3,X0)
call wwRellenarFila(10, ter, X0,t1,t2,t2,t3,t3,t3,t1,t3,t2,t1,t2,t2,t2,X0)
call wwRellenarFila(11, ter, X0,t1,t3,t2,t2,t1,t2,t1,t1,t3,t3,t2,t2,t3,X0)
call wwRellenarFila(12, ter, X0,X0,t2,t2,t2,t2,t3,t3,t2,t2,t1,t1,t3,X0,X0)
call wwRellenarFila(13, ter, X0,X0,X0,t3,t3,t2,t2,t2,t2,t2,t1,t1,X0,X0,X0)
call wwRellenarFila(14, ter, X0,X0,X0,X0,t1,t3,t2,t2,t1,t3,t2,X0,X0,X0,X0)
call wwRellenarFila(15, ter, X0,X0,X0,X0,X0,X0,X0,t1,X0,X0,X0,X0,X0,X0,X0)
//TERRENO 2 (CORONA DE HIELO)
set t1 = 'Idki' //Hielo oscuro Corona de hielo
set t2 = 'Nsnr' //Nieve rocosa Northrend
set t3 = 'Iice' //Hielo Corona de hielo
set t4 = 'Nsnw' //Nieve Northrend
set ter = 2
call SaveInteger(udg_wwT, 0, ter, 'SNls') //Nevada ligera
//...........................01.02.03.04.05.06.07.08.09.10.11.12.13.14.15
call wwRellenarFila( 1, ter, X0,X0,X0,X0,X0,X0,X0,t1,X0,X0,X0,X0,X0,X0,X0)
call wwRellenarFila( 2, ter, X0,X0,X0,X0,t4,t2,t2,t4,t1,t1,t3,X0,X0,X0,X0)
call wwRellenarFila( 3, ter, X0,X0,X0,t2,t2,t4,t4,t2,t4,t1,t1,t3,X0,X0,X0)
call wwRellenarFila( 4, ter, X0,X0,t2,t2,t3,t2,t2,t2,t2,t3,t1,t1,t3,X0,X0)
call wwRellenarFila( 5, ter, X0,t2,t3,t2,t2,t4,t2,t2,t4,t2,t2,t1,t3,t2,X0)
call wwRellenarFila( 6, ter, X0,t4,t2,t4,t2,t2,t1,t4,t4,t2,t2,t1,t2,t2,X0)
call wwRellenarFila( 7, ter, X0,t4,t4,t2,t2,t1,t2,t2,t4,t2,t2,t2,t2,t4,X0)
call wwRellenarFila( 8, ter, t3,t2,t4,t3,t2,t4,t3,t2,t1,t2,t2,t2,t4,t2,t2)
call wwRellenarFila( 9, ter, X0,t4,t4,t3,t1,t3,t3,t3,t3,t2,t2,t3,t3,t4,X0)
call wwRellenarFila(10, ter, X0,t1,t4,t2,t3,t3,t3,t1,t3,t4,t2,t2,t4,t2,X0)
call wwRellenarFila(11, ter, X0,t1,t3,t4,t2,t1,t1,t1,t2,t2,t2,t2,t2,t3,X0)
call wwRellenarFila(12, ter, X0,X0,t2,t2,t4,t4,t3,t3,t2,t4,t1,t1,t2,X0,X0)
call wwRellenarFila(13, ter, X0,X0,X0,t3,t2,t2,t4,t2,t4,t4,t1,t1,X0,X0,X0)
call wwRellenarFila(14, ter, X0,X0,X0,X0,t1,t3,t2,t4,t2,t2,t2,X0,X0,X0,X0)
call wwRellenarFila(15, ter, X0,X0,X0,X0,X0,X0,X0,t1,X0,X0,X0,X0,X0,X0,X0)
//TERRENO 3 (INFIERNO)
set t1 = 'Ddrt'//1264874100
set t2 = 'Kfsl'//1265005420
set t3 = 'Kdkt'//1264872308
set t4 = 'Dlvc'//1147958883
set t5 = 'Ddkr'//1147431794
set t6 = 'Dgrs'//1147630195
set ter = 3
call SaveInteger(udg_wwT, 0, ter, 'FDrh') //Niebla roja
//...........................01.02.03.04.05.06.07.08.09.10.11.12.13.14.15
call wwRellenarFila( 1, ter, X0,X0,X0,X0,X0,X0,X0,t6,X0,X0,X0,X0,X0,X0,X0)
call wwRellenarFila( 2, ter, X0,X0,X0,X0,t6,t6,t6,t6,t6,t6,t4,X0,X0,X0,X0)
call wwRellenarFila( 3, ter, X0,X0,X0,t6,t6,t5,t5,t5,t5,t5,t6,t4,X0,X0,X0)
call wwRellenarFila( 4, ter, X0,X0,t6,t6,t4,t5,t4,t4,t1,t5,t5,t6,t6,X0,X0)
call wwRellenarFila( 5, ter, X0,t6,t6,t5,t5,t2,t2,t4,t4,t4,t5,t5,t6,t6,X0)
call wwRellenarFila( 6, ter, X0,t6,t5,t2,t1,t4,t4,t1,t1,t1,t4,t5,t4,t6,X0)
call wwRellenarFila( 7, ter, X0,t6,t2,t5,t4,t4,t1,t3,t1,t2,t1,t5,t5,t6,X0)
call wwRellenarFila( 8, ter, t6,t6,t5,t5,t4,t1,t3,t4,t3,t1,t1,t1,t5,t6,t6)
call wwRellenarFila( 9, ter, X0,t6,t5,t2,t4,t4,t2,t3,t2,t1,t4,t5,t5,t6,X0)
call wwRellenarFila(10, ter, X0,t6,t5,t5,t1,t2,t4,t1,t4,t4,t4,t5,t5,t1,X0)
call wwRellenarFila(11, ter, X0,t6,t6,t5,t5,t1,t4,t1,t4,t4,t5,t5,t6,t1,X0)
call wwRellenarFila(12, ter, X0,X0,t6,t6,t4,t4,t5,t5,t5,t5,t1,t6,t1,X0,X0)
call wwRellenarFila(13, ter, X0,X0,X0,t6,t6,t5,t5,t5,t5,t5,t6,t6,X0,X0,X0)
call wwRellenarFila(14, ter, X0,X0,X0,X0,t1,t6,t6,t6,t6,t6,t6,X0,X0,X0,X0)
call wwRellenarFila(15, ter, X0,X0,X0,X0,X0,X0,X0,t6,X0,X0,X0,X0,X0,X0,X0)
//TERRENO 4 (VENENO)
set t1 = 'Cgrs'//hierba
set t2 = 'Crck'//roca
set t3 = 'Cgrs'//
set t4 = 'Cvin'//vides
set t5 = 'Clvg'//hojas
set t6 = 'Cpos'//veneno
set ter = 4
call SaveInteger(udg_wwT, 0, ter, 'FDgh') //Niebla roja
//...........................01.02.03.04.05.06.07.08.09.10.11.12.13.14.15
call wwRellenarFila( 1, ter, X0,X0,X0,X0,X0,X0,X0,t6,X0,X0,X0,X0,X0,X0,X0)
call wwRellenarFila( 2, ter, X0,X0,X0,X0,t6,t6,t6,t6,t6,t6,t4,X0,X0,X0,X0)
call wwRellenarFila( 3, ter, X0,X0,X0,t6,t6,t5,t5,t5,t5,t5,t6,t4,X0,X0,X0)
call wwRellenarFila( 4, ter, X0,X0,t6,t6,t4,t5,t4,t4,t1,t5,t5,t6,t6,X0,X0)
call wwRellenarFila( 5, ter, X0,t6,t6,t5,t5,t2,t2,t4,t4,t4,t5,t5,t6,t6,X0)
call wwRellenarFila( 6, ter, X0,t6,t5,t2,t1,t4,t4,t1,t1,t1,t4,t5,t4,t6,X0)
call wwRellenarFila( 7, ter, X0,t6,t2,t5,t4,t4,t1,t3,t1,t2,t1,t5,t5,t6,X0)
call wwRellenarFila( 8, ter, t6,t6,t5,t5,t4,t1,t3,t4,t3,t1,t1,t1,t5,t6,t6)
call wwRellenarFila( 9, ter, X0,t6,t5,t2,t4,t4,t2,t3,t2,t1,t4,t5,t5,t6,X0)
call wwRellenarFila(10, ter, X0,t6,t5,t5,t1,t2,t4,t1,t4,t4,t4,t5,t5,t1,X0)
call wwRellenarFila(11, ter, X0,t6,t6,t5,t5,t1,t4,t1,t4,t4,t5,t5,t6,t1,X0)
call wwRellenarFila(12, ter, X0,X0,t6,t6,t4,t4,t5,t5,t5,t5,t1,t6,t1,X0,X0)
call wwRellenarFila(13, ter, X0,X0,X0,t6,t6,t5,t5,t5,t5,t5,t6,t6,X0,X0,X0)
call wwRellenarFila(14, ter, X0,X0,X0,X0,t1,t6,t6,t6,t6,t6,t6,X0,X0,X0,X0)
call wwRellenarFila(15, ter, X0,X0,X0,X0,X0,X0,X0,t6,X0,X0,X0,X0,X0,X0,X0)
//TERRENO 5 (CIUDAD)
set t1 = 'Yblm'//
set t2 = 'Ybtl'//
set t3 = 'Yrtl'//
set t4 = 'Ywmb'//
set ter = 5
call SaveInteger(udg_wwT, 0, ter, 'LRma') //Rayos de luna
//...........................01.02.03.04.05.06.07.08.09.10.11.12.13.14.15
call wwRellenarFila( 1, ter, X0,X0,X0,X0,X0,X0,X0,t4,X0,X0,X0,X0,X0,X0,X0)
call wwRellenarFila( 2, ter, X0,X0,X0,X0,t1,t2,t1,t4,t1,t2,t1,X0,X0,X0,X0)
call wwRellenarFila( 3, ter, X0,X0,X0,t1,t3,t1,t3,t4,t3,t1,t3,t1,X0,X0,X0)
call wwRellenarFila( 4, ter, X0,X0,t1,t2,t1,t2,t1,t4,t1,t2,t1,t2,t1,X0,X0)
call wwRellenarFila( 5, ter, X0,t1,t3,t1,t3,t1,t3,t4,t3,t1,t3,t1,t3,t1,X0)
call wwRellenarFila( 6, ter, X0,t2,t1,t2,t1,t2,t1,t4,t1,t2,t1,t2,t1,t2,X0)
call wwRellenarFila( 7, ter, X0,t1,t3,t1,t3,t1,t3,t4,t3,t1,t3,t1,t3,t1,X0)
call wwRellenarFila( 8, ter, t4,t4,t4,t4,t4,t4,t4,t1,t4,t4,t4,t4,t4,t4,t4)
call wwRellenarFila( 9, ter, X0,t1,t3,t1,t3,t1,t3,t4,t3,t1,t3,t1,t3,t1,X0)
call wwRellenarFila(10, ter, X0,t2,t1,t2,t1,t2,t1,t4,t1,t2,t1,t2,t1,t2,X0)
call wwRellenarFila(11, ter, X0,t1,t3,t1,t3,t1,t3,t4,t3,t1,t3,t1,t3,t1,X0)
call wwRellenarFila(12, ter, X0,X0,t1,t2,t1,t2,t1,t4,t1,t2,t1,t2,t1,X0,X0)
call wwRellenarFila(13, ter, X0,X0,X0,t1,t3,t1,t3,t4,t3,t1,t3,t1,X0,X0,X0)
call wwRellenarFila(14, ter, X0,X0,X0,X0,t1,t2,t1,t4,t1,t2,t1,X0,X0,X0,X0)
call wwRellenarFila(15, ter, X0,X0,X0,X0,X0,X0,X0,t4,X0,X0,X0,X0,X0,X0,X0)
//TERRENO 6 (LOCURA)
set t1 = 'Oaby'//
set t2 = 'Oaby'//
set t3 = 'Oaby'//
set t4 = 'Oaby'//
set ter = 6
call SaveInteger(udg_wwT, 0, ter, 'FDbl') //Niebla Azul
//...........................01.02.03.04.05.06.07.08.09.10.11.12.13.14.15
call wwRellenarFila( 1, ter, X0,X0,X0,X0,X0,X0,X0,t1,X0,X0,X0,X0,X0,X0,X0)
call wwRellenarFila( 2, ter, X0,X0,X0,X0,t1,t2,t1,t1,t1,t2,t1,X0,X0,X0,X0)
call wwRellenarFila( 3, ter, X0,X0,X0,t1,t3,t1,t3,t1,t3,t1,t3,t1,X0,X0,X0)
call wwRellenarFila( 4, ter, X0,X0,t1,t2,t1,t2,t1,t1,t1,t2,t1,t2,t1,X0,X0)
call wwRellenarFila( 5, ter, X0,t1,t3,t1,t3,t1,t3,t1,t1,t1,t1,t1,t1,t1,X0)
call wwRellenarFila( 6, ter, X0,t2,t1,t2,t1,t2,t1,t1,t1,t1,t1,t1,t1,t1,X0)
call wwRellenarFila( 7, ter, X0,t1,t3,t1,t3,t1,t3,t4,t3,t1,t3,t1,t3,t1,X0)
call wwRellenarFila( 8, ter, t4,t4,t4,t4,t4,t4,t4,t1,t4,t4,t4,t4,t4,t4,t4)
call wwRellenarFila( 9, ter, X0,t1,t3,t1,t3,t1,t3,t4,t3,t1,t3,t1,t3,t1,X0)
call wwRellenarFila(10, ter, X0,t2,t1,t2,t1,t2,t1,t4,t1,t2,t1,t2,t1,t2,X0)
call wwRellenarFila(11, ter, X0,t1,t3,t1,t3,t1,t3,t4,t3,t1,t3,t1,t3,t1,X0)
call wwRellenarFila(12, ter, X0,X0,t1,t2,t1,t2,t1,t4,t1,t2,t1,t2,t1,X0,X0)
call wwRellenarFila(13, ter, X0,X0,X0,t1,t3,t1,t3,t4,t3,t1,t3,t1,X0,X0,X0)
call wwRellenarFila(14, ter, X0,X0,X0,X0,t1,t2,t1,t4,t1,t2,t1,X0,X0,X0,X0)
call wwRellenarFila(15, ter, X0,X0,X0,X0,X0,X0,X0,t4,X0,X0,X0,X0,X0,X0,X0)
endfunction
function wwCambiarTerreno takes integer tipo returns nothing
local real x = GetRectCenterX(gg_rct_TerrenoPunto) - 128.0
local real y = GetRectCenterY(gg_rct_TerrenoPunto) + 128.0
local integer i = 1
local integer j
local integer ter = tipo * 15
local integer aux
loop
exitwhen i > 15
set j = 1
loop
exitwhen j > 15
set aux = LoadInteger(udg_wwT, i + ter, j )
if aux != 0 then
call SetTerrainType(x + I2R(128 * j), y - I2R(128 * i), aux, -1, 1, 0)
endif
set j = j + 1
endloop
set i = i + 1
endloop
call RemoveWeatherEffect(udg_wwMeteo)
set udg_wwMeteo = AddWeatherEffect( bj_mapInitialPlayableArea, LoadInteger(udg_wwT, 0, tipo) )
call EnableWeatherEffect( udg_wwMeteo, true )
endfunction
//===========================================================================
//Arena
function wwControl takes nothing returns nothing
local unit u
local real xu
local real yu
local real xc = GetLocationX(udg_Centro)
local real yc = GetLocationY(udg_Centro)
local real rc
call GroupEnumUnitsInRange(udg_wwG, xc, yc, 1500.0, null)
loop
set u = FirstOfGroup(udg_wwG)
exitwhen u == null
call GroupRemoveUnit(udg_wwG, u)
set xu = GetUnitX(u) - xc
set yu = GetUnitY(u) - yc
set rc = (xu*xu + yu*yu)
if rc > 688900.0 then
set rc = SquareRoot(rc)
call SetUnitX(u, 830.0 * (xu / rc) + xc)
call SetUnitY(u, 830.0 * (yu / rc) + yc)
endif
endloop
endfunction
function wwCombate takes nothing returns nothing
set udg_Heroe = CreateUnit(udg_JUGADOR, 'H000', GetLocationX(udg_Centro) + 600.0, GetLocationY(udg_Centro), 180.0)
if (GetLocalPlayer() == udg_JUGADOR) then
call SetCameraTargetController(udg_Heroe, 0.0, 0.0, false)
endif
call SetHeroLevel(udg_Heroe, 5, false)
call UnitAddItem(udg_Heroe, CreateItem('pghe', GetUnitX(udg_Heroe), GetUnitY(udg_Heroe)))
call UnitAddItem(udg_Heroe, CreateItem('pman', GetUnitX(udg_Heroe), GetUnitY(udg_Heroe)))
call PauseUnit( udg_Heroe, true )
call ClearSelection()
call SelectUnit(udg_Heroe, true)
call wwCambiarTerreno( udg_wwTerreno )
call TriggerSleepAction( 2.50 )
call PauseUnit( udg_Heroe, false )
call TriggerExecute( gg_trg_Combate )
endfunction
//===========================================================================
//Inicio
function INI takes nothing returns nothing
local real i = bj_PI/90.0
local integer j = 1
local real x
local real y
local trigger t = CreateTrigger( )
call SetFloatGameState(GAME_STATE_TIME_OF_DAY, bj_MELEE_STARTING_TOD)
call SetGameSpeed( MAP_SPEED_FASTEST )
call SetMapFlag(MAP_LOCK_SPEED, true)
call SetFloatGameState(GAME_STATE_TIME_OF_DAY, 12.00)
call SetTimeOfDayScale(0.0)
call SuspendTimeOfDay(true)
call FogMaskEnable(false)
call SetSkyModel( "Environment\\Sky\\FoggedSky\\FoggedSky.mdl" )
set x = GetRectCenterX(gg_rct_Region_Central)
set y = GetRectCenterY(gg_rct_Region_Central)
set udg_Centro = Location(x, y)
set udg_MaxRadio = 830.00 + 75.0
loop
exitwhen j > 180
call CreateDestructable('B000', x + udg_MaxRadio * Cos(I2R(j) * i), y + udg_MaxRadio * Sin(I2R(j) * i), GetRandomReal(0, 360), ( 1.0 + ( I2R(ModuloInteger(j, 2)) * 0.01 ) ), 0)
set j = j + 1
endloop
set udg_MaxRadio = 830.00
call FogModifierStart(CreateFogModifierRadiusLoc(udg_JUGADOR, FOG_OF_WAR_VISIBLE, udg_Centro, 2000.00, true, false))
call FogModifierStart(CreateFogModifierRadiusLoc(udg_JUGBOSS, FOG_OF_WAR_VISIBLE, udg_Centro, 2000.00, true, false))
set udg_wwT = InitHashtable()
set udg_wwS = InitHashtable()
call wwTerrenos()
set udg_wwG = CreateGroup()
call TriggerRegisterTimerEvent(t, 0.02, true)
call TriggerAddAction( t, function wwControl )
call CreateQuestBJ( bj_QUESTTYPE_REQ_DISCOVERED, "CREDITS", "|cffffcc00Models:|r|nIon Cannon (WILL THE ALMIGHTY)|nRollingStormSFX (DonDustin)|nLightningEmpowerCaster (DonDustin)|nLightning Elemental (Tarrasque)|nNaked Lightning Elemental (Tarrasque)|nPeeKay's Lightning Sphere (PeeKay)|n|n|cffffcc00Spells:|r|nHoming Pigeon: (angelcraft)|nRejuvenation: (MC)|n|nEverything else was created by me (Wonder Woman), including terrain, skills and systems and is my intellectual property.", "ReplaceableTextures\\CommandButtons\\BTNMGexchange.tga" )
call SP1ini()
call SP2ini()
call SP3ini()
call SP4ini()
call wwCombate()
set t = null
endfunction
Name | Type | is_array | initial_value |
Centro | location | No | |
EfAngulo | real | No | |
Efectos | unit | Yes | |
GRUPO | group | No | |
H | hashtable | No | |
H2 | hashtable | No | |
Heroe | unit | No | |
JUGADOR | player | No | Player00 |
JUGBOSS | player | No | Player11 |
MaxRadio | real | No | |
U | unit | No | |
wwAH | hashtable | No | |
WWdeto | trigger | Yes | |
wwG | group | No | |
WWhl | hashtable | No | |
WWhp | hashtable | No | |
wwHT | hashtable | No | |
WWhu | hashtable | No | |
wwL | location | No | |
wwLL | location | No | |
wwMeteo | weathereffect | No | |
wwS | hashtable | No | |
wwT | hashtable | No | |
wwTerreno | integer | No | 6 |
wwU | unit | No |
function InitTrig_INICIO takes nothing returns nothing
set gg_trg_INICIO = CreateTrigger( )
call TriggerAddAction( gg_trg_INICIO, function INI )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Thunderstruck takes nothing returns nothing
local boolean control = false
local real x
local real y
if boss == null or ContadordeRayo == 5 then
set control = true
endif
set ContadordeRayo = ContadordeRayo + 1
if ContadordeRayo >= 10 then
set ContadordeRayo = 0
endif
if control then
set x = GetUnitX(udg_Heroe)
set y = GetUnitY(udg_Heroe)
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\Brilliance\\Brilliance.mdl", x, y))
call TriggerSleepAction(1.3)
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl", x, y))
call TriggerSleepAction(0.2)
if boss == null then
call wwAreaDam(110, preboss, x, y, 140)
else
call wwAreaDam(110, boss, x, y, 140)
endif
endif
endfunction
//===========================================================================
function InitTrig_Rayo_Periodico takes nothing returns nothing
set gg_trg_Rayo_Periodico = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_Rayo_Periodico, 1.00 )
call TriggerAddAction( gg_trg_Rayo_Periodico, function Thunderstruck )
call Preload("Abilities\\Spells\\Human\\Brilliance\\Brilliance.mdl")
call Preload("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl")
call DisableTrigger(gg_trg_Rayo_Periodico)
endfunction
//TESH.scrollpos=5
//TESH.alwaysfold=0
function Trig_Combate_Actions takes nothing returns nothing
// La variable wwTerreno configura la arena
// Por defecto el terreno usado es 0 que corresponde a "Arena"
// Pero cambiandole el valor inicial se pueden elegir otros terrenos
// En el comentario del detonador se ven las correspondencias
// ------
// ------
// ------
// ACA COMIENZA LA PELEA
local real angulo = GetRandomReal(0, 2.0 * bj_PI)
local unit polo
local effect ef = AddSpecialEffect("war3mapImported\\IonCannon.mdx", GetLocationX(udg_Centro), GetLocationY(udg_Centro))
local integer i = 1
set CentroX = GetLocationX(udg_Centro)
set CentroY = GetLocationY(udg_Centro)
loop
exitwhen i > 30
set EfUnits[i] = CreateUnit(udg_JUGBOSS, 'u004', CentroX, CentroY, 0.0)
set i = i + 1
endloop
call EnableTrigger(EfTrigger)
set Runa[1] = CreateItem('rman', CentroX + 565.0, CentroY + 565.0)
set Runa[2] = CreateItem('rman', CentroX - 565.0, CentroY - 565.0)
set Runa[3] = CreateItem('rhe2', CentroX + 565.0, CentroY - 565.0)
set Runa[4] = CreateItem('rhe2', CentroX - 565.0, CentroY + 565.0)
call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 2, "ReplaceableTextures\\CameraMasks\\White_mask.blp", 0, 0, 0, 0 )
call wwUnidadAgregar(udg_Heroe, 900.00/I2R((GetUnitCollisionSize(udg_Heroe))), false, false)
call TriggerSleepAction(6.55)
call DestroyEffect(AddSpecialEffect("war3mapImported\\RollingStormSFX.mdx", CentroX, CentroY))
set preboss = CreateUnit(udg_JUGBOSS, 'u007', CentroX, CentroY, 0.0)
call SetUnitColor( preboss, PLAYER_COLOR_LIGHT_BLUE )
call wwAreaDam(240, preboss, CentroX, CentroY, 400)
call IssuePointOrder( preboss, "blink", CentroX + 600.0 * Cos(angulo), CentroY + 600.0 * Sin(angulo) )
set polo = CreateUnit(udg_JUGBOSS, 'u000', CentroX, CentroY, 0.00)
call wwPoloCrear(polo, 800.00, true)
call EnableTrigger(gg_trg_Rayo_Periodico)
call TriggerSleepAction(1.2)
call wwPoloDestruir(polo)
call KillUnit(polo)
call RemoveUnit(polo)
call TriggerSleepAction(4.2)
call DestroyEffect(ef)
set polo = null
endfunction
//===========================================================================
function InitTrig_Combate takes nothing returns nothing
set gg_trg_Combate = CreateTrigger( )
call TriggerAddAction( gg_trg_Combate, function Trig_Combate_Actions )
call Preload("war3mapImported\\IonCannon.mdx")
call Preload("war3mapImported\\RollingStormSFX.mdx")
endfunction
//TESH.scrollpos=9
//TESH.alwaysfold=0
scope Trans initializer OnInit
private function Tcondiciones takes nothing returns boolean
return GetTriggerUnit() == preboss
endfunction
private function Transformacion takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
call DestroyEffect(AddSpecialEffect("war3mapImported\\RollingStormSFX.mdx", CentroX, CentroY))
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl", GetUnitX(preboss), GetUnitY(preboss) ))
call TriggerSleepAction(1.0)
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTarget.mdl", CentroX, CentroY ))
call DestroyEffect(AddSpecialEffect("Doodads\\Cinematic\\Lightningbolt\\Lightningbolt.mdl", CentroX, CentroY))
call TriggerSleepAction(0.65)
call RemoveUnit(preboss)
set boss = CreateUnit(udg_JUGBOSS, 'H001', CentroX, CentroY, 0.0)
call wwUnidadAgregar(boss, 900.00/I2R((GetUnitCollisionSize(boss))), false, false)
call SetUnitColor( boss, PLAYER_COLOR_LIGHT_BLUE )
call SetHeroLevel( boss , 5, false)
call TriggerSleepAction(0.2)
call RemoveUnit(armadura)
call DisableTrigger(t)
set t = null
endfunction
private function OnInit takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t , EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( t, Condition( function Tcondiciones ) )
call TriggerAddAction( t, function Transformacion )
call Preload("Doodads\\Cinematic\\Lightningbolt\\Lightningbolt.mdl")
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_MapIni_Actions takes nothing returns nothing
call SetTerrainFogEx( 0, 1000, 8000.00, 0.10, 0, 0, 0 )
call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 0, "ReplaceableTextures\\CameraMasks\\White_mask.blp", 0, 0, 0, 0 )
set armadura = CreateUnit(udg_JUGBOSS, 'u006', GetLocationX(udg_Centro), GetLocationY(udg_Centro), 270.0)
call SetUnitColor( armadura, PLAYER_COLOR_LIGHT_BLUE )
call TriggerSleepAction(0.0)
call DisplayTimedTextToPlayer(udg_JUGADOR,0.88,0.80,5,"Ride the lightning!")
call VolumeGroupSetVolume( SOUND_VOLUMEGROUP_AMBIENTSOUNDS, 0.00 )
call VolumeGroupSetVolume( SOUND_VOLUMEGROUP_SPELLS, 0.00 )
call VolumeGroupSetVolume( SOUND_VOLUMEGROUP_COMBAT, 0.00 )
call VolumeGroupSetVolume( SOUND_VOLUMEGROUP_FIRE, 0.00 )
call VolumeGroupSetVolume( SOUND_VOLUMEGROUP_MUSIC, 0.00 )
call VolumeGroupSetVolume( SOUND_VOLUMEGROUP_UNITMOVEMENT, 0.00 )
call VolumeGroupSetVolume( SOUND_VOLUMEGROUP_UNITSOUNDS, 0.00 )
call VolumeGroupSetVolume( SOUND_VOLUMEGROUP_UI, 0.00 )
call SetUnitAnimation(armadura, "death")
call TriggerSleepAction(1.7)
call VolumeGroupResetBJ( )
call VolumeGroupSetVolume( SOUND_VOLUMEGROUP_UNITSOUNDS, 0.00 )
call PlayMusic( gg_snd_Credits )
endfunction
//===========================================================================
function InitTrig_MapIni takes nothing returns nothing
set gg_trg_MapIni = CreateTrigger( )
call TriggerAddAction( gg_trg_MapIni, function Trig_MapIni_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope Efecto initializer OnInit
globals
integer ContadordeRayo = 0
real EfAngulo = 0.0
unit array EfUnits
endglobals
private function EfectoAcciones takes nothing returns nothing
local integer i = 1
local real x = GetLocationX(udg_Centro)
local real y = GetLocationY(udg_Centro)
set EfAngulo = EfAngulo + 4.00 * bj_DEGTORAD
if EfAngulo >= 360.00 * bj_DEGTORAD then
set EfAngulo = 0.00
endif
loop
exitwhen i > 30
call SetUnitX(EfUnits[i], x + 900.0 * Cos(EfAngulo + bj_DEGTORAD * I2R(i) * 12.0))
call SetUnitY(EfUnits[i], y + 900.0 * Sin(EfAngulo + bj_DEGTORAD * I2R(i) * 12.0))
set i = i + 1
endloop
endfunction
private function OnInit takes nothing returns nothing
set EfTrigger = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( EfTrigger, 0.06 )
call TriggerAddAction( EfTrigger, function EfectoAcciones )
call DisableTrigger(EfTrigger)
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
function AgregarUnidad takes nothing returns nothing
call wwUnidadAgregar(GetEnumUnit(), 1500.00/I2R((GetUnitCollisionSize(GetEnumUnit()))), false, false)
endfunction
function IniCiador takes nothing returns nothing
set udg_H = InitHashtable()
set udg_H2 = InitHashtable()
call TriggerSleepAction( 0.00 )
call wwComandoInicio(50.00)
call wwComandoActivar()
set udg_GRUPO = GetUnitsInRectAll(bj_mapInitialPlayableArea)
call ForGroupBJ( udg_GRUPO, function AgregarUnidad )
call DestroyGroup(udg_GRUPO)
endfunction
//===========================================================================
function InitTrig_Iniciador takes nothing returns nothing
set gg_trg_Iniciador = CreateTrigger( )
call TriggerAddAction( gg_trg_Iniciador, function IniCiador )
call Preload("Doodads\\Cinematic\\EyeOfSargeras\\EyeOfSargeras.mdl")
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function SoporteFisicoCondiciones takes nothing returns boolean
return GetOwningPlayer(GetTriggerUnit()) == udg_JUGADOR and GetUnitAbilityLevel(GetTriggerUnit(), 'Avul') == 0
endfunction
function SoporteFisicoAcciones takes nothing returns nothing
call wwUnidadAgregar(GetTriggerUnit(), 800.00/I2R((GetUnitCollisionSize(GetTriggerUnit()))), false, false)
endfunction
//===========================================================================
function InitTrig_Soporte_Fisico takes nothing returns nothing
set gg_trg_Soporte_Fisico = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_Soporte_Fisico, bj_mapInitialPlayableArea )
call TriggerAddCondition( gg_trg_Soporte_Fisico, Condition( function SoporteFisicoCondiciones ) )
call TriggerAddAction( gg_trg_Soporte_Fisico, function SoporteFisicoAcciones )
endfunction
//TESH.scrollpos=85
//TESH.alwaysfold=0
function FinDeContador takes nothing returns nothing
local timer tim = GetExpiredTimer()
local integer hand = GetHandleId(tim)
local unit u
local unit master = LoadUnitHandle(udg_H, hand, 1)
local unit slave = LoadUnitHandle(udg_H, hand, 2)
local real x1 = GetUnitX(master)
local real y1 = GetUnitY(master)
local real x2 = GetUnitX(slave)
local real y2 = GetUnitY(slave)
local real angulo = LoadReal(udg_H, hand, 5)
call MoveLightningEx ((LoadLightningHandle(udg_H, hand, 4)), true, x1, y1, 30, x2, y2, 30)
call SaveReal(udg_H, hand, 3, LoadReal(udg_H, hand, 3) * 0.99 )
call wwLineaParametros(master, LoadReal(udg_H, hand, 3), true)
call GroupEnumUnitsInRange(udg_wwG, (x1+x2)/2, (y1+y2)/2, 20+wwModulo(x1-x2,y1-y2)/2, null)
loop
set u = FirstOfGroup(udg_wwG)
exitwhen u == null
call GroupRemoveUnit(udg_wwG, u)
if wwUnidadEnArea(u, x1, y1, x2, y2) then
if IsUnitEnemy(u, GetOwningPlayer(master)) then
call SetUnitX(u, Cos(angulo) * 15.0 + GetUnitX(u))
call SetUnitY(u, Sin(angulo) * 15.0 + GetUnitY(u))
call UnitDamageTarget(master, u, 6.0, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_LIGHTNING, WEAPON_TYPE_WHOKNOWS)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\Bolt\\BoltImpact.mdl" , u,"origin"))
endif
endif
endloop
set master = null
set slave = null
set tim = null
endfunction
function FDGcondiciones takes nothing returns boolean
return GetSpellAbilityId() == 'A000' ///ID DEL SPELL
endfunction
function FDGacciones takes nothing returns nothing
local unit u
local lightning rayo
local integer puntero
local unit linea1a
local unit linea1b
local real x
local real y
local real f
local location p
local location t
local timer tim = CreateTimer()
local effect ef1
local effect ef2
local effect ef3
local effect ef4
set puntero = GetHandleId(tim)
set p = GetSpellTargetLoc()
set u = GetTriggerUnit()
set x = GetUnitX(u)
set y = GetUnitY(u)
set linea1a = CreateUnit(GetOwningPlayer(u), 'u000', x+0.01, y+0.01, 0.00)
set linea1b = CreateUnit(GetOwningPlayer(u), 'u000', x-0.01, y-0.01, 0.00)
call SetUnitColor(linea1a, PLAYER_COLOR_LIGHT_BLUE)
call SetUnitColor(linea1b, PLAYER_COLOR_LIGHT_BLUE )
call wwUnidadAgregar(linea1a, -100.00, false, true)
call wwUnidadAgregar(linea1b, -100.00, false, true)
call wwLineaCrear(linea1a, linea1b, 2000.00, true)
call wwPoloCrear(u, 500.00, true)
set ef1 = AddSpecialEffectTarget("Abilities\\Spells\\Orc\\Purge\\PurgeBuffTarget.mdl", u,"origin")
set ef4 = AddSpecialEffectTarget("Abilities\\Spells\\Undead\\FrostArmor\\FrostArmorTarget.mdl", u,"chest")
set ef2 = AddSpecialEffectTarget("Abilities\\Weapons\\ZigguratMissile\\ZigguratMissile.mdl", linea1a,"chest")
set ef3 = AddSpecialEffectTarget("Abilities\\Weapons\\ZigguratMissile\\ZigguratMissile.mdl", linea1b,"chest")
call SaveUnitHandle(udg_H, puntero, 1, linea1a)
call SaveUnitHandle(udg_H, puntero, 2, linea1b)
set t = Location(x,y)
set rayo = AddLightningEx("CLPB", true, GetLocationX(t), GetLocationY(t), GetLocationZ(t) + 30, GetLocationX(t), GetLocationY(t), GetLocationZ(t) + 30)
call SaveLightningHandle(udg_H, puntero, 4, rayo)
call SaveReal(udg_H, puntero, 3, 2000)
call TimerStart(tim, 0.05, true, function FinDeContador)
set f = Atan2(GetLocationY(p) - y, GetLocationX(p) - x)
call SaveReal(udg_H, puntero, 5, f)
call wwUnidadAcelerarPolarR(linea1a, f + 0.62, 15.00) //bj_DEGTORAD*0 ,15.00)
call wwUnidadAcelerarPolarR(linea1b, f - 0.62, 15.00)
call RemoveLocation(t)
set t = null
call RemoveLocation(p)
set p = null
set CoolDown[0] = CoolDownMax[0]
call TriggerSleepAction(0.80)
call wwPoloDestruir(u)
call DestroyEffect(ef1)
set ef1 = null
call DestroyEffect(ef4)
set ef4 = null
set u = null
call TriggerSleepAction(0.50)
call DestroyLightning(rayo)
call PauseTimer(tim)
call DestroyTimer(tim)
set tim = null
set rayo = null
call SaveLightningHandle(udg_H, puntero, 4, null)
call wwLineaDestruir(linea1a)
call KillUnit(linea1a)
call KillUnit(linea1b)
call DestroyEffect(ef2)
set ef2 = null
call DestroyEffect(ef3)
set ef3 = null
call RemoveUnit(linea1a)
call RemoveUnit(linea1b)
set linea1a = null
set linea1b = null
call FlushChildHashtable(udg_H, puntero)
endfunction
//===========================================================================
function InitTrig_Furia_de_Gauss takes nothing returns nothing
set gg_trg_Furia_de_Gauss = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Furia_de_Gauss, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Furia_de_Gauss, Condition( function FDGcondiciones ) )
call TriggerAddAction( gg_trg_Furia_de_Gauss, function FDGacciones )
endfunction
//TESH.scrollpos=17
//TESH.alwaysfold=0
globals
unit WWU = null
endglobals
function wwFiltro takes nothing returns boolean
return GetFilterUnit()!= WWU and GetWidgetLife(GetFilterUnit())>.405 and IsUnitEnemy(GetFilterUnit(),GetOwningPlayer( WWU)) and not IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE)
endfunction
function RDLMperiodica takes nothing returns nothing
local timer tim = GetExpiredTimer()
local integer hand = GetHandleId(tim)
local unit u1 = LoadUnitHandle(udg_H2, hand, 1)
local unit u2 = LoadUnitHandle(udg_H2, hand, 2)
local real X1 = GetUnitX(u1)
local real Y1 = GetUnitY(u1)
local real x1
local real x2 = GetUnitX(u2)
local real y1
local real y2 = GetUnitY(u2)
local unit u
local player p = GetOwningPlayer(u1)
local real face = GetUnitFacing(u1)
if GetUnitState(u2, UNIT_STATE_LIFE) > 0 then
if LoadInteger(udg_H2, hand, 5) >= 10 then
call DestroyEffect(AddSpecialEffect("war3mapImported\\LightningSphere_FX.mdx", x2, y2))
call SaveInteger(udg_H2, hand, 5, 0)
else
call SaveInteger(udg_H2, hand, 5, LoadInteger(udg_H2, hand, 5) + 1)
endif
set WWU = u1
call GroupEnumUnitsInRange(udg_wwG, x2, y2, 500.0, Condition(function wwFiltro))
set u = FirstOfGroup(udg_wwG)
if u != null then
call IssuePointOrder( u2, "move", GetUnitX(u), GetUnitY(u) )
endif
call GroupClear(udg_wwG)
call SetUnitFacing(u1, bj_RADTODEG * Atan2(y2 - Y1, x2 - X1))
set x1 = X1 + CosBJ(face+40)*105
set y1 = Y1 + SinBJ(face+40)*105
call MoveLightningEx ((LoadLightningHandle(udg_H2, hand, 3)), true, x1 , y1, 100, x2, y2, 30)
call GroupEnumUnitsInRange(udg_wwG, (x1+x2)/2, (y1+y2)/2, 20+wwModulo(x1-x2,y1-y2)/2, null)
loop
set u = FirstOfGroup(udg_wwG)
exitwhen u == null
call GroupRemoveUnit(udg_wwG, u)
if wwUnidadEnArea(u, x1, y1, x2, y2) then
if IsUnitEnemy(u, p) then
call UnitDamageTarget(u1, u, 5.0, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_LIGHTNING, WEAPON_TYPE_WHOKNOWS)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\Bolt\\BoltImpact.mdl" , u,"origin"))
endif
endif
endloop
set x1 = X1 + CosBJ(face-40)*105
set y1 = Y1 + SinBJ(face-40)*105
call MoveLightningEx ((LoadLightningHandle(udg_H2, hand, 4)), true, x1 , y1, 100, x2, y2, 30)
call GroupEnumUnitsInRange(udg_wwG, (x1+x2)/2, (y1+y2)/2, 20+wwModulo(x1-x2,y1-y2)/2, null)
loop
set u = FirstOfGroup(udg_wwG)
exitwhen u == null
call GroupRemoveUnit(udg_wwG, u)
if wwUnidadEnArea(u, x1, y1, x2, y2) then
if IsUnitEnemy(u, p) then
call UnitDamageTarget(u1, u, 5.0, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_LIGHTNING, WEAPON_TYPE_WHOKNOWS)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\Bolt\\BoltImpact.mdl" , u,"origin"))
endif
endif
endloop
else
call RemoveUnit(u2)
call DestroyLightning(LoadLightningHandle(udg_H2, hand, 3))
call DestroyLightning(LoadLightningHandle(udg_H2, hand, 4))
call PauseTimer(tim)
call DestroyTimer(tim)
call FlushChildHashtable(udg_H2, hand)
endif
set tim = null
set u2 = null
set u1 = null
set p = null
endfunction
function RDLMcondiciones takes nothing returns boolean
return GetUnitTypeId(GetTriggerUnit()) == 'u001'
endfunction
function RDLMacciones takes nothing returns nothing
local timer tim = CreateTimer()
local integer puntero = GetHandleId(tim)
local unit u1 = GetSummoningUnit()
local unit u2 = GetSummonedUnit()
local real face = GetUnitFacing(u1)
call SaveUnitHandle(udg_H2, puntero, 1, u1)
call SaveUnitHandle(udg_H2, puntero, 2, u2)
call SaveLightningHandle(udg_H2, puntero, 3, AddLightningEx("CLPB", true, GetUnitX(u1) + CosBJ(face+45)*90, GetUnitY(u1) + SinBJ(face+45)*90, 100, GetUnitX(u2), GetUnitY(u2), 30))
call SaveLightningHandle(udg_H2, puntero, 4, AddLightningEx("CLPB", true, GetUnitX(u1) + CosBJ(face-45)*90, GetUnitY(u1) + SinBJ(face-45)*90, 100, GetUnitX(u2), GetUnitY(u2), 30))
call SaveInteger(udg_H2, puntero, 5, 0)
call TimerStart(tim, 0.03, true, function RDLMperiodica)
set tim = null
set u1 = null
set u2 = null
set CoolDown[1] = CoolDownMax[1]
endfunction
//===========================================================================
function InitTrig_Rayo_de_la_Muerte takes nothing returns nothing
set gg_trg_Rayo_de_la_Muerte = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Rayo_de_la_Muerte, EVENT_PLAYER_UNIT_SUMMON )
call TriggerAddCondition( gg_trg_Rayo_de_la_Muerte, Condition( function RDLMcondiciones ) )
call TriggerAddAction( gg_trg_Rayo_de_la_Muerte, function RDLMacciones )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function DMcondiciones takes nothing returns boolean
return GetSpellAbilityId() == 'A002' ///ID DEL SPELL
endfunction
function DMacciones takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit polo
local real x = GetSpellTargetX()
local real y = GetSpellTargetY()
set CoolDown[2] = CoolDownMax[2]
call TriggerSleepAction(3.55)
call UnitApplyTimedLife(CreateUnit(GetOwningPlayer(u), 'e002', x, y, 0.00), 'BHwe', 3.0)
call TriggerSleepAction(3.00)
call wwAreaDam(240, u, x, y, 400)
set polo = CreateUnit(GetOwningPlayer(u), 'u000', x, y, 0.00)
call wwPoloCrear(polo, 800.00, true)
call TriggerSleepAction(1.2)
call wwPoloDestruir(polo)
call KillUnit(polo)
call RemoveUnit(polo)
set polo = null
set u = null
endfunction
//===========================================================================
function InitTrig_Descarga_Masiva takes nothing returns nothing
set gg_trg_Descarga_Masiva = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Descarga_Masiva, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Descarga_Masiva, Condition( function DMcondiciones ) )
call TriggerAddAction( gg_trg_Descarga_Masiva, function DMacciones )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function PIcondiciones takes nothing returns boolean
return GetSpellAbilityId() == 'A003' ///ID DEL SPELL
endfunction
function PIacciones takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit polo
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local real distancia = wwModulo(x - CentroX, y - CentroY)
call DestroyEffect(AddSpecialEffect("war3mapImported\\LightningEmpowerCaster.mdx", x, y))
set polo = CreateUnit(GetOwningPlayer(GetTriggerUnit()), 'u000', x, y, 0.00)
call SetUnitScale(polo, 0.01, 0.01, 0.01)
call wwPoloCrear(polo, 2700.00, true)
set CoolDown[3] = CoolDownMax[3]
if distancia > 770.0 then
call wwUnidadAcelerarCartesiana(u, (x - CentroX) * (distancia - 740.0) * (-0.000375), (y - CentroY) * (distancia - 740.0) * (-0.000375))
endif
call TriggerSleepAction(0.35)
call wwPoloDestruir(polo)
call KillUnit(polo)
call RemoveUnit(polo)
set polo = null
set u = null
endfunction
//===========================================================================
function InitTrig_Pulso_Ionico takes nothing returns nothing
set gg_trg_Pulso_Ionico = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Pulso_Ionico, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Pulso_Ionico, Condition( function PIcondiciones ) )
call TriggerAddAction( gg_trg_Pulso_Ionico, function PIacciones )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope EnergiaPrimaria initializer OnInit
globals
hashtable EnPriH
endglobals
////Energia Primaria
private function EPpush takes nothing returns nothing
local timer tim = GetExpiredTimer()
local integer hand = GetHandleId(tim)
local integer i = LoadInteger(EnPriH, hand, 0)
local integer j = 1
local unit u
local real face
local real tiempo = LoadReal(EnPriH, hand, -1)
loop
exitwhen j > i
set u = LoadUnitHandle(EnPriH, hand, j)
set face = LoadReal(EnPriH, hand, -1-j)
call SetUnitX(u, GetUnitX(u)+(Cos(face)*(10*(tiempo+0.3))))
call SetUnitY(u, GetUnitY(u)+(Sin(face)*(10*(tiempo+0.3))))
set j = j + 1
endloop
call SaveReal(EnPriH, hand, -1, tiempo - 0.03)
if tiempo <= 0.03 then
call PauseTimer(tim)
call DestroyTimer(tim)
call FlushChildHashtable(EnPriH, hand)
endif
set u = null
set tim = null
endfunction
private function EPaux takes nothing returns nothing
local timer tim = GetExpiredTimer()
local timer timpush
local integer i = 0
local integer hand = GetHandleId(tim)
local integer puntero
local unit u
local unit dum = LoadUnitHandle(EnPriH, hand, 5)
local real x = LoadReal(EnPriH, hand, 1) + LoadReal(EnPriH, hand, 3)
local real y = LoadReal(EnPriH, hand, 2) + LoadReal(EnPriH, hand, 4)
local boolean control = false
if wwMod(x-GetLocationX(udg_Centro), y-GetLocationY(udg_Centro)) > 830.0 then
set control = true
endif
call SetUnitX(dum, x)
call SetUnitY(dum, y)
call SaveReal(EnPriH, hand, 1, x)
call SaveReal(EnPriH, hand, 2, y)
call SetUnitFacing(dum, GetUnitFacing(dum) + 4.0)
call GroupEnumUnitsInRange(udg_wwG, x, y, 80.0, null)
loop
set u = FirstOfGroup(udg_wwG)
exitwhen u == null
call GroupRemoveUnit(udg_wwG, u)
if IsUnitEnemy(u, GetOwningPlayer(dum)) and GetUnitState(u, UNIT_STATE_LIFE) > 0 then
set control = true
endif
endloop
if control then
call GroupEnumUnitsInRange(udg_wwG, x, y, 140.0, null)
set timpush = CreateTimer()
set puntero = GetHandleId(timpush)
call SaveReal(EnPriH, puntero, -1, 0.9)
loop
set u = FirstOfGroup(udg_wwG)
exitwhen u == null
call GroupRemoveUnit(udg_wwG, u)
if IsUnitEnemy(u, GetOwningPlayer(dum)) and GetUnitState(u, UNIT_STATE_LIFE) > 0 then
call UnitDamageTarget(udg_Heroe, u, 70.0, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_LIGHTNING, WEAPON_TYPE_WHOKNOWS)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Items\\AIlb\\AIlbSpecialArt.mdl" , u,"chest"))
set i = i + 1
call SaveUnitHandle(EnPriH, puntero, i, u)
call SaveReal(EnPriH, puntero, -1-i, Atan2(GetUnitY(u) - y, GetUnitX(u) - x))
endif
endloop
call Sonido3d("Abilities\\Spells\\Human\\StormBolt\\StormBoltLaunch.wav", x, y, 127)
call SaveInteger(EnPriH, puntero, 0, i)
call TimerStart(timpush, 0.03, true, function EPpush)
call KillUnit(dum)
call PauseTimer(tim)
call DestroyTimer(tim)
call FlushChildHashtable(EnPriH, hand)
endif
set tim = null
set timpush = null
set dum = null
endfunction
private function EPcon takes nothing returns boolean
return GetSpellAbilityId() == 'A004'
endfunction
private function EPacc takes nothing returns nothing
local timer tim = CreateTimer()
local integer puntero = GetHandleId(tim)
local real x1 = GetSpellTargetX()
local real y1 = GetSpellTargetY()
local unit u = GetTriggerUnit()
local real x2 = GetUnitX(u)
local real y2 = GetUnitY(u)
local real dist = wwMod(x1-x2,y1-y2)
call SaveReal(EnPriH, puntero, 1, x2)
call SaveReal(EnPriH, puntero, 2, y2)
call SaveReal(EnPriH, puntero, 3, 25*(x1-x2)/dist)
call SaveReal(EnPriH, puntero, 4, 25*(y1-y2)/dist)
call SaveUnitHandle(EnPriH, puntero, 5, CreateUnit(GetOwningPlayer(u), 'u002', x2, y2, 0.0))
call SetUnitTimeScale(LoadUnitHandle(EnPriH, puntero, 5), 3.0)
call TimerStart(tim, 0.03, true, function EPaux)
call Sonido3d("Abilities\\Spells\\Undead\\DeathCoil\\DeathCoilMissileLaunch1.wav", x2, y2, 50)
set tim = null
set u = null
//AI
set CoolDown[4] = CoolDownMax[4]
endfunction
private function OnInit takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function EPcon ) )
call TriggerAddAction( t, function EPacc )
call Preload("Abilities\\Spells\\Items\\AIlb\\AIlbSpecialArt.mdl")
//call PreloadSound("Abilities\\Spells\\Undead\\DeathCoil\\DeathCoilMissileLaunch1.wav")
//call PreloadSound("Abilities\\Spells\\Human\\StormBolt\\StormBoltLaunch.wav")
set EnPriH = InitHashtable()
set t = null
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
function PEcondiciones takes nothing returns boolean
return GetSpellAbilityId() == 'A005' ///ID DEL SPELL
endfunction
function PEacciones takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit polo
local real x = GetSpellTargetX()
local real y = GetSpellTargetY()
set polo = CreateUnit(GetOwningPlayer(u), 'u003', x, y, 0.00)
call wwPoloCrear(polo, 400.00, true)
call SetUnitColor( polo, PLAYER_COLOR_LIGHT_BLUE )
set CoolDown[5] = CoolDownMax[5]
call TriggerSleepAction(8.2)
call wwPoloDestruir(polo)
call KillUnit(polo)
call RemoveUnit(polo)
set polo = null
set u = null
endfunction
//===========================================================================
function InitTrig_Polo_Electrico takes nothing returns nothing
set gg_trg_Polo_Electrico = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Polo_Electrico, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Polo_Electrico, Condition( function PEcondiciones ) )
call TriggerAddAction( gg_trg_Polo_Electrico, function PEacciones )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function GCcondiciones takes nothing returns boolean
return GetSpellAbilityId() == 'A007' ///ID DEL SPELL
endfunction
function GCacciones takes nothing returns nothing
set CoolDown[7] = CoolDownMax[7]
call TriggerSleepAction(2.0)
call UnitRemoveAbility(boss, 'A007')
endfunction
//===========================================================================
function InitTrig_Golpe_de_Corriente takes nothing returns nothing
set gg_trg_Golpe_de_Corriente = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Golpe_de_Corriente, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Golpe_de_Corriente, Condition( function GCcondiciones ) )
call TriggerAddAction( gg_trg_Golpe_de_Corriente, function GCacciones )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
///SPELL NO MUI
scope ViajeElectromagnetico initializer OnInit
globals
lightning array ViajeRayos
real ViajeDir
real array Xcoords
real array Ycoords
real OffsetPerp
integer LargoTren
integer ViajeRecorrido
integer ViajeDist
boolean ViajeCompleto
unit Viajero
endglobals
private function VEcondiciones takes nothing returns boolean
return GetSpellAbilityId() == 'A006' ///ID DEL SPELL
endfunction
private function VEcontrol takes nothing returns nothing
local timer tim = GetExpiredTimer()
local real angulo = Atan2(CentroY - GetUnitY(preboss), CentroX - GetUnitX(preboss)) + GetRandomReal(-1.15, 1.15)
local real dist = GetRandomReal(580.0, 750.0)
if not FormaDeRelampago then
call IssuePointOrder( preboss, "blink", CentroX + dist * Cos(angulo), CentroY + dist * Sin(angulo) )
endif
call PauseTimer(tim)
call DestroyTimer(tim)
set tim = null
endfunction
private function VEnuevo takes nothing returns nothing
local timer tim = GetExpiredTimer()
local timer ntim = CreateTimer()
local real angulo = Atan2(CentroY - GetUnitY(preboss), CentroX - GetUnitX(preboss)) + GetRandomReal(-1.15, 1.15)
local real dist = GetRandomReal(580.0, 750.0)
call IssuePointOrder( preboss, "blink", CentroX + dist * Cos(angulo), CentroY + dist * Sin(angulo) )
call PauseTimer(tim)
call DestroyTimer(tim)
call TimerStart(ntim, 0.70, false, function VEcontrol)
set tim = null
set ntim = null
endfunction
private function VEperiodica takes nothing returns nothing
local timer ntim = null
local timer tim = GetExpiredTimer()
local real off = GetRandomReal(-40.0, 40.0)
local real dist
set ViajeRecorrido = ViajeRecorrido + 1
if ViajeRecorrido <= ViajeDist then
if ViajeRecorrido <= 6 then
set LargoTren = LargoTren + 1
else
call DestroyLightning(ViajeRayos[ViajeRecorrido - 6])
endif
set LargoTren = LargoTren + 1
set Xcoords[1] = Xcoords[0] + 40.0 * Cos(ViajeDir) + off * Cos(ViajeDir + 1.5707963267948966192313216916398)
set Ycoords[1] = Ycoords[0] + 40.0 * Sin(ViajeDir) + off * Sin(ViajeDir + 1.5707963267948966192313216916398)
set dist = wwModulo(Xcoords[ViajeRecorrido]-CentroX, Ycoords[ViajeRecorrido]-CentroY)
if dist > udg_MaxRadio then
set off = udg_MaxRadio / dist
set Xcoords[1] = Xcoords[1] * off
set Ycoords[1] = Ycoords[1] * off
endif
call SetUnitX(Viajero, Xcoords[1])
call SetUnitY(Viajero, Ycoords[1])
set ViajeRayos[ViajeRecorrido] = AddLightningEx("FORK", true, Xcoords[0], Ycoords[0], 40.0, Xcoords[1], Ycoords[1], 40.0)
call DestroyEffect(AddSpecialEffect("Abilities\\Weapons\\Bolt\\BoltImpact.mdl" , Xcoords[1], Ycoords[1]))
set Xcoords[0] = Xcoords[1]
set Ycoords[0] = Ycoords[1]
call wwAreaDam(14, Viajero, Xcoords[0], Ycoords[0], 120)
else
call DestroyLightning(ViajeRayos[ViajeRecorrido - 6])
endif
set LargoTren = LargoTren - 1
if LargoTren == 0 then
if ViajeDist < 8 then
call DestroyLightning(ViajeRayos[1])
call DestroyLightning(ViajeRayos[2])
call DestroyLightning(ViajeRayos[3])
call DestroyLightning(ViajeRayos[4])
call DestroyLightning(ViajeRayos[5])
call DestroyLightning(ViajeRayos[6])
call DestroyLightning(ViajeRayos[7])
endif
call ShowUnit(Viajero, true)
set FormaDeRelampago = false
//call SelectUnit(Viajero, true)
call PauseTimer(tim)
call DestroyTimer(tim)
call IssuePointOrder(Viajero, "slow", GetUnitX(udg_Heroe) + 50 * CosBJ(GetUnitFacing(udg_Heroe)), GetUnitY(udg_Heroe) + 50 * SinBJ(GetUnitFacing(udg_Heroe)))
set ntim = CreateTimer()
call TimerStart(ntim, 0.90, false, function VEnuevo)
endif
set tim = null
endfunction
private function VEacciones takes nothing returns nothing
local timer tim = CreateTimer()
local real xf = GetSpellTargetX()
local real yf = GetSpellTargetY()
local real xi
local real yi
set Viajero = GetTriggerUnit()
set xi = GetUnitX(Viajero)
set yi = GetUnitY(Viajero)
set ViajeRecorrido = 0
set ViajeDist = R2I(wwModulo(xf-xi,yf-yi)/40.0)
set LargoTren = 0
set ViajeCompleto = false
set Xcoords[0] = xi
set Ycoords[0] = yi
set ViajeDir = Atan2(yf - yi, xf - xi)
call ShowUnit(Viajero, false)
set FormaDeRelampago = true
call TimerStart(tim, 0.03, true, function VEperiodica)
set tim = null
endfunction
//===========================================================================
private function OnInit takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function VEcondiciones ) )
call TriggerAddAction( t, function VEacciones )
call Preload("Abilities\\Weapons\\Bolt\\BoltImpact.mdl")
endfunction
endscope
//TESH.scrollpos=398
//TESH.alwaysfold=0
scope AI initializer OnInit
globals
private constant integer SAURONEYE = 'us01'
private constant integer WALLY = 'H000'
private constant integer PALOMA = 'e001'
private constant integer GOLEM = 'n000'
private constant integer MINIGOLEM = 'n001'
private constant integer POLO = 'u003'
private constant integer DESCARGA = 'e002'
private constant integer FDG = 0 //0 Furia de Gauss
private constant integer RDM = 1 //1 Rayo de la Muerte
private constant integer DMA = 2 //2 Descarga Masiva
private constant integer PIO = 3 //3 Pulso Ionico
private constant integer EPA = 4 //4 Energia Primaria
private constant integer PEO = 5 //5 Polo Electrico
private constant integer IEA = 6 //6 Ilusion Estatica
private constant integer GDC = 7 //7 Golpe de Corriente
private constant integer VEO = 8 //8 Viaje Electromagnetico
trigger TrigEventoPeriodico = null
trigger TrigEventoB = null
trigger TrigEventoA = null
trigger EfTrigger = null
unit boss = null
unit preboss = null
unit armadura = null
unit iludum
item objilu
item array Runa
real CentroX
real CentroY
real AIxB = 0.0
real AIyB = 0.0
real AIxH = 0.0
real AIyH = 0.0
real AIxAH = 0.0
real AIyAH = 0.0
real AIdxH = 0.0
real AIdyH = 0.0
real AIdistancia = 0.0
boolean FormaDeRelampago = false
boolean RiesgoIniciado = true
hashtable AreadeRiesgo
hashtable AreadeRiesgoInicial
hashtable ObjetodeRiesgo
real array CoolDown
real array CoolDownMax
hashtable ColaManiobras
//0 prioridad
//1 nro de maniobra
integer array Maniobras
integer array ManiobraHand
hashtable ManiobraTimer
real IAocupada = 1.0
boolean array MD
integer NroManiobra
integer Prioridad
// se llena al principio de cada evento y alimenta a EvaluarManiobra
endglobals
private function CrearObjetodeRiesgo takes unit u, real dx, real dy returns nothing
local integer NroObjeto = LoadInteger(ObjetodeRiesgo, -1, 0) + 1
local integer ID = GetHandleId(u)
call SaveInteger(ObjetodeRiesgo, -1, 0, NroObjeto)
call SaveInteger(ObjetodeRiesgo, 0, ID, NroObjeto)
call SaveUnitHandle(ObjetodeRiesgo, NroObjeto, 0, u)
call SaveReal(ObjetodeRiesgo, NroObjeto, 1, dx)
call SaveReal(ObjetodeRiesgo, NroObjeto, 2, dy)
endfunction
private function DestruirObjetodeRiesgo takes unit u returns nothing
local integer NroObjeto = LoadInteger(ObjetodeRiesgo, -1, 0)
local integer ID = GetHandleId(u)
local integer NroObjDes = LoadInteger(ObjetodeRiesgo, 0, ID)
call SaveInteger(ObjetodeRiesgo, 0, ID, 0)
call SaveInteger(ObjetodeRiesgo, -1, 0, NroObjeto-1)
call SaveUnitHandle(ObjetodeRiesgo, NroObjDes, 0, LoadUnitHandle(ObjetodeRiesgo, NroObjeto, 0))
call SaveReal(ObjetodeRiesgo, NroObjDes, 1, LoadReal(ObjetodeRiesgo, NroObjeto, 1))
call SaveReal(ObjetodeRiesgo, NroObjDes, 2, LoadReal(ObjetodeRiesgo, NroObjeto, 2))
call SaveUnitHandle(ObjetodeRiesgo, NroObjeto, 0, null)
call SaveReal(ObjetodeRiesgo, NroObjeto, 1, 0.0)
call SaveReal(ObjetodeRiesgo, NroObjeto, 2, 0.0)
endfunction
private function CrearManiobra takes nothing returns integer
local integer i = 1
loop
exitwhen MD[i]
set i = i + 1
endloop
set MD[i] = false
call SaveInteger(ColaManiobras, i, 0, Prioridad)
call SaveInteger(ColaManiobras, i, 1, NroManiobra)
return i
endfunction
private function RemoverManiobra takes integer ManiobraID returns nothing
call FlushChildHashtable(ColaManiobras, Maniobras[ManiobraID])
set MD[Maniobras[ManiobraID]] = true
endfunction
private function CD takes integer spell returns boolean
return CoolDown[spell] <= 0.0
endfunction
function LiberarManiobra takes integer man returns nothing
set ManiobraHand[man] = 0
endfunction
function OcupadoTimer takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer hand = GetHandleId(t)
call PauseTimer(t)
call DestroyTimer(t)
call LiberarManiobra(LoadInteger(ManiobraTimer, hand, 0))
call FlushChildHashtable(ManiobraTimer, hand)
set t = null
endfunction
private function Ocupado takes integer manNro, real tiempo returns nothing
local timer t = CreateTimer()
call SaveInteger(ManiobraTimer, GetHandleId(t), 0, manNro)
call TimerStart(t, tiempo, false, function OcupadoTimer)
set IAocupada = tiempo
set t = null
endfunction
private function SetearRiesgoInicial takes nothing returns nothing
local integer xlimsup = R2I((1024.0) / 64.0) + 1
local integer xliminf = R2I((-1024.0) / 64.0) - 1
local integer ylimsup = R2I((1024.0) / 64.0) + 1
local integer yliminf = R2I((-1024.0) / 64.0) - 1
local integer i
local integer j = yliminf
local real dist
local real tau = 333.33
loop
exitwhen j > ylimsup
set i = xliminf
loop
exitwhen i > xlimsup
set dist = wwModulo( I2R(64*i), I2R(64*j) )
if dist <= 1000.0 then
call SaveReal(AreadeRiesgoInicial, i, j, 100.0-100.0*(1.0-Pow(bj_E, -(1000.0-dist)/tau)))
endif
set i = i + 1
endloop
set j = j + 1
endloop
endfunction
private function SumarRiesgo takes integer i, integer j, real riesgo returns nothing
call SaveReal(AreadeRiesgo, i, j, LoadReal(AreadeRiesgo, i, j) + riesgo)
endfunction
private function SumarRiesgoCircular takes real xP, real yP, real radio, real riesgo returns nothing
local real x = xP - CentroX
local real y = yP - CentroY
local integer xlimsup = R2I((x+radio) / 64.0) + 1
local integer xliminf = R2I((x-radio) / 64.0) - 1
local integer ylimsup = R2I((y+radio) / 64.0) + 1
local integer yliminf = R2I((y-radio) / 64.0) - 1
local integer i
local integer j = yliminf
local real dist
loop
exitwhen j > ylimsup
set i = xliminf
loop
exitwhen i > xlimsup
set dist = wwModulo( x - I2R(64*i), y - I2R(64*j) )
if dist <= radio then
call SumarRiesgo(i, j, riesgo*(1.0-Cuadrado(dist/radio)))
//call SumarRiesgo(i, j, riesgo*(1.0-Pow(bj_E, -(dist)/tau)))
endif
set i = i + 1
endloop
set j = j + 1
endloop
endfunction
private function SumarRiesgoPuntual takes real xP, real yP, real riesgo returns nothing
local real x = xP - CentroX
local real y = yP - CentroY
local integer i = R2I(x / 64.0)
local integer j = R2I(y / 64.0)
local real xoff = x - I2R(i*64)
local real yoff = y - I2R(j*64)
local integer i2 = i + 1
local integer j2 = j + 1
local real riesgox1 = (64.0 - xoff)
local real riesgox2 = (xoff)
local real riesgoy1 = (64.0 - yoff)
local real riesgoy2 = (yoff)
call SumarRiesgo( i, j, riesgo*Cuadrado(riesgox1*riesgoy1))
call SumarRiesgo( i, j2, riesgo*Cuadrado(riesgox1*riesgoy2))
call SumarRiesgo(i2, j, riesgo*Cuadrado(riesgox2*riesgoy1))
call SumarRiesgo(i2, j2, riesgo*Cuadrado(riesgox2*riesgoy2))
endfunction
private function ObtenerRiesgo takes real xP, real yP returns real
local real x = xP - CentroX
local real y = yP - CentroY
local integer i = R2I(x / 64.0)
local integer j = R2I(y / 64.0)
local real xoff = x - I2R(i*64)
local real yoff = y - I2R(j*64)
local integer i2 = i + 1
local integer j2 = j + 1
local real riesgox1 = (64.0 - xoff)
local real riesgox2 = (xoff)
local real riesgoy1 = (64.0 - yoff)
local real riesgoy2 = (yoff)
local real riesgo = 0.0
set riesgo = riesgo + LoadReal(AreadeRiesgo, i, j) * (riesgox1*riesgoy1)
set riesgo = riesgo + LoadReal(AreadeRiesgo, i, j2) * (riesgox1*riesgoy2)
set riesgo = riesgo + LoadReal(AreadeRiesgo,i2, j) * (riesgox2*riesgoy1)
set riesgo = riesgo + LoadReal(AreadeRiesgo,i2, j2) * (riesgox2*riesgoy2)
return riesgo / 4096.0
endfunction
//MANIOBRAS
//Maniobra1 Energia Primaria simple
function Maniobra1 takes nothing returns nothing
local real Ajuste
if CD(EPA) then
set Ajuste = 4.2 + AIdistancia * 0.035
call IssuePointOrder( boss, "slow", AIxH + Ajuste*AIdxH, AIyH + Ajuste*AIdyH )
call Ocupado(1, 0.65)
else
call LiberarManiobra(1)
endif
endfunction
//Maniobra2 Movimiento estandar
function Maniobra2 takes nothing returns nothing
local real x
local real y
local real xa1
local real ya1
local real xa2
local real ya2
local real dx = ObtenerRiesgo(AIxB + 30.0,AIyB) - ObtenerRiesgo(AIxB - 30.0,AIyB) + ObtenerRiesgo(AIxB + 70.0,AIyB) - ObtenerRiesgo(AIxB - 70.0,AIyB) + ObtenerRiesgo(AIxB + 120.0,AIyB) - ObtenerRiesgo(AIxB - 120.0,AIyB)
local real dy = ObtenerRiesgo(AIxB,AIyB + 30.0) - ObtenerRiesgo(AIxB,AIyB - 30.0) + ObtenerRiesgo(AIxB,AIyB + 70.0) - ObtenerRiesgo(AIxB,AIyB - 70.0) + ObtenerRiesgo(AIxB,AIyB + 120.0) - ObtenerRiesgo(AIxB,AIyB - 120.0)
local real mod = wwModulo(dx, dy)
local real distancia = wwModulo(AIxB-CentroX, AIyB-CentroY)
local real angulo
if mod > 0.0 then
set x = AIxB - (200.0 * dx / mod)
set y = AIyB - (200.0 * dy / mod)
if distancia > 785.0 then
set angulo = Atan2(AIyB-CentroY, AIxB-CentroX)
set xa1 = 785.0 * Cos(angulo + 0.209) + CentroX
set ya1 = 785.0 * Sin(angulo + 0.209) + CentroY
set xa2 = 785.0 * Cos(angulo - 0.209) + CentroX
set ya2 = 785.0 * Sin(angulo - 0.209) + CentroY
if wwModulo(xa1-x,ya1-y) < wwModulo(xa2-x,ya2-y) then
set x = xa1
set y = ya1
else
set x = xa2
set y = ya2
endif
endif
call IssuePointOrder( boss, "move", x, y)
endif
call Ocupado(2, 0.30)
endfunction
//Maniobra3 Descarga Masiva simple
function Maniobra3 takes nothing returns nothing
local real dist = wwModulo(CentroX - AIxH, CentroY - AIyH)
local real x = AIxH
local real y = AIyH
if CD(DMA) then
if dist > 585.0 then
set x = x * GetRandomReal(480.0, 630.0) / dist
set y = y * GetRandomReal(480.0, 630.0) / dist
else
set x = x * GetRandomReal(0.85, 1.10)
set y = y * GetRandomReal(0.85, 1.10)
endif
call IssuePointOrder( boss, "stasistrap", x, y )
call Ocupado(3, 0.75)
else
call LiberarManiobra(3)
endif
endfunction
//Maniobra4 Rayo de la Muerte simple
function Maniobra4 takes nothing returns nothing
local real randomdir = GetRandomReal(0.0, 2*bj_PI)
local real randomoff = GetRandomReal(20.0, 35.0)
local real x = AIxH + AIdxH * 12.0 + randomoff * Cos(randomdir)
local real y = AIyH + AIdyH * 12.0 + randomoff * Sin(randomdir)
if AIdistancia < 680.0 and CD(RDM) then
call IssuePointOrder( boss, "tornado", x, y )
call Ocupado(4, 1.25)
else
call LiberarManiobra(4)
endif
endfunction
//Maniobra5 Polo Electrico
function Maniobra5 takes nothing returns nothing
local real direccion = Atan2(AIyH - CentroY, AIxH - CentroX) + GetRandomReal(-0.32,0.32)
local real distancia = wwModulo(AIyH - CentroY, AIxH - CentroX) + GetRandomReal(-85.0,85.0)
if distancia > 750.0 then
set distancia = GetRandomReal(660.0,750.0)
endif
if CD(PEO) then
call IssuePointOrder( boss, "earthquake", distancia*Cos(direccion)+CentroX, distancia*Sin(direccion)+CentroY )
call Ocupado(5, 0.50)
else
call LiberarManiobra(5)
endif
endfunction
//Maniobra6 Furia de Gauss y reacciones defensivas
function Maniobra6 takes nothing returns nothing
local real x = 0.0
local real y = 0.0
local unit u
local integer UniTipo
local real Ajuste
local real Angulo
call GroupEnumUnitsInRange(udg_wwG, AIxB, AIyB, 400.0, null)
loop
set u = FirstOfGroup(udg_wwG)
exitwhen u == null
call GroupRemoveUnit(udg_wwG, u)
if IsUnitEnemy(u, udg_JUGBOSS) and GetUnitState(u, UNIT_STATE_LIFE) > 0 then
set UniTipo = GetUnitTypeId(u)
if UniTipo == WALLY then
set Ajuste = 0.191
elseif UniTipo == GOLEM then
set Ajuste = 0.135
elseif UniTipo == MINIGOLEM then
set Ajuste = 0.086
else
set Ajuste = 0.0
endif
set Angulo = Atan2(GetUnitY(u) - AIyB, GetUnitX(u) - AIxB)
set Ajuste = Ajuste * (450.0 - wwModulo(AIxB-GetUnitX(u),AIyB-GetUnitY(u)))
set x = x + Ajuste * Cos(Angulo)
set y = y + Ajuste * Sin(Angulo)
endif
endloop
if wwModulo(x,y) > 50.0 then
if GetRandomInt(1,2) == 1 and CD(EPA) then
call IssuePointOrder( boss, "slow", x+AIxB, y+AIyB )
call Ocupado(1, 0.65)
call LiberarManiobra(6)
elseif GetRandomInt(1,2) == 1 and CD(DMA) then
call IssuePointOrder( boss, "stasistrap", x+AIxB, y+AIyB )
call Ocupado(3, 0.75)
call LiberarManiobra(6)
elseif CD(FDG) then
call IssuePointOrder( boss, "slow", x+AIxB, y+AIyB )
call IssuePointOrder( boss, "shockwave", x+AIxB, y+AIyB )
call Ocupado(6, 0.80)
else
call LiberarManiobra(6)
endif
elseif CD(PIO) then
call IssueImmediateOrder( boss, "stomp")
call Ocupado(7, 0.60)
call LiberarManiobra(6)
else
call LiberarManiobra(6)
endif
endfunction
//Maniobra7 Pulso Ionico
function Maniobra7 takes nothing returns nothing
if CD(PIO) then
call IssueImmediateOrder( boss, "stomp")
call Ocupado(7, 0.60)
else
call LiberarManiobra(7)
endif
endfunction
//Maniobra8 Furia de Gauss casual
function Maniobra8 takes nothing returns nothing
local real Ajuste
if CD(FDG) and AIdistancia < 900.0 then
set Ajuste = 5.0 + AIdistancia * 0.035
call IssuePointOrder( boss, "shockwave", AIxH + Ajuste*AIdxH, AIyH + Ajuste*AIdyH )
call Ocupado(8, 0.80)
else
call LiberarManiobra(8)
endif
endfunction
//Maniobra9 Ilusion Electromagnetica antipaloma
function Maniobra9 takes nothing returns nothing
local real Ajuste
local unit ilu
local item obj
if CD(IEA) and ObtenerRiesgo(AIxB, AIyB) > 300.0 then
call UnitUseItemTarget( iludum, objilu, boss )
set CoolDown[6] = CoolDownMax[6]
endif
call LiberarManiobra(9)
set ilu = null
set obj = null
endfunction
//Maniobra10 Pulso Ionico por distancia excesiva
function Maniobra10 takes nothing returns nothing
if CD(PIO) then
call IssueImmediateOrder( boss, "stomp")
call Ocupado(10, 0.60)
else
call LiberarManiobra(10)
endif
endfunction
//Maniobra11 Golpe de Corriente
function Maniobra11 takes nothing returns nothing
if CD(GDC) and AIdistancia < 100.0 then
call UnitAddAbility(boss, 'A007')
call IssueTargetOrder( boss, "thunderbolt", udg_Heroe)
call Ocupado(11, 0.90)
else
call LiberarManiobra(11)
endif
endfunction
//FIN MANIOBRAS
private function AreaRiesgo takes nothing returns nothing
local real x
local real y
local integer maximo = LoadInteger(ObjetodeRiesgo, -1, 0)
local unit u
local integer UTipo
local integer i
local integer j = -16
loop
exitwhen j > 16
set i = -16
loop
exitwhen i > 16
call SaveReal(AreadeRiesgo, i, j, LoadReal(AreadeRiesgoInicial, i, j))
set i = i + 1
endloop
set j = j + 1
endloop
set i = 1
loop
exitwhen i > maximo
set u = LoadUnitHandle(ObjetodeRiesgo, i, 0)
set UTipo = GetUnitTypeId(u)
set x = GetUnitX(u)
set y = GetUnitY(u)
if UTipo == SAURONEYE then
call SumarRiesgoCircular(LoadReal(ObjetodeRiesgo, i, 1)*100.0 + x, LoadReal(ObjetodeRiesgo, i, 2)*100.0 + y, 270.0, 150.0)
call SumarRiesgoCircular(LoadReal(ObjetodeRiesgo, i, 1)*300.0 + x, LoadReal(ObjetodeRiesgo, i, 2)*300.0 + y, 280.0, 150.0)
call SumarRiesgoCircular(LoadReal(ObjetodeRiesgo, i, 1)*500.0 + x, LoadReal(ObjetodeRiesgo, i, 2)*500.0 + y, 280.0, 150.0)
call SumarRiesgoCircular(LoadReal(ObjetodeRiesgo, i, 1)*700.0 + x, LoadReal(ObjetodeRiesgo, i, 2)*700.0 + y, 300.0, 120.0)
call SumarRiesgoCircular(LoadReal(ObjetodeRiesgo, i, 1)*900.0 + x, LoadReal(ObjetodeRiesgo, i, 2)*900.0 + y, 300.0, 100.0)
elseif UTipo == WALLY then
call SumarRiesgoCircular(x, y, 400.0, 85.0)
elseif UTipo == PALOMA then
call SumarRiesgoCircular(x, y, 900.0, 1550.0)
elseif UTipo == GOLEM then
call SumarRiesgoCircular(x, y, 300.0, 50.0)
elseif UTipo == MINIGOLEM then
call SumarRiesgoCircular(x, y, 200.0, 22.0)
elseif UTipo == POLO then
call SumarRiesgoCircular(x, y, 260.0, -30.0)
elseif UTipo == DESCARGA then
call SumarRiesgoCircular(x, y, 600.0, -50.0)
endif
set i = i + 1
endloop
set u = null
endfunction
private function ObtenerManiobra takes nothing returns nothing
endfunction
private function EjecutarManiobra takes nothing returns nothing
if LoadInteger(ColaManiobras, Maniobras[1], 0) == 0 then
call ObtenerManiobra()
else
call ExecuteFunc("Maniobra" + I2S(LoadInteger(ColaManiobras, Maniobras[1], 1)))
// call BJDebugMsg("power")
endif
endfunction
private function EvaluarManiobra takes nothing returns nothing
local integer i = 2
local integer j
local integer proximo
local integer proximoaux
local boolean ControlBool = false
if ManiobraHand[NroManiobra] < Prioridad then
set ManiobraHand[NroManiobra] = Prioridad
if Prioridad > LoadInteger(ColaManiobras, Maniobras[1], 0) then
call RemoverManiobra(1)
set Maniobras[1] = CrearManiobra()
call EjecutarManiobra()
else
loop
exitwhen Prioridad > LoadInteger(ColaManiobras, Maniobras[i], 0)
set i = i + 1
endloop
set j = i
set proximo = Maniobras[j]
loop
set j = j + 1
set proximoaux = Maniobras[j]
set Maniobras[j] = proximo
set proximo = proximoaux
if LoadInteger(ColaManiobras, Maniobras[j], 1) == NroManiobra then
call RemoverManiobra(j)
set Maniobras[j] = proximoaux
set ControlBool = true
endif
exitwhen (Maniobras[j] == 0 or ControlBool)
endloop
set Maniobras[i] = CrearManiobra()
endif
endif
endfunction
private function OrdenarManiobras takes nothing returns nothing
local integer ManiobrasCantidad
local integer i = 1
call RemoverManiobra(1)
loop
set Maniobras[i] = Maniobras[i+1]
exitwhen Maniobras[i] == 0
set i = i + 1
endloop
endfunction
private function ProximaManiobra takes nothing returns nothing
call OrdenarManiobras()
call EjecutarManiobra()
endfunction
private function CalcularCD takes real vida returns nothing
local real salud = vida * 0.01
local integer i = 0
//0 Furia de Gauss
//1 Rayo de la Muerte
//2 Descarga Masiva
//3 Pulso Ionico
//4 Energia Primaria
//5 Polo Electrico
set CoolDownMax[0] = 3.5 + salud
set CoolDownMax[1] = 3.5 + salud * 0.5
set CoolDownMax[2] = 4 + salud * 2.0
set CoolDownMax[3] = 6.0
set CoolDownMax[4] = 0.25 + salud * 0.35
set CoolDownMax[5] = 0.5 + salud * 0.45
set CoolDownMax[6] = 8.5
set CoolDownMax[7] = 5.5
loop
set CoolDown[i] = CoolDown[i] - 0.04
if CoolDown[i] < 0.0 then
set CoolDown[i] = 0.0
endif
exitwhen i >= 7
set i = i + 1
endloop
endfunction
//EVENTOS
private function Evento1 takes nothing returns nothing
set NroManiobra = 1
set Prioridad = 140
call EvaluarManiobra()
endfunction
private function Evento2 takes nothing returns nothing
set NroManiobra = 2
set Prioridad = R2I(ObtenerRiesgo(AIxB, AIyB))
if Prioridad > 265 then
if Prioridad > 620 and CD(IEA) then
set NroManiobra = 9
set Prioridad = 2000
else
set Prioridad = 265
endif
endif
call EvaluarManiobra()
endfunction
private function Evento3 takes nothing returns nothing
set NroManiobra = 3
set Prioridad = 180
call EvaluarManiobra()
endfunction
private function Evento4 takes nothing returns nothing
set NroManiobra = 4
set Prioridad = 250
call EvaluarManiobra()
endfunction
private function Evento5 takes nothing returns nothing
set NroManiobra = 5
set Prioridad = 60
call EvaluarManiobra()
endfunction
private function Evento6 takes nothing returns nothing
set NroManiobra = 6
set Prioridad = 260
call EvaluarManiobra()
endfunction
private function Evento7 takes nothing returns nothing
set NroManiobra = 7
set Prioridad = 290
call EvaluarManiobra()
endfunction
private function Evento8 takes nothing returns nothing
set NroManiobra = 8
set Prioridad = 130
call EvaluarManiobra()
endfunction
private function Evento9 takes nothing returns nothing
set NroManiobra = 10
set Prioridad = 165
call EvaluarManiobra()
endfunction
private function Evento10 takes nothing returns nothing
set NroManiobra = 11
set Prioridad = 400
call EvaluarManiobra()
endfunction
private function EventoA takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer UTipo = GetUnitTypeId(u)
if UTipo == SAURONEYE then
call CrearObjetodeRiesgo(u, CosBJ(GetUnitFacing(udg_Heroe)), SinBJ(GetUnitFacing(udg_Heroe)))
elseif UTipo == PALOMA or UTipo == GOLEM or UTipo == MINIGOLEM or UTipo == WALLY or UTipo == POLO or UTipo == DESCARGA then
call CrearObjetodeRiesgo(u, 0.0, 0.0)
endif
if GetOwningPlayer(u) == udg_JUGBOSS and IsUnitIllusion(u) == true then
call SetUnitPathing(u, false)
call SetUnitX(u, AIxB)
call SetUnitY(u, AIyB)
call SetUnitFacing(u, GetUnitFacing(boss))
call SetUnitVertexColor( u, 255, 255, 255, 125 )
endif
set u = null
endfunction
private function EventoB takes nothing returns nothing
local integer i = 1
local unit u = GetTriggerUnit()
local integer UTipo = GetUnitTypeId(u)
if UTipo == SAURONEYE or UTipo == PALOMA or UTipo == GOLEM or UTipo == MINIGOLEM or UTipo == POLO then
call DestruirObjetodeRiesgo(u)
elseif u == boss or u == udg_Heroe then
call DisableTrigger(TrigEventoA)
call DisableTrigger(TrigEventoB)
call DisableTrigger(TrigEventoPeriodico)
call DisableTrigger(gg_trg_Rayo_Periodico)
if u == udg_Heroe then
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTarget.mdl", GetUnitX(boss), GetUnitY(boss) ))
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl", GetUnitX(boss), GetUnitY(boss) ))
call DestroyEffect(AddSpecialEffect("Doodads\\Cinematic\\Lightningbolt\\Lightningbolt.mdl", GetUnitX(boss), GetUnitY(boss) ))
call RemoveUnit(boss)
set boss = null
endif
call DisableTrigger(EfTrigger)
call StopMusicBJ( true )
loop
exitwhen i > 30
call RemoveUnit(EfUnits[i])
set EfUnits[i] = null
set i = i + 1
endloop
call RemoveItem(Runa[1])
call RemoveItem(Runa[2])
call RemoveItem(Runa[3])
call RemoveItem(Runa[4])
set Runa[1] = null
set Runa[2] = null
set Runa[3] = null
set Runa[4] = null
endif
set u = null
endfunction
//FIN EVENTOS
private function Rodeado takes real distancia returns real
local real Rod = 0.0
local real Ajuste
local real dist
local integer UniTipo
local unit u
if distancia > 500.0 then
set Rod = (distancia - 500.0) / 6.5
endif
call GroupEnumUnitsInRange(udg_wwG, AIxB, AIyB, 400.0, null)
loop
set u = FirstOfGroup(udg_wwG)
exitwhen u == null
call GroupRemoveUnit(udg_wwG, u)
if IsUnitEnemy(u, udg_JUGBOSS) and GetUnitState(u, UNIT_STATE_LIFE) > 0 then
set UniTipo = GetUnitTypeId(u)
if UniTipo == WALLY then
set Ajuste = 0.241
elseif UniTipo == GOLEM then
set Ajuste = 0.175
elseif UniTipo == MINIGOLEM then
set Ajuste = 0.096
else
set Ajuste = 0.0
endif
set Rod = Rod + Ajuste * (400.0 - wwModulo(AIxB-GetUnitX(u),AIyB-GetUnitY(u)))
endif
endloop
return Rod
endfunction
private function Inicializar takes nothing returns nothing
set RiesgoIniciado = false
call SetearRiesgoInicial()
call CrearObjetodeRiesgo(udg_Heroe, 0.0, 0.0)
call StartCampaignAI( udg_JUGBOSS, "WonderAI.wai" )
call PauseCompAI(udg_JUGBOSS, true)
set objilu = CreateItem('I0s1', CentroX, CentroY)
set iludum = CreateUnit(udg_JUGBOSS, 'u005', 4000.0, 4000.0, 0.0)
call UnitAddItem(iludum, objilu)
endfunction
private function AIperiodica takes nothing returns nothing
local real salud = GetUnitState(boss, UNIT_STATE_LIFE)
local real distancia
local real rodeadoparam
set AIxB = GetUnitX(boss)
set AIyB = GetUnitY(boss)
set distancia = wwModulo(GetLocationX(udg_Centro)-AIxB,GetLocationY(udg_Centro)-AIyB)
set AIxH = GetUnitX(udg_Heroe)
set AIyH = GetUnitY(udg_Heroe)
set AIdxH = AIxH - AIxAH
set AIdyH = AIyH - AIyAH
set AIdistancia = wwModulo(AIxH - AIxB, AIyH - AIyB)
if boss != null then
if RiesgoIniciado then
call Inicializar()
else
call AreaRiesgo()
endif
call CalcularCD(salud)
if CD(RDM) and distancia < 570.0 and AIdistancia < 680.0 then
call Evento4()
endif
set rodeadoparam = Rodeado(distancia)
if rodeadoparam > 50.0 then
if CD(FDG) then
call Evento6()
elseif CD(PIO) then
call Evento7()
endif
elseif rodeadoparam < 5.0 then
if CD(FDG) and AIdistancia < 850.0 then
call Evento8()
endif
endif
if CD(DMA) and salud < 580.0 then
call Evento3()
endif
if CD(GDC) and AIdistancia < 88.0 then
call Evento10()
endif
if CD(EPA) then
call Evento1()
endif
if CD(PEO) then
call Evento5()
endif
if CD(PIO) and distancia > 780.0 then
call Evento9()
endif
call Evento2()
set IAocupada = IAocupada - 0.04
if IAocupada <= 0 then
call ProximaManiobra()
endif
endif
set AIxAH = AIxH
set AIyAH = AIyH
endfunction
//===========================================================================
private function OnInit takes nothing returns nothing
local integer i = 0
//Evento Periodico
set TrigEventoPeriodico = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( TrigEventoPeriodico, 0.04 )
call TriggerAddAction( TrigEventoPeriodico, function AIperiodica )
//EventoA - Unidad entrante
set TrigEventoA = CreateTrigger( )
call TriggerRegisterEnterRectSimple( TrigEventoA, bj_mapInitialPlayableArea )
call TriggerAddAction( TrigEventoA, function EventoA )
//EventoB - Unidad muere
set TrigEventoB = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( TrigEventoB , EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( TrigEventoB , function EventoB )
set ColaManiobras = InitHashtable()
set ManiobraTimer = InitHashtable()
set AreadeRiesgo = InitHashtable()
set AreadeRiesgoInicial = InitHashtable()
set ObjetodeRiesgo = InitHashtable()
loop
exitwhen i > 100
set MD[i] = true
set i = i + 1
endloop
set i = 0
loop
exitwhen i > 50
set CoolDown[i] = 0
set CoolDownMax[i] = 0
set i = i + 1
endloop
call Preload("Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTarget.mdl")
call Preload("Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl")
endfunction
endscope