//TESH.scrollpos=93
//TESH.alwaysfold=0
globals
hashtable hash = InitHashtable()
endglobals
//!==========================================================//
// Дистанция 2D
//!==========================================================//
function DistanceXY2D takes real X, real Y, real X2, real Y2 returns real
return SquareRoot((X2 - X) * (X2 - X) + (Y2 - Y) * (Y2 - Y))
endfunction
//!==========================================================//
// Фильтрация отряда
//!==========================================================//
function UnitCheck takes unit caster, unit u returns boolean
return IsUnitEnemy(u, GetOwningPlayer(caster)) and not (IsUnitType(u, UNIT_TYPE_DEAD) and GetUnitTypeId(u) != 0) and IsUnitType(u, UNIT_TYPE_GROUND) and not IsUnitType(u, UNIT_TYPE_STRUCTURE)
endfunction
//!==========================================================//
// Парабола
//!==========================================================//
function Parabola takes real h, real d, real x returns real
return (4 * h / d) * (d - x) * (x / d)
endfunction
//!==========================================================//
// Звук
//!==========================================================//
function Sound takes sound soundHandle returns nothing
set bj_lastPlayedSound = soundHandle
if (soundHandle != null) then
call StartSound(soundHandle)
endif
endfunction
//!====================================================================================
// Для канальных способностей
//!====================================================================================
function String2OrderId takes string orderIdString returns integer
local integer orderId
// Check to see if it's a generic order.
set orderId = OrderId(orderIdString)
if (orderId != 0) then
return orderId
endif
// Check to see if it's a (train) unit order.
set orderId = UnitId(orderIdString)
if (orderId != 0) then
return orderId
endif
// Unrecognized - return 0
return 0
endfunction
//!====================================================================================
// Плавающий текст
//!====================================================================================
function PercentInt takes real percentage, integer max returns integer
local integer result = R2I(percentage * I2R(max) * 0.01)
if (result < 0) then
set result = 0
elseif (result > max) then
set result = max
endif
return result
endfunction
function PercentTo takes real percentage returns integer
return PercentInt(percentage, 255)
endfunction
function SetTextTagVelocityR takes texttag tt, real speed, real angle returns nothing
local real vel = speed * 0.071 / 128
local real xvel = vel * Cos(angle * bj_DEGTORAD)
local real yvel = vel * Sin(angle * bj_DEGTORAD)
call SetTextTagVelocity(tt, xvel, yvel)
endfunction
function CreateTextTagUnit takes string s, unit whichUnit, real zOffset, real size, real red, real green, real blue, real transparency returns texttag
local texttag tt = CreateTextTag()
local real textHeight = size * 0.023 / 10
call SetTextTagText(tt, s, textHeight)
call SetTextTagPosUnit(tt, whichUnit, zOffset)
call SetTextTagColor(tt, PercentTo(red), PercentTo(green), PercentTo(blue), PercentTo(100.0-transparency))
call SetTextTagVelocityR( tt, 90.00,90 )
call SetTextTagPermanent(tt, false)
call SetTextTagLifespan(tt, 3.00)
set tt = null
return tt
endfunction
//!====================================================================================
// Массивный урон
//!====================================================================================
function MassiveDamageAoe takes unit a, real x, real y, real damage,real radius returns nothing
local player p = GetOwningPlayer(a)
local group g = CreateGroup()
local unit n = GetEnumUnit()
call GroupEnumUnitsInRange(g,x,y,radius,null)
loop
set n = FirstOfGroup(g)
exitwhen n == null
if IsUnitEnemy(n, p) == true and UnitCheck(a, n) then
call UnitDamageTarget(a,n,damage,false,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_MAGIC,null)
endif
call GroupRemoveUnit(g,n)
endloop
call DestroyGroup(g)
set a = null
set g = null
set n = null
set p = null
endfunction
Name | Type | is_array | initial_value |
Angle | real | No | |
Caster | unit | No | |
Damage | real | No | |
Deggres | real | No | |
Degree | real | No | |
Distance | integer | No | |
Dummy | unit | Yes | |
HandleBoard | leaderboard | No | |
Integer1 | integer | Yes | |
Points | location | Yes | |
Real | real | No | |
Real1 | real | Yes | |
Sfx | effect | Yes | |
Size | real | No | |
Target | unit | No | |
X | integer | No | |
Zed1 | integer | No |
//TESH.scrollpos=0
//TESH.alwaysfold=0
function HandleCounter_Update takes nothing returns nothing
local integer i = 0
local integer id
local location array P
local real result=0
loop
exitwhen i >= 50
set i = i + 1
set P[i] = Location(0,0)
set id = GetHandleId(P[i])
set result = result + (id-0x100000)
endloop
set result = result/i-i/2
loop
call RemoveLocation(P[i])
set P[i] = null
exitwhen i <= 1
set i = i - 1
endloop
call LeaderboardSetItemValue(udg_HandleBoard,0,R2I(result))
endfunction
function HandleCounter_Actions takes nothing returns nothing
set udg_HandleBoard = CreateLeaderboard()
call LeaderboardSetLabel(udg_HandleBoard, "Handle Counter")
call PlayerSetLeaderboard(GetLocalPlayer(),udg_HandleBoard)
call LeaderboardDisplay(udg_HandleBoard,true)
call LeaderboardAddItem(udg_HandleBoard,"Handles",0,Player(0))
call LeaderboardSetSizeByItemCount(udg_HandleBoard,1)
call HandleCounter_Update()
call TimerStart(GetExpiredTimer(),0.01,true,function HandleCounter_Update)
endfunction
function InitTrig_HandleCounter takes nothing returns nothing
call TimerStart(CreateTimer(),0,false,function HandleCounter_Actions)
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_ss_Conditions takes nothing returns boolean
return GetUnitTypeId(GetDyingUnit()) == 'h001'
endfunction
function Trig_ss_Actions takes nothing returns nothing
call RemoveUnit(GetDyingUnit())
endfunction
//===========================================================================
function InitTrig_Bj_remove_Dummy takes nothing returns nothing
local trigger t = CreateTrigger( )
local integer index
set index = 0
loop
call TriggerRegisterPlayerUnitEvent(t, Player(index), EVENT_PLAYER_UNIT_DEATH, null)
set index = index + 1
exitwhen index == 14
endloop
call TriggerAddCondition(t, Condition( function Trig_ss_Conditions ) )
call TriggerAddAction(t, function Trig_ss_Actions )
set t = null
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
globals
constant integer RasenID = 'A000'
constant string RasenOrderId = "stampede"
constant real RasenDamageBase = 50.00
constant real ChannelDamage = 3.00
constant real RasenRadius = 350
// Урон автоматический умножается с уровнем
endglobals
function Trig_RS_Conditions takes nothing returns boolean
return GetSpellAbilityId() == RasenID
endfunction
function Rasen_Move takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local integer id = GetHandleId(t)
local unit a = LoadUnitHandle(hash,id,898)
local unit k1 = LoadUnitHandle(hash,id,899)
local unit k2 = LoadUnitHandle(hash,id,900)
local unit k3 = LoadUnitHandle(hash,id,901)
local real d = LoadReal(hash,id,902)
local real damage = LoadReal(hash,id,903)
local real cur = LoadReal(hash,id,904)
local real dis = LoadReal(hash,id,905) - (cur/35)
local boolean b = LoadBoolean(hash,id,906)
local effect e = LoadEffectHandle(hash,id,907)
local integer i
local real x = GetUnitX(a)
local real y = GetUnitY(a)
local real x1 = x+cur/35*Cos(d*0.01747)
local real y1 = y+cur/35*Sin(d*0.01747)
if GetUnitState(a,UNIT_STATE_LIFE)>0.405 and GetUnitCurrentOrder(a) == String2OrderId(RasenOrderId) then
call SaveReal(hash,id,903,damage+((ChannelDamage)* I2R(GetUnitAbilityLevel(a ,RasenID))))
else
if b == true then
set b = false
call PauseUnit(a,true)
call SetUnitAnimationByIndex(a,6)
call Sound( gg_snd_Fuuton_Rasen_Suriken_Part_2 )
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Orc\\MirrorImage\\MirrorImageDeathCaster.mdl",GetUnitX(k1),GetUnitY(k1)))
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Orc\\MirrorImage\\MirrorImageDeathCaster.mdl",GetUnitX(k2),GetUnitY(k2)))
call RemoveUnit(k1)
call RemoveUnit(k2)
call RemoveUnit(k3)
call SaveBoolean(hash,id,906,b)
endif
if dis <= 0.00 then
call PauseUnit(a,false)
call SetUnitTimeScale(a, 100 * 0.01)
call DestroyEffect(e)
call MassiveDamageAoe(a,x,y,damage,RasenRadius)
call CreateTextTagUnit( ( I2S(R2I(damage)) + "!" ), a, 0, 10.50, 0.00, 200.00, 200.00, 20 )
call UnitApplyTimedLife(CreateUnit(Player(13),'h002',GetUnitX(a),GetUnitY(a),d),'BTLF',2.00)
call UnitApplyTimedLife(CreateUnit(Player(13),'h003',GetUnitX(a),GetUnitY(a),d),'BTLF',2.00)
set i = 0
loop
exitwhen i == 12
call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\NightElf\\NECancelDeath\\NECancelDeath.mdl",x+150*Cos((i*30)*bj_DEGTORAD),y+150*Sin((i*30)*bj_DEGTORAD)))
call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\NightElf\\NECancelDeath\\NECancelDeath.mdl",x+250*Cos((i*30)*bj_DEGTORAD),y+250*Sin((i*30)*bj_DEGTORAD)))
call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\NightElf\\NECancelDeath\\NECancelDeath.mdl",x+350*Cos((i*30)*bj_DEGTORAD),y+350*Sin((i*30)*bj_DEGTORAD)))
set i = i + 1
endloop
call TerrainDeformationRippleBJ( 3.00, false, GetUnitLoc(a), 500.00, 500.00, 60.00, 0.60, 1024.00 )// лень раскрывать
call FlushChildHashtable(hash,id)
call DestroyTrigger(t)
else
call SetUnitX(a,x1)
call SetUnitY(a,y1)
call SetUnitFlyHeight(a,Parabola(150,cur,dis),0.)
call SaveReal(hash,id,905,dis)
endif
endif
set t = null
set a = null
set k1 = null
set k2 = null
set k3 = null
set e = null
endfunction
function Trig_RS_Actions takes nothing returns nothing
local unit a = GetTriggerUnit()
local trigger t = CreateTrigger()
local integer id = GetHandleId(t)
local real x = GetUnitX(a)
local real y = GetUnitY(a)
local real x1 = GetSpellTargetX()
local real y1 = GetSpellTargetY()
local real d = bj_RADTODEG * Atan2(y1 - y, x1 - x)
local unit k1 = CreateUnit(GetOwningPlayer(a),'h001',x+90*Cos((GetUnitFacing(a)-70)*bj_DEGTORAD),y+90*Sin((GetUnitFacing(a)-70)*bj_DEGTORAD),GetUnitFacing(a)+70)
local unit k2 = CreateUnit(GetOwningPlayer(a),'h001',x+90*Cos((GetUnitFacing(a)+70)*bj_DEGTORAD),y+90*Sin((GetUnitFacing(a)+70)*bj_DEGTORAD),GetUnitFacing(a)-70)
local unit k3 = CreateUnit(GetOwningPlayer(a),'h007',x,y,d)
local effect e = AddSpecialEffectTarget("NewRasenshuriken.mdx", a, "hand right")
call UnitAddAbility(a, 1098015094)
call UnitRemoveAbility(a, 1098015094)
call SetUnitAnimation( a, "stand alternate" )
call SetUnitAnimation( k1,"spell three" )
call SetUnitAnimation( k2,"spell three" )
call SetUnitAnimation( k3,"birth" )
call SetUnitTimeScale(a, 77 * 0.01)
call SetUnitTimeScale(k3,31 * 0.01)
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Orc\\MirrorImage\\MirrorImageCaster.mdl",GetUnitX(k1),GetUnitY(k1)))
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Orc\\MirrorImage\\MirrorImageCaster.mdl",GetUnitX(k2),GetUnitY(k2)))
call SaveUnitHandle(hash,id,898,a)
call SaveUnitHandle(hash,id,899,k1)
call SaveUnitHandle(hash,id,900,k2)
call SaveUnitHandle(hash,id,901,k3)
call SaveReal(hash,id,902,d)
call SaveReal(hash,id,903,RasenDamageBase)
call SaveReal(hash,id,904,DistanceXY2D(x,y,x1,y1))
call SaveReal(hash,id,905,DistanceXY2D(x,y,x1,y1))
call SaveBoolean(hash,id,906,true)
call SaveEffectHandle(hash,id,907,e)
call TriggerRegisterTimerEvent(t,0.03125,true)
call TriggerAddAction(t,function Rasen_Move)
set t = null
set a = null
set k1 = null
set k2 = null
set k3 = null
set e = null
endfunction
//===========================================================================
function InitTrig_RS takes nothing returns nothing
set gg_trg_RS = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_RS, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_RS, Condition( function Trig_RS_Conditions ) )
call TriggerAddAction( gg_trg_RS, function Trig_RS_Actions )
endfunction