88-- TODO
99---- ------------------------------------------------------------------------------------------------
1010local Apollo = require " Apollo"
11+ local ApolloTimer = require " ApolloTimer"
1112local GameLib = require " GameLib"
1213local Vector3 = require " Vector3"
1314
@@ -25,7 +26,7 @@ mod:RegisterEnglishLocale({
2526 [" unit.phantom" ] = " Phantom" ,
2627 [" unit.essence" ] = " Essence Void" ,
2728 [" unit.tortued_apparition" ] = " Tortured Apparition" ,
28- [" unit.orb " ] = " Soul Eater" ,
29+ [" unit.soul_eater " ] = " Soul Eater" ,
2930 [" unit.boneclaw" ] = " Risen Boneclaw" ,
3031 [" unit.titan" ] = " Risen Titan" ,
3132 [" unit.lost_soul" ] = " Lost Soul" ,
@@ -186,6 +187,10 @@ local TIMERS = {
186187 }
187188}
188189
190+ local IND_REASONS = {
191+ SOUL_EATER_CAUGHT = 1 ,
192+ }
193+
189194local ROOM_CENTER = Vector3 .New (- 723.717773 , 186.834915 , - 265.187195 )
190195
191196local CARDINAL_MARKERS = {
@@ -217,6 +222,8 @@ local soulEatersActive
217222local lastSoulfireName
218223local orbitColor
219224local drawOrbitTimer
225+ local currentSoulEater
226+ local soulEaters
220227local boneclawsOnYou
221228local boneclawCheckDeadTimer = ApolloTimer .Create (1.0 , true , " RemoveBoneclawLines" , mod )
222229boneclawCheckDeadTimer :Stop ()
@@ -225,10 +232,12 @@ boneclawCheckDeadTimer:Stop()
225232---- ------------------------------------------------------------------------------------------------
226233function mod :OnBossEnable ()
227234 essenceNumber = 0
235+ currentSoulEater = 6
228236 isDeadRealm = false
229237 isMidphase = false
230238 expulsionInThisRealm = false
231239 lastSpiritOfSoulfireStack = 0
240+ soulEaters = {}
232241 essences = {}
233242 boneclawsOnYou = {}
234243 player = {}
@@ -448,13 +457,42 @@ function mod:OnEssenceSurgeStart(id)
448457 end
449458end
450459
451- function mod :OnSoulEaterCreated ()
460+ function mod :OnSoulEaterCreated (id , unit , name )
461+ soulEaters [id ] = {
462+ id = id ,
463+ index = currentSoulEater ,
464+ unit = unit
465+ }
466+
467+ currentSoulEater = currentSoulEater - 1
468+ if currentSoulEater == 0 then
469+ currentSoulEater = 6
470+ end
471+
452472 if not soulEatersActive then
453473 soulEatersActive = true
454474 mod :DrawSoulEaterOrbits ()
455475 end
456476end
457477
478+ function mod :OnSoulEaterDestroyed (id , unit , name )
479+ soulEaters [id ] = nil
480+ end
481+
482+ function mod :OnSoulEaterCaught (id , spellId , stacks , timeRemaining , name , unitCaster )
483+ if unitCaster and unitCaster :IsValid () then
484+ local index = soulEaters [unitCaster :GetId ()].index
485+ mod :RemoveSoulEaterOrbit (index )
486+ mod :SendIndMessage (IND_REASONS .SOUL_EATER_CAUGHT , index )
487+ end
488+ end
489+
490+ function mod :ReceiveIndMessage (from , reason , data )
491+ if reason == IND_REASONS .SOUL_EATER_CAUGHT then
492+ mod :RemoveSoulEaterOrbit (data )
493+ end
494+ end
495+
458496function mod :OnDevourSoulsStop ()
459497 soulEatersActive = false
460498 mod :RemoveSoulEaterOrbits ()
@@ -463,20 +501,20 @@ end
463501
464502function mod :DrawSoulEaterOrbits ()
465503 for i = 1 , # SOUL_EATER_ORBITS do
466- mod :DrawSoulEaterOrbit (i , i )
504+ mod :DrawSoulEaterOrbit (i )
467505 end
468506end
469507
470- function mod :DrawSoulEaterOrbit (id , index )
508+ function mod :DrawSoulEaterOrbit (index )
471509 local radius = SOUL_EATER_ORBITS [index ]
472- if math .mod (id , 2 ) == 0 then
510+ if math .mod (index , 2 ) == 0 then
473511 orbitColor = " xkcdWhite"
474512 else
475513 orbitColor = " xkcdRed"
476514 end
477- core :AddPolygon (" ORBIT_" .. id , ROOM_CENTER , radius .z , nil , 2 , orbitColor , 40 )
478- mod :SetWorldMarker (" ORBIT_" .. id .. " up" , id , ROOM_CENTER + radius )
479- mod :SetWorldMarker (" ORBIT_" .. id .. " down" , id , ROOM_CENTER - radius )
515+ core :AddPolygon (" ORBIT_" .. index , ROOM_CENTER , radius .z , nil , 2 , orbitColor , 40 )
516+ mod :SetWorldMarker (" ORBIT_" .. index .. " up" , index , ROOM_CENTER + radius )
517+ mod :SetWorldMarker (" ORBIT_" .. index .. " down" , index , ROOM_CENTER - radius )
480518end
481519
482520function mod :RemoveSoulEaterOrbits ()
@@ -485,10 +523,10 @@ function mod:RemoveSoulEaterOrbits()
485523 end
486524end
487525
488- function mod :RemoveSoulEaterOrbit (id )
489- core :RemovePolygon (" ORBIT_" .. id )
490- mod :DropWorldMarker (" ORBIT_" .. id .. " up" )
491- mod :DropWorldMarker (" ORBIT_" .. id .. " down" )
526+ function mod :RemoveSoulEaterOrbit (index )
527+ core :RemovePolygon (" ORBIT_" .. index )
528+ mod :DropWorldMarker (" ORBIT_" .. index .. " up" )
529+ mod :DropWorldMarker (" ORBIT_" .. index .. " down" )
492530end
493531
494532function mod :OnMidphaseStart ()
@@ -590,21 +628,19 @@ mod:RegisterUnitEvents("unit.essence",{
590628 },
591629 }
592630)
593-
594631mod :RegisterUnitEvents (" unit.titan" ,{
595632 [core .E .UNIT_CREATED ] = mod .OnTitanCreated ,
596633 }
597634)
598-
599635mod :RegisterUnitEvents (" unit.lost_soul" ,{
600636 [core .E .UNIT_CREATED ] = mod .OnLostSoulCreated ,
601- })
602-
603- mod :RegisterUnitEvents (" unit.orb " ,{
637+ }
638+ )
639+ mod :RegisterUnitEvents (" unit.soul_eater " ,{
604640 [core .E .UNIT_CREATED ] = mod .OnSoulEaterCreated ,
641+ [core .E .UNIT_DESTROYED ] = mod .OnSoulEaterDestroyed ,
605642 }
606643)
607-
608644mod :RegisterUnitEvents (" unit.laveka" ,{
609645 [core .E .UNIT_CREATED ] = mod .OnLavekaCreated ,
610646 [core .E .HEALTH_CHANGED ] = mod .OnLavekaHealthChanged ,
@@ -634,14 +670,16 @@ mod:RegisterUnitEvents("unit.boneclaw",{
634670 [core .E .UNIT_DESTROYED ] = mod .OnBoneclawDestroyed ,
635671 }
636672)
637-
638673mod :RegisterUnitEvents (core .E .ALL_UNITS ,{
639674 [core .E .UNIT_CREATED ] = mod .OnAnyUnitCreated ,
640675 [core .E .UNIT_DESTROYED ] = mod .OnAnyUnitDestroyed ,
641676 [DEBUFFS .SOULFIRE ] = {
642677 [core .E .DEBUFF_ADD ] = mod .OnSoulfireAdd ,
643678 [core .E .DEBUFF_REMOVE ] = mod .OnSoulfireRemove ,
644679 },
680+ [DEBUFFS .SOUL_EATER ] = {
681+ [core .E .DEBUFF_ADD ] = mod .OnSoulEaterCaught ,
682+ },
645683 [DEBUFFS .EXPULSION_OF_SOULS ] = {
646684 [core .E .DEBUFF_ADD ] = mod .OnExpulsionAdd ,
647685 },
0 commit comments