--CUSTOM_CODE
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by Bergi.
--- DateTime: 18.11.2020 15:13
---
do
TimerStart(CreateTimer(), 3, false, function()
InitGuardSystem()
end)
end
function InitGuardSystem()
local _,k,units=FindUnitOfType(FourCC("h00F"))
--print("Найденно "..k.." стражников")
for i=1,k do
AddMarkAndRegister(units[i])
end
end
function AddMarkAndRegister(unit)
local radius=350
local img=CreateImage("circ",radius,radius,radius,4000,4000,0,0,0,0,4)
SetImageColor(img,255,0,0,200)
SetImageRenderAlways(img, true)
ShowImage(img,false)
TimerStart(CreateTimer(), TIMER_PERIOD, true, function()
--local x,y=GetUnitXY(unit)
if IsUnitVisible(unit,Player(0)) and GetUnitTypeId(mainHero)==FourCC("h00G") then
local xs,ys=GetUnitX(unit)-radius/2-16,GetUnitY(unit)-radius/2-16
--SetImagePosition(CircleImage,xs,ys,0)
SetImagePosition(img,xs,ys,0)
ShowImage(img,true)
else
ShowImage(img,false)
end
if not UnitAlive(unit) then
DestroyTimer(GetExpiredTimer())
ShowImage(img,false)
end
end)
--
local this=CreateTrigger()
TriggerRegisterUnitInRangeSimple(this, 150, unit)
TriggerAddAction(this, function()
local hero=GetTriggerUnit()
if hero==mainHero and GetUnitTypeId(mainHero)==FourCC("h00G") then
local p=Player(0)
SetPlayerAllianceStateBJ(p, GetOwningPlayer(unit), bj_ALLIANCE_UNALLIED)
SetPlayerAllianceStateBJ(GetOwningPlayer(unit),p, bj_ALLIANCE_UNALLIED)
local effAlarm=AddSpecialEffectTarget("Abilities\\Spells\\Other\\TalkToMe\\TalkToMe.mdl",unit,"overhead")
TimerStart(CreateTimer(), 2, false, function()
DestroyEffect(effAlarm)
end)
end
end)
end
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by Bergi.
--- DateTime: 11.10.2020 17:34
---
function HealUnit(hero,amount,flag,eff)
--1 или nil Сколько вылечено
--2 Сверхлечение
if not eff then eff="Abilities\\Spells\\Human\\Heal\\HealTarget" end
local p=GetOwningPlayer(hero)
local MaxHP=BlzGetUnitMaxHP(hero)
local CurrentHP=GetUnitState(hero,UNIT_STATE_LIFE)
local LoosingHP=MaxHP-CurrentHP
local OverHeal=amount-LoosingHP
local TotalHeal=amount
if LoosingHP<=amount then TotalHeal=LoosingHP end
DestroyEffect(AddSpecialEffectTarget(eff,hero,"overhead"))
SetUnitState(hero,UNIT_STATE_LIFE,CurrentHP+TotalHeal)
if TotalHeal>1 then
FlyTextTagHealXY(GetUnitX(hero),GetUnitY(hero),"+"..R2I(TotalHeal),p)
end
if not flag or flag==1 then
return TotalHeal
end
if flag==2 then
return OverHeal
end
end
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by Bergi.
--- DateTime: 10.01.2020 23:44
---
---@param x real
---@param y real
---@return boolean
function InMapXY(x, y)
return x > GetRectMinX(bj_mapInitialPlayableArea) and x < GetRectMaxX(bj_mapInitialPlayableArea) and y > GetRectMinY(bj_mapInitialPlayableArea) and y < GetRectMaxY(bj_mapInitialPlayableArea)
end
---@param x real
---@param distance real
---@param angle real radian
---@return real
function GetPolarOffsetX(x, distance, angle)
return x + distance * math.cos(angle)
end
---@param y real
---@param distance real
---@param angle real radian
---@return real
function GetPolarOffsetY(y, distance, angle)
return y + distance * math.sin(angle)
end
---@param x real
---@param distance real
---@param angle real degrees
---@return real
function MoveX(x, distance, angle)
return x + distance * math.cos(angle * bj_DEGTORAD)
end
---@param y real
---@param distance real
---@param angle real degrees
---@return real
function MoveY(y, distance, angle)
return y + distance * math.sin(angle * bj_DEGTORAD)
end
local GetTerrainZ_location = Location(0, 0)
---@param x real
---@param y real
---@return real
function GetTerrainZ(x, y)
MoveLocation(GetTerrainZ_location, x, y)
return GetLocationZ(GetTerrainZ_location)
end
---@param target unit
---@return real
function GetUnitZ(target)
MoveLocation(GetTerrainZ_location, GetUnitX(target), GetUnitY(target))
return GetLocationZ(GetTerrainZ_location) + GetUnitFlyHeight(target)
end
---@param target unit
---@param z real
function SetUnitZ(target, z)
UnitAddAbility(target, FourCC('Aave'))
UnitRemoveAbility(target, FourCC('Aave'))
MoveLocation(GetTerrainZ_location, GetUnitX(target), GetUnitY(target))
SetUnitFlyHeight(target, z - GetLocationZ(GetTerrainZ_location), 0)
end
---@param h real максимальная высота в прыжке на середине расстояния (x = d / 2)
---@param d real общее расстояние до цели
---@param x real расстояние от исходной цели до точки, где следует взять высоту по параболе
---@return real
function ParabolaZ (h, d, x)
return (4 * h / d) * (d - x) * (x / d)
end
---@param zs real начальная высота высота одного края дуги
---@param ze real конечная высота высота другого края дуги
---@param h real максимальная высота на середине расстояния (x = d / 2)
---@param d real общее расстояние до цели
---@param x real расстояние от исходной цели до точки
---@return real
function GetParabolaZ(zs, ze, h, d, x)
return (2 * (zs + ze - 2 * h) * (x / d - 1) + (ze - zs)) * (x / d) + zs
end
---@param xa real
---@param ya real
---@param xb real
---@param yb real
---@return real
function DistanceBetweenXY(xa, ya, xb, yb)
local dx = xb - xa
local dy = yb - ya
return math.sqrt(dx * dx + dy * dy)
end
---@param xa real
---@param ya real
---@param za real
---@param xb real
---@param yb real
---@param zb real
---@return real
function DistanceBetweenXYZ(xa, ya, za, xb, yb, zb)
local dx = xb - xa
local dy = yb - ya
local dz = zb - za
return math.sqrt(dx * dx + dy * dy + dz * dz)
end
---@param xa real
---@param ya real
---@param xb real
---@param yb real
---@return real radian
function AngleBetweenXY(xa, ya, xb, yb)
return math.atan(yb - ya, xb - xa)
end
---@param a real radian
---@param b real radian
---@return real radian
function AngleDifference(a, b)
local c---@type real
local d---@type real
if a > b then
c = a - b
d = b - a + 2 * math.pi
else
c = b - a
d = a - b + 2 * math.pi
end
return c > d and d or c
end
--@author https://xgm.guru/p/wc3/warden-math
---@param a real degrees
---@param b real degrees
---@return real degrees
function AngleDifferenceDeg(a, b)
a, b = math.abs(a, 360), math.abs(b, 360)
local x---@type real
if (a > b) then
a, b = b, a
end
x = b - 360
if (b - a > a - x) then
b = x
end
return math.abs(a - b)
end
-- Находит длину перпендикуляра от отрезка, заданного xa, ya, xb, yb к точке, заданной xc, yc
--@author https://xgm.guru/p/wc3/perpendicular
---@param xa real
---@param ya real
---@param xb real
---@param yb real
---@param xc real
---@param yc real
---@return real
function Perpendicular (xa, ya, xb, yb, xc, yc)
return math.sqrt((xa - xc) * (xa - xc) + (ya - yc) * (ya - yc)) * math.sin(math.atan(yc - ya, xc - xa) - math.atan(yb - ya, xb - xa))
end
--@Hate https://xgm.guru/p/wc3/241479
---@param source unit
---@param x real
---@param y real
function SetUnitPositionSmooth(source, x, y)
local last_x = GetUnitX(source)
local last_y = GetUnitY(source)
local bx
local by
--print("Смус выполнена")
SetUnitPosition(source, x, y)
if (RAbsBJ(GetUnitX(source) - x) > 0.5) or (RAbsBJ(GetUnitY(source) - y) > 0.5) then
SetUnitPosition(source, x, last_y)
bx = RAbsBJ(GetUnitX(source) - x) <= 0.5
SetUnitPosition(source, last_x, y)
by = RAbsBJ(GetUnitY(source) - y) <= 0.5
---
local dx=math.abs(x-last_x)
if dx>=100 then
--print("Телепорт бак в функции Smooth"..dx )
end
---
if bx then
SetUnitPosition(source, x, last_y)
elseif by then
SetUnitPosition(source, last_x, y)
else
SetUnitPosition(source, last_x, last_y)
end
end
end
--Bergi
function GetUnitXY(unit)
return GetUnitX(unit),GetUnitY(unit)
end
function MoveXY(x,y, distance, angle)
return x + distance * math.cos(angle * bj_DEGTORAD),y + distance * math.sin(angle * bj_DEGTORAD)
end
function UnitCollisionOFF(unit)
UnitAddAbility(unit,FourCC('A000'))
IssueImmediateOrder(unit,"windwalk")
end
function AngleBetweenUnits(caster,target)
local yb,ya,xb,xa=GetUnitY(target),GetUnitY(caster),GetUnitX(target),GetUnitX(caster)
return Atan2BJ(yb - ya, xb - xa)
end
function math.clamp (inb, low, high)
return math.min( math.max(inb, low ), high )
end
function math.lerp(a, b, t)
return a + (b - a) * t
end
function repeatN(t, m)
return math.clamp(t - math.floor(t / m) * m, 0, m)
end
function lerpTheta(a, b, t)
local dt = repeatN(b - a, 360)
if dt>180 then dt=dt-360 end
return math.lerp(a, a + dt, t)
end
function AngleBetweenXYZ(x1, y1,z1, x2, y2,z2)
local a=x1*x2+y1*y2+z1*z2
local b=math.sqrt(x1*x1+y1*y1+z1*z1)
local c=math.sqrt(x2*x2+y2*y2+z2*z2)
return math.acos(a/(b*c))
end
-- функия принадлежности точки сектора
-- x1, x2 - координаты проверяемой точки
-- x2, y2 - координаты вершины сектора
-- orientation - ориентация сектора в мировых координатах
-- width - уголовой размер сектора в градусах
-- radius - окружности которой принадлежит сектор
function IsPointInSector(x1,y1,x2,y2,orientation,width,radius)
local lenght=DistanceBetweenXY(x1,y1,x2,y2)
local angle=Acos(Cos(orientation*bj_DEGTORAD)*(x1-x2)/lenght+Sin(orientation*bj_DEGTORAD)*(y1-y2)/lenght )*bj_RADTODEG
return angle<=width and lenght<=radius
end
function GetParabolaPitch(height,distance,i, speed)
local f = function(x)
return ParabolaZ(height, distance, x)
end
local df = function(x)
return ParabolaZDerivative(height, distance, x)
end
local x0 = i * speed
local x1 = x0 + speed
local thisZ = f(x0)
local someTangentZ = Tangent(f, df, x0, x1)
return math.atan(someTangentZ - thisZ, x1 - x0)--pitch
end
function Tangent(f, df, x0, x)
return f(x0) + df(x0) * (x - x0)
end
function ParabolaZDerivative(height, distance, x)
return 4 * height / distance / distance * (distance - 2 * x)
end
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by Bergi.
--- DateTime: 21.10.2020 0:13
do
WLD={ --Белый лист из дестрактаблей
[1]=FourCC('YTfc'),
[2]=FourCC('YTLb'),
[3]=FourCC('YtLc'),
[4]=FourCC('YTac'),
[5]=FourCC('YTpc'),
[6]=FourCC('YTab'),
[7]=FourCC('YTfb'),
[8]=FourCC('YTpb'),
}
end
do
TimerStart(CreateTimer(), .1, false, function()
InitMouseMoveTrigger()
PlayUnitAnimationFromChat()
--InitWASD(hero) --переместить в первый выбор героя
end)
end
TIMER_PERIOD=1/64
HERO={}
function InitHeroTable(hero)
perebor=CreateGroup()
HERO[0]={
UnitHero=hero,
ReleaseW=false,
ReleaseS=false,
ReleaseD=false,
ReleaseA=false,
ReleaseLMB=false,
ReleaseRMB=false,
isAttacking=false,
isCharging=false,
isMoving=false,
DropInventory=true,
isShield=false,
ShieldEff=nil,
}
end
function InitWASD(hero)
--print("initwasdSTART")
InitHeroTable(hero)
CreateWASDActions()
BlockMouse()
EnableDragSelect(false, false)
BlzEnableSelections(false, false)
local data=HERO[0]
local angle=0
local speed=5
local animWalk=0
--[[
print("testanim")
local index=0
TimerStart(CreateTimer(),2, true, function()
SetUnitAnimationByIndex(hero,index)
print(index)
index=index+1
end)]]
animStand=0
TimerStart(CreateTimer(),TIMER_PERIOD, true, function()
data.UnitHero=mainHero -- костыль для смены героя
hero=mainHero -- костыль для смены героя
animWalk=animWalk+TIMER_PERIOD
if animWalk>=0.933 then --длительность анимации WALK
--print(animWalk)
animWalk=0
end
if GetUnitTypeId(mainHero)==FourCC("H000") then -- начальный герой
IndexAnimationWalk=1
IndexAnimationAttack=5
IndexAnimationCharge=6
end
if GetUnitTypeId(mainHero)==FourCC("Hpal") then -- для вампира
IndexAnimationWalk=0
IndexAnimationAttack=GetRandomInt(12,13)
--IndexAnimationCharge=16
end
if GetUnitTypeId(mainHero)==FourCC("n003") then -- крыса квест
IndexAnimationWalk=1
IndexAnimationAttack=2
end
if GetUnitTypeId(mainHero)==FourCC("nrat") then -- крыса обычная
IndexAnimationWalk=1
IndexAnimationAttack=2
end
if GetUnitTypeId(mainHero)==FourCC("h002") then -- Расхититель гробниц
IndexAnimationWalk=2
IndexAnimationAttack=5
end
if GetUnitTypeId(mainHero)==FourCC("hfoo") then -- бандит
IndexAnimationWalk=5
IndexAnimationAttack=GetRandomInt(3,4)
end
if GetUnitTypeId(mainHero)==FourCC("Edmm") then -- Летучие мыши 2,5 dssd
IndexAnimationWalk=1
--IndexAnimationAttack=GetRandomInt(3,4)
end
if GetUnitTypeId(mainHero)==FourCC("h006") then -- бандит 6 уровня
IndexAnimationWalk=5
IndexAnimationAttack=GetRandomInt(3,4)
end
if GetUnitTypeId(mainHero)==FourCC("h007") then -- бандит стрелок
IndexAnimationWalk=4
IndexAnimationAttack=9
end
if GetUnitTypeId(mainHero)==FourCC("h00A") then -- ассасин уровень 7
IndexAnimationWalk=4
IndexAnimationAttack=3
end
if GetUnitTypeId(mainHero)==FourCC("h00B") then -- бандит уровень 8
IndexAnimationWalk=5
IndexAnimationAttack=GetRandomInt(3,4)
end
if GetUnitTypeId(mainHero)==FourCC("n006") then -- мужик
IndexAnimationWalk=6
IndexAnimationAttack=GetRandomInt(4,5)
end
if GetUnitTypeId(mainHero)==FourCC("nvlw") then -- девушка
IndexAnimationWalk=1
IndexAnimationAttack=3
end
if GetUnitTypeId(mainHero)==FourCC("o004") then -- пеон
IndexAnimationWalk=1
IndexAnimationAttack=2
end
if GetUnitTypeId(mainHero)==FourCC("n00E") then -- волк
IndexAnimationWalk=2
IndexAnimationAttack=4
end
if GetUnitTypeId(mainHero)==FourCC("h00F") then -- стражник
IndexAnimationWalk=6
IndexAnimationAttack=GetRandomInt(4,5)
end
if GetUnitTypeId(mainHero)==FourCC("h00G") then -- торговец
IndexAnimationWalk=10
IndexAnimationAttack=9
end
--Автоподбор предметов
if data.DropInventory and IsUnitType(mainHero,UNIT_TYPE_HERO) then
local range=150
local x,y=GetUnitXY(hero)
SetRect(GlobalRect, x - range, y - range, x + range, y +range)
EnumItemsInRect(GlobalRect,nil,function()
UnitAddItem(hero,GetEnumItem())
if GetItemType(GetEnumItem()) == ITEM_TYPE_POWERUP then
SetItemPosition(GetEnumItem(),-7000,-3000) --костыль которые чинить двойное срабатывание
RemoveItem(GetEnumItem())
end
end)
end
data.IsMoving=false
if data.ReleaseW and data.ReleaseD == false and data.ReleaseA == false then
--print("only w")
angle = 90
data.IsMoving = true
end
if data.ReleaseW and data.ReleaseD then
--print("w+d")
angle = 90 - 45
data.IsMoving = true
end
if data.ReleaseW and data.ReleaseA then
--print("w+s")
angle = 90 + 45
data.IsMoving = true
end
if data.ReleaseS and data.ReleaseD == false and data.ReleaseA == false then
angle = 270
data.IsMoving = true
end
if data.ReleaseS and data.ReleaseD then
angle = 270 + 45
data.IsMoving = true
end
if data.ReleaseS and data.ReleaseA then
angle = 270 - 45
data.IsMoving = true
end
if data.ReleaseD and data.ReleaseW == false and data.ReleaseS == false then
angle = 0
data.IsMoving = true
end
if data.ReleaseA and data.ReleaseW == false and data.ReleaseS == false then
angle = 180
data.IsMoving = true
end
if not UnitAlive(hero) then
data.ReleaseW=false
data.ReleaseA=false
data.ReleaseS=false
data.ReleaseD=false
end
if not StunSystem[GetHandleId(mainHero)] then
StunUnit(mainHero,0.2)
end
if StunSystem[GetHandleId(mainHero)].Time==0 then
if not data.isAttacking and UnitAlive(hero) and not data.isShield then
if data.IsMoving then
if GetUnitTypeId(hero)==FourCC("Edmm") then--летучие мыши более быстрые
speed=7
else
speed=5
end
local x,y=GetUnitXY(hero)
local nx,ny=MoveXY(x,y,speed,angle)
SetUnitFacing(hero, angle)
SetUnitPositionSmooth(hero,nx,ny)
if animWalk==0 then
if GetUnitTypeId(hero)~=FourCC("Edmm") then
SetUnitAnimationByIndex(hero,IndexAnimationWalk)
local r={SoundStep1,SoundStep2,SoundStep3,SoundStep4}
PlaySoundNearUnit(hero,r[GetRandomInt(1,4)])
else
-- print("летучие мыши рестарт анимации движения")
end
--print("w")
animStand=3
end
else
--if animWalk==0 then
animStand=animStand+TIMER_PERIOD
if animStand>=2 then --длительность анимации WALK
--print(animWalk)
if GetUnitTypeId(hero)~=FourCC("Edmm") then
ResetUnitAnimation(hero)
--print("дефолтный сборс")
else
-- print("сборс анимации мышей")
end
animStand=0
end
--end
--print("r")--..GetUnitName(mainHero)
end
else
--print("onattaking")
end
else-- иначе юнит оглушен
SetUnitAnimationByIndex(mainHero,5)
UnitRemoveAbility(mainHero,FourCC("A003"))
UnitRemoveAbility(mainHero,FourCC("A004"))
end
end)
end
function CreateWASDActions()
-----------------------------------------------------------------OSKEY_W
local gg_trg_EventUpW = CreateTrigger()
for i = 0, bj_MAX_PLAYER_SLOTS - 1 do
BlzTriggerRegisterPlayerKeyEvent(gg_trg_EventUpW, Player(i), OSKEY_W, 0, true)
BlzTriggerRegisterPlayerKeyEvent(gg_trg_EventUpW, Player(i), OSKEY_UP, 0, true)
end
TriggerAddAction(gg_trg_EventUpW, function()
local pid = GetPlayerId(GetTriggerPlayer())
local data = HERO[pid]
if not data.ReleaseW and not data.isAttacking and UnitAlive(data.UnitHero) then
data.ReleaseW = true
SelectUnitForPlayerSingle(mainHero,Player(0))
if not data.isAttacking and not data.isShield and StunSystem[GetHandleId(mainHero)].Time==0 then
UnitAddForceSimple(data.UnitHero,90,5, 15)
animStand=3
SetUnitAnimationByIndex(data.UnitHero,IndexAnimationWalk)
end
end
end)
local TrigDepressW = CreateTrigger()
for i = 0, bj_MAX_PLAYER_SLOTS - 1 do
BlzTriggerRegisterPlayerKeyEvent(TrigDepressW, Player(i), OSKEY_W, 0, false)
BlzTriggerRegisterPlayerKeyEvent(TrigDepressW, Player(i), OSKEY_UP, 0, false)
end
TriggerAddAction(TrigDepressW, function()
local pid = GetPlayerId(GetTriggerPlayer())
local data = HERO[pid]
data.ReleaseW = false
end)
-----------------------------------------------------------------OSKEY_S
local gg_trg_EventUpS = CreateTrigger()
for i = 0, bj_MAX_PLAYER_SLOTS - 1 do
BlzTriggerRegisterPlayerKeyEvent(gg_trg_EventUpS, Player(i), OSKEY_S, 0, true)
BlzTriggerRegisterPlayerKeyEvent(gg_trg_EventUpS, Player(i), OSKEY_DOWN, 0, true)
end
TriggerAddAction(gg_trg_EventUpS, function()
local pid = GetPlayerId(GetTriggerPlayer())
local data = HERO[pid]
if not data.ReleaseS and not data.isAttacking and UnitAlive(data.UnitHero) then
data.ReleaseS = true
SelectUnitForPlayerSingle(mainHero,Player(0))
if not data.isAttacking and not data.isShield and StunSystem[GetHandleId(mainHero)].Time==0 then
animStand=3
UnitAddForceSimple(data.UnitHero,270,5, 15)
SetUnitAnimationByIndex(data.UnitHero,IndexAnimationWalk)
end
end
end)
local TrigDepressS = CreateTrigger()
for i = 0, bj_MAX_PLAYER_SLOTS - 1 do
BlzTriggerRegisterPlayerKeyEvent(TrigDepressS, Player(i), OSKEY_S, 0, false)
BlzTriggerRegisterPlayerKeyEvent(TrigDepressS, Player(i), OSKEY_DOWN, 0, false)
end
TriggerAddAction(TrigDepressS, function()
local pid = GetPlayerId(GetTriggerPlayer())
local data = HERO[pid]
data.ReleaseS = false
end)
-----------------------------------------------------------------OSKEY_D
local TrigPressD = CreateTrigger()
for i = 0, bj_MAX_PLAYER_SLOTS - 1 do
BlzTriggerRegisterPlayerKeyEvent(TrigPressD, Player(i), OSKEY_D, 0, true)
BlzTriggerRegisterPlayerKeyEvent(TrigPressD, Player(i), OSKEY_RIGHT, 0, true)
end
TriggerAddAction(TrigPressD, function()
local pid = GetPlayerId(GetTriggerPlayer())
local data = HERO[pid]
if not data.ReleaseD and not data.isAttacking and UnitAlive(data.UnitHero) then
data.ReleaseD = true
SelectUnitForPlayerSingle(mainHero,Player(0))
if not data.isAttacking and not data.isShield and StunSystem[GetHandleId(mainHero)].Time==0 then
animStand=3
UnitAddForceSimple(data.UnitHero,0,5, 15)
SetUnitAnimationByIndex(data.UnitHero,IndexAnimationWalk)
end
end
end)
local TrigDePressD = CreateTrigger()
for i = 0, bj_MAX_PLAYER_SLOTS - 1 do
BlzTriggerRegisterPlayerKeyEvent(TrigDePressD, Player(i), OSKEY_D, 0, false)
BlzTriggerRegisterPlayerKeyEvent(TrigDePressD, Player(i), OSKEY_RIGHT, 0, false)
end
TriggerAddAction(TrigDePressD, function()
local pid = GetPlayerId(GetTriggerPlayer())
local data = HERO[pid]
data.ReleaseD = false
end)
-----------------------------------------------------------------OSKEY_A
local TrigPressA = CreateTrigger()
for i = 0, bj_MAX_PLAYER_SLOTS - 1 do
BlzTriggerRegisterPlayerKeyEvent(TrigPressA, Player(i), OSKEY_A, 0, true)
BlzTriggerRegisterPlayerKeyEvent(TrigPressA, Player(i), OSKEY_LEFT, 0, true)
end
TriggerAddAction(TrigPressA, function()
local pid = GetPlayerId(GetTriggerPlayer())
local data = HERO[pid]
if not data.ReleaseA and not data.isAttacking and UnitAlive(data.UnitHero) and StunSystem[GetHandleId(mainHero)].Time==0 then
data.ReleaseA = true
SelectUnitForPlayerSingle(mainHero,Player(0))
if not data.isAttacking and not data.isShield then
animStand=3
UnitAddForceSimple(data.UnitHero,180,5, 15)
SetUnitAnimationByIndex(data.UnitHero,IndexAnimationWalk)
end
end
end)
local TrigDePressA = CreateTrigger()
for i = 0, bj_MAX_PLAYER_SLOTS - 1 do
BlzTriggerRegisterPlayerKeyEvent(TrigDePressA, Player(i), OSKEY_A, 0, false)
BlzTriggerRegisterPlayerKeyEvent(TrigDePressA, Player(i), OSKEY_LEFT, 0, false)
end
TriggerAddAction(TrigDePressA, function()
local pid = GetPlayerId(GetTriggerPlayer())
local data = HERO[pid]
data.ReleaseA = false
end)
-----------------------------------------------------------------LMB
local TrigPressLMB = CreateTrigger()
for i = 0, bj_MAX_PLAYER_SLOTS - 1 do
TriggerRegisterPlayerEvent(TrigPressLMB, Player(i), EVENT_PLAYER_MOUSE_DOWN)
end
TriggerAddAction(TrigPressLMB, function()
--print("any")
if BlzGetTriggerPlayerMouseButton() == MOUSE_BUTTON_TYPE_LEFT then
--это леваый клик всё внутри LMB
local pid = GetPlayerId(GetTriggerPlayer())
GetPlayerMouseX[pid]=BlzGetTriggerPlayerMouseX()
GetPlayerMouseY[pid]=BlzGetTriggerPlayerMouseY()
local data = HERO[pid]
if UnitAlive(data.UnitHero) then
if data.ReleaseRMB then
--Charge(data)
end
attack(data)
else
--print("Герой мёртв")
end
end
end)
local TrigDePressLMB = CreateTrigger()
for i = 0, bj_MAX_PLAYER_SLOTS - 1 do
TriggerRegisterPlayerEvent(TrigDePressLMB, Player(i), EVENT_PLAYER_MOUSE_UP)
end
TriggerAddAction(TrigDePressLMB, function()
--print("any")
if BlzGetTriggerPlayerMouseButton() == MOUSE_BUTTON_TYPE_LEFT then
local pid = GetPlayerId(GetTriggerPlayer())
local data = HERO[pid]
data.ReleaseLMB = false
end
end)
-----------------------------------------------------------------RMB
local TrigPressRMB = CreateTrigger()
for i = 0, bj_MAX_PLAYER_SLOTS - 1 do
TriggerRegisterPlayerEvent(TrigPressRMB, Player(i), EVENT_PLAYER_MOUSE_DOWN)
end
TriggerAddAction(TrigPressRMB, function()
if BlzGetTriggerPlayerMouseButton() == MOUSE_BUTTON_TYPE_RIGHT then
-- это правая кнопка
local pid = GetPlayerId(GetTriggerPlayer())
GetPlayerMouseX[pid]=BlzGetTriggerPlayerMouseX()
GetPlayerMouseY[pid]=BlzGetTriggerPlayerMouseY()
local data = HERO[pid]
--data.Shield=true
if UnitAlive(data.UnitHero) then --and IsUnitType(data.UnitHero,UNIT_TYPE_HERO)
if GetUnitTypeId(data.UnitHero)==FourCC('Hpal') and StunSystem[GetHandleId(mainHero)].Time==0 then -- not data.isAttacking and -- убрал атаку у щита
data.isShield=true
UnitAddAbility(data.UnitHero,FourCC("A003"))
UnitAddAbility(data.UnitHero,FourCC("A004"))
--BlzUnitDisableAbility(mainHero,FourCC('dssd'),true,false)
data.ReleaseW=false
data.ReleaseA=false
data.ReleaseS=false
data.ReleaseD=false
ResetUnitAnimation(data.UnitHero)
--data.ShieldEff=AddSpecialEffectTarget("Abilities\\Spells\\Human\\ManaShield\\ManaShieldCaster",data.UnitHero,"origin")
end
if data.ReleaseLMB then
-- Charge(data)
end
if not data.ReleaseRMB then
data.ReleaseRMB = true
--Charge(data)
end
end
end
end)
local TrigDePressRMB = CreateTrigger()
for i = 0, bj_MAX_PLAYER_SLOTS - 1 do
TriggerRegisterPlayerEvent(TrigDePressRMB, Player(i), EVENT_PLAYER_MOUSE_UP)
end
TriggerAddAction(TrigDePressRMB, function()
--print("depress")
if BlzGetTriggerPlayerMouseButton() == MOUSE_BUTTON_TYPE_RIGHT then
local pid = GetPlayerId(GetTriggerPlayer())
local data = HERO[pid]
local hero = data.UnitHero
data.ReleaseRMB = false
-- print("мышка отпущена")
if data.isShield then
UnitRemoveAbility(data.UnitHero,FourCC("A003"))
UnitRemoveAbility(data.UnitHero,FourCC("A004"))
--BlzUnitDisableAbility(mainHero,FourCC('dssd'),false,false)
--DestroyEffect(data.ShieldEff)
--print("щит отключен")
data.isShield=false
end
if UnitAlive(hero) then
if data.ReleaseA or data.ReleaseW or data.ReleaseS or data.ReleaseD then
-- print("Скольжение2") --не работает
SetUnitAnimationByIndex(mainHero,IndexAnimationWalk)
end
end
end
end)
end
---MouseX,MouseY=0,0
function BlockMouse()
local this=CreateTrigger()
TriggerRegisterAnyUnitEventBJ(this, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER)
TriggerRegisterAnyUnitEventBJ(this, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER)
TriggerAddAction(this, function()
-- MouseX,MouseY=GetPlayerMouseX
--print(OrderId2String(GetUnitCurrentOrder(mainHero)))
if OrderId2String(GetUnitCurrentOrder(mainHero))=="dropitem" then
HERO[0].DropInventory=false
TimerStart(CreateTimer(), 2, false, function()
HERO[0].DropInventory=true
end)
end
if OrderId2String(GetUnitCurrentOrder(mainHero))=="smart" or OrderId2String(GetUnitCurrentOrder(mainHero))=="move" then --Строковый список приказов, которые игрок не может выполнить
BlzPauseUnitEx(mainHero,true)
BlzPauseUnitEx(mainHero,false)
end
end)
end
function attack(data)
if not data.ReleaseLMB and UnitAlive(data.UnitHero) and not IsUnitPaused(data.UnitHero) and not data.isShield then
data.ReleaseLMB = true
if not data.isAttacking and not data.isCharging and not data.ONTarget then
--print("пытаемся атаковать, запускаем кд атаки и прерываем движение")
--print("a "..GetUnitName(mainHero))
data.isAttacking=true
--local state={data.ReleaseW,data.ReleaseA,data.ReleaseS,data.ReleaseD}
data.ReleaseW=false
data.ReleaseA=false
data.ReleaseS=false
data.ReleaseD=false
SetUnitAnimationByIndex(data.UnitHero,IndexAnimationAttack)
local e=nil
local k=0
GroupEnumUnitsInRange(perebor,GetUnitX(mainHero),GetUnitY(mainHero),200,nil)
while true do
e = FirstOfGroup(perebor)
if e == nil then break end
if UnitAlive(e) and UnitAlive(mainHero) and (IsUnitEnemy(e,GetOwningPlayer(mainHero)) or GetOwningPlayer(e)==Player(PLAYER_NEUTRAL_PASSIVE)) then
k=k+1
end
GroupRemoveUnit(perebor,e)
end
if k>1 and GetUnitTypeId(mainHero)==FourCC("Hpal") then
SetUnitAnimationByIndex(data.UnitHero,12)-- всегда сплешь
local eff=AddSpecialEffectTarget("Sweep_Attachments_FX\\Sweep_Blood_Large",mainHero,"hand left")
TimerStart(CreateTimer(), 5, false, function()
DestroyEffect(eff)
end)
end
local angle=-180+AngleBetweenXY(GetPlayerMouseX[0],GetPlayerMouseY[0],GetUnitX(data.UnitHero),GetUnitY(data.UnitHero))/bj_DEGTORAD
SetUnitFacing(data.UnitHero,angle)
TimerStart(CreateTimer(), 0.5, false, function()
local damage=BlzGetUnitBaseDamage(mainHero,0)
if UnitHasItemOfTypeBJ(mainHero,FourCC('I005')) then
damage=damage+15
end
local nx,ny=MoveXY(GetUnitX(data.UnitHero),GetUnitY(data.UnitHero),100,GetUnitFacing(data.UnitHero))
if GetUnitTypeId(mainHero)~=FourCC("Edmm") and not data.isShield and StunSystem[GetHandleId(mainHero)].Time==0 then
local is,_,k=UnitDamageArea(data.UnitHero,damage,nx,ny,100)
if not is then
local tl = Location(GetUnitXY(mainHero))
local r=GetRandomInt(1,2)
if r==1 then
PlaySoundAtPointBJ(SoundAttack3, 100, tl, 0)
else
PlaySoundAtPointBJ(SoundAttack4, 100, tl, 0)
end
RemoveLocation(tl)
end
end
end)
TimerStart(CreateTimer(), 0.7, false, function()
data.isAttacking=false
--data.ReleaseLMB = false
end)
end
end
end
function dash(data) --ОТКЛЮЧЕНО, ЭТО ПЕРЕКАТ
if not data.isDash and not data.isCharging then
data.isDash=true
local angle=-180+AngleBetweenXY(GetPlayerMouseX[0],GetPlayerMouseY[0],GetUnitXY(data.UnitHero))/bj_DEGTORAD
UnitAddForceSimple(data.UnitHero,angle,10,200)
SetUnitAnimationByIndex(data.UnitHero,6)
TimerStart(CreateTimer(), 0.3, false, function()
data.isDash=false
end)
end
end
function Charge(data) --Отключено за ненадобьюсть
if not data.isCharging and GetUnitTypeId(data.UnitHero)==FourCC('Hpal') then --только вампир может в рывок
data.isCharging=true
local angle=-180+AngleBetweenXY(GetPlayerMouseX[0],GetPlayerMouseY[0],GetUnitXY(data.UnitHero))/bj_DEGTORAD
UnitAddForceSimple(data.UnitHero,angle,20,300)
SetUnitFacing(data.UnitHero,angle)
SetUnitAnimationByIndex(data.UnitHero,IndexAnimationCharge)
TimerStart(CreateTimer(), 0.15,false, function()
if data.IsMoving then
SetUnitAnimationByIndex(data.UnitHero,IndexAnimationWalk)
else
ResetUnitAnimation(data.UnitHero)
end
--print("Рывок перезаряжен")
-- data.isCharging=false
end)
TimerStart(CreateTimer(), 2, false, function()
--print("Рывок перезаряжен")
data.isCharging=false
end)
end
end
onForces = {}
function UnitAddForceSimple(hero, angle, speed, distance,flag)
-- псевдо вектор использовать только для юнитов
local currentdistance = 0
if onForces[GetHandleId(hero)] == nil then
onForces[GetHandleId(hero)] = true
end
if not IsUnitType(hero, UNIT_TYPE_STRUCTURE) and onForces[GetHandleId(hero)] then
onForces[GetHandleId(hero)]=false
local m=0
TimerStart(CreateTimer(), TIMER_PERIOD, true, function()
currentdistance = currentdistance + speed
--print(currentdistance)
local x, y = GetUnitX(hero), GetUnitY(hero)
local newX, newY = MoveX(x, speed, angle), MoveY(y, speed, angle)
SetUnitPositionSmooth(hero, newX, newY)
if flag==5 then
local _,enemy=UnitDamageArea(hero,15,newX, newY,100)
if enemy then
HealUnit(hero,5)
end
m=m+1
if m>=6 then
local eff=AddSpecialEffect("Blood Massacre",newX, newY)
BlzSetSpecialEffectColor(eff,255,0,0,0)
DestroyEffect(eff)
m=0
end
end
if flag==6 then
local e=nil
GroupEnumUnitsInRange(perebor,newX, newY,100,nil)
while true do
e = FirstOfGroup(perebor)
if e == nil then break end
if UnitAlive(e) and IsUnitEnemy(e,GetOwningPlayer(hero)) and not IsUnitType(e,UNIT_TYPE_STRUCTURE) and IsUnitType(e,UNIT_TYPE_HERO) then
--if StunSystem[GetHandleId(e)].Time==0 then
-- StunUnit(e,1)
--end
UnitAddForceSimple(e,GetUnitFacing(hero),15,200)
end
GroupRemoveUnit(perebor,e)
end
end
if flag=="dust" then
DestroyEffect(AddSpecialEffect( "Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl",newX, newY))
end
if currentdistance >= distance then --закончил движение
--or (data.OnWater and data.OnTorrent==false)
--data.IsDisabled=false
--data.OnWater=false
if flag==5 then
ShowUnit(hero,true)
end
if flag==6 then -- башлорд конец бега
ResetUnitAnimation(hero)
BlzPauseUnitEx(hero,false)
SetUnitTimeScale(hero,1)
end
if IsUnitType(hero,UNIT_TYPE_HERO) then
if HERO[0].isCharging then
--print("рывок окончен")
--DestroyTimer(GetExpiredTimer())
--onForces[GetHandleId(hero)]=true
--HERO[0].isCharging=false
ResetUnitAnimation(hero)
end
end
DestroyTimer(GetExpiredTimer())
onForces[GetHandleId(hero)]=true
--print("stop cur="..currentdistance.." dist="..distance)
end
end)
end
end
GetPlayerMouseX = {}
GetPlayerMouseY = {}
function InitMouseMoveTrigger()
local MouseMoveTrigger = CreateTrigger()
for i = 0, bj_MAX_PLAYER_SLOTS - 1 do
local player = Player(i)
TriggerRegisterPlayerEvent(MouseMoveTrigger, player, EVENT_PLAYER_MOUSE_MOVE)
GetPlayerMouseX[i] = 0
GetPlayerMouseY[i] = 0
end
TriggerAddAction(MouseMoveTrigger, function()
local id = GetPlayerId(GetTriggerPlayer())
if BlzGetTriggerPlayerMouseX() ~= 0 then
GetPlayerMouseX[id] = BlzGetTriggerPlayerMouseX()
GetPlayerMouseY[id] = BlzGetTriggerPlayerMouseY()
end
end)
end
function UnitDamageArea(u,damage,x,y,range)
local isdamage=false
local e=nil
local hero=nil
GroupEnumUnitsInRange(perebor,x,y,range,nil)
local k=0
while true do
e = FirstOfGroup(perebor)
if e == nil then break end
if UnitAlive(e) and UnitAlive(u) and (IsUnitEnemy(e,GetOwningPlayer(u)) or GetOwningPlayer(e)==Player(PLAYER_NEUTRAL_PASSIVE)) then
UnitDamageTarget( u, e, damage, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS )
isdamage=true
hero=e
k=k+1
end
GroupRemoveUnit(perebor,e)
end
if PointContentDestructable(x,y,range,true,1+damage,u) then isdamage=true end
return isdamage, hero,k
end
GlobalRect=Rect(0,0,0,0)
function PointContentDestructable (x,y,range,iskill,damage,flag)
local content=false
if range==nil then range=80 end
if iskill==nil then iskill=false end
local d=nil
SetRect(GlobalRect, x - range, y - range, x + range, y +range)
EnumDestructablesInRect(GlobalRect,nil,function ()
d=GetEnumDestructable()
if GetDestructableLife(d)>0 then
content=true
if (GetDestructableTypeId(d)==FourCC("B005") or GetDestructableTypeId(d)==FourCC("OTip") ) and flag==1 then -- блокиратор или платформа
content=false
end
if iskill then
if GetUnitTypeId(flag)==FourCC("Hpal") then
local tl = Location(GetUnitXY(flag))
local r=GetRandomInt(1,2)
if r==1 then
PlaySoundAtPointBJ(SoundAttack5, 100, tl, 0)
else
PlaySoundAtPointBJ(SoundAttack6, 100, tl, 0)
end
RemoveLocation(tl)
end
SetDestructableLife(d,GetDestructableLife(d)-damage)
if GetDestructableLife(d)>=1 then
SetDestructableAnimation(d,"Stand Hit")
end
--KillDestructable(d)
end
end
end)
return content,d
end
CQX=430
CQY=6500
function PlayUnitAnimationFromChat()
local this=CreateTrigger()
TriggerRegisterPlayerChatEvent(this,Player(0),"",true)
TriggerAddAction(this, function()
local s=S2I(GetEventPlayerChatString())
if GetEventPlayerChatString()=="w" then
CreateForUnitWayToPoint(mainHero,CQX,CQY)
return
end
if GetEventPlayerChatString()=="m" then
UnitAddItemById(mainHero,FourCC("I00A"))
--print("получена руна морфа, где форма мышей")
return
end
if GetEventPlayerChatString()=="n" then
UnitAddItemById(mainHero,FourCC("I00B"))
return
end
if GetEventPlayerChatString()=="l" then
PlaySoundNearUnit(mainHero,gg_snd_LightningBolt)
return
end
if GetEventPlayerChatString()=="peon" then
SetUnitPositionSmooth(mainHero,-5500,-3000)
return
end
SetUnitAnimationByIndex(mainHero,s)
--print(GetUnitName(mainHero).." "..s)
end)
end
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by Bergi.
--- DateTime: 27.05.2020 23:15
---
local realTimerStart = TimerStart
TimerStart = function(timer, duration, repeating, callback)
local pcallback = function()
if callback == nil then return end
local status, err = pcall(callback)
if not status then
print(err)
end
end
realTimerStart(timer, duration, repeating, pcallback)
end
local realTriggerAddAction = TriggerAddAction
TriggerAddAction = function(trig, callback)
local pcallback = function()
local status, err = pcall(callback)
if not status then
print(err)
end
end
realTriggerAddAction(trig, pcallback)
end
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by Bergi.
--- DateTime: 21.11.2020 16:12
---
do
TimerStart(CreateTimer(), 1, false, function()
InitPreloadStart()
end)
end
function InitPreloadStart()
--print("Start preload tester")
--PreloadGenClear()
Preloader("save\\BO.txt")
local k=0
local s=BlzGetAbilityTooltip (FourCC('Agyv'), 0)
if #s>2 then
print("First Game")
s=1
Preload("\")\ncall BlzSetAbilityTooltip ('Agyv',\""..s.."\",0)".."\n//")
PreloadGenEnd("save\\BO.txt")
PreloadGenClear()
else
Preload("\")\ncall BlzSetAbilityTooltip ('Agyv',\""..R2I(s+1).."\",0)".."\n//")
PreloadGenEnd("save\\BO.txt")
PreloadGenClear()
print("Game № "..R2I(s+1))
end
end
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by Bergi.
--- DateTime: 02.11.2020 19:47
---
TIMER_PERIOD2 = 0.03125
function AngleBetweenXY(xa, ya, xb, yb)
return math.atan(yb - ya, xb - xa)
end
function MoveX(x, distance, angle)
return x + distance * math.cos(angle * bj_DEGTORAD)
end
function MoveY(y, distance, angle)
return y + distance * math.sin(angle * bj_DEGTORAD)
end
function MoveXY(x, y, distance, angle)
return x + distance * math.cos(angle * bj_DEGTORAD), y + distance * math.sin(angle * bj_DEGTORAD)
end
function GetUnitXY(unit)
return GetUnitX(unit), GetUnitY(unit)
end
function AddQuest(hero, qx, qy, message)
local x, y = GetUnitX(hero), GetUnitY(hero)
local model = "AneuCaster"
local player = GetOwningPlayer(hero)
local isEnd = false
if GetLocalPlayer() ~= player then
model = ""
else
--print("звук созданного квеста")
StartSound(bj_questSecretSound)
end
--local QuestPointer = AddSpecialEffect(model, x, y)
--BlzSetSpecialEffectPitch(QuestPointer, math.rad(-90))--/bj_DEGTORAD
print(message)
TimerStart(CreateTimer(), 0.5, false, function()
CreateForUnitWayToPoint(hero, qx, qy)
end)
TimerStart(CreateTimer(), TIMER_PERIOD2, true, function()
local z = BlzGetLocalUnitZ(hero)
local xc, yc = GetUnitX(hero), GetUnitY(hero)
local angle = AngleBetweenXY(xc, yc, qx, qy)
--BlzSetSpecialEffectPosition(QuestPointer, MoveX(xc, 130, angle / bj_DEGTORAD), MoveY(yc, 130, angle / bj_DEGTORAD), z + 10)
--BlzSetSpecialEffectYaw(QuestPointer, angle)
if IsUnitInRangeXY(hero, qx, qy, 200) then
isEnd = true
end
if isEnd then
if GetLocalPlayer() == player then
StartSound(bj_questCompletedSound)
end
DestroyTimer(GetExpiredTimer())
--DestroyEffect(QuestPointer)
-- print("квест №" .. "1" .. " выполнен, даём награду")
end
end)
TimerStart(CreateTimer(), 10, true, function()
if isEnd then
DestroyTimer(GetExpiredTimer())
--print("Выключаем мигалку")
else
PingMinimapForPlayer(player, qx, qy, 3)
end
end)
end
--lastX=0
ShowWay=true
function CreateForUnitWayToPoint(hero, xEnd, yEnd)
if not ShowWay then return end
ShowWay=false
local dummy = CreateUnit(GetOwningPlayer(hero), FourCC("ewsp"), GetUnitX(hero), GetUnitY(hero), AngleBetweenXY(GetUnitX(hero), GetUnitY(hero), xEnd, yEnd) / bj_DEGTORAD)
if UnitAddAbility(dummy, FourCC("Aloc")) then
--print("добавлено")
else
-- print("Нет")
end
SetUnitMoveSpeed(dummy, 1000)
IssuePointOrder(dummy, "move", xEnd, yEnd)
local i = 1
local sec = 0
local eff = {}
local p = 0.12
local lastX = GetUnitX(hero)
local stay = false
local t = CreateTimer()
TimerStart(t, p, true, function()
local x, y = GetUnitXY(dummy)
local angle = GetUnitFacing(dummy)
sec = sec + p
if not IsUnitHidden(dummy) and not IsUnitInRangeXY(dummy, xEnd, yEnd, 30) then
eff[i] = AddSpecialEffect("AneuCaster", x, y) --"Abilities\\Spells\\Items\\AIco\\CrownOfCmndTarget.mdl"
-- local angle=AngleBetweenXY(x,y,point[i-1].x,point[i-1].y)/bj_DEGTORAD
BlzSetSpecialEffectYaw(eff[i], math.rad(angle))
BlzSetSpecialEffectPitch(eff[i], math.rad(-90))
BlzSetSpecialEffectZ(eff[i], BlzGetLocalUnitZ(hero) + 150)
--print("eff "..i)
i = i + 1
if i == 4 then
ShowUnit(dummy, false)
ShowUnit(dummy, true)
end
end
for k = 1, #eff do
if IsUnitInRangeXY(hero, BlzGetLocalSpecialEffectX(eff[k]), BlzGetLocalSpecialEffectY(eff[k]), 50) then
BlzSetSpecialEffectPosition(eff[k], 5000, 5000, 0)
end
end
if lastX ~= GetUnitX(hero) then
stay = true
TimerStart(CreateTimer(), 6, false, function() -- время через которое удаляется квест, после того как юнит сдвинулся
--print("Дамми дошёл до точки на скорости "..GetUnitMoveSpeed(dummy).." за "..sec.." секунд и за "..i.." шагов")
for k = 1, #eff do
DestroyEffect(eff[k])
end
eff = {}
i = 1
ShowWay=true
ShowUnit(dummy, false)
DestroyTimer(t)
end)
--DestroyTimer(GetExpiredTimer())
end
if lastX == GetUnitX(hero) then
if stay and false then
stay = false
KillUnit(dummy)
dummy = CreateUnit(GetOwningPlayer(hero), FourCC("ewsp"), GetUnitX(hero), GetUnitY(hero), AngleBetweenXY(GetUnitX(hero), GetUnitY(hero), xEnd, yEnd) / bj_DEGTORAD)
BlzSetUnitFacingEx(dummy, GetUnitFacing(hero))
UnitAddAbility(dummy, FourCC("Aloc"))
SetUnitMoveSpeed(dummy, 1000)
SetUnitPosition(dummy, MoveXY(GetUnitX(hero), GetUnitY(hero), 60, GetUnitFacing(hero)))
IssuePointOrder(dummy, "move", xEnd, yEnd)
end
end
lastX = GetUnitX(hero)
--print("записано "..GetUnitX(hero))
end)
end
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by Bergi.
--- DateTime: 11.11.2020 22:59
---
do
TimerStart(CreateTimer(), 0.11, false, function()
--звуки попаданий
SoundAttack1 = CreateSound("Sound\\Units\\Combat\\MetalHeavySliceFlesh3", false, true, true, 0, 0, "MissilesEAX")
SetSoundParamsFromLabel(SoundAttack1, "MetalHeavySliceFlesh")
SetSoundDuration(SoundAttack1, 600)
SetSoundVolume(SoundAttack1, 250)
SoundAttack2 = CreateSound("Sound\\Units\\Combat\\MetalHeavySliceFlesh2", false, true, true, 0, 0, "MissilesEAX")
SetSoundParamsFromLabel(SoundAttack2, "MetalHeavySliceFlesh")
SetSoundDuration(SoundAttack2, 600)
SetSoundVolume(SoundAttack2, 250)
--Звуки промахов
SoundAttack3 = CreateSound("Sound\\Units\\Combat\\MetalLightSliceFlesh2", false, true, true, 0, 0, "MissilesEAX")
SetSoundParamsFromLabel(SoundAttack3, "MetalHeavySliceFlesh")
SetSoundDuration(SoundAttack3, 853)
SetSoundVolume(SoundAttack3, 250)
SoundAttack4 = CreateSound("Sound\\Units\\Combat\\MetalLightSliceFlesh2", false, true, true, 0, 0, "MissilesEAX")
SetSoundParamsFromLabel(SoundAttack4, "MetalHeavySliceFlesh")
SetSoundDuration(SoundAttack4, 853)
SetSoundVolume(SoundAttack4, 250)
--Звуки ударов по декору
SoundAttack5 = CreateSound("Sound\\Units\\Combat\\MetalLightSliceWood1", false, true, true, 0, 0, "MissilesEAX")
SetSoundParamsFromLabel(SoundAttack5, "MetalHeavySliceFlesh")
SetSoundDuration(SoundAttack5, 853)
SetSoundVolume(SoundAttack5, 250)
SoundAttack6 = CreateSound("Sound\\Units\\Combat\\MetalLightSliceWood2", false, true, true, 0, 0, "MissilesEAX")
SetSoundParamsFromLabel(SoundAttack6, "MetalHeavySliceFlesh")
SetSoundDuration(SoundAttack6, 853)
SetSoundVolume(SoundAttack6, 250)
HintSound = CreateSound("Sound\\Interface\\Hint", false, true, true, 0, 0, "MissilesEAX")
SetSoundParamsFromLabel(HintSound, "MetalHeavySliceFlesh")
SetSoundDuration(HintSound, 853)
SetSoundVolume(HintSound, 250)
--Нейтральные удары
SoundAttack7 = CreateSound("Sound\\Units\\Combat\\MetalLightChopFlesh1.flac", false, true, true, 0, 0, "MissilesEAX")
SetSoundParamsFromLabel(SoundAttack7, "MetalHeavySliceFlesh")
SetSoundDuration(SoundAttack7, 853)
SetSoundVolume(SoundAttack7, 250)
SoundAttack8 = CreateSound("Sound\\Units\\Combat\\MetalLightChopFlesh2.flac", false, true, true, 0, 0, "MissilesEAX")
SetSoundParamsFromLabel(SoundAttack8, "MetalHeavySliceFlesh")
SetSoundDuration(SoundAttack8, 853)
SetSoundVolume(SoundAttack8, 250)
--Звуки шагов
SoundStep1 = CreateSound("Sound\\Units\\Footsteps\\HeroStep1", false, true, true, 0, 0, "MissilesEAX")
SetSoundParamsFromLabel(SoundStep1, "MetalHeavySliceFlesh")
SetSoundDuration(SoundStep1, 853)
SetSoundVolume(SoundStep1, 250)
SoundStep2 = CreateSound("Sound\\Units\\Footsteps\\HeroStep2", false, true, true, 0, 0, "SpellsEAX")
SetSoundParamsFromLabel(SoundStep2, "HeroCinematicStep2")
SetSoundDuration(SoundStep2, 853)
SetSoundVolume(SoundStep2, 250)
SoundStep3 = CreateSound("Sound\\Units\\Footsteps\\HeroStep3", false, true, true, 0, 0, "SpellsEAX")
SetSoundParamsFromLabel(SoundStep3, "HeroCinematicStep2")
SetSoundDuration(SoundStep3, 853)
SetSoundVolume(SoundStep3, 250)
SoundStep4 = CreateSound("Sound\\Units\\Footsteps\\HeroStep4", false, true, true, 0, 0, "SpellsEAX")
SetSoundParamsFromLabel(SoundStep4, "HeroCinematicStep2")
SetSoundDuration(SoundStep4, 853)
SetSoundVolume(SoundStep4, 250)
--Эффекты
--молния
gg_snd_LightningBolt = CreateSound("Abilities/Spells/Orc/LightningBolt/LightningBolt.flac", false, true, true, 0, 0, "SpellsEAX")
SetSoundParamsFromLabel(gg_snd_LightningBolt, "LightningBolt")
SetSoundDuration(gg_snd_LightningBolt, 1999)
SetSoundVolume(gg_snd_LightningBolt, 127)
end)
end
function PlaySoundNearUnit(hero,sound)
local tl = Location(GetUnitXY(hero))
PlaySoundAtPointBJ(sound, 100, tl, 0)
RemoveLocation(tl)
-- print("звук молнии")
end
function normal_sound (s,x,y)
local snd = CreateSound(s, false, true, true, 10, 10, "CombatSoundsEAX")
SetSoundChannel(snd, 40)
SetSoundVolume(snd, 127)
SetSoundPitch(snd, 1)
SetSoundDistances(snd, 600, 10000)
SetSoundDistanceCutoff(snd, 2100)
SetSoundConeAngles(snd, 0.0, 0.0, 127)
SetSoundConeOrientation(snd, 0.0, 0.0, 0.0)
SetSoundPosition(snd, x, y, 50)
StartSound(snd)
KillSoundWhenDone(snd)
end
function PreloadSound3D_snd(s)
local snd = CreateSound(s,false,true,true,10,10,"CombatSoundsEAX")
SetSoundChannel(snd,5)
SetSoundVolume(snd,127)
SetSoundPitch(snd, 1)
SetSoundDistances(snd,999999,99999)
SetSoundDistanceCutoff(snd,99999)
SetSoundConeAngles(snd,0.0,0.0,127)
SetSoundConeOrientation(snd,0.0,0.0,0.0)
SetSoundPosition(snd,0.0,0.0,50.0)
StartSound(snd)
StopSound(snd, false, false)
end
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by Bergi.
--- DateTime: 30.04.2020 0:04
stunEff="Abilities\\Spells\\Human\\Thunderclap\\ThunderclapTarget"
StunSystem={}
function StunUnit(hero,dur)
if not StunSystem[GetHandleId(hero)] then
-- print("оглушен первый раз")
StunSystem[GetHandleId(hero)]={
Time=0,
Eff=nil,
Timer=nil
}
end
local data=StunSystem[GetHandleId(hero)]
local curdur=0
if data.Time==0 then
data.Timer=CreateTimer()
--print("старт нового таймера")
data.Eff=AddSpecialEffectTarget(stunEff,hero,"overhead")
BlzPauseUnitEx(hero,true)
end
if data.Time<dur then
--print("Более сильное оглушение, обновляем время")
data.Time=dur
else
--print("Есть более долгое оглушение ничего не делаем")
return
end
TimerStart(data.Timer, 0.1, true, function()
curdur=curdur+0.1
data.Time=data.Time-0.1
if curdur>=dur or not UnitAlive(hero) then
--print("Вышел из стана")
BlzPauseUnitEx(hero,false)
DestroyTimer(GetExpiredTimer())
data.Time=0
DestroyEffect(data.Eff)
data.Timer=nil
end
end)
end
function StunArea(hero,range,duration,x,y)
local e=nil
GroupEnumUnitsInRange(perebor,x,y,range,nil)
while true do
e = FirstOfGroup(perebor)
if e == nil then break end
if UnitAlive(e) and IsUnitEnemy(e,GetOwningPlayer(hero)) and not IsUnitType(e,UNIT_TYPE_STRUCTURE) then
StunUnit(e,duration)
end
GroupRemoveUnit(perebor,e)
end
end
---@param text string
---@param textSize real
---@param x real
---@param y real
---@param z real
---@param red integer
---@param green integer
---@param blue integer
---@param alpha integer
---@param xvel real
---@param yvel real
---@param fadepoint real
---@param lifespan real
---@param player player
---@return texttag
function FlyTextTag(text, textSize, x, y, z, red, green, blue, alpha, xvel, yvel, fadepoint, lifespan, player)
local t = CreateTextTag()
SetTextTagText(t, text, textSize)
SetTextTagPos(t, x, y, z)
SetTextTagColor(t, red, green, blue, alpha)
SetTextTagVelocity(t, xvel, yvel)
SetTextTagFadepoint(t, fadepoint)
SetTextTagLifespan(t, lifespan)
SetTextTagPermanent(t, false)
if player ~= nil then
SetTextTagVisibility(t, player == GetLocalPlayer())
end
return t
end
---@param target widget
---@param text string
---@param player player
---@return texttag
function FlyTextTagGoldBounty(target, text, player)
return FlyTextTag(text, 0.024, GetWidgetX(target) - 16, GetWidgetY(target), 0, 255, 220, 0, 255, 0, 0.03, 2, 3, player)
end
---@param target widget
---@param text string
---@param player player
---@return texttag
function FlyTextTagLumberBounty(target, text, player)
return FlyTextTag(text, 0.024, GetWidgetX(target) - 16, GetWidgetY(target), 0, 0, 200, 80, 255, 0, 0.03, 2, 3, player)
end
---@param target widget
---@param text string
---@param player player
---@return texttag
function FlyTextTagMiss(target, text, player)
return FlyTextTag(text, 0.024, GetWidgetX(target), GetWidgetY(target), 0, 255, 0, 0, 255, 0, 0.03, 1, 3, player)
end
---@param target widget
---@param text string
---@param player player
---@return texttag
function FlyTextTagCriticalStrike(target, text, player)
return FlyTextTag(text, 0.024, GetWidgetX(target), GetWidgetY(target), 0, 255, 0, 0, 255, 0, 0.04, 2, 5, player)
end
---@param target widget
---@param text string
---@param player player
---@return texttag
function FlyTextTagManaBurn(target, text, player)
return FlyTextTag(text, 0.024, GetWidgetX(target), GetWidgetY(target), 0, 82, 82, 255, 255, 0, 0.04, 2, 5, player)
end
---@param target widget
---@param text string
---@param player player
---@return texttag
function FlyTextTagShadowStrike(target, text, player)
return FlyTextTag(text, 0.024, GetWidgetX(target), GetWidgetY(target), 0, 160, 255, 0, 255, 0, 0.04, 2, 5, player)
end
function FlyTextTagHealXY(x,y, text, player)
return FlyTextTag(text, 0.024, x, y, 150, 88, 250, 13, 255, 0, 0.03, 1, 3, player)
end
function FlyTextTagShieldXY(x,y, text, player)--™
local xr=GetRandomReal(-0.05,0,05)
return FlyTextTag(""..text, 0.018, x, y, 150, 128, 128, 128, 255, xr, 0.03, 1, 3, player)
end
function StaticTag(text, textSize, x, y, z, red, green, blue, alpha, xvel, yvel, fadepoint, lifespan, player)
local t = CreateTextTag()
SetTextTagText(t, text, textSize)
SetTextTagPos(t, x, y, z)
SetTextTagColor(t, red, green, blue, alpha)
--SetTextTagVelocity(t, xvel, yvel)
SetTextTagFadepoint(t, fadepoint)
SetTextTagLifespan(t, lifespan)
SetTextTagPermanent(t, false)
if player ~= nil then
SetTextTagVisibility(t, player == GetLocalPlayer())
end
return t
end
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by Bergi.
--- DateTime: 11.03.2020 22:30
function FindUnitOfType(id,flag,x,y)
--flag nil - вся карта
--flag any - радиус
local unit=nil
local e=nil
local k=0
--print("ищем")
local rg={}
if not flag then
GroupEnumUnitsInRect(perebor,bj_mapInitialPlayableArea,nil)
while true do
e = FirstOfGroup(perebor)
if e == nil then break end
if UnitAlive(e) and GetUnitTypeId(e)==id then
k=k+1
rg[k]=e
unit=e
end
GroupRemoveUnit(perebor,e)
end
else
GroupEnumUnitsInRange(perebor,x,y,flag,nil)
while true do
e = FirstOfGroup(perebor)
if e == nil then break end
if UnitAlive(e) and GetUnitTypeId(e)==id then
k=k+1
rg[k]=e
unit=e
end
GroupRemoveUnit(perebor,e)
end
end
if k>1 then
-- print("Ошибка получено "..k.." юнитов")
end
if k>2 then
unit=rg[GetRandomInt(1,#rg)]
end
if unit==nil then
--print("Не найдено живых юнитов данного типа")
end
return unit,k,rg
end
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by Bergi.
--- DateTime: 28.10.2020 19:30
---
do
TimerStart(CreateTimer(), 0.11, false, function()
InitBB()
end)
end
function InitBB()
local SpellTrigger = CreateTrigger()
for i = 0, bj_MAX_PLAYER_SLOTS - 1 do
local player = Player(i)
TriggerRegisterPlayerUnitEvent(SpellTrigger, player, EVENT_PLAYER_UNIT_SPELL_CAST)
end
TriggerAddAction(SpellTrigger, function()
if not HERO[0].isShield then
if GetSpellAbilityId() == FourCC('dssd') then --мыши
local caster=GetTriggerUnit()
UnitMakeAbilityPermanent(caster,true,FourCC('dssd')) --сами мыши
UnitMakeAbilityPermanent(caster,true,FourCC('A002')) --Пожирание
UnitMakeAbilityPermanent(caster,true,FourCC('A005')) -- контроль разума
UnitMakeAbilityPermanent(caster,true,FourCC('A007')) -- копьё
UnitMakeAbilityPermanent(caster,true,FourCC('A00G')) -- молния
UnitMakeAbilityPermanent(caster,true,FourCC('A00M')) -- армия тьмы
local curMP=GetUnitState(caster,UNIT_STATE_MANA)
--print(curMP)
UnitAddItemById(mainHero,FourCC("I00A")) --превращаемся в мышей
--local slot=RemoveAllItems(caster)
--local maxHP=BlzGetUnitMaxHP(caster)
--local curHP=GetUnitState(caster,UNIT_STATE_LIFE)
TimerStart(CreateTimer(), 0.02, false, function()
SetUnitState(caster,UNIT_STATE_MANA,curMP)
end)
-- UnitAddItemById(caster,FourCC("I004"))
TimerStart(CreateTimer(), 3, false, function()
--slot=RemoveAllItems(caster)
--maxHP=BlzGetUnitMaxHP(caster)
--curHP=GetUnitState(caster,UNIT_STATE_LIFE)
--UnitAddAbility(caster,FourCC("S001")) -- перелючение обратно
--AddAlItems(caster,slot,maxHP,curHP)
curMP=GetUnitState(caster,UNIT_STATE_MANA)
--print(curMP)
if UnitAlive(mainHero) then
UnitAddItemById(mainHero,FourCC("I00B")) -- превращаемся обратно
else
--print("умер в форме мышей ожидаем воскрешения")
TimerStart(CreateTimer(), 0.02, true, function()
if UnitAlive(mainHero) then
DestroyTimer(GetExpiredTimer())
curMP=GetUnitState(caster,UNIT_STATE_MANA)
UnitAddItemById(mainHero,FourCC("I00B"))
TimerStart(CreateTimer(), 0.02, false, function()
SetUnitState(caster,UNIT_STATE_MANA,curMP)
end)
end
end)
end
TimerStart(CreateTimer(), 0.02, false, function()
SetUnitState(caster,UNIT_STATE_MANA,curMP)
end)
if HERO[0].ReleaseA or HERO[0].ReleaseW or HERO[0].ReleaseS or HERO[0].ReleaseD then
TimerStart(CreateTimer(), 0.1, false, function()
--print("скольжение после мышей")
SetUnitAnimationByIndex(caster,IndexAnimationWalk)
end)
end
end)
end
else
local caster=GetTriggerUnit()
TimerStart(CreateTimer(), 0.05, false, function()
BlzStartUnitAbilityCooldown(caster,FourCC('dssd'),1)
end)
end
end)
end
function RemoveAllItems(hero)
local slot={}
--print("удаляем предметы")
for i=0,5 do
--print(i)
slot[i]=GetItemTypeId(UnitItemInSlot(hero,i))
--print(GetItemName(slot[i]))
RemoveItem(UnitItemInSlot(hero,i))
end
return slot
end
function AddAlItems(hero,slot,maxHP,curHP)
TimerStart(CreateTimer(), 0.05, false, function()
for i=0,5 do
UnitAddItemById(hero,slot[i])
end
end)
--print(maxHP)
TimerStart(CreateTimer(), 0.05, false, function()
BlzSetUnitMaxHP(hero,maxHP)
SetUnitState(hero,UNIT_STATE_LIFE,curHP)
end)
end
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by Bergi.
--- DateTime: 21.11.2020 17:14
---
---
---
do
TimerStart(CreateTimer(), 240, false, function()
InitCry()
end)
end
function InitCry()
local gg_trg_RANGE = CreateTrigger()
--print("initcry")
TriggerRegisterUnitInRangeSimple(gg_trg_RANGE, 150, mainHero)
TriggerAddAction(gg_trg_RANGE, function()
local unit=GetTriggerUnit()
--print("событие приближения")
if GetUnitTypeId(unit)==FourCC("nvlw") and UnitAlive(unit) then
--print(" подошел к девочке")
normal_sound("war3mapImported\\Cry.wav",GetUnitXY(unit))
--PlaySoundBJ(gg_snd_Cry)
--print(GetUnitName())
-- DisableTrigger(GetTriggeringTrigger())
--StartPEONAI(boss)
end
end)
end
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by Bergi.
--- DateTime: 28.10.2020 19:30
---
do
TimerStart(CreateTimer(), 0.11, false, function()
InitDA()
end)
end
function InitDA()
local SpellTrigger = CreateTrigger()
for i = 0, bj_MAX_PLAYER_SLOTS - 1 do
local player = Player(i)
TriggerRegisterPlayerUnitEvent(SpellTrigger, player, EVENT_PLAYER_UNIT_SPELL_CAST)
end
TriggerAddAction(SpellTrigger, function()
if GetSpellAbilityId() == FourCC('A00M') then --армия тьмы
local caster=GetTriggerUnit()
CreateZobiesInArea(caster)
end
end)
end
function CreateZobiesInArea(hero)
local x,y=GetUnitXY(hero)
local e=nil
GroupEnumUnitsInRange(perebor,x,y,1000,nil)
while true do
e = FirstOfGroup(perebor)
if e == nil then break end
if UnitAlive(e) and IsUnitVisible(e,Player(0)) and IsUnitEnemy(e,Player(0)) then
local new=CreateUnit(GetOwningPlayer(hero),FourCC("n009"),GetUnitX(e),GetUnitY(e),GetRandomInt(0,360))
Agr2Units(new,e)
UnitApplyTimedLife(new,FourCC('BTLF'),10)
end
GroupRemoveUnit(perebor,e)
end
end
function Agr2Units(u1,u2)
IssueTargetOrder(u1,"attack",u2)
IssueTargetOrder(u2,"attack",u1)
end
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by Bergi.
--- DateTime: 10.11.2020 18:19
---
do
TimerStart(CreateTimer(), 0.11, false, function()
StartFearArea()
end)
end
function StartFearArea()
TimerStart(CreateTimer(), 2, true, function()
local x,y=GetUnitXY(mainHero)
local e=nil
GroupEnumUnitsInRange(perebor,x,y,500,nil)
while true do
e = FirstOfGroup(perebor)
if e == nil then break end
if UnitAlive(e) and GetUnitTypeId(mainHero)==FourCC("Hpal") and (IsUnitEnemy(e,GetOwningPlayer(mainHero)) or GetOwningPlayer(e)==Player(PLAYER_NEUTRAL_PASSIVE)) and not IsUnitType(e,UNIT_TYPE_STRUCTURE) then
if GetUnitTypeId(e)==FourCC("n006") then
if OrderId2String(GetUnitCurrentOrder(mainHero))~="move" then
--print("в страхе убегает")
local angle=-180+AngleBetweenXY(GetUnitX(e),GetUnitY(e),GetUnitXY(mainHero))/bj_DEGTORAD
local nx,ny=MoveXY(GetUnitX(e),GetUnitY(e),400,angle)
IssuePointOrder(e,"move",nx,ny)
local r=GetRandomInt(1,3)
--U01Peasant15A
--U01Peasant15B
--U01Peasant15С
local tl = Location(GetUnitXY(e))
if r==1 then
PlaySoundAtPointBJ(gg_snd_U01Peasant15A, 100, tl, 0)
elseif r==2 then
PlaySoundAtPointBJ(gg_snd_U01Peasant15B, 100, tl, 0)
elseif r==3 then
PlaySoundAtPointBJ(gg_snd_U01Peasant15C, 100, tl, 0)
end
RemoveLocation(tl)
end
end
end
GroupRemoveUnit(perebor,e)
end
end)
end
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by Bergi.
--- DateTime: 28.10.2020 19:30
---
do
TimerStart(CreateTimer(), 0.11, false, function()
InitLightingSpell()
InitDamageLighting()
end)
end
function InitLightingSpell()
local SpellTrigger = CreateTrigger()
for i = 0, bj_MAX_PLAYER_SLOTS - 1 do
local player = Player(i)
TriggerRegisterPlayerUnitEvent(SpellTrigger, player, EVENT_PLAYER_UNIT_SPELL_CAST)
end
TriggerAddAction(SpellTrigger, function()
if GetSpellAbilityId() == FourCC('A00G') then --Удар молнией
local caster=GetTriggerUnit()
local target=GetSpellTargetUnit()
local e=nil
local k=1
local ss=0
GroupEnumUnitsInRange(perebor,GetUnitX(target),GetUnitY(target),300,nil)
while true do
e = FirstOfGroup(perebor)
if e == nil then break end
if UnitAlive(e) and IsUnitEnemy(e,GetOwningPlayer(caster)) and not IsUnitType(e,UNIT_TYPE_STRUCTURE) and k<=4 then
k=k+1
UnitDamageTarget( caster, e, 1, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_UNIVERSAL, WEAPON_TYPE_WHOKNOWS )
end
GroupRemoveUnit(perebor,e)
end
PlaySoundNearUnit(caster,gg_snd_LightningBolt)
local effect=AddSpecialEffect("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl",GetUnitXY(caster))
if UnitAlive(target) then
-- DestroyEffect(AddSpecialEffect("Abilities\\Weapons\\Bolt\\BoltImpact.mdl",GetUnitXY(target)))
end
HERO[0].isLighting=true
if k==1 then
HERO[0].isLighting=false
end
TimerStart(CreateTimer(), TIMER_PERIOD, true, function()
if not HERO[0].isLighting then
DestroyTimer(GetExpiredTimer())
--print("звука нет")
end
ss=ss+TIMER_PERIOD
--print(GetSoundDuration(gg_snd_LightningBolt)//1000 )
if ss>=GetSoundDuration(gg_snd_LightningBolt)//2000 then -- 2 секунды
ss=0
--normal_sound("Abilities/Spells/Orc/LightningBolt/LightningBolt.flac",GetUnitXY(target))
if UnitAlive(target) then
-- DestroyEffect(AddSpecialEffect("Abilities\\Weapons\\Bolt\\BoltImpact.mdl",GetUnitXY(target)))
end
--print("sound light")
--effect=AddSpecialEffect("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl",GetUnitXY(caster))
end
end)
end
end)
end
function InitDamageLighting()
local DamageTrigger = CreateTrigger()
for i = 0, bj_MAX_PLAYER_SLOTS - 1 do
--TriggerRegisterPlayerUnitEvent(DamageTrigger, Player(i), EVENT_PLAYER_UNIT_DAMAGING) -- До вычета брони
TriggerRegisterPlayerUnitEvent(DamageTrigger, Player(i), EVENT_PLAYER_UNIT_DAMAGED) -- После вычета брони
end
TriggerAddAction(DamageTrigger, function()
local damage = GetEventDamage() -- число урона
if damage < 1 then return end
local eventId = GetHandleId(GetTriggerEventId())
--local isEventDamaging = eventId == GetHandleId(EVENT_PLAYER_UNIT_DAMAGING)
local isEventDamaged = eventId == GetHandleId(EVENT_PLAYER_UNIT_DAMAGED)
local target = GetTriggerUnit() -- тот кто получил урон
local caster = GetEventDamageSource() -- тот кто нанёс урон
if isEventDamaged then
--print(GetUnitName(caster).." Бьёт "..GetUnitName(target))
local damagetype = BlzGetEventDamageType()
--print(ConvertDamageTypeToString(damagetype))
local xLast=GetUnitX(caster)
if damagetype==DAMAGE_TYPE_UNIVERSAL then
local sec=0
local ss=0
local breakDamage=0
TimerStart(CreateTimer(), TIMER_PERIOD, true, function()
--print("Поражение болнией")
CreateLighting2Unit(caster,target)
if UnitDamageTarget( caster, target, 1, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS ) then
breakDamage=breakDamage+1
sec=sec+TIMER_PERIOD
if GetUnitLifePercent(target)<=5 then
SetUnitExploded(target, true)
--print("взрываем юнита")
end
if sec>=0.1 then
--Abilities\Weapons\Bolt\BoltImpact.mdl
--print("звук геде")
sec=0
SetUnitState(caster,UNIT_STATE_MANA,GetUnitState(caster,UNIT_STATE_MANA)-2)
end
-- print(GetSoundDuration(gg_snd_LightningBolt)//1000)
end
StunUnit(target,1)
if not UnitAlive(target) then
DestroyTimer(GetExpiredTimer())
HERO[0].isLighting=false
end
if xLast~=GetUnitX(caster) or GetUnitState(caster,UNIT_STATE_MANA)<=1 then
--print("сдвинулся или потерял ману")
DestroyTimer(GetExpiredTimer())
HERO[0].isLighting=false
end
--Блок для боссов
if breakDamage>=100 and target==BOSS then
--print("Босс сбрасывает с себя молнию")
local angle=360/12 -- 30
for i=1,12 do
local nx,ny=MoveXY(GetUnitX(target),GetUnitY(target),50,angle*i)
SpireCast(target,nx,ny)
end
DestroyTimer(GetExpiredTimer())
HERO[0].isLighting=false
end
xLast=GetUnitX(caster)
end)
end
end
end)
end
function CreateLighting2Unit(caster,target,id)
if not id then id="CLPB" end
local h=100
local x,y=GetUnitXY(caster)
local x1,y1=GetUnitXY(target)
local z,z1=BlzGetUnitZ(caster)+h,BlzGetUnitZ(target)+h
local l=AddLightningEx(id,true,x,y,z,x1,y1,z1) -- CLPB -- AFOD
TimerStart(CreateTimer(), 1, false, function()
DestroyLightning(l)
end)
--
end
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by Bergi.
--- DateTime: 28.10.2020 19:30
---
do
TimerStart(CreateTimer(), 0.11, false, function()
InitCastMC()
end)
end
tempHero=nil
function InitCastMC()
local SpellTrigger = CreateTrigger()
for i = 0, bj_MAX_PLAYER_SLOTS - 1 do
local player = Player(i)
TriggerRegisterPlayerUnitEvent(SpellTrigger, player, EVENT_PLAYER_UNIT_SPELL_CAST)
end
TriggerAddAction(SpellTrigger, function()
if GetSpellAbilityId() == FourCC('A005') then --Подчинение разума
local caster=GetTriggerUnit()
local target=GetSpellTargetUnit()
--print("подчиняем разум "..GetUnitName(target))
TimerStart(CreateTimer(), 1, false, function()
UnitAddAbility(caster,FourCC("A003"))
UnitAddAbility(caster,FourCC("A004"))
UnitAddAbility(target,FourCC("A006")) -- освобождение разума
UnitAddAbility(target,FourCC("Abun")) -- запрет дефолт атаки
HERO[0].ReleaseW=false
HERO[0].ReleaseA=false
HERO[0].ReleaseS=false
HERO[0].ReleaseD=false
mainHero=target
udg_mainHero=target
tempHero=caster
ResetUnitAnimation(tempHero)
SelectUnitForPlayerSingle(mainHero,Player(0))
SetUnitOwner(target,Player(0),true)
TimerStart(CreateTimer(), 1, true, function()
if not UnitAlive(target) then
DestroyTimer(GetExpiredTimer())
--HERO[0].ReleaseW=false
--HERO[0].ReleaseA=false
--HERO[0].ReleaseS=false
--HERO[0].ReleaseD=false
mainHero=caster
udg_mainHero=caster
UnitRemoveAbility(caster,FourCC("A003"))
UnitRemoveAbility(caster,FourCC("A004"))
SelectUnitForPlayerSingle(mainHero,Player(0))
end
end)
end)
--SelectUnitForPlayerSingle()
end
if GetSpellAbilityId() == FourCC('A006') then --Подчинение разума
local caster=GetTriggerUnit()
local amount=GetUnitState(caster,UNIT_STATE_LIFE)
SetUnitExploded(caster,true)
KillUnit(caster)
HealUnit(tempHero,amount)
end
end)
end
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by Bergi.
--- DateTime: 29.10.2020 16:32
---
do
TimerStart(CreateTimer(), 0.11, false, function()
InitNotAttack()
end)
end
function InitNotAttack()
local ThisClick = CreateTrigger()
TriggerRegisterCommandEvent(ThisClick, FourCC("A002"), "darkritual")
TriggerRegisterCommandEvent(ThisClick, FourCC("A005"), "acidbomb")
TriggerRegisterCommandEvent(ThisClick, FourCC("A007"), "nagabuild")
TriggerRegisterCommandEvent(ThisClick, FourCC("A00G"), "chainlightning")
--TriggerRegisterCommandEvent(ThisClick, 0, "cancel")
--TriggerRegisterCommandEvent(ThisClick, 0, "stop")
TriggerAddAction(ThisClick, function()
HERO[0].ONTarget=true
--print("Способность на стадии активации")
end)
local TrigPressAny = CreateTrigger()
TriggerRegisterPlayerEvent(TrigPressAny, Player(0), EVENT_PLAYER_MOUSE_DOWN)
TriggerAddAction(TrigPressAny, function()
if HERO[0].ONTarget then
--print("Способность отменена или подтверждена")
TimerStart(CreateTimer(), 0.1, false, function()
HERO[0].ONTarget=false
ForceUICancelBJ(Player(0))
end)
end
end)
end
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by Bergi.
--- DateTime: 28.10.2020 19:30
---
do
TimerStart(CreateTimer(), 0.11, false, function()
InitSpire()
end)
end
function InitSpire()
local SpellTrigger = CreateTrigger()
for i = 0, bj_MAX_PLAYER_SLOTS - 1 do
local player = Player(i)
TriggerRegisterPlayerUnitEvent(SpellTrigger, player, EVENT_PLAYER_UNIT_SPELL_CAST)
end
TriggerAddAction(SpellTrigger, function()
if GetSpellAbilityId() == FourCC('A007') then --Копьё
local caster=GetTriggerUnit()
local x,y=GetSpellTargetX(),GetSpellTargetY()
SpireCast(caster,x,y,"Valiant Charge")
end
end)
end
function SpireCast(caster,x,y,effModel)
if not effModel then
effModel="Abilities\\Spells\\Orc\\Shockwave\\ShockwaveMissile.mdl"
end
local xs,ys=GetUnitXY(caster)
local angle=AngleBetweenXY(xs,ys,x,y)/bj_DEGTORAD
local eff=AddSpecialEffect(effModel,xs,ys)
local dist=600
local speed=15
local curDist=0
BlzSetSpecialEffectYaw(eff, math.rad(angle))
TimerStart(CreateTimer(), 1/64, true, function()
curDist=curDist+speed
local nx,ny=MoveXY(xs,ys,curDist,angle)
BlzSetSpecialEffectPosition(eff,nx,ny,GetTerrainZ(nx,ny)+60)
BlzSetSpecialEffectColor(eff,255,0,0)
local e=nil
GroupEnumUnitsInRange(perebor,nx,ny,70,nil)
while true do
e = FirstOfGroup(perebor)
if e == nil then break end
if UnitAlive(e) and UnitAlive(caster) and (IsUnitEnemy(e,GetOwningPlayer(caster)) or GetOwningPlayer(e)==Player(PLAYER_NEUTRAL_PASSIVE)) and GetUnitTypeId(e)~=FourCC("hrif") and GetUnitTypeId(e)~=FourCC("u00B") then
if GetUnitTypeId(e)==FourCC("osp1") then
KillUnit(e)
end
local nxe,nye=MoveXY(GetUnitX(e),GetUnitY(e),speed,angle)
if not PointContentDestructable (nx,ny,70) then
--SetUnitX(e,nxe)
--SetUnitY(e,nye)
SetUnitPositionSmooth(e,nxe,nye)
end
--UnitDamageTarget( caster, e, 100, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS )
end
GroupRemoveUnit(perebor,e)
end
if curDist>=dist then
DestroyEffect(eff)
DestroyTimer(GetExpiredTimer())
UnitDamageArea(caster,10,nx,ny,70)
end
if PointContentDestructable (nx,ny,70,nil,nil,1) then
DestroyEffect(eff)
DestroyTimer(GetExpiredTimer())
local damage=BlzGetUnitBaseDamage(caster,0)
if UnitHasItemOfTypeBJ(caster,FourCC('I005')) then
damage=damage+15
end
UnitDamageArea(caster,damage,nx,ny,70)
StunArea(caster,100,2,nx,ny)
end
end)
end
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by Bergi.
--- DateTime: 29.10.2020 16:32
---
do
TimerStart(CreateTimer(), 0.11, false, function()
InitStunPerDie()
InitSpellEat()
end)
end
function InitStunPerDie()
local DamageTrigger = CreateTrigger()
for i = 0, bj_MAX_PLAYER_SLOTS - 1 do
TriggerRegisterPlayerUnitEvent(DamageTrigger, Player(i), EVENT_PLAYER_UNIT_DAMAGING) -- До вычета брони
TriggerRegisterPlayerUnitEvent(DamageTrigger, Player(i), EVENT_PLAYER_UNIT_DAMAGED) -- После вычета брони
end
TriggerAddAction(DamageTrigger, function()
local damage = GetEventDamage() -- число урона
if damage < 1 then return end
local eventId = GetHandleId(GetTriggerEventId())
local isEventDamaging = eventId == GetHandleId(EVENT_PLAYER_UNIT_DAMAGING)
local isEventDamaged = eventId == GetHandleId(EVENT_PLAYER_UNIT_DAMAGED)
local target = GetTriggerUnit() -- тот кто получил урон
local caster = GetEventDamageSource() -- тот кто нанёс урон
if isEventDamaging then
TimerStart(CreateTimer(), 0.11, false, function()
if UnitAlive(target) and GetUnitStatePercent(target,UNIT_STATE_LIFE,UNIT_STATE_MAX_LIFE)<=30 and GetOwningPlayer(target)~=Player(0) and not IsUnitType(target,UNIT_TYPE_UNDEAD) then --and GetUnitLevel(target)<=5
local r=GetRandomInt(1,2)
if r==1 and damage>10 then
local savedOwner=GetOwningPlayer(target)
StunUnit(target,3.5)
UnitAddType(target,UNIT_TYPE_UNDEAD)
SetUnitOwner(target,Player(PLAYER_NEUTRAL_PASSIVE),true)
SetUnitAnimation(target,"death")
RemoveGuardPosition(target)
-- print("юнита можно съесть?")
local t=CreateTimer()
TimerStart(t, 0.1, true, function()
if not UnitAlive(target) then
AddHeroXP(caster,GetUnitLevel(target)*20,true)
DestroyTimer(t)
end
end)
TimerStart(CreateTimer(), 3.5, false, function()
UnitRemoveType(target,UNIT_TYPE_UNDEAD)
if UnitAlive(target) then
ResetUnitAnimation(target)
end
if UnitAlive(target) then
SetUnitOwner(target,savedOwner,true)
DestroyTimer(t)
else
--
end
end)
end
end
end)
if IsUnitInRange(caster,target,200) and caster==mainHero and damage>1 then
if GetUnitTypeId(caster)==FourCC("Hpal") then
--print("звук удара")
local r=GetRandomInt(1,2)
if r==1 then
normal_sound("Sound\\Units\\Combat\\MetalHeavySliceFlesh3",GetUnitXY(target))
else
normal_sound("Sound\\Units\\Combat\\MetalHeavySliceFlesh2",GetUnitXY(target))
end
if not IsUnitType(target,UNIT_TYPE_UNDEAD) then
AddSpecialEffect("Objects\\Spawnmodels\\Other\\BeastmasterBlood\\BeastmasterBlood.mdl",GetUnitXY(target))
--print("Кровь обычная")
else
AddSpecialEffect("Objects\\Spawnmodels\\NightElf\\NightElfBlood\\NightElfBloodChimaera.mdl",GetUnitXY(target))
--print(" кровь нежити")
end
else--Бьёт другое существо
--print("Бьёт другое существо")
if GetOwningPlayer(target)~=Player(PLAYER_NEUTRAL_PASSIVE) then
SetPlayerAllianceStateBJ(GetOwningPlayer(target),Player(0), bj_ALLIANCE_UNALLIED)
end
local r=GetRandomInt(1,2)
if r==1 then
normal_sound("Sound\\Units\\Combat\\MetalLightChopFlesh1.flac",GetUnitXY(target))
--PlaySoundNearUnit(target,SoundAttack7)
else
normal_sound("Sound\\Units\\Combat\\MetalLightChopFlesh2.flac",GetUnitXY(target))
--PlaySoundNearUnit(target,SoundAttack8)
end
end
else
end
end
if isEventDamaged then -- после вычена брони для показа конкретного урона
if damage>=2 then
FlyTextTagMiss(target,R2I(damage),GetOwningPlayer(caster))-- герой видит урон который наносит
end
if GetUnitTypeId(target)==FourCC("Hpal") then
if not HERO[0].isAttacking and not HERO[0].ReleaseW and not HERO[0].ReleaseA and not HERO[0].ReleaseS and not HERO[0].ReleaseD then
if GetUnitAbilityLevel(target,FourCC("A004"))==0 then
SetUnitAnimationByIndex(target,4)
else
local AngleSource = math.deg(AngleBetweenXY(GetUnitX(caster), GetUnitY(caster), GetUnitX(target), GetUnitY(target)))
local eff=AddSpecialEffect("DefendCaster",GetUnitXY(target))
BlzSetSpecialEffectYaw(eff,math.rad(AngleSource-180))
DestroyEffect(eff)
end
end
--print("герой получил урон, путь его колбасит")
end
FlyTextTagShieldXY(GetUnitX(target),GetUnitY(target),R2I(damage),GetOwningPlayer(target))-- показ полученного урона
end
end)
end
function InitSpellEat()
local SpellTrigger = CreateTrigger()
for i = 0, bj_MAX_PLAYER_SLOTS - 1 do
local player = Player(i)
TriggerRegisterPlayerUnitEvent(SpellTrigger, player, EVENT_PLAYER_UNIT_SPELL_CAST)
end
TriggerAddAction(SpellTrigger, function()
if GetSpellAbilityId() == FourCC('A002') then -- пожирание
local target=GetSpellTargetUnit()
if StunSystem[GetHandleId(target)] then
if StunSystem[GetHandleId(target)].Time>0 then
--ShowUnit(target,false)
-- print("Был ли баг двнойной смерти?")
end
end
end
end)
end
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by Bergi.
--- DateTime: 31.10.2020 13:13
---
---
do
TimerStart(CreateTimer(), 0.11, false, function()
InitBossZone2()
end)
end
function InitBossZone2()
local this = CreateTrigger()
TriggerRegisterEnterRectSimple(this, gg_rct_BashZone)
TriggerAddAction(this, function()
local hero=GetTriggerUnit()
if IsUnitType(hero,UNIT_TYPE_HERO) then
StartBossAI2(gg_rct_BashZone)
DisableTrigger(this)
end
end)
end
BossHPBar=nil
notSplash=true
function StartBossAI2(zone)
local boss = FindUnitOfType(FourCC('Giam'))--баш лорд
local bsx,bsy=GetUnitXY(boss) --стартовая позиция босса
BOSS=boss
BossDamaged2(boss)
BlzSetUnitMaxHP(boss,600)
local BossFight=true
--print("Запущен ИИ Босса")
local bar=HealthBarAdd(boss)
local FW = CreateFogModifierRectBJ(false, Player(0), FOG_OF_WAR_VISIBLE, zone) --Рект босс
FogModifierStart(FW)
ClearMapMusicBJ()
PlayMusicBJ(gg_snd_Varien___Born_Of_Blood__Risen_From_Ash)
local phase = 4 --стартовая фаза
local sec = 0
local PhaseOn = true
local OnAttack=true
TimerStart(CreateTimer(), 1, true, function() --каждую секунду
local x, y = GetUnitXY(boss)
if not UnitAlive(boss) then-- Место где босс умер
StartSound(bj_questCompletedSound)
DestroyTimer(GetExpiredTimer())
phase = 0
BlzFrameSetVisible(bar,false)
EnumDestructablesInRect(gg_rct_bossWin,nil,function()
KillDestructable(GetEnumDestructable())
end)
ClearMapMusicBJ()
PlayMusicBJ(gg_snd_All_Clear)
TimerStart(CreateTimer(), 45, false, function()
if not UnitAlive(BOSS) then
ClearMapMusicBJ()
PlayMusicBJ(gg_snd_Blood_Omen__Legacy_of_Kain___Kain_s_Mausoleum)
end
end)
--print("Даём нарграду? ,босс повержен")
else --Проверяем есть ли живые герои,
if BossFight then
if not IsUnitInRange(mainHero, boss, 1000) or not UnitAlive(mainHero) or not IsUnitInRangeXY( boss, bsx,bsy,1500) then
BossFight=false
phase=0
DestroyFogModifier(FW)
IssuePointOrder(boss,"move",bsx,bsy)
DestroyEffect(AddSpecialEffect( "Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl", GetUnitXY(boss)))
SetUnitPositionSmooth(boss,bsx,bsy)
DestroyEffect(AddSpecialEffect( "Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl", GetUnitXY(boss)))
--print("Герой мерт или далеко ушёл, остановка фаз")
CameraClearNoiseForPlayer(Player(0))
ClearMapMusicBJ()
PlayMusicBJ(gg_snd_Blood_Omen__Legacy_of_Kain___Kain_s_Mausoleum)
BlzFrameSetVisible(bar,false)
end
end
end
if BossFight then -- если идёт бой и каждую фазу
sec = sec + 1
if GetUnitLifePercent(boss)<=25 then
UnitAddAbility(boss,FourCC("A00N"))
else
UnitRemoveAbility(boss,FourCC("A00N"))
end
if sec >= 10 then
sec = 0
phase = phase + 1
PhaseOn = true
--print("phase " .. phase)
if phase >= 5 then
phase = 0
end
end
--фазы
if phase == 1 and PhaseOn then
PhaseOn = false
--Doodads\LordaeronSummer\Props\PeasantGrave\PeasantGrave012
--print("моглики со склетеами в случайных местах зоны 1+ 1 за каждые 20%% потеряного хп, максимум 5")
for i=1,4 do
local tl=GetRandomLocInRect(zone)
CreateGrave(boss,GetLocationX(tl),GetLocationY(tl))
RemoveLocation(tl)
end
end
if phase == 2 and PhaseOn then
PhaseOn = false
notSplash=false
--print("Удар молотом вокруг себя медленно")
if not IssueTargetOrder(boss,"attack",mainHero) then
IssuePointOrder(boss,"attack",GetUnitXY(mainHero))
end
TimerStart(CreateTimer(), 2, true, function()
if not IssueTargetOrder(boss,"attack",mainHero) then
IssuePointOrder(boss,"attack",GetUnitXY(mainHero))
end
if IsUnitInRange(boss,mainHero,300) then
AreaSplashMark(boss)
end
if phase~=2 then
DestroyTimer(GetExpiredTimer())
notSplash=true
end
end)
end
if phase == 3 and PhaseOn then
PhaseOn = false
--print("Разбег с отталкиавнием в сторону героя")
--local r=5
RunSkeleton(boss)
TimerStart(CreateTimer(), 3, true, function()
RunSkeleton(boss)
if phase~=3 then
DestroyTimer(GetExpiredTimer())
end
end)
end
if phase == 4 and PhaseOn then -- запуск волны
PhaseOn = false
--print("Фаза закапывания и выкапывания и тумана")
local nx,ny=GetRectCenterX(zone),GetRectCenterY(zone)
local fog=AddSpecialEffect("war3mapImported\\fog.mdl",nx,ny)
BlzSetSpecialEffectScale(fog,0.15)
local z=BlzGetLocalSpecialEffectZ(fog)
local sec2=0
TimerStart(CreateTimer(), TIMER_PERIOD, true, function()
if sec2>2 then
BlzSetSpecialEffectPosition(fog,nx,ny,z-1)
z=BlzGetLocalSpecialEffectZ(fog)
end
--print(z)
sec2=sec2+TIMER_PERIOD
if sec2>=9 then
DestroyTimer(GetExpiredTimer())
DestroyEffect(fog)
end
end)
local tmpLoc=GetRandomLocInRect(zone)
local woman=CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),FourCC("nvlw"),GetLocationX(tmpLoc),GetLocationY(tmpLoc),GetUnitFacing(boss))
RemoveLocation(tmpLoc)
RunSkeleton(boss)
TimerStart(CreateTimer(), 2, true, function()
--тут нужно какое-то действие
if phase~=4 then
-- print("фаза "..phase.." завершена")
DestroyTimer(GetExpiredTimer())
--BlzPauseUnitEx(boss,false)
end
end)
end
else-- перезапуск боссфайта
if IsUnitInRange(mainHero, boss, 1000) then
--print("перезапуск боссфайта")
ClearMapMusicBJ()
PlayMusicBJ(gg_snd_Varien___Born_Of_Blood__Risen_From_Ash)
BlzFrameSetVisible(bar,true)
HealUnit(boss,100)
BossFight=true
end
end--конец
end)
end
function BossDamaged2(boss)
local DamageTrigger = CreateTrigger()
for i = 0, bj_MAX_PLAYER_SLOTS - 1 do
--TriggerRegisterPlayerUnitEvent(DamageTrigger, Player(i), EVENT_PLAYER_UNIT_DAMAGING) -- До вычета брони
TriggerRegisterPlayerUnitEvent(DamageTrigger, Player(i), EVENT_PLAYER_UNIT_DAMAGED) -- После вычета брони
end
local bossTakenDamage=0
local bossGivenDamage=0
TriggerAddAction(DamageTrigger, function()
local damage = GetEventDamage() -- число урона
if damage < 1 then return end
local eventId = GetHandleId(GetTriggerEventId())
--local isEventDamaging = eventId == GetHandleId(EVENT_PLAYER_UNIT_DAMAGING)
local isEventDamaged = eventId == GetHandleId(EVENT_PLAYER_UNIT_DAMAGED)
local target = GetTriggerUnit() -- тот кто получил урон
local caster = GetEventDamageSource() -- тот кто нанёс урон
if isEventDamaged then
if target==boss then-- босс получает 100 урона
bossTakenDamage=bossTakenDamage+damage
if bossTakenDamage>=100 then
bossTakenDamage=0
--local angle=AngleBetweenXY(GetUnitX(boss),GetUnitY(boss),GetUnitXY(mainHero))/bj_DEGTORAD
SpireCast(boss,GetUnitXY(mainHero))
end
end
if caster==boss then -- боссатакует
bossGivenDamage=bossGivenDamage+damage
if bossGivenDamage>=100 then
bossGivenDamage=0
--local r=GetRandomInt(1,5)
--if r==1 and IsUnitInRange(boss,mainHero,300) then
if notSplash then
AreaSplashMark(boss)
end
--end
end
end
end
end)
end
function CreateGrave(boss,x,y)
local r=GetRandomInt(0,2)
DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Undead\\RaiseSkeletonWarrior\\RaiseSkeleton.mdl",x,y))
local eff=AddSpecialEffect("Doodads\\LordaeronSummer\\Props\\PeasantGrave\\PeasantGrave"..r,x,y)
--war3mapImported\fog.mdl
local sec=0
local z=BlzGetLocalSpecialEffectZ(eff)
BlzSetSpecialEffectScale(eff,2.3)
BlzSetSpecialEffectYaw(eff, math.rad(GetRandomInt(0,360)))
--print(z.." стартовая")
local skeleton=nil
local id={FourCC("uske"),FourCC("u004"),FourCC("u006"),FourCC("u007"),FourCC("nvlw"),FourCC("u009"),FourCC("u000")} -- FourCC("u00D")
TimerStart(CreateTimer(), TIMER_PERIOD, true, function()
if sec>2 then
BlzSetSpecialEffectPosition(eff,x,y,z-1)
z=BlzGetLocalSpecialEffectZ(eff)
end
--print(z)
sec=sec+TIMER_PERIOD
if sec>=4.5 then
DestroyTimer(GetExpiredTimer())
DestroyEffect(eff)
DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Undead\\RaiseSkeletonWarrior\\RaiseSkeleton.mdl",x,y))
if GetUnitTypeId(boss)==FourCC("u00B") then --призыв некроманта
skeleton=CreateUnit(GetOwningPlayer(boss),id[GetRandomInt(1,#id)],x,y,GetRandomInt(0,360))
CreateLighting2Unit(boss,skeleton,"AFOD")
local dmg=GetRandomInt(10,20)
HealUnit(boss,-dmg)
FlyTextTagMiss(boss,R2I(dmg),GetOwningPlayer(mainHero))
else -- призыв грейвкипера
skeleton=CreateUnit(GetOwningPlayer(boss),FourCC("uske"),x,y,GetRandomInt(0,360))
end
if GetUnitTypeId(skeleton)==FourCC("nvlw") then --девочка
SetUnitOwner(skeleton,Player(PLAYER_NEUTRAL_PASSIVE),true)
end
if GetUnitTypeId(skeleton)==FourCC("u000") then --красный босс
StunUnit(skeleton,0.2)
--print("Редбосс")
TimerStart(CreateTimer(), 5, true, function()
if IsUnitInRange(skeleton,mainHero,1000) and StunSystem[GetHandleId(skeleton)].Time==0 and UnitAlive(skeleton) then
CreateMeteorMark(skeleton,GetUnitXY(mainHero))
end
if not UnitAlive(skeleton) then
DestroyTimer(GetExpiredTimer())
end
end)
end
UnitApplyTimedLife(skeleton,FourCC('BTLF'),25)
if not IssueTargetOrder(skeleton,"attack",mainHero) then
IssuePointOrder(skeleton,"attack",GetUnitXY(mainHero))
end
end
end)
return skeleton
end
function RunSkeleton(boss)
BlzPauseUnitEx(boss,true)
--SetUnitAnimation(boss,"walk")
SetUnitAnimationByIndex(boss,6)
--print(r)
--r=r+1
SetUnitTimeScale(boss,3)
local angle=AngleBetweenXY(GetUnitX(boss),GetUnitY(boss),GetUnitXY(mainHero))/bj_DEGTORAD
SetUnitFacing(boss,angle)
UnitAddForceSimple(boss,angle,10,500,6)
end
function AreaSplashMark(boss)
BlzPauseUnitEx(boss,true)
SetUnitAnimation(boss,"attack")
SetUnitTimeScale(boss,0.5)
local nx,ny=MoveXY(GetUnitX(boss),GetUnitY(boss),200,GetUnitFacing(boss))
local mark=AddSpecialEffect("Snipe Target",nx,ny)
BlzSetSpecialEffectScale(mark,10)
TimerStart(CreateTimer(), 1.2, false, function()
BlzPauseUnitEx(boss,false)
DestroyEffect(mark)
BlzSetSpecialEffectPosition(mark,5000,5000,0)
--nx,ny=MoveXY(GetUnitX(boss),GetUnitY(boss),200,GetUnitFacing(boss))
DestroyEffect(AddSpecialEffect("ThunderclapCasterClassic",nx,ny))
UnitDamageArea(boss,100,nx,ny,200) --урон
StunArea(boss,200,1,nx,ny)
SetUnitTimeScale(boss,1)
ResetUnitAnimation(boss)
end)
end
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by Bergi.
--- DateTime: 01.11.2020 20:48
---
do
TimerStart(CreateTimer(), 0.11, false, function()
InitBossZoneWE()
end)
end
function InitBossZoneWE()
local this = CreateTrigger()
TriggerRegisterEnterRectSimple(this, gg_rct_WEbolldBoss)
TriggerAddAction(this, function()
local hero=GetTriggerUnit()
if IsUnitType(hero,UNIT_TYPE_HERO) then
StartBossAIWE(gg_rct_WEbolldBoss)
ClearMapMusicBJ()
PlayMusicBJ(gg_snd_Hollow_Knight_OST___Nosk__Boss_Theme_u)
DisableTrigger(this)
udg_RevivePoint = gg_rct_RedKeyDoor
end
end)
end
function StartBossAIWE(zone)
local boss=FindUnitOfType(FourCC("hwt3"),1000,GetRectCenterX(zone),GetRectCenterY(zone))
local hero=boss
StunUnit(boss,0.2)
UnitAddType(boss,UNIT_TYPE_UNDEAD)
--print("запущен ии водного элементаля, он должен что то делать")
TimerStart(CreateTimer(), 5, true, function()
if IsUnitInRange(boss,mainHero,500) and StunSystem[GetHandleId(boss)].Time==0 and UnitAlive(boss) then
UnitAddAbility(boss,FourCC("AInv"))
UnitAddItemById(boss,FourCC("I004"))
ShowUnit(boss,false)
UnitAddForceSimple(boss,GetUnitFacing(boss),15,600,5)
local bar=AddSpecialEffect("Progressbar",GetUnitXY(hero))
BlzSetSpecialEffectColor(bar,255,255,255)
BlzPlaySpecialEffect(bar,ANIM_TYPE_BIRTH)
BlzSetSpecialEffectTimeScale(bar,0.22)
BlzSetSpecialEffectScale(bar,1.5)
local sec=0
TimerStart(CreateTimer(), TIMER_PERIOD, true, function()
sec=sec+TIMER_PERIOD
BlzSetSpecialEffectPosition(bar,GetUnitX(hero),GetUnitY(hero),BlzGetLocalUnitZ(hero)+260)
if sec>5 then
DestroyTimer(GetExpiredTimer())
DestroyEffect(bar)
BlzSetSpecialEffectPosition(bar,5000,5000,0)
end
end)
end
if not UnitAlive(boss) then
DestroyTimer(GetExpiredTimer())
--print("dead")
ClearMapMusicBJ()
PlayMusicBJ(gg_snd_Blood_Omen__Legacy_of_Kain___Kain_s_Mausoleum)
CreateArrowMark(GetUnitXY(boss))
end
end)
end
function CreateArrowMark(x,y)
TimerStart(CreateTimer(), 20, false, function()
local _,k,units=FindUnitOfType(FourCC("hrif"))
--print(k)
if k==0 then
-- print("могилки не найдены")
end
for i=1,#units do
--print(i)
local eff = AddSpecialEffect("AneuCaster", GetUnitXY(units[i])) --"Abilities\\Spells\\Items\\AIco\\CrownOfCmndTarget.mdl"
BlzSetSpecialEffectPitch(eff, math.rad(-90))
BlzSetSpecialEffectZ(eff, BlzGetLocalUnitZ(units[i]) + 350)
TimerStart(CreateTimer(), 0.1, true, function()
local angle=GetUnitFacing(units[i])
--print("поворот "..angle)
BlzSetSpecialEffectYaw(eff, math.rad(angle))
end)
end
end)
end
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by Bergi.
--- DateTime: 31.10.2020 13:13
---
---
do
TimerStart(CreateTimer(), 0.11, false, function()
InitBossZone()
end)
end
function InitBossZone()
local this = CreateTrigger()
TriggerRegisterEnterRectSimple(this, gg_rct_BossRealStart)
TriggerAddAction(this, function()
local hero=GetTriggerUnit()
if IsUnitType(hero,UNIT_TYPE_HERO) then
StartBossAI(gg_rct_boss)
DisableTrigger(this)
end
end)
end
BOSS=nil
BossHPBar=nil
function StartBossAI(zone)
local boss = FindUnitOfType(FourCC('u005'))
local bsx,bsy=GetUnitXY(boss) --стартовая позиция босса
BOSS=boss
BossDamaged(boss)
local BossFight=true
--print("Запущен ИИ Босса")
local bar=HealthBarAdd(boss)
local FW = CreateFogModifierRectBJ(false, Player(0), FOG_OF_WAR_VISIBLE, zone) --Рект босс
FogModifierStart(FW)
ClearMapMusicBJ()
PlayMusicBJ(gg_snd_Blood_omen_2__Battle_theme) -- gg_snd_Blood_omen_2__Battle_theme
local phase = 3 --стартовая фаза
local sec = 0
local PhaseOn = true
local OnAttack=true
TimerStart(CreateTimer(), 1, true, function() --каждую секунду
local x, y = GetUnitXY(boss)
if not UnitAlive(boss) then-- Место где босс умер тиник
StartSound(bj_questCompletedSound)
DestroyTimer(GetExpiredTimer())
phase = 0
GolemIsFree=true
ClearMapMusicBJ()
PlayMusicBJ(gg_snd_All_Clear)
BlzFrameSetVisible(bar,false)
EnumDestructablesInRect(gg_rct_bossWin,nil,function()
KillDestructable(GetEnumDestructable())
end)
TimerStart(CreateTimer(), 45, false, function()
if not UnitAlive(BOSS) then
ClearMapMusicBJ()
PlayMusicBJ(gg_snd_Blood_Omen__Legacy_of_Kain___Kain_s_Mausoleum)
end
end)
--print("Даём нарграду? ,босс повержен")
else --Проверяем есть ли живые герои, когда босс жив
if BossFight then
if not IsUnitInRange(mainHero, boss, 2000) or not UnitAlive(mainHero) or not IsUnitInRangeXY( boss, bsx,bsy,1500) then
BossFight=false
phase=0
IssuePointOrder(boss,"move",bsx,bsy)
--SetUnitPositionSmooth(boss,bsx,bsy)
DestroyFogModifier(FW)
--print("Герой мерт или далеко ушёл, остановка фаз")
ClearMapMusicBJ()
PlayMusicBJ(gg_snd_Blood_Omen__Legacy_of_Kain___Kain_s_Mausoleum)
BlzFrameSetVisible(bar,false)
end
end
end
if BossFight then -- если идёт бой и каждую фазу
sec = sec + 1
if GetUnitLifePercent(boss)<=25 then
UnitAddAbility(boss,FourCC("A00D"))
UnitAddAbility(boss,FourCC("A00E"))
else
UnitRemoveAbility(boss,FourCC("A00D"))
UnitRemoveAbility(boss,FourCC("A00E"))
end
if sec >= 10 then
sec = 0
phase = phase + 1
PhaseOn = true
--print("phase " .. phase)
if phase >= 4 then
phase = 0
end
end
--фазы
if phase == 1 and PhaseOn then
PhaseOn = false
--print("Призываем скелетов")
local skeleton={}
skeleton[1]=CreateUnit(GetOwningPlayer(boss),FourCC("uske"),GetRectMaxX(zone),GetRectMaxY(zone),GetRandomInt(0,360))
skeleton[2]=CreateUnit(GetOwningPlayer(boss),FourCC("uske"),GetRectMaxX(zone)-GetRectWidthBJ(zone),GetRectMinY(zone)+GetRectHeightBJ(zone),GetRandomInt(0,360))
skeleton[3]=CreateUnit(GetOwningPlayer(boss),FourCC("uske"),GetRectMinX(zone)+GetRectWidthBJ(zone),GetRectMinY(zone),GetRandomInt(0,360))
skeleton[4]=CreateUnit(GetOwningPlayer(boss),FourCC("uske"),GetRectMinX(zone),GetRectMinY(zone),GetRandomInt(0,360))
if GetUnitLifePercent(boss)<=50 then
skeleton[5]=CreateUnit(GetOwningPlayer(boss),FourCC("n005"),GetRectMaxX(zone),GetRectMaxY(zone),GetRandomInt(0,360))
skeleton[6]=CreateUnit(GetOwningPlayer(boss),FourCC("n005"),GetRectMaxX(zone)-GetRectWidthBJ(zone),GetRectMinY(zone)+GetRectHeightBJ(zone),GetRandomInt(0,360))
skeleton[7]=CreateUnit(GetOwningPlayer(boss),FourCC("n005"),GetRectMinX(zone)+GetRectWidthBJ(zone),GetRectMinY(zone),GetRandomInt(0,360))
skeleton[8]=CreateUnit(GetOwningPlayer(boss),FourCC("n005"),GetRectMinX(zone),GetRectMinY(zone),GetRandomInt(0,360))
end
for i=1,#skeleton do
UnitApplyTimedLife(skeleton[i],FourCC('BTLF'),20)
if not IssueTargetOrder(skeleton[i],"attack",mainHero) then
IssuePointOrder(skeleton[i],"attack",GetUnitXY(mainHero))
end
end
end
if phase == 2 and PhaseOn then
PhaseOn = false
--print("Падающие люстры")
if not IssueTargetOrder(boss,"attack",mainHero) then
IssuePointOrder(boss,"attack",GetUnitXY(mainHero))
end
TimerStart(CreateTimer(), 1, true, function()
if IsUnitInRange(mainHero, boss, 900) and UnitAlive(mainHero) then
MarkAndFall(GetUnitX(mainHero),GetUnitY(mainHero),"HFMChandelier",boss) --люстра
end
if phase~=2 then
DestroyTimer(GetExpiredTimer())
end
end)
end
if phase == 3 and PhaseOn then -- запуск волны
PhaseOn = false
--print("Пускаем волну в 1 из 3 направлений")
local r=GetRandomInt(1,3)
local xs,ys=GetRectCenterX(zone),GetRectCenterY(zone)
if r==1 then
xs=xs-GetRectWidthBJ(zone)/3
elseif r==2 then
xs=xs+GetRectWidthBJ(zone)/3
end
MarkPillar(xs,ys,boss,zone)
if GetUnitLifePercent(boss)<=15 then--мега ярость
local second=true
if r==1 then
xs=xs+GetRectWidthBJ(zone)/3
elseif r==2 then
xs=xs-GetRectWidthBJ(zone)/3
elseif r==3 then
second=false
end
if second then --запуск второй волны
MarkPillar(xs,ys,boss,zone)
end
end
end
else-- перезапуск боссфайта
if IsUnitInRange(mainHero, boss, 1000) then
--print("перезапуск боссфайта")
ClearMapMusicBJ()
PlayMusicBJ(gg_snd_Blood_omen_2__Battle_theme)
BlzFrameSetVisible(bar,true)
HealUnit(boss,500)
BossFight=true
end
end--конец
end)
end
function MarkAndFall(x,y,effModel,hero)
local mark=AddSpecialEffect("Snipe Target",x,y)
BlzSetSpecialEffectScale(mark,5)
TimerStart(CreateTimer(), 2, false, function()
local FallenEff=AddSpecialEffect(effModel,x,y)
BlzSetSpecialEffectZ(FallenEff,1000)
BlzSetSpecialEffectYaw(FallenEff, math.rad(GetRandomReal(0,360)))
TimerStart(CreateTimer(), TIMER_PERIOD, true, function()
local z=BlzGetLocalSpecialEffectZ(FallenEff)
BlzSetSpecialEffectZ(FallenEff,z-25)
if z<=GetTerrainZ(x,y) then
DestroyEffect(mark)
BlzSetSpecialEffectPosition(mark,5000,5000,0)
DestroyTimer(GetExpiredTimer())
DestroyEffect(FallenEff)
BlzSetSpecialEffectPosition(FallenEff,5000,5000,0)
DestroyEffect(AddSpecialEffect("ThunderclapCasterClassic",x,y))
UnitDamageArea(hero,50,x,y,150) --при падении камня
UnitDamageArea(mainHero,50,x,y,150)
end
end)
end)
end
function CreateFirePillar(xs,ys,boss,zone)
ys=ys+700
local step=100
xs=xs-step*1.7
local x=xs
local k=4
IssuePointOrder(boss,"attack",GetUnitXY(mainHero))
TimerStart(CreateTimer(), 1/16, true, function()
--for k=1,14 do
for i =1,3 do
-- B006 лавйка, можно сломать
x=x+step
local y=ys-step*(k-1)
local eff=AddSpecialEffect("Abilities\\Spells\\Human\\FlameStrike\\FlameStrike1.mdl",x,y)
--DestroyEffect(eff)
local sec=0
TimerStart(CreateTimer(), 0.2, true, function()
sec=sec+0.2
UnitDamageArea(boss,20,x,y,step)
if sec>=5 then
DestroyEffect(eff)
DestroyTimer(GetExpiredTimer())
end
end)
-- local _,d=PointContentDestructable(x,y,step*2)
--if GetDestructableTypeId(d)==FourCC("B006") then
--print("Врезался в лавку")
--DestroyTimer(GetExpiredTimer())
local j=1.2
SetRect(GlobalRect, x - step*j, y - step*j, x + step*j, y +step*j)
EnumDestructablesInRect(GlobalRect,nil,function ()
local d=GetEnumDestructable()
--if GetDestructableLife(d)>0 then
--print("Удалено "..GetDestructableName(d))
RemoveDestructable(d)
--end
end)
--end
UnitDamageArea(boss,99,x,y,step)
end
x=xs
k=k+1
if k>=15 then
DestroyTimer(GetExpiredTimer())
end
end)
--end
end
function BossDamaged(boss)
local DamageTrigger = CreateTrigger()
for i = 0, bj_MAX_PLAYER_SLOTS - 1 do
--TriggerRegisterPlayerUnitEvent(DamageTrigger, Player(i), EVENT_PLAYER_UNIT_DAMAGING) -- До вычета брони
TriggerRegisterPlayerUnitEvent(DamageTrigger, Player(i), EVENT_PLAYER_UNIT_DAMAGED) -- После вычета брони
end
local bossTakenDamage=0
TriggerAddAction(DamageTrigger, function()
local damage = GetEventDamage() -- число урона
if damage < 1 then return end
local eventId = GetHandleId(GetTriggerEventId())
--local isEventDamaging = eventId == GetHandleId(EVENT_PLAYER_UNIT_DAMAGING)
local isEventDamaged = eventId == GetHandleId(EVENT_PLAYER_UNIT_DAMAGED)
local target = GetTriggerUnit() -- тот кто получил урон
local caster = GetEventDamageSource() -- тот кто нанёс урон
if isEventDamaged then
if target==boss then-- босс получает 100 урона
bossTakenDamage=bossTakenDamage+damage
if bossTakenDamage>=100 then
bossTakenDamage=0
local angle=AngleBetweenXY(GetUnitX(boss),GetUnitY(boss),GetUnitXY(mainHero))/bj_DEGTORAD
CreateFireLine(boss,angle,DistanceBetweenXY(GetUnitX(boss),GetUnitY(boss),GetUnitXY(mainHero)))
end
end
if caster==boss then
local r=GetRandomInt(1,5)
if r==1 and IsUnitInRange(boss,mainHero,300) then
SpireCast(boss,GetUnitXY(mainHero))
end
end
end
end)
end
function CreateFireLine(boss,angle,distance)
local x,y=GetUnitXY(boss)
--local currentDistance=0
local speed=128
local step=distance//speed
local mark={}
for i=1,step do
x,y=MoveXY(x,y,speed,angle)
mark[i]=AddSpecialEffect("Snipe Target",x,y)
BlzSetSpecialEffectScale(mark[i],5)
end
TimerStart(CreateTimer(), 2, false, function()
for i=1,#mark do
DestroyEffect(mark[i])
BlzSetSpecialEffectPosition(mark[i],5000,5000,0)
end
x,y=GetUnitXY(boss)
TimerStart(CreateTimer(), 1/16, true, function()
x,y=MoveXY(x,y,speed,angle)
local eff=AddSpecialEffect("Abilities\\Spells\\Human\\FlameStrike\\FlameStrike1.mdl",x,y)
UnitDamageArea(boss,99,x,y,speed)
distance=distance-speed
if distance<=0 then
DestroyTimer(GetExpiredTimer())
end
end)
end)
end
function MarkPillar(xs,ys,boss,zone)
local eff=AddSpecialEffect("s_cube1",xs,ys)
BlzSetSpecialEffectZ(eff,GetUnitZ(mainHero)-45)
BlzSetSpecialEffectMatrixScale(eff,4,14,0.5)
BlzSetSpecialEffectColor(eff,255,0,0)
BlzSetSpecialEffectAlpha(eff,100)
TimerStart(CreateTimer(), 3, false, function()
CreateFirePillar(xs,ys,boss,zone)
DestroyEffect(eff)
BlzSetSpecialEffectPosition(eff,5000,5000,0)
DestroyTimer(GetExpiredTimer())
local tmpLoc=GetRandomLocInRect(zone)
local woman=CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),FourCC("nvlw"),GetLocationX(tmpLoc),GetLocationY(tmpLoc),GetUnitFacing(boss))
RemoveLocation(tmpLoc)
end)
end
do --Инициализация
TimerStart(CreateTimer(), 0.1, false, function()
if BlzLoadTOCFile("Main.toc") then
--print("успех")
else
print("провал загрузки ток кастом бара")
end
end)
end
function HealthBarAdd(u)
local bar = BlzCreateSimpleFrame("MyFakeBar", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), 0)
BlzFrameSetVisible(bar,true)
BlzFrameSetTexture(bar, "Replaceabletextures\\Teamcolor\\Teamcolor00.blp", 0, true)
BlzFrameSetTexture(BlzGetFrameByName("MyFakeBarBorder",0),"MyBarBorder.blp", 0, true)
BlzFrameSetText(BlzGetFrameByName("MyFakeBarTitle",0), "Boss")
BlzFrameSetAbsPoint(bar,FRAMEPOINT_CENTER,0.4,0.55)
BlzFrameSetSize(bar,0.3,.03)
local lefttext = BlzGetFrameByName("MyFakeBarLeftText",0)
local righttext = BlzGetFrameByName("MyFakeBarRightText",0)
local function on_timer()
BlzFrameSetValue(bar, GetUnitLifePercent(u))
BlzFrameSetText(lefttext, R2I(GetWidgetLife(u)))
BlzFrameSetText(righttext, R2I(BlzGetUnitMaxHP(u)))
end
TimerStart(CreateTimer(),0.5,true, on_timer)
return bar
end
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by Bergi.
--- DateTime: 20.11.2020 3:19
---
--Golem=gg_unit_u00A_0384
GolemIsFree=false
do
TimerStart(CreateTimer(), 3, false, function()
--RegisterNecroBoss()
StartAndWaitGolemAI(gg_unit_u00A_0384)
end)
end
function StartAndWaitGolemAI(boss)
local bsx,bsy=GetUnitXY(boss)
BlzSetUnitMaxHP(boss,2000)
HealUnit(boss,2000)
local BossFight=true
--print("Запущен ИИ Босса")
local bar=HealthBarAdd(boss)
BlzFrameSetVisible(bar,false)
--ClearMapMusicBJ()
--PlayMusicBJ(gg_snd_Hollow_Knight_OST___Nosk__Boss_Theme_u)
GolemDamaged(boss)
local phase = 1 --стартовая фаза
local sec = 0
local PhaseOn = true
local OnAttack=true
TimerStart(CreateTimer(), 1, true, function() --каждую секунду
local x, y = GetUnitXY(boss)
if not UnitAlive(boss) then-- Место где босс умер
StartSound(bj_questCompletedSound)
DestroyTimer(GetExpiredTimer())
phase = 0
BlzFrameSetVisible(bar,false)
CameraClearNoiseForPlayer(Player(0))
ClearMapMusicBJ()
PlayMusicBJ(gg_snd_Blood_Omen__Legacy_of_Kain___Kain_s_Mausoleum)
--print("Даём нарграду? ,босс повержен")
else --Проверяем есть ли живые герои,
if BossFight then
if not IsUnitInRange(mainHero, boss, 1000) or not UnitAlive(mainHero) or not IsUnitInRangeXY( boss, bsx,bsy,2000) then
BossFight=false
phase=0
CameraClearNoiseForPlayer(Player(0))
IssuePointOrder(boss,"move",bsx,bsy)
DestroyEffect(AddSpecialEffect( "Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl", GetUnitXY(boss)))
SetUnitPositionSmooth(boss,bsx,bsy)
DestroyEffect(AddSpecialEffect( "Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl", GetUnitXY(boss)))
if GetUnitTypeId(mainHero)==FourCC("Hpal") then
ClearMapMusicBJ()
PlayMusicBJ(gg_snd_Blood_Omen__Legacy_of_Kain___Kain_s_Mausoleum)
end
--print("Герой мерт или далеко ушёл, остановка фаз")
BlzFrameSetVisible(bar,false)
end
end
end
if BossFight then -- если идёт бой и каждую фазу
sec = sec + 1
if GetUnitLifePercent(boss)<=25 then
else
end
if sec >= 10 then
sec = 0
phase = phase + 1
PhaseOn = true
--print("phase " .. phase)
if phase >= 4 then
phase = 0
end
end
--фазы
if phase == 1 and PhaseOn then
PhaseOn = false
-- print("камешки")
if UnitAlive(boss) then
CreateEarthWall(boss)
CameraSetEQNoiseForPlayer(Player(0), 3)
end
end
if phase == 2 and PhaseOn then
CameraClearNoiseForPlayer(Player(0))
PhaseOn = false
end
if phase == 3 and PhaseOn then
PhaseOn = false
--print("Разбег с отталкиавнием в сторону героя")
end
if phase == 4 and PhaseOn then -- запуск волны
PhaseOn = false
--print("Фаза закапывания и выкапывания и тумана")
TimerStart(CreateTimer(), 2, true, function()
--тут нужно какое-то действие
if phase~=4 then
-- print("фаза "..phase.." завершена")
DestroyTimer(GetExpiredTimer())
--BlzPauseUnitEx(boss,false)
end
end)
end
else-- перезапуск боссфайта
if IsUnitInRange(mainHero, boss, 1000) and GolemIsFree then
--print("перезапуск боссфайта")
BOSS=boss
UnitRemoveAbility(boss,FourCC("Avul"))
BlzFrameSetVisible(bar,true)
HealUnit(boss,100)
BossFight=true
ClearMapMusicBJ()
PlayMusicBJ(gg_snd_Hollow_Knight_OST___Nosk__Boss_Theme_u)
end
end--конец
end)
end
function GolemDamaged(boss)
local DamageTrigger = CreateTrigger()
for i = 0, bj_MAX_PLAYER_SLOTS - 1 do
--TriggerRegisterPlayerUnitEvent(DamageTrigger, Player(i), EVENT_PLAYER_UNIT_DAMAGING) -- До вычета брони
TriggerRegisterPlayerUnitEvent(DamageTrigger, Player(i), EVENT_PLAYER_UNIT_DAMAGED) -- После вычета брони
end
local bossTakenDamage=0
TriggerAddAction(DamageTrigger, function()
local damage = GetEventDamage() -- число урона
if damage < 1 then return end
local eventId = GetHandleId(GetTriggerEventId())
--local isEventDamaging = eventId == GetHandleId(EVENT_PLAYER_UNIT_DAMAGING)
local isEventDamaged = eventId == GetHandleId(EVENT_PLAYER_UNIT_DAMAGED)
local target = GetTriggerUnit() -- тот кто получил урон
local caster = GetEventDamageSource() -- тот кто нанёс урон
if isEventDamaged then
if target==boss then-- босс получает 100 урона
bossTakenDamage=bossTakenDamage+damage
if bossTakenDamage>=100 then
bossTakenDamage=0
local angle=AngleBetweenXY(GetUnitX(boss),GetUnitY(boss),GetUnitXY(mainHero))/bj_DEGTORAD
--CreateFireLine(boss,angle,DistanceBetweenXY(GetUnitX(boss),GetUnitY(boss),GetUnitXY(mainHero)))
end
end
if caster==boss then
local r=GetRandomInt(1,5)
if r==1 and IsUnitInRange(boss,mainHero,300) then
--SpireCast(boss,GetUnitXY(mainHero))
StunUnit(mainHero,2)
end
end
end
end)
end
function CreateEarthWall(boss)
local sec=10
local k=1-GetUnitLifePercent(boss)/100
local p=1.2-k
--print(k)
local x,y=GetUnitXY(boss)
TimerStart(CreateTimer(),p,true, function()
local angle=AngleBetweenXY(x,y,GetUnitXY(mainHero))/bj_DEGTORAD
x,y=MoveXY(x,y,80,angle)
CreateWallElement(x,y,10,boss)
sec=sec-p
if sec<=0 then
DestroyTimer(GetExpiredTimer())
end
end)
end
function CreateWallElement(x,y,time,boss)
--print("создан жлемент")
local eff=AddSpecialEffect("Doodads\\Dungeon\\Rocks\\DungeonStalagmite\\DungeonStalagmite"..GetRandomInt(0,3),x,y)
DestroyEffect(AddSpecialEffect( "Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl",x,y))
BlzSetSpecialEffectScale(eff,GetRandomReal(1,2))
BlzSetSpecialEffectYaw(eff, math.rad(GetRandomInt(1,360)))
local zNormal=BlzGetLocalSpecialEffectZ(eff)
local z=zNormal-500
BlzSetSpecialEffectZ(eff,z)
TimerStart(CreateTimer(), TIMER_PERIOD, true, function()
z=z+15
--print(z)
BlzSetSpecialEffectZ(eff,z)
if z>=zNormal then
DestroyTimer(GetExpiredTimer())
--print("вылез из земли")
local block=CreateDestructable(FourCC('YTpb'),x,y,0,1,0) --блокиратор пути земля
local is,hero=UnitDamageArea(boss,100,x,y,200)
local angle=AngleBetweenXY(x,y,GetUnitXY(hero))/bj_DEGTORAD
if hero then
UnitAddForceSimple(hero,angle,15,300,"dust")
end
TimerStart(CreateTimer(), time, false, function()
DestroyEffect(AddSpecialEffect( "Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl",x,y))
KillDestructable(block)
--print("элемент разрушен")
RemoveDestructable(block)
z=BlzGetLocalSpecialEffectZ(eff)
TimerStart(CreateTimer(), TIMER_PERIOD, true, function()
z=z-30
BlzSetSpecialEffectZ(eff,z)
if z<=zNormal-500 then
DestroyTimer(GetExpiredTimer())
DestroyEffect(eff)
BlzSetSpecialEffectPosition(eff,5000,5000,0)
end
end)
end)
end
end)
end
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by Bergi.
--- DateTime: 01.11.2020 20:48
---
do
TimerStart(CreateTimer(), 0.11, false, function()
InitGreenBoss()
end)
end
function InitGreenBoss()
local this = CreateTrigger()
TriggerRegisterEnterRectSimple(this, gg_rct_GreenBoss)
TriggerAddAction(this, function()
local hero=GetTriggerUnit()
if IsUnitType(hero,UNIT_TYPE_HERO) then
StartGreenRed(gg_rct_GreenBoss)
DisableTrigger(this)
end
end)
end
function StartGreenRed(zone)
local boss=FindUnitOfType(FourCC("u002"),1000,GetRectCenterX(zone),GetRectCenterY(zone))
BOSS=boss
UnitAddAbility(boss,FourCC("A00B"))
local spawn=true
StunUnit(boss,0.2)
--print("Гринбосс")
TimerStart(CreateTimer(), 1, true, function()
if StunSystem[GetHandleId(boss)].Time==0 then
if IsUnitInRange(boss,mainHero,1600) then
if spawn then
--local nx,ny=0,0
local angle=45
for i=1,8 do
local nx,ny=MoveXY(GetUnitX(boss),GetUnitY(boss),150,angle*i)
CreateUnit(GetOwningPlayer(boss),FourCC("osp1"),nx,ny,0)
-- print(i.." вардов")
end
end
spawn=false
IssuePointOrder(boss,"ward",GetUnitXY(mainHero))
--print("ward")
--osp1
else
spawn=true
end
end
if not UnitAlive(boss) then
DestroyTimer(GetExpiredTimer())
end
end)
end
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by Bergi.
--- DateTime: 01.11.2020 20:48
---
do
TimerStart(CreateTimer(), 0.11, false, function()
InitIceBoss()
end)
end
function InitIceBoss()
local this = CreateTrigger()
TriggerRegisterEnterRectSimple(this, gg_rct_IceBoss)
TriggerAddAction(this, function()
local hero=GetTriggerUnit()
if IsUnitType(hero,UNIT_TYPE_HERO) then
StartIceBoss(gg_rct_IceBoss)
DisableTrigger(this)
end
end)
end
function StartIceBoss(zone)
local boss=FindUnitOfType(FourCC("u001"),2000,GetRectCenterX(zone),GetRectCenterY(zone))
StunUnit(boss,0.2)
UnitAddAbility(boss,FourCC("A00C"))
--print("Ледяной босс")
TimerStart(CreateTimer(), 1, true, function()
if StunSystem[GetHandleId(boss)].Time==0 then
if OrderId2String(GetUnitCurrentOrder(boss))~="blizzard" then
IssuePointOrder(boss,"blizzard",GetUnitXY(boss))
end
end
if not UnitAlive(boss) then
DestroyTimer(GetExpiredTimer())
end
end)
end
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by Bergi.
--- DateTime: 01.11.2020 20:48
---
do
TimerStart(CreateTimer(), 0.11, false, function()
InitLBoss()
end)
end
function InitLBoss()
local this = CreateTrigger()
TriggerRegisterEnterRectSimple(this, gg_rct_LightFight)
TriggerAddAction(this, function()
local hero=GetTriggerUnit()
if hero==mainHero then
StartBossL(gg_rct_LightFight)
DisableTrigger(this)
end
end)
end
function StartBossL(zone)
local boss=FindUnitOfType(FourCC("u00D"),1000,GetRectCenterX(zone),GetRectCenterY(zone))
BOSS=boss
UnitAddType(boss,UNIT_TYPE_UNDEAD)
StunUnit(boss,0.2)
--print("Редбосс")
TimerStart(CreateTimer(), 6, true, function()
if IsUnitInRange(boss,mainHero,500) and StunSystem[GetHandleId(boss)].Time==0 and UnitAlive(boss) then
if UnitAlive(boss) then
--print("хочет хильнуть")
CreateHealWMark(boss)
end
end
if not UnitAlive(boss) then
DestroyTimer(GetExpiredTimer())
end
end)
end
--Abilities\Spells\Human\HolyBolt\HolyBoltSpecialArt.mdl
--Abilities\Spells\Human\Resurrect\ResurrectTarget.mdl
function CreateHealWMark(boss)
local e=nil
local x,y=GetUnitXY(boss)
local hp={}
local units={}
GroupEnumUnitsInRange(perebor,x,y,1000,nil)
while true do
e = FirstOfGroup(perebor)
if e == nil then break end
if UnitAlive(e) and IsUnitAlly(e,GetOwningPlayer(boss)) then
table.insert(hp,GetUnitLifePercent(e))
table.insert(units,e)
end
GroupRemoveUnit(perebor,e)
end
local key,min = 1,hp[1]--,
for k, v in ipairs(hp) do
if hp[k] < min then
key, min = k, v
end
end
--print(key, min)
local mark=AddSpecialEffect("Alarm",GetUnitXY(units[key]))
BlzSetSpecialEffectScale(mark,1)
local sec=2
TimerStart(CreateTimer(), TIMER_PERIOD, true, function()
BlzSetSpecialEffectPosition(mark,GetUnitX(units[key]),GetUnitY(units[key]),BlzGetUnitZ(units[key])+30)
sec=sec-TIMER_PERIOD
if sec<=0 then
DestroyTimer(GetExpiredTimer())
if StunSystem[GetHandleId(boss)].Time==0 and UnitAlive(boss) and UnitAlive(units[key]) then
HealUnit(units[key],150,nil,"Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt")
end
BlzSetSpecialEffectPosition(mark,5000,5000,0)
local is,hero=UnitDamageArea(boss,150,GetUnitX(units[key]),GetUnitY(units[key]),180)
if is then
DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt",GetUnitXY(hero)))
end
end
end)
end
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by Bergi.
--- DateTime: 10.11.2020 23:27
---
--"u00B
function RegisterNecroBossOLD() --этот блок был багованный и я его переписал
local gg_trg_RANGE = CreateTrigger()
local boss,k=FindUnitOfType(FourCC("u00B"))
BOSS=boss
--print("Некромант здесь")
TriggerRegisterUnitInRangeSimple(gg_trg_RANGE, 700, boss)
TriggerAddAction(gg_trg_RANGE, function()
local hero=GetTriggerUnit()
print("Запускаем некроманта")
print("Запускаем некроманта")
print("Запускаем некроманта")
print("Запускаем некроманта")
print("Запускаем некроманта")
print("Запускаем некроманта")
print("Запускаем некроманта")
print("Запускаем некроманта")
if hero==mainHero then
--print(GetUnitName())
StartNecromantGui(boss)
DisableTrigger(GetTriggeringTrigger())
end
end)
end
do
TimerStart(CreateTimer(), 3, false, function()
--RegisterNecroBoss()
InitBossZone3()
end)
end
function InitBossZone3()
local this = CreateTrigger()
TriggerRegisterEnterRectSimple(this, gg_rct_FieldSkeletons)
TriggerAddAction(this, function()
local hero=GetTriggerUnit()
if IsUnitType(hero,UNIT_TYPE_HERO) then
StartNecromantGui(gg_rct_FieldSkeletons)
DisableTrigger(this)
end
end)
end
function StartNecromantGui(zone)
local boss=FindUnitOfType(FourCC("u00B"))
SetUnitOwner(boss,Player(9),true)
BOSS=boss
local bar=HealthBarAdd(boss)
ClearMapMusicBJ()
PlayMusicBJ(gg_snd_Blood_omen_2__Battle_theme)
TimerStart(CreateTimer(), 2.5, true, function()
if IsUnitInRange(mainHero,boss,1200) and UnitAlive(mainHero) then
BlzFrameSetVisible(bar,true)
local tl=GetRandomLocInRect(gg_rct_FieldSkeletons)
local x,y=GetLocationX(tl),GetLocationY(tl)
local s=CreateGrave(boss,x,y)
local dmg=GetRandomInt(10,20)
--print(dmg)
--HealUnit(boss,-GetRandomInt(10,20))
RemoveLocation(tl)
--print(DistanceBetweenXY(GetUnitX(boss),GetUnitY(boss),GetUnitXY(mainHero)))
if not IsUnitInRange(mainHero,boss,850) and false then -- код отключен из за высокой сложности
--print("Too far")
local gold=CreateUnit(GetOwningPlayer(boss),FourCC("u00D"),x,y,GetRandomInt(0,360))
UnitApplyTimedLife(gold,FourCC('BTLF'),25)
UnitAddType(gold,UNIT_TYPE_UNDEAD)
StunUnit(gold,0.2)
--print("лайтбосс")
TimerStart(CreateTimer(), 6, true, function()
if IsUnitInRange(gold,mainHero,500) and StunSystem[GetHandleId(gold)].Time==0 and UnitAlive(gold) then
if UnitAlive(gold) then
-- print("хочет хильнуть")
CreateHealWMark(gold)
end
end
if not UnitAlive(gold) then
DestroyTimer(GetExpiredTimer())
end
end)
end
else
BlzFrameSetVisible(bar,false)
HealUnit(boss,200)
ClearMapMusicBJ()
PlayMusicBJ(gg_snd_Blood_omen_2__Battle_theme)
end
if not UnitAlive(mainHero) then
ClearAfterDead(gg_rct_FieldSkeletons)
ClearMapMusicBJ()
PlayMusicBJ(gg_snd_Blood_Omen__Legacy_of_Kain___Kain_s_Mausoleum)
end
if not UnitAlive(boss) then
DestroyTimer(GetExpiredTimer())
BlzFrameSetVisible(bar,false)
ClearMapMusicBJ()
PlayMusicBJ(gg_snd_All_Clear)
TimerStart(CreateTimer(), 20, false, function()
if not UnitAlive(BOSS) then
ClearMapMusicBJ()
PlayMusicBJ(gg_snd_Blood_Omen__Legacy_of_Kain___Kain_s_Mausoleum)
end
end)
end
end)
end
function ClearAfterDead(zone)
local e=nil
GroupEnumUnitsInRect(perebor,zone,nil)
while true do
e = FirstOfGroup(perebor)
if e == nil then break end
if UnitAlive(e) and e~=BOSS then
KillUnit(e)
end
GroupRemoveUnit(perebor,e)
end
end
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by Bergi.
--- DateTime: 10.11.2020 23:27
---
--"u00B
do
TimerStart(CreateTimer(), 0.2, false, function()
RegisterPeonBoss()
end)
end
function RegisterPeonBoss()
--[[local gg_trg_RANGE = CreateTrigger()
local boss,k=FindUnitOfType(FourCC("o002"))
BOSS=boss
--print(k)
TriggerRegisterUnitInRangeSimple(gg_trg_RANGE, 1000, boss)
TriggerAddAction(gg_trg_RANGE, function()
local hero=GetTriggerUnit()
--print("Запускаем некроманта")
if hero==mainHero then
--print(GetUnitName())
DisableTrigger(GetTriggeringTrigger())
--StartPEONAI(boss)
end
end)]]
--print("регистрация пеона")
local this = CreateTrigger()
TriggerRegisterEnterRectSimple(this, gg_rct_PeonPlace)
TriggerAddAction(this, function()
local hero=GetTriggerUnit()
if IsUnitType(hero,UNIT_TYPE_HERO) then
StartPEONAI()
DisableTrigger(this)
end
end)
end
bsx,bsy=0,0
PeonIsRed=false
function StartPEONAI()
local boss,err = FindUnitOfType(FourCC('o002'))
BOSS=boss
UnitRemoveAbility(boss,FourCC("Avul"))
--print("запускаем ИИ пеона")
if err==0 then
print('Пеон не найден, обратитесь к автору карты')
end
bsx,bsy=GetUnitXY(boss)
--BossDamaged(boss)
local BossFight=true
UnitAddAbility(boss,FourCC("A008"))
--UnitAddAbility(boss,FourCC("Avul"))
UnitAddType(boss,UNIT_TYPE_UNDEAD)
--print("Запущен ИИ Босса пеона")
local bar=HealthBarAdd(boss)
--local FW = CreateFogModifierRectBJ(false, Player(0), FOG_OF_WAR_VISIBLE, zone) --Рект босс
--FogModifierStart(FW)
ClearMapMusicBJ()
PlayMusicBJ(gg_snd_Rayman_Origins_Soundtrack___Ocean_World__Moray_Boss)
local phase = 5 --стартовая фаза
local sec = 0
local PhaseOn = true
local OnAttack=true
TimerStart(CreateTimer(), 1, true, function() --каждую секунду
local x, y = GetUnitXY(boss)
if not UnitAlive(boss) then-- Место где босс умер
DestroyTimer(GetExpiredTimer())
phase = 0
BlzFrameSetVisible(bar,false)
print("Bergios's boss is defeated, victory in 10 seconds")
TimerStart(CreateTimer(), 10, false, function()
CustomVictoryBJ(Player(0),true,true)
end)
ClearMapMusicBJ()
PlayMusicBJ(gg_snd_All_Clear)
TimerStart(CreateTimer(), 50, false, function()
if not UnitAlive(BOSS) then
ClearMapMusicBJ()
PlayMusicBJ(gg_snd_Blood_Omen__Legacy_of_Kain___Kain_s_Mausoleum)
end
end)
else --Проверяем есть ли живые герои, когда тиник жив
if BossFight then
if not IsUnitInRange(mainHero, boss, 2000) or not UnitAlive(mainHero) then
BossFight=false
phase=0
--DestroyFogModifier(FW)
--print("Герой мерт или далеко ушёл, остановка фаз")
CameraClearNoiseForPlayer(Player(0))
ClearMapMusicBJ()
PlayMusicBJ(gg_snd_Blood_Omen__Legacy_of_Kain___Kain_s_Mausoleum)
BlzFrameSetVisible(bar,false)
end
end
end
if BossFight then -- если идёт бой и каждую фазу
sec = sec + 1
if GetUnitLifePercent(boss)<=50 and not PeonIsRed then
boss=ReplaceUnitBJ(boss,FourCC("o005"),1) --0 3
UnitAddAbility(boss,FourCC("A008"))
UnitAddType(boss,UNIT_TYPE_UNDEAD)
BlzFrameSetVisible(bar,false)
bar=HealthBarAdd(boss)
PeonIsRed=true
--print("peon is red")
end
if sec >= 10 then
sec = 0
phase = phase + 1
PhaseOn = true
--print("phase " .. phase)
if phase >= 5 then --число фаз +1
phase = 0
end
end
--фазы
if phase == 1 and PhaseOn then
SetUnitPositionSmooth(boss,bsx,bsy)
PhaseOn = false
--print("Серия я ударов")
-- Удар в центр
PeonAttackCenter(boss)
TimerStart(CreateTimer(), 4, false, function()
PeonAttackLeft(boss)
end)
TimerStart(CreateTimer(), 7, false, function()
PeonAttackRight(boss,280)
end)
-- Удары справа налево
-- Замах слева на право
end
if phase == 2 and PhaseOn then
SetUnitPositionSmooth(boss,bsx,bsy)
UnitRemoveAbility(boss,FourCC("Avul"))
PhaseOn = false
local nx,ny=MoveXY(x,y,-1000,GetUnitFacing(boss))
CameraSetEQNoiseForPlayer(Player(0), 3)
--print("Призыв катапульт, стреляют навесом")
TimerStart(CreateTimer(), 2, false, function()
IssuePointOrder(boss,"move",nx,ny)
CameraClearNoiseForPlayer(Player(0))
local e=nil
local id=FourCC("ocat")
GroupEnumUnitsInRect(perebor,bj_mapInitialPlayableArea,nil)
while true do
e = FirstOfGroup(perebor)
if e == nil then break end
if UnitAlive(e) and GetUnitTypeId(e)==id then
SetUnitOwner(e,Player(PLAYER_NEUTRAL_PASSIVE),true)
AttackWMark(e)
RepeatAG(e)
end
GroupRemoveUnit(perebor,e)
end
TimerStart(CreateTimer(), 8, false, function()
GroupEnumUnitsInRect(perebor,bj_mapInitialPlayableArea,nil)
while true do
e = FirstOfGroup(perebor)
if e == nil then break end
if UnitAlive(e) and GetUnitTypeId(e)==id then
SetUnitOwner(e,Player(PLAYER_NEUTRAL_PASSIVE),true)
IssueImmediateOrder(e,"stop")
--IssuePointOrder(boss,"move",x,y)
SetUnitZ(boss,0)
end
GroupRemoveUnit(perebor,e)
end
end)
end)
end
if phase == 3 and PhaseOn then -- запуск волны
SetUnitPositionSmooth(boss,bsx,bsy)
PhaseOn = false
--CameraSetEQNoiseForPlayer(Player(0), 4)
--TriggerSleepAction(2.00)
--CameraClearNoiseForPlayer(Player(0))
--print("Пеон убегает, а потом прыгает на героя")
PeonJumpAndFall(boss)
end
if (phase == 4 or phase == 0) and PhaseOn then -- запуск волны
SetUnitPositionSmooth(boss,bsx,bsy)
PhaseOn = false
-- gg_rct_PeonPlace
for i=1,5 do
local nx,ny=GetLocationX(GetRandomLocInRect(gg_rct_PeonPlace)),GetLocationY(GetRandomLocInRect(gg_rct_PeonPlace))
local peon=CreateUnit(Player(PLAYER_NEUTRAL_AGGRESSIVE),FourCC("o004"),nx,ny,GetRandomInt(0,360))
IssueTargetOrder(peon,"attack",mainHero)
--print("peon")
end
TimerStart(CreateTimer(), 4, false, function()
PeonAttackRight(boss,300)
end)
--print("Серия атак создающая шипы")
end
if phase == 5 and PhaseOn then -- запуск волны
PhaseOn = false
--print("раскалывающий удар")
--PeonAttackCenter(boss)
Wall2Line(boss)
end
else-- перезапуск боссфайта
if IsUnitInRange(mainHero, boss, 1000) then
--print("перезапуск боссфайта")
--IssuePointOrder(boss,"move",GetRectCenterX(zone),GetRectCenterY(zone))
ClearMapMusicBJ()
PlayMusicBJ(gg_snd_Rayman_Origins_Soundtrack___Ocean_World__Moray_Boss)
BlzFrameSetVisible(bar,true)
--HealUnit(boss,500)
BossFight=true
end
end--конец
end)
end
function PeonAttackCenter(boss)
--print("Запомни этот поворот "..GetUnitFacing(boss))
SetUnitFacing(boss,278)
local x,y=GetUnitXY(boss)
x,y=MoveXY(x,y,500,GetUnitFacing(boss))
local mark=AddSpecialEffect("Alarm",x,y)
BlzSetSpecialEffectScale(mark,3)
SetUnitAnimationByIndex(boss,2)
TimerStart(CreateTimer(), 1, false, function()--первая задержка
local k=0
TimerStart(CreateTimer(), 0.5, true, function()
DestroyEffect(mark)
SetUnitAnimationByIndex(boss,2)
BlzSetSpecialEffectPosition(mark,5000,5000,0)
DestroyEffect(AddSpecialEffect("ThunderclapCasterClassic",x,y))
UnitDamageArea(boss,100,x,y,300)
k=k+1
if k>4 then
DestroyTimer(GetExpiredTimer())
ResetUnitAnimation(boss)
end
end)
end)
end
function PeonAttackLeft(boss)
BlzSetUnitFacingEx(boss,295)
local x,y=GetUnitXY(boss)
--x,y=MoveXY(x,y,500,GetUnitFacing(boss))
local mark=AddSpecialEffect("Alarm",x,y)
BlzSetSpecialEffectScale(mark,2)
SetUnitAnimationByIndex(boss,2)
local k=0
TimerStart(CreateTimer(), 0.35, true, function()
DestroyEffect(mark)
SetUnitFacing(boss,GetUnitFacing(boss)-10)
local nx,ny=MoveXY(x,y,500,GetUnitFacing(boss))
SetUnitAnimationByIndex(boss,3)
--BlzSetSpecialEffectPosition(mark,5000,5000,0)
DestroyEffect(AddSpecialEffect("ThunderclapCasterClassic",nx,ny))
UnitDamageArea(boss,100,nx,ny,200)
k=k+1
if k>7 then
DestroyTimer(GetExpiredTimer())
ResetUnitAnimation(boss)
end
end)
end
function PeonAttackRight(boss,range)
BlzSetUnitFacingEx(boss,278)
local x,y=GetUnitXY(boss)
-- x,y=MoveXY(x,y,500,GetUnitFacing(boss))
--local mark=AddSpecialEffect("Alarm",x,y)
BlzSetSpecialEffectScale(mark,2)
SetUnitAnimationByIndex(boss,13)
if not range then range=500 end
TimerStart(CreateTimer(), 2.5, false, function()
local k=0
local angle=230
TimerStart(CreateTimer(), 0.1, true, function()
-- print("Проводим топором "..k)
local nx,ny=MoveXY(x,y,range,angle)
angle=angle+17
--print(angle)
DestroyEffect(AddSpecialEffect("ThunderclapCasterClassic",nx,ny))
UnitDamageArea(boss,100,nx,ny,200)
k=k+1
if k>7 then
DestroyTimer(GetExpiredTimer())
ResetUnitAnimation(boss)
end
end)
end)
end
function AttackWMark(e)
local x,y=GetUnitXY(mainHero)
local nx,ny=MoveXY(x,y,GetRandomInt(0,500),GetRandomInt(0,360))
if not IssuePointOrderById(e,851984,nx,ny) then
-- print("каммон, такого приказа нет")
IssuePointOrderById(e,851984,nx,ny)
end
--print(GetUnitCurrentOrder(e))
local mark=AddSpecialEffect("Alarm",nx,ny)
BlzSetSpecialEffectZ(mark,BlzGetLocalSpecialEffectZ(mark)+50)
TimerStart(CreateTimer(), 0.9, false, function()
--print(GetUnitCurrentOrder(e))
IssueImmediateOrder(e,"stop")
end)
BlzSetSpecialEffectScale(mark,1)
TimerStart(CreateTimer(), 2.5, false, function()
if PeonIsRed then
local eff=AddSpecialEffect("Abilities\\Spells\\Human\\FlameStrike\\FlameStrike1.mdl",nx,ny)
UnitDamageArea(e,99,nx,ny,150)
end
DestroyEffect(mark)
BlzSetSpecialEffectPosition(mark,5000,5000,0)
end)
end
function RepeatAG(e)
local k=0
TimerStart(CreateTimer(), 3, true, function()
AttackWMark(e)
--print("Повтор таймер периода атаки катапульт ".. GetUnitName(e))
k=k+1
if k>3 then
DestroyTimer(GetExpiredTimer())
end
end)
end
function PeonJumpAndFall(boss)
SetUnitAnimation(boss,"death")
local sx,sy=GetUnitXY(boss)
local up=true
local down=true
local z=0
local h=4000
TimerStart(CreateTimer(), 2.1, false, function()
SetUnitTimeScale(boss,0)
local mark=AddSpecialEffect("Alarm",0,0)
local zMark=550
local dx,dy=0,0
BlzSetSpecialEffectScale(mark,4)
TimerStart(CreateTimer(), TIMER_PERIOD, true, function()
-- BlzSetSpecialEffectPosition(mark,GetUnitX(mainHero),GetUnitY(mainHero),zMark)
if GetUnitZ(boss)<=h and up then
SetUnitZ(boss,GetUnitZ(boss)+60)
else
if down then
--print("Пора опускаться "..GetUnitZ(boss))
up=false
z=GetUnitZ(boss)
down=false
end
end
if not up then
if z>=0 then
if z>1000 then
local bx,by=MoveXY(GetUnitX(mainHero),GetUnitY(mainHero),400,GetUnitFacing(boss)-180)
SetUnitPosition(boss,bx,by)
BlzSetSpecialEffectPosition(mark,GetUnitX(mainHero),GetUnitY(mainHero),zMark)
dx,dy=bx,by
else
if mark then
end
end
if z>=500 then
--print("опускаем юнита "..GetUnitZ(boss))
SetUnitZ(boss,GetUnitZ(boss)-30)
end
z=z-30
end
if z<=495 then
-- print("опустился")
CameraSetEQNoiseForPlayer(Player(0), 3)
local bx,by=MoveXY(GetUnitX(boss),GetUnitY(boss),400,GetUnitFacing(boss)-180)
DestroyEffect(AddSpecialEffect("ThunderclapCasterClassic",bx,by))
UnitDamageArea(boss,100,dx,dy,500)
DestroyTimer(GetExpiredTimer())
DestroyEffect(mark)
BlzSetSpecialEffectPosition(mark,5000,5000,0)
TimerStart(CreateTimer(), 5, false, function()
CameraClearNoiseForPlayer(Player(0))
SetUnitTimeScale(boss,1)
ResetUnitAnimation(boss)
SetUnitPosition(boss,sx,sy)
end)
end
end
end)
end)
end
function Wall2Line(boss)
local sec=10
local k=1-GetUnitLifePercent(boss)/100
local p=0.1
--print(k)
local x,y=GetUnitXY(boss)
local angle=AngleBetweenXY(x,y,GetUnitXY(mainHero))/bj_DEGTORAD
TimerStart(CreateTimer(),p,true, function()
--angle=GetUnitFacing(boss)
x,y=MoveXY(x,y,80,angle)
CreateWallElement(x,y,10,boss)
sec=sec-p
if sec<=0 then
DestroyTimer(GetExpiredTimer())
end
end)
end
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by Bergi.
--- DateTime: 01.11.2020 20:48
---
do
TimerStart(CreateTimer(), 0.11, false, function()
InitBossRed()
end)
end
function InitBossRed()
local this = CreateTrigger()
TriggerRegisterEnterRectSimple(this, gg_rct_RedBossKey)
TriggerAddAction(this, function()
local hero=GetTriggerUnit()
if IsUnitType(hero,UNIT_TYPE_HERO) then
StartBossRed(gg_rct_RedBossKey)
DisableTrigger(this)
end
end)
end
function StartBossRed(zone)
local boss=FindUnitOfType(FourCC("u000"),1000,GetRectCenterX(zone),GetRectCenterY(zone))
UnitAddType(boss,UNIT_TYPE_UNDEAD)
StunUnit(boss,0.2)
--print("Редбосс")
TimerStart(CreateTimer(), 5, true, function()
if IsUnitInRange(boss,mainHero,500) and StunSystem[GetHandleId(boss)].Time==0 and UnitAlive(boss) then
CreateMeteorMark(boss,GetUnitXY(mainHero))
end
if not UnitAlive(boss) then
DestroyTimer(GetExpiredTimer())
end
end)
end
function CreateMeteorMark(boss,x,y)
local mark=AddSpecialEffect("Snipe Target",x,y)
BlzSetSpecialEffectScale(mark,5)
TimerStart(CreateTimer(), 2, false, function()
DestroyEffect(mark)
BlzSetSpecialEffectPosition(mark,5000,5000,0)
local eff=AddSpecialEffect("Abilities\\Spells\\Demon\\RainOfFire\\RainOfFireTarget.mdl",x,y)
TimerStart(CreateTimer(), 1, false, function()
--print("Упал?")
UnitDamageArea(boss,50,x,y,150)
end)
end)
--"Abilities\\Spells\\Demon\\RainOfFire\\RainOfFireTarget.mdl"
end
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by Bergi.
--- DateTime: 18.10.2020 19:39
---
---
portrait="war3mapImported\\avatar_alive.blp"
portraitVampire="war3mapImported\\avatar_kain.blp"
bagT="war3mapImported\\bag.dds"
empBar="war3mapImported\\VbarEMP.dds"
mainHero=nil --Переменная назначается автоматически при выборе героя
do
TimerStart(CreateTimer(), .1, false, function()
--HideEverything()
-- BlzFrameSetVisible(BlzGetFrameByName("ConsoleUIBackdrop", 0), false) -- черна рамка
BlzFrameSetAbsPoint ( BlzGetFrameByName ( "ConsoleUIBackdrop" , 0 ) , FRAMEPOINT_TOPRIGHT , 0 , - 0,8 )
BlzHideOriginFrames(true)
BlzEnableUIAutoPosition ( false )
local GAME_UI = BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0)
local WORLD_FRAME = BlzGetOriginFrame(ORIGIN_FRAME_WORLD_FRAME, 0)
BlzFrameSetAllPoints(WORLD_FRAME, GAME_UI)
BlzFrameSetAlpha(BlzGetFrameByName("SimpleInventoryCover", 0), 0) --скрыть заглушку отсутсвия инвентаря
BlzFrameSetAbsPoint(BlzGetFrameByName("SimpleInventoryCover", 0),FRAMEPOINT_BOTTOM,-1000,-1000)
BlzFrameSetVisible(BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT, 0), false)
BlzFrameSetSize(BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT, 0), 0, 0)
BlzFrameSetAbsPoint(BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT, 0),FRAMEPOINT_BOTTOM,-1000,-1000)
BlzFrameClearAllPoints(BlzGetOriginFrame(ORIGIN_FRAME_UBERTOOLTIP, 0)) -- ПОдсказка при наведении на дефолт фреймы
BlzFrameSetPoint(BlzGetOriginFrame(ORIGIN_FRAME_UBERTOOLTIP, 0), FRAMEPOINT_BOTTOM, BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), FRAMEPOINT_BOTTOM, 0, 0.08)
for i = 0,11 do --отвязка всех кнопок
--print("очистка.. "..i)
BlzFrameClearAllPoints(BlzGetFrameByName("CommandButton_"..i, 0))
BlzFrameSetAbsPoint(BlzGetFrameByName("CommandButton_"..i, 0),FRAMEPOINT_CENTER,1,1)
--
end
CreateQWERDFG()
--ShowInventory()
MenuFrame()
ShowFPSPINGAPM()
CreatePortrait()
--CreateBars()
InitSelectionRegister()
CreateInfoFrames()
--RepositionMSG()
end)
end
function HideEverything()
--BlzFrameSetVisible(BlzGetFrameByName("ConsoleUIBackdrop", 0), false)
for i = 0, 11 do
--BlzFrameSetVisible(BlzGetFrameByName("CommandButton_"..i, 0), false) --отключить
-- BlzFrameSetSize(BlzGetFrameByName("CommandButton_" .. i, 0), 0, 0)--скрыть, но работать будут по хоткеям
end
BlzHideOriginFrames(true)--скрыть всё
end
function ShowInventory()
local next=0.039/1.3
local step=(next*6)+next/2
BlzFrameSetVisible(BlzFrameGetParent(BlzGetOriginFrame(ORIGIN_FRAME_ITEM_BUTTON, 0)), true)
BlzFrameSetAlpha(BlzGetFrameByName("SimpleInventoryCover", 0), 0)
local infoPanel=BlzFrameGetParent(BlzGetFrameByName("SimpleInfoPanelUnitDetail",0)) -- панель стат героя
BlzFrameClearAllPoints(infoPanel)
BlzFrameSetVisible(infoPanel,true)
BlzFrameSetAbsPoint(infoPanel, FRAMEPOINT_CENTER, 0,9) --0,9 чтобы полностью убрать
local bugFrames=BlzCreateFrameByType('BACKDROP', 'FaceButtonIcon', BlzGetOriginFrame(ORIGIN_FRAME_WORLD_FRAME, 0), '', 0)
for i = 0, 5 do
local item = BlzGetOriginFrame(ORIGIN_FRAME_ITEM_BUTTON, i)
BlzFrameSetVisible(item, true)
BlzFrameClearAllPoints(item)
BlzFrameSetSize(item, next, next)
BlzFrameSetAbsPoint(item,FRAMEPOINT_BOTTOM,0.31+next/2+(next*i),0.04)
local bag = BlzCreateFrameByType('BACKDROP', 'FaceButtonIcon', bugFrames, '', 0)
BlzFrameSetParent(bag, BlzGetFrameByName("ConsoleUIBackdrop", 0))
BlzFrameSetTexture(bag, bagT, 0, true)
BlzFrameSetSize(bag, next*1.1, next*1.1)
BlzFrameSetAbsPoint(bag,FRAMEPOINT_BOTTOM,0.31+next/2+(next*i),0.04)
end
TimerStart(CreateTimer(), .1, true, function()
if mainHero then
if IsUnitType(mainHero,UNIT_TYPE_HERO) then
BlzFrameSetVisible(bugFrames,true)
else
BlzFrameSetVisible(bugFrames,false)
end
end
end)
end
function MenuFrame()
BlzFrameSetVisible(BlzGetFrameByName("UpperButtonBarFrame",0),true)
for i=0,3 do
--local i=0
local f10=BlzGetOriginFrame(ORIGIN_FRAME_SYSTEM_BUTTON, i)
if i==0 then
BlzFrameSetParent(f10, BlzGetFrameByName("ConsoleUIBackdrop", 0))
BlzFrameSetVisible(f10, true)
BlzFrameClearAllPoints(f10)
BlzFrameSetAbsPoint(f10, FRAMEPOINT_CENTER, 0.65+(0.08*2) ,0.59)
elseif i==1 then
BlzFrameSetVisible(f10, false)
elseif i==2 then
BlzFrameSetParent(f10, BlzGetFrameByName("ConsoleUIBackdrop", 0))
BlzFrameSetVisible(f10, true)
BlzFrameClearAllPoints(f10)
BlzFrameSetAbsPoint(f10, FRAMEPOINT_CENTER, 0.65+(0.08*1) ,0.59)
elseif i==3 then
BlzFrameSetParent(f10, BlzGetFrameByName("ConsoleUIBackdrop", 0))
BlzFrameSetVisible(f10, true)
BlzFrameClearAllPoints(f10)
BlzFrameSetAbsPoint(f10, FRAMEPOINT_CENTER, 0.65+(0.08*i) ,0.59)
end
end
end
function CreateQWERDFG()
local next=0.039
local last=0
for i=8,11 do --QWER
if i>=9 then
BlzFrameSetAbsPoint(BlzGetFrameByName("CommandButton_"..i, 0), FRAMEPOINT_CENTER, -next+0.07-next*2+next*i ,next/2)
else
BlzFrameSetAbsPoint(BlzGetFrameByName("CommandButton_"..i, 0), FRAMEPOINT_CENTER, -next+0.07-next+next*i ,next/2)
end
last=0.07-next+next*i
end
for i=4,7 do --FGTH
BlzFrameSetAbsPoint(BlzGetFrameByName("CommandButton_"..i, 0), FRAMEPOINT_CENTER, -next+last-next*4+next*i ,next/2)
end
--BlzFrameSetAbsPoint(BlzGetFrameByName("CommandButton_"..0, 0), FRAMEPOINT_CENTER, 0.4 ,next*1,5) --центровка
end
function ShowFPSPINGAPM()
BlzFrameSetVisible(BlzGetFrameByName("ResourceBarFrame",0),true)
local fps=BlzGetFrameByName("ResourceBarFrame",0)
BlzFrameClearAllPoints(fps)
BlzFrameSetAbsPoint(fps, FRAMEPOINT_CENTER, 0.87 ,0.62)
end
function CreatePortrait()
local buttonIconFrame = BlzCreateFrameByType('BACKDROP', 'FaceButtonIcon', BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), '', 0)
BlzFrameSetParent(buttonIconFrame, BlzGetFrameByName("ConsoleUIBackdrop", 0))
BlzFrameSetTexture(buttonIconFrame, portrait, 0, true)
BlzFrameSetSize(buttonIconFrame, 0.085, 0.16)
BlzFrameSetAbsPoint(buttonIconFrame, FRAMEPOINT_CENTER, -0.08, 0.49)
TimerStart(CreateTimer(), 0.05, true, function()
if mainHero then
if GetUnitTypeId(mainHero)~=FourCC("H000") then
--print("Портрет изменён на вампирский")
BlzFrameSetTexture(buttonIconFrame, portraitVampire, 0, true)
DestroyTimer(GetExpiredTimer())
end
end
end)
end
function CreateBars(hero,index)
local nextBar=0.02
local x,y=-0.02+index*nextBar, 0.49
local into = BlzCreateFrameByType('BACKDROP', 'FaceButtonIcon', BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), '', 0)
BlzFrameSetParent(into, BlzGetFrameByName("ConsoleUIBackdrop", 0))
BlzFrameSetTexture(into, "Replaceabletextures\\Teamcolor\\Teamcolor0"..index..".blp", 0, true)
BlzFrameSetSize(into, 0.0195, 0)
BlzFrameSetAbsPoint(into, FRAMEPOINT_BOTTOM,x,y-0.075)
local buttonIconFrame = BlzCreateFrameByType('BACKDROP', 'FaceButtonIcon', BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), '', 0)
BlzFrameSetParent(buttonIconFrame, BlzGetFrameByName("ConsoleUIBackdrop", 0))
BlzFrameSetTexture(buttonIconFrame, empBar, 0, true)
BlzFrameSetSize(buttonIconFrame, 0.02, 0.16)
BlzFrameSetAbsPoint(buttonIconFrame, FRAMEPOINT_CENTER,x,y)
local textMax = BlzCreateFrameByType("TEXT", "ButtonChargesText", buttonIconFrame, "", 0)
BlzFrameSetPoint(textMax, FRAMEPOINT_BOTTOM, buttonIconFrame, FRAMEPOINT_BOTTOM, 0.,0.01)
BlzFrameSetText(textMax, "100")
local textCurrent = BlzCreateFrameByType("TEXT", "ButtonChargesText", buttonIconFrame, "", 0)
BlzFrameSetPoint(textCurrent, FRAMEPOINT_TOP, buttonIconFrame, FRAMEPOINT_TOP, 0.,-0.01)
BlzFrameSetText(textCurrent, "100")
local per1=0.16/100
local sec=0
TimerStart(CreateTimer(), 0.05, true, function()
--print(per1)
sec=sec+per1
--print(sec)
if sec>=0.15 then
DestroyTimer(GetExpiredTimer())
TimerStart(CreateTimer(), 0.05, true, function()
local hp=0
if index==0 then
hp=GetUnitLifePercent(mainHero)
BlzFrameSetText(textCurrent, R2I(GetUnitState(mainHero,UNIT_STATE_LIFE)))
BlzFrameSetText(textMax, R2I(BlzGetUnitMaxHP(mainHero)))
else
hp=GetUnitManaPercent(mainHero)
BlzFrameSetText(textCurrent, R2I(GetUnitState(mainHero,UNIT_STATE_MANA)))
BlzFrameSetText(textMax, R2I(BlzGetUnitMaxMana(mainHero)))
end
BlzFrameSetSize(into, 0.0195, hp*0.15/100)
end)
end
BlzFrameSetSize(into, 0.0195, sec)
--BlzFrameSetAbsPoint(into, FRAMEPOINT_CENTER,x,y-(0.16+sec))
end)
end
function InitSelectionRegister()
local this = CreateTrigger()
for i = 0, bj_MAX_PLAYER_SLOTS - 1 do
TriggerRegisterPlayerUnitEvent(this, Player(i), EVENT_PLAYER_UNIT_SELECTED, nil)
end
TriggerAddAction(this, function()
local hero=GetTriggerUnit()
--print(GetUnitName(hero))
if IsUnitType(hero,UNIT_TYPE_HERO) then
if GetOwningPlayer(hero)==GetTriggerPlayer() then
if not mainHero then
--print("Определён первый герой для игрока")
StunUnit(hero,0.2)
mainHero=hero
InitCry()
InitWASD(mainHero)
--print("initwasd")
ShowInventory()
CreateBars(hero,0)
CreateBars(hero,1)
--InitWASD(mainHero)
end
end
end
end)
end
function RepositionMSG()
local frame=BlzGetOriginFrame(ORIGIN_FRAME_UNIT_MSG, 0)
BlzFrameClearAllPoints(frame)
BlzFrameSetParent(frame, BlzGetFrameByName("ConsoleUIBackdrop", 0))
BlzFrameSetAbsPoint(frame,FRAMEPOINT_TOPLEFT,0.0,0.7) -- fatal upper > 0.4
end
function CreateInfoFrames()
local scale=0.039/2
local x,y=-0.10,0.395
CreateEmptyGlue("ReplaceableTextures\\CommandButtons\\BTNThoriumMelee.blp",scale,x+scale*0,y,1)-- Атака
CreateEmptyGlue("ReplaceableTextures\\CommandButtons\\BTNHumanArmorUpTwo.blp",scale,x+scale*2.2,y,2)-- Броня
CreateEmptyGlue("ReplaceableTextures\\CommandButtons\\BTNAnkh.blp",scale,x+scale*4.4,y,3)-- жизни
end
function CreateEmptyGlue(texture,scale,posX,posY,flag)
local SelfFrame = BlzCreateFrameByType('GLUEBUTTON', 'FaceButton', BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), 'ScoreScreenTabButtonTemplate', 0)
local buttonIconFrame = BlzCreateFrameByType('BACKDROP', 'FaceButtonIcon', SelfFrame, '', 0)
BlzFrameSetParent(SelfFrame, BlzGetFrameByName("ConsoleUIBackdrop", 0))
BlzFrameSetParent(buttonIconFrame, BlzGetFrameByName("ConsoleUIBackdrop", 0))
BlzFrameSetAllPoints(buttonIconFrame, SelfFrame)
BlzFrameSetTexture(buttonIconFrame, texture, 0, true)
BlzFrameSetSize(SelfFrame, scale, scale)
BlzFrameSetAbsPoint(SelfFrame, FRAMEPOINT_CENTER, posX, posY)
local textCurrent = BlzCreateFrameByType("TEXT", "ButtonChargesText", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), "", 0)
BlzFrameSetAbsPoint(textCurrent, FRAMEPOINT_LEFT, posX+scale/2,posY) --posX+scale
BlzFrameSetScale(textCurrent,1)
BlzFrameSetParent(textCurrent, BlzGetFrameByName("ConsoleUIBackdrop", 0))
BlzFrameSetText(textCurrent, "unknown")
TimerStart(CreateTimer(), 0.05, true, function()
if flag==1 then
--print("обновление текста")
local damage=0
if UnitHasItemOfTypeBJ(mainHero,FourCC('I005')) then
damage=damage+15
end
BlzFrameSetText(textCurrent, " "..R2I(damage+BlzGetUnitBaseDamage(mainHero,0)))
elseif flag==2 then
BlzFrameSetText(textCurrent, " "..R2I(BlzGetUnitArmor(mainHero)))
elseif flag==3 then
BlzFrameSetText(textCurrent, " "..GetPlayerState(Player(0),PLAYER_STATE_RESOURCE_LUMBER))
end
end)
return SelfFrame
end
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by Bergi.
--- DateTime: 28.10.2020 22:45
---
do
TimerStart(CreateTimer(), 0.11, false, function()
InitPUI()
end)
end
secToHideItem=0
function InitPUI()
local k=1
local BDShowItems={}
frameINFO,textINFO=CreateInfoItemBOX()
local this = CreateTrigger()
TriggerRegisterAnyUnitEventBJ(this, EVENT_PLAYER_UNIT_PICKUP_ITEM)
TriggerAddAction(this, function()
local item=GetManipulatedItem()
ItemGlobalInfo(item)
end)
end
function CreateInfoItemBOX()
local x,y=0.45,0.15
local buttonIconFrame = BlzCreateFrameByType('BACKDROP', 'FaceButtonIcon', BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), '', 0)
BlzFrameSetTexture(buttonIconFrame, "texture", 0, true)
BlzFrameSetSize(buttonIconFrame, 0.039/2, 0.039/2)
BlzFrameSetAbsPoint(buttonIconFrame, FRAMEPOINT_LEFT, x, y)
local textCurrent = BlzCreateFrameByType("TEXT", "ButtonChargesText", buttonIconFrame, "", 0)
BlzFrameSetAbsPoint(textCurrent, FRAMEPOINT_LEFT, x-0.21, y)
BlzFrameSetScale(textCurrent,2)
BlzFrameSetText(textCurrent, "You acquired new item: ")
BlzFrameSetVisible(buttonIconFrame,false)
return buttonIconFrame,textCurrent
end
function ItemInBD(table,id)
local has=false
for i=1,#table do
if table[i]==id then
has=true
end
end
return has
end
function ItemGlobalInfo(item,flag)
--[[
if not ItemInBD(BDShowItems,GetItemTypeId(item)) then
table.insert(BDShowItems,GetItemTypeId(item))
--print("пердмет показан первый раз")
else
--print("последующий")
--return
end]]
local frame,text=frameINFO,textINFO
if GetItemTypeId(item)~=FourCC("I004") and GetItemTypeId(item)~=FourCC("I00A") and GetItemTypeId(item)~=FourCC("I00B")then --Список исключений предметов
BlzFrameSetVisible(frame,true)
BlzFrameSetTexture(frame,BlzGetItemIconPath(item),0,true)
BlzFrameSetAlpha(frame,255)
BlzFrameSetText(text, "You acquired new item: |cffffcc00"..GetItemName(item).."|r")
StartSound(bj_questHintSound)
if flag==1 then
BlzFrameSetText(text, "You used item: |cffffcc00"..GetItemName(item).."|r")
end
--|cffffcc001-й уровень:|r
local p=1/64
secToHideItem=secToHideItem+6
TimerStart(CreateTimer(), p, true, function()
secToHideItem=secToHideItem-p
if secToHideItem<=0 then
DestroyTimer(GetExpiredTimer())
BlzFrameSetVisible(frame,false)
end
if secToHideItem<=2.5 then
BlzFrameSetAlpha(frame,R2I(secToHideItem*100))
end
end)
end
end
--ItemGlobalInfo(GetManipulatedItem(),1)
--CUSTOM_CODE
Name | Type | is_array | initial_value |
ActiveGrave | unit | No | |
ActiveTrader | unit | No | |
Cat | integer | No | |
FinalDialog | dialog | No | |
IntLightCheck | integer | No | |
IsRatBlocked | boolean | No | |
KeyBlue | item | No | |
KeyGreen | item | No | |
KeyRed | item | No | |
mainHero | unit | No | |
QuestIntro | quest | No | |
RainWeather | weathereffect | No | |
Random | integer | No | |
RevivePoint | rect | No | |
Skulls | integer | No | |
tmpitem | item | No | |
xWizard | integer | No | |
Yes | button | No |