Files
deepseek f040bb6be0 Three Kingdoms: Warlord's Fate — complete playable game
- Stylized 3D ink-painting map of China (12 provinces, 32 cities, 17 factions)
- Custom warlord creation (8 origins, banner, starting city) or historical factions
- City management: 7 buildings, 5 dev tiers, recruitment from levies
- Character system: stats, traits, loyalty, relationships, wounds, capture, death, succession
- Turn-based tactical battles with formations, stances, hero skills, cinematic 3D replay
- Sieges: assault, starvation, bribery, infiltration
- Diplomacy with trust memory, alliances, NAPs, trade, marriage, espionage, betrayal
- Scripted diverging history (Dong Zhuo, Guandu, Red Cliffs...) + world crises + court events
- AI factions with distinct personalities; prisoners (execute/release/recruit/ransom)
- Procedural guqin/taiko WebAudio score; save/load; victory + dynasty chronicle screens
- View-relative camera controls; headless test suites (smoke, stress, map validator)
2026-08-23 06:59:40 +00:00

350 lines
33 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// ============================================================
// WARLORD'S FATE — static game data
// Stylized hex-map of China + factions, cities, characters
// ============================================================
export const START_YEAR = 193;
export const START_MONTH = 1;
// ---------- HEX MAP ----------
// Each char = one hex tile. '.' water. Lowercase letter = province plains,
// uppercase = mountainous hex of that province.
// Provinces: l liangzhou, o yongzhou, y youzhou, j jizhou, q qingzhou,
// a yanzhou, s sili, x xuzhou, u yuzhou, n jingzhou, h yangzhou, g yizhou
export const MAP_ROWS = [
"llllllll...................",
"lLLlllll.yyyyyyyY..........",
"lLLLllll.yyyyyyyYY.........",
"llLLLlll.yyyyyyyyY.........",
"lllLoooooyyyyyyyYY.........",
"llllooooojJJjjjjj..........",
"lllloooooojJjjjqqqqQQq.....",
"...oooosssjJjjjqqqqQQQq....",
"....ooossssaaaaaqqqqQQq....",
".....oSSSssaaaaaaqqqqqq....",
".gggggoSSSaaaaaaaqqqqq.....",
".gggggnnssSaaaaaaqqqqx.....",
".gGGggnnnnnaaaaaxxxxxxh....",
".ggGGGnnnnuuuuUUxxxxxhhh...",
"ggggGGnnnnnuuuuuxxxxhhhhh..",
".ggggGnnnnnnuuuuuhhhhhhhh..",
".gggggnnnnnnnnnhhhhhhhhhh..",
".ggggggNnnnnnnnhhhhhhhhhh..",
".ggggggNNnnnnnnhhhhhhhhhh..",
".ggggggGNnnnnnn..hhhhhhh...",
".gggggggNnnnnnn...hhhh.....",
"..gggggGG.nnnn.............",
"..gggggG...................",
"..gggggG...................",
"...gggg....................",
"...gggg....................",
];
export const HEX_R = 3.1; // world radius of a hex
export function hexToWorld(col, row) {
const w = Math.sqrt(3) * HEX_R;
return [col * w + (row % 2 ? w / 2 : 0), row * 1.5 * HEX_R];
}
// ---------- PROVINCES ----------
export const PROVINCES = {
l: { name: "Liangzhou", cn: "凉州", tint: 0xc9ae7c, mount: 0.85, desc: "Western corridors. Horse country of hard riders." },
o: { name: "Yongzhou", cn: "雍州", tint: 0xc4ad7d, mount: 0.55, desc: "Old Qin lands guarding the Guanzhong plain." },
y: { name: "Youzhou", cn: "幽州", cn2: "", tint: 0xc7b489, mount: 0.7, desc: "Northern frontier against the steppe." },
j: { name: "Jizhou", cn: "冀州", tint: 0xcdbb8b, mount: 0.45, desc: "The richest northern plains, granary of war." },
q: { name: "Qingzhou", cn: "青州", tint: 0xcabb90, mount: 0.4, desc: "Eastern peninsula of salt and hills." },
a: { name: "Yanzhou", cn: "兖州", tint: 0xcdbc8e, mount: 0.3, desc: "Central crossroads — whoever holds it threatens the capital." },
s: { name: "Sili", cn: "司隶", tint: 0xc6b183, mount: 0.6, desc: "The imperial domain: Luoyang and the passes." },
x: { name: "Xuzhou", cn: "徐州", tint: 0xc9bd94, mount: 0.25, desc: "Rich eastern lowlands, fought over by every warlord." },
u: { name: "Yuzhou", cn: "豫州", tint: 0xc7b78c, mount: 0.3, desc: "Ancient heartland of the Central Plains." },
n: { name: "Jingzhou", cn: "荆州", tint: 0xa8ab77, mount: 0.55, desc: "Vast southern rivers region. Seven commanderies of grain and boats." },
h: { name: "Yangzhou", cn: "扬州", tint: 0x9cab7d, mount: 0.5, desc: "Lakeland and rivers below the Yangtze." },
g: { name: "Yizhou", cn: "益州", tint: 0x99a674, mount: 0.95, desc: "The basin behind mountains — a nation unto itself." },
};
export const PROVINCE_LETTERS = Object.keys(PROVINCES);
// ---------- CITIES ----------
// [id, name, cn, province, col, row, basePop(thousands), commerce, fertility]
export const CITY_DEFS = [
["ji", "Ji", "蓟", "y", 12, 2, 180, 52, 60],
["beiping", "Beiping", "北平", "y", 15, 2, 150, 46, 55],
["ye", "Ye", "邺", "j", 12, 6, 220, 72, 85],
["nanpi", "Nanpi", "南皮", "j", 15, 5, 160, 58, 70],
["linzi", "Linzi", "临淄", "q", 17, 7, 170, 60, 62],
["beihai", "Beihai", "北海", "q", 21, 8, 130, 50, 55],
["puyang", "Puyang", "濮阳", "a", 12, 9, 140, 55, 68],
["chenliu", "Chenliu", "陈留", "a", 14, 10, 150, 62, 70],
["luoyang", "Luoyang", "洛阳", "s", 9, 9, 300, 88, 60],
["hongnong", "Hongnong", "弘农", "s", 8, 11, 90, 40, 48],
["changan", "Chang'an", "长安", "o", 6, 8, 280, 84, 65],
["anding", "Anding", "安定", "o", 5, 6, 80, 34, 45],
["wuwei", "Wuwei", "武威", "l", 2, 3, 100, 42, 50],
["tianshui", "Tianshui", "天水", "l", 3, 5, 110, 44, 52],
["xiaopei", "Xiaopei", "小沛", "x", 16, 12, 110, 44, 66],
["xiapi", "Xiapi", "下邳", "x", 19, 13, 190, 64, 80],
["xuchang", "Xuchang", "许昌", "u", 14, 13, 170, 66, 78],
["wan", "Wan", "宛", "u", 12, 14, 140, 54, 64],
["runan", "Runan", "汝南", "u", 15, 14, 150, 50, 72],
["shouchun", "Shouchun", "寿春", "h", 18, 15, 160, 56, 76],
["jianye", "Jianye", "建业", "h", 21, 14, 200, 74, 72],
["lujiang", "Lujiang", "庐江", "h", 18, 17, 120, 48, 66],
["wu", "Wu", "吴", "h", 21, 17, 170, 68, 74],
["xiangyang", "Xiangyang", "襄阳", "n", 10, 14, 230, 76, 78],
["jiangling", "Jiangling", "江陵", "n", 11, 17, 180, 62, 82],
["jiangxia", "Jiangxia", "江夏", "n", 14, 16, 140, 52, 70],
["changsha", "Changsha", "长沙", "n", 11, 20, 160, 58, 80],
["hanzhong", "Hanzhong", "汉中", "g", 4, 11, 120, 48, 68],
["chengdu", "Chengdu", "成都", "g", 3, 15, 240, 80, 92],
["zitong", "Zitong", "梓潼", "g", 3, 13, 110, 44, 66],
["jiangzhou", "Jiangzhou", "江州", "g", 6, 17, 130, 50, 70],
["yunnan", "Yunnan", "云南", "g", 6, 22, 90, 38, 58],
];
// ---------- FACTIONS ----------
// personality: hawk | diplomat | turtle | merchant | opportunist | fanatic
export const FACTION_DEFS = [
{ id: "cao", name: "Cao Cao", title: "Protector of the East", color: "#3b62c8", leader: "caocao", personality: "hawk", desc: "Ruthless genius of the Central Plains. Peerless officers, cold ambition.", startCities: ["chenliu"] },
{ id: "liu", name: "Liu Bei", title: "Lord of Benevolence", color: "#43a05e", leader: "liubei", personality: "diplomat", desc: "A sandal-weaver who swears brotherhood with heroes. The people love him.", startCities: ["xiaopei"] },
{ id: "sun", name: "Sun Ce", title: "Little Conqueror", color: "#cc4633", leader: "sunce", personality: "hawk", desc: "The Tiger of Jiangdong's son, carving a river realm with bold strokes.", startCities: ["jianye", "wu"] },
{ id: "yuan", name: "Yuan Shao", title: "Lord of Four Generations", color: "#8f6ad6", leader: "yuanshao", personality: "hawk", desc: "Greatest house of the age — vast lands, divided court.", startCities: ["ye", "nanpi"] },
{ id: "gongsun", name: "Gongsun Zan", title: "White Horse General", color: "#dfe5ee", leader: "gongsunzan", personality: "hawk", desc: "Iron cavalry of the northern frontier.", startCities: ["beiping", "ji"] },
{ id: "dong", name: "Dong Zhuo", title: "Tyrant Chancellor", color: "#50606e", leader: "dongzhuo", personality: "fanatic", desc: "He burns what he cannot rule. The Empire hates him — and fears him more.", startCities: ["changan", "luoyang", "hongnong"] },
{ id: "ma", name: "Ma Teng", title: "Lion of the West", color: "#dd8030", leader: "mateng", personality: "opportunist", desc: "Descendant of heroes, master of the western horse.", startCities: ["wuwei"] },
{ id: "liuzhang", name: "Liu Zhang", title: "Lord of Shu", color: "#2ba3a0", leader: "liuzhang", personality: "turtle", desc: "Gentle master of the rich mountain basin.", startCities: ["chengdu", "zitong", "jiangzhou"] },
{ id: "liubiao", name: "Liu Biao", title: "Warden of Jingzhou", color: "#c05a9e", leader: "liubiao", personality: "turtle", desc: "Scholar-lord of the great southern rivers.", startCities: ["xiangyang", "jiangling", "jiangxia"] },
{ id: "yuanshu", name: "Yuan Shu", title: "General of the Rear", color: "#cf7052", leader: "yuanshu", personality: "fanatic", desc: "Proud cousin of Yuan Shao. His ambition outstrips his sense.", startCities: ["shouchun"] },
{ id: "lubu", name: "Lü Bu", title: "Flying General", color: "#9e2b3c", leader: "lubu", personality: "opportunist", desc: "Matchless in battle. Matchless in treachery. Two fathers already betrayed.", startCities: ["puyang"] },
{ id: "tao", name: "Tao Qian", title: "Governor of Xu", color: "#a08b62", leader: "taoqian", personality: "diplomat", desc: "An aging, kindly governor in a land everyone covets.", startCities: ["xiapi"] },
{ id: "kong", name: "Kong Rong", title: "Scholar of the North", color: "#7fa8b8", leader: "kongrong", personality: "diplomat", desc: "Descendant of Confucius. Braver with words than armies.", startCities: ["beihai"] },
{ id: "zhanglu", name: "Zhang Lu", title: "Master of the Ways", color: "#7c8f4a", leader: "zhanglu", personality: "turtle", desc: "Priest-king of the Hanzhong valley, beloved by his flock.", startCities: ["hanzhong"] },
{ id: "hansui", name: "Han Sui", title: "Old Friend of the West",color: "#8a6a42", leader: "hansui", personality: "opportunist", desc: "Ma Teng's sworn brother, holding Tianshui's passes.", startCities: ["tianshui"] },
{ id: "huangjin", name: "Yellow Turbans", title: "Remnant Zealots", color: "#c9b93a", leader: "guanhai", personality: "fanatic", desc: "The shattered sect still preaches rebellion in the hills.", startCities: ["linzi", "runan"] },
{ id: "neutral", name: "Local Garrison", title: "Imperial Remnant", color: "#8a8a82", leader: null, personality: "turtle", desc: "Militias loyal to a fading throne.", startCities: ["xuchang", "wan", "lujiang", "changsha", "anding", "yunnan"] },
];
export const PLAYER_SPAWN_CITIES = ["xuchang", "wan", "lujiang", "changsha", "yunnan", "anding"];
// ---------- TRAITS ----------
export const TRAITS = {
brave: { name: "Brave", icon: "⚔", desc: "+charge damage, morale holds longer" },
cautious: { name: "Cautious", icon: "🛡", desc: "fewer losses when losing, resists ambush" },
impulsive: { name: "Impulsive", icon: "⚡", desc: "wild swings in battle — brilliant or reckless" },
loyalheart: { name: "Loyal Heart", icon: "❤", desc: "loyalty rarely decays" },
ambitious: { name: "Ambitious", icon: "🏔", desc: "demands promotion; loyalty falls without glory" },
greedy: { name: "Greedy", icon: "💰", desc: "higher salary, can be bribed by enemies" },
honorable: { name: "Honorable", icon: "⛩", desc: "refuses bribes; executing prisoners angers them" },
cruel: { name: "Cruel", icon: "🩸", desc: "+siege assault, public order, inspires fear" },
charismatic: { name: "Charismatic", icon: "✨", desc: "boosts nearby troops' morale and recruiting" },
genius: { name: "Genius", icon: "☯", desc: "stratagems far more likely to succeed" },
arrogant: { name: "Arrogant", icon: "😤", desc: "clashes with peers; hard to advise" },
kind: { name: "Kind", icon: "🌸", desc: "+public order wherever stationed" },
naval: { name: "River Master", icon: "⛵", desc: "+power in river battles" },
cavalry: { name: "Cavalry Expert",icon:"🐎", desc: "cavalry under him hit harder" },
vanguard: { name: "Vanguard", icon: "🗡", desc: "leads devastating first assaults" },
admin: { name: "Administrator",icon: "📐", desc: "+city tax and construction speed" },
engineer: { name: "Engineer", icon: "🔧", desc: "sieges progress faster, walls matter less" },
spymaster: { name: "Spy Master", icon: "👁", desc: "espionage missions succeed more often" },
scholar: { name: "Scholar", icon: "📖", desc: "academies train officers faster" },
ironwill: { name: "Iron Will", icon: "🗿", desc: "never routs early; wounded recovers faster" },
};
// ---------- HERO SKILLS ----------
export const SKILLS = {
greendragon: { name: "Green Dragon Strike", cn: "青龙偃月", type: "charge", pow: 2.2, text: "cleaves through the enemy line like a crescent moon" },
tigerroar: { name: "Tiger Roar", cn: "据水断桥", type: "morale", pow: 26, text: "roars so terribly the enemy line wavers and breaks" },
dragonspear: { name: "Dragon Spear", cn: "龙胆亮银", type: "charge", pow: 1.9, text: "rides seven times through enemy ranks, unscathed" },
skypiercer: { name: "Sky Piercer", cn: "方天画戟", type: "duel", pow: 3.0, text: "seeks the enemy champion amid the storm of halberds" },
fireattack: { name: "Fire Attack", cn: "火计", type: "fire", pow: 1.6, text: "the wind turns, and flame devours the foe" },
eightform: { name: "Eight Formations", cn: "八阵图", type: "defense",pow: 0.45,text: "the ranks fold into an unfathomable maze of stones" },
patience: { name: "Still Water", cn: "隐忍", type: "defense",pow: 0.3, text: "waits, unmoving, until the enemy spends his fury" },
weststorm: { name: "Western Storm", cn: "西凉铁骑", type: "charge", pow: 2.1, text: "leads a tide of horsemen that nothing can stand against" },
fallingstar: { name: "Drawn Bow, Falling Star", cn: "百步穿杨", type: "volley", pow: 2.0, text: "draws the great bow — the arrow flies beyond sight and strikes" },
ironguard: { name: "Iron Guard", cn: "古之恶来", type: "defense",pow: 0.4, text: "stands alone at the gate and the gate does not fall" },
madox: { name: "Mad Ox", cn: "虎痴", type: "duel", pow: 2.4, text: "wrestles bulls bare-handed — men scatter before him" },
thunder: { name: "Thunder at the Walls",cn: "威震逍遥津",type:"morale", pow: 22, text: "his name alone drains the courage from the foe" },
littleconq: { name: "Little Conqueror", cn: "小霸王", type: "charge", pow: 2.0, text: "breaks the siege lines with sheer joyous fury" },
divinearchery:{ name: "Divine Archery", cn: "辕门射戟", type: "volley", pow: 1.7, text: "pierces the small branch at a hundred paces — both armies stare" },
ruthlessscheme:{ name: "Ruthless Scheme", cn: "毒士", type: "fire", pow: 1.5, text: "whispers one sentence, and the battlefield turns" },
vengeance: { name: "Vengeance", cn: "恩怨分明", type: "morale", pow: 18, text: "points at the traitor's banner — the soldiers howl" },
rally: { name: "Rally", cn: "激励", type: "morale", pow: 12, text: "raises the standard and steadies the line" },
volley: { name: "Arrow Storm", cn: "万箭齐发", type: "volley", pow: 1.4, text: "a thousand arrows darken the sky" },
chargecall: { name: "Charge!", cn: "冲锋", type: "charge", pow: 1.5, text: "sounds the horns and rides down the wavering foe" },
ambush: { name: "Ambush", cn: "埋伏", type: "fire", pow: 1.45,text: "signals from the tall grass — the trap closes" },
};
// ---------- GENERALS ----------
// n,f faction,t title,b birth,st [ldr,war,int,pol,cha],tr traits,sk skill
export const GENERAL_DEFS = [
// --- Cao Cao's camp ---
{ n: "Cao Cao", f: "cao", t: "Warlord of Chenliu", b: 155, st: [96, 84, 92, 94, 90], tr: ["genius", "ambitious", "arrogant"], sk: "ruthlessscheme" },
{ n: "Xiahou Dun", f: "cao", t: "Fierce General", b: 157, st: [86, 90, 56, 62, 70], tr: ["brave", "ironwill"], sk: "chargecall" },
{ n: "Xiahou Yuan", f: "cao", t: "Swift Cavalry", b: 158, st: [84, 87, 60, 55, 64], tr: ["impulsive", "cavalry"], sk: "chargecall" },
{ n: "Cao Ren", f: "cao", t: "Steadfast Defender", b: 168, st: [88, 82, 66, 60, 58], tr: ["cautious", "ironwill"], sk: "ironguard" },
{ n: "Dian Wei", f: "cao", t: "Coming Evil", b: 158, st: [70, 96, 32, 20, 40], tr: ["brave", "loyalheart"], sk: "madox" },
{ n: "Xu Chu", f: "cao", t: "Mad Tiger", b: 169, st: [68, 95, 36, 22, 44], tr: ["brave", "loyalheart"], sk: "madox" },
{ n: "Yu Jin", f: "cao", t: "Disciplined Officer", b: 160, st: [82, 78, 64, 58, 52], tr: ["cautious"], sk: "rally" },
{ n: "Xun Yu", f: "cao", t: "King's Advisor", b: 163, st: [52, 30, 96, 98, 84], tr: ["scholar", "honorable", "admin"], sk: "patience" },
{ n: "Guo Jia", f: "cao", t: "Young Phoenix Eye", b: 170, st: [46, 24, 97, 74, 80], tr: ["genius", "impulsive"], sk: "fireattack" },
// --- Liu Bei's brotherhood ---
{ n: "Liu Bei", f: "liu", t: "Lord of Virtue", b: 161, st: [88, 68, 74, 82, 99], tr: ["charismatic", "kind", "loyalheart"], sk: "rally" },
{ n: "Guan Yu", f: "liu", t: "Beautiful Beard", b: 160, st: [95, 97, 78, 62, 84], tr: ["brave", "honorable", "loyalheart", "arrogant"], sk: "greendragon" },
{ n: "Zhang Fei", f: "liu", t: "Yan Man", b: 165, st: [84, 96, 40, 30, 62], tr: ["brave", "impulsive", "cruel"], sk: "tigerroar" },
{ n: "Jian Yong", f: "liu", t: "Wandering Monk-Advisor", b: 158, st: [40, 22, 78, 72, 84], tr: ["kind"], sk: "rally" },
{ n: "Mi Zhu", f: "liu", t: "Wealthy Host", b: 162, st: [42, 26, 68, 82, 74], tr: ["admin", "loyalheart"], sk: "rally" },
// --- Sun clan ---
{ n: "Sun Ce", f: "sun", t: "Little Conqueror", b: 175, st: [90, 91, 74, 62, 92], tr: ["charismatic", "brave", "vanguard"], sk: "littleconq" },
{ n: "Zhou Yu", f: "sun", t: "Marquis of Beauty", b: 175, st: [92, 76, 96, 80, 94], tr: ["genius", "naval", "charismatic"], sk: "fireattack" },
{ n: "Huang Gai", f: "sun", t: "Old Veteran", b: 148, st: [78, 80, 58, 52, 60], tr: ["ironwill", "naval"], sk: "fireattack" },
{ n: "Cheng Pu", f: "sun", t: "Senior General", b: 145, st: [80, 79, 62, 58, 64], tr: ["cautious", "naval"], sk: "rally" },
{ n: "Han Dang", f: "sun", t: "River Veteran", b: 150, st: [76, 78, 54, 48, 58], tr: ["naval"], sk: "volley" },
{ n: "Zhu Zhi", f: "sun", t: "Governor of Wu", b: 156, st: [70, 62, 66, 76, 66], tr: ["admin"], sk: "rally" },
{ n: "Zhang Zhao", f: "sun", t: "Chancellor Material", b: 156, st: [48, 20, 88, 94, 78], tr: ["scholar", "admin"], sk: "patience" },
{ n: "Sun Quan", f: "sun", t: "Heir of Jiangdong", b: 182, st: [78, 62, 82, 88, 86], tr: ["kind", "cautious"], sk: "rally", heirOf: "sun" },
// --- Yuan Shao's host ---
{ n: "Yuan Shao", f: "yuan", t: "Lord of Ye", b: 154, st: [84, 70, 66, 78, 88], tr: ["arrogant", "ambitious"], sk: "chargecall" },
{ n: "Yan Liang", f: "yuan", t: "Brave of Hebei", b: 160, st: [78, 91, 42, 30, 48], tr: ["brave", "impulsive"], sk: "chargecall" },
{ n: "Wen Chou", f: "yuan", t: "Brave of Hebei", b: 158, st: [76, 90, 40, 28, 46], tr: ["brave", "impulsive"], sk: "chargecall" },
{ n: "Zhang He", f: "yuan", t: "Prudent Officer", b: 167, st: [86, 84, 76, 62, 58], tr: ["cautious"], sk: "ambush" },
{ n: "Ju Shou", f: "yuan", t: "Loyal Counselor", b: 158, st: [50, 24, 88, 80, 60], tr: ["honorable"], sk: "patience" },
{ n: "Tian Feng", f: "yuan", t: "Blunt Strategist", b: 156, st: [48, 26, 90, 74, 52], tr: ["honorable", "arrogant"], sk: "patience" },
{ n: "Xu You", f: "yuan", t: "Greedy Advisor", b: 157, st: [44, 22, 89, 66, 62], tr: ["greedy", "arrogant"], sk: "fireattack" },
{ n: "Guo Tu", f: "yuan", t: "Court Flatterer", b: 159, st: [40, 18, 78, 70, 66], tr: ["greedy"], sk: "ambush" },
// --- Gongsun Zan ---
{ n: "Gongsun Zan", f: "gongsun", t: "White Horse General", b: 153, st: [82, 84, 58, 56, 60], tr: ["cavalry", "arrogant"], sk: "weststorm" },
{ n: "Zhao Yun", f: "gongsun", t: "Dragon of Changshan", b: 168, st: [92, 98, 76, 58, 82], tr: ["brave", "loyalheart", "kind", "cavalry"], sk: "dragonspear" },
{ n: "Tian Kai", f: "gongsun", t: "Frontier Colonel", b: 158, st: [68, 70, 50, 46, 48], tr: [], sk: "volley" },
// --- Dong Zhuo's tyrants ---
{ n: "Dong Zhuo", f: "dong", t: "Chancellor of State", b: 138, st: [78, 80, 52, 60, 44], tr: ["cruel", "greedy", "ambitious"], sk: "tigerroar" },
{ n: "Lü Bu", f: "lubu", t: "Flying General", b: 156, st: [82, 100, 42, 30, 50], tr: ["brave", "ambitious", "impulsive"], sk: "skypiercer", servingDong: true },
{ n: "Hua Xiong", f: "dong", t: "Pass Commander", b: 158, st: [74, 88, 44, 32, 44], tr: ["brave"], sk: "chargecall" },
{ n: "Li Jue", f: "dong", t: "Bandit General", b: 152, st: [70, 76, 48, 40, 34], tr: ["cruel", "greedy"], sk: "chargecall" },
{ n: "Guo Si", f: "dong", t: "Bandit General", b: 153, st: [68, 74, 44, 38, 32], tr: ["cruel", "greedy"], sk: "chargecall" },
{ n: "Jia Xu", f: "dong", t: "Poison Scholar", b: 147, st: [56, 30, 98, 84, 62], tr: ["genius", "spymaster"], sk: "ruthlessscheme" },
{ n: "Gao Shun", f: "lubu", t: "Camp Rampart", b: 158, st: [84, 88, 58, 40, 42], tr: ["ironwill", "loyalheart"], sk: "ironguard" },
{ n: "Zhang Liao", f: "lubu", t: "Quiet Thunder", b: 169, st: [92, 92, 80, 66, 74], tr: ["brave", "loyalheart", "cautious"], sk: "thunder" },
{ n: "Chen Gong", f: "lubu", t: "Disillusioned Strategist", b: 161, st: [48, 26, 92, 76, 66], tr: ["honorable"], sk: "ambush" },
// --- West ---
{ n: "Ma Teng", f: "ma", t: "Lion of Xiliang", b: 145, st: [80, 82, 54, 56, 74], tr: ["brave", "honorable"], sk: "weststorm" },
{ n: "Ma Chao", f: "ma", t: "Splendid Stallion", b: 176, st: [88, 97, 56, 34, 72], tr: ["brave", "cavalry", "vanguard", "impulsive"], sk: "weststorm" },
{ n: "Pang De", f: "ma", t: "White-Horse Rider", b: 170, st: [82, 90, 58, 44, 52], tr: ["brave", "ironwill"], sk: "chargecall" },
{ n: "Ma Dai", f: "ma", t: "Young Cousin", b: 180, st: [74, 78, 62, 50, 56], tr: ["cautious"], sk: "rally" },
{ n: "Han Sui", f: "hansui", t: "Elder of the West", b: 144, st: [76, 72, 62, 64, 70], tr: ["cautious"], sk: "rally" },
// --- South & river lords ---
{ n: "Liu Zhang", f: "liuzhang", t: "Lord of Shu", b: 162, st: [58, 40, 52, 66, 60], tr: ["kind"], sk: "rally" },
{ n: "Zhang Ren", f: "liuzhang", t: "Shield of Shu", b: 165, st: [84, 84, 66, 48, 54], tr: ["loyalheart", "cautious"], sk: "ambush" },
{ n: "Yan Yan", f: "liuzhang", t: "Old General of Ba", b: 150, st: [78, 76, 58, 54, 60], tr: ["ironwill"], sk: "ironguard" },
{ n: "Fa Zheng", f: "liuzhang", t: "Sharp Vengeance", b: 176, st: [50, 24, 94, 78, 64], tr: ["genius"], sk: "vengeance" },
{ n: "Liu Biao", f: "liubiao", t: "Warden of Jing", b: 142, st: [64, 44, 74, 84, 80], tr: ["kind", "scholar"], sk: "patience" },
{ n: "Kuai Liang", f: "liubiao", t: "Jing Advisor", b: 152, st: [52, 26, 86, 80, 68], tr: ["scholar"], sk: "patience" },
{ n: "Cai Mao", f: "liubiao", t: "Naval Commander", b: 155, st: [72, 70, 58, 56, 60], tr: ["naval", "greedy"], sk: "volley" },
{ n: "Huang Zhong", f: "neutral", t: "Hidden Dragon of Changsha", b: 148, st: [88, 95, 66, 50, 58], tr: ["brave", "ironwill", "vanguard"], sk: "fallingstar", hidden: true },
{ n: "Wei Yan", f: "neutral", t: "Restless Blade", b: 173, st: [82, 88, 58, 42, 50], tr: ["ambitious", "brave"], sk: "ambush", hidden: true },
{ n: "Yuan Shu", f: "yuanshu", t: "Lord of Shouchun", b: 155, st: [66, 52, 48, 62, 58], tr: ["arrogant", "greedy", "ambitious"], sk: "chargecall" },
{ n: "Ji Ling", f: "yuanshu", t: "Three-Bladed Halberd", b: 160, st: [74, 84, 46, 36, 44], tr: ["brave"], sk: "chargecall" },
{ n: "Tao Qian", f: "tao", t: "Kind Governor", b: 132, st: [56, 40, 62, 76, 78], tr: ["kind"], sk: "rally" },
{ n: "Cao Bao", f: "tao", t: "Ambitious Colonel", b: 155, st: [62, 60, 44, 48, 50], tr: ["greedy"], sk: "rally" },
{ n: "Kong Rong", f: "kong", t: "Confucian Lord", b: 153, st: [48, 30, 82, 78, 84], tr: ["scholar", "kind"], sk: "patience" },
{ n: "Taishi Ci", f: "neutral", t: "Wandering Hero", b: 166, st: [84, 90, 70, 54, 72], tr: ["brave", "honorable", "loyalheart"], sk: "divinearchery", hidden: false, freeAgent: true },
{ n: "Gan Ning", f: "neutral", t: "Bell-Robbed Pirate", b: 175, st: [80, 88, 66, 40, 62], tr: ["naval", "impulsive", "brave"], sk: "ambush", hidden: true },
{ n: "Zhang Lu", f: "zhanglu", t: "Waymaster", b: 148, st: [66, 48, 72, 84, 82], tr: ["kind", "scholar"], sk: "patience" },
{ n: "Guan Hai", f: "huangjin", t: "Zealot Chief", b: 155, st: [62, 74, 36, 24, 40], tr: ["brave", "cruel"], sk: "rally" },
{ n: "He Yi", f: "huangjin", t: "Zealot Chief", b: 153, st: [58, 70, 34, 22, 38], tr: ["cruel"], sk: "chargecall" },
];
// relationships
export const RELATIONS = {
sworn: [["Liu Bei", "Guan Yu"], ["Liu Bei", "Zhang Fei"], ["Guan Yu", "Zhang Fei"],
["Ma Teng", "Han Sui"], ["Sun Ce", "Zhou Yu"]],
rivals: [["Zhuge Liang", "Zhou Yu"], ["Yuan Shao", "Gongsun Zan"], ["Ma Teng", "Dong Zhuo"]],
friends: [["Guo Jia", "Cao Cao"], ["Xun Yu", "Cao Cao"], ["Fa Zheng", "Zhang Ren"],
["Taishi Ci", "Sun Ce"], ["Zhao Yun", "Liu Bei"]],
family: [["Cao Cao", "Xiahou Dun"], ["Cao Cao", "Xiahou Yuan"], ["Cao Cao", "Cao Ren"],
["Ma Teng", "Ma Chao"], ["Ma Teng", "Ma Dai"], ["Sun Ce", "Sun Quan"]],
};
// Hidden talents that may be discovered (city -> general definition)
export const HIDDEN_TALENTS = [
{ n: "Zhuge Liang", f: null, t: "Sleeping Dragon", b: 181, st: [88, 62, 100, 96, 92], tr: ["genius", "loyalheart", "scholar"], sk: "eightform", findCity: "xiangyang", minYear: 199, hint: "a young farmer-scholar who talks about the empire like a chessboard" },
{ n: "Pang Tong", f: null, t: "Fledgling Phoenix", b: 179, st: [80, 58, 98, 84, 70], tr: ["genius", "arrogant"], sk: "fireattack", findCity: "jiangling", minYear: 198, hint: "an ugly, brilliant wanderer whom everyone underestimates" },
{ n: "Xu Shu", f: null, t: "Single Sword Wanderer", b: 172, st: [76, 72, 90, 70, 76], tr: ["scholar", "brave"], sk: "ambush", findCity: "xuchang", minYear: 195, hint: "a swordsman turned strategist, avenging wrongs along the road" },
{ n: "Sima Yi", f: null, t: "Patient Wolf", b: 179, st: [86, 58, 98, 94, 78], tr: ["genius", "cautious", "ambitious"], sk: "patience", findCity: "luoyang", minYear: 201, hint: "a sickly-looking clerk whose eyes miss nothing" },
{ n: "Lu Xun", f: null, t: "Young Fire of Jiangdong", b: 183, st: [84, 62, 96, 88, 82], tr: ["genius", "naval", "kind"], sk: "fireattack", findCity: "wu", minYear: 203, hint: "a quiet youth of a great house who reads smoke like scripture" },
{ n: "Wang Ping", f: null, t: "Stubborn Veteran", b: 178, st: [78, 80, 60, 52, 50], tr: ["ironwill", "cautious"], sk: "ironguard", findCity: "hanzhong", minYear: 196, hint: "a hill soldier who knows every goat trail in the passes" },
];
// random-name parts for generic recruits
export const SURNAME = ["Zhao","Qian","Sun","Li","Zhou","Wu","Zheng","Wang","Feng","Chen","Chu","Wei","Jiang","Shen","Han","Yang","Zhu","Qin","You","Xu","He","Lü","Shi","Zhang","Kong","Cao","Yan","Hua","Jin","Tao","Jiang2","Qi","Xie","Zou","Yu","Bai","Shui","Dou","Zhang2","Pan"];
export const GIVEN = ["Ping","An","Kang","Ning","Fu","Gui","Lu","De","Long","Hu","Bao","Shan","Yi","Li","Jun","Jie","Xiong","Hao","Wei","Feng","Yuan","Liang","Zhong","Shi","Bo","Shu","Gong","Wenda","Gongjin","Yunchang","Yide","Zilong","Mingyuan"];
// ---------- UNITS ----------
// atk/def per 100 men; cost gold per 100 recruited; upkeep food/month per 100
export const UNIT_TYPES = {
spear: { name: "Spearmen", icon: "🔱", atk: 22, def: 26, cost: 60, food: 4, desc: "Cheap and steady. Counters cavalry." },
sword: { name: "Swordsmen", icon: "⚔", atk: 26, def: 22, cost: 90, food: 4, desc: "Balanced melee line infantry." },
bow: { name: "Archers", icon: "🏹", atk: 24, def: 14, cost: 100, food: 3, desc: "Strikes first rounds from range. Fragile in melee." },
xb: { name: "Crossbowmen", icon: "🎯", atk: 32, def: 16, cost: 150, food: 4, desc: "Devastating slow volleys. Weak defense." },
cav: { name: "Cavalry", icon: "🐎", atk: 34, def: 24, cost: 180, food: 7, desc: "Fast flankers. Counters archers, dies to spears." },
hcav: { name: "Heavy Cavalry",icon: "🦄", atk: 44, def: 34, cost: 300, food: 9, desc: "Shatterhammer of the line. Very expensive." },
};
// counter matrix attacker->defender multiplier
export const COUNTER = {
spear: { cav: 1.7, hcav: 1.8, spear: 1.0, sword: 0.9, bow: 0.8, xb: 0.8 },
sword: { spear: 1.1, sword: 1.0, bow: 1.2, xb: 1.1, cav: 0.8, hcav: 0.7 },
bow: { sword: 1.1, spear: 1.1, bow: 1.0, xb: 0.9, cav: 0.6, hcav: 0.5 },
xb: { hcav: 1.0, cav: 0.9, spear: 1.2, sword: 1.2, bow: 1.0, xb: 1.0 },
cav: { bow: 1.8, xb: 1.9, sword: 1.3, spear: 0.55, cav: 1.0, hcav: 0.8 },
hcav: { bow: 2.0, xb: 2.1, sword: 1.5, spear: 0.5, cav: 1.2, hcav: 1.0 },
};
// ---------- BUILDINGS ----------
export const BUILDINGS = {
farm: { name: "Farm", icon: "🌾", maxLv: 3, cost: lv => 500 + lv * 700, desc: "+food harvest" },
market: { name: "Market", icon: "🏮", maxLv: 3, cost: lv => 600 + lv * 800, desc: "+tax income" },
barracks: { name: "Barracks", icon: "⚔", maxLv: 3, cost: lv => 600 + lv * 800, desc: "+recruit capacity, troop quality" },
wall: { name: "Walls", icon: "🧱", maxLv: 3, cost: lv => 800 + lv * 1000, desc: "+siege defense" },
academy: { name: "Academy", icon: "📖", maxLv: 3, cost: lv => 700 + lv * 900, desc: "generals gain XP; unlocks stratagems" },
workshop: { name: "Workshop", icon: "🔧", maxLv: 2, cost: lv => 800 + lv * 1000, desc: "cheaper elite troops, siege engines" },
granary: { name: "Granary", icon: "🏚", maxLv: 2, cost: lv => 500 + lv * 600, desc: "+food storage, famine protection" },
};
// ---------- FORMATIONS ----------
export const FORMATIONS = {
balanced: { name: "Balanced Line", icon: "", desc: "No bonuses, no weaknesses.", mods: {} },
turtle: { name: "Turtle", icon: "🐢", desc: "Defense +30%, damage 15%. Grinds the foe down.", mods: { defMul: 1.3, atkMul: 0.85 } },
spearwall: { name: "Spear Wall", icon: "🔱", desc: "Counters cavalry utterly; weak to arrows.", mods: { antiCav: 2.0, vsBow: 1.35 } },
cavcharge: { name: "Cavalry Charge",icon: "🐎", desc: "First 3 rounds +50% damage; then fatigue.", mods: { burst: 1.5 } },
archerline: { name: "Archer Line", icon: "🏹", desc: "Ranged units +35%; melee weaker.", mods: { ranged: 1.35, melee: 0.85 } },
encircle: { name: "Encirclement", icon: "🌀", desc: "+damage each round as the trap closes; risky if losing morale.", mods: { ramp: 1.12 } },
};
// ---------- ORIGINS (custom warlord backgrounds) ----------
export const ORIGINS = {
governor: { name: "Local Governor", icon: "🏯", desc: "An appointed administrator. +Politics, cities start orderly, cheap buildings.", bonus: { stat: "pol", orderBonus: 15, buildDiscount: 0.15 } },
soldier: { name: "Former Soldier", icon: "⚔", desc: "Rose from the ranks. +War, troops cost 20% less, armies +5% morale.", bonus: { stat: "war", troopDiscount: 0.2, moraleBonus: 5 } },
noble: { name: "Fallen Noble", icon: "⛩", desc: "Blood of old houses. +Legitimacy 15, start with +1500 gold, marriage offers come easier.", bonus: { legit: 15, gold: 1500, diploBonus: 8 } },
bandit: { name: "Bandit Leader", icon: "🐺", desc: "Feared raider. Start with extra troops, +Fear, Honor. Order harder to keep.", bonus: { fear: 15, honor: -10, extraTroops: 400, orderPenalty: -10 } },
merchant: { name: "Merchant Prince", icon: "🏮", desc: "Silver tongue and ledgers. +25% tax, trade deals better, +500 gold.", bonus: { taxBonus: 0.25, gold: 500, tradeBonus: 10 } },
scholar: { name: "Wandering Scholar", icon: "📖", desc: "Students everywhere. Free talented retainer, academies cheaper, discover talents easier.", bonus: { stat: "int", academyDiscount: 0.3, findBonus: 0.15 } },
exile: { name: "Exiled General", icon: "🎖", desc: "A famous commander fleeing injustice. Start with a veteran sworn friend, +Fame.", bonus: { fame: 15, companion: true } },
rebel: { name: "Rebel Firebrand", icon: "🔥", desc: "The peasants rise for you. Recruits cost half, +recruitment, Legitimacy.", bonus: { recruitDiscount: 0.5, legit: -10, fame: 10 } },
};
export const DIFFICULTIES = {
easy: { name: "Shepherd of the People", aiIncome: 0.75, aiAggro: 0.8, playerTax: 1.15, desc: "AI grows slower; forgiving economy." },
normal: { name: "Contender", aiIncome: 1.0, aiAggro: 1.0, playerTax: 1.0, desc: "The intended struggle for the realm." },
hard: { name: "Vulture of the Age", aiIncome: 1.3, aiAggro: 1.35, playerTax: 0.9, desc: "AI expands aggressively and hunts the weak — including you." },
};
// decorative river polylines (hex col,row)
export const RIVERS = [
{ name: "Yellow River", pts: [[5,6],[6,7],[7,8],[8,8],[9,9],[10,9],[11,8],[12,7],[13,7],[14,8],[16,8],[18,8],[20,8]] },
{ name: "Yangtze", pts: [[3,15],[4,15],[6,15],[8,15],[10,15],[12,15],[13,15],[15,15],[17,16],[19,16],[21,16],[23,17]] },
{ name: "Han River", pts: [[9,12],[9,13],[10,14]] },
{ name: "Huai River", pts: [[14,13],[16,13],[18,14],[19,15]] },
];
// season names
export const SEASONS = ["Winter","Spring","Summer","Autumn"];
export function seasonOfMonth(m){ if(m>=2&&m<=4)return"Spring"; if(m>=5&&m<=7)return"Summer"; if(m>=8&&m<=10)return"Autumn"; return"Winter"; }