Skip to content

Commit

Permalink
raidboss: add P12s Engravement 1 Tower trigger (#5597)
Browse files Browse the repository at this point in the history
Add P12s Engravement 1 Tower triggers. 
> This trigger is based on part of the functionality of #5587 PR, and
later merges may involve conflict merges, which I will resolve at that
time.

In Engravement 1 (Paradeigma 2), 2 players receive lightTower and 2
players receive darkTower, 2 players need to guide the light beam and 2
players need to guide the dark beam.

The operator of the beam extends the beam directly from the outside. The
beam is attenuated until the jagged line disappears.

The people in the tower find the people who have the opposite attribute
to the debuff and put them in four places. At NE NW SE SW as a # shape.
The position of outside Anthropos is fixed by two situation. `{[97, 75],
[125, 97], [103, 125], [75, 103]} and {[103, 75], [125, 103], [97, 125],
[75, 97]}`. The Anthropos will cast 'Searing Radiance' for light beam
and 'Shadowsear' for dark beam. We use those as a trigger for Tower
players place the Tower.

When debuffs expire and towers drop, their debuff changes to lightTilt
or darkTilt (same as tower color).
At the same time the towers drop, the 4 tethered players receive
lightTilt or darkTilt depending on their tether color.


![example](https://github.com/quisquous/cactbot/assets/12003087/6d2eb614-a04a-4225-97be-5968cd3279fa)

---------

Signed-off-by: 柚木鉉 <[email protected]>
Co-authored-by: Adrienne Walker <[email protected]>
  • Loading branch information
YuzukiTsuru and quisquous authored Jun 23, 2023
1 parent 49b1d19 commit ab9af74
Showing 1 changed file with 197 additions and 4 deletions.
201 changes: 197 additions & 4 deletions ui/raidboss/data/06-ew/raid/p12s.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import Conditions from '../../../../../resources/conditions';
import Outputs from '../../../../../resources/outputs';
import { callOverlayHandler } from '../../../../../resources/overlay_plugin_api';
import { Responses } from '../../../../../resources/responses';
import { Directions } from '../../../../../resources/util';
import ZoneId from '../../../../../resources/zone_id';
import { RaidbossData } from '../../../../../types/data';
import { PluginCombatantState } from '../../../../../types/event';
import { NetMatches } from '../../../../../types/net_matches';
import { TriggerSet } from '../../../../../types/trigger';

Expand Down Expand Up @@ -164,11 +166,18 @@ const getHeadmarkerId = (data: Data, matches: NetMatches['HeadMarker']) => {
};

export interface Data extends RaidbossData {
readonly triggerSetConfig: { engravement1DropTower: 'quadrant' | 'clockwise' | 'tower' };
decOffset?: number;
expectedFirstHeadmarker?: string;
isDoorBoss: boolean;
phase?: 'superchain1' | 'palladion' | 'superchain2a' | 'superchain2b';
combatantData: PluginCombatantState[];
engravementCounter: number;
engravement1BeamsPosMap: Map<string, string>;
engravement1TetherIds: number[];
engravement1TetherPlayers: { [name: string]: AnthroposTether };
engravement1LightBeamsPos: string[];
engravement1DarkBeamsPos: string[];
engravement1Towers: string[];
engravement2MyLabel?: EngravementLabel;
engravement3TowerType?: 'lightTower' | 'darkTower';
Expand All @@ -194,11 +203,40 @@ export interface Data extends RaidbossData {
const triggerSet: TriggerSet<Data> = {
id: 'AnabaseiosTheTwelfthCircleSavage',
zoneId: ZoneId.AnabaseiosTheTwelfthCircleSavage,
config: [
{
id: 'engravement1DropTower',
name: {
en: 'Paradeigma 2 Tower Strategy',
cn: '第一次拉线踩塔方法',
},
type: 'select',
options: {
en: {
'Tether direct across + nearest quadrant tower (Game8)': 'quadrant',
'Clockwise tower from tether': 'clockwise',
'No strategy: just call tower color': 'tower',
},
cn: {
'垂直拉线 (Game8)': 'quadrant',
'对角拉线': 'clockwise',
'仅提示塔颜色': 'tower',
},
},
default: 'tower',
},
],
timelineFile: 'p12s.txt',
initData: () => {
return {
isDoorBoss: true,
combatantData: [],
engravementCounter: 0,
engravement1BeamsPosMap: new Map(),
engravement1TetherIds: [],
engravement1TetherPlayers: {},
engravement1LightBeamsPos: [],
engravement1DarkBeamsPos: [],
engravement1Towers: [],
engravement3TowerPlayers: [],
engravement3TetherPlayers: {},
Expand Down Expand Up @@ -604,30 +642,185 @@ const triggerSet: TriggerSet<Data> = {
netRegex: { id: '8305', source: 'Athena', capture: false },
run: (data) => ++data.engravementCounter,
},
// In Engravement 1 (Paradeigma 2), 2 players receive lightTower and 2 players receive darkTower.
// In Engravement 1 (Paradeigma 2), 2 players receive lightTower and 2 players receive darkTower,
// 2 players need to guide the light beam and 2 players need to guide the dark beam.
// The operator of the beam extends the beam directly from the outside. The beam is attenuated until the jagged line disappears.
// The people in the tower find the people who have the opposite attribute to the debuff and put them in four places.
// At NE NW SE SW as a # shape. The position of outside Anthropos is fixed by two situation.
// {[97, 75], [125, 97], [103, 125], [75, 103]} and {[103, 75], [125, 103], [97, 125], [75, 97]}. The Anthropos will cast
// 'Searing Radiance' for light beam and 'Shadowsear' for dark beam. We use those as a trigger for Tower players place
// the Tower.
// When debuffs expire and towers drop, their debuff changes to lightTilt or darkTilt (same as tower color).
// At the same time the towers drop, the 4 tethered players receive lightTilt or darkTilt depending on their tether color.
//
{
id: 'P12S Engravement 1 Tether Tracker',
type: 'Tether',
netRegex: { id: Object.keys(anthroposTetherMap), source: 'Anthropos' },
run: (data, matches) => {
const tetherType = anthroposTetherMap[matches.id];
if (tetherType === undefined)
return;
data.engravement1TetherPlayers[matches.sourceId] = tetherType;
data.engravement1TetherIds.push(parseInt(matches.sourceId, 16));
},
},
{
id: 'P12S Engravement 1 Beam',
type: 'StartsUsing',
netRegex: { id: Object.keys(tetherAbilityToTowerMap), source: 'Anthropos' },
condition: (data) => data.engravementCounter === 1,
alertText: (data, matches, output) => {
if (data.me === matches.target) {
if (matches.id === '82F1')
return output.lightBeam!();
return output.darkBeam!();
}
},
outputStrings: {
lightBeam: {
en: 'light beam',
cn: '引导光激光',
},
darkBeam: {
en: 'dark beam',
cn: '引导暗激光',
},
},
},
{
id: 'P12S Engravement 1 Tower Drop',
type: 'GainsEffect',
netRegex: { effectId: engravementTowerIds },
condition: (data) => data.engravementCounter === 1,
durationSeconds: (_data, matches) => parseFloat(matches.duration),
promise: async (data) => {
data.combatantData = [];
data.combatantData = (await callOverlayHandler({
call: 'getCombatants',
ids: data.engravement1TetherIds,
})).combatants;
},
alertText: (data, matches, output) => {
data.engravement1Towers.push(matches.target);

for (const combatant of data.combatantData) {
const x = combatant.PosX;
const y = combatant.PosY;

const combatantId = combatant.ID;
if (combatantId === undefined)
return;

const tempColor = data.engravement1TetherPlayers[combatantId.toString(16).toUpperCase()];

const color = tempColor === 'light' ? 'dark' : 'light';

if (data.triggerSetConfig.engravement1DropTower === 'quadrant') {
if (x < 80 && y < 100) { // x = 75 && y = 97
data.engravement1BeamsPosMap.set('NE', color);
} else if (x < 100 && y < 80) { // x = 97 && y = 75
data.engravement1BeamsPosMap.set('SW', color);
} else if (x > 100 && y < 80) { // x = 103 && y = 75
data.engravement1BeamsPosMap.set('SE', color);
} else if (x > 120 && y < 100) { // x = 125 && y = 97
data.engravement1BeamsPosMap.set('NW', color);
} else if (x > 120 && y > 100) { // x = 125 && y = 103
data.engravement1BeamsPosMap.set('SW', color);
} else if (x > 100 && y > 120) { // x = 103 && y = 125
data.engravement1BeamsPosMap.set('NE', color);
} else if (x < 100 && y > 120) { // x = 97 && y = 125
data.engravement1BeamsPosMap.set('NW', color);
} else if (x < 80 && y > 100) { // x = 75 && y = 103
data.engravement1BeamsPosMap.set('SE', color);
}
} else if (data.triggerSetConfig.engravement1DropTower === 'clockwise') {
if (x < 80 && y < 100) { // x = 75 && y = 97
data.engravement1BeamsPosMap.set('SE', color);
} else if (x < 100 && y < 80) { // x = 97 && y = 75
data.engravement1BeamsPosMap.set('SE', color);
} else if (x > 100 && y < 80) { // x = 103 && y = 75
data.engravement1BeamsPosMap.set('SW', color);
} else if (x > 120 && y < 100) { // x = 125 && y = 97
data.engravement1BeamsPosMap.set('SW', color);
} else if (x > 120 && y > 100) { // x = 125 && y = 103
data.engravement1BeamsPosMap.set('NW', color);
} else if (x > 100 && y > 120) { // x = 103 && y = 125
data.engravement1BeamsPosMap.set('NW', color);
} else if (x < 100 && y > 120) { // x = 97 && y = 125
data.engravement1BeamsPosMap.set('NE', color);
} else if (x < 80 && y > 100) { // x = 75 && y = 103
data.engravement1BeamsPosMap.set('NE', color);
}
}
}

if (data.me === matches.target) {
if (matches.effectId === engravementIdMap.lightTower)
return output.lightTower!();
return output.darkTower!();
// if Only notify tower color
if (data.triggerSetConfig.engravement1DropTower === 'tower') {
if (matches.effectId === engravementIdMap.lightTower)
return output.lightTower!();
return output.darkTower!();
}
data.engravement1DarkBeamsPos = [];
data.engravement1LightBeamsPos = [];
data.engravement1BeamsPosMap.forEach((value: string, key: string) => {
if (matches.effectId === engravementIdMap.lightTower && value === 'light') {
if (key === 'NE')
data.engravement1LightBeamsPos.push(output.northeast!());
else if (key === 'NW')
data.engravement1LightBeamsPos.push(output.northwest!());
else if (key === 'SE')
data.engravement1LightBeamsPos.push(output.southeast!());
else if (key === 'SW')
data.engravement1LightBeamsPos.push(output.southwest!());
} else if (matches.effectId === engravementIdMap.darkTower && value === 'dark') {
if (key === 'NE')
data.engravement1DarkBeamsPos.push(output.northeast!());
else if (key === 'NW')
data.engravement1DarkBeamsPos.push(output.northwest!());
else if (key === 'SE')
data.engravement1DarkBeamsPos.push(output.southeast!());
else if (key === 'SW')
data.engravement1DarkBeamsPos.push(output.southwest!());
}
});

// if light tower
if (matches.effectId === engravementIdMap.lightTower) {
return output.lightTowerSide!({
pos1: data.engravement1LightBeamsPos[0],
pos2: data.engravement1LightBeamsPos[1],
});
}

return output.darkTowerSide!({
pos1: data.engravement1DarkBeamsPos[0],
pos2: data.engravement1DarkBeamsPos[1],
});
}
},
outputStrings: {
lightTowerSide: {
en: 'Drop light tower ${pos1}/${pos2}',
cn: '去 ${pos1}/${pos2} 放光塔',
},
darkTowerSide: {
en: 'Drop dark tower at ${pos1}/${pos2}',
cn: '去 ${pos1}/${pos2} 放暗塔',
},
lightTower: {
en: 'Drop light tower',
cn: '放光塔',
},
darkTower: {
en: 'Drop dark tower',
cn: '放暗塔',
},
northeast: Outputs.dirNE,
northwest: Outputs.dirNW,
southeast: Outputs.dirSE,
southwest: Outputs.dirSW,
},
},
{
Expand Down

0 comments on commit ab9af74

Please sign in to comment.