Prototype Richese No-Fields on foreign Homeworlds

This commit is contained in:
Quintine committed 2026-10-28 20:04:03 +11:00
1 parent dd3c199e2e
commit 850227c26d
71 files changed
+1806 -187

No files matched your search

+5 -6
View File
@@ -1,11 +1,12 @@
import { location, splitLocation } from './board';
import { isBoardNoFieldLocation, type NoFieldLocation } from './richese-no-field';
/** Structural public input: no token identity, value, inventory or reserves. */
export type ForcePresence = {
forces: Readonly<Record<string, number>>;
noField?: {
deployed: {
location: { territory: string; sector: number };
location: NoFieldLocation;
} | null;
} | null;
};
@@ -17,10 +18,8 @@ export function presenceAt(player: ForcePresence, territory: string): number {
total + (splitLocation(key).territory === territory ? count : 0),
0,
);
return (
actual +
(player.noField?.deployed?.location.territory === territory ? 1 : 0)
);
const marker = player.noField?.deployed?.location;
return actual + (marker && isBoardNoFieldLocation(marker) && marker.territory === territory ? 1 : 0);
}
/** A fresh location map, with the single hidden marker represented as one. */
@@ -29,7 +28,7 @@ export function presenceByLocation(
): Record<string, number> {
const counts = { ...player.forces };
const marker = player.noField?.deployed?.location;
if (marker) {
if (marker && isBoardNoFieldLocation(marker)) {
const key = location(marker.territory, marker.sector);
counts[key] = (counts[key] ?? 0) + 1;
}