visualize focus misalignment and improve research recommendation logic
Highlight colony pills in warm orange-brown when their current focus (colony or allocation) disagrees with the advisor's recommendation, mirroring the yellow-outline signal already used in dropdowns. Refactor recommendAllocationFocus to avoid oscillation: instead of reading the colony's own slider (which would flip between Default at 0.20 and Research at 0.50), check for an eligible research building and population ≥ 3, and include the building name in the advice message.
This commit is contained in:
parent
e78f626406
commit
d63d81fb66
|
|
@ -49,6 +49,11 @@ import {
|
||||||
|
|
||||||
const ACCENT = 0x6fc4ff;
|
const ACCENT = 0x6fc4ff;
|
||||||
const PANEL = 0x0b1220;
|
const PANEL = 0x0b1220;
|
||||||
|
// Same navy pill, warmed toward red-orange — flags a Colony/Allocation Focus
|
||||||
|
// pill whose current setting disagrees with recommendColonyFocus/
|
||||||
|
// recommendAllocationFocus, the same judgment the dropdown's yellow outline
|
||||||
|
// already points at.
|
||||||
|
const MISALIGNED_BG = 0x3a2418;
|
||||||
const PAD = 22;
|
const PAD = 22;
|
||||||
|
|
||||||
const LEFT_X = 24;
|
const LEFT_X = 24;
|
||||||
|
|
@ -716,13 +721,17 @@ export function openColoniesScreen(scene, rules, state, e, art, opts = {}) {
|
||||||
|
|
||||||
const focusOpt = COLONY_FOCUS_OPTIONS.find((o) => o.value === (colony.focus ?? 'manual'))
|
const focusOpt = COLONY_FOCUS_OPTIONS.find((o) => o.value === (colony.focus ?? 'manual'))
|
||||||
?? COLONY_FOCUS_OPTIONS[0];
|
?? COLONY_FOCUS_OPTIONS[0];
|
||||||
|
const focusMisaligned = focusOpt.value !== recommendColonyFocus(rules, state, colony).value;
|
||||||
pill(scroller.content, COL_FOCUS, y + 10, COL_ALLOC - COL_FOCUS - 14, 40, focusOpt.label,
|
pill(scroller.content, COL_FOCUS, y + 10, COL_ALLOC - COL_FOCUS - 14, 40, focusOpt.label,
|
||||||
'#e8f4ff', 0x16253c, (p) => openFocusDropdown(colony, 'colony', p.x, p.y), { fontSize: 14 });
|
'#e8f4ff', focusMisaligned ? MISALIGNED_BG : 0x16253c,
|
||||||
|
(p) => openFocusDropdown(colony, 'colony', p.x, p.y), { fontSize: 14 });
|
||||||
|
|
||||||
const allocOpt = ALLOCATION_FOCUS_OPTIONS.find((o) => o.key === colony.advisor?.allocKey)
|
const allocOpt = ALLOCATION_FOCUS_OPTIONS.find((o) => o.key === colony.advisor?.allocKey)
|
||||||
?? ALLOCATION_FOCUS_OPTIONS[0];
|
?? ALLOCATION_FOCUS_OPTIONS[0];
|
||||||
|
const allocMisaligned = allocOpt.key !== recommendAllocationFocus(rules, state, colony).key;
|
||||||
pill(scroller.content, COL_ALLOC, y + 10, COL_SEND - COL_ALLOC - 14, 40, allocOpt.label,
|
pill(scroller.content, COL_ALLOC, y + 10, COL_SEND - COL_ALLOC - 14, 40, allocOpt.label,
|
||||||
'#e8f4ff', 0x16253c, (p) => openFocusDropdown(colony, 'alloc', p.x, p.y), { fontSize: 14 });
|
'#e8f4ff', allocMisaligned ? MISALIGNED_BG : 0x16253c,
|
||||||
|
(p) => openFocusDropdown(colony, 'alloc', p.x, p.y), { fontSize: 14 });
|
||||||
|
|
||||||
const canSend = maxSendablePopulation(colony) > 0 && empireColonies(state, e).length > 1;
|
const canSend = maxSendablePopulation(colony) > 0 && empireColonies(state, e).length > 1;
|
||||||
pill(scroller.content, COL_SEND, y + 10, 44, 40, '⇄', armed ? '#0b1220' : '#cfe8ff',
|
pill(scroller.content, COL_SEND, y + 10, 44, 40, '⇄', armed ? '#0b1220' : '#cfe8ff',
|
||||||
|
|
|
||||||
|
|
@ -2238,10 +2238,21 @@ export function recommendAllocationFocus(rules, state, colony) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (colony.sliders.research < 0.3) {
|
// Deliberately NOT `colony.sliders.research < someThreshold`: the Default
|
||||||
|
// and Research Focus presets sit at 0.20 and 0.50 respectively, so reading
|
||||||
|
// the colony's own current slider back would just report which preset was
|
||||||
|
// picked last — recommend Default while on Research (0.50 isn't low) and
|
||||||
|
// recommend Research while on Default (0.20 is low), flipping every time
|
||||||
|
// the player follows the advice. A research building still worth putting
|
||||||
|
// up is a fact about the colony, not about whichever preset is live, so it
|
||||||
|
// can't oscillate the same way — same signal recommendColonyFocus's own
|
||||||
|
// research rung uses.
|
||||||
|
const researchId = firstEligibleBuildingId(rules, state, colony, researchBuildingIds(rules));
|
||||||
|
if (colony.pop >= 3 && researchId) {
|
||||||
return {
|
return {
|
||||||
key: 'research', label: 'Research Focus',
|
key: 'research', label: 'Research Focus',
|
||||||
reason: 'Nothing urgent elsewhere — leaning into Research pays off over time.',
|
reason: `Nothing more urgent elsewhere — a ${rules.buildings[researchId].name} would raise this `
|
||||||
|
+ "colony's contribution to empire research.",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue