Skip to content

Commit

Permalink
raidboss: fix P11S lightstream safespot (#5585)
Browse files Browse the repository at this point in the history
The lasers are not always in sorted order, apparently? From the one (1)
example of them not being sorted, it appears that sorting by actor id
puts them in the correct order.

Fixes #5584.
quisquous authored Jun 19, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 4700770 commit 55bf6e3
Showing 1 changed file with 26 additions and 30 deletions.
56 changes: 26 additions & 30 deletions ui/raidboss/data/06-ew/raid/p11s.ts
Original file line number Diff line number Diff line change
@@ -18,8 +18,7 @@ export interface Data extends RaidbossData {
lightDarkDebuff: { [name: string]: 'light' | 'dark' };
lightDarkBuddy: { [name: string]: string };
lightDarkTether: { [name: string]: 'near' | 'far' };
cylinderValue?: number;
numCylinders?: number;
cylinderCollect: NetMatches['HeadMarker'][];
}

const headmarkers = {
@@ -51,6 +50,7 @@ const triggerSet: TriggerSet<Data> = {
lightDarkDebuff: {},
lightDarkBuddy: {},
lightDarkTether: {},
cylinderCollect: [],
};
},
triggers: [
@@ -682,32 +682,31 @@ const triggerSet: TriggerSet<Data> = {
netRegex: { target: 'Arcane Cylinder' },
condition: (data, matches) => {
const id = getHeadmarkerId(data, matches);
return (id === headmarkers.orangeCW || id === headmarkers.blueCCW);
if (id !== headmarkers.orangeCW && id !== headmarkers.blueCCW)
return false;
data.cylinderCollect.push(matches);
return data.cylinderCollect.length === 3;
},
run: (data, matches) => {
const id = getHeadmarkerId(data, matches);
alertText: (data, _matches, output) => {
let cylinderValue = 0;

// targetId is in hex, but that's still lexicographically sorted so no need to parseInt.
const sortedCylinders = data.cylinderCollect.sort((a, b) => {
return a.targetId.localeCompare(b.targetId);
});
const markers = sortedCylinders.map((x) => x.id);

// Once sorted by id, the lasers will always be in NW, S, NE order.
// Create a 3 digit binary value, Orange = 0, Blue = 1.
// e.g. BBO = 110 = 6
data.cylinderValue ??= 0;
data.numCylinders ??= 0;
data.cylinderValue *= 2;
if (id === headmarkers.blueCCW)
data.cylinderValue += 1;
data.numCylinders++;
},
},
{
id: 'P11S Lightstream',
type: 'HeadMarker',
netRegex: { target: 'Arcane Cylinder' },
condition: (data, matches) => {
const id = getHeadmarkerId(data, matches);
return (data.numCylinders === 3 &&
(id === headmarkers.orangeCW || id === headmarkers.blueCCW));
},
alertText: (data, _matches, output) => {
if (!data.cylinderValue || !(data.cylinderValue >= 0) || data.cylinderValue > 7)
return;
for (const marker of markers) {
cylinderValue *= 2;
if (marker === headmarkers.blueCCW)
cylinderValue += 1;
}

// The safe spot is the one just CW of two reds or just CCW of two blues.
// There's always two of one color and one of the other.
const outputs: { [cylinderValue: number]: string | undefined } = {
0b000: undefined,
0b001: output.northwest!(),
@@ -718,12 +717,9 @@ const triggerSet: TriggerSet<Data> = {
0b110: output.southeast!(),
0b111: undefined,
};
return outputs[data.cylinderValue];
},
run: (data) => {
delete data.cylinderValue;
delete data.numCylinders;
return outputs[cylinderValue];
},
run: (data) => data.cylinderCollect = [],
outputStrings: {
east: Outputs.east,
northeast: Outputs.northeast,

0 comments on commit 55bf6e3

Please sign in to comment.