Compare commits

...
17 Commits
Author SHA1 Message Date
Warren H ff64c6ddcc Android build v1.1.32 2026-07-07 15:07:14 -04:00
Warren H a6cca2810c Android build v1.1.31 2026-07-06 23:49:14 -04:00
Warren H f48e6130b8 Android build v1.1.30 2026-07-06 15:35:18 -04:00
Warren H 61de17d63e Android build v1.1.29 2026-07-06 15:31:42 -04:00
Warren H 5629041879 Android build v1.1.29 2026-07-06 15:30:04 -04:00
Warren H ed3f43c93f Android build v1.1.28 2026-07-06 13:03:33 -04:00
Warren H d70941f43e Android build v1.1.27 2026-07-06 11:46:53 -04:00
Warren H de2f86e101 Android build v1.1.26 2026-07-05 23:31:04 -04:00
Warren H 62dc51b42a Android build v1.1.26 2026-07-05 23:21:37 -04:00
Warren H defbf0ce10 Android build v1.1.25 2026-07-05 22:51:34 -04:00
Warren H d70f916f31 Android build v1.1.24 2026-07-05 22:49:25 -04:00
Warren H 9708ba9e40 Android build v1.1.23 2026-07-05 22:48:56 -04:00
Warren H 956c9e32f9 Android build v1.1.22 2026-07-05 12:08:11 -04:00
Warren H 547044892d Android build v1.1.21 2026-07-04 21:15:29 -04:00
Warren H 81d65bc381 Android build v1.1.20 2026-07-04 21:15:04 -04:00
Warren H bdae0007a1 Android build v1.1.19 2026-07-04 20:50:33 -04:00
Warren H c052b086f8 Android build v1.1.18 2026-07-04 19:31:58 -04:00
170 changed files with 15283 additions and 805 deletions
+37
View File
@@ -15,6 +15,9 @@
- Controller navigation must not depend on touch, mouse, keyboard, or hidden developer-only shortcuts.
- Focus state must always be visible and predictable when controller navigation is active.
- Avoid interaction patterns that trap focus, lose focus, or require precise pointer input.
- Controller navigation fixes must not break live combat bindings. When changing shared input routing, verify that combat-only actions still win during active combat: movement, ability casts, party targeting, pause, and overlay navigation must all work on AYN Thor controls.
- `data-game-nav-active` and other custom navigation markers may coexist with live combat HUDs. Do not treat those markers as menu mode during active combat unless a pause/dialog/result overlay is visible.
- Before considering any controller input change complete, test both states: no-overlay combat and menu/dialog navigation. No-overlay combat must include at least one successful ability cast from a controller binding and continuous analog movement on the AYN Thor control scheme.
## Architecture Requirements
@@ -34,10 +37,44 @@
- IWT2 rendering can use a 2D canvas/game runtime, but renderer objects must not become the source of truth for saveable gameplay state.
- IWT2 needs continuous movement input: left analog stick on AYN Thor and WASD on keyboard. Do not rely only on existing menu-style navigation actions for arena movement.
- IWT2 menus, dialogs, inventory, collection log, pause overlays, and game-select screen must still follow controller navigation requirements.
- IWT2 combat must preserve AYN Thor face/shoulder button ability bindings even when party frames, HUD controls, or target rails use custom controller navigation state. Menu navigation priority must never swallow ability inputs while `data-combat-active="true"` and no overlay is open.
- IWT2 boss mechanics and indicators must be modular. Add reusable hit-shape, damage/status, telegraph/indicator, hazard, and marker primitives under `src/modes/iwt2/sim/` or `src/modes/iwt2/render/` instead of hardcoding boss-specific rules in Phaser scenes. Boss AI may compose these primitives, but renderer code should draw sim-owned indicators generically.
- Every IWT2 boss must have a boss pet collection-log reward. Add the pet to IWT2 boss reward metadata when adding the boss, and keep boss kill pet drops at a rare 1 in 500 chance.
- IWT2 boss and party movement must be built with crowding and hazard escape in mind from the first implementation. New bosses must not rely on straight-line chase or single-vector hazard avoidance if the boss can create ground effects, wall pressure, summons, or multi-boss overlap.
- IWT2 AI-controlled party members must be able to route around nearby ground effects and telegraphs using deterministic local steering/path scoring. Avoidance should consider hazard damage radius, telegraph danger, boss collision radius, nearby party members, wall clearance, and a center-safe bias when escaping danger.
- IWT2 bosses must not be allowed to pin the tank, DPS, or themselves in arena corners. Any boss that chases, charges, pounces, relocates, or creates persistent hazards needs wall-disengage/relocation behavior and must avoid sustained wall contact.
- IWT2 collision resolution must run after both party movement and boss movement so party-vs-boss and party-vs-party overlaps do not persist into damage, projectile, or hazard ticks. When resolving boss overlap near walls, prefer pushing party members toward arena center instead of clamping them deeper into the wall/corner.
- Any new IWT2 boss or boss-pair change must be verified with forced simulation for that boss alone and in at least one two-boss pairing. Sim checks should look for sustained boss wall contact, live party overlap, party members stuck near hazards with near-zero movement, and deaths caused by corner pileups rather than intended mechanics.
- First IWT2 boss conversion target: Bulldrome. Bulldrome should have normal melee tank damage, a charge across the arena that damages and knocks down/stuns hit players for 0.75 seconds, and every 3rd charge should be followed by an AoE ground slam around the boss that also damages and knocks down/stuns hit players for 0.75 seconds.
- IWT2 starter party fantasy: player-controlled healer plus visible party members moving in the arena. Paladin tank holds aggro; ranger fires arrows; mage fires fireballs; rogue flanks; warrior fights in melee. Each class should have a distinct icon and color scheme.
## IWT2 Boss Asset Requirements
- IWT2 gameplay boss sprites should use side-view cel-shaded PNG art by default, not top-down token art.
- Boss sprites should face right in source art. Renderer may flip sprites horizontally for left-facing movement; avoid 360-degree rotation for side-view sprites.
- Use original creature designs only. Do not copy franchise art, silhouettes, armor layouts, or exact monster designs.
- Generate full-body sprites with generous padding, crisp inked outlines, simple shaded color blocks, and strong silhouettes readable on the Thor main viewport.
- Keep gameplay sprites transparent after processing, cropped to content plus padding, and sized appropriately for Thor. Prefer final PNGs around 512 px wide unless a smaller asset remains crisp.
- Store IWT2 boss gameplay sprites under `public/iwt2/bosses/` using `<boss-id>-side-cel.png`.
- In boss metadata, set `spriteUrl`, `spriteView: 'side'`, `spriteWidthScale`, `spriteHeightScale`, and `spriteYOffsetScale` so the rendered sprite preserves its source aspect ratio and reads well near party members.
- Use a flat chroma-key source background for generated sprites, then remove it locally. Use `#00ff00` unless the boss has green/teal body colors; use `#ff00ff` for green/teal bosses. The key color must not appear in the boss.
- Validate every final sprite has transparent corners and renders nonblank in the 960 x 540 Thor main viewport.
Base prompt for future IWT2 boss sprites:
```text
Use case: stylized-concept
Asset type: production game boss sprite for I Want To Heal 2 arena gameplay
Primary request: side-view cel-shaded sprite of an original <boss fantasy> boss, facing right, full body visible
Subject: <distinct silhouette, body plan, role/mechanic cues, readable combat posture>; original design, not copied from any franchise
Style/medium: clean 2D cel-shaded action-game sprite, crisp inked outline, simple shaded color blocks, readable at small size
Composition/framing: centered single character, side-view with slight 3/4 depth, full body, generous padding, no cropping
Lighting/mood: clear high-contrast game lighting, readable over dark arena grid
Color palette: <boss palette and accent colors>
Scene/backdrop: perfectly flat solid <#00ff00 or #ff00ff> chroma-key background for background removal
Constraints: background must be one uniform <key color> with no shadows, gradients, texture, floor plane, reflection, or lighting variation; do not use <key color> anywhere in the boss; no cast shadow; no text; no watermark; no UI; no logos
```
## Performance Requirements
- Treat CPU, GPU, memory, battery, and startup cost as first-class constraints.
+31 -3
View File
@@ -54,12 +54,18 @@ code updates to be a Git pull plus app restart.
Portainer is not required. Use TrueNAS **Apps > Discover > Install via YAML**.
Repository:
Repository URL:
```text
https://git.whoagland.com/phenom/i-want-to-heal.git
```
Local Gitea repository path on the same TrueNAS host:
```text
/mnt/.ix-apps/app_mounts/gitea/data/git/repositories/phenom/i-want-to-heal.git
```
TrueNAS paths:
```text
@@ -67,12 +73,15 @@ TrueNAS paths:
/mnt/usbssds/apps/iwanttoheal/data
```
Create the app directory and clone the repo:
Create the app directory and clone the repo. When Gitea is hosted on the same
TrueNAS box, prefer the local repository path instead of HTTPS. This avoids
Git-over-HTTPS TLS failures while downloading large pack files.
```sh
sudo mkdir -p /mnt/usbssds/apps/iwanttoheal
cd /mnt/usbssds/apps/iwanttoheal
sudo git clone https://git.whoagland.com/phenom/i-want-to-heal.git app
sudo git config --global --add safe.directory /mnt/.ix-apps/app_mounts/gitea/data/git/repositories/phenom/i-want-to-heal.git
sudo git clone /mnt/.ix-apps/app_mounts/gitea/data/git/repositories/phenom/i-want-to-heal.git app
```
Because the clone was run with `sudo`, give the normal TrueNAS user ownership:
@@ -101,6 +110,25 @@ cd /mnt/usbssds/apps/iwanttoheal/app
git pull
```
If setting up a different app hosted by the same Gitea instance, first find its
bare repository path:
```sh
sudo find /mnt -type d -name "REPO-NAME.git" -prune -print 2>/dev/null
```
Then substitute that path in the `safe.directory` and `git clone` commands:
```sh
sudo git config --global --add safe.directory /mnt/.ix-apps/app_mounts/gitea/data/git/repositories/OWNER/REPO-NAME.git
sudo git clone /mnt/.ix-apps/app_mounts/gitea/data/git/repositories/OWNER/REPO-NAME.git app
sudo chown -R truenas_admin:truenas_admin app
```
`safe.directory` is a Git trust exception for the Gitea-owned bare repository.
It is needed because Gitea's repository files are owned by the app/container
user, not by `truenas_admin`.
If Git fails with `chmod ... Operation not permitted`, do not use a media or SMB
dataset for the repo. Git needs normal file locking and chmod behavior. Create or
use a dedicated apps dataset and clone under `/mnt/usbssds/apps/...`.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+2 -2
View File
@@ -7,8 +7,8 @@ android {
applicationId "com.warren.iwanttoheal"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 96
versionName "1.1.17"
versionCode 113
versionName "1.1.32"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
@@ -164,6 +164,9 @@ public abstract class ControllerBridgeActivity extends BridgeActivity {
}
Set<String> currentTokens = new HashSet<>();
float leftStickX = event.getAxisValue(MotionEvent.AXIS_X);
float leftStickY = event.getAxisValue(MotionEvent.AXIS_Y);
dispatchNativeControllerMotion(leftStickX, leftStickY);
addAxisTokens(
currentTokens,
event.getAxisValue(MotionEvent.AXIS_HAT_X),
@@ -178,13 +181,13 @@ public abstract class ControllerBridgeActivity extends BridgeActivity {
);
addAxisTokens(
currentTokens,
event.getAxisValue(MotionEvent.AXIS_X),
leftStickX,
"Axis0-",
"Axis0+"
);
addAxisTokens(
currentTokens,
event.getAxisValue(MotionEvent.AXIS_Y),
leftStickY,
"Axis1-",
"Axis1+"
);
@@ -240,6 +243,19 @@ public abstract class ControllerBridgeActivity extends BridgeActivity {
);
}
private void dispatchNativeControllerMotion(float x, float y) {
if (bridge == null || bridge.getWebView() == null) return;
String script =
"window.dispatchEvent(new CustomEvent('ashen-halls-native-controller-motion',"
+ "{detail:{x:" + x + ",y:" + y + "}}));";
bridge.getWebView().post(
() -> {
bridge.getWebView().requestFocus();
bridge.getWebView().evaluateJavascript(script, null);
}
);
}
private boolean shouldThrottleDpad(String token) {
int buttonIndex = Integer.parseInt(token.substring("Button".length()));
long now = SystemClock.uptimeMillis();
+7
View File
@@ -173,6 +173,13 @@ CREATE TABLE IF NOT EXISTS accounts (
last_saved_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS account_iwt2_saves (
account_id INTEGER PRIMARY KEY REFERENCES accounts(id) ON DELETE CASCADE,
save_json TEXT NOT NULL,
character_level INTEGER NOT NULL DEFAULT 1,
updated_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS account_ip_allowances (
ip_address TEXT PRIMARY KEY,
max_accounts INTEGER NOT NULL CHECK (max_accounts >= 1),
Binary file not shown.

After

Width:  |  Height:  |  Size: 314 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 536 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 358 KiB

+183
View File
@@ -0,0 +1,183 @@
# IWT2 Future Boss Concept Prompts
These are exploration-only concepts. They are not implemented encounters.
## Rimebastion
- Hook: Frost leviathan turtle-crab siege boss; plants jagged ice wall segments, boxes party into lanes, then shatters walls into cone shards.
- Chroma key: `#00ff00`
```text
Use case: stylized-concept
Asset type: production game boss sprite for I Want To Heal 2 arena gameplay
Primary request: side-view cel-shaded sprite of an original frost leviathan turtle-crab siege boss, facing right, full body visible
Subject: massive turtle-crab hybrid with a low armored glacier shell, four heavy crab legs, broad claw-like siege forelimbs, frost-rimmed tusk mandibles, ice wall crystal growths along the shell edges, compact battering-ram posture, readable tanky wall-builder silhouette; original design, not copied from any franchise
Style/medium: clean 2D cel-shaded action-game sprite, crisp inked outline, simple shaded color blocks, readable at small size
Composition/framing: centered single character, side-view with slight 3/4 depth, full body, generous padding, no cropping
Lighting/mood: clear high-contrast game lighting, readable over dark arena grid
Color palette: deep blue shell plates, pale cyan ice crystals, white frost edges, dark slate claws, cold violet shadow accents
Scene/backdrop: perfectly flat solid #00ff00 chroma-key background for background removal
Constraints: background must be one uniform #00ff00 with no shadows, gradients, texture, floor plane, reflection, or lighting variation; do not use #00ff00 anywhere in the boss; no cast shadow; no text; no watermark; no UI; no logos
```
## Ember Mantis Duelist
- Hook: Fast side-stepping mantis swordsman. Blade arms draw glowing line-slash telegraphs, then carve straight arena cuts that force party repositioning.
- Chroma key: `#00ff00`
```text
Use case: stylized-concept
Asset type: production game boss sprite for I Want To Heal 2 arena gameplay
Primary request: side-view cel-shaded sprite of an original ember mantis duelist boss, facing right, full body visible
Subject: tall predatory mantis warrior with two long scythe-like blade arms, ember-cracked chitin plates, narrow duelist stance, swept horn-like antennae, glowing slash scars along forearms, agile line-slash mechanic cues; original design, not copied from any franchise
Style/medium: clean 2D cel-shaded action-game sprite, crisp inked outline, simple shaded color blocks, readable at small size
Composition/framing: centered single character, side-view with slight 3/4 depth, full body, generous padding, no cropping
Lighting/mood: clear high-contrast game lighting, readable over dark arena grid
Color palette: charcoal black chitin, deep crimson armor plates, molten orange cracks, pale bone blade edges, small yellow ember accents
Scene/backdrop: perfectly flat solid #00ff00 chroma-key background for background removal
Constraints: background must be one uniform #00ff00 with no shadows, gradients, texture, floor plane, reflection, or lighting variation; do not use #00ff00 anywhere in the boss; no cast shadow; no text; no watermark; no UI; no logos
```
## Obsidian Ram Golem
- Hook: Living volcanic-stone ram construct. Charge cracks armor plates, quake sends fracture waves, shatter armor drops broken obsidian slabs as hazards.
- Chroma key: `#00ff00`
```text
Use case: stylized-concept
Asset type: production game boss sprite for I Want To Heal 2 arena gameplay
Primary request: side-view cel-shaded sprite of an original obsidian ram golem boss, facing right, full body visible
Subject: massive quadruped ram-shaped stone construct with jagged obsidian armor plates, curled basalt horns, glowing ember cracks, heavy hooves, lowered charging posture, fractured shoulder plates suggesting shatter armor mechanics, quake-impact weight in stance; original design, not copied from any franchise
Style/medium: clean 2D cel-shaded action-game sprite, crisp inked outline, simple shaded color blocks, readable at small size
Composition/framing: centered single character, side-view with slight 3/4 depth, full body, generous padding, no cropping
Lighting/mood: clear high-contrast game lighting, readable over dark arena grid
Color palette: black obsidian, charcoal basalt, dark gray stone, lava-orange crack glow, muted red-hot horn accents
Scene/backdrop: perfectly flat solid #00ff00 chroma-key background for background removal
Constraints: background must be one uniform #00ff00 with no shadows, gradients, texture, floor plane, reflection, or lighting variation; do not use #00ff00 anywhere in the boss; no cast shadow; no text; no watermark; no UI; no logos
```
## Stormcoil Wyrm
- Hook: Serpentine sky-eel boss. Loops body into charged rings, leaves arcing storm trails, chains lightning through clustered party members.
- Chroma key: `#ff00ff`
```text
Use case: stylized-concept
Asset type: production game boss sprite for I Want To Heal 2 arena gameplay
Primary request: side-view cel-shaded sprite of an original storm eel wyrm boss, facing right, full body visible
Subject: long serpentine eel-wyrm with raised crested head, ribbon-like looping body forming two open coils, jagged fin spines, glowing storm nodes along its sides, forked whiskers acting as lightning conductors, readable chain-lightning mechanic cues, aggressive hovering combat posture; original design, not copied from any franchise
Style/medium: clean 2D cel-shaded action-game sprite, crisp inked outline, simple shaded color blocks, readable at small size
Composition/framing: centered single character, side-view with slight 3/4 depth, full body, generous padding, no cropping
Lighting/mood: clear high-contrast game lighting, readable over dark arena grid
Color palette: deep navy body, pale silver belly, electric cyan and white lightning accents, violet storm-glow details
Scene/backdrop: perfectly flat solid #ff00ff chroma-key background for background removal
Constraints: background must be one uniform #ff00ff with no shadows, gradients, texture, floor plane, reflection, or lighting variation; do not use #ff00ff anywhere in the boss; no cast shadow; no text; no watermark; no UI; no logos
```
## Venom Orchid Hydra
- Hook: Three blossom-serpent heads sweep staggered poison cones while buried roots snare lanes and blooming pods leave toxic zones.
- Chroma key: `#ff00ff`
```text
Use case: stylized-concept
Asset type: production game boss sprite for I Want To Heal 2 arena gameplay
Primary request: side-view cel-shaded sprite of an original venom orchid hydra boss, facing right, full body visible
Subject: massive root-bodied hydra with three long orchid-serpent heads, poisonous blossom crowns, thorny vine necks, exposed twisting roots used for snares, swollen toxin pods, readable cone-attack posture with heads angled at different heights; original design, not copied from any franchise
Style/medium: clean 2D cel-shaded action-game sprite, crisp inked outline, simple shaded color blocks, readable at small size
Composition/framing: centered single character, side-view with slight 3/4 depth, full body, generous padding, no cropping
Lighting/mood: clear high-contrast game lighting, readable over dark arena grid
Color palette: deep violet petals, pale bone-yellow stamens, dark bark roots, black-purple thorns, toxic lime-yellow venom accents; do not use magenta
Scene/backdrop: perfectly flat solid #ff00ff chroma-key background for background removal
Constraints: background must be one uniform #ff00ff with no shadows, gradients, texture, floor plane, reflection, or lighting variation; do not use #ff00ff anywhere in the boss; no cast shadow; no text; no watermark; no UI; no logos
```
## Sandglass Scorpion
- Hook: Burrowing scorpion boss that leaves moving sand trails, plants delayed stinger eruptions, and flips hourglass sand zones between safe glass and sinking hazard.
- Chroma key: `#00ff00`
```text
Use case: stylized-concept
Asset type: production game boss sprite for I Want To Heal 2 arena gameplay
Primary request: side-view cel-shaded sprite of an original sandglass scorpion boss, facing right, full body visible
Subject: massive desert scorpion with hourglass-shaped torso shell, glassy sand chambers in claws and tail, segmented legs built for burrowing, curved raised stinger with dripping golden sand, ridged shovel-like pincers, readable combat posture suggesting delayed underground strikes and arena sand zones; original design, not copied from any franchise
Style/medium: clean 2D cel-shaded action-game sprite, crisp inked outline, simple shaded color blocks, readable at small size
Composition/framing: centered single character, side-view with slight 3/4 depth, full body, generous padding, no cropping
Lighting/mood: clear high-contrast game lighting, readable over dark arena grid
Color palette: warm ochre sand armor, dark obsidian joints, amber glass chambers, pale bone claws, bright gold sand accents
Scene/backdrop: perfectly flat solid #00ff00 chroma-key background for background removal
Constraints: background must be one uniform #00ff00 with no shadows, gradients, texture, floor plane, reflection, or lighting variation; do not use #00ff00 anywhere in the boss; no cast shadow; no text; no watermark; no UI; no logos
```
## Crystal Bat Matriarch
- Hook: Giant jeweled cave-bat queen. Sonic ring pulses force party spacing, mirror shards split/reflect danger lanes, swoop dives punish clustered players.
- Chroma key: `#00ff00`
```text
Use case: stylized-concept
Asset type: production game boss sprite for I Want To Heal 2 arena gameplay
Primary request: side-view cel-shaded sprite of an original crystal bat matriarch boss, facing right, full body visible
Subject: towering bat queen with wide angular wings, faceted amethyst-and-obsidian crystal growths along crown, shoulders, wing fingers, and tail; open fanged mouth emitting visible pale sonic ring motifs around the head; several floating broken mirror shards orbiting near the wings; poised in a low forward swoop posture with claws extended; original creature design, not copied from any franchise
Style/medium: clean 2D cel-shaded action-game sprite, crisp inked outline, simple shaded color blocks, readable at small size
Composition/framing: centered single character, side-view with slight 3/4 depth, full body, generous padding, no cropping
Lighting/mood: clear high-contrast game lighting, readable over dark arena grid
Color palette: deep violet body, black wing membranes, icy blue crystal highlights, silver mirror shards, pale cyan sonic accents
Scene/backdrop: perfectly flat solid #00ff00 chroma-key background for background removal
Constraints: background must be one uniform #00ff00 with no shadows, gradients, texture, floor plane, reflection, or lighting variation; do not use #00ff00 anywhere in the boss; no cast shadow; no text; no watermark; no UI; no logos
```
## Cinderback Ricochet
- Hook: Molten armadillo boss curls into plated lava wheel, ricochets off arena walls, leaves burning trails, then uncurls for armor-plate slam windows.
- Chroma key: `#00ff00`
```text
Use case: stylized-concept
Asset type: production game boss sprite for I Want To Heal 2 arena gameplay
Primary request: side-view cel-shaded sprite of an original molten armadillo boss, facing right, full body visible
Subject: bulky low-slung armadillo-like beast with layered volcanic armor plates, glowing lava cracks, heavy clawed feet, curled rolling-combat silhouette cues, scorched tail, defensive plated brow, readable ricochet boss posture; original design, not copied from any franchise
Style/medium: clean 2D cel-shaded action-game sprite, crisp inked outline, simple shaded color blocks, readable at small size
Composition/framing: centered single character, side-view with slight 3/4 depth, full body, generous padding, no cropping
Lighting/mood: clear high-contrast game lighting, readable over dark arena grid
Color palette: charcoal obsidian plates, ember orange lava seams, dark red underbody, pale hot-yellow highlights
Scene/backdrop: perfectly flat solid #00ff00 chroma-key background for background removal
Constraints: background must be one uniform #00ff00 with no shadows, gradients, texture, floor plane, reflection, or lighting variation; do not use #00ff00 anywhere in the boss; no cast shadow; no text; no watermark; no UI; no logos
```
## Hollowcrown Revenant
- Hook: Spectral stag boss leaves cursed hoof zones and fading dash trails; ghost antlers flare before line charges.
- Chroma key: `#ff00ff`
```text
Use case: stylized-concept
Asset type: production game boss sprite for I Want To Heal 2 arena gameplay
Primary request: side-view cel-shaded sprite of an original spectral stag revenant boss, facing right, full body visible
Subject: gaunt undead stag spirit with cracked bone mask, tall translucent ghost antlers, torn shadowy hide, glowing pale blue curse runes on ribs and hooves, wispy dash-trail ribbons streaming backward, combat-ready lowered stance; original design, not copied from any franchise
Style/medium: clean 2D cel-shaded action-game sprite, crisp inked outline, simple shaded color blocks, readable at small size
Composition/framing: centered single character, side-view with slight 3/4 depth, full body, generous padding, no cropping
Lighting/mood: clear high-contrast game lighting, eerie revenant glow, readable over dark arena grid
Color palette: bone white, charcoal black, cold blue, pale cyan, muted violet accents
Scene/backdrop: perfectly flat solid #ff00ff chroma-key background for background removal
Constraints: background must be one uniform #ff00ff with no shadows, gradients, texture, floor plane, reflection, or lighting variation; do not use #ff00ff anywhere in the boss; no cast shadow; no text; no watermark; no UI; no logos
```
## Tidejaw Behemoth
- Hook: Massive reef-backed crocodile boss. Blasts pressurized water jets, uses heavy tail sweeps to knock party members sideways, leaves spinning whirlpool puddles that pull players inward.
- Chroma key: `#ff00ff`
```text
Use case: stylized-concept
Asset type: production game boss sprite for I Want To Heal 2 arena gameplay
Primary request: side-view cel-shaded sprite of an original tide crocodile behemoth boss, facing right, full body visible
Subject: enormous low-slung crocodilian sea monster with a broad armored skull, jagged coral-like back plates, heavy sweeping tail, webbed claws, pressure-jet water vents along shoulders and flanks, swirling puddle motifs around feet without shadows; original design, not copied from any franchise
Style/medium: clean 2D cel-shaded action-game sprite, crisp inked outline, simple shaded color blocks, readable at small size
Composition/framing: centered single character, side-view with slight 3/4 depth, full body, generous padding, no cropping
Lighting/mood: clear high-contrast game lighting, readable over dark arena grid
Color palette: deep swamp green body, dark navy shell plates, pale bone claws and teeth, bright cyan water accents, coral-orange warning marks
Scene/backdrop: perfectly flat solid #ff00ff chroma-key background for background removal
Constraints: background must be one uniform #ff00ff with no shadows, gradients, texture, floor plane, reflection, or lighting variation; do not use #ff00ff anywhere in the boss; no cast shadow; no text; no watermark; no UI; no logos
```
Binary file not shown.

