Skip to content

Commit

Permalink
fix crash in celestial conduit when player didnt cast unity within
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorm4 committed Sep 24, 2024
1 parent 73e5d86 commit 6fe892e
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 24 deletions.
1 change: 1 addition & 0 deletions src/analysis/retail/monk/mistweaver/CHANGELOG.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Trevor, Vohrr } from 'CONTRIBUTORS';
import SpellLink from 'interface/SpellLink';

export default [
change(date (2024, 9, 24), <>Fix crash in <SpellLink spell={TALENTS_MONK.CELESTIAL_CONDUIT_TALENT}/> guide section when player did not cast <SpellLink spell={TALENTS_MONK.UNITY_WITHIN_TALENT}/></>, Trevor),
change(date (2024, 9, 22), <>Add guide section for <SpellLink spell={TALENTS_MONK.CELESTIAL_CONDUIT_TALENT}/></>, Trevor),
change(date (2024, 9, 17), <>Add check for <SpellLink spell={TALENTS_MONK.MANA_TEA_TALENT}/> to <SpellLink spell={TALENTS_MONK.STRENGTH_OF_THE_BLACK_OX_TALENT}/> module</>, Trevor),
change(date (2024, 9, 15), <>Fix <SpellLink spell={TALENTS_MONK.INVOKE_YULON_THE_JADE_SERPENT_TALENT}/> cooldown duration</>, Trevor),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ interface CastInfo {
cooldownMap: Map<number, number> | undefined;
// hits per pulse
targetsHit: number[];
castUnity: boolean;
}

const LESS_IMPORTANT_CDR_SPELLS: Set<number> = new Set<number>([
Expand Down Expand Up @@ -128,11 +129,13 @@ class CelestialConduit extends Analyzer {
cooldownMap: undefined,
targetsHit: [],
timestamp: event.timestamp,
castUnity: false,
});
}

private onUnityWithin(event: CastEvent) {
this.castInfoList.at(-1)!.cooldownMap = this.getCooldownMap();
this.castInfoList.at(-1)!.castUnity = true;
}

private onChannelEnd(event: EndChannelEvent) {
Expand Down Expand Up @@ -161,6 +164,7 @@ class CelestialConduit extends Analyzer {
cooldownMap: undefined,
targetsHit: [],
timestamp: event.timestamp,
castUnity: false,
});
}
if (event.type === EventType.Heal) {
Expand Down Expand Up @@ -195,31 +199,50 @@ class CelestialConduit extends Analyzer {
),
details: <>{castInfo.cancelled ? 'No' : 'Yes'}</>,
};
const unityPerf = castInfo.castUnity
? QualitativePerformance.Good
: QualitativePerformance.Fail;
const unityItem: CooldownExpandableItem = {
label: (
<>
Cast <SpellLink spell={TALENTS_MONK.UNITY_WITHIN_TALENT} />
</>
),
result: (
<>
<PerformanceMark perf={unityPerf} />
</>
),
details: castInfo.castUnity ? 'Yes' : 'No',
};
const cooldownPerfs: QualitativePerformance[] = [];
const cooldownItems: CooldownExpandableItem[] = [];
castInfo.cooldownMap!.forEach((cooldown, spellId) => {
const perf =
cooldown === 0
? LESS_IMPORTANT_CDR_SPELLS.has(spellId)
? QualitativePerformance.Ok
: QualitativePerformance.Fail
: QualitativePerformance.Good;
cooldownPerfs.push(perf);
cooldownItems.push({
label: (
<>
<SpellLink spell={spellId} /> on cooldown when casting{' '}
<SpellLink spell={TALENTS_MONK.UNITY_WITHIN_TALENT} />
</>
),
result: (
<>
<PerformanceMark perf={perf} />
</>
),
details: <>{cooldown === 0 ? 'No' : 'Yes'}</>,
if (castInfo.cooldownMap) {
castInfo.cooldownMap!.forEach((cooldown, spellId) => {
const perf =
cooldown === 0
? LESS_IMPORTANT_CDR_SPELLS.has(spellId)
? QualitativePerformance.Ok
: QualitativePerformance.Fail
: QualitativePerformance.Good;
cooldownPerfs.push(perf);
cooldownItems.push({
label: (
<>
<SpellLink spell={spellId} /> on cooldown when casting{' '}
<SpellLink spell={TALENTS_MONK.UNITY_WITHIN_TALENT} />
</>
),
result: (
<>
<PerformanceMark perf={perf} />
</>
),
details: <>{cooldown === 0 ? 'No' : 'Yes'}</>,
});
});
});
}

const avgTargetsHit =
castInfo.targetsHit.reduce((prev, cur) => {
return prev + cur;
Expand All @@ -236,8 +259,8 @@ class CelestialConduit extends Analyzer {
details: <>{avgTargetsHit.toFixed(1)} </>,
};
return {
perf: getAveragePerf([cancelPerf, ...cooldownPerfs, targetHitPerf]),
items: [cancelledItem, ...cooldownItems, targetsHitItem],
perf: getAveragePerf([cancelPerf, unityPerf, ...cooldownPerfs, targetHitPerf]),
items: [cancelledItem, unityItem, ...cooldownItems, targetsHitItem],
};
}

Expand Down

0 comments on commit 6fe892e

Please sign in to comment.