//TESH.scrollpos=103
//TESH.alwaysfold=0
globals
hashtable hash = InitHashtable()
endglobals
//!==========================================================//
// Парабола
//!==========================================================//
function Parabola takes real h, real d, real x returns real
return (4 * h / d) * (d - x) * (x / d)
endfunction
//!==========================================================//
// Дистанция 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 KillTrees takes nothing returns nothing
call KillDestructable(GetEnumDestructable())
endfunction
//!====================================================================================
// Rect
//!====================================================================================
function PS_KillTrees takes real x, real y, real radius returns nothing
local rect r=Rect(x-radius,y-radius,x+radius,y+radius)
call EnumDestructablesInRect(r,null,function KillTrees)
call RemoveRect(r)
set r=null
endfunction
//!====================================================================================
// Выбрать юнита для игрока
//!====================================================================================
function SelectUnitForPlayer takes unit a, player p returns nothing
if (GetLocalPlayer() == p) then
call ClearSelection()
call SelectUnit(a, true)
endif
set p = null
set a = null
endfunction
//!=======================================================================================================
// KnockAoe(Parabola)
//!=======================================================================================================
function Trig_SystemKnock_Loop takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer id = GetHandleId(t)
local unit n = LoadUnitHandle(hash,id,134)
local real angle = LoadReal(hash,id,135)
local real height = LoadReal(hash,id,136)
local real speed = LoadReal(hash,id,137)
local real cur = LoadReal(hash,id,138)
local real dist = LoadReal(hash,id,139) - ( speed)
local real x = GetUnitX(n)
local real y = GetUnitY(n)
local real xx = x+speed*Cos(angle*bj_DEGTORAD)
local real yy = y+speed*Sin(angle*bj_DEGTORAD)
call PS_KillTrees( x, y, 125. )
if dist <=0.00 then
call PauseTimer(t)
call DestroyTimer(t)
call FlushChildHashtable(hash,id)
elseif IsTerrainPathable(xx, yy, PATHING_TYPE_WALKABILITY) == false then
call SetUnitX(n,xx)
call SetUnitY(n,yy)
endif
call SetUnitFlyHeight(n,Parabola(height,cur,dist),0.00)
call SaveReal(hash,id,139,dist)
set t = null
set n = null
endfunction
function Trig_SystemKnock_Actions takes unit a,real x, real y,real damage,real height, real speed ,real distance,real radius returns nothing
local timer t
local integer id
local group g = CreateGroup()
local unit n
local real angle
call GroupEnumUnitsInRange(g,x,y,radius,null)
loop
set n = FirstOfGroup(g)
exitwhen n == null
if IsUnitEnemy(n, GetOwningPlayer(a)) == true and UnitCheck(a, n) then
set t = CreateTimer()
set id = GetHandleId(t)
set angle = bj_RADTODEG * Atan2(GetUnitY(n) - y, GetUnitX(n) - x)
call UnitDamageTarget(a,n,damage,false,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_MAGIC,null)
call SaveUnitHandle(hash,id,134,n)
call SaveReal(hash,id,135,angle)
call SaveReal(hash,id,136,height)
call SaveReal(hash,id,137,speed)
call SaveReal(hash,id,138,distance)
call SaveReal(hash,id,139,distance)
call UnitAddAbility(n, 'Arav')
call UnitRemoveAbility(n, 'Arav')
call PauseUnit(n,true)
call TimerStart(t,0.03,true,function Trig_SystemKnock_Loop)
endif
call GroupRemoveUnit(g,n)
endloop
call DestroyGroup(g)
set t = null
set a = null
endfunction
//!=======================================================================================================
// Дамми кастер
//!=======================================================================================================
function Cast_Spell_Dummy_Point takes integer id, integer lvl,real x ,real y, string order,unit caster returns nothing
local unit dummy = CreateUnit(GetOwningPlayer(caster),'u000',x,y,bj_DEGTORAD)
call UnitAddAbility(dummy,id)
call SetUnitAbilityLevel(dummy,id,GetUnitAbilityLevel(caster, lvl))
call IssueImmediateOrder( dummy, order )
call UnitApplyTimedLife(dummy,'BTLF',1.00)
set dummy = null
set caster = null
endfunction
Name | Type | is_array | initial_value |
//TESH.scrollpos=0
//TESH.alwaysfold=0
globals
constant integer AbilRaw = 'A000'
constant integer DummyRaw = 'O000'
constant integer StunAoeRaw = 'A001'
constant string Order = "stomp"
endglobals
function AttackSlam_Loop takes nothing returns nothing
local trigger t = GetTriggeringTrigger()
local integer id = GetHandleId(t)
local unit a = LoadUnitHandle(hash,id,117)
local unit c = LoadUnitHandle(hash,id,118)
local real speed = LoadReal(hash,id,119) - ( 2.00 )
local real distance = LoadReal(hash,id,120) + speed
if distance <=0.00 then
call DestroyTrigger(t)
call PauseUnit(a, false)
call SetUnitFlyHeight(a, GetUnitDefaultFlyHeight(a), 0.00)
call Trig_SystemKnock_Actions(a,GetUnitX(a)+175*Cos(GetUnitFacing(a)*bj_DEGTORAD),GetUnitY(a)+150*Sin(GetUnitFacing(a)*bj_DEGTORAD),(1.50 * I2R(GetHeroStr(a, true))) * I2R(GetUnitAbilityLevel(a ,AbilRaw)),GetRandomReal(150,200),10,GetRandomReal(200,300),325)
call Cast_Spell_Dummy_Point(StunAoeRaw, AbilRaw,GetUnitX(a)+150*Cos(GetUnitFacing(a)*bj_DEGTORAD),GetUnitY(a)+150*Sin(GetUnitFacing(a)*bj_DEGTORAD),Order,a)
call IssueImmediateOrder(a,"stop")
else
call SetUnitFlyHeight( a, ( GetUnitFlyHeight(a) + speed ), 0.00 )
endif
if speed ==(-14) then
call RemoveUnit(c)
call ShowUnit(a, true)
call SelectUnitForPlayer(a,GetOwningPlayer(a))
call SetUnitAnimation(a,"attack slam")
call DestroyEffect(AddSpecialEffect("war3mapImported\\explosion.mdx" ,GetUnitX(a)+175*Cos(GetUnitFacing(a)*bj_DEGTORAD),GetUnitY(a)+175*Sin(GetUnitFacing(a)*bj_DEGTORAD)))
elseif speed > 0.00 then
call SetUnitX(a,GetUnitX(c))
call SetUnitY(a,GetUnitY(c))
call SetUnitFlyHeight( c, ( GetUnitFlyHeight(c) + speed+(5)), 0.00 )
call SetUnitFacing(a,GetUnitFacing(c))
endif
call SaveReal(hash,id,119,speed)
call SaveReal(hash,id,120,distance)
set a = null
set t = null
set c = null
endfunction
function Trig_AttackSlam_Actions takes nothing returns nothing
local unit a = GetTriggerUnit()
local trigger t = CreateTrigger()
local integer id = GetHandleId(t)
local unit c = CreateUnit(GetOwningPlayer(a),DummyRaw,GetUnitX(a),GetUnitY(a),GetUnitFacing(a))
call SaveUnitHandle(hash,id,117,a)
call SaveUnitHandle(hash,id,118,c)
call SaveReal(hash,id,119,44)
call SaveReal(hash,id,120,0)
call ShowUnit(a, false)
call PauseUnit(a, true)
call SelectUnitForPlayer(c,GetOwningPlayer(a))
call UnitAddAbility(a, 1098015094)
call UnitRemoveAbility(a, 1098015094)
call TriggerRegisterTimerEvent(t,0.03125,true)
call TriggerAddAction(t,function AttackSlam_Loop)
set a = null
set t = null
set c = null
endfunction
function Trig_AttackSlam_Conditions takes nothing returns boolean
return GetSpellAbilityId() == AbilRaw
endfunction
//===========================================================================
function InitTrig_AttackSlam takes nothing returns nothing
set gg_trg_AttackSlam = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_AttackSlam, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_AttackSlam, Condition( function Trig_AttackSlam_Conditions ) )
call TriggerAddAction( gg_trg_AttackSlam, function Trig_AttackSlam_Actions )
endfunction