Skip to content

Commit

Permalink
raidboss: collapse multiple sidewise spark hits to intercards
Browse files Browse the repository at this point in the history
The way clones and the boss hit for sidewise spark often results in an
intercardinal spot being safe for multiple cleaves. When making a call
for a safe spot, if an intercard is safe for the entire sequence, just
call that intercard.

For the collected callouts where there may be a future callout with a
new safe spot, include the number of hits. This should be two, though
the current code has support for anywhere from 2 to 5.

For the final hit after the boss cleave, just call the direction and
"stay", so its clear the player can just move to that intercard and stay
without needing to keep track of a count.

Signed-off-by: Jacob Keller <[email protected]>
  • Loading branch information
jacob-keller committed Oct 11, 2024
1 parent 17ecd62 commit 059e293
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions ui/raidboss/data/07-dt/raid/r4n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ const directionOutputStrings = {
unknown: Outputs.unknown,
goLeft: Outputs.left,
goRight: Outputs.right,
stay: {
en: 'Stay',
},
num2: Outputs.num2,
num3: Outputs.num3,
num4: Outputs.num4,
num5: Outputs.num5,
separator: {
en: ' => ',
de: ' => ',
Expand All @@ -35,6 +42,17 @@ const directionOutputStrings = {
cn: ' => ',
ko: ' => ',
},
intercardStay: {
en: '${dir} => Stay',
},
numHits: {
en: '${dir} x${num}',
de: '${dir} x${num}',
fr: '${dir} x${num}',
ja: '${dir} x${num}',
cn: '${dir} x${num}',
ko: '${dir} x${num}',
},
combo: {
en: '${dirs}',
de: '${dirs}',
Expand Down Expand Up @@ -93,6 +111,23 @@ const getCleaveDirs = (
return Directions.outputFromCardinalNum((actorFacing + 4 + offset) % 4);
});

if (dirs.length === 1)
return dirs;

// Check if all directions lead to the same intercard. If so, there's no
// reason to call a sequence. We don't need to check the cardinals,
// because it will only be true either when there is exactly one element,
// or in the extremely unlikely event that every clone pointed in the same
// direction.
if (dirs.every((dir) => ['dirN', 'dirE'].includes(dir)))
return ['dirNE'];
if (dirs.every((dir) => ['dirS', 'dirE'].includes(dir)))
return ['dirSE'];
if (dirs.every((dir) => ['dirS', 'dirW'].includes(dir)))
return ['dirSW'];
if (dirs.every((dir) => ['dirN', 'dirW'].includes(dir)))
return ['dirNW'];

return dirs;
};

Expand Down Expand Up @@ -211,6 +246,19 @@ const triggerSet: TriggerSet<Data> = {
const dirs = getCleaveDirs(data.actors, data.storedCleaves);
const mappedDirs = dirs.map((dir) => output[dir]!());

const cleaves: number = data.storedCleaves.length;
if (mappedDirs.length === 1 && cleaves > 1) {
const cleaveNums: { [key: number]: string } = {
2: output.num2!(),
3: output.num3!(),
4: output.num4!(),
5: output.num5!(),
};

if (cleaves in cleaveNums)
return output.numHits!({ dir: mappedDirs[0], num: cleaveNums[cleaves] });
}

return output.combo!({ dirs: mappedDirs.join(output.separator!()) });
},
run: (data) => {
Expand Down Expand Up @@ -289,6 +337,12 @@ const triggerSet: TriggerSet<Data> = {

const dirs: DirectionOutput8[] = getCleaveDirs(data.actors, remainingHits);

if (dirs.length === 1) {
const dir = dirs[0]!;
const mappedDir = output[dir]!();
return output.intercardStay!({ dir: mappedDir });
}

const mappedDirs = dirs.map((dir) => output[dir]!());

return output.combo!({ dirs: mappedDirs.join(output.separator!()) });
Expand Down

0 comments on commit 059e293

Please sign in to comment.