Skip to content

Commit

Permalink
triggers build: raidboss: add durations for p12s white flame (#5689)
Browse files Browse the repository at this point in the history
From @valarnin's comment here:
#5682 (comment)

A follow-up to this would be to adjust the calls about baiting to say
"quick" or "delayed" or "very delayed" or something depending on how
long the wait is. 704cae5
  • Loading branch information
github-actions committed Jul 27, 2023
1 parent d0c1175 commit a62a296
Showing 1 changed file with 84 additions and 2 deletions.
86 changes: 84 additions & 2 deletions 06-ew/raid/p12s.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,8 @@ Options.Triggers.push({
wingCollect: [],
wingCalls: [],
superchainCollect: [],
lcCombatants: [],
lcCombatantsOffset: 0,
whiteFlameCounter: 0,
sampleTiles: [],
darknessClones: [],
Expand Down Expand Up @@ -1653,14 +1655,88 @@ Options.Triggers.push({
},
},
},
{
id: 'P12S Limit Cut Combatant Tracker',
type: 'Ability',
netRegex: { id: '82F3', source: 'Athena', capture: false },
promise: async (data) => {
const actorData = await callOverlayHandler({
call: 'getCombatants',
});
if (actorData === null) {
console.error(`LC Combatant Tracker: null data`);
return;
}
const combatants = actorData.combatants.filter((combatant) => {
const distX = Math.abs(100 - combatant.PosX);
const distY = Math.abs(100 - combatant.PosY);
const distance = Math.hypot(distX, distY);
// Only "Anthropos" (12378) combatants at roughly the correct distance (roughly 9.89y intercard/10y card away from middle)
return combatant.BNpcNameID === 12378 && Math.abs(distance - 10) < 0.25;
});
if (combatants.length !== 8) {
console.error(`LC Combatant Tracker: expected 8, got ${combatants.length}`);
return;
}
data.lcCombatants = combatants;
},
},
{
id: 'P12S Limit Cut Line Bait Collector',
type: 'CombatantMemory',
netRegex: {
id: '40[0-9A-F]{6}',
pair: [{ key: 'ModelStatus', value: '16384' }],
capture: true,
},
condition: (data, matches) =>
data.lcCombatants.length > 0 &&
data.lcCombatants.find((c) => c.ID === parseInt(matches.id, 16)) !== undefined,
run: (data, matches) => {
const combatant = data.lcCombatants.find((c) => c.ID === parseInt(matches.id, 16));
if (combatant === undefined) {
console.error(`LC Line Bait Collector: Could not find combatant for ID ${matches.id}`);
return;
}
combatant.order = data.lcCombatantsOffset;
++data.lcCombatantsOffset;
if (data.lcCombatantsOffset < 8)
return;
// Find the intercardinal adds that jumped, and then sort by order.
const orderedJumps = data.lcCombatants
.filter((combatant) =>
(Directions.xyTo8DirNum(combatant.PosX, combatant.PosY, 100, 100) % 2) === 1
).map((combatant) => combatant.order)
.sort((left, right) => (left ?? 0) - (right ?? 0));
if (orderedJumps.length !== 4) {
console.error(
`LC Line Bait Collector: Incorrect count of intercardinal adds`,
data.lcCombatants,
);
return;
}
const [o1, o2, o3, o4] = orderedJumps;
if (o1 === undefined || o2 === undefined || o3 === undefined || o4 === undefined)
return;
// delay of 1 = immediate, 5 = maximum
data.lcWhiteFlameDelay = [o1 + 1, o2 - o1, o3 - o2, o4 - o3];
},
},
{
id: 'P12S Palladion White Flame Initial',
type: 'StartsUsing',
// 82F5 = Palladion cast
// 8 seconds from Palladion starts casting to first White Flame damage
// This is also an 8 second cast.
// ~3 seconds after that for every potential White Flame
netRegex: { id: '82F5', source: 'Athena', capture: false },
// Don't collide with number callout.
delaySeconds: 2,
durationSeconds: 4,
durationSeconds: (data) => {
const delay = data.lcWhiteFlameDelay?.[0] ?? 1;
// 8 seconds from cast start - 2 second delay already
return (8 - 2) + 3 * (delay - 1) - 0.5;
},
response: (data, _matches, output) => {
// cactbot-builtin-response
output.responseOutputStrings = {
Expand All @@ -1681,6 +1757,7 @@ Options.Triggers.push({
ko: '(5, 7 레이저)',
},
};
// TODO: use `data.lcWhiteFlameDelay` to say things like "quick" or "delayed" or "very delayed".
const infoText = output.firstWhiteFlame();
if (data.limitCutNumber === 5 || data.limitCutNumber === 7)
return { alertText: output.baitLaser(), infoText: infoText };
Expand All @@ -1692,6 +1769,11 @@ Options.Triggers.push({
type: 'Ability',
netRegex: { id: '82EF', source: 'Anthropos', capture: false },
condition: (data) => data.phase === 'palladion',
preRun: (data) => data.whiteFlameCounter++,
durationSeconds: (data) => {
const delay = data.lcWhiteFlameDelay?.[data.whiteFlameCounter] ?? 1;
return 3 * delay - 0.5;
},
response: (data, _matches, output) => {
// cactbot-builtin-response
output.responseOutputStrings = {
Expand Down Expand Up @@ -1728,7 +1810,7 @@ Options.Triggers.push({
ko: '(2, 4 레이저)',
},
};
data.whiteFlameCounter++;
// TODO: use `data.lcWhiteFlameDelay` to say things like "quick" or "delayed" or "very delayed".
const baitLaser = output.baitLaser();
if (data.whiteFlameCounter === 1) {
const infoText = output.secondWhiteFlame();
Expand Down

0 comments on commit a62a296

Please sign in to comment.