版本比较
oj运维模拟器(修改版)
正文
增加 127 行删除 127 行
27 行未改动2829303132323334353621 行未改动5859606162626364656610 行未改动77787980818182838485858687888990919293949595969798999910010110210310410510610710710810911011133 行未改动14514614714814914915015115215215315415515615715415515615715815916016116216316416516516616716816975 行未改动24524624724824924925025125225330 行未改动28428528628728828828929029129217 行未改动31031131231331431431531631731831932032132132232332432532632732832832933033133221 行未改动35435535635735835835936036136236236336436536619 行未改动38638738838939039039139239339420 行未改动41541641741841941942042142242317 行未改动44144244344444544644544644744844945024 行未改动47547647747847947948048148248348348448548648748848949049149249249349449549619 行未改动5165175185195205205215225235235245255265275285295295305315325335345355365375385395395405415425435445455455465475485495505515525525535545555565575585595605615625625635645645655665675688 行未改动57757857958058158258158258358458558611 行未改动59859960060160260260360460460560660760860960961061161261361361461561661714 行未改动63263363463563663763663763863964064064164264364364464564664664764864965065165265365465465565665765865965966066166266366466466566666766827 行未改动6966976986997007007017027037037047057067074 行未改动7127137147157167177187167177187197207217227237237247257267267277287297307317327337347357367347357367377387397397407417417427437447457467477487487497507517527537547527537547557567577577587597607607617627637644 行未改动7697707717727737747737747757767777782 行未改动7817827837847857857867877887897897907917927937937947957967974 行未改动8028038048058068068078088098107 行未改动8188198208218228228238248258268278288258268278288298308318328338348358368368378388398408418428438438448458468478488488498508518528538548558568568578588598598608618628638648658668678688698698708718728738748758768738748758768778788788798808818818828838848858868878888898898908918928939 行未改动90390490590690790790890991091191291391491591691691791891991992092192292313 行未改动9379389399409419419429439449459469469479489499499509519529533 行未改动9579589599609619619629639649649659669679689699699709719729739749749759769779785 行未改动984985986987988988989990991992992993994995996997998999100010001001100210031004100410051006100610071008100910101010101110121013101410151016101710181019101810191020102110221023102410251026102610271028102910301031103110321033103410354 行未改动10401041104210431044104410451046104710482 行未改动105110521053105410551055105610571058105910601061106210631064106410651066106710685 行未改动1074107510761077107810781079108010811082108210831084108510861087108710881089109010911092109210931094109510962 行未改动1099110011011102110311031104110511061107110811091110111111121113111311141115111611171117111811191120112111211122112311241124112511261127112811291130113011311132113311341135113611361137113811391139114011411142114311 行未改动27 行未改动 } ::-webkit-scrollbar { width: 8px; } ::-webkit-scrollbar-track { background: var(--bg-color); } ::-webkit-scrollbar-thumb { background: #444; border-radius: 4px; }
#sidebar { width: 350px; background-color: var(--panel-bg); padding: 20px;21 行未改动 } .stat-row { display: flex; justify-content: space-between; margin-bottom: 4px; align-items: center; } .stat-val { font-weight: bold; color: #4fc3f7; font-family: monospace; font-size: 1.1em; } .sub-text { font-size: 0.8em; color: #888; }
.forecast-row { display: flex; justify-content: space-between; font-size: 0.85em; color: #aaa; border-bottom: 1px dashed #333; padding: 2px 0; } .forecast-val { font-family: monospace; } .income { color: #69f0ae; } .expense { color: #ff5252; }10 行未改动 font-size: 0.9em; } button:hover { background-color: var(--text); transform: translateY(-1px); } button:disabled { background-color: #333; cursor: not-allowed; opacity: 0.6; transform: none; }
.btn-group { display: flex; align-items: center; margin-bottom: 6px; } .btn-group label { width: 80px; font-size: 0.9em; color: #ccc; } .btn-small { padding: 4px 8px; font-size: 0.8em; background-color: #444; }
.tabs { display: flex; border-bottom: 2px solid #333; margin-bottom: 15px; } .tab { padding: 10px 20px; cursor: pointer; background: rgba(0,0,0,0.2); border-radius: 8px 8px 0 0; margin-right: 4px; } .tab.active { background: var(--text); color: white; font-weight: bold; }
.panel { display: none; animation: fadeIn 0.3s; } .panel.active { display: block; } @keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.action-card { background: var(--panel-bg); border: 1px solid var(--border); padding: 15px; margin-bottom: 15px; border-radius: 8px; }
#log-area { height: 200px; background: #111; font-family: 'Consolas', monospace;33 行未改动 margin-bottom: 10px; border-radius: 8px; } #next-month-btn:hover { background-color: #43a047; }
.progress-container { width: 100%; background-color: #333; height: 6px; border-radius: 3px; margin-top: 8px; overflow: hidden; } .progress-bar { height: 100%; background-color: var(--success); width: 0%; transition: width 0.5s ease-out; }
.edu-card { background: #222; padding: 12px; margin-bottom: 10px; border-radius: 6px; background: #222; padding: 12px; margin-bottom: 10px; border-radius: 6px; border-left: 4px solid var(--text); } .edu-header { display: flex; justify-content: space-between; font-weight: bold; margin-bottom: 8px; } .edu-cost { font-size: 0.85em; color: #aaa; margin-bottom: 8px; line-height: 1.4; } .edu-actions { display: flex; gap: 8px; } .btn-run { background-color: #2e7d32; flex: 1; } .btn-up { background-color: #1565c0; flex: 1; }
/* 新增:资源转化按钮组样式优化 */ .convert-btn-group { display: flex; align-items: center;75 行未改动</div>
<div id="main"> <div id="warning-banner">警告:预计下个月将破产!请立即筹集资金!</div>
<button id="next-month-btn" onclick="game.nextMonth()">进入下个月</button>
<div class="tabs"> <div class="tab active" onclick="ui.switchTab('ops')">日常运营</div>30 行未改动 <button onclick="game.organizeContest('water')">水赛 (需要$1000, 学术40)<br><span style="font-size:0.8em">低质题目+6, 增长x1.15</span></button> <button onclick="game.organizeContest('normal')">普通赛 (需要$3000, 学术80)<br><span style="font-size:0.8em">普通题目+4, 增长x1.1</span></button> <button onclick="game.organizeContest('grand')">优秀赛 (需要$8000, 学术200)<br><span style="font-size:0.8em">高质题目+3, 增长x1.1, 升声誉</span></button> </div>
<div class="action-card"> <h3>题库扩充</h3> <div class="card-desc" style="font-size:0.85em; color:#aaa; margin-bottom:5px;">搬运普通/低质试题可吸引 10~50 名新用户。</div> <!-- 基础题库扩充 -->17 行未改动 <h3>基础设施</h3> <div style="color:#ff5252; font-size:0.85em; margin-bottom:10px; font-weight:bold;"> 注意:当核心数达到架构上限(32或64 × 架构等级)时,必须先升级架构才能继续购买。 </div>
<div class="btn-group"> <label>Web核心:</label> <button onclick="game.expandHardware('server', 1)">+1</button> <button onclick="game.expandHardware('server', 10)" class="btn-small">+10</button> <button onclick="game.expandHardware('server', 'max')" class="btn-small" style="background:#555">填满</button> </div>
<div class="btn-group"> <label>评测核心:</label> <button onclick="game.expandHardware('judge', 1)">+1</button> <button onclick="game.expandHardware('judge', 10)" class="btn-small">+10</button> <button onclick="game.expandHardware('judge', 'max')" class="btn-small" style="background:#555">填满</button> </div>
<div class="btn-group" style="margin-top:10px"> <button onclick="game.expandHardware('disk', 1)">加硬盘 (+40GB)</button> <button onclick="game.expandHardware('disk', 25)">加硬盘 (+1000GB)</button> </div>21 行未改动 <h4 style="margin-top:0">研发团队 (产出: <span id="out-rd">0</span>/月)</h4> <button onclick="game.hire('rd_student')">高中生 ($1500, +20 研发)</button> <button onclick="game.hire('rd_uni')">大学生 ($5000, +75 研发)</button> <button onclick="game.hire('rd_full')">全职大牛 ($12000, +120 研发)</button>
<h4 style="margin-top:10px">学术团队 (产出: <span id="out-acad">0</span>/月)</h4> <button onclick="game.hire('acad_part')">现役选手 ($500, +50 学术)</button> <button onclick="game.hire('acad_full')">全职教练 ($15000, +400 学术)</button>
<h4 style="margin-top:10px">社区团队 (产出: <span id="out-comm">0</span>/月)</h4> <button onclick="game.hire('comm_part')">兼职版主 ($500, +50 社区)</button> <button onclick="game.hire('comm_full')">全职运营 ($7500, +400 社区)</button> </div>19 行未改动 INITIAL: { YEAR: 2013, MONTH: 1, MONEY: 5000, AP: 100, USERS: 50, SERVER_CORES: 2, JUDGE_CORES: 1, DISK_MB: 20480 }, INCOME: { MONTHLY_GRANT: 500 }, COSTS: { SERVER_CORE_RENT: 200, JUDGE_CORE_RENT: 200, DISK_BLOCK_RENT: 100, DISK_BLOCK_SIZE_GB: 40, ADD_PROBLEM_ACAD: 20, ADD_PROBLEM_BATCH_ACAD: 200, ADD_PROBLEM_ACAD: 20, ADD_PROBLEM_BATCH_ACAD: 200, HIRE_AP: 10 }, HIRING: { rd_student: { name: "高中兼职", cost: 1500, gain: 20, limit: 5, type: 'rd' },20 行未改动 }, USER_BEHAVIOR: { SUBMISSIONS: { normal: 15, active: 65, core: 300 }, SOLUTIONS: { normal: 0.01, active: 1, core: 5 }, GROWTH_FACTOR: 0.25, GROWTH_FACTOR: 0.25, UPGRADE_N_A_BASE: 4, UPGRADE_N_A_MULT: 10, UPGRADE_A_C_MULT: 5 }, DISK_USAGE: { PROBLEM: 50, USER_DATA: 0.05, SUBMISSION: 0.002, SOLUTION: 0.005 }, CLASSES: {17 行未改动 total_solutions: 0, reputation: 0, last_month: { subs: 0, sols: 0 }, consecutive_failure_months: 0, comm_fail_months: 0, pending_user_bonus: 0 comm_fail_months: 0, pending_user_bonus: 0 }, hardware: { server_cores: GAME_PARAMS.INITIAL.SERVER_CORES, judge_cores: GAME_PARAMS.INITIAL.JUDGE_CORES, disk_extra_blocks: 0, disk_used: 0, server_arch: 1, judge_arch: 124 行未改动 for (let k in this.staff) { let count = this.staff[k], conf = GAME_PARAMS.HIRING[k]; if (count > 0) { salary += count * conf.cost; gain[conf.type] += count * conf.gain; } }
this.money += GAME_PARAMS.INCOME.MONTHLY_GRANT; this.money -= salary; this.resources.rd += gain.rd; this.resources.acad += gain.acad; this.resources.comm += gain.comm;
if(salary > 0) ui.log(`财务: 发放工资 ${salary}, 产出 R:${gain.rd} A:${gain.acad} C:${gain.comm}`);
// Maintenance let maintain_rd = 0; for (let k in GAME_PARAMS.FEATURES) if (this.features_unlocked[k]) maintain_rd += GAME_PARAMS.FEATURES[k].maintain; maintain_rd += 20 * (this.hardware.server_arch - 1); maintain_rd += 20 * (this.hardware.judge_arch - 1); this.resources.rd = Math.max(this.resources.rd - maintain_rd, 0);
// 硬件租金计算 let hw_cost = this.hardware.disk_extra_blocks * GAME_PARAMS.COSTS.DISK_BLOCK_RENT; hw_cost += this.hardware.server_cores * GAME_PARAMS.COSTS.SERVER_CORE_RENT; hw_cost += this.hardware.judge_cores * GAME_PARAMS.COSTS.JUDGE_CORE_RENT;19 行未改动 load_multiplier = 1.0; } let load = u.active + (u.normal / 3) + (u.core * 3); load *= load_multiplier;
if (this.features_unlocked.api) { let total_u = u.normal + u.active + u.core; this.money += Math.floor(total_u * 1.0); this.money += Math.floor(total_u * 1.0); }
// --- Growth Logic --- let rep = this.stats.reputation; let total_users = u.normal + u.active + u.core;
let pct_rate = (rep * 8 + 4) / 100; if (pct_rate < 0) pct_rate = 0; let growth_from_pct = total_users * pct_rate; let growth_from_fixed = (rep + 1) * 50; if (growth_from_fixed < 0) growth_from_fixed = 0;
let new_users = Math.floor(growth_from_pct + growth_from_fixed); if (this.flags.contest_growth_mult !== 1.0) { new_users = Math.floor(new_users * this.flags.contest_growth_mult); this.flags.contest_growth_mult = 1.0; this.flags.contest_growth_mult = 1.0; } // 讨论区新增1.1倍用户增长加成 if (this.features_unlocked.discuss) { new_users = Math.floor(new_users * 1.05); }
// 搬题奖励发放 if (this.stats.pending_user_bonus > 0) { new_users += this.stats.pending_user_bonus; ui.log(`推广: 试题扩充吸引了额外 ${this.stats.pending_user_bonus} 名用户`); this.stats.pending_user_bonus = 0; }
u.normal += new_users; if (new_users > 0) ui.log(`用户: 新增 ${new_users} 人`);
// Flow let prob_n2a = (rep * GAME_PARAMS.USER_BEHAVIOR.UPGRADE_N_A_MULT + GAME_PARAMS.USER_BEHAVIOR.UPGRADE_N_A_BASE) / 100; if (this.features_unlocked.difficulty) prob_n2a *= 1.1; if (this.features_unlocked.solution) prob_n2a *= 1.25; if (this.features_unlocked.discuss) prob_n2a *= 1.1; if (this.features_unlocked.team) prob_n2a *= 1.1;
let delta_n2a = Math.floor(u.normal * prob_n2a); if (delta_n2a > 0) { u.normal -= delta_n2a; u.active += delta_n2a; } if (delta_n2a > 0) { u.normal -= delta_n2a; u.active += delta_n2a; } else { let delta_a2n = Math.floor(u.active * Math.abs(prob_n2a)); u.active -= delta_a2n; u.normal += delta_a2n; }
let prob_a2c = (rep * GAME_PARAMS.USER_BEHAVIOR.UPGRADE_A_C_MULT) / 100; let delta_a2c = Math.floor(u.active * prob_a2c);8 行未改动 (u.active * GAME_PARAMS.USER_BEHAVIOR.SUBMISSIONS.active) + (u.core * GAME_PARAMS.USER_BEHAVIOR.SUBMISSIONS.core); let subs_int = Math.floor(subs); this.stats.total_submissions += subs_int; this.stats.last_month.subs = subs_int; this.stats.last_month.subs = subs_int;
let sols = 0; // 修改点2:总题数为0时题解数强制为0 let total_prob = this.stats.problems.high + this.stats.problems.mid + this.stats.problems.low; if (total_prob > 0 && this.features_unlocked.solution) {11 行未改动 (total_users * GAME_PARAMS.DISK_USAGE.USER_DATA) + (this.stats.total_submissions * GAME_PARAMS.DISK_USAGE.SUBMISSION) + (this.stats.total_solutions * GAME_PARAMS.DISK_USAGE.SOLUTION); this.hardware.disk_used = disk;
let disk_cap = GAME_PARAMS.INITIAL.DISK_MB + (this.hardware.disk_extra_blocks * GAME_PARAMS.COSTS.DISK_BLOCK_SIZE_GB * 1024);
// System Failure Check let is_disk_full = disk > disk_cap; let is_server_overload = load > server_cap; let is_judge_overload = load > judge_cap;
if (is_disk_full) ui.log("? 硬盘已满!数据写入失败!", "log-bad"); if (is_server_overload) ui.log("? Web服务器过载!", "log-bad"); if (is_judge_overload) ui.log("? 评测机过载!", "log-bad");
if (is_disk_full || is_server_overload || is_judge_overload) { this.stats.consecutive_failure_months++; ui.log(`?? 系统故障!连续故障月数: ${this.stats.consecutive_failure_months}/6`, "log-bad"); if (this.stats.consecutive_failure_months >= 6) {14 行未改动 if (this.features_unlocked.solution) acad_need += total_prob * 0.1; // 社区维护需求公式调整 let comm_need = 0; if (this.features_unlocked.discuss) { comm_need = (this.stats.users.core * 0.02) + (this.stats.users.active * 0.01) + comm_need = (this.stats.users.core * 0.02) + (this.stats.users.active * 0.01) + (this.stats.users.normal * 0.003); }
this.resources.acad -= acad_need; this.resources.comm -= comm_need;
let acad_gap = (this.resources.acad < 0) ? Math.abs(this.resources.acad) : 0; let comm_gap = (this.resources.comm < 0) ? Math.abs(this.resources.comm) : 0;
// 社区缺口统计 if (comm_gap > 0) this.stats.comm_fail_months++; // 每年1月罚款逻辑 if (this.date.month === 1 && this.stats.comm_fail_months >= 12 && total_users >= 10000) { let fine = total_users; this.money -= fine; ui.log(`?? 监管通知: 因长期社区维护不善,罚款 ${fine} 元!`, "log-bad"); this.stats.comm_fail_months = 0; this.stats.comm_fail_months = 0; }
let server_gap = Math.max(0, load - server_cap); let judge_gap = Math.max(0, load - judge_cap);
this.calculateReputation(acad_gap, comm_gap, server_gap, judge_gap, total_prob);
// Cooldowns for(let k in this.class_state) if (this.class_state[k].cooldown > 0) this.class_state[k].cooldown--;
if (this.flags.fundraising_penalty_val > 0) { this.flags.fundraising_penalty_val -= (0.2 / 12); if (this.flags.fundraising_penalty_val < 0) this.flags.fundraising_penalty_val = 0; }27 行未改动 if (acad_gap > 0) r_stable -= Math.log10(acad_gap) / 20; if (comm_gap > 0) r_stable -= Math.log10(comm_gap) / 20; if (server_gap > 0) r_stable -= Math.log10(server_gap) / 10; if (judge_gap > 0) r_stable -= Math.log10(judge_gap) / 10;
r_stable -= this.flags.fundraising_penalty_val; r_stable -= this.flags.temp_rep_penalty;
let total = r_acad + r_users + r_edu + r_stable; if (total > 1) total = 1; this.stats.reputation = total; },4 行未改动 ui.log(`行动: 10 AP -> 10 ${target}点`); ui.update(); },
convertAPAll: function(target) { if (this.ap < 10) { ui.log("AP不足(至少需要10点)", "log-bad"); return; if (this.ap < 10) { ui.log("AP不足(至少需要10点)", "log-bad"); return; } const convertTimes = Math.floor(this.ap / 10); const apCost = convertTimes * 10; const resourceGain = convertTimes * 10;
this.ap -= apCost; this.resources[target] += resourceGain;
ui.log(`行动: ${apCost} AP -> ${resourceGain} ${target}点(剩余AP: ${this.ap})`, "log-good"); ui.update(); },
addProblem: function(type) { // 基础加题 if (type === 'high' || type === 'mid' || type === 'low') { if (this.resources.acad < GAME_PARAMS.COSTS.ADD_PROBLEM_ACAD) { ui.log("学术不足", "log-bad"); return; if (this.resources.acad < GAME_PARAMS.COSTS.ADD_PROBLEM_ACAD) { ui.log("学术不足", "log-bad"); return; } this.resources.acad -= GAME_PARAMS.COSTS.ADD_PROBLEM_ACAD;
if (type === 'mid' || type === 'low') { let bonus = Math.floor(Math.random() * 41) + 10; let bonus = Math.floor(Math.random() * 41) + 10; this.stats.pending_user_bonus = (this.stats.pending_user_bonus || 0) + bonus; }
if (type === 'high') this.stats.problems.high += 3; if (type === 'mid') this.stats.problems.mid += 10; if (type === 'low') { this.stats.problems.low += 20; this.stats.reputation -= 0.001; } ui.log(`题库: 增加 ${type} 试题`); ui.log(`题库: 增加 ${type} 试题`); } // 批量加题 else if (type === 'high_batch' || type === 'mid_batch' || type === 'low_batch') { if (this.resources.acad < GAME_PARAMS.COSTS.ADD_PROBLEM_BATCH_ACAD) { ui.log("学术不足(需要200点)", "log-bad"); return; if (this.resources.acad < GAME_PARAMS.COSTS.ADD_PROBLEM_BATCH_ACAD) { ui.log("学术不足(需要200点)", "log-bad"); return; } this.resources.acad -= GAME_PARAMS.COSTS.ADD_PROBLEM_BATCH_ACAD;
// 批量题也有用户奖励 if (type === 'mid_batch' || type === 'low_batch') { let bonus = Math.floor(Math.random() * 201) + 50; let bonus = Math.floor(Math.random() * 201) + 50; this.stats.pending_user_bonus = (this.stats.pending_user_bonus || 0) + bonus; }
if (type === 'high_batch') {4 行未改动 this.stats.problems.mid += 100; ui.log(`题库: 批量增加普通试题 (+100题)`); } if (type === 'low_batch') { this.stats.problems.low += 200; this.stats.reputation -= 0.01; this.stats.problems.low += 200; this.stats.reputation -= 0.01; ui.log(`题库: 批量增加低质量试题 (+200题),声誉小幅下降`, "log-warn"); } } ui.update();2 行未改动 organizeContest: function(key) { let conf = GAME_PARAMS.CONTESTS[key]; if (this.money < conf.cost || this.resources.acad < conf.acad) { ui.log("资源不足", "log-bad"); return; } this.money -= conf.cost; this.resources.acad -= conf.acad;
if (conf.prob_mid) this.stats.problems.mid += conf.prob_mid; if (conf.prob_low) this.stats.problems.low += conf.prob_low; if (conf.prob_high) this.stats.problems.high += conf.prob_high;
if (conf.rep_pen) this.flags.temp_rep_penalty += conf.rep_pen; if (conf.rep_gain) this.stats.reputation += conf.rep_gain; if (conf.growth_mult) this.flags.contest_growth_mult = conf.growth_mult;
ui.log(`比赛: ${conf.name} (下月增长 x${conf.growth_mult})`); ui.update(); },
fundraising: function() {4 行未改动 // 修改点:新增随机数因子,范围 0.1 ~ 2 let random_factor = Math.random() * 1.9 + 0.1; // 生成 0.1 到 2 之间的随机数 let gain = Math.floor((this.stats.reputation + 1) * total_users * random_factor); if (gain < 0) gain = 0;
this.money += gain; this.flags.fundraising_penalty_val += 0.2; ui.log(`募捐: 获得 ${gain} 元,声誉受损`, "log-bad"); ui.update(); },7 行未改动 },
expandHardware: function(type, mode) { mode = mode || 1;
if (type === 'disk') { let count = (typeof mode === 'number') ? mode : 1; this.hardware.disk_extra_blocks += count; ui.log(`硬件: 硬盘扩容 (+${count * 40}GB)`); ui.update(); return; this.hardware.disk_extra_blocks += count; ui.log(`硬件: 硬盘扩容 (+${count * 40}GB)`); ui.update(); return; }
let isServer = (type === 'server'); let arch = isServer ? this.hardware.server_arch : this.hardware.judge_arch; let current = isServer ? this.hardware.server_cores : this.hardware.judge_cores; let limit_base = isServer ? 32 : 64; let limit = limit_base * arch;
let count = 0; if (mode === 'max') { count = limit - current; } else { count = mode; }
if (count <= 0) { ui.log("已达到架构上限,无法添加", "log-bad"); return; }
if (current + count > limit) { count = limit - current; if (count <= 0) { ui.log("核心数已达架构上限,请先升级架构", "log-bad"); return; } }
if (isServer) this.hardware.server_cores += count; else this.hardware.judge_cores += count;
ui.log(`硬件: ${isServer?'Web':'评测'}核心 +${count}`); ui.update(); },
// 修改点1:升级架构耗费改为200研发+$500*核心数 upgradeArch: function(type) { let isServer = (type === 'server'); let currentCores = isServer ? this.hardware.server_cores : this.hardware.judge_cores; let costMoney = 500 * currentCores;
// 新规则:研发点 = 200 + 50 × (当前架构等级 - 1) let currentArch = isServer ? this.hardware.server_arch : this.hardware.judge_arch; let costRD = 200 + 50 * (currentArch - 1); if (this.money < costMoney || this.resources.rd < costRD) { ui.log(`资源不足(需要$${costMoney} + ${costRD} 研发点)`, "log-bad"); return;
if (this.money < costMoney || this.resources.rd < costRD) { ui.log(`资源不足(需要$${costMoney} + ${costRD} 研发点)`, "log-bad"); return; }
this.money -= costMoney; this.resources.rd -= costRD;
if (isServer) { this.hardware.server_arch++; ui.log(`研发: Web架构升级至Lv.${this.hardware.server_arch}`, "log-good"); } else { this.hardware.judge_arch++; ui.log(`研发: 评测架构升级至Lv.${this.hardware.judge_arch}`, "log-good"); }
ui.update();},
unlockFeature: function(id) {9 行未改动 let conf = GAME_PARAMS.CLASSES[id], st = this.class_state[id]; if (conf.season && !conf.season.includes(this.date.month)) { ui.log("季节不符 (需7-10月)", "log-bad"); return; } if (st.cooldown > 0) return; if (this.money < conf.req_money || this.resources.acad < conf.req_acad) { ui.log("无法开课 (资源不足)", "log-bad"); return; }
this.money -= conf.req_money; this.resources.acad -= conf.req_acad; this.money += conf.inc_base * st.level; st.cooldown = 3; ui.log(`网校: ${conf.name} 开课`, "log-good"); ui.update(); },
upgradeClass: function(id) { let conf = GAME_PARAMS.CLASSES[id], st = this.class_state[id]; if (st.level >= conf.max) return;
let cm = conf.cost_base * st.level; let ca = conf.acad_base * st.level;
if (this.money < cm || this.resources.acad < ca) { ui.log("升级资源不足", "log-bad"); return; } this.money -= cm; this.resources.acad -= ca; st.level++; ui.log(`网校: 升级 ${conf.name}`, "log-good"); ui.renderClasses(); ui.update(); },13 行未改动 document.getElementById('disp-date').innerText = `${game.date.year}-${String(game.date.month).padStart(2,'0')}`; document.getElementById('disp-money').innerText = game.money; document.getElementById('disp-rep').innerText = game.stats.reputation.toFixed(3); document.getElementById('rep-bar').style.width = Math.max(0, Math.min(100, (game.stats.reputation + 1)/2*100)) + '%';
document.getElementById('disp-ap').innerText = game.ap; document.getElementById('disp-rd').innerText = Math.floor(game.resources.rd); document.getElementById('disp-acad').innerText = Math.floor(game.resources.acad); document.getElementById('disp-comm').innerText = Math.floor(game.resources.comm);
let u = game.stats.users; document.getElementById('disp-users-total').innerText = u.normal + u.active + u.core;
let failSpan = document.getElementById('disp-fail-months'); failSpan.innerText = `${game.stats.consecutive_failure_months} / 6`; failSpan.style.color = game.stats.consecutive_failure_months > 0 ? '#ff5252' : '#aaa';
3 行未改动 let p = game.stats.problems; document.getElementById('disp-prob-high').innerText = p.high; document.getElementById('disp-prob-mid').innerText = p.mid; document.getElementById('disp-prob-low').innerText = p.low;
let disk_cap = GAME_PARAMS.INITIAL.DISK_MB + (game.hardware.disk_extra_blocks * GAME_PARAMS.COSTS.DISK_BLOCK_SIZE_GB * 1024); document.getElementById('disp-disk').innerText = `${(game.hardware.disk_used/1024).toFixed(1)} / ${(disk_cap/1024).toFixed(1)} GB`;
document.getElementById('disp-server-core').innerText = game.hardware.server_cores; document.getElementById('disp-server-arch').innerText = game.hardware.server_arch; document.getElementById('disp-judge-core').innerText = game.hardware.judge_cores; document.getElementById('disp-judge-arch').innerText = game.hardware.judge_arch;
// Load Calculation let server_arch_bonus = (game.hardware.server_arch - 1) * 100; let server_cap_unit = 500 - (game.features_unlocked.team?50:0) - (game.features_unlocked.api?50:0) + server_arch_bonus; let s_cap = game.hardware.server_cores * server_cap_unit;
let judge_arch_bonus = (game.hardware.judge_arch - 1) * 100; let judge_cap_unit = 500 + judge_arch_bonus; let j_cap = game.hardware.judge_cores * judge_cap_unit;
5 行未改动 } let load = u.active + (u.normal/3) + (u.core*3); load *= load_multiplier; load = Math.floor(load);
document.getElementById('disp-server-load').innerText = load; document.getElementById('disp-server-cap').innerText = s_cap; document.getElementById('disp-server-load').style.color = (load > s_cap) ? '#ff5252' : '#888';
document.getElementById('disp-judge-load').innerText = load; document.getElementById('disp-judge-cap').innerText = j_cap; document.getElementById('disp-judge-load').style.color = (load > j_cap) ? '#ff5252' : '#888';
// Forecast let salary = 0; for (let k in game.staff) salary += game.staff[k] * GAME_PARAMS.HIRING[k].cost;
let hw_cost = game.hardware.disk_extra_blocks * GAME_PARAMS.COSTS.DISK_BLOCK_RENT; hw_cost += game.hardware.server_cores * GAME_PARAMS.COSTS.SERVER_CORE_RENT; hw_cost += game.hardware.judge_cores * GAME_PARAMS.COSTS.JUDGE_CORE_RENT;
let total_expense = salary + hw_cost;
let api_income = 0; if (game.features_unlocked.api) api_income = Math.floor((u.normal+u.active+u.core) * 1.0); let total_income = GAME_PARAMS.INCOME.MONTHLY_GRANT + api_income;
let m_rd = 0, m_acad = 0, m_comm = 0; for (let k in GAME_PARAMS.FEATURES) if (game.features_unlocked[k]) m_rd += GAME_PARAMS.FEATURES[k].maintain; m_rd += 20 * (game.hardware.server_arch - 1) + 20 * (game.hardware.judge_arch - 1); let total_prob = p.high + p.mid + p.low; if (game.features_unlocked.difficulty) m_acad += total_prob * 0.05; if (game.features_unlocked.solution) m_acad += total_prob * 0.1; if (game.features_unlocked.discuss) { m_comm = (game.stats.users.core * 0.02) + (game.stats.users.active * 0.01) + m_comm = (game.stats.users.core * 0.02) + (game.stats.users.active * 0.01) + (game.stats.users.normal * 0.003); }
document.getElementById('fc-income').innerText = `+${total_income}`; document.getElementById('fc-salary').innerText = `-${salary}`; document.getElementById('fc-maint').innerText = `-${hw_cost}`;
let net = total_income - total_expense; let netEl = document.getElementById('fc-net'); netEl.innerText = (net >= 0 ? '+' : '') + net; netEl.style.color = (net >= 0 ? '#69f0ae' : '#ff5252');
document.getElementById('fc-rd-cost').innerText = m_rd; document.getElementById('fc-acad-cost').innerText = Math.floor(m_acad); document.getElementById('fc-comm-cost').innerText = Math.floor(m_comm);
4 行未改动 let staff = game.staff, h = GAME_PARAMS.HIRING; document.getElementById('out-rd').innerText = staff.rd_student*h.rd_student.gain + staff.rd_uni*h.rd_uni.gain + staff.rd_full*h.rd_full.gain; document.getElementById('out-acad').innerText = staff.acad_part*h.acad_part.gain + staff.acad_full*h.acad_full.gain; document.getElementById('out-comm').innerText = staff.comm_part*h.comm_part.gain + staff.comm_full*h.comm_full.gain;
// 更新架构升级成本显示let s_cores = game.hardware.server_cores;let j_cores = game.hardware.judge_cores;let s_rd_cost = 200 + 50 * (game.hardware.server_arch - 1);2 行未改动document.getElementById('disp-up-judge-cost').innerText = `$${500 * j_cores} + ${j_rd_cost} 研发`;
ui.renderClasses(); },
log: function(msg, cls) { let div = document.createElement('div'); div.className = 'log-entry ' + (cls||''); div.innerText = `[${game.date.year}-${game.date.month}] ` + msg; let area = document.getElementById('log-area'); area.appendChild(div); area.scrollTop = area.scrollHeight; },
switchTab: function(id) { document.querySelectorAll('.tab').forEach(t => t.classList.remove('active')); document.querySelectorAll('.panel').forEach(p => p.classList.remove('active')); document.querySelector(`.tab[onclick="ui.switchTab('${id}')"]`).classList.add('active');5 行未改动 for(let k in GAME_PARAMS.FEATURES) { let f = GAME_PARAMS.FEATURES[k]; let div = document.createElement('div'); div.className = 'edu-card';
let header = document.createElement('div'); header.className = 'edu-header'; header.innerHTML = `${f.name} <span style="color:#ffb74d">$${f.cost} / ${f.rd} 研发</span>`;
let desc = document.createElement('div'); desc.style.fontSize = '0.85em'; desc.style.margin = '8px 0'; desc.innerText = f.desc;
let btn = document.createElement('button'); btn.innerText = game.features_unlocked[k] ? '已解锁' : '研发'; btn.disabled = game.features_unlocked[k]; if (!game.features_unlocked[k]) btn.onclick = () => game.unlockFeature(k);
div.appendChild(header); div.appendChild(desc); div.appendChild(btn); list.appendChild(div);2 行未改动
renderClasses: function() { let list = document.getElementById('edu-list'); list.innerHTML = '';
if (!game.features_unlocked.school) { list.innerHTML = '<div style="padding:10px; color:#aaa;">需先研发【网校功能】解锁</div>'; return; }
for(let k in GAME_PARAMS.CLASSES) { let conf = GAME_PARAMS.CLASSES[k], st = game.class_state[k]; let div = document.createElement('div'); div.className = 'edu-card';
let header = document.createElement('div'); header.className = 'edu-header'; header.innerHTML = `${conf.name} Lv.${st.level} <span style="color:#ffb74d">收入: ${conf.inc_base * st.level}</span>`;
let cost = document.createElement('div'); cost.className = 'edu-cost'; cost.innerHTML = `开课: $${conf.req_money} / ${conf.req_acad} 学术 | 升级: $${conf.cost_base * st.level} / ${conf.acad_base * st.level} 学术`;
let actions = document.createElement('div'); actions.className = 'edu-actions';
let btnRun = document.createElement('button'); btnRun.className = 'btn-run'; btnRun.innerText = st.cooldown > 0 ? `冷却(${st.cooldown})` : '开课'; btnRun.disabled = st.cooldown > 0; btnRun.onclick = () => game.runClass(k);
let btnUp = document.createElement('button'); btnUp.className = 'btn-up'; btnUp.innerText = `升级 (max:${conf.max})`; btnUp.disabled = st.level >= conf.max; btnUp.onclick = () => game.upgradeClass(k);
actions.appendChild(btnRun); actions.appendChild(btnUp);
div.appendChild(header); div.appendChild(cost); div.appendChild(actions); list.appendChild(div);11 行未改动