After

Width:  |  Height:  |  Size: 341 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 411 KiB

+10
View File
@@ -96,8 +96,18 @@ curl -sS -X POST "$GITEA_URL/api/v1/repos/$GITEA_OWNER/$GITEA_REPO/releases/$REL
-F "attachment=@$APK"
```
If the CLI release fails after creating the Gitea release but before uploading the APK asset, retry only the release upload:
```sh
npm run release:cli -- --release-only 1.1.26
```
## Step 5: Update TrueNAS
The TrueNAS app checkout should be cloned from the local Gitea bare repository
path when Gitea runs on the same TrueNAS host. After that setup, normal updates
still use `git pull`; the remote is local filesystem storage instead of HTTPS.
```sh
cd /mnt/usbssds/apps/iwanttoheal/app
git pull
Binary file not shown.

After

Width:  |  Height:  |  Size: 173 KiB

+12
View File
@@ -0,0 +1,12 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 144 144" role="img" aria-label="Mirehorn boss sprite">
<path d="M20 80c6-31 35-49 68-42 31 6 48 27 43 52-5 26-34 41-68 34-30-6-48-24-43-44Z" fill="#8d714d"/>
<path d="M44 49c16-15 49-17 72-1-28 0-53 6-76 20Z" fill="#d6bd80"/>
<path d="M56 29h48l17 24-23 17H55L35 52Z" fill="#6a5137"/>
<path d="M63 37h33l10 14-12 9H62L50 51Z" fill="#a48a61"/>
<path d="M35 69 8 54l18 42 33 2Z" fill="#6a5137"/>
<path d="m102 68 33-13-14 42-34 2Z" fill="#6a5137"/>
<path d="M67 65c14 0 26 10 26 23s-12 23-26 23-26-10-26-23 12-23 26-23Z" fill="#5a412e"/>
<path d="m94 82 32 7-31 10Z" fill="#3a2b21"/>
<path d="M54 77h7v8h-7z" fill="#f3e2a5"/>
<path d="M44 111h16l-8 18ZM90 111h16l-8 18Z" fill="#3a2b21"/>
</svg>

After

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 KiB

+14
View File
@@ -0,0 +1,14 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 144 144" role="img" aria-label="Bristlemaw boss sprite">
<path d="M22 80c4-31 32-50 64-43 26 6 42 23 43 45 2 23-16 39-43 41-34 2-62-14-64-43Z" fill="#7a4b35"/>
<path d="M42 91c11 15 42 22 67 10-9 16-28 24-52 18-13-4-23-13-28-24l13-4Z" fill="#3b2d28" opacity=".55"/>
<path d="M42 51c11-12 31-17 52-12 14 3 25 10 31 21-25-9-53-11-83-9Z" fill="#b48762"/>
<path d="M30 62 9 48l8 31 20-5Z" fill="#d6c8aa"/>
<path d="m104 55 30-12-13 28-20-2Z" fill="#d6c8aa"/>
<path d="M40 34 24 18h25l7 17Z" fill="#ad5632"/>
<path d="m99 36 15-18 13 24-20 8Z" fill="#ad5632"/>
<path d="M72 58c17 0 31 11 31 25S89 108 72 108 41 97 41 83s14-25 31-25Z" fill="#5b3b31"/>
<path d="M73 63c9 0 17 7 17 16s-8 17-17 17-17-8-17-17 8-16 17-16Z" fill="#2c2422"/>
<path d="M68 72h9v20h-9z" fill="#e8b068"/>
<path d="M61 55c5-9 17-9 22 0-6-2-16-2-22 0Z" fill="#261b17"/>
<path d="M42 110h16l-8 16ZM90 109h16l-8 16Z" fill="#2a211e"/>
</svg>

After

Width:  |  Height:  |  Size: 982 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

+13
View File
@@ -0,0 +1,13 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 144 144" role="img" aria-label="Packfang Alpha boss sprite">
<path d="M21 78c8-28 38-42 69-32 24 8 36 27 27 49-9 23-38 32-66 20-22-9-35-21-30-37Z" fill="#3f8f73"/>
<path d="M54 48c15-15 38-14 55 1-21 0-39 6-54 19Z" fill="#b8f0aa"/>
<path d="M28 79 7 58l33 5Z" fill="#2a6e58"/>
<path d="M97 66 137 46l-20 36Z" fill="#2a6e58"/>
<path d="M92 91c16 2 30 9 41 22-24-5-43-8-58-6Z" fill="#326d59"/>
<path d="M70 62c12 0 22 9 22 21S82 105 70 105s-22-10-22-22 10-21 22-21Z" fill="#245848"/>
<path d="M60 32 48 15l26 13ZM82 32l14-17 6 27Z" fill="#b8f0aa"/>
<circle cx="60" cy="74" r="4" fill="#f4ffd0"/>
<circle cx="60" cy="74" r="2" fill="#111"/>
<path d="m93 82 31 4-29 12Z" fill="#1f4539"/>
<path d="M44 108h13l-7 18ZM80 111h13l-7 18Z" fill="#1f4539"/>
</svg>

After

Width:  |  Height:  |  Size: 828 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB

+12
View File
@@ -0,0 +1,12 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 144 144" role="img" aria-label="Palevolt Maw boss sprite">
<path d="M27 82c2-28 27-43 55-40 25 3 45 20 45 44 0 23-21 39-50 39-30 0-52-18-50-43Z" fill="#d8d7c9"/>
<path d="M42 55c14-13 47-13 66 0-23-2-45 2-68 16Z" fill="#fff4df"/>
<path d="M37 70 10 55l15 40 30 2Z" fill="#b9b7aa"/>
<path d="m102 68 31-15-13 40-30 4Z" fill="#b9b7aa"/>
<path d="M49 72c8-16 32-21 45-8 13 14 8 39-13 46-21 7-42-4-43-21 0-6 4-12 11-17Z" fill="#efe9da"/>
<path d="M64 61c17-32 40-43 57-32-22 10-33 27-34 51Z" fill="#d8d7c9"/>
<path d="M89 35c8-18 23-24 40-21-14 8-22 18-25 31Z" fill="#fff4df"/>
<path d="M60 84c11-5 26-4 36 4-9 8-27 8-36-4Z" fill="#7d4b55"/>
<path d="M55 112h14l-8 17ZM88 112h14l-8 17Z" fill="#8d8a80"/>
<path d="M105 69c9 1 15 5 19 13-10-3-17-3-25 2Z" fill="#77d9ff"/>
</svg>

After

Width:  |  Height:  |  Size: 846 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 KiB

+13
View File
@@ -0,0 +1,13 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 144 144" role="img" aria-label="Verdant Wyrm boss sprite">
<path d="M26 77c6-30 35-48 66-40 27 7 42 30 36 55-6 24-34 38-64 29-26-8-43-25-38-44Z" fill="#4d9a58"/>
<path d="M48 51c13-17 40-22 64-4-25 0-44 6-59 20Z" fill="#f0c24d"/>
<path d="M35 69 5 38l13 54 36 10Z" fill="#3f7c4a"/>
<path d="m100 65 38-28-15 56-35 9Z" fill="#3f7c4a"/>
<path d="M30 63 6 37l31 14 18 36Z" fill="#78b861"/>
<path d="m112 58 28-22-20 31-27 22Z" fill="#78b861"/>
<path d="M77 22c17 8 30 21 38 39-18-12-37-18-59-18 5-10 12-17 21-21Z" fill="#2d693f"/>
<path d="M70 61c13 0 24 10 24 23s-11 24-24 24-24-11-24-24 11-23 24-23Z" fill="#2f5f3c"/>
<path d="m96 82 34 7-33 12Z" fill="#244c32"/>
<path d="M57 75h6v8h-6z" fill="#f7ffd2"/>
<path d="M44 110h15l-8 19ZM88 111h15l-8 19Z" fill="#244c32"/>
</svg>

After

Width:  |  Height:  |  Size: 849 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 KiB

+13
View File
@@ -0,0 +1,13 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 144 144" role="img" aria-label="Stormtail boss sprite">
<path d="M25 79c7-27 34-42 65-34 24 6 38 23 35 45-3 23-28 37-58 30-27-6-47-24-42-41Z" fill="#6a79bd"/>
<path d="M49 50c13-14 38-18 61-3-21 1-40 8-56 22Z" fill="#a8f3ff"/>
<path d="M40 69 8 49l20 46 34 5Z" fill="#515d9d"/>
<path d="m95 66 38-18-20 48-34 4Z" fill="#515d9d"/>
<path d="M92 89c20 3 34 14 41 32-22-10-42-14-62-12Z" fill="#dfeaff"/>
<path d="M68 61c13 0 23 10 23 22s-10 23-23 23-23-11-23-23 10-22 23-22Z" fill="#414b87"/>
<path d="M58 32 44 12l28 16ZM83 32l19-17 4 29Z" fill="#dfeaff"/>
<path d="m82 55 7 12 13-4-11 11 7 13-14-7-11 11 3-15-14-7 15-2Z" fill="#a8f3ff"/>
<circle cx="59" cy="74" r="4" fill="#f6ffff"/>
<circle cx="59" cy="74" r="2" fill="#101425"/>
<path d="M45 108h14l-8 18ZM82 110h14l-8 18Z" fill="#303869"/>
</svg>

After

Width:  |  Height:  |  Size: 874 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 282 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 KiB

+14
View File
@@ -0,0 +1,14 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 144 144" role="img" aria-label="Emberquill boss sprite">
<path d="M28 84c3-29 28-45 56-38 24 6 39 24 35 48-3 22-24 34-51 31-25-3-42-18-40-41Z" fill="#d66a35"/>
<path d="M52 51c9-14 29-18 49-5-16 0-31 5-43 16Z" fill="#ffd166"/>
<path d="M38 67 9 45l12 45 29 5Z" fill="#f28a3e"/>
<path d="m99 71 36-20-16 45-30-1Z" fill="#f28a3e"/>
<path d="M33 66 7 42l20 9 17 24Z" fill="#ffd166"/>
<path d="m112 63 25-16-16 20-20 12Z" fill="#ffd166"/>
<path d="M80 26c18 7 29 21 31 40-13-15-28-21-47-22 4-8 9-14 16-18Z" fill="#b6462d"/>
<path d="M69 58c12 0 22 10 22 22s-10 22-22 22-22-10-22-22 10-22 22-22Z" fill="#812f25"/>
<path d="m93 79 31 5-28 11Z" fill="#61241d"/>
<circle cx="60" cy="73" r="5" fill="#fff2a5"/>
<circle cx="60" cy="73" r="2" fill="#1f1511"/>
<path d="M52 112h13l-8 18ZM86 111h14l-8 18Z" fill="#58251c"/>
</svg>

After

