forked from WoWAnalyzer/WoWAnalyzer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement prepull normalizer for living flame to handle specific scen…
…ario
- Loading branch information
Showing
2 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
src/analysis/retail/evoker/devastation/modules/normalizers/LivingFlamePrePullNormalizer.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import SPELLS from 'common/SPELLS/evoker'; | ||
import { AnyEvent, BeginCastEvent, EventType, HasRelatedEvent } from 'parser/core/Events'; | ||
import EventsNormalizer from 'parser/core/EventsNormalizer'; | ||
import { BURNOUT_CONSUME } from './CastLinkNormalizer'; | ||
import Haste from 'parser/shared/modules/Haste'; | ||
|
||
/** | ||
* Living flame is the most commonly pre-pull casted spell for Devastation | ||
* however it often occurs that you'll start channeling it pre-pull and only | ||
* the cast success event (PrePullNormalizer doesn't account for this since we don't have a way to define instant cast spells) | ||
* will trigger, this messes with how we handle GCDs and makes for a messy timeline. | ||
* | ||
* This normalizer aims to correct those situation | ||
*/ | ||
class LivingFlamePrePullNormalizer extends EventsNormalizer { | ||
static dependencies = { | ||
...EventsNormalizer.dependencies, | ||
haste: Haste, | ||
}; | ||
protected haste!: Haste; | ||
normalize(events: AnyEvent[]) { | ||
const fixedEvents: AnyEvent[] = []; | ||
let lastBeginCastEvent: BeginCastEvent | undefined; | ||
|
||
events.forEach((event) => { | ||
if (!lastBeginCastEvent) { | ||
if ( | ||
event.type === EventType.BeginCast && | ||
event.ability.guid === SPELLS.LIVING_FLAME_CAST.id | ||
) { | ||
lastBeginCastEvent = event; | ||
} | ||
|
||
if ( | ||
event.type === EventType.Cast && | ||
event.ability.guid === SPELLS.LIVING_FLAME_CAST.id && | ||
!HasRelatedEvent(event, BURNOUT_CONSUME) | ||
) { | ||
fixedEvents.push({ | ||
...event, | ||
// Try to get the proper GCD time | ||
timestamp: event.timestamp - 1500 / (1 + this.haste.current), | ||
__modified: true, | ||
prepull: true, | ||
}); | ||
return; | ||
} | ||
} | ||
fixedEvents.push(event); | ||
}); | ||
return fixedEvents; | ||
} | ||
} | ||
export default LivingFlamePrePullNormalizer; |