CI / build + unit + e2e (pull_request) Successful in 2m8s
- Add a hard military conquest gate (canConquer, CONQUEST_MILITARY_MARGIN=15) enforced in applyTurnResult: a contested invasion is repelled when the attacker's military is more than 15 below the defender's; re-claims of unowned regions are never gated. Emits a new 'repelled' event. - Document the soft levers in the system prompt: stability<30 + gathering marker -> non-military takeover; economy growth/decay drives other stats. - Emit bounded frontierMilitary (per-neighbour balance) and takeoverRisks hints in the user payload (only when present). - repelled outcome color (#9f1239); full unit test coverage; stub untouched. - Bump to v0.30.0. Fixes #50
44 lines
1.4 KiB
TypeScript
44 lines
1.4 KiB
TypeScript
// Small color maps for the "command center" theme. Pure + shared so the event
|
||
// feed, nation panel, and any future view all agree on a type/status → color.
|
||
import type { EventOutcome, EventType, RelationStatus } from '@shared/types';
|
||
|
||
export const EVENT_COLORS: Record<EventType, string> = {
|
||
military: '#ef4444',
|
||
diplomatic: '#3b82f6',
|
||
economic: '#22c55e',
|
||
political: '#f59e0b',
|
||
social: '#06b6d4',
|
||
disaster: '#f97316',
|
||
scientific: '#a855f7',
|
||
cultural: '#ec4899',
|
||
};
|
||
|
||
export const RELATION_COLORS: Record<RelationStatus, string> = {
|
||
ally: '#22c55e',
|
||
neutral: '#94a3b8',
|
||
rival: '#f59e0b',
|
||
hostile: '#f97316',
|
||
war: '#ef4444',
|
||
};
|
||
|
||
export const OUTCOME_COLORS: Record<EventOutcome, string> = {
|
||
success: '#22c55e',
|
||
failure: '#ef4444',
|
||
partial: '#f59e0b',
|
||
neutral: '#94a3b8',
|
||
// (v0.30, #50) engine-emitted "invasion repelled" — a muted, darker red so it
|
||
// reads as a defensive failure distinct from a bright outright `failure`.
|
||
repelled: '#9f1239',
|
||
};
|
||
|
||
/**
|
||
* A 0–100 value → a color on a smooth red → yellow → green ramp, for stat bars.
|
||
* Low values read as "danger" (red), high values as "strong" (green). Pure so the
|
||
* dossier and any future gauge agree.
|
||
*/
|
||
export function statValueColor(v: number): string {
|
||
const x = Math.max(0, Math.min(100, v));
|
||
const hue = x * 1.2; // 0 → red, 60 → yellow, 120 → green
|
||
return `hsl(${Math.round(hue)} 72% 46%)`;
|
||
}
|