feedback7 G-UI: selling a summoner counts the bench slots its summon stacks free (PR #309 by @siruimei07)

Applied as-is. The sale pre-check now treats each of the operator's own hand or temp summon stacks as one empty slot, independent of stack.count, before the equipment returns. Board summons and another player's tokens still occupy their slots. A sale that does not fit still returns HAND_FULL before anything is detached.

Tests: node --test test/match/sell-capacity.test.js test/match/economy.test.js test/match/playtest6_summons.test.js — 28 pass, 0 fail. eslint on the touched files: 0 errors (one pre-existing unused-arg warning in economy.js).
This commit is contained in:
siruimei07 authored and sganggs committed 2026-10-08 18:42:00 +08:00
1 parent 25bcdff3a7
commit d07d97dc4c
2 files changed
+156 -1

No files matched your search

+3 -1
View File
@@ -209,7 +209,9 @@ export class PlayerEconomy {
if (loc.piece.kind !== 'chess') return fail(ERR.BAD_TARGET, loc.piece.kind === 'item' ? 'items cannot be sold' : 'tokens cannot be sold');
const piece = loc.piece;
// its equipment returns to the hand (overflow temp): refuse rather than destroy it when there is no room
const room = this.hand.filter((x) => x == null).length + this.temp.filter((x) => x == null).length + (loc.area === 'hand' || loc.area === 'temp' ? 1 : 0);
// Removing the owner's summon stacks frees one slot per stack, regardless of its summon count.
const freed = (x) => x == null || (x.kind === 'token' && x.ownerUid === piece.uid);
const room = this.hand.filter(freed).length + this.temp.filter(freed).length + (loc.area === 'hand' || loc.area === 'temp' ? 1 : 0);
if ((piece.items || []).length > room) return fail(ERR.HAND_FULL, 'no room for the equipment');
this._detach(loc);
this.removeTokensOf(piece.uid);