Prototype charity Truthtrance and coalition rule foundations
Verify and publish checkpoint container / container (push) Successful in 10m14s
Verify and publish checkpoint container / container (push) Successful in 10m14s
This commit is contained in:
1 parent
e896570f07
commit
cea310b030
17 files changed
+1024
-35
No files matched your search
+18
-6
@@ -3,6 +3,7 @@ import { territory } from './board';
|
||||
import { fighterCount } from './advisors';
|
||||
import { presenceAt, type ForcePresence } from './force-presence';
|
||||
import { ecazOccupancyIdentity, ecazOccupancyRelation } from './ecaz-occupy';
|
||||
import { coalitionAllies, coalitionGroups, type CoalitionState } from './coalition-alliance';
|
||||
|
||||
/** Public board information only: a concealed No-Field contributes presence,
|
||||
* never its hidden denomination. Advisor groups do not fill strongholds. */
|
||||
@@ -10,6 +11,7 @@ export type OccupancySeat = ForcePresence & {
|
||||
id: string;
|
||||
faction: FactionId;
|
||||
ally?: string | null;
|
||||
allySinceTurn?: number;
|
||||
advisors?: Readonly<Record<string, { lockedTurn?: number }>>;
|
||||
};
|
||||
|
||||
@@ -38,21 +40,31 @@ export function territoryEntryBlock(
|
||||
to: string,
|
||||
advisors = false,
|
||||
temporaryAlliedShipment = false,
|
||||
coalitionState?: CoalitionState,
|
||||
): string | null {
|
||||
// Validate the complete identity roster even for an empty destination.
|
||||
ecazOccupancyIdentity(players, playerId, { kind: 'territory', id: to });
|
||||
if (advisors) return null;
|
||||
const player = players.find((p) => p.id === playerId)!;
|
||||
const ally = players.find((p) => p.id === player.ally);
|
||||
const seats = players.map(p => ({ id: p.id, ally: p.ally ?? null, allySinceTurn: p.allySinceTurn }));
|
||||
if (coalitionState !== undefined) {
|
||||
const groups = coalitionGroups(seats, coalitionState);
|
||||
if (players.some(player => player.faction === 'ecaz') && groups.some(group => group.members.length === 3))
|
||||
throw new Error('Three-member board rules do not yet support Ecaz.');
|
||||
}
|
||||
if (advisors) return null;
|
||||
const allies = coalitionState === undefined ? (player.ally ? [player.ally] : [])
|
||||
: coalitionAllies(seats, coalitionState, playerId);
|
||||
if (
|
||||
!temporaryAlliedShipment &&
|
||||
to !== 'polar_sink' &&
|
||||
ally &&
|
||||
presenceAt(ally, to) > 0 &&
|
||||
ecazOccupancyRelation(players, playerId, ally.id, {
|
||||
allies.some(id => {
|
||||
const ally = players.find(p => p.id === id);
|
||||
return !!ally && presenceAt(ally, to) > 0 &&
|
||||
ecazOccupancyRelation(players, playerId, id, {
|
||||
kind: 'territory',
|
||||
id: to,
|
||||
}) !== 'ecazAlliance'
|
||||
}) !== 'ecazAlliance';
|
||||
})
|
||||
)
|
||||
return 'You cannot enter a territory occupied by your ally.';
|
||||
if (
|
||||
|
||||
Reference in new issue
Block a user