From d9a7b5094cbd0ea73c73de58fe52ad1a91e96729 Mon Sep 17 00:00:00 2001
From: Nyeogmi <economicsbat@gmail.com>
Date: Sat, 22 Feb 2025 15:50:31 -0800
Subject: [PATCH] Run prettier

---
 src/button.ts           |  2 +-
 src/drawpile.ts         | 14 ++++-----
 src/endgamemodal.ts     |  5 ++--
 src/engine/datatypes.ts |  5 ++--
 src/gridart.ts          | 66 +++++++++++++----------------------------
 src/huntmode.ts         | 66 ++++++++++++++++++++++++-----------------
 src/mapgen.ts           | 34 +++++++++++++++------
 src/pickups.ts          | 53 ++++++++++++++++++++-------------
 src/skillsmodal.ts      |  2 +-
 9 files changed, 128 insertions(+), 119 deletions(-)

diff --git a/src/button.ts b/src/button.ts
index 675d1bd..250511d 100644
--- a/src/button.ts
+++ b/src/button.ts
@@ -57,6 +57,6 @@ export function addButton(
     },
     new Rect(topLeftPadded, sizePadded),
     enabled,
-    {onClick: cbClick},
+    { onClick: cbClick },
   );
 }
diff --git a/src/drawpile.ts b/src/drawpile.ts
index 5bfe804..7b4b7ab 100644
--- a/src/drawpile.ts
+++ b/src/drawpile.ts
@@ -2,12 +2,12 @@ import { D, I } from "./engine/public.ts";
 import { Rect } from "./engine/datatypes.ts";
 
 export type Handlers = {
-  onClick?: () => void,
-  onSqueeze?: () => void,
-}
+  onClick?: () => void;
+  onSqueeze?: () => void;
+};
 
 export class DrawPile {
-  #draws: { depth: number; op: () => void; handlers?: Handlers, }[];
+  #draws: { depth: number; op: () => void; handlers?: Handlers }[];
   #hoveredIndex: number | null;
 
   constructor() {
@@ -30,9 +30,9 @@ export class DrawPile {
     rect: Rect,
     enabled: boolean,
     handlers: {
-      onClick?: () => void,
-      onSqueeze?: () => void,
-    }
+      onClick?: () => void;
+      onSqueeze?: () => void;
+    },
   ) {
     let position = I.mousePosition?.offset(D.camera);
     let hovered = false;
diff --git a/src/endgamemodal.ts b/src/endgamemodal.ts
index e98df86..3dad279 100644
--- a/src/endgamemodal.ts
+++ b/src/endgamemodal.ts
@@ -348,7 +348,7 @@ export class EndgameModal {
           } else {
             this.#selectedSuccessor = ix;
           }
-        }
+        },
       },
     );
   }
@@ -402,7 +402,6 @@ export class EndgameModal {
       generalRect,
       enabled,
       {
-
         onClick: () => {
           if (this.#selectedWish == ix) {
             this.#selectedWish = null;
@@ -410,7 +409,7 @@ export class EndgameModal {
             this.#selectedWish = ix;
           }
         },
-      }
+      },
     );
   }
 
diff --git a/src/engine/datatypes.ts b/src/engine/datatypes.ts
index 341065f..bf24ac9 100644
--- a/src/engine/datatypes.ts
+++ b/src/engine/datatypes.ts
@@ -102,7 +102,7 @@ export class Point {
   snap(x: number, y: number) {
     return new Point(
       lerp(x, Math.floor(this.x), Math.ceil(this.x)),
-      lerp(y, Math.floor(this.y), Math.ceil(this.y))
+      lerp(y, Math.floor(this.y), Math.ceil(this.y)),
     );
   }
 }
@@ -141,7 +141,6 @@ export class Rect {
     return `Rect(${this.top},${this.size})`;
   }
 
-
   offset(offset: Point) {
     return new Rect(this.top.offset(offset), this.size);
   }
@@ -303,4 +302,4 @@ export function lerp(amt: number, lo: number, hi: number) {
     return hi;
   }
   return lo + (hi - lo) * amt;
