Name | Type | is_array | initial_value |
//TESH.scrollpos=3
//TESH.alwaysfold=0
scope Init
globals
private unit u
endglobals
private struct A extends array
static method cond takes nothing returns boolean
call SetFloatGameState(GAME_STATE_TIME_OF_DAY, bj_MELEE_STARTING_TOD)
set u = CreateUnit(Player(0), 'Hblm', 0, 0, 0)
call SetHeroLevel(u, 4, false)
call DestroyTrigger(GetTriggeringTrigger())
return false
endmethod
static method onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerEvent(t, 0., false)
call TriggerAddCondition(t, Condition(function thistype.cond))
set t =null
endmethod
endstruct
endscope
//TESH.scrollpos=186
//TESH.alwaysfold=0
scope StaticFieldA
native UnitAlive takes unit id returns boolean
globals
private constant real FPS = 0.0312500
private constant string MODEL_PATH = "Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl"
private constant integer SPELL_ID = 'A000'
private constant string LIGHTNING_ID = "FORK"
private constant real LIGHTNING_RED = 0.15
private constant real LIGHTNING_GREEN = 0.45
private constant real LIGHTNING_BLUE = 1.
private constant real LIGHTNING_ALPHA = 1.
private constant real DURATION = 0.75
private constant attacktype A_TYPE = ATTACK_TYPE_MAGIC
private constant damagetype D_TYPE = DAMAGE_TYPE_MAGIC
endglobals
private constant function MaxDamage takes integer level returns real
return 75.*level
endfunction
private constant function MinDamage takes integer level returns real
return 30.*level
endfunction
private constant function Aoe takes integer level returns real
return 600 + 75.*level
endfunction
private function UnitFilter takes player source, unit targ returns boolean
return IsUnitEnemy(targ, source) and UnitAlive(targ) and not IsUnitType(targ, UNIT_TYPE_MAGIC_IMMUNE)
endfunction
//! textmacro_once STATIC_FIELD_ALLOC
if thistype(0).prev == 0 then
set count = count + 1
set this = count
else
set this = thistype(0).prev
set thistype(0).prev = thistype(0).prev.prev
endif
if thistype(0).next == 0 then
call TimerStart(period, FPS, true, function thistype.periodic)
else
set thistype(0).next.prev = this
endif
set this.next = thistype(0).next
set thistype(0).next = this
set this.prev = thistype(0)
//! endtextmacro
private struct Caster extends array
real x
real y
real temp
thistype prev
thistype next
static integer count
static timer period
method destroy takes nothing returns nothing
if this.next != 0 then
set this.next.prev = this.prev
endif
set this.prev.next = this.next
set this.prev = thistype(0).prev
set thistype(0).prev = this
if thistype(0).next == 0 then
call PauseTimer(period)
endif
endmethod
static method periodic takes nothing returns nothing
local thistype this = thistype(0).next
loop
exitwhen this == 0
set this.temp = this.temp - FPS
if this.temp <= 0 then
call DestroyEffect(AddSpecialEffect(MODEL_PATH, this.x, this.y))
call this.destroy()
endif
set this = this.next
endloop
endmethod
static method add takes real x, real y returns nothing
local thistype this
//! runtextmacro STATIC_FIELD_ALLOC()
set this.x = x
set this.y = y
set this.temp = DURATION
endmethod
static method onInit takes nothing returns nothing
set count = 0
set period = CreateTimer()
endmethod
endstruct
private struct SF extends array
unit targ
unit cast
lightning light
real dmg
real cx
real cy
real cz
real tx
real ty
real x
real y
real z
integer steps
thistype prev
thistype next
static integer count
static timer period
static group g
static location loc
method destroy takes nothing returns nothing
if this.next != 0 then
set this.next.prev = this.prev
endif
set this.prev.next = this.next
set this.prev = thistype(0).prev
set thistype(0).prev = this
if thistype(0).next == 0 then
call PauseTimer(period)
endif
call UnitDamageTarget(this.cast, this.targ, this.dmg, true, false, A_TYPE, D_TYPE, null)
call DestroyLightning(this.light)
call SetUnitPropWindow(this.targ, GetUnitDefaultPropWindow(this.targ)*bj_DEGTORAD)
set this.light = null
set this.cast = null
set this.targ = null
endmethod
static method periodic takes nothing returns nothing
local thistype this = thistype(0).next
loop
exitwhen this == 0
set this.tx = this.tx+this.x
set this.ty = this.ty+this.y
call MoveLocation(loc, this.tx, this.ty)
set this.z = GetLocationZ(loc) + 20 + GetUnitFlyHeight(this.targ)
if IsTerrainWalkable(this.tx, this.ty) then
call MoveLightningEx(this.light, true, this.cx, this.cy, this.cz, this.tx, this.ty, this.z)
call SetUnitX(this.targ, this.tx)
call SetUnitY(this.targ, this.ty)
endif
set this.steps = this.steps - 1
if this.steps == 0 then
call this.destroy()
endif
set this = this.next
endloop
endmethod
static method cond takes nothing returns boolean
local thistype this
local integer lvl
local real angle
local unit u
local unit v
local real x
local real y
local player p
local real dist
if GetSpellAbilityId() == SPELL_ID then
set u = GetTriggerUnit()
set x = GetUnitX(u)
set y = GetUnitY(u)
set p = GetOwningPlayer(u)
set lvl = GetUnitAbilityLevel(u, SPELL_ID)
call GroupEnumUnitsInRange(g, x, y, Aoe(lvl), null)
loop
set v = FirstOfGroup(g)
exitwhen v == null
call GroupRemoveUnit(g,v)
if UnitFilter(p,v) then
//! runtextmacro STATIC_FIELD_ALLOC()
set this.cast = u
set this.targ = v
set this.cx = x
set this.cy = y
set this.tx = GetUnitX(v)
set this.ty = GetUnitY(v)
set angle = Atan2(this.ty-y, this.tx-x)
set dist = SquareRoot((this.tx-x)*(this.tx-x) + (this.ty-y)*(this.ty-y))
set this.dmg = MinDamage(lvl) + (dist/Aoe(lvl))*(MaxDamage(lvl)-MinDamage(lvl))
set this.x = -(dist/DURATION)*FPS*Cos(angle)
set this.y = -(dist/DURATION)*FPS*Sin(angle)
call MoveLocation(loc, x, y)
set this.cz = GetLocationZ(loc) + 20
call MoveLocation(loc, this.tx, this.ty)
set this.z = GetLocationZ(loc) + 20 + GetUnitFlyHeight(v)
set this.light = AddLightningEx(LIGHTNING_ID, true, this.cx, this.cy, this.cz, this.tx, this.ty, this.z)
call SetLightningColor(this.light, LIGHTNING_RED, LIGHTNING_GREEN, LIGHTNING_BLUE, LIGHTNING_ALPHA)
call SetLightningColor(this.light, LIGHTNING_RED, LIGHTNING_GREEN, LIGHTNING_BLUE, LIGHTNING_ALPHA)
set this.steps = R2I(DURATION/FPS)
call SetUnitPropWindow(this.targ, 0)
endif
endloop
call Caster.add(x,y)
set u = null
set p = null
endif
return false
endmethod
static method onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition(function thistype.cond))
call Preload(MODEL_PATH)
set count = 0
set period = CreateTimer()
set g = CreateGroup()
set loc = Location(0,0)
set t = null
endmethod
endstruct
endscope
//TESH.scrollpos=135
//TESH.alwaysfold=0
scope StaticFieldE
//native UnitAlive takes unit id returns boolean
globals
private constant real FPS = 0.0312500
private constant string MODEL_PATH = "Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl"
private constant integer SPELL_ID = 'A001'
private constant string LIGHTNING_ID = "FORK"
private constant real LIGHTNING_RED = 1
private constant real LIGHTNING_GREEN = 0.45
private constant real LIGHTNING_BLUE = 0.15
private constant real LIGHTNING_ALPHA = 1.
private constant real DURATION = 0.75
private constant attacktype A_TYPE = ATTACK_TYPE_MAGIC
private constant damagetype D_TYPE = DAMAGE_TYPE_MAGIC
private constant real SPEED = 600.
endglobals
private constant function MaxDamage takes integer level returns real
return 75.*level
endfunction
private constant function MinDamage takes integer level returns real
return 30.*level
endfunction
private constant function Aoe takes integer level returns real
return 600 + 75.*level
endfunction
private function UnitFilter takes player source, unit targ returns boolean
return IsUnitEnemy(targ, source) and UnitAlive(targ) and not IsUnitType(targ, UNIT_TYPE_MAGIC_IMMUNE)
endfunction
//! textmacro_once STATIC_FIELD_ALLOC
if thistype(0).prev == 0 then
set count = count + 1
set this = count
else
set this = thistype(0).prev
set thistype(0).prev = thistype(0).prev.prev
endif
if thistype(0).next == 0 then
call TimerStart(period, FPS, true, function thistype.periodic)
else
set thistype(0).next.prev = this
endif
set this.next = thistype(0).next
set thistype(0).next = this
set this.prev = thistype(0)
//! endtextmacro
private struct SF extends array
unit targ
unit cast
lightning light
real dmg
real cx
real cy
real cz
real tx
real ty
real x
real y
real z
integer steps
thistype prev
thistype next
static integer count
static timer period
static group g
static location loc
method destroy takes nothing returns nothing
if this.next != 0 then
set this.next.prev = this.prev
endif
set this.prev.next = this.next
set this.prev = thistype(0).prev
set thistype(0).prev = this
if thistype(0).next == 0 then
call PauseTimer(period)
endif
call UnitDamageTarget(this.cast, this.targ, this.dmg, true, false, A_TYPE, D_TYPE, null)
call DestroyLightning(this.light)
call SetUnitPropWindow(this.targ, GetUnitDefaultPropWindow(this.targ)*bj_DEGTORAD)
set this.light = null
set this.cast = null
set this.targ = null
endmethod
static method periodic takes nothing returns nothing
local thistype this = thistype(0).next
loop
exitwhen this == 0
set this.tx = this.tx+this.x
set this.ty = this.ty+this.y
call MoveLocation(loc, this.tx, this.ty)
set this.z = GetLocationZ(loc) + 20 + GetUnitFlyHeight(this.targ)
if IsTerrainWalkable(this.tx, this.ty) then
call MoveLightningEx(this.light, true, this.cx, this.cy, this.cz, this.tx, this.ty, this.z)
call SetUnitX(this.targ, this.tx)
call SetUnitY(this.targ, this.ty)
endif
set this.steps = this.steps - 1
if this.steps == 0 then
call this.destroy()
endif
set this = this.next
endloop
endmethod
static method cond takes nothing returns boolean
local thistype this
local integer lvl
local real angle
local unit u
local unit v
local real x
local real y
local player p
local real dist
if GetSpellAbilityId() == SPELL_ID then
set u = GetTriggerUnit()
set x = GetUnitX(u)
set y = GetUnitY(u)
set p = GetOwningPlayer(u)
set lvl = GetUnitAbilityLevel(u, SPELL_ID)
call GroupEnumUnitsInRange(g, x, y, Aoe(lvl), null)
call DestroyEffect(AddSpecialEffect(MODEL_PATH, x, y))
loop
set v = FirstOfGroup(g)
exitwhen v == null
call GroupRemoveUnit(g,v)
if UnitFilter(p,v) then
//! runtextmacro STATIC_FIELD_ALLOC()
set this.cast = u
set this.targ = v
set this.cx = x
set this.cy = y
set this.tx = GetUnitX(v)
set this.ty = GetUnitY(v)
set angle = Atan2(this.ty-y, this.tx-x)
set dist = SquareRoot((this.tx-x)*(this.tx-x) + (this.ty-y)*(this.ty-y))
set this.dmg = MinDamage(lvl) + (1-(dist/Aoe(lvl)))*(MaxDamage(lvl)-MinDamage(lvl))
set this.x = SPEED*FPS*Cos(angle)
set this.y = SPEED*FPS*Sin(angle)
call MoveLocation(loc, x, y)
set this.cz = GetLocationZ(loc)
call MoveLocation(loc, this.tx, this.ty)
set this.z = GetLocationZ(loc) + 20 + GetUnitFlyHeight(v)
set this.light = AddLightningEx(LIGHTNING_ID, true, this.cx, this.cy, this.cz, this.tx, this.ty, this.z)
call SetLightningColor(this.light, LIGHTNING_RED, LIGHTNING_GREEN, LIGHTNING_BLUE, LIGHTNING_ALPHA)
call SetLightningColor(this.light, LIGHTNING_RED, LIGHTNING_GREEN, LIGHTNING_BLUE, LIGHTNING_ALPHA)
set this.steps = R2I(DURATION/FPS)
call SetUnitPropWindow(this.targ, 0)
endif
endloop
set u = null
set p = null
endif
return false
endmethod
static method onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition(function thistype.cond))
call Preload(MODEL_PATH)
set count = 0
set period = CreateTimer()
set g = CreateGroup()
set loc = Location(0,0)
set t = null
endmethod
endstruct
endscope
//TESH.scrollpos=183
//TESH.alwaysfold=0
scope DistantFieldA
//native UnitAlive takes unit id returns boolean
globals
private constant real FPS = 0.0312500
private constant string MODEL_PATH = "Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl"
private constant integer SPELL_ID = 'A002'
private constant string LIGHTNING_ID = "FORK"
private constant real LIGHTNING_RED = 0.15
private constant real LIGHTNING_GREEN = 0.45
private constant real LIGHTNING_BLUE = 1.
private constant real LIGHTNING_ALPHA = 1.
private constant real DURATION = 0.75
private constant attacktype A_TYPE = ATTACK_TYPE_MAGIC
private constant damagetype D_TYPE = DAMAGE_TYPE_MAGIC
endglobals
private constant function MaxDamage takes integer level returns real
return 75.*level
endfunction
private constant function MinDamage takes integer level returns real
return 30.*level
endfunction
private constant function Aoe takes integer level returns real
return 600 + 75.*level
endfunction
private function UnitFilter takes player source, unit targ returns boolean
return IsUnitEnemy(targ, source) and UnitAlive(targ) and not IsUnitType(targ, UNIT_TYPE_MAGIC_IMMUNE)
endfunction
//! textmacro_once STATIC_FIELD_ALLOC
if thistype(0).prev == 0 then
set count = count + 1
set this = count
else
set this = thistype(0).prev
set thistype(0).prev = thistype(0).prev.prev
endif
if thistype(0).next == 0 then
call TimerStart(period, FPS, true, function thistype.periodic)
else
set thistype(0).next.prev = this
endif
set this.next = thistype(0).next
set thistype(0).next = this
set this.prev = thistype(0)
//! endtextmacro
private struct Caster extends array
real x
real y
real temp
thistype prev
thistype next
static integer count
static timer period
method destroy takes nothing returns nothing
if this.next != 0 then
set this.next.prev = this.prev
endif
set this.prev.next = this.next
set this.prev = thistype(0).prev
set thistype(0).prev = this
if thistype(0).next == 0 then
call PauseTimer(period)
endif
endmethod
static method periodic takes nothing returns nothing
local thistype this = thistype(0).next
loop
exitwhen this == 0
set this.temp = this.temp - FPS
if this.temp <= 0 then
call DestroyEffect(AddSpecialEffect(MODEL_PATH, this.x, this.y))
call this.destroy()
endif
set this = this.next
endloop
endmethod
static method add takes real x, real y returns nothing
local thistype this
//! runtextmacro STATIC_FIELD_ALLOC()
set this.x = x
set this.y = y
set this.temp = DURATION
endmethod
static method onInit takes nothing returns nothing
set count = 0
set period = CreateTimer()
endmethod
endstruct
private struct SF extends array
unit targ
unit cast
lightning light
real dmg
real cx
real cy
real cz
real tx
real ty
real x
real y
real z
integer steps
thistype prev
thistype next
static integer count
static timer period
static group g
static location loc
method destroy takes nothing returns nothing
if this.next != 0 then
set this.next.prev = this.prev
endif
set this.prev.next = this.next
set this.prev = thistype(0).prev
set thistype(0).prev = this
if thistype(0).next == 0 then
call PauseTimer(period)
endif
call UnitDamageTarget(this.cast, this.targ, this.dmg, true, false, A_TYPE, D_TYPE, null)
call DestroyLightning(this.light)
call SetUnitPropWindow(this.targ, GetUnitDefaultPropWindow(this.targ)*bj_DEGTORAD)
set this.light = null
set this.cast = null
set this.targ = null
endmethod
static method periodic takes nothing returns nothing
local thistype this = thistype(0).next
loop
exitwhen this == 0
set this.tx = this.tx+this.x
set this.ty = this.ty+this.y
call MoveLocation(loc, this.tx, this.ty)
set this.z = GetLocationZ(loc) + 20 + GetUnitFlyHeight(this.targ)
if IsTerrainWalkable(this.tx, this.ty) then
call MoveLightningEx(this.light, true, this.cx, this.cy, this.cz, this.tx, this.ty, this.z)
call SetUnitX(this.targ, this.tx)
call SetUnitY(this.targ, this.ty)
endif
set this.steps = this.steps - 1
if this.steps == 0 then
call this.destroy()
endif
set this = this.next
endloop
endmethod
static method cond takes nothing returns boolean
local thistype this
local integer lvl
local real angle
local unit u
local unit v
local real x
local real y
local player p
local real dist
if GetSpellAbilityId() == SPELL_ID then
set u = GetTriggerUnit()
set x = GetSpellTargetX()
set y = GetSpellTargetY()
set p = GetOwningPlayer(u)
set lvl = GetUnitAbilityLevel(u, SPELL_ID)
call GroupEnumUnitsInRange(g, x, y, Aoe(lvl), null)
loop
set v = FirstOfGroup(g)
exitwhen v == null
call GroupRemoveUnit(g,v)
if UnitFilter(p,v) then
//! runtextmacro STATIC_FIELD_ALLOC()
set this.cast = u
set this.targ = v
set this.cx = x
set this.cy = y
set this.tx = GetUnitX(v)
set this.ty = GetUnitY(v)
set angle = Atan2(this.ty-y, this.tx-x)
set dist = SquareRoot((this.tx-x)*(this.tx-x) + (this.ty-y)*(this.ty-y))
set this.dmg = MinDamage(lvl) + (dist/Aoe(lvl))*(MaxDamage(lvl)-MinDamage(lvl))
set this.x = -(dist/DURATION)*FPS*Cos(angle)
set this.y = -(dist/DURATION)*FPS*Sin(angle)
call MoveLocation(loc, x, y)
set this.cz = GetLocationZ(loc) + 20
call MoveLocation(loc, this.tx, this.ty)
set this.z = GetLocationZ(loc) + 20 + GetUnitFlyHeight(v)
set this.light = AddLightningEx(LIGHTNING_ID, true, this.cx, this.cy, this.cz, this.tx, this.ty, this.z)
call SetLightningColor(this.light, LIGHTNING_RED, LIGHTNING_GREEN, LIGHTNING_BLUE, LIGHTNING_ALPHA)
call SetLightningColor(this.light, LIGHTNING_RED, LIGHTNING_GREEN, LIGHTNING_BLUE, LIGHTNING_ALPHA)
set this.steps = R2I(DURATION/FPS)
call SetUnitPropWindow(this.targ, 0)
endif
endloop
call Caster.add(x,y)
set u = null
set p = null
endif
return false
endmethod
static method onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition(function thistype.cond))
call Preload(MODEL_PATH)
set count = 0
set period = CreateTimer()
set g = CreateGroup()
set loc = Location(0,0)
set t = null
endmethod
endstruct
endscope
//TESH.scrollpos=139
//TESH.alwaysfold=0
scope DistantFieldE
//native UnitAlive takes unit id returns boolean
globals
private constant real FPS = 0.0312500
private constant string MODEL_PATH = "Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl"
private constant integer SPELL_ID = 'A003'
private constant string LIGHTNING_ID = "FORK"
private constant real LIGHTNING_RED = 1
private constant real LIGHTNING_GREEN = 0.45
private constant real LIGHTNING_BLUE = 0.15
private constant real LIGHTNING_ALPHA = 1.
private constant real DURATION = 0.75
private constant attacktype A_TYPE = ATTACK_TYPE_MAGIC
private constant damagetype D_TYPE = DAMAGE_TYPE_MAGIC
private constant real SPEED = 600.
endglobals
private constant function MaxDamage takes integer level returns real
return 75.*level
endfunction
private constant function MinDamage takes integer level returns real
return 30.*level
endfunction
private constant function Aoe takes integer level returns real
return 600 + 75.*level
endfunction
private function UnitFilter takes player source, unit targ returns boolean
return IsUnitEnemy(targ, source) and UnitAlive(targ) and not IsUnitType(targ, UNIT_TYPE_MAGIC_IMMUNE)
endfunction
//! textmacro_once STATIC_FIELD_ALLOC
if thistype(0).prev == 0 then
set count = count + 1
set this = count
else
set this = thistype(0).prev
set thistype(0).prev = thistype(0).prev.prev
endif
if thistype(0).next == 0 then
call TimerStart(period, FPS, true, function thistype.periodic)
else
set thistype(0).next.prev = this
endif
set this.next = thistype(0).next
set thistype(0).next = this
set this.prev = thistype(0)
//! endtextmacro
private struct SF extends array
unit targ
unit cast
lightning light
real dmg
real cx
real cy
real cz
real tx
real ty
real x
real y
real z
integer steps
thistype prev
thistype next
static integer count
static timer period
static group g
static location loc
method destroy takes nothing returns nothing
if this.next != 0 then
set this.next.prev = this.prev
endif
set this.prev.next = this.next
set this.prev = thistype(0).prev
set thistype(0).prev = this
if thistype(0).next == 0 then
call PauseTimer(period)
endif
call UnitDamageTarget(this.cast, this.targ, this.dmg, true, false, A_TYPE, D_TYPE, null)
call DestroyLightning(this.light)
call SetUnitPropWindow(this.targ, GetUnitDefaultPropWindow(this.targ)*bj_DEGTORAD)
set this.light = null
set this.cast = null
set this.targ = null
endmethod
static method periodic takes nothing returns nothing
local thistype this = thistype(0).next
loop
exitwhen this == 0
set this.tx = this.tx+this.x
set this.ty = this.ty+this.y
call MoveLocation(loc, this.tx, this.ty)
set this.z = GetLocationZ(loc) + 20 + GetUnitFlyHeight(this.targ)
if IsTerrainWalkable(this.tx, this.ty) then
call MoveLightningEx(this.light, true, this.cx, this.cy, this.cz, this.tx, this.ty, this.z)
call SetUnitX(this.targ, this.tx)
call SetUnitY(this.targ, this.ty)
endif
set this.steps = this.steps - 1
if this.steps == 0 then
call this.destroy()
endif
set this = this.next
endloop
endmethod
static method cond takes nothing returns boolean
local thistype this
local integer lvl
local real angle
local unit u
local unit v
local real x
local real y
local player p
local real dist
if GetSpellAbilityId() == SPELL_ID then
set u = GetTriggerUnit()
set x = GetSpellTargetX()
set y = GetSpellTargetY()
set p = GetOwningPlayer(u)
set lvl = GetUnitAbilityLevel(u, SPELL_ID)
call GroupEnumUnitsInRange(g, x, y, Aoe(lvl), null)
call DestroyEffect(AddSpecialEffect(MODEL_PATH, x, y))
loop
set v = FirstOfGroup(g)
exitwhen v == null
call GroupRemoveUnit(g,v)
if UnitFilter(p,v) then
//! runtextmacro STATIC_FIELD_ALLOC()
set this.cast = u
set this.targ = v
set this.cx = x
set this.cy = y
set this.tx = GetUnitX(v)
set this.ty = GetUnitY(v)
set angle = Atan2(this.ty-y, this.tx-x)
set dist = SquareRoot((this.tx-x)*(this.tx-x) + (this.ty-y)*(this.ty-y))
set this.dmg = MinDamage(lvl) + (1-(dist/Aoe(lvl)))*(MaxDamage(lvl)-MinDamage(lvl))
set this.x = SPEED*FPS*Cos(angle)
set this.y = SPEED*FPS*Sin(angle)
call MoveLocation(loc, x, y)
set this.cz = GetLocationZ(loc) + 20
call MoveLocation(loc, this.tx, this.ty)
set this.z = GetLocationZ(loc) + 20 + GetUnitFlyHeight(v)
set this.light = AddLightningEx(LIGHTNING_ID, true, this.cx, this.cy, this.cz, this.tx, this.ty, this.z)
call SetLightningColor(this.light, LIGHTNING_RED, LIGHTNING_GREEN, LIGHTNING_BLUE, LIGHTNING_ALPHA)
set this.steps = R2I(DURATION/FPS)
call SetUnitPropWindow(this.targ, 0)
endif
endloop
set u = null
set p = null
endif
return false
endmethod
static method onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition(function thistype.cond))
call Preload(MODEL_PATH)
set count = 0
set period = CreateTimer()
set g = CreateGroup()
set loc = Location(0,0)
set t = null
endmethod
endstruct
endscope
//TESH.scrollpos=12
//TESH.alwaysfold=0
library TerrainPathability initializer Init
//******************************************************************************
//* BY: Rising_Dusk
//*
//* This script can be used to detect the type of pathing at a specific point.
//* It is valuable to do it this way because the IsTerrainPathable is very
//* counterintuitive and returns in odd ways and aren't always as you would
//* expect. This library, however, facilitates detecting those things reliably
//* and easily.
//*
//******************************************************************************
//*
//* > function IsTerrainDeepWater takes real x, real y returns boolean
//* > function IsTerrainShallowWater takes real x, real y returns boolean
//* > function IsTerrainLand takes real x, real y returns boolean
//* > function IsTerrainPlatform takes real x, real y returns boolean
//* > function IsTerrainWalkable takes real x, real y returns boolean
//*
//* These functions return true if the given point is of the type specified
//* in the function's name and false if it is not. For the IsTerrainWalkable
//* function, the MAX_RANGE constant below is the maximum deviation range from
//* the supplied coordinates that will still return true.
//*
//* The IsTerrainPlatform works for any preplaced walkable destructable. It will
//* return true over bridges, destructable ramps, elevators, and invisible
//* platforms. Walkable destructables created at runtime do not create the same
//* pathing hole as preplaced ones do, so this will return false for them. All
//* other functions except IsTerrainWalkable return false for platforms, because
//* the platform itself erases their pathing when the map is saved.
//*
//* After calling IsTerrainWalkable(x, y), the following two global variables
//* gain meaning. They return the X and Y coordinates of the nearest walkable
//* point to the specified coordinates. These will only deviate from the
//* IsTerrainWalkable function arguments if the function returned false.
//*
//* Variables that can be used from the library:
//* [real] TerrainPathability_X
//* [real] TerrainPathability_Y
//*
globals
private constant real MAX_RANGE = 10.
private constant integer DUMMY_ITEM_ID = 'wolg'
endglobals
globals
private item Item = null
private rect Find = null
private item array Hid
private integer HidMax = 0
public real X = 0.
public real Y = 0.
endglobals
function IsTerrainDeepWater takes real x, real y returns boolean
return not IsTerrainPathable(x, y, PATHING_TYPE_FLOATABILITY) and IsTerrainPathable(x, y, PATHING_TYPE_WALKABILITY)
endfunction
function IsTerrainShallowWater takes real x, real y returns boolean
return not IsTerrainPathable(x, y, PATHING_TYPE_FLOATABILITY) and not IsTerrainPathable(x, y, PATHING_TYPE_WALKABILITY) and IsTerrainPathable(x, y, PATHING_TYPE_BUILDABILITY)
endfunction
function IsTerrainLand takes real x, real y returns boolean
return IsTerrainPathable(x, y, PATHING_TYPE_FLOATABILITY)
endfunction
function IsTerrainPlatform takes real x, real y returns boolean
return not IsTerrainPathable(x, y, PATHING_TYPE_FLOATABILITY) and not IsTerrainPathable(x, y, PATHING_TYPE_WALKABILITY) and not IsTerrainPathable(x, y, PATHING_TYPE_BUILDABILITY)
endfunction
private function HideItem takes nothing returns nothing
if IsItemVisible(GetEnumItem()) then
set Hid[HidMax] = GetEnumItem()
call SetItemVisible(Hid[HidMax], false)
set HidMax = HidMax + 1
endif
endfunction
function IsTerrainWalkable takes real x, real y returns boolean
//Hide any items in the area to avoid conflicts with our item
call MoveRectTo(Find, x, y)
call EnumItemsInRect(Find ,null, function HideItem)
//Try to move the test item and get its coords
call SetItemPosition(Item, x, y) //Unhides the item
set X = GetItemX(Item)
set Y = GetItemY(Item)
static if LIBRARY_IsTerrainWalkable then
//This is for compatibility with the IsTerrainWalkable library
set IsTerrainWalkable_X = X
set IsTerrainWalkable_Y = Y
endif
call SetItemVisible(Item, false)//Hide it again
//Unhide any items hidden at the start
loop
exitwhen HidMax <= 0
set HidMax = HidMax - 1
call SetItemVisible(Hid[HidMax], true)
set Hid[HidMax] = null
endloop
//Return walkability
return (X-x)*(X-x)+(Y-y)*(Y-y) <= MAX_RANGE*MAX_RANGE and not IsTerrainPathable(x, y, PATHING_TYPE_WALKABILITY)
endfunction
private function Init takes nothing returns nothing
set Find = Rect(0., 0., 128., 128.)
set Item = CreateItem(DUMMY_ITEM_ID, 0, 0)
call SetItemVisible(Item, false)
endfunction
endlibrary