Skip to content

Commit

Permalink
raidboss: update arr and responses to use player objects (#5891)
Browse files Browse the repository at this point in the history
Followup to #5861.
  • Loading branch information
quisquous authored Nov 4, 2023
1 parent ecadc4b commit d9304c6
Show file tree
Hide file tree
Showing 20 changed files with 90 additions and 59 deletions.
33 changes: 24 additions & 9 deletions resources/responses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export const Responses = {
if (target === data.me)
return;

return output.busterOnTarget?.({ player: data.ShortName(target) });
return output.busterOnTarget?.({ player: data.party.member(target) });
};

const combined = combineFuncs(
Expand All @@ -217,6 +217,7 @@ export const Responses = {
},
tankBusterSwap: (busterSev?: Severity, swapSev?: Severity) => {
const outputStrings = {
noTarget: Outputs.tankBuster,
tankSwap: Outputs.tankSwap,
busterOnYou: Outputs.tankBusterOnYou,
busterOnTarget: Outputs.tankBusterOnPlayer,
Expand All @@ -236,7 +237,9 @@ export const Responses = {

if (target === data.me)
return output.busterOnYou?.();
return output.busterOnTarget?.({ player: data.ShortName(target) });
if (target === undefined)
return output.noTarget?.();
return output.busterOnTarget?.({ player: data.party.member(target) });
};

const combined = combineFuncs(
Expand Down Expand Up @@ -292,7 +295,7 @@ export const Responses = {
if (target === data.me)
return output.sharedTankbusterOnYou?.();
if (data.role === 'tank' || data.role === 'healer')
return output.sharedTankbusterOnTarget?.({ player: data.ShortName(target) });
return output.sharedTankbusterOnTarget?.({ player: data.party.member(target) });
};

const otherFunc = (data: Data, matches: TargetedMatches, output: Output) => {
Expand Down Expand Up @@ -334,13 +337,16 @@ export const Responses = {
output.responseOutputStrings = {
stackOnYou: Outputs.stackOnYou,
stackOnTarget: Outputs.stackOnPlayer,
stackMarker: Outputs.stackMarker,
};
return {
[defaultAlertText(sev)]: (data: Data, matches: TargetedMatches, output: Output) => {
const target = getTarget(matches);
if (target === data.me)
return output.stackOnYou?.();
return output.stackOnTarget?.({ player: data.ShortName(target) });
if (target === undefined)
return output.stackMarker?.();
return output.stackOnTarget?.({ player: data.party.member(target) });
},
};
},
Expand All @@ -355,6 +361,7 @@ export const Responses = {
knockback: (sev?: Severity) => staticResponse(defaultAlertText(sev), Outputs.knockback),
knockbackOn: (targetSev?: Severity, otherSev?: Severity) => {
const outputStrings = {
knockback: Outputs.knockback,
knockbackOnYou: Outputs.knockbackOnYou,
knockbackOnTarget: Outputs.knockbackOnPlayer,
};
Expand All @@ -367,8 +374,10 @@ export const Responses = {

const otherFunc = (data: Data, matches: TargetedMatches, output: Output) => {
const target = getTarget(matches);
if (target === undefined)
return output.knockback?.();
if (target !== data.me)
return output.knockbackOnTarget?.({ player: data.ShortName(target) });
return output.knockbackOnTarget?.({ player: data.party.member(target) });
};
const combined = combineFuncs(
defaultInfoText(targetSev),
Expand All @@ -388,14 +397,17 @@ export const Responses = {
lookAwayFromTarget: (sev?: Severity) => (_data: Data, _matches: unknown, output: Output) => {
// cactbot-builtin-response
output.responseOutputStrings = {
lookAway: Outputs.lookAway,
lookAwayFrom: Outputs.lookAwayFromTarget,
};
return {
[defaultAlertText(sev)]: (data: Data, matches: TargetedMatches, output: Output) => {
const target = getTarget(matches);
if (target === data.me)
return;
const name = isPlayerId(matches?.targetId) ? data.ShortName(target) : target;
if (target === undefined)
return output.lookAway?.();
const name = isPlayerId(matches?.targetId) ? data.party.member(target) : target;
return output.lookAwayFrom?.({ name: name });
},
};
Expand All @@ -410,7 +422,7 @@ export const Responses = {
const source = getSource(matches);
if (source === data.me)
return;
const name = isPlayerId(matches?.sourceId) ? data.ShortName(source) : source;
const name = isPlayerId(matches?.sourceId) ? data.party.member(source) : source;
return output.lookAwayFrom?.({ name: name });
},
};
Expand Down Expand Up @@ -538,8 +550,9 @@ export const Responses = {

const otherFunc = (data: Data, matches: TargetedMatches, output: Output) => {
const target = getTarget(matches);
const player = target === undefined ? output.unknown?.() : data.party.member(target);
if (target !== data.me)
return output.preyOnTarget?.({ player: data.ShortName(target) });
return output.preyOnTarget?.({ player: player });
};

const combined = combineFuncs(
Expand All @@ -559,13 +572,15 @@ export const Responses = {
output.responseOutputStrings = {
awayFromGroup: Outputs.awayFromGroup,
awayFromTarget: Outputs.awayFromPlayer,
unknown: Outputs.unknown,
};
return {
[defaultAlertText(sev)]: (data: Data, matches: TargetedMatches, output: Output) => {
const target = getTarget(matches);
if (data.me === target)
return output.awayFromGroup?.();
return output.awayFromTarget?.({ player: data.ShortName(target) });
const player = target === undefined ? output.unknown?.() : data.party.member(target);
return output.awayFromTarget?.({ player: player });
},
};
},
Expand Down
25 changes: 16 additions & 9 deletions ui/raidboss/data/00-misc/general.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ const triggerSet: TriggerSet<Data> = {
return false;
return caresAboutTankStuff(data);
},
infoText: (data, matches, output) => output.text!({ player: data.ShortName(matches.source) }),
infoText: (data, matches, output) =>
output.text!({ player: data.party.member(matches.source) }),
outputStrings: {
text: {
en: 'Provoke: ${player}',
Expand All @@ -52,8 +53,8 @@ const triggerSet: TriggerSet<Data> = {
suppressSeconds: 0.5,
infoText: (data, matches, output) => {
if (matches.targetId === 'E0000000')
return output.noTarget!({ player: data.ShortName(matches.source) });
return output.text!({ player: data.ShortName(matches.source) });
return output.noTarget!({ player: data.party.member(matches.source) });
return output.text!({ player: data.party.member(matches.source) });
},
outputStrings: {
text: {
Expand Down Expand Up @@ -86,7 +87,8 @@ const triggerSet: TriggerSet<Data> = {
return false;
return caresAboutTankStuff(data);
},
infoText: (data, matches, output) => output.text!({ player: data.ShortName(matches.source) }),
infoText: (data, matches, output) =>
output.text!({ player: data.party.member(matches.source) }),
outputStrings: {
text: {
en: 'Shirk: ${player}',
Expand All @@ -110,7 +112,8 @@ const triggerSet: TriggerSet<Data> = {
return false;
return caresAboutTankStuff(data);
},
infoText: (data, matches, output) => output.text!({ player: data.ShortName(matches.source) }),
infoText: (data, matches, output) =>
output.text!({ player: data.party.member(matches.source) }),
outputStrings: {
text: {
en: 'Holmgang: ${player}',
Expand All @@ -134,7 +137,8 @@ const triggerSet: TriggerSet<Data> = {
return false;
return caresAboutTankStuff(data);
},
infoText: (data, matches, output) => output.text!({ player: data.ShortName(matches.source) }),
infoText: (data, matches, output) =>
output.text!({ player: data.party.member(matches.source) }),
outputStrings: {
text: {
en: 'Hallowed: ${player}',
Expand All @@ -158,7 +162,8 @@ const triggerSet: TriggerSet<Data> = {
return false;
return caresAboutTankStuff(data);
},
infoText: (data, matches, output) => output.text!({ player: data.ShortName(matches.source) }),
infoText: (data, matches, output) =>
output.text!({ player: data.party.member(matches.source) }),
outputStrings: {
text: {
en: 'Bolide: ${player}',
Expand All @@ -182,7 +187,8 @@ const triggerSet: TriggerSet<Data> = {
return false;
return caresAboutTankStuff(data);
},
infoText: (data, matches, output) => output.text!({ player: data.ShortName(matches.source) }),
infoText: (data, matches, output) =>
output.text!({ player: data.party.member(matches.source) }),
outputStrings: {
text: {
en: 'Living: ${player}',
Expand All @@ -206,7 +212,8 @@ const triggerSet: TriggerSet<Data> = {
return false;
return caresAboutTankStuff(data);
},
infoText: (data, matches, output) => output.text!({ player: data.ShortName(matches.source) }),
infoText: (data, matches, output) =>
output.text!({ player: data.party.member(matches.source) }),
outputStrings: {
text: {
en: 'Walking: ${player}',
Expand Down
7 changes: 3 additions & 4 deletions ui/raidboss/data/02-arr/dungeon/brayfloxs_longstop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ const triggerSet: TriggerSet<Data> = {
const names = data.pelicanPoisons.sort();
if (names.length === 1 && names[0] === data.me)
return output.esunaYourPoison!();

return output.esunaPoisonOn!({ players: names.map((x) => data.ShortName(x)).join(', ') });
return output.esunaPoisonOn!({ players: names.map((x) => data.party.member(x)) });
},
run: (data) => data.pelicanPoisons = [],
outputStrings: {
Expand Down Expand Up @@ -103,7 +102,7 @@ const triggerSet: TriggerSet<Data> = {
netRegex: { id: '3D3', source: 'Hellbender' },
infoText: (data, matches, output) => {
if (matches.target !== data.me)
return output.breakBubbleOn!({ player: data.ShortName(matches.target) });
return output.breakBubbleOn!({ player: data.party.member(matches.target) });

if (matches.target === data.me)
return output.breakYourBubble!();
Expand Down Expand Up @@ -162,7 +161,7 @@ const triggerSet: TriggerSet<Data> = {
condition: (data) => data.CanCleanse(),
alertText: (data, matches, output) => {
if (matches.target !== data.me)
return output.esunaPoisonOn!({ player: data.ShortName(matches.target) });
return output.esunaPoisonOn!({ player: data.party.member(matches.target) });

return output.esunaYourPoison!();
},
Expand Down
3 changes: 2 additions & 1 deletion ui/raidboss/data/02-arr/dungeon/pharos_sirius.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ const triggerSet: TriggerSet<Data> = {
id: 'Pharos Sirius Doom',
type: 'GainsEffect',
netRegex: { effectId: '172' },
infoText: (data, matches, output) => output.text!({ player: data.ShortName(matches.target) }),
infoText: (data, matches, output) =>
output.text!({ player: data.party.member(matches.target) }),
outputStrings: {
text: {
en: 'Heal ${player} to full',
Expand Down
5 changes: 3 additions & 2 deletions ui/raidboss/data/02-arr/dungeon/sastasha_hard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ const triggerSet: TriggerSet<Data> = {
type: 'GainsEffect',
netRegex: { effectId: '239' },
condition: (data) => data.CanCleanse(),
infoText: (data, matches, output) => output.text!({ player: data.ShortName(matches.target) }),
infoText: (data, matches, output) =>
output.text!({ player: data.party.member(matches.target) }),
outputStrings: {
text: {
en: 'Esuna ${player}',
Expand All @@ -35,7 +36,7 @@ const triggerSet: TriggerSet<Data> = {
return output.stun!({ name: matches.source });
},
infoText: (data, matches, output) => {
return output.tailScrewOn!({ player: data.ShortName(matches.target) });
return output.tailScrewOn!({ player: data.party.member(matches.target) });
},
outputStrings: {
stun: Outputs.stunTarget,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const triggerSet: TriggerSet<Data> = {
type: 'GainsEffect',
netRegex: { effectId: 'D2' },
alertText: (data, matches, output) =>
output.text!({ player: data.ShortName(matches.target) }),
output.text!({ player: data.party.member(matches.target) }),
outputStrings: {
text: {
en: 'Heal ${player} to full',
Expand Down
4 changes: 2 additions & 2 deletions ui/raidboss/data/02-arr/raid/t10.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const triggerSet: TriggerSet<Data> = {
},
infoText: (data, matches, output) => {
if (data.me !== matches.target)
return output.chargeOn!({ player: data.ShortName(matches.target) });
return output.chargeOn!({ player: data.party.member(matches.target) });
},
outputStrings: {
chargeOn: {
Expand Down Expand Up @@ -69,7 +69,7 @@ const triggerSet: TriggerSet<Data> = {
},
infoText: (data, matches, output) => {
if (data.me !== matches.target)
return output.cyclonicOn!({ player: data.ShortName(matches.target) });
return output.cyclonicOn!({ player: data.party.member(matches.target) });
},
outputStrings: {
cyclonicOn: {
Expand Down
6 changes: 3 additions & 3 deletions ui/raidboss/data/02-arr/raid/t11.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const triggerSet: TriggerSet<Data> = {
type: 'Ability',
netRegex: { source: 'Kaliya', id: 'B73' },
alertText: (data, matches, output) => {
return output.text!({ player: data.ShortName(matches.target) });
return output.text!({ player: data.party.member(matches.target) });
},
outputStrings: {
text: {
Expand Down Expand Up @@ -164,7 +164,7 @@ const triggerSet: TriggerSet<Data> = {
partner = player0;
if (partner === undefined)
return;
return output.text!({ player: data.ShortName(partner) });
return output.text!({ player: data.party.member(partner) });
},
outputStrings: {
text: {
Expand Down Expand Up @@ -194,7 +194,7 @@ const triggerSet: TriggerSet<Data> = {
partner = player0;
if (partner === undefined)
return;
return output.text!({ player: data.ShortName(partner) });
return output.text!({ player: data.party.member(partner) });
},
outputStrings: {
text: {
Expand Down
4 changes: 2 additions & 2 deletions ui/raidboss/data/02-arr/raid/t12.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const triggerSet: TriggerSet<Data> = {
},
infoText: (data, matches, output) => {
if (matches.target !== data.me)
return output.awayFromPlayer!({ player: data.ShortName(matches.target) });
return output.awayFromPlayer!({ player: data.party.member(matches.target) });
},
outputStrings: {
awayFromPlayer: {
Expand Down Expand Up @@ -135,7 +135,7 @@ const triggerSet: TriggerSet<Data> = {
},
infoText: (data, matches, output) => {
if (matches.target !== data.me)
return output.chainOn!({ player: data.ShortName(matches.target) });
return output.chainOn!({ player: data.party.member(matches.target) });
},
outputStrings: {
chainOn: {
Expand Down
4 changes: 2 additions & 2 deletions ui/raidboss/data/02-arr/raid/t13.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const triggerSet: TriggerSet<Data> = {
infoText: (data, matches, output) => {
if (matches.target === data.me)
return;
return output.flattenOn!({ player: data.ShortName(matches.target) });
return output.flattenOn!({ player: data.party.member(matches.target) });
},
outputStrings: {
flattenOn: {
Expand Down Expand Up @@ -132,7 +132,7 @@ const triggerSet: TriggerSet<Data> = {
},
infoText: (data, matches, output) => {
if (matches.target !== data.me)
return output.akhMornOn!({ player: data.ShortName(matches.target) });
return output.akhMornOn!({ player: data.party.member(matches.target) });
},
outputStrings: {
akhMornOn: {
Expand Down
2 changes: 1 addition & 1 deletion ui/raidboss/data/02-arr/raid/t2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const triggerSet: TriggerSet<Data> = {
},
infoText: (data, matches, output) => {
if (data.me !== matches.target)
return output.rotOn!({ player: data.ShortName(matches.target) });
return output.rotOn!({ player: data.party.member(matches.target) });
},
outputStrings: {
rotOn: {
Expand Down
Loading

0 comments on commit d9304c6

Please sign in to comment.