Skip to content

Commit

Permalink
Fix crash in a different way
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorm4 committed Sep 24, 2024
1 parent 6fe892e commit 6846300
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 48 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 again</>, Trevor),
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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ 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 @@ -84,6 +83,10 @@ class CelestialConduit extends Analyzer {
Events.EndChannel.by(SELECTED_PLAYER).spell(TALENTS_MONK.CELESTIAL_CONDUIT_TALENT),
this.onChannelEnd,
);
this.addEventListener(
Events.EndChannel.by(SELECTED_PLAYER).spell(TALENTS_MONK.CELESTIAL_CONDUIT_TALENT),
this.onUnityWithin,
);

this.addEventListener(
Events.damage.by(SELECTED_PLAYER).spell(SPELLS.CELESTIAL_CONDUIT_DAMAGE),
Expand Down Expand Up @@ -129,13 +132,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 onUnityWithin(event: CastEvent | EndChannelEvent) {
if (!this.castInfoList.at(-1)?.cooldownMap) {
this.castInfoList.at(-1)!.cooldownMap = this.getCooldownMap();
}
}

private onChannelEnd(event: EndChannelEvent) {
Expand Down Expand Up @@ -164,7 +167,6 @@ class CelestialConduit extends Analyzer {
cooldownMap: undefined,
targetsHit: [],
timestamp: event.timestamp,
castUnity: false,
});
}
if (event.type === EventType.Heal) {
Expand Down Expand Up @@ -199,49 +201,31 @@ 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[] = [];
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'}</>,
});
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) => {
Expand All @@ -259,8 +243,8 @@ class CelestialConduit extends Analyzer {
details: <>{avgTargetsHit.toFixed(1)} </>,
};
return {
perf: getAveragePerf([cancelPerf, unityPerf, ...cooldownPerfs, targetHitPerf]),
items: [cancelledItem, unityItem, ...cooldownItems, targetsHitItem],
perf: getAveragePerf([cancelPerf, ...cooldownPerfs, targetHitPerf]),
items: [cancelledItem, ...cooldownItems, targetsHitItem],
};
}

Expand Down

0 comments on commit 6846300

Please sign in to comment.