-};
+}
diff --git a/src/gridart.ts b/src/gridart.ts
index 7249895..c6d11fe 100644
--- a/src/gridart.ts
+++ b/src/gridart.ts
@@ -23,20 +23,22 @@ export class GridArt {
     this.#floorCenter = atPixel.offset(CENTER);
     this.#ceilingCenter = at.scale(CEILING_CELL_SIZE).offset(CENTER);
 
-    this.#floorTl = atPixel.offset(new Point(-FLOOR_CELL_SIZE.w / 2, -FLOOR_CELL_SIZE.h / 2))
+    this.#floorTl = atPixel
+      .offset(new Point(-FLOOR_CELL_SIZE.w / 2, -FLOOR_CELL_SIZE.h / 2))
       .offset(CENTER);
     this.#ceilingTl = at
       .offset(new Point(-0.5, -0.5))
       .scale(CEILING_CELL_SIZE)
       .offset(CENTER)
-      .snap(0, 0)
-    this.#floorBr = atPixel.offset(new Point(FLOOR_CELL_SIZE.w / 2, FLOOR_CELL_SIZE.h / 2))
+      .snap(0, 0);
+    this.#floorBr = atPixel
+      .offset(new Point(FLOOR_CELL_SIZE.w / 2, FLOOR_CELL_SIZE.h / 2))
       .offset(CENTER);
     this.#ceilingBr = at
       .offset(new Point(0.5, 0.5))
       .scale(CEILING_CELL_SIZE)
       .offset(CENTER)
-      .snap(0, 0)
+      .snap(0, 0);
 
     // console.log(`floorTl: ${this.#floorTl}`)
     // console.log(`floorBr: ${this.#floorBr}`)
@@ -102,14 +104,18 @@ export class GridArt {
     if (this.#atPixel.y < -FLOOR_CELL_SIZE.h / 2) {
       return;
     }
-    new GridArt(this.#atPixel.offset(new Point(0, FLOOR_CELL_SIZE.h))).#drawWallTop(color);
+    new GridArt(
+      this.#atPixel.offset(new Point(0, FLOOR_CELL_SIZE.h)),
+    ).#drawWallTop(color);
   }
 
   drawWallRight(color: Color) {
     if (this.#atPixel.x < -FLOOR_CELL_SIZE.w / 2) {
       return;
     }
-    new GridArt(this.#atPixel.offset(new Point(FLOOR_CELL_SIZE.w, 0))).#drawWallLeft(color);
+    new GridArt(
+      this.#atPixel.offset(new Point(FLOOR_CELL_SIZE.w, 0)),
+    ).#drawWallLeft(color);
   }
 
   drawMouldingTop(color: Color) {
@@ -118,11 +124,7 @@ export class GridArt {
     let x1 = this.#ceilingBr.x;
     let y1 = this.#ceilingTl.y;
 
-    D.fillRect(
-      new Point(x0, y0),
-      new Size(x1 - x0, y1 - y0),
-      color
-    );
+    D.fillRect(new Point(x0, y0), new Size(x1 - x0, y1 - y0), color);
   }
 
   drawMouldingTopLeft(color: Color) {
@@ -131,11 +133,7 @@ export class GridArt {
     let x1 = this.#ceilingTl.x;
     let y1 = this.#ceilingTl.y;
 
-    D.fillRect(
-      new Point(x0, y0),
-      new Size(x1 - x0, y1 - y0),
-      color
-    );
+    D.fillRect(new Point(x0, y0), new Size(x1 - x0, y1 - y0), color);
   }
 
   drawMouldingLeft(color: Color) {
@@ -144,11 +142,7 @@ export class GridArt {
     let x1 = this.#ceilingTl.x;
     let y1 = this.#ceilingBr.y;
 
-    D.fillRect(
-      new Point(x0, y0),
-      new Size(x1 - x0, y1 - y0),
-      color
-    );
+    D.fillRect(new Point(x0, y0), new Size(x1 - x0, y1 - y0), color);
   }
 
   drawMouldingTopRight(color: Color) {
@@ -157,11 +151,7 @@ export class GridArt {
     let x1 = this.#ceilingBr.x + MOULDING_SZ.w;
     let y1 = this.#ceilingTl.y;
 
-    D.fillRect(
-      new Point(x0, y0),
-      new Size(x1 - x0, y1 - y0),
-      color
-    );
+    D.fillRect(new Point(x0, y0), new Size(x1 - x0, y1 - y0), color);
   }
 
   drawMouldingBottom(color: Color) {
@@ -170,11 +160,7 @@ export class GridArt {
     let x1 = this.#ceilingBr.x;
     let y1 = this.#ceilingBr.y + MOULDING_SZ.h;
 
-    D.fillRect(
-      new Point(x0, y0),
-      new Size(x1 - x0, y1 - y0),
-      color
-    );
+    D.fillRect(new Point(x0, y0), new Size(x1 - x0, y1 - y0), color);
   }
 
   drawMouldingBottomLeft(color: Color) {
@@ -183,11 +169,7 @@ export class GridArt {
     let x1 = this.#ceilingTl.x;
     let y1 = this.#ceilingBr.y + MOULDING_SZ.h;
 
-    D.fillRect(
-      new Point(x0, y0),
-      new Size(x1 - x0, y1 - y0),
-      color,
-    );
+    D.fillRect(new Point(x0, y0), new Size(x1 - x0, y1 - y0), color);
   }
 
   drawMouldingRight(color: Color) {
@@ -196,11 +178,7 @@ export class GridArt {
     let x1 = this.#ceilingBr.x + MOULDING_SZ.w;
     let y1 = this.#ceilingBr.y;
 
-    D.fillRect(
-      new Point(x0, y0),
-      new Size(x1 - x0, y1 - y0),
-      color
-    );
+    D.fillRect(new Point(x0, y0), new Size(x1 - x0, y1 - y0), color);
   }
 
   drawMouldingBottomRight(color: Color) {
@@ -209,11 +187,7 @@ export class GridArt {
     let x1 = this.#ceilingBr.x + MOULDING_SZ.w;
     let y1 = this.#ceilingBr.y + MOULDING_SZ.h;
 
-    D.fillRect(
-      new Point(x0, y0),
-      new Size(x1 - x0, y1 - y0),
-      color
-    );
+    D.fillRect(new Point(x0, y0), new Size(x1 - x0, y1 - y0), color);
   }
 
   drawCeiling(color: Color) {
diff --git a/src/huntmode.ts b/src/huntmode.ts
index da5bce0..c923e4b 100644
--- a/src/huntmode.ts
+++ b/src/huntmode.ts
@@ -1,7 +1,7 @@
-import {Point, Rect, Size} from "./engine/datatypes.ts";
-import {DrawPile} from "./drawpile.ts";
-import {D, I} from "./engine/public.ts";
-import {sprThrallLore} from "./sprites.ts";
+import { Point, Rect, Size } from "./engine/datatypes.ts";
+import { DrawPile } from "./drawpile.ts";
+import { D, I } from "./engine/public.ts";
+import { sprThrallLore } from "./sprites.ts";
 import {
   BG_INSET,
   BG_WALL_OR_UNREVEALED,
@@ -11,11 +11,11 @@ import {
   FG_TEXT_ENDORSED,
   FG_TOO_EXPENSIVE,
 } from "./colors.ts";
-import {getPlayerProgress} from "./playerprogress.ts";
-import {Architecture, LoadedNewMap} from "./newmap.ts";
-import {FLOOR_CELL_SIZE, GridArt} from "./gridart.ts";
-import {shadowcast} from "./shadowcast.ts";
-import {withCamera} from "./layout.ts";
+import { getPlayerProgress } from "./playerprogress.ts";
+import { Architecture, LoadedNewMap } from "./newmap.ts";
+import { FLOOR_CELL_SIZE, GridArt } from "./gridart.ts";
+import { shadowcast } from "./shadowcast.ts";
+import { withCamera } from "./layout.ts";
 
 export class HuntMode {
   map: LoadedNewMap;
@@ -49,9 +49,13 @@ export class HuntMode {
 
   get pixelPlayer(): Point {
     return new Point(
-      Math.floor(this.floatingPlayer.x * FLOOR_CELL_SIZE.w - FLOOR_CELL_SIZE.w / 2),
-      Math.floor(this.floatingPlayer.y * FLOOR_CELL_SIZE.h - FLOOR_CELL_SIZE.h / 2),
-    )
+      Math.floor(
+        this.floatingPlayer.x * FLOOR_CELL_SIZE.w - FLOOR_CELL_SIZE.w / 2,
+      ),
+      Math.floor(
+        this.floatingPlayer.y * FLOOR_CELL_SIZE.h - FLOOR_CELL_SIZE.h / 2,
+      ),
+    );
   }
 
   getDepth() {
@@ -126,9 +130,7 @@ export class HuntMode {
     this.frame += 1;
     this.drawpile.clear();
 
-    let globalOffset = this.pixelPlayer.offset(
-      new Point(-192, -192)
-    );
+    let globalOffset = this.pixelPlayer.offset(new Point(-192, -192));
 
     this.#updatePlayer();
     this.#updateFov();
@@ -136,9 +138,9 @@ export class HuntMode {
 
     for (let y = 0; y < this.map.size.h; y += 1) {
       for (let x = 0; x < this.map.size.w; x += 1) {
-        let offsetInPixels = new Point(x, y).scale(FLOOR_CELL_SIZE).offset(
-          this.pixelPlayer.negate()
-        );
+        let offsetInPixels = new Point(x, y)
+          .scale(FLOOR_CELL_SIZE)
+          .offset(this.pixelPlayer.negate());
         this.#drawMapCell(offsetInPixels, new Point(x, y));
       }
     }
@@ -155,10 +157,18 @@ export class HuntMode {
 
     let amt = 0.005;
 
-    if (I.isKeyDown("w")) { dy -= amt; }
-    if (I.isKeyDown("s")) { dy += amt; }
-    if (I.isKeyDown("a")) { dx -= amt; }
-    if (I.isKeyDown("d")) { dx += amt; }
+    if (I.isKeyDown("w")) {
+      dy -= amt;
+    }
+    if (I.isKeyDown("s")) {
+      dy += amt;
+    }
+    if (I.isKeyDown("a")) {
+      dx -= amt;
+    }
+    if (I.isKeyDown("d")) {
+      dx += amt;
+    }
 
     dx *= 0.9;
     dy *= 0.9;
@@ -174,8 +184,8 @@ export class HuntMode {
 
       let bbox = new Rect(
         newXy.offset(new Point(-szX / 2, -szY / 2)),
-        new Size(szX, szY)
-      )
+        new Size(szX, szY),
+      );
 
       for (let cell of bbox.overlappedCells(new Size(1, 1)).values()) {
         if (this.#blocksMovement(cell.top)) {
@@ -189,8 +199,8 @@ export class HuntMode {
 
       bbox = new Rect(
         newXy.offset(new Point(-szX / 2, -szY / 2)),
-        new Size(szX, szY)
-      )
+        new Size(szX, szY),
+      );
 
       for (let cell of bbox.overlappedCells(new Size(1, 1)).values()) {
         if (this.#blocksMovement(cell.top)) {
@@ -326,8 +336,8 @@ export class HuntMode {
             return;
           }
           pickup?.onSqueeze(cellData);
-        }
-      }
+        },
+      },
     );
 
     if (pickup != null) {
diff --git a/src/mapgen.ts b/src/mapgen.ts
index f85f814..2417b71 100644
--- a/src/mapgen.ts
+++ b/src/mapgen.ts
@@ -4,9 +4,11 @@ import { choose, shuffle } from "./utils.ts";
 import { standardVaultTemplates, VaultTemplate } from "./vaulttemplate.ts";
 import { ALL_STATS } from "./datatypes.ts";
 import {
-  BreakableBlockPickup, ExperiencePickupCallbacks,
+  BreakableBlockPickup,
+  ExperiencePickupCallbacks,
   LadderPickup,
-  LockPickup, StatPickupCallbacks,
+  LockPickup,
+  StatPickupCallbacks,
   ThrallItemPickup,
   ThrallPickup,
 } from "./pickups.ts";
@@ -278,21 +280,27 @@ function carveVault(knife: Knife, room: Rect, vaultTemplate: VaultTemplate) {
       if (!(a.contains(xy) || b.contains(xy))) {
         stat = vaultTemplate.stats.secondary;
       }
-      knife.map.get(xy).pickup = new BreakableBlockPickup(new StatPickupCallbacks(stat));
+      knife.map.get(xy).pickup = new BreakableBlockPickup(
+        new StatPickupCallbacks(stat),
+      );
     }
   }
 
   for (let dy = 0; dy < c.size.h; dy++) {
     for (let dx = 0; dx < c.size.w; dx++) {
       let xy = c.top.offset(new Point(dx, dy));
-      knife.map.get(xy).pickup = new BreakableBlockPickup(new StatPickupCallbacks(vaultTemplate.stats.primary));
+      knife.map.get(xy).pickup = new BreakableBlockPickup(
+        new StatPickupCallbacks(vaultTemplate.stats.primary),
+      );
     }
   }
 
   for (let dy = 0; dy < d.size.h; dy++) {
     for (let dx = 0; dx < d.size.w; dx++) {
       let xy = d.top.offset(new Point(dx, dy));
-      knife.map.get(xy).pickup = new BreakableBlockPickup(new StatPickupCallbacks(vaultTemplate.stats.primary));
+      knife.map.get(xy).pickup = new BreakableBlockPickup(
+        new StatPickupCallbacks(vaultTemplate.stats.primary),
+      );
     }
   }
 
@@ -394,10 +402,18 @@ function carveRoom(knife: Knife, room: Rect, label?: string) {
         new Point(room.size.w - dx - 1, room.size.h - dy - 1),
       );
       let stat = choose(ALL_STATS);
-      knife.map.get(xy0).pickup = new BreakableBlockPickup(new StatPickupCallbacks(stat));
-      knife.map.get(xy1).pickup = new BreakableBlockPickup(new StatPickupCallbacks(stat));
-      knife.map.get(xy2).pickup = new BreakableBlockPickup(new StatPickupCallbacks(stat));
-      knife.map.get(xy3).pickup = new BreakableBlockPickup(new StatPickupCallbacks(stat));
+      knife.map.get(xy0).pickup = new BreakableBlockPickup(
+        new StatPickupCallbacks(stat),
+      );
+      knife.map.get(xy1).pickup = new BreakableBlockPickup(
+        new StatPickupCallbacks(stat),
+      );
+      knife.map.get(xy2).pickup = new BreakableBlockPickup(
+        new StatPickupCallbacks(stat),
+      );
+      knife.map.get(xy3).pickup = new BreakableBlockPickup(
+        new StatPickupCallbacks(stat),
+      );
     }
   }
 }
diff --git a/src/pickups.ts b/src/pickups.ts
index 6345084..37917a4 100644
--- a/src/pickups.ts
+++ b/src/pickups.ts
@@ -62,17 +62,17 @@ export class LockPickup {
     }
   }
 
-  update() { }
+  update() {}
 
   onClick(cell: CellView): boolean {
     getCheckModal().show(this.check, () => (cell.pickup = null));
     return true;
   }
 
-  onSqueeze() { }
+  onSqueeze() {}
 }
 
-const RECOVERY_PER_TICK: number = 0.10;
+const RECOVERY_PER_TICK: number = 0.1;
 export class BreakableBlockPickup {
   callbacks: StatPickupCallbacks | ExperiencePickupCallbacks;
   breakProgress: number;
@@ -133,21 +133,29 @@ export class BreakableBlockPickup {
   }
 
   onSqueeze(_cellData: CellView) {
-    this.breakProgress = Math.min(this.breakProgress + 0.02 + RECOVERY_PER_TICK, 1.0);
+    this.breakProgress = Math.min(
+      this.breakProgress + 0.02 + RECOVERY_PER_TICK,
+      1.0,
+    );
   }
 }
 
 export class StatPickupCallbacks {
-  #stat: Stat
+  #stat: Stat;
 
-  constructor(stat: Stat) { this.#stat = stat; }
+  constructor(stat: Stat) {
+    this.#stat = stat;
+  }
 
   obtain() {
     getPlayerProgress().add(this.#stat, 1);
     getPlayerProgress().purloinItem();
   }
 
-  draw(at: Point, options: {xScale?: number, yScale?: number, angle?: number}) {
+  draw(
+    at: Point,
+    options: { xScale?: number; yScale?: number; angle?: number },
+  ) {
     let statIndex = ALL_STATS.indexOf(this.#stat);
     if (statIndex == -1) {
       return;
@@ -158,14 +166,17 @@ export class StatPickupCallbacks {
 }
 
 export class ExperiencePickupCallbacks {
-  constructor() { }
+  constructor() {}
 
   obtain() {
     getPlayerProgress().addExperience(250);
     getPlayerProgress().purloinItem();
   }
 
-  draw(at: Point, options: {xScale?: number, yScale?: number, angle?: number}) {
+  draw(
+    at: Point,
+    options: { xScale?: number; yScale?: number; angle?: number },
+  ) {
     D.drawSprite(sprResourcePickup, at, 0, options);
   }
 }
@@ -199,7 +210,7 @@ export class LadderPickup {
   }
   drawInAir() {}
 
-  update() { }
+  update() {}
 
   onClick(): boolean {
     getPlayerProgress().addBlood(1000);
@@ -207,7 +218,7 @@ export class LadderPickup {
     return false;
   }
 
-  onSqueeze() { }
+  onSqueeze() {}
 }
 
 export class ThrallPickup {
@@ -246,7 +257,7 @@ export class ThrallPickup {
     });
   }
 
-  update() { }
+  update() {}
 
   onClick(cell: CellView): boolean {
     let data = getThralls().get(this.thrall);
@@ -257,7 +268,7 @@ export class ThrallPickup {
     return true;
   }
 
-  onSqueeze() { }
+  onSqueeze() {}
 }
 
 export class ThrallPosterPickup {
@@ -296,7 +307,7 @@ export class ThrallPosterPickup {
     });
   }
 
-  update() { }
+  update() {}
 
   onClick(cell: CellView): boolean {
     let data = getThralls().get(this.thrall);
@@ -304,7 +315,7 @@ export class ThrallPosterPickup {
     return true;
   }
 
-  onSqueeze() { }
+  onSqueeze() {}
 }
 
 export class ThrallRecruitedPickup {
@@ -359,7 +370,7 @@ export class ThrallRecruitedPickup {
     });
   }
 
-  update() { }
+  update() {}
 
   onClick(_cell: CellView): boolean {
     this.spokenTo = true;
@@ -408,7 +419,7 @@ export class ThrallRecruitedPickup {
     return true;
   }
 
-  onSqueeze() { }
+  onSqueeze() {}
 }
 
 export class ThrallCollectionPlatePickup {
@@ -476,7 +487,7 @@ export class ThrallCollectionPlatePickup {
     }
   }
 
-  update() { }
+  update() {}
 
   onClick(_cell: CellView): boolean {
     let lifeStage = getPlayerProgress().getThrallLifeStage(this.thrall);
@@ -536,7 +547,7 @@ export class ThrallCollectionPlatePickup {
     return true;
   }
 
-  onSqueeze() { }
+  onSqueeze() {}
 }
 
 export class ThrallItemPickup {
@@ -575,7 +586,7 @@ export class ThrallItemPickup {
     });
   }
 
-  update() { }
+  update() {}
 
   onClick(cell: CellView): boolean {
     let data = getThralls().get(this.thrall);
@@ -592,5 +603,5 @@ export class ThrallItemPickup {
     return true;
   }
 
-  onSqueeze() { }
+  onSqueeze() {}
 }
diff --git a/src/skillsmodal.ts b/src/skillsmodal.ts
index a8cb43c..234a213 100644
--- a/src/skillsmodal.ts
+++ b/src/skillsmodal.ts
@@ -103,7 +103,7 @@ export class SkillsModal {
           onClick: () => {
             this.#skillSelection = skill;
           },
-        }
+        },
       );
       y += 16;
     });