Width:  |  Height:  |  Size: 895 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.
+44 -15
View File
@@ -5,6 +5,7 @@ import json
import os
import queue
import re
import shutil
import subprocess
import sys
import threading
@@ -153,6 +154,48 @@ def gitea_request(
except urllib.error.HTTPError as exc:
data = exc.read()
return exc.code, data
except urllib.error.URLError as exc:
raise ReleaseError(f"{method} {url} failed: {exc.reason}") from exc
def gitea_upload_asset(config: ReleaseConfig, path: str, apk_path: Path) -> tuple[int, bytes]:
curl = shutil.which("curl")
if curl is None:
raise ReleaseError("curl is required for Gitea asset uploads")
url = config.gitea_url.rstrip("/") + path
proc = subprocess.run(
[
curl,
"--silent",
"--show-error",
"--retry",
"3",
"--retry-all-errors",
"--retry-delay",
"2",
"--request",
"POST",
url,
"--header",
f"Authorization: token {config.token}",
"--form",
f"attachment=@{apk_path}",
"--write-out",
"\n%{http_code}",
],
check=False,
capture_output=True,
)
if proc.returncode != 0:
detail = (proc.stderr or proc.stdout).decode("utf-8", "replace").strip()
raise ReleaseError(f"Gitea asset upload failed: curl exited {proc.returncode}: {detail}")
try:
body, status_text = proc.stdout.rsplit(b"\n", 1)
return int(status_text), body
except ValueError as exc:
output = proc.stdout.decode("utf-8", "replace")
raise ReleaseError(f"Gitea asset upload returned malformed curl output: {output}") from exc
def parse_json_response(status: int, data: bytes, action: str) -> dict:
@@ -211,26 +254,12 @@ def upload_release_asset(config: ReleaseConfig, log: Callable[[str], None]) -> N
raise ReleaseError(f"APK not found for release upload: {apk_path}")
release_id = find_or_create_release(config, log)
boundary = f"----iwanttoheal{int(time.time() * 1000)}"
header = (
f"--{boundary}\r\n"
f'Content-Disposition: form-data; name="attachment"; filename="{apk_path.name}"\r\n'
"Content-Type: application/vnd.android.package-archive\r\n\r\n"
).encode("utf-8")
footer = f"\r\n--{boundary}--\r\n".encode("utf-8")
body = header + apk_path.read_bytes() + footer
asset_name = urllib.parse.quote(apk_path.name)
path = (
f"/api/v1/repos/{config.gitea_owner}/{config.gitea_repo}"
f"/releases/{release_id}/assets?name={asset_name}"
)
status, data = gitea_request(
config,
"POST",
path,
body=body,
content_type=f"multipart/form-data; boundary={boundary}",
)
status, data = gitea_upload_asset(config, path, apk_path)
if status == 409:
raise ReleaseError(f"Release asset already exists: {apk_path.name}")
parse_json_response(status, data, "Upload release asset")
+97 -24
View File
@@ -68,9 +68,16 @@ def parse_args(argv: list[str]) -> argparse.Namespace:
action="store_true",
help="Skip the RESET confirmation when used with --reset-player-data.",
)
parser.add_argument(
"--release-only",
metavar="VERSION",
help="Create or reuse the Gitea release and upload an existing IWantToHeal-Thor-vVERSION.apk, without rebuilding.",
)
args = parser.parse_args(argv)
if args.yes_reset and not args.reset_player_data:
parser.error("--yes-reset requires --reset-player-data")
if args.release_only and args.reset_player_data:
parser.error("--release-only cannot be combined with --reset-player-data")
return args
@@ -131,44 +138,90 @@ def request_json(method: str, path: str, token: str, data: dict | None = None) -
except urllib.error.HTTPError as exc:
detail = exc.read().decode("utf-8", "replace")
raise SystemExit(f"Gitea {method} failed ({exc.code}): {detail}") from exc
except urllib.error.URLError as exc:
raise SystemExit(f"Gitea {method} failed: {exc.reason}") from exc
def upload_asset(path: str, token: str, apk: Path) -> dict:
boundary = "----iwanttoheal-release-boundary"
body = (
f"--{boundary}\r\n"
f'Content-Disposition: form-data; name="attachment"; filename="{apk.name}"\r\n'
"Content-Type: application/vnd.android.package-archive\r\n\r\n"
).encode("utf-8")
body += apk.read_bytes()
body += f"\r\n--{boundary}--\r\n".encode("utf-8")
headers = {
"Authorization": f"token {token}",
"Content-Type": f"multipart/form-data; boundary={boundary}",
}
req = urllib.request.Request(GITEA_URL + path, data=body, headers=headers, method="POST")
url = GITEA_URL + path
curl = shutil.which("curl")
if curl is None:
raise SystemExit("curl is required for Gitea asset uploads")
proc = subprocess.run(
[
curl,
"--silent",
"--show-error",
"--retry",
"3",
"--retry-all-errors",
"--retry-delay",
"2",
"--request",
"POST",
url,
"--header",
f"Authorization: token {token}",
"--form",
f"attachment=@{apk}",
"--write-out",
"\n%{http_code}",
],
check=False,
capture_output=True,
text=True,
)
if proc.returncode != 0:
detail = proc.stderr.strip() or proc.stdout.strip()
raise SystemExit(f"Gitea asset upload failed: curl exited {proc.returncode}: {detail}")
try:
body, status_text = proc.stdout.rsplit("\n", 1)
status = int(status_text)
except ValueError as exc:
raise SystemExit(f"Gitea asset upload returned malformed curl output: {proc.stdout}") from exc
if status >= 400:
raise SystemExit(f"Gitea asset upload failed ({status}): {body}")
try:
parsed = json.loads(body or "{}")
except json.JSONDecodeError as exc:
raise SystemExit(f"Gitea asset upload returned invalid JSON: {body}") from exc
if not isinstance(parsed, dict):
raise SystemExit(f"Gitea asset upload returned unexpected JSON: {parsed}")
return parsed
def find_or_create_release(version: str, token: str) -> int:
repo_path = f"/api/v1/repos/{GITEA_OWNER}/{GITEA_REPO}"
tag = f"v{version}"
tag_path = repo_path + "/releases/tags/" + urllib.parse.quote(tag, safe="")
req = urllib.request.Request(GITEA_URL + tag_path, headers={"Authorization": f"token {token}"}, method="GET")
try:
with urllib.request.urlopen(req) as resp:
return json.loads(resp.read().decode("utf-8"))
release = json.loads(resp.read().decode("utf-8"))
release_id = release.get("id")
if not release_id:
raise SystemExit(f"Gitea release missing id: {release}")
print(f"Gitea release exists: {tag} (id {release_id})")
return int(release_id)
except urllib.error.HTTPError as exc:
if exc.code != 404:
detail = exc.read().decode("utf-8", "replace")
raise SystemExit(f"Gitea asset upload failed ({exc.code}): {detail}") from exc
raise SystemExit(f"Gitea release lookup failed ({exc.code}): {detail}") from exc
except urllib.error.URLError as exc:
raise SystemExit(f"Gitea release lookup failed: {exc.reason}") from exc
def create_gitea_release(version: str, apk: Path) -> None:
token = GITEA_TOKEN.strip()
if not token or token == "PASTE_YOUR_GITEA_TOKEN_HERE":
raise SystemExit("Set GITEA_TOKEN near top of scripts/release_game_cli.py")
repo_path = f"/api/v1/repos/{GITEA_OWNER}/{GITEA_REPO}"
release = request_json(
"POST",
repo_path + "/releases",
token,
{
"tag_name": f"v{version}",
"tag_name": tag,
"target_commitish": BRANCH,
"name": f"v{version}",
"name": tag,
"body": f"I Want to Heal Android build v{version}",
"draft": False,
"prerelease": False,
@@ -177,7 +230,17 @@ def create_gitea_release(version: str, apk: Path) -> None:
release_id = release.get("id")
if not release_id:
raise SystemExit(f"Gitea release missing id: {release}")
print(f"Gitea release created: {tag} (id {release_id})")
return int(release_id)
def create_gitea_release(version: str, apk: Path) -> None:
token = GITEA_TOKEN.strip()
if not token or token == "PASTE_YOUR_GITEA_TOKEN_HERE":
raise SystemExit("Set GITEA_TOKEN near top of scripts/release_game_cli.py")
repo_path = f"/api/v1/repos/{GITEA_OWNER}/{GITEA_REPO}"
release_id = find_or_create_release(version, token)
asset_name = urllib.parse.quote(apk.name)
upload_asset(f"{repo_path}/releases/{release_id}/assets?name={asset_name}", token, apk)
print(f"Gitea release uploaded: v{version}")
@@ -289,6 +352,16 @@ def reset_player_data(database_path: Path, *, assume_yes: bool) -> None:
def main(argv: list[str] | None = None) -> int:
args = parse_args(sys.argv[1:] if argv is None else argv)
os.chdir(REPO_ROOT)
if args.release_only:
version = args.release_only.strip()
if not re.fullmatch(r"\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?", version):
raise SystemExit("Version must look like 1.1.2")
apk = REPO_ROOT / f"IWantToHeal-Thor-v{version}.apk"
if not apk.exists():
raise SystemExit(f"APK not found: {apk}")
create_gitea_release(version, apk)
return 0
version = prompt_version()
apk = build_apk(version)
commit_and_push(version)
+59 -11
View File
@@ -51,6 +51,14 @@ function ensureRuntimeMigrations(database) {
SET last_saved_at = COALESCE(NULLIF(last_saved_at, ''), created_at, CURRENT_TIMESTAMP)
WHERE last_saved_at IS NULL OR last_saved_at = ''
`).run()
database.exec(`
CREATE TABLE IF NOT EXISTS account_iwt2_saves (
account_id INTEGER PRIMARY KEY REFERENCES accounts(id) ON DELETE CASCADE,
save_json TEXT NOT NULL,
character_level INTEGER NOT NULL DEFAULT 1,
updated_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
)
`)
}
function sqliteDateFromMs(value) {
@@ -1384,6 +1392,46 @@ function importSyncSave(database, accountId, activeCharacterId, payload) {
}
}
function readIwt2SyncSave(database, accountId) {
const row = database.prepare(`
SELECT save_json AS saveJson
FROM account_iwt2_saves
WHERE account_id = ?
`).get(accountId)
if (!row) return { save: null }
try {
return { save: JSON.parse(row.saveJson) }
} catch {
return { save: null }
}
}
function importIwt2SyncSave(database, accountId, payload) {
const save = payload?.save
if (
!save
|| typeof save !== 'object'
|| Number(save.version) !== 2
|| typeof save.updatedAt !== 'number'
|| !save.character
|| typeof save.character !== 'object'
|| typeof save.character.level !== 'number'
) {
throw new Error('The IWT2 save snapshot is invalid.')
}
const savedAt = sqliteDateFromMs(save.updatedAt)
const characterLevel = clampInteger(save.character.level, 1, 1, 1000000)
database.prepare(`
INSERT INTO account_iwt2_saves (account_id, save_json, character_level, updated_at)
VALUES (?, ?, ?, ?)
ON CONFLICT(account_id) DO UPDATE SET
save_json = excluded.save_json,
character_level = excluded.character_level,
updated_at = excluded.updated_at
`).run(accountId, JSON.stringify(save), characterLevel, savedAt)
return readIwt2SyncSave(database, accountId)
}
function itemById(database, itemId) {
return database.prepare(`
SELECT
@@ -1544,11 +1592,6 @@ function rollEncounterLoot(database, characterId, encounterId, difficultyId, run
`).get(encounterId, difficultyId)
if (!context) throw new Error('That loot table is not available.')
const character = database.prepare('SELECT level FROM characters WHERE id = ?').get(characterId)
if (character.level < context.unlockLevel) {
throw new Error(`${context.difficultyName} unlocks at level ${context.unlockLevel}.`)
}
const entries = database.prepare(`
SELECT
encounter_loot.drop_weight AS dropWeight,
@@ -2249,9 +2292,6 @@ function completeDungeon(database, characterId, accountId, dungeonId, difficulty
JOIN classes ON classes.id = characters.class_id
WHERE characters.id = ?
`).get(characterId)
if (character.level < dungeon.unlockLevel) {
throw new Error(`${dungeon.difficultyName} unlocks at level ${dungeon.unlockLevel}.`)
}
const maxLevel = Number(
database.prepare("SELECT value FROM game_settings WHERE key = 'max_level'").get()?.value ?? 25,
)
@@ -2483,9 +2523,6 @@ function completeRoguelike(database, characterId, accountId, runMetrics) {
FROM characters
WHERE characters.id = ?
`).get(characterId)
if (character.level < dungeon.unlockLevel) {
throw new Error(`${dungeon.difficultyName} unlocks at level ${dungeon.unlockLevel}.`)
}
const maxLevel = Number(
database.prepare("SELECT value FROM game_settings WHERE key = 'max_level'").get()?.value ?? 25,
)
@@ -3137,6 +3174,17 @@ export async function handleApiRequest(request, response, next) {
return
}
if (request.url === '/api/iwt2/sync-save' && request.method === 'GET') {
sendJson(response, 200, readIwt2SyncSave(database, session.accountId))
return
}
if (request.url === '/api/iwt2/sync-save' && request.method === 'PUT') {
const payload = await readJson(request, 512 * 1024)
sendJson(response, 200, importIwt2SyncSave(database, session.accountId, payload))
return
}
if (request.url === '/api/profile' && request.method === 'GET') {
sendJson(response, 200, getProfile(database, session.characterId, session.accountId))
return
+852 -26
View File
File diff suppressed because it is too large Load Diff
+77 -4
View File
@@ -1,7 +1,12 @@
import { useState } from 'react'
import { useCallback, useEffect, useState } from 'react'
import { AuthScreen } from './components/AuthScreen'
import IWantToHeal1App from './modes/iwt1/IWantToHeal1App'
import { IWantToHeal2App } from './modes/iwt2/IWantToHeal2App'
import { useGameAction } from './input'
import {
loadAuthSession,
type AuthSession,
} from './profile'
type GameVersion = 'iwt1' | 'iwt2'
@@ -31,9 +36,46 @@ const GAME_OPTIONS: Array<{
function App() {
const [selectedVersion, setSelectedVersion] = useState<GameVersion | null>(null)
const [selectedIndex, setSelectedIndex] = useState(0)
const [authSession, setAuthSession] = useState<AuthSession | null>(null)
const [authChecked, setAuthChecked] = useState(false)
const [serverMessage, setServerMessage] = useState('')
useEffect(() => {
let cancelled = false
loadAuthSession()
.then((session) => {
if (cancelled) return
setAuthSession(session.account && session.profile ? session : null)
})
.catch((reason: unknown) => {
if (cancelled) return
setServerMessage(
reason instanceof Error
? `${reason.message} Offline play is still available.`
: 'Unable to reach the server. Offline play is still available.',
)
})
.finally(() => {
if (!cancelled) setAuthChecked(true)
})
return () => {
cancelled = true
}
}, [])
const acceptSession = useCallback((session: AuthSession) => {
setAuthSession(session)
setSelectedVersion(null)
setServerMessage('')
}, [])
const clearAuthSession = useCallback(() => {
setAuthSession(null)
setSelectedVersion(null)
}, [])
useGameAction((action, device) => {
if (selectedVersion || device !== 'controller') return
if (!authSession || selectedVersion || device !== 'controller') return
if (action === 'navigateLeft' || action === 'navigateUp') {
setSelectedIndex((current) => Math.max(0, current - 1))
} else if (action === 'navigateRight' || action === 'navigateDown') {
@@ -43,12 +85,43 @@ function App() {
}
})
if (!authChecked) {
return (
<main className="game-shell">
<section className="message-panel">
<p className="eyebrow">Opening Chronicle</p>
<h1>Loading...</h1>
</section>
</main>
)
}
if (!authSession) {
return (
<AuthScreen
onAuthenticated={acceptSession}
serverMessage={serverMessage}
/>
)
}
if (selectedVersion === 'iwt1') {
return <IWantToHeal1App onBackToGameSelect={() => setSelectedVersion(null)} />
return (
<IWantToHeal1App
initialSession={authSession}
onAuthenticationCleared={clearAuthSession}
onBackToGameSelect={() => setSelectedVersion(null)}
/>
)
}
if (selectedVersion === 'iwt2') {
return <IWantToHeal2App onBackToGameSelect={() => setSelectedVersion(null)} />
return (
<IWantToHeal2App
onlineBackupsAvailable={authSession.account?.id !== -1}
onBackToGameSelect={() => setSelectedVersion(null)}
/>
)
}
return (
+9 -3
View File
@@ -9,9 +9,13 @@ export type RewardSummaryBase = {
unlockedAbilities: DungeonReward['unlockedAbilities']
}
export type RunBossCoinAward = NonNullable<DungeonReward['bonusItem']> & {
sourceLabel: string
}
export type PvpRunRewardSummary = RewardSummaryBase & {
bossesKilled: number
loot: Array<NonNullable<DungeonReward['bonusItem']>>
loot: RunBossCoinAward[]
}
export function createEmptyRewardSummary(): RewardSummaryBase {
@@ -60,11 +64,13 @@ export function mergeDungeonRewardSummary<TSummary extends RewardSummaryBase>(
export function mergePvpRunRewardSummary(
current: PvpRunRewardSummary,
reward: DungeonReward,
{ bossKilled }: { bossKilled: boolean },
{ bossKilled, sourceLabel }: { bossKilled: boolean; sourceLabel?: string },
) {
return {
...mergeDungeonRewardSummary(current, reward),
bossesKilled: current.bossesKilled + (bossKilled ? 1 : 0),
loot: reward.bonusItem ? [...current.loot, reward.bonusItem] : current.loot,
loot: reward.bonusItem
? [...current.loot, { ...reward.bonusItem, sourceLabel: sourceLabel ?? `Boss ${current.bossesKilled + 1}` }]
: current.loot,
}
}
+43 -11
View File
@@ -3,7 +3,6 @@ import {
completeDungeon,
completeRoguelike,
loadProfile,
recordBossKill,
type DungeonReward,
rollEncounterLoot,
type LootRoll,
@@ -55,6 +54,7 @@ import {
createPveCombatState,
createPveRoguelikeRunStart,
} from '../combat/pveRoguelikeRunSetup'
import type { RunBossCoinAward } from '../combat/rewardSummaries'
import {
appendCombatLog,
type BasicFloatingCombatText,
@@ -79,7 +79,7 @@ import { usePartyTargeting } from '../hooks/usePartyTargeting'
import { PartyMemberFrame } from './PartyFrames'
import { ResourceBar, SpellBar } from './SpellBars'
import { barFillStyle } from './barStyles'
import { BonusItemReward, LootRollList, RewardXpSummary } from './RewardPanels'
import { BonusItemReward, LootRollList, PvpRunLootList, RewardXpSummary } from './RewardPanels'
import { ResultScreen } from './ResultScreen'
import {
DualScreenTopCombat,
@@ -236,6 +236,7 @@ function makeRoguelikeSegment(
mode: RoguelikeMode,
): RoguelikeEncounter[] {
const mechanics = chooseRandom(ROGUELIKE_MECHANICS, Math.min(2 + Math.floor(stage / 3), 4))
const stageOneDamageScale = 0.58 + (mode === 'raid' ? 0.13 : 0.1)
return buildRoguelikeSegment<RoguelikeMechanic, { roguelikeMechanics: RoguelikeMechanic[] }>({
pool,
stage,
@@ -243,8 +244,8 @@ function makeRoguelikeSegment(
trashCandidateCount: (trashCount) => Math.min(trashCount, 4 + stage * (mode === 'raid' ? 1 : 2)),
bossCandidateCount: (bossCount) => Math.min(bossCount, 2 + Math.floor((stage + 1) / 2)),
healthScale: difficulty.healthMultiplier * (0.64 + stage * (mode === 'raid' ? 0.15 : 0.11)),
damageScale: difficulty.damageMultiplier * (0.58 + stage * (mode === 'raid' ? 0.13 : 0.1)),
partyDamageScale: 0.9 + stage * 0.05,
damageScale: difficulty.damageMultiplier * stageOneDamageScale,
partyDamageScale: 0.95,
idBase: 900000,
bossDescription: (selectedMechanics) => `Roguelike boss with ${selectedMechanics.map(mechanicLabel).join(', ')}.`,
extraFields: (_encounter, isBoss, selectedMechanics) => ({
@@ -265,6 +266,7 @@ export function CombatScreen({
roguelikeAbilityLabelMode = 'ability',
roguelikeEncounterPool,
onExit,
onMainMenu = onExit,
onProfileUpdated,
}: {
difficulty: Difficulty
@@ -278,6 +280,7 @@ export function CombatScreen({
roguelikeAbilityLabelMode?: RoguelikeAbilityLabelMode
roguelikeEncounterPool?: DungeonEncounter[]
onExit: () => void
onMainMenu?: () => void
onProfileUpdated: (profile: CharacterProfile) => void
}) {
const staticEncounters = useMemo(
@@ -359,6 +362,7 @@ export function CombatScreen({
const [reward, setReward] = useState<DungeonReward | null>(null)
const [rewardError, setRewardError] = useState('')
const [lootRolls, setLootRolls] = useState<LootRoll[]>([])
const [roguelikeBossCoins, setRoguelikeBossCoins] = useState<RunBossCoinAward[]>([])
const [showEndLog, setShowEndLog] = useState(false)
const {
floatingTexts,
@@ -540,9 +544,31 @@ export function CombatScreen({
const key = `${runTokenRef.current}:${encounter.id}:${encounterIndex}`
if (recordedBossKillIdsRef.current.has(key)) return
recordedBossKillIdsRef.current.add(key)
recordBossKill(encounter.id, { petVariant: 'purple' })
completeRoguelike(
dungeon.id,
difficulty.id,
0,
0,
Math.max(1, Math.round((Date.now() - runStartedAtRef.current) / 1000)),
{
bossesCleared: 0,
fightsCleared: 0,
lootSourceEncounterId: encounter.id,
roguelikeStage,
},
)
.then((result) => {
onProfileUpdated(result.profile)
if (result.bonusItem) {
setRoguelikeBossCoins((current) => [...current, {
...result.bonusItem!,
sourceLabel: encounter.enemyName,
}])
addLog(
`${result.bonusItem.name} x${result.bonusItem.quantity} awarded.`,
'loot',
)
}
if (result.petAwarded) {
addLog(
`${result.petAwarded.petName} awarded${result.petAwarded.duplicate ? ` (owned x${result.petAwarded.quantityAfter})` : ''}.`,
@@ -552,11 +578,11 @@ export function CombatScreen({
})
.catch((reason: unknown) => {
addLog(
reason instanceof Error ? reason.message : 'Unable to record boss kill.',
reason instanceof Error ? reason.message : 'Unable to award boss coins.',
'danger',
)
})
}, [addLog, encounterIndex, isRoguelike, onProfileUpdated])
}, [addLog, difficulty.id, dungeon.id, encounterIndex, isRoguelike, onProfileUpdated, roguelikeStage])
const resetRun = useCallback(() => {
const nextRoguelikeEncounters = roguelikeMode
@@ -581,6 +607,7 @@ export function CombatScreen({
setReward(setup.defaults.reward)
setRewardError(setup.defaults.rewardError)
setLootRolls(setup.defaults.lootRolls)
setRoguelikeBossCoins([])
setShowEndLog(setup.defaults.showEndLog)
clearFloatingTexts()
setRoguelikeUpgrades(setup.defaults.roguelikeUpgrades)
@@ -1374,10 +1401,10 @@ export function CombatScreen({
<div>
<p className="eyebrow">Game Paused</p>
<h2>{dungeon.name}</h2>
<p>Combat is stopped. Resume the fight or leave the current run.</p>
<button onClick={() => setPaused(false)} type="button">Resume</button>
<button className="secondary-result-button" onClick={onExit} type="button">
Leave {contentName}
<p>Combat is stopped. Continue the fight or return to the main menu.</p>
<button onClick={() => setPaused(false)} type="button">Continue</button>
<button className="secondary-result-button" onClick={onMainMenu} type="button">
Main Menu
</button>
</div>
</div>
@@ -1434,7 +1461,11 @@ export function CombatScreen({
{rewardError && <p className="reward-error">{rewardError}</p>}
{reward && (
<>
{isRoguelike && <p>Run totals</p>}
<RewardXpSummary reward={reward} />
{isRoguelike && (
<PvpRunLootList loot={roguelikeBossCoins} emptyLabel="No boss coins collected this run." />
)}
{!isRoguelike && (
<>
<p>Component tier: item level {reward.droppedItemLevel}.</p>
@@ -1459,6 +1490,7 @@ export function CombatScreen({
<>
<RewardXpSummary reward={reward} />
<p>{encounterIndex} encounters cleared.</p>
<PvpRunLootList loot={roguelikeBossCoins} emptyLabel="No boss coins collected this run." />
<p className="efficiency-result">
{reward.resourceSpent} {gameClass.resourceName} spent
<small>{reward.durationSeconds}s survived</small>
+27 -10
View File
@@ -229,6 +229,7 @@ function spellResourceCost(spell: Spell, buffs: StackCounts<SelfBuffId>, debuffs
function buildEncounterSegment(pool: DungeonEncounter[], stage: number, kind: PvpContentType): PvpEncounter[] {
const mechanics = chooseRandom(BOSS_MECHANICS, Math.min(2 + Math.floor(stage / 3), 4))
const stageOneDamageScale = 0.8 + (kind === 'raid' ? 0.18 : 0.14)
return buildRoguelikeSegment<BossMechanic, {
bossMechanics: BossMechanic[]
sourceEncounterId?: number
@@ -240,8 +241,8 @@ function buildEncounterSegment(pool: DungeonEncounter[], stage: number, kind: Pv
trashCandidateCount: (trashCount) => Math.min(trashCount, 5 + stage * (kind === 'raid' ? 1 : 2)),
bossCandidateCount: (bossCount) => Math.min(bossCount, 2 + Math.floor((stage + 1) / 2)),
healthScale: 0.75 + stage * (kind === 'raid' ? 0.28 : 0.22),
damageScale: 0.8 + stage * (kind === 'raid' ? 0.18 : 0.14),
partyDamageScale: 0.85 + stage * 0.04,
damageScale: stageOneDamageScale,
partyDamageScale: 0.89,
idBase: 910000,
bossDescription: (selectedMechanics) => `PvP boss with ${selectedMechanics.join(', ')}.`,
extraFields: (encounter, isBoss, selectedMechanics) => ({
@@ -293,6 +294,7 @@ export function PvPRoguelikeScreen({
contentType,
encounterPool,
onExit,
onMainMenu = onExit,
onProfileUpdated,
}: {
profile: CharacterProfile
@@ -300,6 +302,7 @@ export function PvPRoguelikeScreen({
contentType: PvpContentType
encounterPool: DungeonEncounter[]
onExit: () => void
onMainMenu?: () => void
onProfileUpdated: (profile: CharacterProfile) => void
}) {
const gameClass = profile.classes.find((candidate) => candidate.id === profile.character.classId)!
@@ -537,7 +540,10 @@ export function PvPRoguelikeScreen({
)
.then((result) => {
setReward(result)
setRunSummary((current) => mergePvpRunRewardSummary(current, result, { bossKilled: isBossReward }))
setRunSummary((current) => mergePvpRunRewardSummary(current, result, {
bossKilled: isBossReward,
sourceLabel: rewardEncounter?.enemyName,
}))
onProfileUpdated(result.profile)
if (result.experienceGained > 0) {
addLog(`+${result.experienceGained} XP awarded.`, 'loot')
@@ -579,7 +585,10 @@ export function PvPRoguelikeScreen({
)
.then((result) => {
setReward(result)
setRunSummary((current) => mergePvpRunRewardSummary(current, result, { bossKilled: false }))
setRunSummary((current) => mergePvpRunRewardSummary(current, result, {
bossKilled: false,
sourceLabel: 'Match Win',
}))
onProfileUpdated(result.profile)
if (result.experienceGained > 0) {
addLog(`Match win bonus: +${result.experienceGained} XP.`, 'loot')
@@ -1416,14 +1425,14 @@ export function PvPRoguelikeScreen({
if (!entry || pvpOverlayEntryDisabled(entry)) return
if (entry.kind === 'queueBack') onExit()
else if (entry.kind === 'pauseResume') setPaused(false)
else if (entry.kind === 'pauseLeave') onExit()
else if (entry.kind === 'pauseLeave') onMainMenu()
else if (entry.kind === 'upgradeBuff') setSelectedBuff(playerBuffChoices[entry.index] ?? null)
else if (entry.kind === 'upgradeDebuff') setSelectedDebuff(playerDebuffChoices[entry.index] ?? null)
else if (entry.kind === 'upgradeContinue') confirmUpgradeChoices()
}
useGameAction((action) => {
if (status === 'queueing' || status === 'round-countdown') {
if (status === 'queueing') {
if (action === 'back' || action === 'pause') onExit()
if (status === 'queueing' && action === 'confirm') openPvpOverlayEntry(activePvpOverlayEntry())
return
@@ -1440,6 +1449,13 @@ export function PvPRoguelikeScreen({
if (action.startsWith('navigate')) movePvpOverlaySelection(action)
return
}
if (status === 'round-countdown') {
if (action === 'back' || action === 'pause') {
setOverlaySelectedIndex(0)
setPaused(true)
}
return
}
if (status === 'upgrade-choice') {
if (action === 'confirm') {
openPvpOverlayEntry(activePvpOverlayEntry())
@@ -1773,16 +1789,16 @@ export function PvPRoguelikeScreen({
onPointerDown={() => setPvpOverlayCursor('pauseResume')}
type="button"
>
Resume
Continue
</button>
<button
className={`secondary-result-button ${pvpOverlayEntrySelected('pauseLeave') ? 'game-selected' : ''}`}
data-controller-nav="skip"
onClick={onExit}
onClick={onMainMenu}
onPointerDown={() => setPvpOverlayCursor('pauseLeave')}
type="button"
>
Leave
Main Menu
</button>
</div>
</div>
@@ -1808,11 +1824,12 @@ export function PvPRoguelikeScreen({
>
<p>{finalEncountersCleared} encounters cleared.</p>
<div className="reward-summary">
<p>Run totals</p>
<p>{runSummary.bossesKilled} bosses killed.</p>
<RewardXpSummary reward={runSummary} />
{runSummary.bossesKilled > 0 && !reward && !rewardError && <p>Final boss rewards still recording...</p>}
{rewardError && <p className="reward-error">{rewardError}</p>}
<PvpRunLootList loot={runSummary.loot} />
<PvpRunLootList loot={runSummary.loot} emptyLabel="No boss coins collected this run." />
{reward && runSummary.bossesKilled === 0 && (
<>
<RewardXpSummary reward={reward} />
+85 -27
View File
@@ -8,8 +8,9 @@ import {
type Spell,
} from '../game'
import { completeRoguelike, recordPvpMatch } from '../profile'
import type { CharacterProfile } from '../profile'
import type { CharacterProfile, DungeonEncounter } from '../profile'
import type { GameMode } from '../gameRepository'
import { roguelikeCoinItemLevel } from '../shared/rewardRules.mjs'
import { PartyMemberFrame } from './PartyFrames'
import { SpellBar } from './SpellBars'
import { barFillStyle } from './barStyles'
@@ -64,9 +65,10 @@ import {
import {
createEmptyRewardSummary,
mergeDungeonRewardSummary,
type RunBossCoinAward,
type RewardSummaryBase,
} from '../combat/rewardSummaries'
import { RewardXpSummary } from './RewardPanels'
import { PvpRunLootList, RewardXpSummary } from './RewardPanels'
import { ResultScreen } from './ResultScreen'
import {
publishPvpMatchState,
@@ -158,6 +160,25 @@ function slotSpellName(slot: SlotKey, spells: Spell[], fallback: string) {
return spells.find((candidate) => candidate.key === slot)?.name ?? fallback
}
function starterSpellsForClass(gameClass: CharacterProfile['classes'][number]) {
return gameClass.spells
.filter((spell) => spell.unlockLevel === 1)
.slice(0, 5)
.map((spell, index) => toCombatSpell(spell, String(index + 1)))
}
function randomCpuClass(classes: CharacterProfile['classes'], fallbackId: CharacterProfile['classes'][number]['id']) {
const pool = classes.length > 0 ? classes : []
return pool[Math.floor(Math.random() * pool.length)] ?? classes.find((candidate) => candidate.id === fallbackId)
}
function stadiumBossCoinSource(bosses: DungeonEncounter[], stage: number) {
const targetItemLevel = roguelikeCoinItemLevel(stage)
const eligible = bosses.filter((boss) => boss.lootTables.some((item) => item.itemLevel === targetItemLevel))
const pool = eligible.length > 0 ? eligible : bosses
return pool.length > 0 ? pool[(stage - 1) % pool.length] : undefined
}
function buildStadiumBuffs(spells: Spell[]): StadiumBuff[] {
const directName = slotSpellName('1', spells, 'Mend')
const sustainName = slotSpellName('2', spells, 'Renew')
@@ -330,11 +351,11 @@ export function PvpStadiumScreen({
onProfileUpdated: (profile: CharacterProfile) => void
}) {
const gameClass = profile.classes.find((candidate) => candidate.id === profile.character.classId)!
const starterSpells = useMemo(() => gameClass.spells
.filter((spell) => spell.unlockLevel === 1)
.slice(0, 5)
.map((spell, index) => toCombatSpell(spell, String(index + 1))), [gameClass.spells])
const [cpuGameClass, setCpuGameClass] = useState(() => randomCpuClass(profile.classes, gameClass.id) ?? gameClass)
const starterSpells = useMemo(() => starterSpellsForClass(gameClass), [gameClass])
const cpuStarterSpells = useMemo(() => starterSpellsForClass(cpuGameClass), [cpuGameClass])
const buffCatalog = useMemo(() => buildStadiumBuffs(starterSpells), [starterSpells])
const cpuBuffCatalog = useMemo(() => buildStadiumBuffs(cpuStarterSpells), [cpuStarterSpells])
const partyTemplate = useMemo(
() => INITIAL_PARTY.map((member) => ({
...member,
@@ -351,6 +372,12 @@ export function PvpStadiumScreen({
)
const rewardDungeon = profile.dungeons.find((candidate) => candidate.contentType === 'dungeon') ?? profile.dungeons[0]
const rewardDifficulty = rewardDungeon.difficulties[0]
const stadiumCoinBosses = useMemo(
() => profile.dungeons
.flatMap((candidate) => candidate.encounters)
.filter((candidate) => candidate.isBoss && candidate.lootTables.length > 0),
[profile.dungeons],
)
const [status, setStatus] = useState<'queueing' | 'round-countdown' | 'playing' | 'shop' | 'won' | 'lost'>('queueing')
const [playerSide, setPlayerSide] = useState<StadiumSideState>(() => createStadiumStarterSide<StadiumBuffId>({
partyTemplate,
@@ -382,6 +409,7 @@ export function PvpStadiumScreen({
clearFloatingTexts,
} = useSidedFloatingCombatText()
const [rewardSummary, setRewardSummary] = useState<RewardSummaryBase>(() => createEmptyRewardSummary())
const [stadiumBossCoins, setStadiumBossCoins] = useState<RunBossCoinAward[]>([])
const [rewardError, setRewardError] = useState('')
const [showEndLog, setShowEndLog] = useState(false)
const selectedIdRef = useRef(partyTemplate[0].id)
@@ -417,8 +445,8 @@ export function PvpStadiumScreen({
cost: playerSpellSlotCost,
})
const opponentBuffSummary = useMemo(
() => summarizeStacks(cpuSide.buffs, buffCatalog),
[buffCatalog, cpuSide.buffs],
() => summarizeStacks(cpuSide.buffs, liveMatch ? buffCatalog : cpuBuffCatalog),
[buffCatalog, cpuBuffCatalog, cpuSide.buffs, liveMatch],
)
const playerBuffSummary = useMemo(
() => summarizeStacks(playerSide.buffs, buffCatalog),
@@ -473,18 +501,31 @@ export function PvpStadiumScreen({
setStatus('round-countdown')
}, [clearRoundCountdown, startRoundCountdown])
const awardXp = useCallback((key: string, mode: StadiumExperienceMode) => {
const awardXp = useCallback((
key: string,
mode: StadiumExperienceMode,
coinSource?: { encounter: DungeonEncounter; stage: number; label: string },
) => {
if (awardedXpRef.current.has(key)) return
awardedXpRef.current.add(key)
completeRoguelike(rewardDungeon.id, rewardDifficulty.id, 0, 0, Math.max(1, Math.floor(playerRef.current.survivalSeconds || 1)), {
bossesCleared: 0,
fightsCleared: 1,
experienceMode: mode,
lootSourceEncounterId: coinSource?.encounter.id,
roguelikeStage: coinSource?.stage,
})
.then((result) => {
setRewardSummary((current) => mergeDungeonRewardSummary(current, result))
if (result.bonusItem && coinSource) {
setStadiumBossCoins((current) => [...current, {
...result.bonusItem!,
sourceLabel: coinSource.label,
}])
}
onProfileUpdated(result.profile)
if (result.experienceGained > 0) addLog(`+${result.experienceGained} XP awarded.`, 'loot')
if (result.bonusItem) addLog(`${result.bonusItem.name} x${result.bonusItem.quantity} awarded.`, 'loot')
})
.catch((reason: unknown) => {
setRewardError(reason instanceof Error ? reason.message : 'Unable to award Stadium XP.')
@@ -521,6 +562,7 @@ export function PvpStadiumScreen({
setLiveMatch(setup.liveMatch)
setPaused(setup.defaults.paused)
setRewardSummary(createEmptyRewardSummary())
setStadiumBossCoins([])
setRewardError(setup.defaults.rewardError)
setShowEndLog(setup.defaults.showEndLog)
clearFloatingTexts()
@@ -559,11 +601,13 @@ export function PvpStadiumScreen({
setLiveMatch(null)
setPaused(setup.defaults.paused)
setRewardSummary(createEmptyRewardSummary())
setStadiumBossCoins([])
setRewardError(setup.defaults.rewardError)
setShowEndLog(setup.defaults.showEndLog)
clearFloatingTexts()
loggedOpponentRoundRef.current = ''
const beginCpuMatch = (randomCpu: CpuDifficulty, message: string) => {
setCpuGameClass(randomCpuClass(profile.classes, gameClass.id) ?? gameClass)
setCpuDifficulty(randomCpu)
setQueueMessage(message)
setLog([{ id: 1, text: message, tone: 'system' }])
@@ -591,7 +635,7 @@ export function PvpStadiumScreen({
},
},
})
}, [beginRoundCountdown, clearFloatingTexts, clearRoundCountdown, cpuPartyTemplate, gameMode, partyTemplate, resetShopTimer, setSelectedTargetId, startLiveMatch])
}, [beginRoundCountdown, clearFloatingTexts, clearRoundCountdown, cpuPartyTemplate, gameClass, gameMode, partyTemplate, profile.classes, resetShopTimer, setSelectedTargetId, startLiveMatch])
useEffect(() => {
const frame = window.requestAnimationFrame(() => startMatch())
@@ -602,6 +646,7 @@ export function PvpStadiumScreen({
current: StadiumSideState,
setCurrent: Dispatch<SetStateAction<StadiumSideState>>,
sideName: 'player' | 'cpu',
spells: Spell[],
spell: Spell,
targetId: string,
) => {
@@ -614,7 +659,7 @@ export function PvpStadiumScreen({
id: (slot) => `slot${slot as SlotKey}-extra-target` as StadiumBuffId,
})
const renewDuration = hasBuff('slot2-double-duration') && spell.key === '2' ? 10 : 5
const shieldEffect = starterSpells.find((candidate) => candidate.kind === 'shield')
const shieldEffect = spells.find((candidate) => candidate.kind === 'shield')
const shieldPower = (sourcePower: number, strength = 1) => Math.round(
sourcePower
* strength
@@ -717,7 +762,7 @@ export function PvpStadiumScreen({
wasReady: effectiveCost === 0 && current.freeCastReady,
},
})
}, [addFloatingHeal, starterSpells])
}, [addFloatingHeal])
const castPlayerSpell = useCallback((spell: Spell) => {
if (status !== 'playing' || !playerAlive) return
@@ -726,9 +771,9 @@ export function PvpStadiumScreen({
const next = typeof value === 'function' ? value(playerRef.current) : value
playerRef.current = next
setPlayerSide(next)
}, 'player', spell, targetId)
}, 'player', starterSpells, spell, targetId)
if (succeeded) addLog(`${spell.name} cast on ${playerRef.current.party.find((member) => member.id === targetId)?.name ?? 'target'}.`, 'heal')
}, [addLog, applySpell, playerAlive, status])
}, [addLog, applySpell, playerAlive, starterSpells, status])
const getTargetParty = useCallback(() => playerRef.current.party, [])
const {
@@ -749,7 +794,7 @@ export function PvpStadiumScreen({
runCpuHealTurn({
side: cpuRef.current,
elapsedTicks,
spells: starterSpells,
spells: cpuStarterSpells,
behavior,
preferSlots: true,
applySpell: (side, spell, targetId) => {
@@ -757,10 +802,10 @@ export function PvpStadiumScreen({
const next = typeof value === 'function' ? value(cpuRef.current) : value
cpuRef.current = next
setCpuSide(next)
}, 'cpu', spell, targetId)
}, 'cpu', cpuStarterSpells, spell, targetId)
},
})
}, [applySpell, cpuDifficulty, elapsedTicks, starterSpells, status])
}, [applySpell, cpuDifficulty, cpuStarterSpells, elapsedTicks, status])
const advanceBoss = useCallback((side: StadiumSideState) => {
if (side.roundStatus !== 'playing') return side
@@ -823,7 +868,7 @@ export function PvpStadiumScreen({
})
if (!liveMatchRef.current) {
const purchases = chooseStadiumCpuPurchases<StadiumBuffId, StadiumBuff>(
buffCatalog,
cpuBuffCatalog,
stadiumShopPointsForOutcome(outcome, 'opponent'),
)
setCpuSide((current) => {
@@ -832,14 +877,17 @@ export function PvpStadiumScreen({
return next
})
}
}, [buffCatalog, startShopTimer])
}, [cpuBuffCatalog, startShopTimer])
const finishRound = useCallback((outcome: StadiumRoundOutcome) => {
if (status !== 'playing') return
if (roundResolvedRef.current) return
roundResolvedRef.current = true
const result = resolveStadiumRound({ outcome, roundIndex, wins: roundWins })
awardXp(result.roundExperience.key, result.roundExperience.mode)
const roundCoinSource = stadiumBossCoinSource(stadiumCoinBosses, roundIndex)
awardXp(result.roundExperience.key, result.roundExperience.mode, roundCoinSource
? { encounter: roundCoinSource, stage: roundIndex, label: `Round ${roundIndex}: ${roundCoinSource.enemyName}` }
: undefined)
addLog(result.log.text, result.log.tone)
if (result.status === 'won') {
setRoundWins(result.nextWins)
@@ -849,7 +897,13 @@ export function PvpStadiumScreen({
playerRef.current = next
return next
})
if (result.matchExperience) awardXp(result.matchExperience.key, result.matchExperience.mode)
if (result.matchExperience) {
const matchCoinStage = roundIndex + 1
const matchCoinSource = stadiumBossCoinSource(stadiumCoinBosses, matchCoinStage)
awardXp(result.matchExperience.key, result.matchExperience.mode, matchCoinSource
? { encounter: matchCoinSource, stage: matchCoinStage, label: `Match Win: ${matchCoinSource.enemyName}` }
: undefined)
}
return
}
if (result.status === 'lost') {
@@ -863,7 +917,7 @@ export function PvpStadiumScreen({
return
}
beginShop(outcome, result.nextWins)
}, [addLog, awardXp, beginShop, roundIndex, roundWins, status])
}, [addLog, awardXp, beginShop, roundIndex, roundWins, stadiumCoinBosses, status])
useEffect(() => {
if (status !== 'playing' || paused) return
@@ -1077,12 +1131,12 @@ export function PvpStadiumScreen({
encounterCount: 5,
party: playerSide.party,
opponentName: opponentLabel,
opponentClassName: liveMatch?.opponentClassName ?? (cpuDifficulty ? `CPU ${cpuDifficulty}` : 'CPU'),
opponentClassName: liveMatch?.opponentClassName ?? (cpuDifficulty ? `${cpuGameClass.name} | CPU ${cpuDifficulty}` : cpuGameClass.name),
opponentParty: cpuSide.party,
opponentEnemyHealth: 0,
opponentResource: cpuSide.resource,
opponentMaxResource: MAX_RESOURCE,
opponentResourceName: gameClass.resourceName,
opponentResourceName: liveMatch ? gameClass.resourceName : cpuGameClass.resourceName,
opponentBuffSummary,
opponentDebuffSummary,
floatingTexts: dualScreenFloatingTexts,
@@ -1110,13 +1164,15 @@ export function PvpStadiumScreen({
activeBindings,
controllerIconStyle,
cpuDifficulty,
cpuGameClass.name,
cpuGameClass.resourceName,
cpuSide.party,
cpuSide.resource,
cpuSide.survivalSeconds,
directPartyTargeting,
dualScreenFloatingTexts,
gameClass.resourceName,
liveMatch?.opponentClassName,
liveMatch,
opponentBuffSummary,
opponentDebuffSummary,
opponentLabel,
@@ -1277,10 +1333,10 @@ export function PvpStadiumScreen({
<div>
<p className="eyebrow">Opponent</p>
<h2>{opponentLabel}</h2>
<small>Survival {formatTime(cpuSide.survivalSeconds)}</small>
<small>{liveMatch?.opponentClassName ?? cpuGameClass.name} | Survival {formatTime(cpuSide.survivalSeconds)}</small>
</div>
<div className="pvp-resource-wrap">
<span>{gameClass.resourceName} {Math.floor(cpuSide.resource)} / {MAX_RESOURCE}</span>
<span>{liveMatch ? gameClass.resourceName : cpuGameClass.resourceName} {Math.floor(cpuSide.resource)} / {MAX_RESOURCE}</span>
<div className="bar mana-bar"><span style={barFillStyle((cpuSide.resource / MAX_RESOURCE) * 100)} /></div>
</div>
</div>
@@ -1401,8 +1457,10 @@ export function PvpStadiumScreen({
>
<p>Final score {roundWins.player} - {roundWins.opponent}</p>
<div className="reward-summary">
<p>Run totals</p>
<RewardXpSummary reward={rewardSummary} />
{rewardError && <p className="reward-error">{rewardError}</p>}
<PvpRunLootList loot={stadiumBossCoins} emptyLabel="No boss coins collected this run." />
</div>
</ResultScreen>
)}
+7 -4
View File
@@ -1,4 +1,5 @@
import type { CombatLogEntry } from '../game'
import type { RunBossCoinAward } from '../combat/rewardSummaries'
import type { DungeonReward, LootRoll } from '../profile'
type BonusItem = NonNullable<DungeonReward['bonusItem']>
@@ -119,14 +120,16 @@ export function LootRollList({
export function PvpRunLootList({
loot,
emptyLabel = 'No boss coins awarded',
}: {
loot: BonusItem[]
loot: RunBossCoinAward[]
emptyLabel?: string
}) {
return (
<div className="run-loot-rolls">
{loot.length > 0 ? loot.map((item, index) => (
<div className="dropped" key={`${item.id}-${index}`}>
<strong>Boss {index + 1}</strong>
<strong>{item.sourceLabel}</strong>
<span>
{item.glyph} {item.name} x{item.quantity}
{item.duplicate ? ` (owned x${item.quantityAfter})` : ''}
@@ -134,8 +137,8 @@ export function PvpRunLootList({
</div>
)) : (
<div>
<strong>Loot</strong>
<span>No boss loot awarded</span>
<strong>Boss Coins</strong>
<span>{emptyLabel}</span>
</div>
)}
</div>
+47
View File
@@ -49,6 +49,11 @@ export type DualScreenCombatState = {
opponentClassName?: string
opponentParty?: PartyMember[]
opponentEnemyHealth?: number
opponentArena?: {
bounds: { width: number, height: number }
bosses: Array<{ id: string, name: string, icon: string, color: string, x: number, y: number, radius: number, health: number, maxHealth: number }>
party: Array<{ id: string, icon: string, color: string, x: number, y: number, radius: number, health: number, maxHealth: number, isHealer: boolean }>
}
opponentResource?: number
opponentMaxResource?: number
opponentResourceName?: string
@@ -638,6 +643,48 @@ export function DualScreenBottomDisplay() {
</section>
)}
{state.opponentArena && (
<section className="dual-opponent-arena" aria-label="Opponent arena">
<div
className="dual-opponent-arena-field"
style={{ aspectRatio: `${state.opponentArena.bounds.width} / ${state.opponentArena.bounds.height}` }}
>
{state.opponentArena.bosses.map((boss) => (
<div
className="dual-opponent-arena-entity boss"
key={boss.id}
style={{
backgroundColor: boss.color,
height: `${Math.max(8, (boss.radius / state.opponentArena!.bounds.height) * 100)}%`,
left: `${(boss.x / state.opponentArena!.bounds.width) * 100}%`,
top: `${(boss.y / state.opponentArena!.bounds.height) * 100}%`,
width: `${Math.max(8, (boss.radius / state.opponentArena!.bounds.width) * 100)}%`,
}}
title={`${boss.name} ${Math.ceil(boss.health)} / ${boss.maxHealth}`}
>
{boss.icon}
</div>
))}
{state.opponentArena.party.map((member) => (
<div
className={`dual-opponent-arena-entity party ${member.isHealer ? 'healer' : ''}`}
key={member.id}
style={{
backgroundColor: member.color,
height: `${Math.max(5, (member.radius / state.opponentArena!.bounds.height) * 100)}%`,
left: `${(member.x / state.opponentArena!.bounds.width) * 100}%`,
opacity: member.health > 0 ? 1 : 0.35,
top: `${(member.y / state.opponentArena!.bounds.height) * 100}%`,
width: `${Math.max(5, (member.radius / state.opponentArena!.bounds.width) * 100)}%`,
}}
>
{member.icon}
</div>
))}
</div>
</section>
)}
<section className={`dual-opponent-party-grid ${state.opponentParty.length > 6 ? 'raid' : ''}`}>
{state.opponentParty.map((member) => (
<PartyMemberFrame
-6
View File
@@ -1127,9 +1127,6 @@ function createLocalRepository(store: LocalSaveStore): GameRepository {
throw new Error('That difficulty is not available for this dungeon.')
}
const cd = save.characters[save.activeClassId]
if (cd.level < difficulty.unlockLevel) {
throw new Error(`${difficulty.name} unlocks at level ${difficulty.unlockLevel}.`)
}
const previousLevel = cd.level
const previousExperience = cd.experience
@@ -1251,9 +1248,6 @@ function createLocalRepository(store: LocalSaveStore): GameRepository {
throw new Error('That difficulty is not available for this roguelike.')
}
const cd = save.characters[save.activeClassId]
if (cd.level < difficulty.unlockLevel) {
throw new Error(`${difficulty.name} unlocks at level ${difficulty.unlockLevel}.`)
}
const previousLevel = cd.level
const previousExperience = cd.experience
+39 -3
View File
@@ -134,6 +134,7 @@ const STORAGE_KEY = 'ashen-halls-input-bindings-v1'
const PREFERENCES_STORAGE_KEY = 'ashen-halls-input-preferences-v1'
const GAME_ACTION_EVENT = 'ashen-halls-game-action'
const NATIVE_CONTROLLER_EVENT = 'ashen-halls-native-controller'
const NATIVE_CONTROLLER_MOTION_EVENT = 'ashen-halls-native-controller-motion'
const FOCUSABLE_SELECTOR = 'button:not(:disabled):not([data-controller-nav="skip"]), input:not(:disabled):not([data-controller-nav="skip"]), select:not(:disabled):not([data-controller-nav="skip"]), textarea:not(:disabled):not([data-controller-nav="skip"]), [tabindex]:not([tabindex="-1"]):not([data-controller-nav="skip"])'
const MAIN_CONTENT_SELECTOR = '.auth-shell, .menu-screen, .content-screen, .dungeon-run-screen, .dual-bottom-display, .iwt2-bottom-display'
const HEADER_CONTENT_SELECTOR = '.app-header'
@@ -142,6 +143,7 @@ const GAMEPAD_MENU_POLL_MS = 1000 / 30
const GAMEPAD_BROWSER_DISCONNECTED_POLL_MS = 250
const CONTROLLER_REPEAT_INITIAL_MS = 260
const CONTROLLER_REPEAT_MS = 85
const NATIVE_STICK_TIMEOUT_MS = 140
const DPAD_NAV_ACTIONS: Partial<Record<string, InputAction>> = {
Button12: 'navigateUp',
Button13: 'navigateDown',
@@ -433,6 +435,10 @@ function hasDedicatedGameNavigation() {
).some(isVisible)
}
function isDedicatedNavigationAction(action: InputAction) {
return action.startsWith('navigate') || action === 'confirm' || action === 'back'
}
function dispatchGameAction(action: InputAction, device: InputDevice) {
window.dispatchEvent(new CustomEvent(GAME_ACTION_EVENT, {
detail: { action, device },
@@ -619,7 +625,12 @@ export function InputProvider({ children }: { children: ReactNode }) {
setLastDevice(device)
document.documentElement.dataset.inputDevice = device
if (controllerUiInput && dedicatedNavAction && hasDedicatedGameNavigation()) {
if (
device === 'controller'
&& dedicatedNavAction
&& !keyboardInputRef.current
&& hasDedicatedGameNavigation()
) {
if (document.activeElement instanceof HTMLElement) document.activeElement.blur()
dispatchGameAction(action, device)
return
@@ -707,6 +718,7 @@ export function InputProvider({ children }: { children: ReactNode }) {
'navigateRight',
'confirm',
'back',
'pause',
] satisfies InputAction[]
const directTargetActions = [
'targetParty1',
@@ -736,7 +748,13 @@ export function InputProvider({ children }: { children: ReactNode }) {
'navigateLeft',
'navigateRight',
] satisfies InputAction[]
const action = DPAD_NAV_ACTIONS[token] && (!combatActive || uiOverlay)
const dedicatedNavigationActive = hasDedicatedGameNavigation() && (!combatActive || uiOverlay)
const action = dedicatedNavigationActive
? uiPriority.find((candidate) => bindingsRef.current.controller[candidate] === token)
?? (DPAD_NAV_ACTIONS[token] && isDedicatedNavigationAction(DPAD_NAV_ACTIONS[token])
? DPAD_NAV_ACTIONS[token]
: undefined)
: DPAD_NAV_ACTIONS[token] && (!combatActive || uiOverlay)
? DPAD_NAV_ACTIONS[token]
: uiOverlay
? uiPriority.find((candidate) => bindingsRef.current.controller[candidate] === token)
@@ -1087,6 +1105,8 @@ export function useMovementVectorRef(enabled = true) {
let frame = 0
const pressedKeys = new Set<string>()
let nativeStick: MovementVector = { x: 0, y: 0 }
let nativeStickUpdatedAt = 0
const keyboardVector = () => normalizedVector(
(pressedKeys.has('KeyD') ? 1 : 0) - (pressedKeys.has('KeyA') ? 1 : 0),
(pressedKeys.has('KeyS') ? 1 : 0) - (pressedKeys.has('KeyW') ? 1 : 0),
@@ -1094,12 +1114,26 @@ export function useMovementVectorRef(enabled = true) {
const updateMovement = () => {
const gamepad = firstConnectedGamepad()
const stick = gamepad ? applyStickDeadzone(gamepad.axes[0] ?? 0, gamepad.axes[1] ?? 0) : { x: 0, y: 0 }
const native = performance.now() - nativeStickUpdatedAt <= NATIVE_STICK_TIMEOUT_MS
? applyStickDeadzone(nativeStick.x, nativeStick.y)
: { x: 0, y: 0 }
const keyboard = keyboardVector()
movementRef.current = Math.hypot(stick.x, stick.y) > 0
movementRef.current = Math.hypot(native.x, native.y) > 0
? native
: Math.hypot(stick.x, stick.y) > 0
? stick
: keyboard
frame = window.requestAnimationFrame(updateMovement)
}
const onNativeMotion = (event: Event) => {
const detail = (event as CustomEvent<Partial<MovementVector>>).detail
nativeStick = {
x: Number(detail.x) || 0,
y: Number(detail.y) || 0,
}
nativeStickUpdatedAt = performance.now()
document.documentElement.dataset.inputDevice = 'controller'
}
const onKeyDown = (event: KeyboardEvent) => {
if (isTextInput(document.activeElement)) return
if (!['KeyW', 'KeyA', 'KeyS', 'KeyD'].includes(event.code)) return
@@ -1113,12 +1147,14 @@ export function useMovementVectorRef(enabled = true) {
event.preventDefault()
}
window.addEventListener(NATIVE_CONTROLLER_MOTION_EVENT, onNativeMotion)
window.addEventListener('keydown', onKeyDown)
window.addEventListener('keyup', onKeyUp)
frame = window.requestAnimationFrame(updateMovement)
return () => {
window.cancelAnimationFrame(frame)
window.removeEventListener(NATIVE_CONTROLLER_MOTION_EVENT, onNativeMotion)
window.removeEventListener('keydown', onKeyDown)
window.removeEventListener('keyup', onKeyUp)
movementRef.current = { x: 0, y: 0 }
+41 -43
View File
@@ -1,5 +1,4 @@
import { lazy, Suspense, useEffect, useMemo, useState } from 'react'
import { AuthScreen } from '../../components/AuthScreen'
import {
loadCpuPvpLeaderboard,
type CpuPvpLeaderboardEntry,
@@ -138,11 +137,21 @@ function ScreenLoading() {
type RoguelikeVariant = 'pve' | 'pvp'
function IWantToHeal1App({ onBackToGameSelect }: { onBackToGameSelect: () => void }) {
type IWantToHeal1AppProps = {
initialSession: AuthSession
onAuthenticationCleared: () => void
onBackToGameSelect: () => void
}
function IWantToHeal1App({
initialSession,
onAuthenticationCleared,
onBackToGameSelect,
}: IWantToHeal1AppProps) {
const { enabled: dualScreenEnabled } = useDualScreen()
const [screen, setScreen] = useState<Screen>('menu')
const [account, setAccount] = useState<Account | null>(null)
const [profile, setProfile] = useState<CharacterProfile | null>(null)
const [account, setAccount] = useState<Account | null>(initialSession.account)
const [profile, setProfile] = useState<CharacterProfile | null>(initialSession.profile)
const [authChecked, setAuthChecked] = useState(false)
const [gameMode, setGameMode] = useState<GameMode>(getGameMode())
const [serverMessage, setServerMessage] = useState('')
@@ -186,6 +195,10 @@ function IWantToHeal1App({ onBackToGameSelect }: { onBackToGameSelect: () => voi
.finally(() => setAuthChecked(true))
}, [])
useEffect(() => {
if (authChecked && (!account || !profile)) onAuthenticationCleared()
}, [account, authChecked, onAuthenticationCleared, profile])
useEffect(() => {
const handleModeChange = (event: Event) => {
const nextMode = (event as CustomEvent<GameMode>).detail
@@ -292,7 +305,6 @@ function IWantToHeal1App({ onBackToGameSelect }: { onBackToGameSelect: () => voi
const characterLevel = profile?.character.level ?? 0
const savedTier = tierOptions.find((candidate) => (
candidate.droppedItemLevel === savedDifficulty?.droppedItemLevel
&& characterLevel >= candidate.unlockLevel
))
if (savedTier) return savedTier
for (let index = tierOptions.length - 1; index >= 0; index -= 1) {
@@ -350,18 +362,6 @@ function IWantToHeal1App({ onBackToGameSelect }: { onBackToGameSelect: () => voi
[leaderboardCategory, selectedActivityOption?.leaderboards, selectedDifficultyOption?.id],
)
function acceptSession(session: AuthSession) {
setAccount(session.account)
setProfile(session.profile)
setGameMode(getGameMode())
setScreen('menu')
setError('')
setServerMessage('')
window.requestAnimationFrame(() => {
focusFirstControl()
})
}
async function signOut() {
try {
await logoutAccount()
@@ -371,6 +371,7 @@ function IWantToHeal1App({ onBackToGameSelect }: { onBackToGameSelect: () => voi
setScreen('menu')
setSyncMessage('')
setSyncComparison(null)
onAuthenticationCleared()
} catch (reason) {
setError(reason instanceof Error ? reason.message : 'Unable to sign out.')
}
@@ -498,7 +499,7 @@ function IWantToHeal1App({ onBackToGameSelect }: { onBackToGameSelect: () => voi
function dungeonEntries() {
const difficulty = selectedDifficultyOption ?? selectedActivityOption?.difficulties[0]
const locked = profile && difficulty ? profile.character.level < difficulty.unlockLevel : true
const locked = !profile || !difficulty
const entries: DungeonNavEntry[] = [
{ kind: 'back' },
]
@@ -520,7 +521,7 @@ function IWantToHeal1App({ onBackToGameSelect }: { onBackToGameSelect: () => voi
entries.push({
kind: 'activity',
index,
disabled: !profile || profile.character.level < candidateDifficulty.unlockLevel,
disabled: !profile || !candidateDifficulty,
})
})
entries.push(
@@ -531,7 +532,7 @@ function IWantToHeal1App({ onBackToGameSelect }: { onBackToGameSelect: () => voi
entries.push({
kind: 'tier',
index,
disabled: !profile || profile.character.level < difficultyOption.unlockLevel,
disabled: !profile || !difficultyOption,
})
})
entries.push({ kind: 'loot' })
@@ -590,7 +591,6 @@ function IWantToHeal1App({ onBackToGameSelect }: { onBackToGameSelect: () => voi
(option) => option.droppedItemLevel === selectedDifficultyOption.droppedItemLevel,
) ?? candidate.difficulties[0]
: candidate.difficulties[0]
if (profile && profile.character.level < difficulty.unlockLevel) return
if (screen === 'raids') setSelectedRaidId(candidate.id)
else setSelectedDungeonId(candidate.id)
setSelectedDifficultyId(difficulty.id)
@@ -599,7 +599,7 @@ function IWantToHeal1App({ onBackToGameSelect }: { onBackToGameSelect: () => voi
function selectTierByIndex(index: number) {
const difficulty = tierOptions[index]
const activity = selectedActivityOption ?? activityOptions[0]
if (!difficulty || !activity || (profile && profile.character.level < difficulty.unlockLevel)) return
if (!difficulty || !activity) return
setActivityPage(0)
const nextActivity = activity.difficulties.some(
(candidate) => candidate.droppedItemLevel === difficulty.droppedItemLevel,
@@ -620,7 +620,7 @@ function IWantToHeal1App({ onBackToGameSelect }: { onBackToGameSelect: () => voi
function startSelectedRun(marathon: boolean) {
const activity = selectedActivityOption ?? activityOptions[0]
const difficulty = selectedDifficultyOption ?? activity?.difficulties[0]
if (!activity || !difficulty || (profile && profile.character.level < difficulty.unlockLevel)) return
if (!activity || !difficulty) return
setSelectedMarathonMode(marathon)
setCombatContentId(activity.id)
setSelectedDifficultyId(difficulty.id)
@@ -785,7 +785,6 @@ function IWantToHeal1App({ onBackToGameSelect }: { onBackToGameSelect: () => voi
|| !selectedActivityOption
|| !selectedDifficultyOption
) return null
const locked = profile.character.level < selectedDifficultyOption.unlockLevel
return {
contentType: selectedActivityOption.contentType,
title: selectedActivityOption.name,
@@ -795,7 +794,7 @@ function IWantToHeal1App({ onBackToGameSelect }: { onBackToGameSelect: () => voi
difficultyName: selectedDifficultyOption.name,
itemLevel: selectedDifficultyOption.droppedItemLevel,
experience: Math.round(selectedActivityOption.experienceReward * selectedDifficultyOption.experienceMultiplier),
lockedReason: locked ? `Unlocks at level ${selectedDifficultyOption.unlockLevel}` : undefined,
lockedReason: undefined,
stats: {
health: `${selectedDifficultyOption.healthMultiplier.toFixed(2)}x`,
damage: `${selectedDifficultyOption.damageMultiplier.toFixed(2)}x`,
@@ -832,10 +831,13 @@ function IWantToHeal1App({ onBackToGameSelect }: { onBackToGameSelect: () => voi
if (!account || !profile) {
return (
<AuthScreen
onAuthenticated={acceptSession}
serverMessage={serverMessage}
/>
<main className="game-shell">
<section className="message-panel">
<p className="eyebrow">Opening Chronicle</p>
<h1>Returning to Sign In...</h1>
{serverMessage && <p>{serverMessage}</p>}
</section>
</main>
)
}
@@ -858,6 +860,7 @@ function IWantToHeal1App({ onBackToGameSelect }: { onBackToGameSelect: () => voi
onExit={() => {
setScreen(combatContentId < 0 ? 'roguelike' : dungeon.contentType === 'raid' ? 'raids' : 'dungeons')
}}
onMainMenu={() => setScreen('menu')}
onProfileUpdated={setProfile}
/>
</Suspense>
@@ -891,6 +894,10 @@ function IWantToHeal1App({ onBackToGameSelect }: { onBackToGameSelect: () => voi
setRoguelikeVariant('pvp')
setScreen('roguelike')
}}
onMainMenu={() => {
setCpuLeaderboard(loadCpuPvpLeaderboard(pvpContentType))
setScreen('menu')
}}
onProfileUpdated={setProfile}
profile={profile}
/>
@@ -912,7 +919,6 @@ function IWantToHeal1App({ onBackToGameSelect }: { onBackToGameSelect: () => voi
const activityPageEnd = Math.min(activityOptions.length, (currentActivityPage + 1) * ACTIVITY_PAGE_SIZE)
const activity = selectedActivityOption ?? dungeon
const selectedDifficulty = selectedDifficultyOption ?? activity.difficulties[0]
const difficultyLocked = profile.character.level < selectedDifficulty.unlockLevel
return (
<main className={`game-shell ${screen === 'dungeons' || screen === 'raids' ? 'dungeon-shell' : ''} ${screen === 'customize' ? 'workshop-shell' : ''} ${screen === 'settings' ? 'settings-shell' : ''}`}>
{screen !== 'hunter-profile' && (
@@ -1266,13 +1272,11 @@ function IWantToHeal1App({ onBackToGameSelect }: { onBackToGameSelect: () => voi
const difficulty = candidate.difficulties.find(
(option) => option.droppedItemLevel === selectedDifficulty.droppedItemLevel,
) ?? candidate.difficulties[0]
const locked = profile.character.level < difficulty.unlockLevel
const selected = candidate.id === activity.id
return (
<button
className={`activity-card ${selected ? 'selected' : ''} ${locked ? 'locked' : ''} ${dungeonEntrySelected('activity', index) ? 'game-selected' : ''}`}
className={`activity-card ${selected ? 'selected' : ''} ${dungeonEntrySelected('activity', index) ? 'game-selected' : ''}`}
data-controller-nav="skip"
disabled={locked}
key={candidate.id}
onClick={() => {
if (screen === 'raids') setSelectedRaidId(candidate.id)
@@ -1305,16 +1309,13 @@ function IWantToHeal1App({ onBackToGameSelect }: { onBackToGameSelect: () => voi
<h2>Run</h2>
</div>
<small>
{difficultyLocked
? `Unlocks at level ${selectedDifficulty.unlockLevel}`
: 'Pick a hunt or marathon.'}
Pick a hunt or marathon.
</small>
</div>
<div className="part-picker">
<button
className={`primary-button selected-part ${dungeonEntrySelected('start') ? 'game-selected' : ''}`}
data-controller-nav="skip"
disabled={difficultyLocked}
onClick={() => {
setSelectedMarathonMode(false)
setCombatContentId(activity.id)
@@ -1329,7 +1330,6 @@ function IWantToHeal1App({ onBackToGameSelect }: { onBackToGameSelect: () => voi
<button
className={`primary-button ${selectedMarathonMode ? 'selected-part' : ''} ${dungeonEntrySelected('marathon') ? 'game-selected' : ''}`}
data-controller-nav="skip"
disabled={difficultyLocked}
onClick={() => {
setSelectedMarathonMode(true)
setCombatContentId(activity.id)
@@ -1350,17 +1350,15 @@ function IWantToHeal1App({ onBackToGameSelect }: { onBackToGameSelect: () => voi
<p className="eyebrow">Item Level</p>
<h2>Tier</h2>
</div>
<small>{screen === 'raids' ? 'Raid' : 'Dungeon'} tiers unlock by level.</small>
<small>{screen === 'raids' ? 'Raid' : 'Dungeon'} tiers are available at every level.</small>
</div>
<div className="tier-grid">
{tierOptions.map((difficulty, index) => {
const locked = profile.character.level < difficulty.unlockLevel
const selected = difficulty.droppedItemLevel === selectedDifficulty.droppedItemLevel
return (
<button
className={`${selected ? 'selected' : ''} ${locked ? 'locked' : ''} ${dungeonEntrySelected('tier', index) ? 'game-selected' : ''}`}
className={`${selected ? 'selected' : ''} ${dungeonEntrySelected('tier', index) ? 'game-selected' : ''}`}
data-controller-nav="skip"
disabled={locked}
key={difficulty.id}
onClick={() => {
setActivityPage(0)
@@ -1384,7 +1382,7 @@ function IWantToHeal1App({ onBackToGameSelect }: { onBackToGameSelect: () => voi
type="button"
>
<strong>iLvl {difficulty.droppedItemLevel}</strong>
<span>{locked ? `Level ${difficulty.unlockLevel}` : difficulty.name}</span>
<span>{difficulty.name}</span>
</button>
)
})}
+258 -87
View File
@@ -1,5 +1,7 @@
import { useEffect, useMemo, useState } from 'react'
import { useEffect, useMemo, useRef, useState } from 'react'
import { useGameAction } from '../../input'
import { getGameMode } from '../../gameRepository'
import { startPvpQueueWithCpuFallback } from '../../pvpQueueLifecycle'
import { summarizeChoiceStacks } from '../../combat/roguelikeUpgrades'
import {
useDualScreen,
@@ -13,6 +15,7 @@ import {
Iwt2CloudSaveScreen,
Iwt2CustomizeCharacterScreen,
Iwt2DungeonsScreen,
Iwt2GearUpgradeScreen,
Iwt2HunterProfileScreen,
Iwt2ModeScreen,
Iwt2RoguelikeScreen,
@@ -25,6 +28,13 @@ import {
type Iwt2Save,
} from './save/iwt2Repository'
import { IWT2_BOSS_METADATA, type Iwt2BossId } from './content/bosses'
import { iwt2BossCoinRewardFor } from './content/bossRewards'
import {
findIwt2Difficulty,
IWT2_DUNGEON_DIFFICULTIES,
IWT2_RAID_DIFFICULTIES,
type Iwt2Difficulty,
} from './content/difficulties'
import { abilitiesForHealer, IWT2_HEALER_METADATA } from './content/healerAbilities'
import {
buildIwt2OpponentDebuffChoices,
@@ -36,6 +46,13 @@ import {
type Iwt2RoguelikeSelfBuffId,
type Iwt2RoguelikeVariant,
} from './content/roguelike'
import {
createIwt2WeightedRoguelikeBossPair,
createUniformIwt2RoguelikeBossPair,
IWT2_PVE_ROGUELIKE_WEIGHTED_BOSS_PROGRESSION_ENABLED,
IWT2_PVP_ROGUELIKE_WEIGHTED_BOSS_PROGRESSION_ENABLED,
IWT2_PVP_STADIUM_WEIGHTED_BOSS_PROGRESSION_ENABLED,
} from './content/roguelikeBossProgression'
type Iwt2Screen =
| 'menu'
@@ -46,14 +63,17 @@ type Iwt2Screen =
| 'roguelike'
| 'roguelike-arena'
| 'roguelike-upgrade'
| 'gear-upgrade'
| 'hunter-profile'
| 'customize-character'
| 'settings'
const IWT2_MENU_COLUMNS = 4
const IWT2_MENU_COLUMNS = 2
const IWT2_ROGUELIKE_CHOICE_COUNT = 3
const IWT2_PVP_FIRST_BUFF_EXTRA_TARGET_CHANCE = 0.65
type Iwt2RoguelikeRunState = {
bossIds: Iwt2BossId[]
buffs: Iwt2RoguelikeSelfBuffId[]
contentType: Iwt2RoguelikeContentType
debuffs: Iwt2RoguelikeOpponentDebuffId[]
@@ -69,16 +89,10 @@ const MENU_ITEMS: Array<{
description: string
glyph: string
}> = [
{
screen: 'cloud-save',
title: 'Backup Slot',
description: 'Save or restore the isolated IWT2 progress slot.',
glyph: 'C',
},
{
screen: 'dungeons',
title: 'Dungeons',
description: 'Queue into Bulldrome, Yian Kut Ku, Great Jaggi, and Khezu boss arenas.',
description: 'Queue into seven modular IWT2 boss arenas.',
glyph: 'D',
},
{
@@ -99,6 +113,12 @@ const MENU_ITEMS: Array<{
description: 'Race another healer through roguelike encounters with buffs and sabotage.',
glyph: 'P',
},
{
screen: 'gear-upgrade',
title: 'Gear Upgrade',
description: 'Spend boss coins on class gear slots and infusion abilities.',
glyph: 'G',
},
{
screen: 'hunter-profile',
title: 'Hunter Profile',
@@ -111,6 +131,12 @@ const MENU_ITEMS: Array<{
description: 'Choose healer kit, armor palette, and IWT2 hunter callsign.',
glyph: 'K',
},
{
screen: 'cloud-save',
title: 'Backup Slot',
description: 'Choose local, online, or fresh IWT2 progress.',
glyph: 'C',
},
{
screen: 'settings',
title: 'Settings',
@@ -119,24 +145,47 @@ const MENU_ITEMS: Array<{
},
]
export function IWantToHeal2App({ onBackToGameSelect }: { onBackToGameSelect: () => void }) {
export function IWantToHeal2App({
onlineBackupsAvailable,
onBackToGameSelect,
}: {
onlineBackupsAvailable: boolean
onBackToGameSelect: () => void
}) {
const { enabled: dualScreenEnabled } = useDualScreen()
const [screen, setScreen] = useState<Iwt2Screen>('menu')
const [save, setSave] = useState<Iwt2Save>(loadIwt2Save)
const [selectedIndex, setSelectedIndex] = useState(0)
const [selectedBossId, setSelectedBossId] = useState<Iwt2BossId>('bulldrome')
const [arenaModeLabel, setArenaModeLabel] = useState('Dungeon')
const [arenaDifficulty, setArenaDifficulty] = useState<Iwt2Difficulty>(IWT2_DUNGEON_DIFFICULTIES[0])
const [selectedDungeonDifficultySlug, setSelectedDungeonDifficultySlug] = useState(IWT2_DUNGEON_DIFFICULTIES[0].slug)
const [selectedRaidDifficultySlug, setSelectedRaidDifficultySlug] = useState(IWT2_RAID_DIFFICULTIES[0].slug)
const [roguelikeVariant, setRoguelikeVariant] = useState<Iwt2RoguelikeVariant>('pve')
const [roguelikeContentType, setRoguelikeContentType] = useState<Iwt2RoguelikeContentType>('dungeon')
const [roguelikeRun, setRoguelikeRun] = useState<Iwt2RoguelikeRunState | null>(null)
const [pvpQueueMessage, setPvpQueueMessage] = useState('')
const [pvpQueueing, setPvpQueueing] = useState(false)
const cancelPvpQueueRef = useRef<(() => void) | null>(null)
useEffect(() => {
writeIwt2Save(save)
}, [save])
useEffect(() => () => {
cancelPvpQueueRef.current?.()
}, [])
function cancelIwt2PvpQueue() {
cancelPvpQueueRef.current?.()
cancelPvpQueueRef.current = null
setPvpQueueing(false)
setPvpQueueMessage('')
}
const setupDualScreenState = useMemo<DualScreenSetupState | null>(
() => buildIwt2SetupDualScreenState(screen, selectedBossId, save),
[save, screen, selectedBossId],
() => buildIwt2SetupDualScreenState(screen, selectedBossId, save, currentSetupDifficulty(screen, selectedDungeonDifficultySlug, selectedRaidDifficultySlug)),
[save, screen, selectedBossId, selectedDungeonDifficultySlug, selectedRaidDifficultySlug],
)
const workshopDualScreenState = useMemo<DualScreenWorkshopState | null>(
() => buildIwt2WorkshopDualScreenState(screen, save),
@@ -182,6 +231,8 @@ export function IWantToHeal2App({ onBackToGameSelect }: { onBackToGameSelect: ()
return (
<BossArenaScreen
bossId={selectedBossId}
difficulty={arenaDifficulty}
key={`arena-${selectedBossId}-${arenaModeLabel}-${arenaDifficulty.slug}`}
modeLabel={arenaModeLabel}
save={save}
onBack={() => setScreen('menu')}
@@ -193,7 +244,9 @@ export function IWantToHeal2App({ onBackToGameSelect }: { onBackToGameSelect: ()
if (screen === 'roguelike-arena' && roguelikeRun) {
return (
<BossArenaScreen
bossIds={roguelikeRun.bossIds}
bossId={selectedBossId}
key={`roguelike-${roguelikeRun.variant}-${roguelikeRun.contentType}-${roguelikeRun.stage}-${roguelikeRun.bossIds.join('-')}`}
roguelikeRun={{
buffs: roguelikeRun.buffs,
contentType: roguelikeRun.contentType,
@@ -212,6 +265,11 @@ export function IWantToHeal2App({ onBackToGameSelect }: { onBackToGameSelect: ()
}}
save={save}
onBack={() => setScreen('roguelike')}
onMainMenu={() => setScreen('menu')}
onPvpRequeue={() => {
setScreen('roguelike')
startIwt2RoguelikeRun()
}}
onSaveUpdated={setSave}
/>
)
@@ -233,7 +291,7 @@ export function IWantToHeal2App({ onBackToGameSelect }: { onBackToGameSelect: ()
onChoose={(buffId, debuffId) => {
const nextRun = applyRoguelikeChoice(roguelikeRun, buffId, debuffId, save)
setRoguelikeRun(nextRun)
setSelectedBossId(bossForRoguelike(nextRun.variant, nextRun.contentType, nextRun.stage))
setSelectedBossId(nextRun.bossIds[0] ?? 'bulldrome')
setScreen('roguelike-arena')
}}
/>
@@ -246,12 +304,17 @@ export function IWantToHeal2App({ onBackToGameSelect }: { onBackToGameSelect: ()
<main className="game-shell iwt2-shell">
<Iwt2Header save={save} onBackToGameSelect={onBackToGameSelect} />
<Iwt2DungeonsScreen
difficultySlug={selectedDungeonDifficultySlug}
save={save}
onBack={() => setScreen('menu')}
onOpenBoss={(bossId) => {
setArenaModeLabel('Dungeon')
onDifficultyChange={setSelectedDungeonDifficultySlug}
onOpenBoss={(bossId, difficulty) => {
setArenaModeLabel(`${difficulty.name} Dungeon`)
setArenaDifficulty(difficulty)
setSelectedBossId(bossId)
setScreen('arena')
}}
onPreviewBoss={setSelectedBossId}
/>
</main>
)
@@ -264,20 +327,24 @@ export function IWantToHeal2App({ onBackToGameSelect }: { onBackToGameSelect: ()
<Iwt2RoguelikeScreen
contentType={roguelikeContentType}
variant={roguelikeVariant}
onBack={() => setScreen('menu')}
onBack={() => {
cancelIwt2PvpQueue()
setScreen('menu')
}}
onCancelQueue={cancelIwt2PvpQueue}
onContentTypeChange={setRoguelikeContentType}
onStart={() => {
const nextRun = createRoguelikeRun(save, roguelikeVariant, roguelikeContentType)
setRoguelikeRun(nextRun)
setSelectedBossId(bossForRoguelike(roguelikeVariant, roguelikeContentType, nextRun.stage))
setScreen('roguelike-arena')
startIwt2RoguelikeRun()
}}
onVariantChange={(nextVariant) => {
cancelIwt2PvpQueue()
setRoguelikeVariant(nextVariant)
if (nextVariant === 'pve' && roguelikeContentType === 'stadium') {
setRoguelikeContentType('dungeon')
}
}}
queueing={pvpQueueing}
queueMessage={pvpQueueMessage}
/>
</main>
)
@@ -288,13 +355,18 @@ export function IWantToHeal2App({ onBackToGameSelect }: { onBackToGameSelect: ()
<main className="game-shell iwt2-shell">
<Iwt2Header save={save} onBackToGameSelect={onBackToGameSelect} />
<Iwt2ModeScreen
difficultySlug={selectedRaidDifficultySlug}
mode="Raids"
save={save}
onBack={() => setScreen('menu')}
onOpenBoss={(bossId) => {
setArenaModeLabel('Raid')
onDifficultyChange={setSelectedRaidDifficultySlug}
onOpenBoss={(bossId, difficulty) => {
setArenaModeLabel(`${difficulty.name} Raid`)
setArenaDifficulty(difficulty)
setSelectedBossId(bossId)
setScreen('arena')
}}
onPreviewBoss={setSelectedBossId}
/>
</main>
)
@@ -303,12 +375,29 @@ export function IWantToHeal2App({ onBackToGameSelect }: { onBackToGameSelect: ()
if (screen === 'hunter-profile') {
return (
<main className="game-shell iwt2-shell">
<Iwt2Header save={save} onBackToGameSelect={onBackToGameSelect} />
<Iwt2HunterProfileScreen save={save} onBack={() => setScreen('menu')} />
</main>
)
}
if (screen === 'gear-upgrade') {
return (
<main className="game-shell iwt2-shell">
<Iwt2Header
save={save}
title="Gear Upgrade"
onBack={() => setScreen('menu')}
onBackToGameSelect={onBackToGameSelect}
/>
<Iwt2GearUpgradeScreen
save={save}
onBack={() => setScreen('menu')}
onSaveUpdated={setSave}
/>
</main>
)
}
if (screen === 'customize-character') {
return (
<main className="game-shell iwt2-shell">
@@ -328,6 +417,7 @@ export function IWantToHeal2App({ onBackToGameSelect }: { onBackToGameSelect: ()
<Iwt2Header save={save} onBackToGameSelect={onBackToGameSelect} />
<Iwt2CloudSaveScreen
save={save}
onlineBackupsAvailable={onlineBackupsAvailable}
onBack={() => setScreen('menu')}
onSaveUpdated={setSave}
/>
@@ -350,15 +440,13 @@ export function IWantToHeal2App({ onBackToGameSelect }: { onBackToGameSelect: ()
{screen === 'menu' && (
<section className="iwt2-menu-screen" data-game-nav-active="true">
<div className="iwt2-menu-heading">
<p className="eyebrow">I Want To Heal 2</p>
<h1>Mode Select</h1>
</div>
<div className="iwt2-menu-grid">
{MENU_ITEMS.map((item, index) => (
<button
className={`iwt2-menu-card ${selectedIndex === index ? 'game-selected' : ''}`}
aria-label={`${item.title}. ${item.description}`}
data-controller-nav="skip"
data-game-selected={selectedIndex === index ? 'true' : undefined}
key={`${item.screen}-${item.title}`}
onClick={() => openMenuItem(item)}
onPointerDown={() => setSelectedIndex(index)}
@@ -376,24 +464,63 @@ export function IWantToHeal2App({ onBackToGameSelect }: { onBackToGameSelect: ()
)}
</main>
)
function startIwt2RoguelikeRun() {
cancelIwt2PvpQueue()
if (roguelikeVariant !== 'pvp') {
beginIwt2RoguelikeArena(roguelikeVariant, roguelikeContentType)
return
}
const startStage = 1
setPvpQueueing(true)
setPvpQueueMessage('Queuing for PvP...')
cancelPvpQueueRef.current = startPvpQueueWithCpuFallback<unknown>({
contentType: roguelikeContentType,
startStage,
gameMode: getGameMode(),
liveMatchActive: () => false,
onSearching: (message) => {
setPvpQueueing(true)
setPvpQueueMessage(message)
},
onCpuMatch: (_difficulty, message) => {
cancelPvpQueueRef.current = null
setPvpQueueing(false)
setPvpQueueMessage(message)
beginIwt2RoguelikeArena('pvp', roguelikeContentType)
},
onLiveMatch: (...liveMatchArgs) => {
const message = liveMatchArgs[2]
cancelPvpQueueRef.current = null
setPvpQueueing(false)
setPvpQueueMessage(message)
beginIwt2RoguelikeArena('pvp', roguelikeContentType)
},
messages: {
offline: (difficulty) => `Offline mode. CPU ${difficulty} enters IWT2 ${formatRoguelikeContentType(roguelikeContentType)}.`,
searching: `Searching IWT2 ${formatRoguelikeContentType(roguelikeContentType)} queue for 5s.`,
notFound: (difficulty) => `No IWT2 opponent found after 5s. CPU ${difficulty} steps in.`,
unavailable: (difficulty) => `PvP server unavailable. CPU ${difficulty} steps in.`,
liveFound: () => `Opponent found. Starting IWT2 ${formatRoguelikeContentType(roguelikeContentType)} race.`,
},
})
}
function bossForRoguelike(
function beginIwt2RoguelikeArena(
variant: Iwt2RoguelikeVariant,
contentType: Iwt2RoguelikeContentType,
stage = 1,
): Iwt2BossId {
const dungeonBosses: Iwt2BossId[] = variant === 'pvp'
? ['yian-kut-ku', 'great-jaggi', 'bulldrome', 'khezu']
: ['bulldrome', 'yian-kut-ku', 'great-jaggi', 'khezu']
const raidBosses: Iwt2BossId[] = ['khezu', 'great-jaggi', 'yian-kut-ku', 'bulldrome']
const stadiumBosses: Iwt2BossId[] = ['great-jaggi', 'yian-kut-ku', 'khezu', 'bulldrome']
const pool = contentType === 'raid'
? raidBosses
: contentType === 'stadium'
? stadiumBosses
: dungeonBosses
return pool[(stage - 1) % pool.length]
) {
const nextRun = createRoguelikeRun(save, variant, contentType)
setRoguelikeRun(nextRun)
setSelectedBossId(nextRun.bossIds[0] ?? 'bulldrome')
setScreen('roguelike-arena')
}
}
function formatRoguelikeContentType(contentType: Iwt2RoguelikeContentType) {
if (contentType === 'raid') return 'Raid'
if (contentType === 'stadium') return 'Stadium'
return 'Dungeon'
}
function createRoguelikeRun(
@@ -402,6 +529,7 @@ function createRoguelikeRun(
contentType: Iwt2RoguelikeContentType,
): Iwt2RoguelikeRunState {
return {
bossIds: createRoguelikeBossPair(variant, contentType, 1),
buffs: [],
contentType,
debuffs: [],
@@ -416,7 +544,14 @@ function buildRoguelikeChoices(save: Iwt2Save, variant: Iwt2RoguelikeVariant) {
const selfCatalog = [IWT2_REVIVE_PARTY_CHOICE, ...buildIwt2SelfBuffChoices(abilities)]
const debuffCatalog = buildIwt2OpponentDebuffChoices(abilities)
return {
selfChoices: chooseRunChoices(selfCatalog, IWT2_ROGUELIKE_CHOICE_COUNT),
selfChoices: variant === 'pvp'
? chooseRunChoicesWithPreferredFirst(
selfCatalog,
IWT2_ROGUELIKE_CHOICE_COUNT,
isExtraTargetBuff,
IWT2_PVP_FIRST_BUFF_EXTRA_TARGET_CHANCE,
)
: chooseRunChoices(selfCatalog, IWT2_ROGUELIKE_CHOICE_COUNT),
debuffChoices: variant === 'pvp'
? chooseRunChoices(debuffCatalog, IWT2_ROGUELIKE_CHOICE_COUNT)
: [],
@@ -462,11 +597,29 @@ function applyRoguelikeChoice(
return {
...run,
...nextBase,
bossIds: createRoguelikeBossPair(run.variant, run.contentType, run.stage + 1),
...buildRoguelikeChoices(save, run.variant),
stage: run.stage + 1,
}
}
function createRoguelikeBossPair(
variant: Iwt2RoguelikeVariant,
contentType: Iwt2RoguelikeContentType,
stage: number,
): Iwt2BossId[] {
const weightedProgressionEnabled = variant === 'pve'
? IWT2_PVE_ROGUELIKE_WEIGHTED_BOSS_PROGRESSION_ENABLED
: contentType === 'stadium'
? IWT2_PVP_STADIUM_WEIGHTED_BOSS_PROGRESSION_ENABLED
: IWT2_PVP_ROGUELIKE_WEIGHTED_BOSS_PROGRESSION_ENABLED
if (weightedProgressionEnabled) {
return createIwt2WeightedRoguelikeBossPair(stage)
}
return createUniformIwt2RoguelikeBossPair()
}
function chooseRunChoices<T>(items: readonly T[], count: number): T[] {
const pool = [...items]
const choices: T[] = []
@@ -478,23 +631,63 @@ function chooseRunChoices<T>(items: readonly T[], count: number): T[] {
return choices
}
function chooseRunChoicesWithPreferredFirst<T>(
items: readonly T[],
count: number,
preferred: (item: T) => boolean,
preferredChance: number,
): T[] {
if (count <= 0) return []
const pool = [...items]
const choices: T[] = []
const preferredPool = pool.filter(preferred)
if (preferredPool.length > 0 && Math.random() < preferredChance) {
const preferredChoice = preferredPool[Math.floor(Math.random() * preferredPool.length)]
const preferredIndex = pool.indexOf(preferredChoice)
if (preferredIndex >= 0) {
const [choice] = pool.splice(preferredIndex, 1)
if (choice) choices.push(choice)
}
}
while (pool.length > 0 && choices.length < count) {
const index = Math.floor(Math.random() * pool.length)
const [choice] = pool.splice(index, 1)
if (choice) choices.push(choice)
}
return choices
}
function isExtraTargetBuff(choice: Iwt2RoguelikeChoice<Iwt2RoguelikeSelfBuffId>) {
return choice.id.endsWith('-extra-target')
}
function Iwt2Header({
onBack,
onBackToGameSelect,
save,
title,
}: {
onBack?: () => void
onBackToGameSelect: () => void
save: Iwt2Save
title?: string
}) {
return (
<header className="topbar app-header">
<button className="brand-button" onClick={onBackToGameSelect} type="button">
<strong>Games</strong>
</button>
{title && <strong className="iwt2-header-title">{title}</strong>}
<div className="character-summary">
<strong>{save.character.name}</strong>
<small>IWT2 Level {save.character.level}</small>
<small>{save.character.experience} XP</small>
</div>
{onBack && (
<button className="back-button iwt2-header-back" data-controller-nav="skip" onClick={onBack} type="button">
Back
</button>
)}
</header>
)
}
@@ -503,63 +696,48 @@ function buildIwt2SetupDualScreenState(
screen: Iwt2Screen,
selectedBossId: Iwt2BossId,
save: Iwt2Save,
difficulty: Iwt2Difficulty,
): DualScreenSetupState | null {
if (screen !== 'dungeons' && screen !== 'raids') return null
const boss = IWT2_BOSS_METADATA[selectedBossId]
const raid = screen === 'raids'
const coinReward = iwt2BossCoinRewardFor(selectedBossId, difficulty.slug)
return {
contentType: raid ? 'raid' : 'dungeon',
description: raid
? `${boss.name} raid assignment. Tank holds aggro while party moves around modular boss mechanics.`
: `${boss.name} arena. Heal the party through melee pressure, telegraphs, hazards, and stun recovery.`,
difficultyName: `IWT2 Level ${save.character.level}`,
experience: 125,
? `${boss.name} raid assignment. Tank holds aggro while party moves around modular boss mechanics. Reward: ${coinReward.name}.`
: `${boss.name} arena. Heal the party through melee pressure, telegraphs, hazards, and stun recovery. Reward: ${coinReward.name}.`,
difficultyName: difficulty.name,
experience: Math.round(125 * difficulty.experienceMultiplier),
initials: boss.icon,
itemLevel: save.character.level,
itemLevel: difficulty.droppedItemLevel,
lockedReason: undefined,
stats: {
damage: `${boss.meleeDamage}`,
health: `${boss.maxHealth}`,
loot: 'IWT2',
xp: '125',
damage: `${difficulty.damageMultiplier.toFixed(2)}x`,
health: `${difficulty.healthMultiplier.toFixed(2)}x`,
loot: coinReward.name,
xp: `${difficulty.experienceMultiplier.toFixed(1)}x`,
},
subtitle: `${raid ? 'Raid' : 'Dungeon'} | 6 Players | ${IWT2_HEALER_METADATA[save.character.healerStyle].name}`,
title: raid ? `${boss.name} Raid` : `${boss.name} Arena`,
}
}
function currentSetupDifficulty(
screen: Iwt2Screen,
selectedDungeonDifficultySlug: string,
selectedRaidDifficultySlug: string,
): Iwt2Difficulty {
if (screen === 'raids') {
return findIwt2Difficulty(IWT2_RAID_DIFFICULTIES, selectedRaidDifficultySlug)
}
return findIwt2Difficulty(IWT2_DUNGEON_DIFFICULTIES, selectedDungeonDifficultySlug)
}
function buildIwt2WorkshopDualScreenState(
screen: Iwt2Screen,
save: Iwt2Save,
): DualScreenWorkshopState | null {
if (screen === 'hunter-profile') {
return {
items: [
{
glyph: 'H',
meta: `${save.character.experience} XP`,
status: `Level ${save.character.level}`,
title: save.character.name,
},
{
glyph: IWT2_HEALER_METADATA[save.character.healerStyle].icon,
meta: IWT2_HEALER_METADATA[save.character.healerStyle].description,
status: 'Class',
title: IWT2_HEALER_METADATA[save.character.healerStyle].name,
},
...(Object.keys(IWT2_BOSS_METADATA) as Iwt2BossId[]).map((bossId) => ({
glyph: IWT2_BOSS_METADATA[bossId].icon,
meta: `${save.collectionLog.bossKills[bossId] ?? 0} kills`,
status: `${save.collectionLog.dropsFound[bossDropIdForAppSummary(bossId)] ?? 0} drops`,
title: IWT2_BOSS_METADATA[bossId].name,
})),
],
mode: 'collection',
subtitle: 'IWT2 inventory and collection log',
summary: `${save.inventory.length} inventory slots`,
title: 'Hunter Profile',
}
}
if (screen === 'customize-character') {
const healer = IWT2_HEALER_METADATA[save.character.healerStyle]
return {
@@ -578,10 +756,3 @@ function buildIwt2WorkshopDualScreenState(
return null
}
function bossDropIdForAppSummary(bossId: Iwt2BossId): string {
if (bossId === 'yian-kut-ku') return 'yian-kut-ku-scale'
if (bossId === 'great-jaggi') return 'great-jaggi-hide'
if (bossId === 'khezu') return 'khezu-pearl'
return 'raw-bulldrome-coin'
}
+1
View File
@@ -42,6 +42,7 @@ export function Iwt2BottomDisplay() {
binding={activeBindings[action]}
iconStyle="playstation"
/>{' '}
<img alt="" aria-hidden="true" className="iwt2-bottom-target-icon" draggable={false} src={target.uiIconUrl} />
{label}
</div>
)
+3
View File
@@ -1,11 +1,13 @@
export function ArenaBar({
className = '',
current,
label,
max,
shield = 0,
}: {
className?: string
current: number
label?: string
max: number
shield?: number
}) {
@@ -15,6 +17,7 @@ export function ArenaBar({
<div className={`iwt2-bar ${className}`}>
<span style={{ width: `${percent}%` }} />
{shieldPercent > 0 && <i style={{ width: `${shieldPercent}%` }} />}
{label && <em>{label}</em>}
</div>
)
}
+14 -5
View File
@@ -2,16 +2,25 @@ import type { Iwt2BossEntityState } from '../sim'
import { ArenaBar } from './ArenaBars'
import { IWT2_BOSS_METADATA } from '../content/bosses'
export function BossHud({ boss }: { boss: Iwt2BossEntityState }) {
const metadata = IWT2_BOSS_METADATA[boss.bossId]
export function BossHud({ boss, bosses }: { boss?: Iwt2BossEntityState, bosses?: Iwt2BossEntityState[] }) {
const entries = bosses ?? (boss ? [boss] : [])
return (
<div className="iwt2-boss-hud">
{entries.map((entry) => {
const metadata = IWT2_BOSS_METADATA[entry.bossId]
return (
<div className="iwt2-boss-hud-row" key={entry.id}>
<div>
<strong>{metadata.name}</strong>
<small>{Math.ceil(boss.health)} / {boss.maxHealth} HP</small>
<small>{Math.ceil(entry.health)} / {entry.maxHealth} HP</small>
{entry.maxArmor > 0 && <small>{Math.ceil(entry.armor)} / {entry.maxArmor} Armor</small>}
{entry.mechanicEnergyMax > 0 && <small>{Math.ceil(entry.mechanicEnergy)} / {entry.mechanicEnergyMax} Static</small>}
</div>
<small className="iwt2-boss-phase">{boss.attackPhase}</small>
<ArenaBar className="boss" current={boss.health} max={boss.maxHealth} />
<small className="iwt2-boss-phase">{entry.attackPhase}</small>
<ArenaBar className="boss" current={entry.health} max={entry.maxHealth} />
</div>
)
})}
</div>
)
}
+5 -3
View File
@@ -27,6 +27,7 @@ export function PartyFrames({
<button
className={`iwt2-party-row ${targetBinding ? 'has-target-binding' : ''} ${selected ? 'game-selected selected' : ''}`}
data-controller-nav="skip"
data-game-selected={selected ? 'true' : undefined}
key={member.id}
onClick={() => onTarget(member.id)}
type="button"
@@ -39,13 +40,14 @@ export function PartyFrames({
/>
</span>
)}
<span style={{ background: meta.color }}>{meta.icon}</span>
<span className="iwt2-party-portrait" style={{ backgroundColor: meta.color }}>
<img alt="" aria-hidden="true" draggable={false} src={meta.uiIconUrl} />
</span>
<div>
<div className="iwt2-party-row-title">
<strong>{meta.name}</strong>
<small>{Math.ceil(member.health)}</small>
</div>
<ArenaBar className="hp" current={member.health} max={member.maxHealth} shield={member.shield} />
<ArenaBar className="hp" current={member.health} label={`${Math.ceil(member.maxHealth)}`} max={member.maxHealth} shield={member.shield} />
{member.maxMana > 0 && (
<ArenaBar className="mana" current={member.mana} max={member.maxMana} />
)}
+129
View File
@@ -0,0 +1,129 @@
import type { Iwt2BossId } from './bosses'
export const IWT2_BOSS_PET_DROP_RATE = 1 / 500
export type Iwt2BossCoinReward = {
id: string
name: string
rarity: 'common' | 'uncommon' | 'rare' | 'epic' | 'legendary'
itemLevel: number
glyph: string
}
export type Iwt2BossPetReward = {
id: string
name: string
}
type Iwt2CoinTier = {
idPrefix: string
namePrefix: string
rarity: Iwt2BossCoinReward['rarity']
itemLevel: number
glyph: string
}
const IWT2_COIN_TIERS: Record<string, Iwt2CoinTier> = {
initiate: { idPrefix: 'raw', namePrefix: 'Raw', rarity: 'common', itemLevel: 1, glyph: 'R' },
veteran: { idPrefix: 'green', namePrefix: 'Green', rarity: 'uncommon', itemLevel: 10, glyph: 'G' },
champion: { idPrefix: 'blue', namePrefix: 'Blue', rarity: 'rare', itemLevel: 15, glyph: 'B' },
mythic: { idPrefix: 'purple', namePrefix: 'Purple', rarity: 'epic', itemLevel: 20, glyph: 'P' },
ascendant: { idPrefix: 'orange', namePrefix: 'Orange', rarity: 'legendary', itemLevel: 25, glyph: 'O' },
'raid-normal': { idPrefix: 'green', namePrefix: 'Green', rarity: 'uncommon', itemLevel: 10, glyph: 'G' },
'raid-champion': { idPrefix: 'blue', namePrefix: 'Blue', rarity: 'rare', itemLevel: 15, glyph: 'B' },
'raid-mythic': { idPrefix: 'purple', namePrefix: 'Purple', rarity: 'epic', itemLevel: 20, glyph: 'P' },
'raid-ascendant': { idPrefix: 'orange', namePrefix: 'Orange', rarity: 'legendary', itemLevel: 25, glyph: 'O' },
}
const IWT2_BOSS_REWARD_DISPLAY_NAMES: Record<Iwt2BossId, string> = {
'barroth': 'Mirehorn',
'bulldrome': 'Bristlemaw',
'cinderback-ricochet': 'Cinderback Ricochet',
'crystal-bat-matriarch': 'Crystal Bat Matriarch',
'ember-mantis-duelist': 'Ember Mantis Duelist',
'great-jaggi': 'Packfang Alpha',
'hollowcrown-revenant': 'Hollowcrown Revenant',
'khezu': 'Palevolt Maw',
'obsidian-ram-golem': 'Obsidian Ram Golem',
'rathian': 'Verdant Wyrm',
'rimebastion': 'Rimebastion',
'sandglass-scorpion': 'Sandglass Scorpion',
'stormcoil-wyrm': 'Stormcoil Wyrm',
'tobi-kadachi': 'Stormtail',
'venom-orchid-hydra': 'Venom Orchid Hydra',
'yian-kut-ku': 'Emberquill',
}
export const IWT2_BOSS_COIN_DIFFICULTY_SLUGS = [
'initiate',
'veteran',
'champion',
'mythic',
'ascendant',
] as const
export const IWT2_LEGACY_BOSS_MATERIAL_REWARDS: Record<Iwt2BossId, { id: string, name: string }> = {
'barroth': { id: 'barroth-shell', name: 'Mirehorn Shell' },
'bulldrome': { id: 'raw-bulldrome-coin', name: 'Raw Bristlemaw Coin' },
'cinderback-ricochet': { id: 'cinderback-plate', name: 'Cinderback Plate' },
'crystal-bat-matriarch': { id: 'crystal-bat-fang', name: 'Crystal Bat Fang' },
'ember-mantis-duelist': { id: 'ember-mantis-blade', name: 'Ember Mantis Blade' },
'great-jaggi': { id: 'great-jaggi-hide', name: 'Packfang Alpha Hide' },
'hollowcrown-revenant': { id: 'hollowcrown-antler', name: 'Hollowcrown Antler' },
'khezu': { id: 'khezu-pearl', name: 'Palevolt Maw Pearl' },
'obsidian-ram-golem': { id: 'obsidian-ram-core', name: 'Obsidian Ram Core' },
'rathian': { id: 'rathian-scale', name: 'Verdant Wyrm Scale' },
'rimebastion': { id: 'rimebastion-core', name: 'Rimebastion Core' },
'sandglass-scorpion': { id: 'sandglass-stinger', name: 'Sandglass Stinger' },
'stormcoil-wyrm': { id: 'stormcoil-conductor', name: 'Stormcoil Conductor' },
'tobi-kadachi': { id: 'tobi-kadachi-pelt', name: 'Stormtail Pelt' },
'venom-orchid-hydra': { id: 'venom-orchid-pod', name: 'Venom Orchid Pod' },
'yian-kut-ku': { id: 'yian-kut-ku-scale', name: 'Emberquill Scale' },
}
const IWT2_BOSS_PET_REWARDS: Record<Iwt2BossId, Iwt2BossPetReward> = {
'barroth': { id: 'barroth-pet', name: 'Mirehorn Pet' },
'bulldrome': { id: 'bulldrome-pet', name: 'Bristlemaw Pet' },
'cinderback-ricochet': { id: 'cinderback-ricochet-pet', name: 'Cinderback Ricochet Pet' },
'crystal-bat-matriarch': { id: 'crystal-bat-matriarch-pet', name: 'Crystal Bat Matriarch Pet' },
'ember-mantis-duelist': { id: 'ember-mantis-duelist-pet', name: 'Ember Mantis Duelist Pet' },
'great-jaggi': { id: 'great-jaggi-pet', name: 'Packfang Alpha Pet' },
'hollowcrown-revenant': { id: 'hollowcrown-revenant-pet', name: 'Hollowcrown Revenant Pet' },
'khezu': { id: 'khezu-pet', name: 'Palevolt Maw Pet' },
'obsidian-ram-golem': { id: 'obsidian-ram-golem-pet', name: 'Obsidian Ram Golem Pet' },
'rathian': { id: 'rathian-pet', name: 'Verdant Wyrm Pet' },
'rimebastion': { id: 'rimebastion-pet', name: 'Rimebastion Pet' },
'sandglass-scorpion': { id: 'sandglass-scorpion-pet', name: 'Sandglass Scorpion Pet' },
'stormcoil-wyrm': { id: 'stormcoil-wyrm-pet', name: 'Stormcoil Wyrm Pet' },
'tobi-kadachi': { id: 'tobi-kadachi-pet', name: 'Stormtail Pet' },
'venom-orchid-hydra': { id: 'venom-orchid-hydra-pet', name: 'Venom Orchid Hydra Pet' },
'yian-kut-ku': { id: 'yian-kut-ku-pet', name: 'Emberquill Pet' },
}
export function iwt2BossCoinRewardFor(
bossId: Iwt2BossId,
difficultySlug = 'initiate',
): Iwt2BossCoinReward {
const tier = IWT2_COIN_TIERS[difficultySlug] ?? IWT2_COIN_TIERS.initiate
return {
id: `${tier.idPrefix}-${bossId}-coin`,
name: `${tier.namePrefix} ${formatBossNameForCoin(bossId)} Coin`,
rarity: tier.rarity,
itemLevel: tier.itemLevel,
glyph: tier.glyph,
}
}
export function iwt2BossCoinRewardsFor(bossId: Iwt2BossId): Iwt2BossCoinReward[] {
return IWT2_BOSS_COIN_DIFFICULTY_SLUGS.map((difficultySlug) => (
iwt2BossCoinRewardFor(bossId, difficultySlug)
))
}
export function iwt2BossPetRewardFor(bossId: Iwt2BossId): Iwt2BossPetReward {
return IWT2_BOSS_PET_REWARDS[bossId]
}
function formatBossNameForCoin(bossId: Iwt2BossId): string {
return IWT2_BOSS_REWARD_DISPLAY_NAMES[bossId]
}
+604 -24
View File
@@ -1,6 +1,22 @@
import { IWT2_BALANCE_OVERRIDES } from './balanceOverrides'
export type Iwt2BossId = 'bulldrome' | 'yian-kut-ku' | 'great-jaggi' | 'khezu'
export type Iwt2BossId =
| 'bulldrome'
| 'yian-kut-ku'
| 'great-jaggi'
| 'khezu'
| 'rathian'
| 'barroth'
| 'tobi-kadachi'
| 'rimebastion'
| 'ember-mantis-duelist'
| 'cinderback-ricochet'
| 'obsidian-ram-golem'
| 'stormcoil-wyrm'
| 'venom-orchid-hydra'
| 'sandglass-scorpion'
| 'crystal-bat-matriarch'
| 'hollowcrown-revenant'
export type Iwt2BalanceOverrides = {
bosses?: Partial<Record<Iwt2BossId, Partial<Pick<Iwt2BossMetadata, 'maxHealth' | 'birdHealth'>>>>
@@ -10,6 +26,11 @@ export type Iwt2BossMetadata = {
id: Iwt2BossId
name: string
icon: string
spriteUrl: string
spriteView?: 'topDown' | 'side'
spriteWidthScale?: number
spriteHeightScale?: number
spriteYOffsetScale?: number
color: string
accentColor: string
maxHealth: number
@@ -64,45 +85,120 @@ export type Iwt2BossMetadata = {
lightningStrikeDamage?: number
lightningStrikeStunSeconds?: number
lightningStrikeCount?: number
poisonTailCooldown?: number
tailSweepWindup?: number
tailSweepRecover?: number
tailSweepInnerRadius?: number
tailSweepOuterRadius?: number
tailSweepAngleRadians?: number
tailSweepDamage?: number
tailSweepStunSeconds?: number
poisonSpitCooldown?: number
poisonSpitWindup?: number
poisonPuddleRadius?: number
poisonPuddleDamage?: number
poisonPuddleSeconds?: number
mudArmor?: number
mudSprayCooldown?: number
mudSprayWindup?: number
mudSprayRange?: number
mudSprayAngleRadians?: number
mudSprayDamage?: number
mudSprayStunSeconds?: number
mudPuddleRadius?: number
mudPuddleSeconds?: number
staticEnergyMax?: number
staticEnergyPerSecond?: number
staticEnergyPerMelee?: number
staticPounceWindup?: number
staticPounceSpeed?: number
staticPounceDamage?: number
staticPounceStunSeconds?: number
staticPounceLength?: number
staticPounceWidth?: number
chainShockCooldown?: number
chainShockWindup?: number
chainShockRadius?: number
chainShockDamage?: number
chainShockStunSeconds?: number
iceWallCooldown?: number
iceWallWindup?: number
iceWallActiveSeconds?: number
iceWallCount?: number
iceWallLength?: number
iceWallWidth?: number
iceWallDamage?: number
iceShardDamage?: number
iceShardStunSeconds?: number
slashCooldown?: number
slashWindup?: number
slashDamage?: number
slashStunSeconds?: number
slashWidth?: number
crossSlashAngleRadians?: number
sidestepDistance?: number
ricochetCooldown?: number
ricochetWindup?: number
ricochetSpeed?: number
ricochetDamage?: number
ricochetStunSeconds?: number
ricochetSeconds?: number
lavaTrailRadius?: number
lavaTrailDamage?: number
lavaTrailSeconds?: number
armorSlamWindup?: number
armorSlamRadius?: number
armorSlamDamage?: number
armorSlamStunSeconds?: number
}
const DEFAULT_BULLDROME_BOSS_METADATA: Iwt2BossMetadata = {
id: 'bulldrome',
name: 'Bulldrome',
name: 'Bristlemaw',
icon: 'B',
spriteUrl: '/iwt2/bosses/bulldrome-side-cel.png',
spriteView: 'side',
spriteWidthScale: 6.2,
spriteHeightScale: 4.5,
spriteYOffsetScale: -0.14,
color: '#8f5a3c',
accentColor: '#e6b17f',
maxHealth: 950,
radius: 31,
moveSpeed: 128,
meleeRange: 58,
meleeDamage: 9,
meleeDamage: 20,
meleeCooldown: 1.05,
chargeCooldown: 4.75,
chargeWindup: 0.55,
chargeSpeed: 510,
chargeDamage: 32,
chargeDamage: 60,
chargeStunSeconds: 0.75,
chargeLength: 560,
chargeOvershoot: 120,
chargeWidth: 62,
slamWindup: 0.45,
slamRadius: 104,
slamDamage: 24,
slamDamage: 55,
slamStunSeconds: 0.75,
}
const DEFAULT_YIAN_KUT_KU_BOSS_METADATA: Iwt2BossMetadata = {
id: 'yian-kut-ku',
name: 'Yian Kut Ku',
icon: 'Y',
name: 'Emberquill',
icon: 'E',
spriteUrl: '/iwt2/bosses/yian-kut-ku-side-cel.png',
spriteView: 'side',
spriteWidthScale: 5.9,
spriteHeightScale: 4.7,
spriteYOffsetScale: -0.1,
color: '#d66a35',
accentColor: '#ffd166',
maxHealth: 400,
maxHealth: 750,
radius: 29,
moveSpeed: 118,
meleeRange: 56,
meleeDamage: 8,
meleeDamage: 12,
meleeCooldown: 1,
chargeCooldown: 0,
chargeWindup: 0,
@@ -119,32 +215,37 @@ const DEFAULT_YIAN_KUT_KU_BOSS_METADATA: Iwt2BossMetadata = {
fireballCooldown: 3.6,
fireballWindup: 0.55,
fireballSpeed: 285,
fireballDamage: 12,
fireballDamage: 32,
fireballRadius: 9,
firePuddleRadius: 42,
firePuddleDamage: 7,
firePuddleDamage: 15,
firePuddleSeconds: 8,
birdWaveThresholds: [0.9, 0.4],
birdFlightCooldown: 10,
birdFlightWindup: 0.85,
birdFlightSpeed: 360,
birdHealth: 58,
birdHealth: 100,
birdRadius: 16,
birdContactDamage: 10,
birdContactDamage: 26,
birdStunSeconds: 0.75,
}
const DEFAULT_GREAT_JAGGI_BOSS_METADATA: Iwt2BossMetadata = {
id: 'great-jaggi',
name: 'Great Jaggi',
icon: 'J',
name: 'Packfang Alpha',
icon: 'P',
spriteUrl: '/iwt2/bosses/great-jaggi-side-cel.png',
spriteView: 'side',
spriteWidthScale: 5.9,
spriteHeightScale: 4.1,
spriteYOffsetScale: -0.09,
color: '#3f8f73',
accentColor: '#b8f0aa',
maxHealth: 620,
maxHealth: 1000,
radius: 27,
moveSpeed: 146,
meleeRange: 52,
meleeDamage: 7,
meleeDamage: 18,
meleeCooldown: 0.82,
chargeCooldown: 0,
chargeWindup: 0,
@@ -160,7 +261,7 @@ const DEFAULT_GREAT_JAGGI_BOSS_METADATA: Iwt2BossMetadata = {
slamStunSeconds: 0,
packHowlCooldown: 5.8,
packHowlWindup: 0.95,
packLaneDamage: 15,
packLaneDamage: 45,
packLaneStunSeconds: 0.45,
packLaneWidth: 24,
packLaneCount: 3,
@@ -168,15 +269,20 @@ const DEFAULT_GREAT_JAGGI_BOSS_METADATA: Iwt2BossMetadata = {
const DEFAULT_KHEZU_BOSS_METADATA: Iwt2BossMetadata = {
id: 'khezu',
name: 'Khezu',
icon: 'K',
name: 'Palevolt Maw',
icon: 'P',
spriteUrl: '/iwt2/bosses/khezu-side-cel.png',
spriteView: 'side',
spriteWidthScale: 5.9,
spriteHeightScale: 4.4,
spriteYOffsetScale: -0.12,
color: '#d8d7c9',
accentColor: '#77d9ff',
maxHealth: 760,
maxHealth: 1100,
radius: 30,
moveSpeed: 92,
meleeRange: 58,
meleeDamage: 10,
meleeDamage: 20,
meleeCooldown: 1.15,
chargeCooldown: 0,
chargeWindup: 0,
@@ -194,16 +300,466 @@ const DEFAULT_KHEZU_BOSS_METADATA: Iwt2BossMetadata = {
thunderRingWindup: 0.9,
thunderRingInnerRadius: 70,
thunderRingOuterRadius: 172,
thunderRingDamage: 22,
thunderRingDamage: 60,
thunderRingStunSeconds: 0.7,
lightningStrikeCooldown: 4.2,
lightningStrikeWindup: 0.78,
lightningStrikeRadius: 46,
lightningStrikeDamage: 17,
lightningStrikeDamage: 48,
lightningStrikeStunSeconds: 0.55,
lightningStrikeCount: 2,
}
const DEFAULT_RATHIAN_BOSS_METADATA: Iwt2BossMetadata = {
id: 'rathian',
name: 'Verdant Wyrm',
icon: 'V',
spriteUrl: '/iwt2/bosses/rathian-side-cel.png',
spriteView: 'side',
spriteWidthScale: 6.9,
spriteHeightScale: 4.35,
spriteYOffsetScale: -0.12,
color: '#4d9a58',
accentColor: '#f0c24d',
maxHealth: 1120,
radius: 34,
moveSpeed: 118,
meleeRange: 62,
meleeDamage: 16,
meleeCooldown: 1.08,
chargeCooldown: 0,
chargeWindup: 0,
chargeSpeed: 0,
chargeDamage: 0,
chargeStunSeconds: 0,
chargeLength: 0,
chargeOvershoot: 0,
chargeWidth: 0,
slamWindup: 0,
slamRadius: 0,
slamDamage: 0,
slamStunSeconds: 0,
poisonTailCooldown: 5.4,
tailSweepWindup: 0.72,
tailSweepRecover: 0.48,
tailSweepInnerRadius: 24,
tailSweepOuterRadius: 118,
tailSweepAngleRadians: Math.PI * 1.25,
tailSweepDamage: 45,
tailSweepStunSeconds: 0.55,
poisonSpitCooldown: 6.2,
poisonSpitWindup: 0.7,
poisonPuddleRadius: 46,
poisonPuddleDamage: 15,
poisonPuddleSeconds: 8,
}
const DEFAULT_BARROTH_BOSS_METADATA: Iwt2BossMetadata = {
id: 'barroth',
name: 'Mirehorn',
icon: 'M',
spriteUrl: '/iwt2/bosses/barroth-side-cel.png',
spriteView: 'side',
spriteWidthScale: 6.3,
spriteHeightScale: 3.35,
spriteYOffsetScale: -0.07,
color: '#8d714d',
accentColor: '#d6bd80',
maxHealth: 1280,
radius: 35,
moveSpeed: 104,
meleeRange: 60,
meleeDamage: 16,
meleeCooldown: 1.18,
chargeCooldown: 0,
chargeWindup: 0,
chargeSpeed: 0,
chargeDamage: 0,
chargeStunSeconds: 0,
chargeLength: 0,
chargeOvershoot: 0,
chargeWidth: 0,
slamWindup: 0,
slamRadius: 0,
slamDamage: 0,
slamStunSeconds: 0,
mudArmor: 280,
mudSprayCooldown: 5.8,
mudSprayWindup: 0.82,
mudSprayRange: 172,
mudSprayAngleRadians: Math.PI * 0.58,
mudSprayDamage: 28,
mudSprayStunSeconds: 0.25,
mudPuddleRadius: 40,
mudPuddleSeconds: 7.5,
}
const DEFAULT_TOBI_KADACHI_BOSS_METADATA: Iwt2BossMetadata = {
id: 'tobi-kadachi',
name: 'Stormtail',
icon: 'S',
spriteUrl: '/iwt2/bosses/tobi-kadachi-side-cel.png',
spriteView: 'side',
spriteWidthScale: 6.7,
spriteHeightScale: 3.85,
spriteYOffsetScale: -0.08,
color: '#6a79bd',
accentColor: '#a8f3ff',
maxHealth: 920,
radius: 28,
moveSpeed: 160,
meleeRange: 53,
meleeDamage: 13,
meleeCooldown: 0.78,
chargeCooldown: 2.2,
chargeWindup: 0,
chargeSpeed: 0,
chargeDamage: 0,
chargeStunSeconds: 0,
chargeLength: 0,
chargeOvershoot: 0,
chargeWidth: 0,
slamWindup: 0,
slamRadius: 0,
slamDamage: 0,
slamStunSeconds: 0,
staticEnergyMax: 100,
staticEnergyPerSecond: 16,
staticEnergyPerMelee: 15,
staticPounceWindup: 0.58,
staticPounceSpeed: 560,
staticPounceDamage: 46,
staticPounceStunSeconds: 0.6,
staticPounceLength: 520,
staticPounceWidth: 46,
chainShockCooldown: 5.2,
chainShockWindup: 0.85,
chainShockRadius: 86,
chainShockDamage: 34,
chainShockStunSeconds: 0.45,
}
const DEFAULT_RIMEBASTION_BOSS_METADATA: Iwt2BossMetadata = {
id: 'rimebastion',
name: 'Rimebastion',
icon: 'I',
spriteUrl: '/iwt2/bosses/rimebastion-side-cel.png',
spriteView: 'side',
spriteWidthScale: 7.2,
spriteHeightScale: 4.5,
spriteYOffsetScale: -0.08,
color: '#5f9fd6',
accentColor: '#b8f3ff',
maxHealth: 1380,
radius: 37,
moveSpeed: 86,
meleeRange: 62,
meleeDamage: 16,
meleeCooldown: 1.2,
chargeCooldown: 5.6,
chargeWindup: 0,
chargeSpeed: 0,
chargeDamage: 0,
chargeStunSeconds: 0,
chargeLength: 0,
chargeOvershoot: 0,
chargeWidth: 0,
slamWindup: 0,
slamRadius: 0,
slamDamage: 0,
slamStunSeconds: 0,
iceWallCooldown: 6.2,
iceWallWindup: 0.9,
iceWallActiveSeconds: 0.7,
iceWallCount: 3,
iceWallLength: 180,
iceWallWidth: 22,
iceWallDamage: 18,
iceShardDamage: 34,
iceShardStunSeconds: 0.55,
}
const DEFAULT_EMBER_MANTIS_DUELIST_BOSS_METADATA: Iwt2BossMetadata = {
id: 'ember-mantis-duelist',
name: 'Ember Mantis Duelist',
icon: 'M',
spriteUrl: '/iwt2/bosses/ember-mantis-duelist-side-cel.png',
spriteView: 'side',
spriteWidthScale: 5.6,
spriteHeightScale: 4.6,
spriteYOffsetScale: -0.1,
color: '#b94831',
accentColor: '#ffb24a',
maxHealth: 1040,
radius: 29,
moveSpeed: 168,
meleeRange: 54,
meleeDamage: 13,
meleeCooldown: 0.78,
chargeCooldown: 3.8,
chargeWindup: 0,
chargeSpeed: 0,
chargeDamage: 0,
chargeStunSeconds: 0,
chargeLength: 0,
chargeOvershoot: 0,
chargeWidth: 0,
slamWindup: 0,
slamRadius: 0,
slamDamage: 0,
slamStunSeconds: 0,
slashCooldown: 4.2,
slashWindup: 0.48,
slashDamage: 36,
slashStunSeconds: 0.35,
slashWidth: 24,
crossSlashAngleRadians: Math.PI * 0.32,
sidestepDistance: 94,
}
const DEFAULT_CINDERBACK_RICOCHET_BOSS_METADATA: Iwt2BossMetadata = {
id: 'cinderback-ricochet',
name: 'Cinderback Ricochet',
icon: 'C',
spriteUrl: '/iwt2/bosses/cinderback-ricochet-side-cel.png',
spriteView: 'side',
spriteWidthScale: 6.6,
spriteHeightScale: 3.8,
spriteYOffsetScale: -0.06,
color: '#9a4f2f',
accentColor: '#ff8a3d',
maxHealth: 1250,
radius: 34,
moveSpeed: 106,
meleeRange: 60,
meleeDamage: 14,
meleeCooldown: 1.05,
chargeCooldown: 5.4,
chargeWindup: 0,
chargeSpeed: 0,
chargeDamage: 0,
chargeStunSeconds: 0,
chargeLength: 0,
chargeOvershoot: 0,
chargeWidth: 0,
slamWindup: 0,
slamRadius: 0,
slamDamage: 0,
slamStunSeconds: 0,
ricochetCooldown: 6.6,
ricochetWindup: 0.65,
ricochetSpeed: 440,
ricochetDamage: 40,
ricochetStunSeconds: 0.45,
ricochetSeconds: 1.45,
lavaTrailRadius: 34,
lavaTrailDamage: 15,
lavaTrailSeconds: 5.5,
armorSlamWindup: 0.42,
armorSlamRadius: 86,
armorSlamDamage: 44,
armorSlamStunSeconds: 0.5,
}
const DEFAULT_OBSIDIAN_RAM_GOLEM_BOSS_METADATA: Iwt2BossMetadata = {
id: 'obsidian-ram-golem',
name: 'Obsidian Ram Golem',
icon: 'O',
spriteUrl: '/iwt2/bosses/obsidian-ram-golem-side-cel.png',
spriteView: 'side',
spriteWidthScale: 6.5,
spriteHeightScale: 4.25,
spriteYOffsetScale: -0.08,
color: '#2f3034',
accentColor: '#ff7b32',
maxHealth: 1420,
radius: 36,
moveSpeed: 98,
meleeRange: 62,
meleeDamage: 14,
meleeCooldown: 1.12,
chargeCooldown: 5.7,
chargeWindup: 0,
chargeSpeed: 0,
chargeDamage: 0,
chargeStunSeconds: 0,
chargeLength: 0,
chargeOvershoot: 0,
chargeWidth: 0,
slamWindup: 0,
slamRadius: 0,
slamDamage: 0,
slamStunSeconds: 0,
mudArmor: 240,
}
const DEFAULT_STORMCOIL_WYRM_BOSS_METADATA: Iwt2BossMetadata = {
id: 'stormcoil-wyrm',
name: 'Stormcoil Wyrm',
icon: 'S',
spriteUrl: '/iwt2/bosses/stormcoil-wyrm-side-cel.png',
spriteView: 'side',
spriteWidthScale: 7.1,
spriteHeightScale: 4.15,
spriteYOffsetScale: -0.1,
color: '#273b75',
accentColor: '#78ecff',
maxHealth: 1120,
radius: 30,
moveSpeed: 142,
meleeRange: 58,
meleeDamage: 12,
meleeCooldown: 0.95,
chargeCooldown: 5.1,
chargeWindup: 0,
chargeSpeed: 0,
chargeDamage: 0,
chargeStunSeconds: 0,
chargeLength: 0,
chargeOvershoot: 0,
chargeWidth: 0,
slamWindup: 0,
slamRadius: 0,
slamDamage: 0,
slamStunSeconds: 0,
chainShockCooldown: 5,
chainShockWindup: 0.78,
chainShockRadius: 94,
chainShockDamage: 18,
chainShockStunSeconds: 0.38,
}
const DEFAULT_VENOM_ORCHID_HYDRA_BOSS_METADATA: Iwt2BossMetadata = {
id: 'venom-orchid-hydra',
name: 'Venom Orchid Hydra',
icon: 'V',
spriteUrl: '/iwt2/bosses/venom-orchid-hydra-side-cel.png',
spriteView: 'side',
spriteWidthScale: 7.2,
spriteHeightScale: 4.6,
spriteYOffsetScale: -0.1,
color: '#5e316c',
accentColor: '#d8f05b',
maxHealth: 1320,
radius: 35,
moveSpeed: 84,
meleeRange: 64,
meleeDamage: 12,
meleeCooldown: 1.15,
chargeCooldown: 5.4,
chargeWindup: 0,
chargeSpeed: 0,
chargeDamage: 0,
chargeStunSeconds: 0,
chargeLength: 0,
chargeOvershoot: 0,
chargeWidth: 0,
slamWindup: 0,
slamRadius: 0,
slamDamage: 0,
slamStunSeconds: 0,
poisonSpitCooldown: 5.6,
poisonSpitWindup: 0.75,
poisonPuddleRadius: 42,
poisonPuddleDamage: 15,
poisonPuddleSeconds: 7,
}
const DEFAULT_SANDGLASS_SCORPION_BOSS_METADATA: Iwt2BossMetadata = {
id: 'sandglass-scorpion',
name: 'Sandglass Scorpion',
icon: 'G',
spriteUrl: '/iwt2/bosses/sandglass-scorpion-side-cel.png',
spriteView: 'side',
spriteWidthScale: 6.4,
spriteHeightScale: 4.25,
spriteYOffsetScale: -0.07,
color: '#9d7430',
accentColor: '#ffd15a',
maxHealth: 1245,
radius: 33,
moveSpeed: 126,
meleeRange: 58,
meleeDamage: 13,
meleeCooldown: 0.98,
chargeCooldown: 5.2,
chargeWindup: 0,
chargeSpeed: 0,
chargeDamage: 0,
chargeStunSeconds: 0,
chargeLength: 0,
chargeOvershoot: 0,
chargeWidth: 0,
slamWindup: 0,
slamRadius: 0,
slamDamage: 0,
slamStunSeconds: 0,
mudPuddleRadius: 44,
mudPuddleSeconds: 6,
}
const DEFAULT_CRYSTAL_BAT_MATRIARCH_BOSS_METADATA: Iwt2BossMetadata = {
id: 'crystal-bat-matriarch',
name: 'Crystal Bat Matriarch',
icon: 'Q',
spriteUrl: '/iwt2/bosses/crystal-bat-matriarch-side-cel.png',
spriteView: 'side',
spriteWidthScale: 6.8,
spriteHeightScale: 4.75,
spriteYOffsetScale: -0.12,
color: '#4e2d76',
accentColor: '#8eeaff',
maxHealth: 1050,
radius: 31,
moveSpeed: 150,
meleeRange: 56,
meleeDamage: 11,
meleeCooldown: 0.9,
chargeCooldown: 5.1,
chargeWindup: 0,
chargeSpeed: 0,
chargeDamage: 0,
chargeStunSeconds: 0,
chargeLength: 0,
chargeOvershoot: 0,
chargeWidth: 0,
slamWindup: 0,
slamRadius: 0,
slamDamage: 0,
slamStunSeconds: 0,
}
const DEFAULT_HOLLOWCROWN_REVENANT_BOSS_METADATA: Iwt2BossMetadata = {
id: 'hollowcrown-revenant',
name: 'Hollowcrown Revenant',
icon: 'H',
spriteUrl: '/iwt2/bosses/hollowcrown-revenant-side-cel.png',
spriteView: 'side',
spriteWidthScale: 6.6,
spriteHeightScale: 4.35,
spriteYOffsetScale: -0.1,
color: '#3c3f5e',
accentColor: '#9be8ff',
maxHealth: 1080,
radius: 30,
moveSpeed: 158,
meleeRange: 56,
meleeDamage: 12,
meleeCooldown: 0.9,
chargeCooldown: 4.8,
chargeWindup: 0,
chargeSpeed: 0,
chargeDamage: 0,
chargeStunSeconds: 0,
chargeLength: 0,
chargeOvershoot: 0,
chargeWidth: 0,
slamWindup: 0,
slamRadius: 0,
slamDamage: 0,
slamStunSeconds: 0,
}
function applyBossOverrides(metadata: Iwt2BossMetadata): Iwt2BossMetadata {
const override = IWT2_BALANCE_OVERRIDES.bosses?.[metadata.id]
if (!override) return metadata
@@ -217,10 +773,34 @@ export const BULLDROME_BOSS_METADATA: Iwt2BossMetadata = applyBossOverrides(DEFA
export const YIAN_KUT_KU_BOSS_METADATA: Iwt2BossMetadata = applyBossOverrides(DEFAULT_YIAN_KUT_KU_BOSS_METADATA)
export const GREAT_JAGGI_BOSS_METADATA: Iwt2BossMetadata = applyBossOverrides(DEFAULT_GREAT_JAGGI_BOSS_METADATA)
export const KHEZU_BOSS_METADATA: Iwt2BossMetadata = applyBossOverrides(DEFAULT_KHEZU_BOSS_METADATA)
export const RATHIAN_BOSS_METADATA: Iwt2BossMetadata = applyBossOverrides(DEFAULT_RATHIAN_BOSS_METADATA)
export const BARROTH_BOSS_METADATA: Iwt2BossMetadata = applyBossOverrides(DEFAULT_BARROTH_BOSS_METADATA)
export const TOBI_KADACHI_BOSS_METADATA: Iwt2BossMetadata = applyBossOverrides(DEFAULT_TOBI_KADACHI_BOSS_METADATA)
export const RIMEBASTION_BOSS_METADATA: Iwt2BossMetadata = applyBossOverrides(DEFAULT_RIMEBASTION_BOSS_METADATA)
export const EMBER_MANTIS_DUELIST_BOSS_METADATA: Iwt2BossMetadata = applyBossOverrides(DEFAULT_EMBER_MANTIS_DUELIST_BOSS_METADATA)
export const CINDERBACK_RICOCHET_BOSS_METADATA: Iwt2BossMetadata = applyBossOverrides(DEFAULT_CINDERBACK_RICOCHET_BOSS_METADATA)
export const OBSIDIAN_RAM_GOLEM_BOSS_METADATA: Iwt2BossMetadata = applyBossOverrides(DEFAULT_OBSIDIAN_RAM_GOLEM_BOSS_METADATA)
export const STORMCOIL_WYRM_BOSS_METADATA: Iwt2BossMetadata = applyBossOverrides(DEFAULT_STORMCOIL_WYRM_BOSS_METADATA)
export const VENOM_ORCHID_HYDRA_BOSS_METADATA: Iwt2BossMetadata = applyBossOverrides(DEFAULT_VENOM_ORCHID_HYDRA_BOSS_METADATA)
export const SANDGLASS_SCORPION_BOSS_METADATA: Iwt2BossMetadata = applyBossOverrides(DEFAULT_SANDGLASS_SCORPION_BOSS_METADATA)
export const CRYSTAL_BAT_MATRIARCH_BOSS_METADATA: Iwt2BossMetadata = applyBossOverrides(DEFAULT_CRYSTAL_BAT_MATRIARCH_BOSS_METADATA)
export const HOLLOWCROWN_REVENANT_BOSS_METADATA: Iwt2BossMetadata = applyBossOverrides(DEFAULT_HOLLOWCROWN_REVENANT_BOSS_METADATA)
export const IWT2_BOSS_METADATA: Record<Iwt2BossId, Iwt2BossMetadata> = {
bulldrome: BULLDROME_BOSS_METADATA,
'yian-kut-ku': YIAN_KUT_KU_BOSS_METADATA,
'great-jaggi': GREAT_JAGGI_BOSS_METADATA,
khezu: KHEZU_BOSS_METADATA,
rathian: RATHIAN_BOSS_METADATA,
barroth: BARROTH_BOSS_METADATA,
'tobi-kadachi': TOBI_KADACHI_BOSS_METADATA,
rimebastion: RIMEBASTION_BOSS_METADATA,
'ember-mantis-duelist': EMBER_MANTIS_DUELIST_BOSS_METADATA,
'cinderback-ricochet': CINDERBACK_RICOCHET_BOSS_METADATA,
'obsidian-ram-golem': OBSIDIAN_RAM_GOLEM_BOSS_METADATA,
'stormcoil-wyrm': STORMCOIL_WYRM_BOSS_METADATA,
'venom-orchid-hydra': VENOM_ORCHID_HYDRA_BOSS_METADATA,
'sandglass-scorpion': SANDGLASS_SCORPION_BOSS_METADATA,
'crystal-bat-matriarch': CRYSTAL_BAT_MATRIARCH_BOSS_METADATA,
'hollowcrown-revenant': HOLLOWCROWN_REVENANT_BOSS_METADATA,
}
+75 -4
View File
@@ -2,11 +2,48 @@ export type Iwt2PlayerClassId = 'healer' | 'paladin' | 'ranger' | 'mage' | 'rogu
export type Iwt2PlayerClassRole = 'healer' | 'tank' | 'damage'
export type Iwt2ClassEquipmentSlot =
| 'weapon'
| 'offhand'
| 'head'
| 'chest'
| 'hands'
| 'legs'
export type Iwt2ClassLayerMotion = {
offsetXScale?: number
offsetYScale?: number
rotation?: number
}
export type Iwt2ClassWeaponLayer = {
id: string
slot: Iwt2ClassEquipmentSlot
url: string
drawOrder: 'behindBody' | 'front'
heightScale: number
offsetXScale: number
offsetYScale: number
originX?: number
originY?: number
attackMotion?: Iwt2ClassLayerMotion
tierAccentEligible?: boolean
}
export type Iwt2ClassLayeredArenaSprite = {
bodyUrl: string
bodyHeightScale?: number
weaponLayers: Iwt2ClassWeaponLayer[]
}
export type Iwt2ClassMetadata = {
id: Iwt2PlayerClassId
name: string
role: Iwt2PlayerClassRole
icon: string
arenaSpriteUrl: string
arenaLayeredSprite?: Iwt2ClassLayeredArenaSprite
uiIconUrl: string
color: string
accentColor: string
maxHealth: number
@@ -25,6 +62,8 @@ export const IWT2_CLASS_METADATA: Record<Iwt2PlayerClassId, Iwt2ClassMetadata> =
name: 'Player Healer',
role: 'healer',
icon: '+',
arenaSpriteUrl: '/iwt2/classes/arena/healer-chunky.png',
uiIconUrl: '/iwt2/classes/ui/healer-medallion.png',
color: '#2fbf71',
accentColor: '#b7f7cf',
maxHealth: 125,
@@ -41,6 +80,8 @@ export const IWT2_CLASS_METADATA: Record<Iwt2PlayerClassId, Iwt2ClassMetadata> =
name: 'Paladin Tank',
role: 'tank',
icon: '🛡',
arenaSpriteUrl: '/iwt2/classes/arena/paladin-chunky.png',
uiIconUrl: '/iwt2/classes/ui/paladin-medallion.png',
color: '#f2c94c',
accentColor: '#fff0a8',
maxHealth: 190,
@@ -57,6 +98,8 @@ export const IWT2_CLASS_METADATA: Record<Iwt2PlayerClassId, Iwt2ClassMetadata> =
name: 'Ranger',
role: 'damage',
icon: '🏹',
arenaSpriteUrl: '/iwt2/classes/arena/ranger-chunky.png',
uiIconUrl: '/iwt2/classes/ui/ranger-medallion.png',
color: '#4aa3df',
accentColor: '#b9e3ff',
maxHealth: 115,
@@ -64,8 +107,8 @@ export const IWT2_CLASS_METADATA: Record<Iwt2PlayerClassId, Iwt2ClassMetadata> =
radius: 14,
attackRange: 245,
attackDamage: 8,
attackCooldown: 0.62,
castTime: 0.32,
attackCooldown: 0.31,
castTime: 0.16,
projectileSpeed: 410,
},
mage: {
@@ -73,6 +116,8 @@ export const IWT2_CLASS_METADATA: Record<Iwt2PlayerClassId, Iwt2ClassMetadata> =
name: 'Mage',
role: 'damage',
icon: '⚚',
arenaSpriteUrl: '/iwt2/classes/arena/mage-chunky.png',
uiIconUrl: '/iwt2/classes/ui/mage-medallion.png',
color: '#c56cf0',
accentColor: '#efc4ff',
maxHealth: 100,
@@ -80,8 +125,8 @@ export const IWT2_CLASS_METADATA: Record<Iwt2PlayerClassId, Iwt2ClassMetadata> =
radius: 14,
attackRange: 220,
attackDamage: 11,
attackCooldown: 0.78,
castTime: 0.42,
attackCooldown: 0.39,
castTime: 0.21,
projectileSpeed: 330,
},
rogue: {
@@ -89,6 +134,8 @@ export const IWT2_CLASS_METADATA: Record<Iwt2PlayerClassId, Iwt2ClassMetadata> =
name: 'Rogue',
role: 'damage',
icon: '††',
arenaSpriteUrl: '/iwt2/classes/arena/rogue-chunky.png',
uiIconUrl: '/iwt2/classes/ui/rogue-medallion.png',
color: '#55efc4',
accentColor: '#c8fff2',
maxHealth: 110,
@@ -105,6 +152,30 @@ export const IWT2_CLASS_METADATA: Record<Iwt2PlayerClassId, Iwt2ClassMetadata> =
name: 'Warrior',
role: 'damage',
icon: '⚔',
arenaSpriteUrl: '/iwt2/classes/arena/warrior-chunky.png',
arenaLayeredSprite: {
bodyUrl: '/iwt2/classes/arena/layers/warrior-body.png',
weaponLayers: [
{
id: 'axe',
slot: 'weapon',
url: '/iwt2/classes/arena/layers/warrior-weapon-axe.png',
drawOrder: 'front',
heightScale: 1.72,
offsetXScale: 0.38,
offsetYScale: -0.88,
originX: 0.18,
originY: 0.5,
attackMotion: {
offsetXScale: 0.22,
offsetYScale: -0.18,
rotation: 0.54,
},
tierAccentEligible: true,
},
],
},
uiIconUrl: '/iwt2/classes/ui/warrior-medallion.png',
color: '#ff7675',
accentColor: '#ffd0d0',
maxHealth: 150,
+119
View File
@@ -0,0 +1,119 @@
export type Iwt2Difficulty = {
slug: string
name: string
droppedItemLevel: number
unlockLevel: number
healthMultiplier: number
damageMultiplier: number
experienceMultiplier: number
description: string
}
export const IWT2_DUNGEON_DIFFICULTIES: Iwt2Difficulty[] = [
{
slug: 'initiate',
name: 'Initiate',
droppedItemLevel: 1,
unlockLevel: 1,
healthMultiplier: 0.8,
damageMultiplier: 0.8,
experienceMultiplier: 1,
description: 'IWT1 starter dungeon tuning.',
},
{
slug: 'veteran',
name: 'Veteran',
droppedItemLevel: 10,
unlockLevel: 10,
healthMultiplier: 1.45,
damageMultiplier: 1.25,
experienceMultiplier: 2,
description: 'IWT1 veteran dungeon tuning.',
},
{
slug: 'champion',
name: 'Champion',
droppedItemLevel: 15,
unlockLevel: 15,
healthMultiplier: 1.7,
damageMultiplier: 1.45,
experienceMultiplier: 2.2,
description: 'IWT1 champion dungeon tuning.',
},
{
slug: 'mythic',
name: 'Mythic',
droppedItemLevel: 20,
unlockLevel: 20,
healthMultiplier: 2.25,
damageMultiplier: 1.85,
experienceMultiplier: 3.5,
description: 'IWT1 mythic dungeon tuning.',
},
{
slug: 'ascendant',
name: 'Ascendant',
droppedItemLevel: 25,
unlockLevel: 25,
healthMultiplier: 2.8,
damageMultiplier: 2.25,
experienceMultiplier: 4.5,
description: 'IWT1 ascendant dungeon tuning.',
},
]
export const IWT2_RAID_DIFFICULTIES: Iwt2Difficulty[] = [
{
slug: 'raid-normal',
name: 'Normal',
droppedItemLevel: 10,
unlockLevel: 10,
healthMultiplier: 1.45,
damageMultiplier: 1.25,
experienceMultiplier: 2,
description: 'IWT1 normal raid tuning.',
},
{
slug: 'raid-champion',
name: 'Champion Raid',
droppedItemLevel: 15,
unlockLevel: 15,
healthMultiplier: 1.7,
damageMultiplier: 1.45,
experienceMultiplier: 2.4,
description: 'IWT1 champion raid tuning.',
},
{
slug: 'raid-mythic',
name: 'Mythic Raid',
droppedItemLevel: 20,
unlockLevel: 20,
healthMultiplier: 2.25,
damageMultiplier: 1.85,
experienceMultiplier: 3.5,
description: 'IWT1 mythic raid tuning.',
},
{
slug: 'raid-ascendant',
name: 'Ascendant Raid',
droppedItemLevel: 25,
unlockLevel: 25,
healthMultiplier: 2.8,
damageMultiplier: 2.25,
experienceMultiplier: 4.5,
description: 'IWT1 ascendant raid tuning.',
},
]
export function findIwt2Difficulty(
difficulties: readonly Iwt2Difficulty[],
slug: string,
): Iwt2Difficulty {
return difficulties.find((difficulty) => difficulty.slug === slug) ?? difficulties[0]
}
export function isIwt2DifficultyUnlocked(difficulty: Iwt2Difficulty, level: number): boolean {
void difficulty
void level
return true
}
+199
View File
@@ -0,0 +1,199 @@
import type { Iwt2BossId } from './bosses'
import type { Iwt2PlayerClassId } from './classes'
import { iwt2BossCoinRewardFor } from './bossRewards'
import { IWT2_INFUSION_ABILITIES, type Iwt2InfusionAbilityId } from './infusionAbilities'
export { IWT2_INFUSION_ABILITIES, iwt2InfusionAbilitiesForClass } from './infusionAbilities'
export type { Iwt2InfusionAbility, Iwt2InfusionAbilityId } from './infusionAbilities'
export type Iwt2GearSlotId = 'weapon' | 'helmet' | 'chest' | 'legs' | 'feet'
export type Iwt2GearLevel = 0 | 1 | 2 | 3 | 4 | 5
export type Iwt2GearStatId =
| 'maxHealth'
| 'moveSpeed'
| 'healingPower'
| 'damage'
| 'attackCooldown'
| 'projectileSpeed'
| 'stunResist'
| 'hazardDamageTaken'
export type Iwt2GearSlotProgress = {
level: Iwt2GearLevel
}
export type Iwt2ClassGearProgress = {
slots: Record<Iwt2GearSlotId, Iwt2GearSlotProgress>
infusionAbilityId: Iwt2InfusionAbilityId | null
}
export type Iwt2GearProgress = Record<Iwt2PlayerClassId, Iwt2ClassGearProgress>
export type Iwt2GearUpgradeCost = {
itemId: string
itemName: string
quantity: number
}
export type Iwt2GearSlotRecipe = {
classId: Iwt2PlayerClassId
slotId: Iwt2GearSlotId
primaryBossId: Iwt2BossId
secondaryBossId: Iwt2BossId
statId: Iwt2GearStatId
}
export const IWT2_GEAR_SLOTS: Iwt2GearSlotId[] = ['weapon', 'helmet', 'chest', 'legs', 'feet']
export const IWT2_GEAR_SLOT_LABELS: Record<Iwt2GearSlotId, string> = {
weapon: 'Weapon',
helmet: 'Helmet',
chest: 'Chest',
legs: 'Legs',
feet: 'Feet',
}
export const IWT2_GEAR_STAT_LABELS: Record<Iwt2GearStatId, string> = {
maxHealth: 'Max Health',
moveSpeed: 'Move Speed',
healingPower: 'Healing Power',
damage: 'Damage',
attackCooldown: 'Cooldown',
projectileSpeed: 'Projectile Speed',
stunResist: 'Stun Resist',
hazardDamageTaken: 'Hazard Damage Taken',
}
export const IWT2_GEAR_SLOT_RECIPES: Record<Iwt2PlayerClassId, Record<Iwt2GearSlotId, Iwt2GearSlotRecipe>> = {
healer: {
weapon: slotRecipe('healer', 'weapon', 'rathian', 'yian-kut-ku', 'healingPower'),
helmet: slotRecipe('healer', 'helmet', 'khezu', 'rimebastion', 'attackCooldown'),
chest: slotRecipe('healer', 'chest', 'barroth', 'obsidian-ram-golem', 'maxHealth'),
legs: slotRecipe('healer', 'legs', 'tobi-kadachi', 'great-jaggi', 'moveSpeed'),
feet: slotRecipe('healer', 'feet', 'venom-orchid-hydra', 'sandglass-scorpion', 'hazardDamageTaken'),
},
paladin: {
weapon: slotRecipe('paladin', 'weapon', 'obsidian-ram-golem', 'bulldrome', 'damage'),
helmet: slotRecipe('paladin', 'helmet', 'khezu', 'hollowcrown-revenant', 'stunResist'),
chest: slotRecipe('paladin', 'chest', 'barroth', 'rimebastion', 'maxHealth'),
legs: slotRecipe('paladin', 'legs', 'bulldrome', 'tobi-kadachi', 'moveSpeed'),
feet: slotRecipe('paladin', 'feet', 'sandglass-scorpion', 'great-jaggi', 'hazardDamageTaken'),
},
ranger: {
weapon: slotRecipe('ranger', 'weapon', 'cinderback-ricochet', 'yian-kut-ku', 'damage'),
helmet: slotRecipe('ranger', 'helmet', 'crystal-bat-matriarch', 'stormcoil-wyrm', 'attackCooldown'),
chest: slotRecipe('ranger', 'chest', 'great-jaggi', 'barroth', 'maxHealth'),
legs: slotRecipe('ranger', 'legs', 'tobi-kadachi', 'crystal-bat-matriarch', 'moveSpeed'),
feet: slotRecipe('ranger', 'feet', 'sandglass-scorpion', 'venom-orchid-hydra', 'hazardDamageTaken'),
},
mage: {
weapon: slotRecipe('mage', 'weapon', 'stormcoil-wyrm', 'yian-kut-ku', 'damage'),
helmet: slotRecipe('mage', 'helmet', 'rimebastion', 'khezu', 'attackCooldown'),
chest: slotRecipe('mage', 'chest', 'venom-orchid-hydra', 'barroth', 'maxHealth'),
legs: slotRecipe('mage', 'legs', 'tobi-kadachi', 'crystal-bat-matriarch', 'moveSpeed'),
feet: slotRecipe('mage', 'feet', 'hollowcrown-revenant', 'sandglass-scorpion', 'hazardDamageTaken'),
},
rogue: {
weapon: slotRecipe('rogue', 'weapon', 'ember-mantis-duelist', 'rathian', 'damage'),
helmet: slotRecipe('rogue', 'helmet', 'crystal-bat-matriarch', 'khezu', 'attackCooldown'),
chest: slotRecipe('rogue', 'chest', 'great-jaggi', 'barroth', 'maxHealth'),
legs: slotRecipe('rogue', 'legs', 'tobi-kadachi', 'ember-mantis-duelist', 'moveSpeed'),
feet: slotRecipe('rogue', 'feet', 'hollowcrown-revenant', 'sandglass-scorpion', 'hazardDamageTaken'),
},
warrior: {
weapon: slotRecipe('warrior', 'weapon', 'bulldrome', 'ember-mantis-duelist', 'damage'),
helmet: slotRecipe('warrior', 'helmet', 'obsidian-ram-golem', 'khezu', 'attackCooldown'),
chest: slotRecipe('warrior', 'chest', 'barroth', 'rimebastion', 'maxHealth'),
legs: slotRecipe('warrior', 'legs', 'great-jaggi', 'tobi-kadachi', 'moveSpeed'),
feet: slotRecipe('warrior', 'feet', 'rathian', 'venom-orchid-hydra', 'hazardDamageTaken'),
},
}
export function createDefaultIwt2GearProgress(): Iwt2GearProgress {
return {
healer: createDefaultClassGearProgress(),
paladin: createDefaultClassGearProgress(),
ranger: createDefaultClassGearProgress(),
mage: createDefaultClassGearProgress(),
rogue: createDefaultClassGearProgress(),
warrior: createDefaultClassGearProgress(),
}
}
export function isIwt2InfusionUnlocked(progress: Iwt2ClassGearProgress): boolean {
return Object.values(progress.slots).some((slot) => slot.level >= 5)
}
export function iwt2GearUpgradeCosts(
classId: Iwt2PlayerClassId,
slotId: Iwt2GearSlotId,
currentLevel: Iwt2GearLevel,
): Iwt2GearUpgradeCost[] {
if (currentLevel >= 5) return []
const recipe = IWT2_GEAR_SLOT_RECIPES[classId][slotId]
const nextLevel = (currentLevel + 1) as Exclude<Iwt2GearLevel, 0>
const slug = upgradeDifficultySlug(nextLevel)
const primary = iwt2BossCoinRewardFor(recipe.primaryBossId, slug)
const secondary = iwt2BossCoinRewardFor(recipe.secondaryBossId, slug)
if (nextLevel === 1) return [{ itemId: primary.id, itemName: primary.name, quantity: 2 }]
if (nextLevel === 2) return [
{ itemId: primary.id, itemName: primary.name, quantity: 3 },
{ itemId: secondary.id, itemName: secondary.name, quantity: 1 },
]
if (nextLevel === 3) return [
{ itemId: primary.id, itemName: primary.name, quantity: 3 },
{ itemId: secondary.id, itemName: secondary.name, quantity: 2 },
]
if (nextLevel === 4) return [
{ itemId: primary.id, itemName: primary.name, quantity: 4 },
{ itemId: secondary.id, itemName: secondary.name, quantity: 3 },
]
return [
{ itemId: primary.id, itemName: primary.name, quantity: 5 },
{ itemId: secondary.id, itemName: secondary.name, quantity: 4 },
]
}
export function iwt2InfusionCosts(
classId: Iwt2PlayerClassId,
slotId: Iwt2GearSlotId,
abilityId: Iwt2InfusionAbilityId,
): Iwt2GearUpgradeCost[] {
const recipe = IWT2_GEAR_SLOT_RECIPES[classId][slotId]
const ability = IWT2_INFUSION_ABILITIES[abilityId]
const linked = iwt2BossCoinRewardFor(ability.linkedBossId, 'ascendant')
const slotPrimary = iwt2BossCoinRewardFor(recipe.primaryBossId, 'mythic')
return [
{ itemId: linked.id, itemName: linked.name, quantity: 5 },
{ itemId: slotPrimary.id, itemName: slotPrimary.name, quantity: 5 },
]
}
function createDefaultClassGearProgress(): Iwt2ClassGearProgress {
return {
slots: {
weapon: { level: 0 },
helmet: { level: 0 },
chest: { level: 0 },
legs: { level: 0 },
feet: { level: 0 },
},
infusionAbilityId: null,
}
}
function slotRecipe(
classId: Iwt2PlayerClassId,
slotId: Iwt2GearSlotId,
primaryBossId: Iwt2BossId,
secondaryBossId: Iwt2BossId,
statId: Iwt2GearStatId,
): Iwt2GearSlotRecipe {
return { classId, primaryBossId, secondaryBossId, slotId, statId }
}
function upgradeDifficultySlug(level: Exclude<Iwt2GearLevel, 0>): string {
if (level <= 2) return 'initiate'
if (level === 3) return 'veteran'
if (level === 4) return 'champion'
return 'mythic'
}

Some files were not shown because too many files have changed in this diff Show More