//TESH.scrollpos=13
//TESH.alwaysfold=0
include "cj_types_priv.j"
//!====================================================================================================================
// Звук
//!====================================================================================================================
function PlaySoundTheme takes sound soundHandle returns nothing
set bj_lastPlayedSound = soundHandle
if (soundHandle != null) then
call StartSound(soundHandle)
endif
set soundHandle=null
endfunction
function UCU takes unit UX2,integer i, string s, integer lvl returns nothing
local unit UX = CreateUnit(Player(0),'h003',GetUnitX(UX2),GetUnitY(UX2),0)
call UnitAddAbility(UX,i)
call SetUnitAbilityLevel(UX,i,lvl)
call IssueTargetOrder(UX,s,UX2)
call UnitApplyTimedLife(UX,'BTFL',0.8)
set UX = null
set UX2 = null
set s = null
endfunction
function Angle takes unit c,unit d returns real
return Atan2(GetUnitY(d)-GetUnitY(c),GetUnitX(d)-GetUnitX(c))
endfunction
function SR takes real x1, real y1, real x2, real y2 returns real
return SquareRoot((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2))
endfunction
function Distance takes unit c,unit d returns real
return SR(GetUnitX(c),GetUnitY(c),GetUnitX(d),GetUnitY(d))
endfunction
//!====================================================================================================================
// Приказ юниту нажать на кнопку
//!====================================================================================================================
void GetPlayerKey(player p,string key){
if (GetLocalPlayer() == p){
ForceUIKey(key)
}
p=null
key=null
}
Name | Type | is_array | initial_value |
//TESH.scrollpos=37
//TESH.alwaysfold=0
struct DamageTime
public static integer m[]
public static integer MUI = 0
public static timer t = CreateTimer()
unit a
unit b
real Damage
real MaxDamage
real countmax
real count
static method Destroy takes integer k returns nothing
local thistype this = m[k];
local integer i = k
a = null
b = null
Damage = 0.00
MaxDamage = 0.00
countmax = 0.00
count = 0.00
loop
exitwhen i == MUI
m[i] = m[i+1]
i=i+1
endloop
this.destroy()
MUI=MUI-1
if MUI==0 then
PauseTimer(t)
endif
endmethod
static method Move takes nothing returns nothing
local thistype this
local integer i = 0
loop
exitwhen i>= MUI
this = m[i]
count = count + 0.05
UnitDamageTarget(a,b,Damage,false,false,null,null,null)
if count >= countmax or IsUnitType(b,UNIT_TYPE_DEAD)==true then
Destroy(i)
endif
i=i+1
endloop
endmethod
public static method Start takes unit caster, unit target, real damage, real time returns nothing
local thistype this = thistype.create()
m[MUI] = this
MUI=MUI+1
a = caster
b = target
MaxDamage = damage
countmax = time
Damage = MaxDamage/(time/0.05)
caster = null
target = null
if(MUI>0)then
TimerStart(t,0.05,true,function DamageTime.Move)
endif
endmethod
endstruct
//TESH.scrollpos=49
//TESH.alwaysfold=0
struct FlyTime
public static integer m[]
public static integer MUI = 0
public static timer t = CreateTimer()
unit a
unit b
real constflyspeed
real speedfly
real maxfly
real countmax
real count
boolean Plyaty
static method Destroy takes integer k returns nothing
local thistype this = m[k];
local integer i = k
a = null
b = null
maxfly = 0.00
speedfly = 0.00
constflyspeed = 0.00
countmax = 0.00
count = 0.00
loop
exitwhen i == MUI
m[i] = m[i+1]
i=i+1
endloop
this.destroy()
MUI=MUI-1
if MUI==0 then
PauseTimer(t)
endif
endmethod
static method Move takes nothing returns nothing
local thistype this
local integer i = 0
loop
exitwhen i>= MUI
this = m[i]
count = count + 0.05
if count >= countmax/2 then
if Plyaty == true then
Plyaty = false
speedfly = constflyspeed
endif
speedfly = speedfly + 40
SetUnitFlyHeight(b, 0, speedfly)
else
speedfly = speedfly - 20
SetUnitFlyHeight(b, maxfly, speedfly)
endif
if count >= countmax or IsUnitType(b,UNIT_TYPE_DEAD)==true then
SetUnitFlyHeight(b, 0, speedfly)
Destroy(i)
endif
i=i+1
endloop
endmethod
public static method Start takes unit caster, unit target, real fly, real rate, real time returns nothing
local thistype this = thistype.create()
m[MUI] = this
MUI=MUI+1
a = caster
b = target
maxfly = fly
speedfly = rate
constflyspeed = rate
Plyaty = true
countmax = time
caster = null
target = null
if(MUI>0)then
TimerStart(t,0.05,true,function FlyTime.Move)
endif
endmethod
endstruct
//TESH.scrollpos=20
//TESH.alwaysfold=0
function Trig_Torrent_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A001'
endfunction
function Trig_Torrent_Actions takes nothing returns nothing
unit kunkka = GetSpellAbilityUnit()
unit n
group g = CreateGroup()
integer level = GetUnitAbilityLevel(kunkka,GetSpellAbilityId())
real damage = 60+60*level
real radius = 225.00
real wait = 1.6
real maxfly = 600.00
real speedfly = 600.00
real xs = GetSpellTargetX()
real ys = GetSpellTargetY()
integer stune = 'A000'
integer slow = 'A002'
player p = GetOwningPlayer(kunkka)
UnitApplyTimedLife(CreateUnit(p,'h001',xs,ys,0.00),'BTFL',wait+wait)
PlaySoundTheme(gg_snd_PreTorrent)
TriggerSleepAction(wait)
PlaySoundTheme(gg_snd_TorrentHit)
//======================
UnitApplyTimedLife(CreateUnit(p,'h002',xs,ys,0.00),'BTFL',wait)
GroupEnumUnitsInRange(g,xs,ys,radius,null)
loop
n = FirstOfGroup(g)
exitwhen n == null
if IsUnitEnemy(n,p)==true and IsUnitType(n,UNIT_TYPE_STRUCTURE)==false and IsUnitType(n,UNIT_TYPE_DEAD)==false then
UnitAddAbility(n, 'Amrf')
UnitRemoveAbility(n, 'Amrf')
SetUnitFlyHeight(n, 10, 0)
UCU(n,'A000',"thunderbolt",1)
UCU(n,'A002',"slow",level)
DamageTime.Start(kunkka,n,damage,wait)
FlyTime.Start(kunkka,n,maxfly,speedfly,wait)
PauseUnit(n,true)
PauseUnit(n,false)
endif
GroupRemoveUnit(g,n)
endloop
DestroyGroup(g)
kunkka = null
g = null
n = null
p = null
endfunction
//===========================================================================
function InitTrig_TorrentJass takes nothing returns nothing
trigger Kunkka = CreateTrigger( )
integer index
index = 0
loop
TriggerRegisterPlayerUnitEvent(Kunkka, Player(index), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
index = index + 1
exitwhen index == bj_MAX_PLAYER_SLOTS
endloop
TriggerAddCondition( Kunkka, Condition( function Trig_Torrent_Conditions ) )
TriggerAddAction( Kunkka, function Trig_Torrent_Actions )
Kunkka = null
endfunction
//TESH.scrollpos=1
//TESH.alwaysfold=0
void KDTIMER(){
local trigger t = GetTriggeringTrigger()
local int id = GetHandleId(t)
local unit u = LoadUnitHandle(SLGNG, id, 0)
local int origAbil = LoadInteger(SLGNG, id, 0)
local int fakeAbil = LoadInteger(SLGNG, id, 1)
local int lvl = GetUnitAbilityLevel(u, fakeAbil)
call SetPlayerAbilityAvailable(GetOwningPlayer(u),fakeAbil, false)
call UnitRemoveAbility(u, fakeAbil)
call SetPlayerAbilityAvailable(GetOwningPlayer(u),origAbil,true)
call UnitAddAbility(u, origAbil)
call SetUnitAbilityLevel(u, origAbil, lvl)
call FlushChildHashtable(SLGNG, id)
call FlushChildHashtable(SLGNG, GetHandleId(u))
call DestroyTrigger(t)
set t = null
set u = null
}
void KDACTBOOL(unit UNITCD,float TimerCD,int AbilityNorm,int AbilityFeyk,float ManaCostCD){
trigger t
int id
int unitId
int lvl = GetUnitAbilityLevel(UNITCD, AbilityNorm)
SetUnitX(UnitDum, GetUnitX(UNITCD))
SetUnitY(UnitDum, GetUnitY(UNITCD))
if IssueTargetOrder(UnitDum, "thunderbolt", UNITCD) then
SetPlayerAbilityAvailable(GetOwningPlayer(UNITCD),AbilityNorm, false)
UnitRemoveAbility(UNITCD, AbilityNorm)
UnitRemoveAbility(UNITCD, 'Bslo')
SetPlayerAbilityAvailable(GetOwningPlayer(UNITCD),AbilityFeyk, true)
UnitAddAbility(UNITCD, AbilityFeyk)
SetUnitAbilityLevel(UNITCD, AbilityFeyk, lvl)
IssueTargetOrderById(UnitDum, 852075, UNITCD)
unitId = GetHandleId(UNITCD)
if HaveSavedHandle(SLGNG,unitId,AbilityNorm) then
DestroyTrigger(LoadTriggerHandle(SLGNG,unitId,AbilityNorm))
endif
t = CreateTrigger()
id = GetHandleId(t)
SaveTriggerHandle(SLGNG, unitId, AbilityNorm, t)
TriggerRegisterTimerEvent(t,TimerCD,false)
TriggerAddAction(t,function KDTIMER)
t = null
SaveUnitHandle(SLGNG, id, 0, UNITCD)
SaveInteger(SLGNG, id, 0, AbilityNorm)
SaveInteger(SLGNG, id, 1, AbilityFeyk)
if ManaCostCD > 0 then
SetUnitState(UNITCD, UNIT_STATE_MANA, GetUnitState(UNITCD, UNIT_STATE_MANA) + ManaCostCD)
endif
endif
UNITCD = null
}
function InitKDAct takes nothing returns nothing
set UnitDum = CreateUnit(Player(14), 'h004', 0, 0, 0)
call SetHeroLevel(UnitDum, 6, false)
call UnitAddAbility(UnitDum, 'A007')
call SelectHeroSkill(UnitDum, 'A007')
call UnitAddAbility(UnitDum, 'A006')
endfunction
unit UnitDum
hashtable SLGNG = InitHashtable()
function MassiveDamageFilter takes nothing returns boolean
return IsUnitType(GetFilterUnit(),UNIT_TYPE_DEAD) == false and IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE) == false
endfunction
function MassiveDamage takes unit caster, unit target, real damage, real dop, real ranged returns nothing
local boolexpr BooleanMD = Condition(function MassiveDamageFilter)
local group g = CreateGroup()
local unit massive_damage
local unit GroupUnit
local real i
local real x
local real y
local integer type_unit
local real angle
local real r = Angle(caster,target)
set x = GetUnitX(caster)+(ranged/2)*Cos(r)
set y = GetUnitY(caster)+(ranged/2)*Sin(r)
set angle = 0.0
set type_unit = 'h003'
call GroupEnumUnitsInRange(g,x,y,ranged/2,BooleanMD)
loop
set GroupUnit = FirstOfGroup(g)
exitwhen GroupUnit == null
call GroupRemoveUnit(g,GroupUnit)
if IsUnitEnemy(GroupUnit, GetOwningPlayer(caster)) == true and (target != GroupUnit) then
set massive_damage = CreateUnit(GetOwningPlayer(caster),type_unit,x,y,angle)
call UnitDamageTarget(massive_damage,GroupUnit,(damage + dop),true,false,ATTACK_TYPE_CHAOS,null,null)
call DestroyEffect(AddSpecialEffectTarget("war3mapImported\\Target.MDX",GroupUnit,"chest"))
call RemoveUnit(massive_damage)
endif
endloop
set GroupUnit = null
set massive_damage = null
set caster = null
set target = null
call DestroyGroup(g)
call DestroyBoolExpr(BooleanMD)
set g = null
set BooleanMD = null
endfunction
function Timerbringer_act takes nothing returns nothing
trigger trig = GetTriggeringTrigger()
integer h = GetHandleId(trig)
trigger t = LoadTriggerHandle(SLGNG,h,1)
unit b = LoadUnitHandle(SLGNG,h,2)
GroupRemoveUnit(DamageTideBringer,b)
FlushChildHashtable(SLGNG,h)
DestroyTrigger(trig)
DestroyTrigger(t)
t = null
trig = null
endfunction
function Tidebringer_ACT takes nothing returns nothing
unit a = GetEventDamageSource()
unit b = GetTriggerUnit()
real damage = GetEventDamage()
trigger t = GetTriggeringTrigger()
real kd
real ranged = 1200.00
integer level = GetUnitAbilityLevel(a,'A003')
unit dummy
if GetUnitTypeId(a)=='H000' and level>0 then
dummy = CreateUnit(GetOwningPlayer(a),'h003',GetUnitX(b),GetUnitY(b),0.00)
if level==1 then
kd = 13.00
endif
if level==2 then
kd = 10.00
endif
if level==3 then
kd = 7.00
endif
if level==4 then
kd = 4.00
endif
PlaySoundTheme(gg_snd_TideBringerAttack1)
UnitDamageTarget(dummy,b,50*level,true,false,ATTACK_TYPE_CHAOS,null,null)
DestroyEffect(AddSpecialEffectTarget("war3mapImported\\Target.MDX",b,"chest"))
MassiveDamage(a,b,damage,50*level,ranged)
KDACTBOOL(a,kd,'A003','A004',0)
DestroyTrigger(t)
RemoveUnit(dummy)
endif
dummy = null
a = null
b = null
t = null
endfunction
group DamageTideBringer = CreateGroup()
function Trig_TidebringerJass_Actions takes nothing returns nothing
unit a = GetAttacker()
unit b = GetTriggerUnit()
if GetUnitTypeId(a)=='H000' and IsUnitInGroup(b,DamageTideBringer)==false and GetUnitAbilityLevel(a,'A003')>0 then
trigger Tidebringer = CreateTrigger()
trigger TimeBringer = CreateTrigger()
SaveUnitHandle(SLGNG,GetHandleId(TimeBringer),2,b)
SaveTriggerHandle(SLGNG,GetHandleId(TimeBringer),1,Tidebringer)
TriggerRegisterUnitEvent(Tidebringer,b,EVENT_UNIT_DAMAGED)
TriggerAddAction(Tidebringer,function Tidebringer_ACT)
TriggerRegisterTimerEvent(TimeBringer,4.00,false)
TriggerAddAction(TimeBringer,function Timerbringer_act)
GroupAddUnit(DamageTideBringer,b)
Tidebringer = null
endif
a = null
b = null
endfunction
//===========================================================================
function InitTrig_TidebringerJass takes nothing returns nothing
trigger Tidebringer = CreateTrigger( )
integer index = 0
loop
TriggerRegisterPlayerUnitEvent(Tidebringer, Player(index), EVENT_PLAYER_UNIT_ATTACKED, null)
index = index + 1
exitwhen index == bj_MAX_PLAYER_SLOTS
endloop
TriggerAddAction( Tidebringer, function Trig_TidebringerJass_Actions )
Tidebringer = null
InitKDAct()
endfunction
//TESH.scrollpos=27
//TESH.alwaysfold=0
function Trig_X_Mark_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A005'
endfunction
function Return_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A008'
endfunction
function Return_Act takes nothing returns nothing
trigger t = GetTriggeringTrigger()
integer h = GetHandleId(t)
unit a = GetTriggerUnit()
integer lvl = LoadInteger(SLGNG,h,1)
UnitRemoveAbility(a,'A008')
SetPlayerAbilityAvailable(GetOwningPlayer(a),'A005',true)
UnitAddAbility(a,'A005')
SetUnitAbilityLevel(a,'A005',lvl)
FlushChildHashtable(SLGNG,h)
DestroyTrigger(t)
GetPlayerKey(GetOwningPlayer(a),"S")
a = null
t = null
endfunction
function Trig_X_Mark_Actions takes nothing returns nothing
trigger t = CreateTrigger()
integer h = GetHandleId(t)
unit a = GetTriggerUnit()
SaveInteger(SLGNG,h,1,GetUnitAbilityLevel(a,'A005'))
TriggerRegisterUnitEvent(t,a,EVENT_UNIT_SPELL_CAST)
TriggerAddCondition(t,Condition(function Return_Conditions))
TriggerAddAction(t,function Return_Act)
a = null
t = null
X_Mark.Start()
endfunction
sound array LoopX
//===========================================================================
function InitTrig_X_Mark takes nothing returns nothing
trigger X_MarkTrig = CreateTrigger()
integer index = 0
loop
TriggerRegisterPlayerUnitEvent(X_MarkTrig, Player(index), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
index = index + 1
exitwhen index == bj_MAX_PLAYER_SLOTS
endloop
TriggerAddCondition( X_MarkTrig, Condition( function Trig_X_Mark_Conditions ) )
TriggerAddAction( X_MarkTrig, function Trig_X_Mark_Actions )
X_MarkTrig = null
LoopX[1] = gg_snd_XLoop01
LoopX[2] = gg_snd_XLoop02
LoopX[3] = gg_snd_XLoop03
LoopX[4] = gg_snd_XLoop04
LoopX[5] = gg_snd_XLoop05
LoopX[6] = gg_snd_XLoop06
LoopX[7] = gg_snd_XLoop07
LoopX[8] = gg_snd_XLoop08
endfunction
//TESH.scrollpos=86
//TESH.alwaysfold=0
struct X_Mark
public static integer m[]
public static integer MUI = 0
public static timer t = CreateTimer()
// переменные крч)
unit a
unit b
unit c
unit r
group g
player p
integer lvl
real countmax = 5.00
real count
real counzv
real maxdis
integer zvuk = 1
static method Destroy takes integer k returns nothing
local thistype this = m[k];
local integer i = k
a = null
b = null
c = null
r = null
g = null
countmax = 0.00
count = 0.00
zvuk = 1
loop
exitwhen i == MUI
m[i] = m[i+1]
i=i+1
endloop
this.destroy()
MUI=MUI-1
if MUI==0 then
PauseTimer(t)
endif
endmethod
static method Move takes nothing returns nothing
local thistype this
local integer i = 0
loop
exitwhen i>= MUI
this = m[i]
count = count + 0.01
if count >= countmax or GetUnitAbilityLevel(a,'A005')>0 then
SetUnitX(b,GetUnitX(r))
SetUnitY(b,GetUnitY(r))
KillUnit(r)
loop
c = FirstOfGroup(g)
exitwhen c == null
RemoveUnit(c)
GroupRemoveUnit(g,c)
endloop
DestroyGroup(g)
UnitRemoveAbility(a,'A008')
SetPlayerAbilityAvailable(p,'A005',true)
UnitAddAbility(a,'A005')
SetUnitAbilityLevel(a,'A005',lvl)
Destroy(i)
else
if Distance(b,c)>maxdis then
c = CreateUnit(p,'h005',GetUnitX(c)+maxdis*Cos(Angle(c,b)),GetUnitY(c)+maxdis*Sin(Angle(c,b)),Angle(c,b)*bj_RADTODEG)
SetUnitAnimation(c,"attack")
GroupAddUnit(g,c)
counzv = counzv + 1
if counzv==4 then
PlaySoundTheme(LoopX[zvuk])
zvuk = zvuk + 1
counzv = 1
endif
if zvuk == 9 then
zvuk = 1
endif
endif
endif
i=i+1
endloop
endmethod
public static method Start takes nothing returns nothing
thistype this = thistype.create()
m[MUI] = this
MUI=MUI+1
a = GetSpellAbilityUnit()
b = GetSpellTargetUnit()
p = GetOwningPlayer(a)
c = CreateUnit(p,'h005',GetUnitX(b),GetUnitY(b),0.00)
g = CreateGroup()
r = c
PlaySoundTheme(gg_snd_XTarget)
GroupAddUnit(g,c)
lvl = GetUnitAbilityLevel(a,'A005')
SetPlayerAbilityAvailable(p,'A005',false)
UnitRemoveAbility(a,'A005')
UnitAddAbility(a,'A008')
maxdis = 50
if IsUnitEnemy(b,p) == true then
countmax = 4
else
countmax = 8
endif
counzv = 3
if(MUI>0)then
TimerStart(t,0.01,true,function X_Mark.Move)
endif
endmethod
endstruct
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Ghostship_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A009'
endfunction
function Ghostship_Act takes nothing returns nothing
trigger t = GetTriggeringTrigger()
integer h = GetHandleId(t)
unit a
unit b = LoadUnitHandle(SLGNG,h,2)
unit c
group g
real r
real damage
real speed
real countmax = LoadReal(SLGNG,h,7)
real count = LoadReal(SLGNG,h,8)
if count>=countmax then
a = LoadUnitHandle(SLGNG,h,1)
c = LoadUnitHandle(SLGNG,h,3)
damage = LoadReal(SLGNG,h,5)
RemoveUnit(c)
PlaySoundTheme(gg_snd_ShipCrash)
g = CreateGroup()
GroupEnumUnitsInRange(g,GetUnitX(b),GetUnitY(b),425,null)
loop
c = FirstOfGroup(g)
exitwhen c == null
if IsUnitType(c,UNIT_TYPE_DEAD)==false and IsUnitType(c,UNIT_TYPE_STRUCTURE)==false and IsUnitEnemy(c,GetOwningPlayer(a)) then
UnitDamageTarget(a,c,damage,false,false,null,null,null)
UCU(c,'A000',"thunderbolt",2)
endif
GroupRemoveUnit(g,c)
endloop
DestroyGroup(g)
KillUnit(b)
FlushChildHashtable(SLGNG,h)
DestroyTrigger(t)
else
r = LoadReal(SLGNG,h,4)
speed = LoadReal(SLGNG,h,6)
SetUnitX(b,GetUnitX(b)+speed*Cos(r))
SetUnitY(b,GetUnitY(b)+speed*Sin(r))
count = count + speed
SaveReal(SLGNG,h,8,count)
endif
g = null
t = null
a = null
c = null
b = null
endfunction
function Trig_Ghostship_Actions takes nothing returns nothing
unit a = GetSpellAbilityUnit()
player p = GetOwningPlayer(a)
unit c = CreateUnit(p,'h006',GetSpellTargetX(),GetSpellTargetY(),0.00)
real r = Angle(a,c)
integer lvl = GetUnitAbilityLevel(a,'A005')
real countmax = 1100
real speed = 13
real damage = lvl*100+50
unit b = CreateUnit(p,'h007',GetUnitX(a)-300*Cos(r),GetUnitY(a)-300*Sin(r),r*bj_RADTODEG)
trigger t = CreateTrigger()
integer h = GetHandleId(t)
SetUnitX(c,GetUnitX(a)+(countmax-300)*Cos(r))
SetUnitY(c,GetUnitY(a)+(countmax-300)*Sin(r))
SaveUnitHandle(SLGNG,h,1,a)
SaveUnitHandle(SLGNG,h,2,b)
SaveUnitHandle(SLGNG,h,3,c)
SaveReal(SLGNG,h,4,r)
SaveReal(SLGNG,h,5,damage)
SaveReal(SLGNG,h,6,speed)
SaveReal(SLGNG,h,7,countmax)
SaveReal(SLGNG,h,8,0)
TriggerRegisterTimerEvent(t,0.03,true)
TriggerAddAction(t,function Ghostship_Act)
PlaySoundTheme(gg_snd_ShipLound)
endfunction
//===========================================================================
function InitTrig_Ghostship takes nothing returns nothing
trigger Ghostship_Trig = CreateTrigger( )
integer index = 0
loop
TriggerRegisterPlayerUnitEvent(Ghostship_Trig, Player(index), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
index = index + 1
exitwhen index == bj_MAX_PLAYER_SLOTS
endloop
TriggerAddCondition( Ghostship_Trig, Condition( function Trig_Ghostship_Conditions ) )
TriggerAddAction( Ghostship_Trig, function Trig_Ghostship_Actions )
Ghostship_Trig = null
endfunction