From dd6bdaea52183f595e681ec586f5af3347f6e627 Mon Sep 17 00:00:00 2001 From: XP Date: Sat, 3 Aug 2024 18:40:34 -0700 Subject: [PATCH 1/2] Update lint rules to add commas --- eslint.config.js | 7 +++++++ packages/frontend/src/scripts/sims/tank/pld/pldsks_sim.ts | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index d96113a5..cbf4913a 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -29,6 +29,13 @@ export default [ "setWithoutGet": true } ], + "comma-spacing": [ + "error", + { + "before": false, + "after": true, + } + ], "@typescript-eslint/no-this-alias": [ "off" ] diff --git a/packages/frontend/src/scripts/sims/tank/pld/pldsks_sim.ts b/packages/frontend/src/scripts/sims/tank/pld/pldsks_sim.ts index d48c5e13..3922b542 100644 --- a/packages/frontend/src/scripts/sims/tank/pld/pldsks_sim.ts +++ b/packages/frontend/src/scripts/sims/tank/pld/pldsks_sim.ts @@ -80,7 +80,7 @@ class PaladinStateSystem { debugState() { - console.log( [ this.combo_state , this.sword_oath , this.divine_might ].toString() ); + console.log( [ this.combo_state, this.sword_oath, this.divine_might ].toString() ); } } @@ -653,7 +653,7 @@ export class PldSKSSheetSim extends BaseMultiCycleSim Date: Mon, 26 Aug 2024 13:14:12 -0700 Subject: [PATCH 2/2] Fix lint --- .../src/scripts/sims/tank/pld/pldsks_sim.ts | 338 +++++++----------- 1 file changed, 127 insertions(+), 211 deletions(-) diff --git a/packages/frontend/src/scripts/sims/tank/pld/pldsks_sim.ts b/packages/frontend/src/scripts/sims/tank/pld/pldsks_sim.ts index 2a9776f4..6ddc3d47 100644 --- a/packages/frontend/src/scripts/sims/tank/pld/pldsks_sim.ts +++ b/packages/frontend/src/scripts/sims/tank/pld/pldsks_sim.ts @@ -1,21 +1,23 @@ import {GcdAbility, OgcdAbility, SimSettings, SimSpec} from "@xivgear/core/sims/sim_types"; -import {CycleProcessor, CycleSimResult, ExternalCycleSettings, MultiCycleSettings, - AbilityUseResult, Rotation} from "@xivgear/core/sims/cycle_sim"; +import { + AbilityUseResult, + CycleProcessor, + CycleSimResult, + ExternalCycleSettings, + MultiCycleSettings, + Rotation +} from "@xivgear/core/sims/cycle_sim"; import {STANDARD_ANIMATION_LOCK} from "@xivgear/xivmath/xivconstants"; import {BaseMultiCycleSim} from "../../sim_processors"; import * as Actions from './pld_actions_sks'; import * as Buffs from './pld_buffs_sks'; -import { - FieldBoundCheckBox, - labeledCheckbox, - labelFor -} from "@xivgear/common-ui/components/util"; +import {FieldBoundCheckBox, labeledCheckbox, labelFor} from "@xivgear/common-ui/components/util"; // keys for Action records structures: -type PldEnum_GCD = "Fast" | "Riot" | "Royal" | "HS" | "HSHC" | "Atone" | - "Supp" | "Sep" | "Gore" | "Conf" | "Faith" | "Truth" | "Valor" ; +type PldEnum_GCD = "Fast" | "Riot" | "Royal" | "HS" | "HSHC" | "Atone" | + "Supp" | "Sep" | "Gore" | "Conf" | "Faith" | "Truth" | "Valor"; -type PldEnum_oGCD = "Exp" | "Cos" | "Imp" | "Honor" | "Int" | "FOF"; +type PldEnum_oGCD = "Exp" | "Cos" | "Imp" | "Honor" | "Int" | "FOF"; // self reminder: const != immutable, just a constant reference const ActionRecord_GCD: Record = { @@ -54,23 +56,18 @@ class PaladinStateSystem { sword_oath: number = 0; divine_might: boolean = false; - perform_action(GCDused: GcdAbility) - { - if (GCDused == ActionRecord_GCD["Fast"]) - { + perform_action(GCDused: GcdAbility) { + if (GCDused == ActionRecord_GCD["Fast"]) { this.combo_state = 2; } - else if (GCDused == ActionRecord_GCD["Riot"]) - { + else if (GCDused == ActionRecord_GCD["Riot"]) { if (this.combo_state == 2) this.combo_state = 3; else this.combo_state = 0; } - else if (GCDused == ActionRecord_GCD["Royal"]) - { - if (this.combo_state == 3) - { + else if (GCDused == ActionRecord_GCD["Royal"]) { + if (this.combo_state == 3) { this.combo_state = 1; this.divine_might = true; this.sword_oath = this.sword_oath | this.A1Ready @@ -78,40 +75,33 @@ class PaladinStateSystem { else this.combo_state = 0; } - else if (GCDused == ActionRecord_GCD["HS"]) - { + else if (GCDused == ActionRecord_GCD["HS"]) { // Consume Divine Might: this.divine_might = false; } - else if (GCDused == ActionRecord_GCD["Atone"]) - { - if (this.sword_oath & this.A1Ready) - { + else if (GCDused == ActionRecord_GCD["Atone"]) { + if (this.sword_oath & this.A1Ready) { // Remove AtonementReady, Add Supplication Ready this.sword_oath = (this.sword_oath & ~this.A1Ready) | this.A2Ready; } } - else if (GCDused == ActionRecord_GCD["Supp"]) - { - if (this.sword_oath & this.A2Ready) - { + else if (GCDused == ActionRecord_GCD["Supp"]) { + if (this.sword_oath & this.A2Ready) { // Remove Supplication Ready, Add Sepulchre Ready this.sword_oath = (this.sword_oath & ~this.A2Ready) | this.A3Ready; } } - else if (GCDused == ActionRecord_GCD["Sep"]) - { - if (this.sword_oath & this.A3Ready) - { + else if (GCDused == ActionRecord_GCD["Sep"]) { + if (this.sword_oath & this.A3Ready) { // Remove Sepulchre Ready this.sword_oath = (this.sword_oath & (~this.A3Ready)); } } } - + debugState() { - console.log( [ this.combo_state, this.sword_oath, this.divine_might ].toString() ); + console.log([this.combo_state, this.sword_oath, this.divine_might].toString()); } } @@ -150,9 +140,9 @@ export const pldSKSSheetSpec: SimSpec readyAt) { @@ -491,21 +475,20 @@ export class PldSKSSheetSim extends BaseMultiCycleSim 2.49 && !strategy_hubris) - { - if (sim.settings.alwaysLateWeave) - { + if (physGCD > 2.49 && !strategy_hubris) { + if (sim.settings.alwaysLateWeave) { cp.addSpecialRow(`Late Weaving FOF at 2.50, OK! (Override)`); strategy_always9 = true; strategy_special250late = false; } - else - { + else { cp.addSpecialRow(`No SKS to consider due to 2.5 GCD`); strategy_250 = true; } } - else if (strategy_hubris) - { + else if (strategy_hubris) { cp.addSpecialRow(``); cp.addSpecialRow(`SKS Rotations are disabled.`); cp.addSpecialRow(`Sim will DELIBERATELY CLIP GCD`); @@ -560,71 +539,59 @@ export class PldSKSSheetSim extends BaseMultiCycleSim 2.46 || sim.settings.justMinimiseDrift) - { - if (sim.settings.justMinimiseDrift) - { + else if (physGCD > 2.46 || sim.settings.justMinimiseDrift) { + if (sim.settings.justMinimiseDrift) { cp.addSpecialRow(`Just minimising drift, use FOF on CD always`); strategy_minimise = true; } // However we have setting over rides to force our hand: - else if (sim.settings.alwaysLateWeave == true) - { + else if (sim.settings.alwaysLateWeave == true) { cp.addSpecialRow(`Late FOF w/2.43+ GCD (Override)`); cp.addSpecialRow(`(+personal pps, --alignment & big drift)`); strategy_always9 = true; } - else if (sim.settings.attempt9GCDAbove247 == true) - { + else if (sim.settings.attempt9GCDAbove247 == true) { cp.addSpecialRow(`9/8 FOF w/2.47+ GCD (Override)`); strategy_98_alt = true; } - else - { + else { cp.addSpecialRow(`2.47+ GCD, aim to minimise drift`); strategy_minimise = true; } } - // At 2.43 to 2.46, it should be possible to alternate a 9 GCD and an 8 GCD - // FOF to minimise drift, and just get a little extra from party buffs + // At 2.43 to 2.46, it should be possible to alternate a 9 GCD and an 8 GCD + // FOF to minimise drift, and just get a little extra from party buffs // It's so, so little though, lol. - else if (physGCD > 2.42) - { + else if (physGCD > 2.42) { // 2.43 specifically is cursed: - if (physGCD < 2.44) - { + if (physGCD < 2.44) { cp.addSpecialRow(`2.43 Phys GCD is particularly challenging.`); cp.addSpecialRow(`It either delays fof significantly`); cp.addSpecialRow(`or risks clipping it's GCD to do 9/8`); - if (sim.settings.alwaysLateWeave) - { + if (sim.settings.alwaysLateWeave) { strategy_always9 = true; cp.addSpecialRow(`Late FOF w/2.43 GCD (Override)`); cp.addSpecialRow(`(+personal pps, -buff alignment`); } - else - { + else { strategy_98_alt = true; strategy_98_force = true; cp.addSpecialRow(`Presenting CLIP strat (+buff alignment, -potency)`); cp.addSpecialRow(`(consider the 'always late' sim option)`); } } - else - { + else { // If we're 2.44 - 2.46 - if (sim.settings.alwaysLateWeave == true) - { + if (sim.settings.alwaysLateWeave == true) { cp.addSpecialRow(`Late FOF w/2.43+ GCD (Override)`); cp.addSpecialRow(`(+personal pps, -buff alignment)`); strategy_always9 = true; } - else - { + else { cp.addSpecialRow(`2.44-2.46 GCD, alternating 9/8 FOFs`); cp.addSpecialRow(`(+buff alignment, low drift)`); strategy_98_alt = true; @@ -632,34 +599,28 @@ export class PldSKSSheetSim extends BaseMultiCycleSim 2.36) - { + else if (physGCD > 2.36) { cp.addSpecialRow(`Always Late FOF at 2.37+ GCD`); strategy_always9 = true; } // Below that, things get weird, so let's just rely on the sim's override options: - else - { + else { cp.addSpecialRow(`Phys GCD very low! Use Overrides to trial behavior:`); - if (sim.settings.alwaysLateWeave == true) - { + if (sim.settings.alwaysLateWeave == true) { cp.addSpecialRow(`Always late override, Late FOFs`); strategy_always9 = true; } - else if (sim.settings.attempt9GCDAbove247 == true) - { + else if (sim.settings.attempt9GCDAbove247 == true) { cp.addSpecialRow(`9/8 Override, will late weave evens`); strategy_98_alt = true; } - else - { + else { cp.addSpecialRow(`No Overrides, Minimizing Drift`); strategy_minimise = true; } } - if (!strategy_250 && physGCD != 2.50) - { + if (!strategy_250 && physGCD != 2.50) { cp.addSpecialRow(""); cp.addSpecialRow("This strategy will delay FOF in some way"); cp.addSpecialRow("Big delays = misalign from party buffs"); @@ -667,15 +628,13 @@ export class PldSKSSheetSim extends BaseMultiCycleSim> Always 9 GCD FOF: Hold Atonement`); } // We will not set our loop up to attempt a special first burst @@ -723,12 +677,10 @@ export class PldSKSSheetSim extends BaseMultiCycleSim> Override: Bursting 1 GCD earlier") } @@ -748,52 +700,45 @@ export class PldSKSSheetSim extends BaseMultiCycleSim 0) && (safety < 100000) ) { + while ((cp.remainingGcdTime > 0) && (safety < 100000)) { // While loops with no safety clause! safety++; - if (strategy_minimise || strategy_98_alt || strategy_hubris) - { + if (strategy_minimise || strategy_98_alt || strategy_hubris) { // if we are forcing 9/8s, we can't rely on canUseWithoutClipping // this is because: we will clip, lol. // We also want to provide feedback on if we delayed FOF across a GCD - + const readyAt = fof_delay_tracker_next; const next_early = cp.nextGcdTime + STANDARD_ANIMATION_LOCK; // note that this is the going to delay up to the earliest weave after the next GCD: - if (readyAt > cp.currentTime && readyAt < ( next_early )) - { + if (readyAt > cp.currentTime && readyAt < (next_early)) { // If this is going to collide with the next GCD, we want to know about it // If we are forcing 98s and this is an even minute, we will get our awareness // elsewhere: if ((strategy_98_force && even_minute)) force_next_burst = true; - else - { + else { const is_after_late_weave_limit = (readyAt > (cp.nextGcdTime - STANDARD_ANIMATION_LOCK)); const is_after_next_gcd = readyAt > cp.nextGcdTime; // Otherwise, add to the log what we are doing: - if (is_after_late_weave_limit) - { - if (strategy_hubris) - { + if (is_after_late_weave_limit) { + if (strategy_hubris) { cp.addSpecialRow(">> FOF comes up in " + (readyAt - cp.currentTime).toFixed(2) + "s"); - if (is_after_next_gcd) - { + if (is_after_next_gcd) { cp.addSpecialRow(">> This is after the next GCD."); cp.addSpecialRow(">> A non-sks inclined player likely uses the GCD"); cp.addSpecialRow(">> Delaying FOF by " + (next_early - readyAt).toFixed(2) + "s"); } - else - { + else { cp.addSpecialRow(">> Clipping once available!"); cp.advanceTo(readyAt); force_next_burst = true; } } else - cp.addSpecialRow(">> Delaying FOF " + (next_early - readyAt).toFixed(2) + "s across GCD...", readyAt); + cp.addSpecialRow(">> Delaying FOF " + (next_early - readyAt).toFixed(2) + "s across GCD...", readyAt); } } } @@ -801,58 +746,48 @@ export class PldSKSSheetSim extends BaseMultiCycleSim> Using FOF ASAP`); cp.useOgcd(ActionRecord_oGCD["FOF"]); } - else - { + else { // Should we try to late weave? // DANGER DANGER: Magic number: //let fof_is_not_early = cp.cdTracker.statusOf(ActionRecord_oGCD["FOF"]).readyAt.relative > 1.0; // if we are on an even minute, and we're 98ing - if ((strategy_98_alt && even_minute) || strategy_always9) - { + if ((strategy_98_alt && even_minute) || strategy_always9) { const readyAt = fof_delay_tracker_next; cp.addSpecialRow(`>> FOF Ready, Late Weaving FOF!`, readyAt); // if force is on, we are here because we are clipping our GCD: - if (strategy_98_force) - { - if (!cp.canUseWithoutClipping(ActionRecord_oGCD["FOF"])) - { + if (strategy_98_force) { + if (!cp.canUseWithoutClipping(ActionRecord_oGCD["FOF"])) { const beforeGCD = cp.nextGcdTime; cp.delayForOgcd(ActionRecord_oGCD["FOF"]); const clip_amount = cp.nextGcdTime - beforeGCD; cp.addSpecialRow("! ALERT ! Clipped GCD! " + (clip_amount).toFixed(2) + "s"); clip_total_time += clip_amount; } - else - { + else { cp.useOgcdLateWeave(ActionRecord_oGCD["FOF"], sim.settings.useHyperRobotPrecision); } } - else - { + else { // a normal late weave is fine: cp.useOgcdLateWeave(ActionRecord_oGCD["FOF"], sim.settings.useHyperRobotPrecision); } - if (fofs_used != 0) - { + if (fofs_used != 0) { const fofUsedTime = cp.currentTime - STANDARD_ANIMATION_LOCK; const delayedBy = fofUsedTime - readyAt; cp.addSpecialRow(`>> Delay to FOF: ` + (delayedBy).toFixed(2) + `s`, fofUsedTime); } } - else - { + else { cp.addSpecialRow(`Using FOF ASAP`); cp.useOgcd(ActionRecord_oGCD["FOF"]); } @@ -863,27 +798,25 @@ export class PldSKSSheetSim extends BaseMultiCycleSim> Final burst GCD:`); - if (sim.settings.simulateMissing9th && burstGCDsUsed == 3) - { + if (sim.settings.simulateMissing9th && burstGCDsUsed == 3) { cp.advanceTo(cp.nextGcdTime); cp.addSpecialRow(`>> (option) Simming this GCD misses FOF:`); cp.removeBuff(Buffs.FightOrFlightBuff); @@ -1012,19 +937,17 @@ export class PldSKSSheetSim extends BaseMultiCycleSim> 9/8 Even min: Hold Atonement`); else cp.addSpecialRow(`>> 9/8 Odd min: Spend Atonement`); } } - + // If there are fewer than 20 seconds remaining in the user selected // time window: - if (cp.remainingTime < 20 && !end_of_time_burn && !sim.settings.disableBurnDown) - { + if (cp.remainingTime < 20 && !end_of_time_burn && !sim.settings.disableBurnDown) { cp.addSpecialRow("Less than 20s remain on sim!"); cp.addSpecialRow("Will now burn GCD resources."); cp.addSpecialRow("Replace new combo w/HS in last 3 GCDs"); @@ -1032,8 +955,7 @@ export class PldSKSSheetSim extends BaseMultiCycleSim 0) - { + if ((cp.nextGcdTime - beforeGCD) > 0) { const clip_amount = cp.nextGcdTime - beforeGCD; cp.addSpecialRow("! ALERT ! Clipped GCD! " + (clip_amount).toFixed(2) + "s"); clip_total_time += clip_amount; @@ -1061,8 +980,7 @@ export class PldSKSSheetSim extends BaseMultiCycleSim 0.01) - { + if (avg_delay_fof > 0.01) { const three_gcd_delay = 7.5 / avg_delay_fof; cp.addSpecialRow("Burst hits 7.5s delay @ ~" + three_gcd_delay.toFixed(0) + "m"); cp.addSpecialRow("Delay interacts with Party Buffs."); } - if (clip_total_time > 0.01) - { + if (clip_total_time > 0.01) { cp.addSpecialRow("! ALERT !: Total clip time: " + clip_total_time.toFixed(2) + "s"); cp.addSpecialRow("Avg of " + ((clip_total_time / cp.currentTime) * 60).toFixed(2) + "s Clip every min"); }