//TESH.scrollpos=162
//TESH.alwaysfold=0
function AntiLeak takes nothing returns boolean
return true
endfunction
library Knockback initializer Init
// *******************************************************************************
// ** **
// ** Knockback(Ex) **
// ** ————————————— **
// ** **
// ** Just a function I made for efficient knockbacking **
// ** ** Made by Silvenon
// *******************************************************************************
public struct Data
unit u
real d1
real d2
real sin
real cos
real r
string s = ""
effect e = null
endstruct
globals
private timer Tim = CreateTimer()
private Data array Ar
private boolean array BoolAr
private integer Total = 0
private boolexpr Cond = null
private real MAX_X
private real MAX_Y
private real MIN_X
private real MIN_Y
endglobals
public function TreeFilter takes nothing returns boolean
local integer d = GetDestructableTypeId(GetFilterDestructable())
return d == 'ATtr' or d == 'BTtw' or d == 'KTtw' or d == 'YTft' or d == 'JTct' or d == 'YTst' or d == 'YTct' or d == 'YTwt' or d == 'JTwt' or d == 'JTwt' or d == 'FTtw' or d == 'CTtr' or d == 'ITtw' or d == 'NTtw' or d == 'OTtw' or d == 'ZTtw' or d == 'WTst' or d == 'LTlt' or d == 'GTsh' or d == 'Xtlt' or d == 'WTtw' or d == 'Attc' or d == 'BTtc' or d == 'CTtc' or d == 'ITtc' or d == 'NTtc' or d == 'ZTtc'
endfunction
private constant function Interval takes nothing returns real
return 0.04
endfunction
private function KillTree takes nothing returns nothing
if BoolAr[0] then
call KillDestructable(GetEnumDestructable())
else
set BoolAr[1] = true
endif
endfunction
private function Execute takes nothing returns nothing
local Data kd
local integer i = 0
local real x
local real y
local rect r
loop
exitwhen i >= Total
set kd = Ar[i]
if kd.s != null and kd.s != null then
set x = GetUnitX(kd.u)
set y = GetUnitY(kd.u)
call DestroyEffect(AddSpecialEffect(kd.s, x, y))
set x = x + kd.d1 * kd.cos
set y = y + kd.d1 * kd.sin
else
set x = GetUnitX(kd.u) + kd.d1 * kd.cos
set y = GetUnitY(kd.u) + kd.d1 * kd.sin
endif
set r = Rect(x - kd.r, y - kd.r, x + kd.r, y + kd.r)
set BoolAr[0] = kd.r != 0
call EnumDestructablesInRect(r, Cond, function KillTree)
call RemoveRect(r)
set r = null
if (x < MAX_X and y < MAX_Y and x > MIN_X and y > MIN_Y) and not BoolAr[1] then
call SetUnitX(kd.u, x)
call SetUnitY(kd.u, y)
endif
set kd.d1 = kd.d1 - kd.d2
if kd.d1 <= 0 or (x > MAX_X or y > MAX_Y or x < MIN_X or y < MIN_Y) or BoolAr[1] then
if kd.e != null then
call DestroyEffect(kd.e)
endif
call PauseUnit(kd.u, false)
set Ar[i] = Ar[Total - 1]
set Total = Total - 1
call kd.destroy()
set BoolAr[0] = false
set BoolAr[1] = false
endif
set i = i + 1
endloop
if Total == 0 then
call PauseTimer(Tim)
endif
endfunction
function KnockbackEx takes unit u, real d, real a, real w, real r, integer t, string s, string p returns Data
local Data kd = Data.create()
local integer q = R2I(w / Interval())
set kd.u = u
set kd.d1 = 2 * d / (q + 1)
set kd.d2 = kd.d1 / q
set kd.sin = Sin(a)
set kd.cos = Cos(a)
set kd.r = r
if s != "" and s != null then
if t == 2 then
if p != "" and p != null then
set kd.e = AddSpecialEffectTarget(s, u, p)
else
set kd.e = AddSpecialEffectTarget(s, u, "chest")
endif
elseif t == 1 then
set kd.s = s
endif
endif
call SetUnitPosition(u, GetUnitX(u), GetUnitY(u))
call PauseUnit(u, true)
if Total == 0 then
call TimerStart(Tim, Interval(), true, function Execute)
endif
set Total = Total + 1
set Ar[Total - 1] = kd
return kd
endfunction
function Knockback takes unit u, real d, real a, real w returns Data
return KnockbackEx(u, d, a, w, 0, 1, "Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl", "")
endfunction
private function Init takes nothing returns nothing
set Cond = Filter(function TreeFilter)
set BoolAr[0] = false
set BoolAr[1] = false
set MAX_X = GetRectMaxX(bj_mapInitialPlayableArea) - 64
set MAX_Y = GetRectMaxY(bj_mapInitialPlayableArea) - 64
set MIN_X = GetRectMinX(bj_mapInitialPlayableArea) + 64
set MIN_Y = GetRectMinY(bj_mapInitialPlayableArea) + 64
endfunction
endlibrary
function SetUnitXY takes unit u, real x, real y returns nothing
local real minx = GetRectMinX ( bj_mapInitialPlayableArea )
local real maxx = GetRectMaxX ( bj_mapInitialPlayableArea )
local real miny = GetRectMinY ( bj_mapInitialPlayableArea )
local real maxy = GetRectMaxY ( bj_mapInitialPlayableArea )
if ( x < minx ) then
call SetUnitX ( u, minx )
elseif ( x > maxx ) then
call SetUnitX ( u, maxx )
else
call SetUnitX ( u, x )
endif
if ( y < miny ) then
call SetUnitY ( u, miny )
elseif ( y > maxy ) then
call SetUnitY ( u, maxy )
else
call SetUnitY ( u, y )
endif
endfunction
library Jump initializer Init_Jump
// *******************************************************************************
// ** **
// ** Jump **
// ** ———————— **
// ** **
// ** Just a function I made for efficient jumping **
// ** **
// *******************************************************************************
//========================================//
//Credits to Shadow1500 for this function!//
//========================================//
private function JumpParabola takes real dist, real maxdist, real curve returns real
local real t = (dist * 2) / maxdist - 1
return (- t * t + 1) * (maxdist / curve)
endfunction
//=======================================//
//Credits to PitzerMike for this function//
//=======================================//
//===========================================================================
private function TreeKill takes nothing returns nothing
call KillDestructable(GetEnumDestructable())
endfunction
globals
private integer DUMMY_ID = 'h005'
private constant real Interval = 0.035
private boolexpr Bool
private location Loc = Location(0, 0)
private timer Tim = CreateTimer()
private integer Total = 0
endglobals
private function TreeFilter takes nothing returns boolean
local destructable d = GetFilterDestructable()
local boolean i = IsDestructableInvulnerable(d)
local unit u = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), DUMMY_ID,GetWidgetX(d), GetWidgetY(d), 0)
local boolean result = false
call UnitAddAbility(u, 'Ahrl')
if i then
call SetDestructableInvulnerable(d, false)
endif
set result = IssueTargetOrder(u, "harvest", d)
call RemoveUnit(u)
if i then
call SetDestructableInvulnerable(d, true)
endif
set u = null
set d = null
return result
endfunction
public struct Data
unit u
integer q
real md
real d
real c
real sin
real cos
integer i = 1
real r
string s
static method create takes unit u, integer q, real x2, real y2, real c, real r, string s1, string s2 returns Data
local Data dat = Data.allocate()
local real x1 = GetUnitX(u)
local real y1 = GetUnitY(u)
local real dx = x1 - x2
local real dy = y1 - y2
local real a = Atan2(y2 - y1, x2 - x1)
set dat.u = u
set dat.q = q
set dat.md = SquareRoot(dx * dx + dy * dy)
set dat.d = dat.md / q
set dat.c = c
set dat.sin = Sin(a)
set dat.cos = Cos(a)
set dat.r = r
set dat.s = s2
if s1 != "" and s1 != null then
call DestroyEffect(AddSpecialEffect(s1, x1, y1))
endif
call UnitAddAbility(u, 'Amrf')
call UnitRemoveAbility(u, 'Amrf')
call PauseUnit(u, true)
return dat
endmethod
method onDestroy takes nothing returns nothing
local real x
local real y
local rect r
if .r != 0 then
set x = GetUnitX(.u)
set y = GetUnitY(.u)
set r = Rect(x - .r, y - .r, x + .r, y + .r)
call EnumDestructablesInRect(r, Bool, function TreeKill)
call RemoveRect(r)
set r = null
endif
if .s != "" and .s != null then
call DestroyEffect(AddSpecialEffect(.s, x, y))
endif
call PauseUnit(.u, false)
endmethod
endstruct
globals
private Data array Ar
endglobals
private function Execute takes nothing returns nothing
local Data dat
local integer i = 0
local real x
local real y
local location l
local real h
local rect r
loop
exitwhen i >= Total
set dat = Ar[i]
set x = GetUnitX(dat.u) + dat.d * dat.cos
set y = GetUnitY(dat.u) + dat.d * dat.sin
call MoveLocation(Loc, x, y)
set h = JumpParabola(dat.d * dat.i, dat.md, dat.c) - GetLocationZ(Loc)
call SetUnitX(dat.u, x)
call SetUnitY(dat.u, y)
call SetUnitFlyHeight(dat.u, h, 0)
if dat.i >= dat.q then
call dat.destroy()
set Total = Total - 1
set Ar[i] = Ar[Total]
else
set dat.i = dat.i + 1
endif
set i = i + 1
endloop
if Total == 0 then
call PauseTimer(Tim)
endif
set l = null
endfunction
function Jump takes unit whichUnit, real dur, real destX, real destY, real curve, real radius, string sfx1, string sfx2 returns nothing
local Data dat = Data.create(whichUnit, R2I(dur / Interval), destX, destY, curve, radius, sfx1, sfx2)
if Total == 0 then
call TimerStart(Tim, Interval, true, function Execute)
endif
set Ar[Total] = dat
set Total = Total + 1
endfunction
//==================================================================================
function Init_Jump takes nothing returns nothing
set Bool = Filter(function TreeFilter)
endfunction
endlibrary
function CreateTextTagUnit takes string s, unit whichUnit, real zOffset, real size, integer red, integer green, integer blue, integer transparency, real velocityA, real velocityB, real lifespan, boolean perma, boolean visible returns nothing
local texttag LastTextTag = CreateTextTag()
call SetTextTagText(LastTextTag, s, size * 0.023 / 10)
call SetTextTagPosUnit(LastTextTag, whichUnit, zOffset)
call SetTextTagColor(LastTextTag, red, green, blue, transparency)
call SetTextTagVelocity( LastTextTag, velocityA, velocityB )
call SetTextTagLifespan( LastTextTag, lifespan )
call SetTextTagPermanent( LastTextTag, perma )
call SetTextTagVisibility( LastTextTag, visible )
endfunction
Name | Type | is_array | initial_value |
KR_Effect | effect | Yes | |
KR_HitOrNo | boolean | Yes | |
KR_KillCount | integer | Yes |
//TESH.scrollpos=135
//TESH.alwaysfold=0
scope GravityDrain initializer Init
public struct Data
unit caster
unit target
real distancebetween = 0
real distancemax = 0
real facing = 0
effect E
real x = 0
real y = 0
real x1 = 0
real y1 = 0
real x2 = 0
real y2 = 0
integer countdown = 0
real speed = 450*0.03
real damage
group damaged
group alreadydamaged
endstruct
globals
private Data array Ar
private integer Total = 0
private boolean array BoolAr
private timer t = CreateTimer()
private boolexpr Cond = null
private integer tempint
private integer SPELL_ID = 'A001'
private constant real DamageDone = 25.00 //This is the damage basic var, it is multiplicated with the level of Gravity Drain.
endglobals
public function TreeFilter takes nothing returns boolean
local integer d = GetDestructableTypeId(GetFilterDestructable())
return d == 'ATtr' or d == 'BTtw' or d == 'KTtw' or d == 'YTft' or d == 'JTct' or d == 'YTst' or d == 'YTct' or d == 'YTwt' or d == 'JTwt' or d == 'JTwt' or d == 'FTtw' or d == 'CTtr' or d == 'ITtw' or d == 'NTtw' or d == 'OTtw' or d == 'ZTtw' or d == 'WTst' or d == 'LTlt' or d == 'GTsh' or d == 'Xtlt' or d == 'WTtw' or d == 'Attc' or d == 'BTtc' or d == 'CTtc' or d == 'ITtc' or d == 'NTtc' or d == 'ZTtc'
endfunction
private function KillTree takes nothing returns nothing
local Data kd = Ar[tempint]
if GetDestructableLife(GetEnumDestructable()) > 0.405 then
call KillDestructable(GetEnumDestructable())
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl", kd.target, "chest"))
call UnitDamageTarget(kd.caster, kd.target, kd.damage, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
endif
endfunction
private function Trig_Gravity_Drain_Conditions takes nothing returns boolean
return GetSpellAbilityId() == SPELL_ID
endfunction
function Trig_Gravity_Pull_Loop takes nothing returns nothing
local Data kd
local integer i = 0
local rect R
local unit P
loop
exitwhen i >= Total
set kd = Ar[i]
set kd.damaged = CreateGroup()
if (GetUnitCurrentOrder(kd.caster) != String2OrderIdBJ("charm") or (kd.distancebetween + 150) >= kd.distancemax) or GetWidgetLife(kd.target) < 0.405 then
call IssueImmediateOrder(kd.caster, "stop")
call PauseUnit(kd.target, false)
call SetUnitPathing(kd.target, true)
call SetUnitFlyHeight(kd.target,0, 320)
call DestroyGroup(kd.alreadydamaged)
set kd.caster = null
set kd.target = null
call DestroyEffect(kd.E)
set Ar[i] = Ar[Total - 1]
set Total = Total - 1
call kd.destroy()
else
set kd.distancebetween = kd.distancebetween + kd.speed
set kd.x2 = kd.x1 + kd.distancebetween * Cos(kd.facing)
set kd.y2 = kd.y1 + kd.distancebetween * Sin(kd.facing)
call SetUnitXY(kd.target, kd.x2, kd.y2)
set kd.countdown = kd.countdown + 1
call GroupEnumUnitsInRange(kd.damaged, kd.x2, kd.y2, 125.00, Filter(function AntiLeak))
set kd.damage = DamageDone*GetUnitAbilityLevel(kd.caster, SPELL_ID)
loop
set P = FirstOfGroup(kd.damaged)
exitwhen P == null
if not IsUnitInGroup(P, kd.alreadydamaged) and P != kd.target and P != kd.caster and GetWidgetLife(P) > 0.405 and not IsUnitAlly(kd.target, GetOwningPlayer(kd.caster)) then
call UnitDamageTarget(kd.caster, kd.target, kd.damage, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
call UnitDamageTarget(kd.caster, P, kd.damage, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl", kd.target, "chest"))
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl", P, "chest"))
endif
call GroupAddUnit(kd.alreadydamaged, P)
call GroupRemoveUnit(kd.damaged, P)
set P = null
endloop
set R = Rect(kd.x2 - 100, kd.y2 - 100, kd.x2 + 100, kd.y2 + 100)
set tempint = i
set kd.damage = GetUnitAbilityLevel(kd.caster, SPELL_ID)*15
call EnumDestructablesInRect(R, Cond, function KillTree)
call RemoveRect(R)
set R = null
if kd.countdown == 5 then
call SetUnitFlyHeight(kd.target, GetRandomInt(45, 70), 360)
endif
if kd.countdown == 10 then
call SetUnitFlyHeight(kd.target, 80, 360)
set kd.countdown = 0
endif
endif
call DestroyGroup(kd.damaged)
set i = i + 1
endloop
if Total == 0 then
call PauseTimer(t)
endif
endfunction
function Trig_Gravity_Drain_Actions takes nothing returns nothing
local Data kd = Data.create()
set kd.caster = GetTriggerUnit()
set kd.target = GetSpellTargetUnit()
set kd.x = GetUnitX(kd.caster)
set kd.x1 = GetUnitX(kd.target)
set kd.y = GetUnitY(kd.caster)
set kd.y1 = GetUnitY(kd.target)
set kd.distancemax = SquareRoot((kd.x - kd.x1) * (kd.x - kd.x1) + (kd.y - kd.y1) * (kd.y - kd.y1))
set kd.facing = Atan2(kd.y - kd.y1, kd.x - kd.x1)
set kd.alreadydamaged = CreateGroup()
call UnitAddAbility( kd.target, 'Amrf' )
call UnitRemoveAbility( kd.target, 'Amrf' )
call PauseUnit(kd.target, true)
set kd.E = AddSpecialEffectTarget("Abilities\\Spells\\Undead\\AntiMagicShell\\AntiMagicShell.mdl", kd.target, "overhead")
call SetUnitFlyHeight(kd.target, 80, 360)
call SetUnitPathing(kd.target, false)
call TriggerSleepAction(0.25)
if Total == 0 then
call TimerStart(t, 0.03, true, function Trig_Gravity_Pull_Loop)
endif
set Ar[Total] = kd
set Total = Total + 1
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local integer index = 0
set Cond = Filter(function TreeFilter)
call Preload("Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl")
set gg_trg_GravityDrain = CreateTrigger( )
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_GravityDrain, Player(index), EVENT_PLAYER_UNIT_SPELL_EFFECT, Filter(function AntiLeak))
set index = index + 1
exitwhen index == bj_MAX_PLAYER_SLOTS
endloop
call TriggerAddCondition( gg_trg_GravityDrain, Condition( function Trig_Gravity_Drain_Conditions ) )
call TriggerAddAction( gg_trg_GravityDrain, function Trig_Gravity_Drain_Actions )
endfunction
endscope
//TESH.scrollpos=40
//TESH.alwaysfold=0
scope WildSand initializer Init
public struct WildSand
unit caster
player casterowner
real x
real y
real x1
real y1
real x2
real y2
terraindeformation T
group Sanded
unit Pick
real facing = 0
timer ti
integer counter = 0
real duration = 0
endstruct
globals
private WildSand array Br
private integer Total = 0
private integer tempint = 0
private timer t = CreateTimer()
private integer SPELL_ID = 'A002'
private constant real DamageDone = 100.00 //this * level = damage done.
endglobals
function Trig_Wild_Sand_Conditions takes nothing returns boolean
return GetSpellAbilityId() == SPELL_ID
endfunction
function Trig_Wild_Sand_Whirl takes nothing returns nothing
local WildSand kb
local integer i = 0
loop
exitwhen i >= Total
set kb = Br[i]
set tempint = i
set kb.Sanded = CreateGroup()
set kb.counter = kb.counter + 5
if kb.counter == 100 then
set kb.counter = 0
set kb.duration = kb.duration + 1.00
call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl", kb.x, kb.y))
call GroupEnumUnitsInRange(kb.Sanded, kb.x, kb.y, 375.00, Filter(function AntiLeak))
loop
set kb.Pick = FirstOfGroup(kb.Sanded)
exitwhen kb.Pick == null
call GroupRemoveUnit(kb.Sanded, kb.Pick)
if GetUnitCurrentOrder(kb.Pick) != String2OrderIdBJ("stop") and not IsUnitType(kb.Pick,UNIT_TYPE_MAGIC_IMMUNE) and not IsUnitType(kb.Pick,UNIT_TYPE_FLYING) and not IsUnitAlly(kb.Pick, kb.casterowner) and not (GetUnitState(kb.Pick, UNIT_STATE_LIFE) <= 0.405) and not IsUnitType(kb.Pick, UNIT_TYPE_STRUCTURE) then
set kb.x1 = GetUnitX(kb.Pick)
set kb.y1 = GetUnitY(kb.Pick)
set kb.facing = Atan2(kb.y - kb.y1, kb.x - kb.x1)
if SquareRoot((kb.x - kb.x1) * (kb.x - kb.x1) + (kb.y - kb.y1) * (kb.y - kb.y1)) <= 100 then
set kb.x2 = kb.x1 + GetRandomReal(525, 625) * Cos(GetRandomReal(0.00, 360.00)*bj_DEGTORAD)
set kb.y2 = kb.y1 + GetRandomReal(525, 625) * Sin(GetRandomReal(0.00, 360.00)*bj_DEGTORAD)
call Jump(kb.Pick, 1.00, kb.x2, kb.y2, 2, 150, "Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl", "Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl")
call DestroyEffect(AddSpecialEffectTarget("Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl", kb.Pick, "chest"))
call UnitDamageTarget(kb.caster, kb.Pick, DamageDone*GetUnitAbilityLevel(kb.caster, SPELL_ID), true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
else
call Knockback(kb.Pick, 150.00, kb.facing, 0.25)
endif
endif
endloop
call DestroyGroup(kb.Sanded)
endif
if kb.duration == 20 then
set kb.caster = null
set kb.casterowner = null
call TerrainDeformStop(kb.T, 1)
set Br[i] = Br[Total - 1]
set Total = Total - 1
call kb.destroy()
endif
set i = i + 1
endloop
if Total == 0 then
call PauseTimer(t)
endif
endfunction
function Trig_Wild_Sand_Actions takes nothing returns nothing
local WildSand kb = WildSand.create()
local location temploc = GetSpellTargetLoc()
set kb.caster = GetTriggerUnit()
set kb.casterowner = GetOwningPlayer(kb.caster)
set kb.x = GetLocationX(temploc)
set kb.y = GetLocationY(temploc)
set kb.T = TerrainDeformCrater(kb.x, kb.y, 325.00, 250.00, 0, false)
call RemoveLocation(temploc)
if Total == 0 then
call TimerStart(t, 0.05, true, function Trig_Wild_Sand_Whirl)
endif
set Br[Total] = kb
set Total = Total + 1
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local integer index = 0
set gg_trg_WildSand = CreateTrigger( )
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_WildSand, Player(index), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
set index = index + 1
exitwhen index == bj_MAX_PLAYER_SLOTS
endloop
call TriggerAddCondition( gg_trg_WildSand, Condition( function Trig_Wild_Sand_Conditions ) )
call TriggerAddAction( gg_trg_WildSand, function Trig_Wild_Sand_Actions )
endfunction
endscope
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_UnholyBladeCheck takes nothing returns boolean
return GetUnitAbilityLevel(GetKillingUnit(), 'A003') > 0
endfunction
function Trig_Unholy_Blade_Actions takes nothing returns nothing
local unit U = GetKillingUnit()
local player p = GetOwningPlayer(U)
local integer maxsouls = 2 + (2*GetUnitAbilityLevel(U, 'A003'))
if udg_KR_KillCount[GetPlayerId(p) + 1] < (maxsouls + 1) then
set udg_KR_KillCount[GetPlayerId(p) + 1] = udg_KR_KillCount[GetPlayerId(p) + 1] + 1
call CreateTextTagUnit( I2S(udg_KR_KillCount[GetPlayerId(p) + 1]) + "/" + I2S(maxsouls) + " Souls!", U, 0.00, 10.00, 200, 200, 200, 255, 0, 0.03, 3.00, false, true)
endif
endfunction
//===========================================================================
function InitTrig_UnholyBlade takes nothing returns nothing
local integer index
set gg_trg_UnholyBlade = CreateTrigger( )
set index = 0
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_UnholyBlade, Player(index), EVENT_PLAYER_UNIT_DEATH, Filter(function AntiLeak))
set index = index + 1
exitwhen index == bj_MAX_PLAYER_SLOTS
endloop
call TriggerAddCondition( gg_trg_UnholyBlade, Condition( function Trig_UnholyBladeCheck ) )
call TriggerAddAction( gg_trg_UnholyBlade, function Trig_Unholy_Blade_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_UnholyBladeAttackCheck takes nothing returns boolean
local player P = GetOwningPlayer(GetAttacker())
return GetUnitAbilityLevel(GetAttacker(), 'A003') > 0 and udg_KR_HitOrNo[GetPlayerId(P) + 1]
endfunction
function Trig_Unholy_Blade_Attack_Actions takes nothing returns nothing
local unit U = GetAttacker()
local unit u = GetTriggerUnit()
local player p = GetOwningPlayer(U)
local integer maxsouls = 2 + (2*GetUnitAbilityLevel(U, 'A003'))
local real x = GetUnitX(U)
local real y = GetUnitY(U)
local real x1 = GetUnitX(u)
local real y1 = GetUnitY(u)
local real d = Atan2(y1 - y, x1 - x)
local real x2 = x1 + 350 * Cos(d)
local real y2 = y1 + 350 * Sin(d)
call QueueUnitAnimation(U, "attack slam")
call CreateTextTagUnit( "Unleash! +" + I2S(R2I(20.00*udg_KR_KillCount[GetPlayerId(p) + 1])) + " Damage", U, 0.00, 10.00, 100, 100, 100, 255, 0, 0.03, 5.00, false, true)
call DestroyEffect(udg_KR_Effect[GetPlayerId(p) + 1])
call Jump(u, 0.50, x2, y2, 1.80, 100, "Abilities\\Weapons\\ZigguratMissile\\ZigguratMissile.mdl", "Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl")
call UnitDamageTarget(U, u, 20.00*udg_KR_KillCount[GetPlayerId(p) + 1], true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
set udg_KR_KillCount[GetPlayerId(p) + 1] = 0
set udg_KR_HitOrNo[GetPlayerId(p) + 1] = false
set U = null
set u = null
endfunction
//===========================================================================
function InitTrig_UnholyBladeAttack takes nothing returns nothing
local integer index
call Preload("Abilities\\Weapons\\ZigguratMissile\\ZigguratMissile.mdl")
set gg_trg_UnholyBladeAttack = CreateTrigger( )
set index = 0
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_UnholyBladeAttack, Player(index), EVENT_PLAYER_UNIT_ATTACKED, Filter(function AntiLeak))
set index = index + 1
exitwhen index == bj_MAX_PLAYER_SLOTS
endloop
call TriggerAddCondition( gg_trg_UnholyBladeAttack, Condition( function Trig_UnholyBladeAttackCheck ) )
call TriggerAddAction( gg_trg_UnholyBladeAttack, function Trig_Unholy_Blade_Attack_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_UnholyBladeActivate_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A007'
endfunction
function Trig_UnholyBladeActivate_Actions takes nothing returns nothing
local unit caster = GetSpellAbilityUnit()
local player casterowner = GetOwningPlayer(caster)
if udg_KR_KillCount[GetPlayerId(casterowner) + 1] > 0 then
set udg_KR_HitOrNo[GetPlayerId(casterowner) + 1] = true
set udg_KR_Effect[GetPlayerId(casterowner) + 1] = AddSpecialEffectTarget("Abilities\\Weapons\\ZigguratMissile\\ZigguratMissile.mdl", caster, "weapon")
endif
set caster = null
endfunction
//===========================================================================
function InitTrig_UnholyBladeActivate takes nothing returns nothing
set gg_trg_UnholyBladeActivate = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_UnholyBladeActivate, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_UnholyBladeActivate, Condition( function Trig_UnholyBladeActivate_Conditions ) )
call TriggerAddAction( gg_trg_UnholyBladeActivate, function Trig_UnholyBladeActivate_Actions )
endfunction
//TESH.scrollpos=155
//TESH.alwaysfold=0
scope BladeTwister initializer Init
//This Spell is very limited, and it would be really complicated to change it, it works only in 3 steps, for example 200, 150, 100, more not.
public struct BladeTwister
unit caster
player casterowner
real facing = 0
real facingc = 0
boolean phase = true
boolean secphase = false
real heighttimer = 0
unit array blade[18]
real facingblade = 0
real x = 0
real y = 0
real x1 = 0
real y1 = 0
real dist = 100
group damaged
group damagedalrdy
real damage = 0
unit pick
effect array attach[2]
endstruct
globals
private BladeTwister array Tr
private integer Total = 0
private integer tempint = 0
private timer t = CreateTimer()
private integer SPELL_ID = 'A004'
private constant real DamageBasic = 200.00 //Damage done at start.
private constant real DamageReduce = 50.00 //Reduce per # travelled.
private constant real DistanceMax = 600 //Max range travelled
private constant real DistanceReduceDamage = 200.00 //This tells the distance steps which reduce the damage
endglobals
private function Trig_Blade_Twister_Conditions takes nothing returns boolean
return GetSpellAbilityId() == SPELL_ID
endfunction
function Trig_BladeTwisterShockWaves takes nothing returns nothing
local BladeTwister kb
local integer bladecount2 = 0
local integer i = 0
loop
exitwhen i >= Total
set kb = Tr[i]
if kb.secphase == false then
if kb.heighttimer < 0.375 then
set kb.heighttimer = kb.heighttimer + 0.03
if kb.heighttimer >= 0.25 and kb.phase == true then
call SetUnitFlyHeight(kb.caster, 0, 3200)
set kb.phase = false
endif
else
set kb.secphase = true
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl", GetUnitX(kb.caster), GetUnitY(kb.caster)))
set bladecount2 = 0
loop
exitwhen (bladecount2 == 18)
set kb.facingblade = kb.facingblade + 20
set kb.x = kb.x1 + kb.dist * Cos(kb.facingblade*bj_DEGTORAD)
set kb.y = kb.y1 + kb.dist * Sin(kb.facingblade*bj_DEGTORAD)
set kb.blade[bladecount2] = CreateUnit(kb.casterowner, 'h006', kb.x, kb.y, kb.facingblade)
set bladecount2 = bladecount2 + 1
endloop
call SetUnitInvulnerable( kb.caster, false )
call SetUnitAnimation( kb.caster, "stand" )
call SetUnitTimeScale(kb.caster, 100.00 * 0.01)
call PauseUnit(kb.caster, false)
endif
else
set bladecount2 = 0
set kb.facingblade = 0
set kb.dist = kb.dist + 12
set kb.damage = DamageBasic
if kb.dist < DistanceMax - (DistanceReduceDamage*2) then
set kb.damage = kb.damage
endif
if kb.dist > DistanceMax - (DistanceReduceDamage*2) then
set kb.damage = kb.damage - DamageReduce
endif
if kb.dist > DistanceMax - DistanceReduceDamage then
set kb.damage = kb.damage - DamageReduce
endif
if kb.dist < DistanceMax then
loop
exitwhen (bladecount2 == 18)
set kb.facingblade = kb.facingblade + 20
set kb.x = kb.x1 + kb.dist * Cos(kb.facingblade*bj_DEGTORAD)
set kb.y = kb.y1 + kb.dist * Sin(kb.facingblade*bj_DEGTORAD)
call SetUnitPosition(kb.blade[bladecount2], kb.x, kb.y)
call DestroyEffect(AddSpecialEffect("Abilities\\Weapons\\VoidWalkerMissile\\VoidWalkerMissile.mdl", kb.x, kb.y))
set kb.damaged = CreateGroup()
call GroupEnumUnitsInRange(kb.damaged, kb.x, kb.y, 125.00, Filter(function AntiLeak))
loop
set kb.pick = FirstOfGroup(kb.damaged)
exitwhen kb.pick == null
call GroupRemoveUnit(kb.damaged, kb.pick)
if not IsUnitInGroup(kb.pick, kb.damagedalrdy) and not IsUnitType(kb.pick,UNIT_TYPE_MAGIC_IMMUNE) and not IsUnitType(kb.pick,UNIT_TYPE_FLYING) and not IsUnitAlly(kb.pick, kb.casterowner) and not (GetUnitState(kb.pick, UNIT_STATE_LIFE) <= 0.405) then
call GroupAddUnit(kb.damagedalrdy, kb.pick)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Undead\\OrbOfDeath\\OrbOfDeathMissile.mdl", kb.pick, "origin"))
call UnitDamageTarget(kb.caster, kb.pick, kb.damage, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
call CreateTextTagUnit( I2S(R2I(kb.damage)) + "!", kb.pick, 0.00, 10.00, 255, 0, 255, 255, 0, 0.03, 4.00, false, true)
endif
set kb.pick = null
endloop
call DestroyGroup(kb.damaged)
set bladecount2 = bladecount2 + 1
endloop
else
set bladecount2 = 0
set kb.caster = null
call DestroyEffect(kb.attach[0])
call DestroyEffect(kb.attach[1])
loop
exitwhen (bladecount2 == 18)
call DestroyEffect(AddSpecialEffect("Abilities\\Weapons\\SkeletalMageMissile\\SkeletalMageMissile.mdl", GetUnitX(kb.blade[bladecount2]), GetUnitY(kb.blade[bladecount2])))
call RemoveUnit(kb.blade[bladecount2])
set bladecount2 = bladecount2 + 1
endloop
call DestroyGroup(kb.damagedalrdy)
set Tr[i] = Tr[Total - 1]
set Total = Total - 1
call kb.destroy()
endif
endif
set i = i + 1
endloop
if Total == 0 then
call PauseTimer(t)
endif
endfunction
function Trig_Blade_Twister_Actions takes nothing returns nothing
local BladeTwister kb = BladeTwister.create()
set kb.caster = GetSpellAbilityUnit()
set kb.casterowner = GetOwningPlayer(kb.caster)
set kb.facing = GetUnitFacing(kb.caster)
set kb.facingc = GetUnitFacing(kb.caster)
set kb.x1 = GetUnitX(kb.caster)
set kb.y1 = GetUnitY(kb.caster)
set kb.damagedalrdy = CreateGroup()
call UnitAddAbility(kb.caster, 'Amrf')
call UnitRemoveAbility(kb.caster, 'Amrf')
call SetUnitFlyHeight(kb.caster, 400, 1600)
call SetUnitInvulnerable( kb.caster, true )
call SetUnitAnimation( kb.caster, "spell" )
call SetUnitTimeScale(kb.caster, 0.00 * 0.01)
set kb.attach[0] = AddSpecialEffectTarget("Abilities\\Weapons\\DragonHawkMissile\\DragonHawkMissile.mdl", kb.caster, "hand left")
set kb.attach[1] = AddSpecialEffectTarget("Abilities\\Weapons\\DragonHawkMissile\\DragonHawkMissile.mdl", kb.caster, "hand right")
call TriggerSleepAction(0.01)
call PauseUnit(kb.caster, true)
if Total == 0 then
call TimerStart(t, 0.03, true, function Trig_BladeTwisterShockWaves)
endif
set Tr[Total] = kb
set Total = Total + 1
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local integer index = 0
set gg_trg_BladeTwister = CreateTrigger( )
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_BladeTwister, Player(index), EVENT_PLAYER_UNIT_SPELL_EFFECT, Filter(function AntiLeak))
set index = index + 1
exitwhen index == bj_MAX_PLAYER_SLOTS
endloop
call TriggerAddCondition( gg_trg_BladeTwister, Condition( function Trig_Blade_Twister_Conditions ) )
call TriggerAddAction( gg_trg_BladeTwister, function Trig_Blade_Twister_Actions )
endfunction
endscope
//TESH.scrollpos=164
//TESH.alwaysfold=0
scope BlisterBlast initializer Init
public struct BlisterBlast
real x = 0
real y = 0
real x1 = 0
real y1 = 0
real x2 = 0
real y2 = 0
unit caster
player casterowner
unit dummy
real facing = 0
real maxrange = 0
group hitted
unit hittedunit
real currentrange = 100
boolean check = false
real time = 0
real heightmax = 0
real height1 = 50
real height2 = 0
real accelerate = 0
real currentfly = 0
boolean check2 = false
real currentfly2 = 0
real damagedown = 0
real life = 0
real life2 = 0
unit pick
endstruct
globals
private BlisterBlast array Kr
private integer Total = 0
private integer tempint = 0
private timer t = CreateTimer()
private integer SPELL_ID = 'A006'
private integer DUMMY_ID = 'h007' //Missile Dummy ID
private constant real DamageDoneTarget = 30.00 //is dealt for every 100 height of flying during the bubble to the targeted unit
private constant real DamageDoneAoE = 15.00 //is dealt for every 100 height of flying during the bubble to all units around the target
private constant real BasicHeight = 100.00 //Basic Height + (AddHeight*level of blister blast) = max height of the bubble
private constant real AddHeight = 200.00 //Basic Height + (AddHeight*level of blister blast) = max height of the bubble
private constant real BubbleExplodeDamageBasic = 50.00 // BubbleExplodeDamageBasic + (BubbleExplodeDamageAdd* level of blister blast) = damage until the bubble bursts
private constant real BubbleExplodeDamageAdd = 50.00 // BubbleExplodeDamageBasic + (BubbleExplodeDamageAdd* level of blister blast) = damage until the bubble bursts
endglobals
private function Trig_Blister_Blast_Conditions takes nothing returns boolean
return GetSpellAbilityId() == SPELL_ID
endfunction
function Trig_BlisterBlastStuff takes nothing returns nothing
local BlisterBlast kb
local integer i = 0
loop
exitwhen i >= Total
set kb = Kr[i]
if kb.check == false then
if kb.currentrange <= kb.maxrange then
set kb.currentrange = kb.currentrange + 12
set kb.x2 = kb.x + kb.currentrange * Cos(kb.facing)
set kb.y2 = kb.y + kb.currentrange * Sin(kb.facing)
call SetUnitPosition(kb.dummy, kb.x2, kb.y2)
set kb.hitted = CreateGroup()
call GroupEnumUnitsInRange(kb.hitted, kb.x2, kb.y2, 110.00, Filter(function AntiLeak))
set kb.hittedunit = FirstOfGroup(kb.hitted)
if kb.hittedunit != null and not IsUnitType(kb.hittedunit,UNIT_TYPE_MAGIC_IMMUNE) and not IsUnitType(kb.hittedunit,UNIT_TYPE_FLYING) and not IsUnitAlly(kb.hittedunit, kb.casterowner) and not (GetUnitState(kb.hittedunit, UNIT_STATE_LIFE) <= 0.405) then
set kb.check = true
endif
call DestroyGroup(kb.hitted)
else
call UnitApplyTimedLife(kb.dummy, 'BTLF', 0.01)
set kb.dummy = null
set kb.caster = null
set Kr[i] = Kr[Total - 1]
set Total = Total - 1
call kb.destroy()
endif
else
if kb.time == 0.00 then
call SetUnitPathing(kb.hittedunit, false)
set kb.life = GetWidgetLife(kb.hittedunit)
call PauseUnit(kb.hittedunit, true)
set kb.x2 = GetUnitX(kb.hittedunit)
set kb.y2 = GetUnitY(kb.hittedunit)
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Undead\\FreezingBreath\\FreezingBreathMissile.mdl", kb.x2, kb.y2))
call SetUnitPosition(kb.dummy, kb.x2, kb.y2)
call UnitAddAbility(kb.hittedunit, 'Amrf')
call UnitRemoveAbility(kb.hittedunit, 'Amrf')
set kb.time = kb.time + 0.03
else
set kb.life2 = GetWidgetLife(kb.hittedunit)
if kb.currentfly >= kb.heightmax or GetWidgetLife(kb.hittedunit) < 0.405 or (kb.life - kb.life2) >= kb.damagedown then
set kb.accelerate = kb.accelerate + 3
call UnitApplyTimedLife(kb.dummy, 'BTLF', 0.01)
set kb.height2 = kb.height2 - kb.accelerate
call SetUnitFlyHeight(kb.hittedunit, kb.height2, 0)
set kb.check2 = true
else
set kb.time = kb.time + 0.03
set kb.height1 = kb.height1 + 4.5
set kb.height2 = kb.height2 + 4.5
set kb.currentfly = kb.currentfly + 4.5
call SetUnitFlyHeight(kb.dummy, kb.height1, 0)
call SetUnitFlyHeight(kb.hittedunit, kb.height2, 0)
endif
if (GetUnitFlyHeight(kb.hittedunit) <= 0.010 and kb.check2 == true) then
if GetWidgetLife(kb.hittedunit) > 0.405 then
set kb.currentfly = kb.currentfly/100
call UnitDamageTarget(kb.caster, kb.hittedunit, DamageDoneTarget*kb.currentfly, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
set kb.hitted = CreateGroup()
call GroupEnumUnitsInRange(kb.hitted, kb.x2, kb.y2, 225.00, Filter(function AntiLeak))
loop
set kb.pick = FirstOfGroup(kb.hitted)
exitwhen kb.pick == null
call GroupRemoveUnit(kb.hitted, kb.pick)
if kb.pick != kb.hittedunit and not IsUnitType(kb.pick,UNIT_TYPE_MAGIC_IMMUNE) and not IsUnitType(kb.pick,UNIT_TYPE_FLYING) and not IsUnitAlly(kb.pick, kb.casterowner) and not (GetUnitState(kb.pick, UNIT_STATE_LIFE) <= 0.405) then
call UnitDamageTarget(kb.caster, kb.pick, DamageDoneAoE*kb.currentfly, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl", kb.pick, "chest"))
endif
endloop
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl", kb.x2, kb.y2))
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl", kb.x2, kb.y2))
call DestroyGroup(kb.hitted)
endif
call PauseUnit(kb.hittedunit, false)
call SetUnitPathing(kb.hittedunit, true)
set kb.dummy = null
set kb.hittedunit = null
set kb.caster = null
set Kr[i] = Kr[Total - 1]
set Total = Total - 1
call kb.destroy()
endif
endif
endif
set i = i + 1
endloop
if Total == 0 then
call PauseTimer(t)
endif
endfunction
function Trig_Blister_Blast_Actions takes nothing returns nothing
local BlisterBlast kb = BlisterBlast.create()
local location l
set kb.caster = GetSpellAbilityUnit()
set kb.casterowner = GetOwningPlayer(kb.caster)
set kb.x = GetUnitX(kb.caster)
set kb.y = GetUnitY(kb.caster)
set l = GetSpellTargetLoc()
set kb.x1 = GetLocationX(l)
set kb.y1 = GetLocationY(l)
call RemoveLocation(l)
set l = null
set kb.facing = Atan2(kb.y1 - kb.y, kb.x1 - kb.x)
set kb.maxrange = SquareRoot((kb.x - kb.x1) * (kb.x - kb.x1) + (kb.y - kb.y1) * (kb.y - kb.y1)) + 100
set kb.x2 = kb.x + kb.currentrange * Cos(kb.facing)
set kb.y2 = kb.y + kb.currentrange * Sin(kb.facing)
call DestroyEffect(AddSpecialEffect("Abilities\\Weapons\\SkeletalMageMissile\\SkeletalMageMissile.mdl", kb.x2, kb.y2))
set kb.dummy = CreateUnit(kb.casterowner, DUMMY_ID, kb.x2, kb.y2, kb.facing)
call SetUnitPathing(kb.dummy, false)
set kb.heightmax = BasicHeight + (GetUnitAbilityLevel(kb.caster, 'A006')*AddHeight)
set kb.damagedown = BubbleExplodeDamageBasic + (GetUnitAbilityLevel(kb.caster, 'A006')*BubbleExplodeDamageAdd)
if Total == 0 then
call TimerStart(t, 0.03, true, function Trig_BlisterBlastStuff)
endif
set Kr[Total] = kb
set Total = Total + 1
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local integer index = 0
set gg_trg_BlisterBlast = CreateTrigger( )
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_BlisterBlast, Player(index), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
set index = index + 1
exitwhen index == bj_MAX_PLAYER_SLOTS
endloop
call TriggerAddCondition( gg_trg_BlisterBlast, Condition( function Trig_Blister_Blast_Conditions ) )
call TriggerAddAction( gg_trg_BlisterBlast, function Trig_Blister_Blast_Actions )
endfunction
endscope