Change curios to always show on inventory

This commit is contained in:
2026-10-01 16:35:41 -03:00
parent deba36260e
commit 3dc7d2adee
24 changed files with 244 additions and 159 deletions
+9 -13
View File
@@ -1,7 +1,8 @@
// artifacts: items worn in curios slots that change the wearer's attributes, see mods/artifacts
import { assertEquals } from "@std/assert";
import { ATTRIBUTES } from "$/server/game/entity/attributes.ts";
import { menu_items, opened_menu, test_game } from "./helpers.ts";
import { PLAYER_MENU_EXTRA } from "$/common/protocol.ts";
import { test_game } from "./helpers.ts";
// deno-lint-ignore no-explicit-any
type Msg = any;
@@ -17,18 +18,14 @@ async function setup() {
Deno.test("the power glove and feral claws go in the hands slot, and only work while worn", async () => {
const t = await setup();
t.send(1, { type: "mod", channel: "curios:open", data: {} });
const menu = opened_menu(t.take(1));
// the hands slot, then the inventory's
assertEquals(menu.slots.map((s: Msg) => s.icon).filter(Boolean), ["curios:empty_hands_slot"]);
t.send(1, { type: "click", menu: menu.id, slot: 1, button: 0, shift: true });
// the hands slot is the only curios one, after the player's own menu's
t.send(1, { type: "click", menu: 0, slot: 0, button: 0, shift: true });
t.game.tick();
assertEquals(t.alice.attribute(ATTRIBUTES.attack_damage), 1 + 4);
// swapped for the claws by hand: the glove's damage goes, the claws' speed comes
t.send(1, { type: "click", menu: menu.id, slot: 2, button: 0 });
t.send(1, { type: "click", menu: menu.id, slot: 0, button: 0 });
t.send(1, { type: "click", menu: 0, slot: 1, button: 0 });
t.send(1, { type: "click", menu: 0, slot: PLAYER_MENU_EXTRA, button: 0 });
t.game.tick();
assertEquals(t.alice.attribute(ATTRIBUTES.attack_damage), 1);
assertEquals(t.alice.attribute(ATTRIBUTES.attack_speed), 4 * 1.3);
@@ -36,10 +33,9 @@ Deno.test("the power glove and feral claws go in the hands slot, and only work w
Deno.test("worn artifacts work again after rejoining, and say what they do", async () => {
const t = await setup();
t.send(1, { type: "mod", channel: "curios:open", data: {} });
const { id } = opened_menu(t.take(1));
t.send(1, { type: "click", menu: id, slot: 1, button: 0, shift: true });
assertEquals(menu_items(t.take(1))[0].lore, "When worn:\n+4 Attack Damage");
t.send(1, { type: "click", menu: 0, slot: 0, button: 0, shift: true });
const worn = t.take(1).findLast((m: Msg) => m.type === "container" && m.container === "extra").items;
assertEquals(worn[0].lore, "When worn:\n+4 Attack Damage");
t.game.on_disconnect(1);
t.join(1, "alice");