灵感来源
出于whk班主任模拟器和OI重开模拟器,我用deepseek结合两款模拟器做了一个 whk重生模拟器。
📖 游戏简介
《whk-重生学霸之路》是一款融合了学业养成、恋爱模拟、炒股投资与人生抉择的文字游戏。前世,你因追求心上人荒废了OI竞赛与文化课,最终高考失利。重生回到高考前,你决心逆天改命,在200天内平衡学业、感情与压力,走向不同的人生结局。
✨ 核心玩法
1️⃣ 学业成长
- 六门学科:语文、数学、英语、物理、化学、生物
- 等级体系:E → D → C → B → A → S → SS → SSS(班主任模拟器风格,带背景色)
- 性别倾向:
- 男生:理科(数理化生)+10%,文科(语英)-10%
- 女生:文科+10%,理科-10%
- 提升方式:认真听课、魔鬼特训(价格随等级上升)、上课摸鱼(有手机没收风险)
2️⃣ 恋爱攻略
- 可攻略对象:校花/校草、富家千金/富二代、普通同学(名字可自定义)
- 交互:约会(恋爱中必成功)、表白(成功率取决于真实好感)、分手、被表白(需选择回应)
- 风险:
- 脚踏两条船有50%概率被捉奸,双方好感大幅下降
- 分手有1%概率导致对方跳楼,游戏终结
- 父母可能来电催婚或劝分,影响感情与压力
3️⃣ 炒股系统
- 炒股能力独立等级(E~SSS),通过“学习炒股”提升,每次学习消耗金钱并增加压力,等级越高学习成本与压力越高。
4️⃣ 经济系统
- 打工:发传单、工地搬砖、家教
- 贷款:日息1%,消费不足时自动贷款
- 富家对象可索要零花钱
- 月考奖励、股票收益、打工收入
5️⃣ 随机事件
- 班主任提问:可选择尝试回答(概率受学科等级影响)或罚站,回答成功涨决心与好感,失败则反噬。
- 发现情书:可多次寻找,成本递增,成功率递减,失败损失决心递增。
- 体育课:随机触发,可选复习、稳妥打球、秀操作。
- 父母来电:单身时催恋,恋爱时劝分,影响压力与感情。
- 压力过载:压力≥100%会病倒一周,跳过7天并计算7天利息。
6️⃣ 高考结局
- 正常高考:根据平均学科等级判定大学(985/211/一本/二本/专科),并根据最高好感对象决定婚姻。
- 错过高考:若高考前压力≥90%,会病倒无法参加。
⏱️ 时间系统
- 初始可设定高考剩余天数
- 每周七天,周末不能上课
- 每天选择一个行动,时间自动推进
- 每30天一次月考,根据平均等级奖励金钱
🎯 游戏目标
在高考来临前,将学科等级提升至理想水平,同时处理好感情、经济与心理压力,争取进入理想大学,收获美满人生。
🚀 开始游戏
- 选择性别
- 自定义四位恋爱角色的名字
- 选择难度
- 创造属于你的逆袭故事!
html源代码
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>whk-重生学霸之路</title>
<style>
* { box-sizing: border-box; font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif; transition: all 0.2s ease; }
:root {
--primary: #1e3c5c; --accent: #e67e22; --danger: #c0392b; --success: #27ae60;
--bg: #ecf0f5; --card: #ffffff; --text: #2c3e50; --border: #bdc9d5;
--love: #d6336c; --rich: #f1c40f; --weekend: #95a5a6;
--level-sss: #4a1d6d; --level-ss: #7b3f9f; --level-s: #9333ea; --level-a: #e11d48;
--level-b: #ea580c; --level-c: #16a34a; --level-d: #3b82f6; --level-e: #64748b;
}
body { background: var(--bg); color: var(--text); margin: 0; display: flex; flex-direction: column; min-height: 100vh; font-size: 14px; }
button { cursor: pointer; border: none; border-radius: 8px; font-weight: bold; padding: 8px 16px; background: var(--primary); color: white; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-accent { background: var(--accent); }
.btn-love { background: var(--love); }
.btn-rich { background: var(--rich); color: #000; }
.btn-danger { background: var(--danger); }
.hidden { display: none !important; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.overlay { position: fixed; inset: 0; background: rgba(10,20,30,0.9); z-index: 9999; display: flex; justify-content: center; align-items: center; backdrop-filter: blur(6px); }
.modal-box { background: var(--card); border-radius: 24px; padding: 30px; width: 90%; max-width: 600px; box-shadow: 0 20px 40px rgba(0,0,0,0.5); max-height: 80vh; overflow-y: auto; }
.modal-title { font-size: 2em; color: var(--primary); border-bottom: 3px solid var(--accent); padding-bottom: 10px; margin-top: 0; }
header { height: 70px; background: var(--card); border-bottom: 4px solid var(--accent); display: flex; align-items: center; justify-content: space-between; padding: 0 25px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.stat-group { display: flex; gap: 20px; flex-wrap: wrap; }
.stat-pill { background: #f0f6fc; padding: 8px 18px; border-radius: 30px; border: 1px solid var(--border); font-weight: bold; display: flex; align-items: center; gap: 6px; }
.stat-pill b { color: var(--accent); font-size: 1.2em; }
.app-body { display: grid; grid-template-columns: 280px 1fr 280px; gap: 20px; padding: 20px; flex: 1; overflow: hidden; }
.stats-panel { background: var(--card); border-radius: 20px; padding: 20px; border: 1px solid var(--border); overflow-y: auto; box-shadow: 0 4px 10px rgba(0,0,0,0.03); }
.stats-panel h3 { margin-top: 0; color: var(--primary); border-bottom: 2px solid var(--accent); padding-bottom: 8px; }
.stat-item { display: flex; justify-content: space-between; margin: 12px 0; font-size: 1.1em; }
.stat-value { font-weight: bold; color: var(--accent); }
.subject-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 15px; }
.subject-card { background: #f8fafc; border-radius: 12px; padding: 10px; text-align: center; border: 1px solid #dde3ed; }
.subject-label { font-size: 0.8em; color: #4f6b8a; }
.subject-score { font-size: 1.8em; font-weight: 800; color: white; text-shadow: 0 1px 2px rgba(0,0,0,0.3); padding: 4px 0; border-radius: 8px; }
.subject-exp { font-size: 0.7em; color: #6c7a8d; }
.loan-info { background: #fef5e7; padding: 10px; border-radius: 12px; margin-top: 15px; border: 1px solid var(--rich); }
.interest-note { font-size: 0.8em; color: var(--danger); margin-top: 5px; }
.grade-info { background: #e0f2fe; padding: 8px; border-radius: 8px; margin-top: 10px; text-align: center; font-weight: bold; }
.action-panel { background: var(--card); border-radius: 20px; padding: 20px; border: 1px solid var(--border); overflow-y: auto; display: flex; flex-direction: column; }
.day-info { background: var(--primary); color: white; padding: 15px; border-radius: 16px; margin-bottom: 20px; text-align: center; font-size: 1.3em; font-weight: bold; }
.action-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-bottom: 20px; }
.action-card { background: #f8fafc; border: 1px solid var(--border); border-radius: 16px; padding: 16px; cursor: pointer; transition: 0.2s; text-align: center; }
.action-card.weekend-locked { background: #ecf0f1; color: #7f8c8d; pointer-events: none; opacity: 0.6; }
.action-card:hover:not(.weekend-locked) { border-color: var(--accent); transform: translateY(-3px); box-shadow: 0 6px 12px rgba(230,126,34,0.15); }
.action-icon { font-size: 2.5em; margin-bottom: 8px; }
.action-title { font-weight: bold; font-size: 1.1em; margin-bottom: 4px; }
.action-cost { font-size: 0.85em; color: #64748b; }
.sub-panel { background: #f0f6fc; border-radius: 16px; padding: 15px; margin-bottom: 15px; }
.subject-buttons, .love-buttons, .image-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.event-log { background: #1e2f3f; color: #eef5fc; border-radius: 16px; padding: 15px; flex: 1; overflow-y: auto; font-size: 0.9em; border-top: 4px solid var(--accent); }
.log-entry { margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px dashed #3a5770; }
.log-eff { color: #f9d77e; font-weight: bold; }
.social-panel { background: var(--card); border-radius: 20px; padding: 20px; border: 1px solid var(--border); overflow-y: auto; }
.love-card { border-radius: 16px; padding: 15px; margin-bottom: 15px; border: 2px solid; position: relative; }
.crush-card { border-color: var(--love); background: #fff0f5; }
.rich-card { border-color: var(--rich); background: #fef5e7; }
.normal-card { border-color: var(--border); background: #f8fafc; }
.love-name { font-size: 1.3em; font-weight: bold; }
.dating-tag { position: absolute; top: 10px; right: 10px; background: var(--love); color: white; padding: 2px 8px; border-radius: 20px; font-size: 0.7em; }
.love-feel { margin: 8px 0; }
.heart-bar { height: 10px; background: #ffccd5; border-radius: 10px; overflow: hidden; margin: 5px 0; }
.heart-fill { height: 100%; background: #ff4d6d; width: 0%; }
.no-contact { color: #7f8c8d; font-style: italic; }
.button-group { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.button-group button { flex: 1; min-width: 80px; }
.name-input-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 15px 0; }
.name-input-item { display: flex; flex-direction: column; }
.name-input-item label { font-weight: bold; margin-bottom: 4px; }
.name-input-item input { padding: 8px; border: 1px solid var(--border); border-radius: 6px; }
#start-overlay .story-content { background: #fef7e8; padding: 20px; border-radius: 16px; border-left: 6px solid var(--accent); line-height: 1.8; margin: 20px 0; }
.gender-select { display: flex; gap: 20px; justify-content: center; margin: 15px 0; }
.gender-select label { display: flex; align-items: center; gap: 5px; cursor: pointer; }
.stock-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 0.9em; }
.stock-table th, .stock-table td { padding: 6px; text-align: center; border: 1px solid var(--border); }
.stock-table th { background: var(--primary); color: white; }
.stock-input { width: 70px; padding: 4px; text-align: center; }
</style>
</head>
<body>
<div id="start-overlay" class="overlay">
<div class="modal-box">
<h1 class="modal-title">💔 whk-重生学霸之路</h1>
<div class="story-content" id="story-text">
<p>前世,你是OI赛场上的希望之星,却为了追求心上人,放弃了集训队选拔……最后对方保送985,而你OI失利、文化课一落千丈,只考上一所专科。</p>
<p>毕业五年后的同学会上,看到对方挽着优秀伴侣的手,你后悔莫及。当晚酗酒过度,心梗猝死。</p>
<p><strong>上天给了你一次重来的机会。</strong>你回到了高考前,这次你要逆天改命!</p>
</div>
<div class="gender-select">
<label><input type="radio" name="gender" value="male" checked> 🧑 男生</label>
<label><input type="radio" name="gender" value="female"> 👩 女生</label>
</div>
<div style="margin: 20px 0;">
<label>你回到了高考前 <input type="number" id="start-days" min="1" max="1000" value="200" style="width:80px;"> 天</label>
</div>
<h3 id="char-name-title">为恋爱角色命名</h3>
<div id="name-input-grid" class="name-input-grid"></div>
<div style="display: flex; gap: 15px; justify-content: center; margin: 20px 0;">
<button class="btn-accent" onclick="startGame('easy')">🚀 简单模式</button>
<button onclick="startGame('hard')">🔥 困难模式</button>
</div>
</div>
</div>
<header id="main-header" class="hidden">
<div style="font-size:1.5rem; font-weight:900; color:var(--primary);">📚 高考冲刺 · 重生之路</div>
<div class="stat-group">
<div class="stat-pill">⏰ 高考倒计时: <b id="ui-days-left">200</b>天</div>
<div class="stat-pill">📆 <span id="ui-weekday">周一</span></div>
<div class="stat-pill">💰 零花钱: <b id="ui-money">0</b></div>
<div class="stat-pill">🧠 决心: <b id="ui-determination">50</b>/100</div>
<div class="stat-pill">😰 压力: <b id="ui-stress">20</b>/100</div>
</div>
</header>
<div class="app-body hidden" id="main-body">
<div class="stats-panel">
<h3>📊 我的状态</h3>
<div class="stat-item"><span>✨ 魅力</span><span class="stat-value" id="stat-charm">60</span>/100</div>
<div class="stat-item"><span>💪 决心</span><span class="stat-value" id="stat-determination">50</span>/100</div>
<div class="stat-item"><span>😰 压力</span><span class="stat-value" id="stat-stress">20</span>/100</div>
<div class="stat-item"><span>💰 零花钱</span><span class="stat-value" id="stat-money">0</span></div>
<div class="loan-info">
<div class="stat-item"><span>💳 贷款</span><span class="stat-value" id="stat-loan">0</span>元</div>
<div class="interest-note">每日利息1%</div>
<button class="btn-rich" onclick="showLoanPanel()" style="width:100%; margin-top:5px;">💰 贷款 / 还款</button>
</div>
<div class="grade-info" id="grade-display">当前年级: 高三冲刺</div>
<h3 style="margin-top: 25px;">📚 学科等级</h3>
<div class="subject-grid" id="subject-scores"></div>
<div style="margin-top: 20px; background:#f0f6fc; padding:10px; border-radius:12px;">
<p><strong>🏫 教室环境</strong> Lv.<span id="fac-level">0</span> (学习效率+<span id="fac-bonus">0</span>%)</p>
</div>
<h3 style="margin-top: 25px;">📈 炒股能力</h3>
<div class="subject-card" style="margin-bottom:10px;"><div class="subject-label">炒股等级</div><div class="subject-score" id="stock-level" style="background:var(--level-e);">E</div><div class="subject-exp" id="stock-exp">0/20</div></div>
</div>
<div class="action-panel">
<div class="day-info" id="day-info">
距离高考 <span id="current-days">200</span> 天 · <span id="current-weekday">周一</span>
</div>
<div class="action-grid" id="action-buttons"></div>
<!-- 子面板 -->
<div id="train-panel" class="sub-panel hidden"><h4>选择特训科目 (价格随等级提升)</h4><div class="subject-buttons" id="train-subjects"></div><button onclick="hidePanels()">取消</button></div>
<div id="date-panel" class="sub-panel hidden"><h4>和谁约会?(花费随机20~80💰)</h4><div class="love-buttons" id="date-love"></div><button onclick="hidePanels()">取消</button></div>
<div id="work-panel" class="sub-panel hidden"><h4>选择打工方式</h4><div class="subject-buttons" id="work-options"><button onclick="doWork('easy')">发传单</button><button onclick="doWork('hard')">工地搬砖</button><button onclick="doWork('tutor')">家教</button></div><button onclick="hidePanels()">取消</button></div>
<div id="loan-panel" class="sub-panel hidden"><h4>贷款/还款 (日息1%)</h4><p>当前贷款: <span id="current-loan">0</span>元</p><div><button onclick="takeLoan(1000)">借1000</button><button onclick="takeLoan(5000)">借5000</button><button onclick="takeLoan(10000)">借10000</button></div><div><input type="number" id="repay-amount" placeholder="还款金额" style="width:100px;"><button onclick="repayLoan()">还款</button></div><button onclick="hidePanels()">关闭</button></div>
<div id="teacher-panel" class="sub-panel hidden" style="border:2px solid var(--danger);"><h4>👨🏫 班主任提问</h4><p id="teacher-question"></p><div><button onclick="handleTeacher('try')">尝试回答</button><button onclick="handleTeacher('punish')">站着罚站</button></div></div>
<div id="loveletter-panel" class="sub-panel hidden" style="border:2px solid var(--love);"><h4>💌 发现情书</h4><p id="loveletter-desc"></p><div><button onclick="handleLoveLetter('find')">花钱寻找</button><button onclick="handleLoveLetter('throw')">扔掉</button></div></div>
<div id="phone-panel" class="sub-panel hidden" style="border:2px solid var(--danger);"><h4>📱 手机被没收</h4><p id="phone-desc"></p><button onclick="closePhonePanel()">接受现实</button></div>
<div id="sports-event-panel" class="sub-panel hidden" style="border:2px solid var(--success);"><h4>⛹️ 体育课时间</h4><p id="sports-desc"></p><div><button onclick="handleSports('review')">复习文化课</button><button onclick="handleSports('safe')">稳妥打球</button><button onclick="handleSports('showoff')">秀操作</button></div></div>
<div id="confession-panel" class="sub-panel hidden" style="border:2px solid var(--love);"><h4>💕 有人向你表白</h4><p id="confession-desc"></p><div><button onclick="handleConfession('accept')">接受</button><button onclick="handleConfession('ask')">先问问</button><button onclick="handleConfession('reject')">拒绝</button></div></div>
<div id="parent-panel" class="sub-panel hidden" style="border:2px solid var(--primary);"><h4>👨👩👧 父母来电</h4><p id="parent-desc"></p><div><button onclick="closeParentPanel()">知道了</button></div></div>
<div id="caught-panel" class="sub-panel hidden" style="border:2px solid var(--danger);"><h4>💔 脚踏两条船被发现了</h4><p id="caught-desc"></p><button onclick="closeCaughtPanel()">面对现实</button></div>
<div id="suicide-panel" class="sub-panel hidden" style="border:2px solid black; background:#2c3e50; color:white;"><h4>😱 悲剧发生</h4><p id="suicide-desc"></p><button onclick="closeSuicidePanel()">……</button></div>
<div id="stock-panel" class="sub-panel hidden"><h4>📈 股票交易</h4><div id="stock-list"></div><button onclick="hidePanels()">关闭</button></div>
<div id="image-panel" class="sub-panel hidden"><h4>💄 提升形象 (花钱提升好感)</h4><div class="image-buttons" id="image-girls"></div><button onclick="hidePanels()">取消</button></div>
<div id="sick-gaokao-panel" class="sub-panel hidden" style="border:2px solid var(--danger); background:#fff0f0;"><h4>🏥 高考前病倒</h4><p id="sick-gaokao-desc"></p><div style="display:flex; gap:10px; justify-content:center;"><button onclick="handleSickGaokao('retry')" class="btn-accent">复读</button><button onclick="handleSickGaokao('quit')" class="btn-danger">步入社会</button></div></div>
<div class="event-log" id="log-area"><div class="log-entry">✨ 重生回到高考前,这一次要逆天改命!</div></div>
</div>
<div class="social-panel" id="social-panel"></div>
</div>
<div id="exam-modal" class="overlay hidden"><div class="modal-box"><h2 class="modal-title" id="exam-title">月考</h2><div id="exam-content"></div><button onclick="closeExam()">继续</button></div></div>
<div id="gaokao-modal" class="overlay hidden"><div class="modal-box"><h1 class="modal-title">🎓 高考结束</h1><div id="gaokao-content"></div><div id="marriage-content"></div><button onclick="restartGame()">再玩一次</button></div></div>
<div id="marriage-choice-modal" class="overlay hidden"><div class="modal-box"><h2 class="modal-title">💍 选择共度一生的人</h2><div id="marriage-options"></div><button onclick="selectMarriage('none')">独自生活</button></div></div>
<div id="event-modal" class="overlay hidden"><div class="modal-box"><h2 id="event-title"></h2><p id="event-desc"></p><button onclick="closeEventModal()">确定</button></div></div>
<script>
// ========== 配置 ==========
const SUBJECTS = [
{ id: 'chi', name: '语文', exp: 0, level: 'E', threshold: [0,20,50,100,180,260,300,330] },
{ id: 'mat', name: '数学', exp: 0, level: 'E' }, { id: 'eng', name: '英语', exp: 0, level: 'E' },
{ id: 'phy', name: '物理', exp: 0, level: 'E' }, { id: 'che', name: '化学', exp: 0, level: 'E' }, { id: 'bio', name: '生物', exp: 0, level: 'E' }
];
const LEVELS = ['E','D','C','B','A','S','SS','SSS'];
const LEVEL_THRESHOLD = [0,20,50,100,180,260,300,330];
const TRAIN_PRICE = { 'E':50, 'D':80, 'C':120, 'B':180, 'A':250, 'S':350, 'SS':500, 'SSS':700 };
let stockExp = 0;
let stockLevel = 'E';
function getStockLevel(exp) { for(let i=LEVELS.length-1;i>=0;i--) if(exp>=LEVEL_THRESHOLD[i]) return LEVELS[i]; return 'E'; }
function addStockExp(amt) { stockExp = Math.min(330, stockExp + amt); stockLevel = getStockLevel(stockExp); document.getElementById('stock-level').innerText = stockLevel; document.getElementById('stock-level').style.background = `var(--level-${stockLevel.toLowerCase()})`; document.getElementById('stock-exp').innerText = `${stockExp}/${LEVEL_THRESHOLD[LEVELS.indexOf(stockLevel)+1]||'MAX'}`; }
// 炒股等级对应的上涨概率和幅度修正
const STOCK_UP_PROB = { 'E':0.05, 'D':0.10, 'C':0.20, 'B':0.28, 'A':0.40, 'S':0.45, 'SS':0.52, 'SSS':0.60 };
const STOCK_GAIN_MULTIPLIER = { 'E':0.5, 'D':0.6, 'C':0.7, 'B':0.8, 'A':0.9, 'S':1.0, 'SS':1.2, 'SSS':1.5 };
const STOCK_LOSS_MULTIPLIER = { 'E':1.5, 'D':1.4, 'C':1.3, 'B':1.2, 'A':1.1, 'S':1.0, 'SS':0.9, 'SSS':0.8 };
// 股票列表(3只,初始价格80~120随机)
const STOCKS = [
{ name: '中华联通', price: 80 + Math.floor(Math.random() * 41) },
{ name: '中华移动', price: 80 + Math.floor(Math.random() * 41) },
{ name: '中华电信', price: 80 + Math.floor(Math.random() * 41) }
];
let State = {
daysLeft: 200, weekday: 0, money: 0, determination: 50, stress: 20, charm: 60, loan: 0, facility: 0,
subjects: JSON.parse(JSON.stringify(SUBJECTS)), loves: [], isGraduated: false, difficulty: 'hard',
teacherEventToday: false, examCountdown: 30, gender: 'male', loveLetterAttempts: 0,
stocks: JSON.parse(JSON.stringify(STOCKS))
};
// 确保有足够的钱支付amount,不足则自动贷款,并扣除amount
function ensureMoney(amount) {
if (State.money >= amount) {
State.money -= amount;
return true;
}
let need = amount - State.money;
State.loan += need;
State.money = 0;
log(`⚠️ 零花钱不足,自动贷款 ${need} 元支付`, `负债+${need}`);
return true;
}
function getSubjectLevel(exp) { for(let i=LEVELS.length-1;i>=0;i--) if(exp>=LEVEL_THRESHOLD[i]) return LEVELS[i]; return 'E'; }
function getLevelIndex(l) { return LEVELS.indexOf(l); }
function getLevelColor(l) { return `var(--level-${l.toLowerCase()})`; }
function addSubjectExp(id, amt) {
let s=State.subjects.find(x=>x.id===id); if(!s) return;
let isMale = State.gender === 'male';
let modifier = 1;
if (isMale) {
if (id === 'chi' || id === 'eng') modifier = 0.9;
else if (id === 'mat' || id === 'phy' || id === 'che' || id === 'bio') modifier = 1.1;
} else {
if (id === 'chi' || id === 'eng') modifier = 1.1;
else if (id === 'mat' || id === 'phy' || id === 'che' || id === 'bio') modifier = 0.9;
}
let finalAmt = Math.floor(amt * modifier);
if (finalAmt < 0) finalAmt = 0;
s.exp = Math.min(330, s.exp + finalAmt);
let nl=getSubjectLevel(s.exp);
if(nl!==s.level){ s.level=nl; log(`🎉 ${s.name} 升到 ${nl} 级!`); }
}
function getLove(id) { return State.loves.find(l=>l.id===id); }
function addTrueFeel(loveId, deltaBase) { let l=getLove(loveId); if(!l) return; let delta = deltaBase + Math.floor(Math.random()*21)-10; delta = Math.floor(delta*(0.8+Math.random()*0.7)); delta = Math.max(-20,Math.min(25,delta)); l.trueFeel = Math.min(100,Math.max(0,l.trueFeel+delta)); updateDisplayFeel(l); return delta; }
function updateDisplayFeel(l) { let offset=Math.floor(Math.random()*21)-10; l.feel=Math.min(100,Math.max(0,l.trueFeel+offset)); }
function log(msg,eff='') { let area=document.getElementById('log-area'); area.innerHTML=`<div class="log-entry"><span style="color:#b0d0ff;">[倒计时 ${State.daysLeft}天 ${getWeekdayName(State.weekday)}]</span> ${msg} ${eff?`<span class="log-eff">${eff}</span>`:''}</div>`+area.innerHTML; }
function getWeekdayName(w) { return ['周一','周二','周三','周四','周五','周六','周日'][w]; }
function isWeekend() { return State.weekday===5||State.weekday===6; }
function getAvgLevel() { let t=0; State.subjects.forEach(s=>t+=getLevelIndex(s.level)); return t/6; }
function updateGrade() { let days=State.daysLeft; let grade=days>365?'高二':'高三冲刺'; document.getElementById('grade-display').innerHTML=`当前年级: ${grade}`; }
// 更新股票价格(根据炒股等级调整概率,波动幅度加大)
function updateStocks() {
for (let i=0; i<State.stocks.length; i++) {
let stock = State.stocks[i];
let hold = State[`stock_${i}`] || 0;
let isHold = hold > 0;
let upProb = 0.5; // 默认随机
let gainMult = 1.0;
let lossMult = 1.0;
if (isHold) {
let level = stockLevel;
upProb = STOCK_UP_PROB[level];
gainMult = STOCK_GAIN_MULTIPLIER[level];
lossMult = STOCK_LOSS_MULTIPLIER[level];
}
let change = (Math.random() < upProb) ? 1 : -1;
let baseRange = 0.10; // 基础波动提升到10%
let range = baseRange;
if (change > 0) range *= gainMult;
else range *= lossMult;
let changePercent = (Math.random() * range) * change;
let newPrice = stock.price * (1 + changePercent);
newPrice = Math.max(10, Math.min(500, newPrice));
stock.price = Math.floor(newPrice);
}
}
function showStockPanel() {
hidePanels();
let html = '<table class="stock-table"><thead><tr><th>股票</th><th>现价</th><th>持有</th><th>买入</th><th>卖出</th></tr></thead><tbody>';
State.stocks.forEach((stock, idx) => {
let hold = State[`stock_${idx}`] || 0;
html += `<tr>
<td>${stock.name}</td>
<td>${stock.price}</td>
<td>${hold}</td>
<td><input type="number" id="buy_${idx}" class="stock-input" min="1" value="1"> <button onclick="buyStock(${idx})">买入</button></td>
<td><input type="number" id="sell_${idx}" class="stock-input" min="1" value="1"> <button onclick="sellStock(${idx})">卖出</button></td>
</tr>`;
});
html += '</tbody></table><button onclick="hidePanels()">关闭</button>';
document.getElementById('stock-list').innerHTML = html;
document.getElementById('stock-panel').classList.remove('hidden');
}
function buyStock(idx) {
let amount = parseInt(document.getElementById(`buy_${idx}`).value);
if(isNaN(amount)||amount<=0) return;
let cost = State.stocks[idx].price * amount;
ensureMoney(cost);
State[`stock_${idx}`] = (State[`stock_${idx}`] || 0) + amount;
log(`买入 ${State.stocks[idx].name} ${amount}股,花费 ${cost}💰`);
hidePanels();
updateUI();
}
function sellStock(idx) {
let amount = parseInt(document.getElementById(`sell_${idx}`).value);
if(isNaN(amount)||amount<=0) return;
let hold = State[`stock_${idx}`] || 0;
if(amount > hold) { alert('持有数量不足'); return; }
let income = State.stocks[idx].price * amount;
State.money += income;
State[`stock_${idx}`] = hold - amount;
log(`卖出 ${State.stocks[idx].name} ${amount}股,收入 ${income}💰`);
hidePanels();
updateUI();
}
// 学习炒股
function studyStock() {
let levelIndex = LEVELS.indexOf(stockLevel);
let cost = 30 + levelIndex * 15;
let stressInc = 5 + levelIndex * 2;
ensureMoney(cost);
State.stress = Math.min(100, State.stress + stressInc);
let gain = 5 + Math.floor(Math.random() * 5);
addStockExp(gain);
log(`学习炒股 (花费${cost}💰, 压力+${stressInc})`, `炒股经验+${gain}`);
hidePanels();
advanceDay();
}
// 提升形象(花钱随机提升好感,无具体数值提示)
function showImagePanel() {
hidePanels();
let html = '';
State.loves.forEach(l => {
html += `<button onclick="doImproveImage('${l.id}')">${l.name}</button>`;
});
document.getElementById('image-girls').innerHTML = html;
document.getElementById('image-panel').classList.remove('hidden');
}
function doImproveImage(loveId) {
let love = getLove(loveId);
if (!love) return;
let cost = 0, gain = 0;
if (State.difficulty === 'easy') {
cost = 100 + Math.floor(Math.random() * 101);
gain = Math.floor(Math.random() * 10);
} else {
cost = 150 + Math.floor(Math.random() * 101);
gain = Math.floor(Math.random() * 5);
}
ensureMoney(cost);
if (gain > 0) {
addTrueFeel(loveId, gain);
const msgs = [
`你为${love.name}精心准备了礼物,对方似乎很开心。`,
`你请${love.name}吃饭,聊得很投机。`,
`你帮${love.name}解决了一个难题,对方对你刮目相看。`,
`你和${love.name}一起看了场电影,气氛很好。`,
`你送了一束花给${love.name},对方微笑着收下了。`,
`你陪${love.name}逛街,度过了愉快的时光。`
];
let msg = msgs[Math.floor(Math.random() * msgs.length)];
log(msg);
} else {
const failMsgs = [
`你为${love.name}准备了礼物,但对方似乎不太喜欢。`,
`你请${love.name}吃饭,但对方心不在焉。`,
`你试图讨好${love.name},但效果不佳。`,
`你花了钱却弄巧成拙,${love.name}反而有点不高兴。`
];
let msg = failMsgs[Math.floor(Math.random() * failMsgs.length)];
log(msg);
}
hidePanels();
updateUI();
advanceDay();
}
// 约会:恋爱中必成功
function doDate(loveId) {
let cost = Math.floor(Math.random()*61)+20;
ensureMoney(cost);
let love = getLove(loveId);
if(love.dating) {
let delta = addTrueFeel(loveId, 8);
State.stress = Math.max(0,State.stress-8);
State.charm = Math.min(100,State.charm+1);
let msg = `和${love.name}约会 (花费${cost}💰)`;
if(delta>0) msg+=',对方非常开心';
else msg+=',气氛有点微妙';
log(msg, `压力-8,魅力+1`);
hidePanels(); advanceDay();
} else {
let prob = love.trueFeel/100;
if(Math.random()<prob){
let delta = addTrueFeel(loveId,8);
State.stress = Math.max(0,State.stress-8);
State.charm = Math.min(100,State.charm+1);
let msg = `和${love.name}约会 (花费${cost}💰)`;
if(delta>0) msg+=',对方非常开心';
else msg+=',气氛有点微妙';
log(msg, `压力-8,魅力+1`);
} else {
addTrueFeel(loveId,-3);
log(`${love.name}拒绝了你 (花费${cost}💰打水漂)`,'真实好感下降');
}
hidePanels(); advanceDay();
}
}
// 情书事件
let loveLetterAttempts = 0;
function triggerLoveLetterEvent() {
let available = State.loves.filter(l => !l.dating);
if(available.length === 0) return;
loveLetterAttempts = 0;
updateLoveLetterPanel();
document.getElementById('loveletter-panel').classList.remove('hidden');
}
function updateLoveLetterPanel() {
let cost = 50 + loveLetterAttempts * 50;
let successProb = Math.max(0.1, 0.6 - loveLetterAttempts * 0.1);
let deterLoss = 2 + loveLetterAttempts * 2;
document.getElementById('loveletter-desc').innerHTML = `你在书桌里发现一封匿名情书……(第${loveLetterAttempts+1}次尝试,成本${cost}💰,成功率${Math.floor(successProb*100)}%,失败决心-${deterLoss})`;
}
function handleLoveLetter(choice) {
if (choice === 'find') {
let cost = 50 + loveLetterAttempts * 50;
ensureMoney(cost);
let successProb = Math.max(0.1, 0.6 - loveLetterAttempts * 0.1);
if (Math.random() < successProb) {
let available = State.loves.filter(l => !l.dating);
if(available.length === 0) { log(`你花${cost}元寻找,但所有人都已有对象,没找到送信人`); loveLetterAttempts++; updateLoveLetterPanel(); return; }
let love = available[Math.floor(Math.random() * available.length)];
addTrueFeel(love.id, 12);
log(`你花${cost}元找到了送情书的人:${love.name},对方害羞地跑开了`, `好感上升`);
hidePanels(); updateUI(); advanceDay();
} else {
let deterLoss = 2 + loveLetterAttempts * 2;
State.determination = Math.max(0, State.determination - deterLoss);
log(`你花${cost}元寻找,没找到送信人,决心-${deterLoss}`, `💰-${cost}`);
loveLetterAttempts++;
updateLoveLetterPanel();
return;
}
} else {
State.determination = Math.max(0, State.determination - 5);
log('你扔掉了情书', '决心-5');
hidePanels(); updateUI(); advanceDay();
}
}
// 高考前生病抉择
function checkSickBeforeGaokao() {
if (State.daysLeft <= 1 && State.stress >= 90) {
document.getElementById('sick-gaokao-desc').innerHTML = `高考前你因压力过大病倒了,无法参加考试……`;
document.getElementById('sick-gaokao-panel').classList.remove('hidden');
return true;
}
return false;
}
function handleSickGaokao(choice) {
document.getElementById('sick-gaokao-panel').classList.add('hidden');
if (choice === 'retry') {
let days = parseInt(document.getElementById('start-days').value);
if(isNaN(days)||days<1) days=200;
State.daysLeft = days;
State.weekday = 0;
State.money = 0;
State.determination = 50;
State.stress = 20;
State.charm = 60;
State.loan = 0;
if(State.difficulty==='hard') State.loan = 500;
State.facility = 0;
State.examCountdown = 30;
State.subjects = JSON.parse(JSON.stringify(SUBJECTS));
if(State.difficulty==='easy') State.subjects.forEach(s=>s.exp=20);
else State.subjects.forEach(s=>s.exp=0);
State.subjects.forEach(s=>s.level=getSubjectLevel(s.exp));
stockExp = 0; stockLevel = 'E';
initLoves();
State.isGraduated = false;
State.teacherEventToday = false;
updateGrade();
for(let i=0;i<State.stocks.length;i++) State[`stock_${i}`] = 0;
updateUI();
log('你选择了复读,重新出发!', '📖 新开始');
} else {
State.isGraduated = true;
let avg = getAvgLevel();
let scoreText = '你错过了高考,只能步入社会。';
if(State.loan>0) scoreText += ' 负债累累,生活艰辛。';
document.getElementById('gaokao-content').innerHTML = `<p>${scoreText}</p><p>负债: ${State.loan}元</p>`;
document.getElementById('marriage-content').innerHTML = '独自面对人生。';
document.getElementById('gaokao-modal').classList.remove('hidden');
}
}
// 打工:模糊提示,不显示具体数值
function doWork(type) {
let reward = 0, stressInc = 0, detChange = 0, charmInc = 0;
if(type==='easy'){ reward=80; stressInc=5; }
else if(type==='hard'){ reward=200; stressInc=15; detChange=-2; }
else if(type==='tutor'){
let baseProb = getAvgLevel() / 7;
if(State.difficulty==='hard') baseProb *= 0.6;
let success = Math.random() < baseProb;
if(success){ reward=120; detChange=2; charmInc=1; }
else {
let fine=80;
ensureMoney(fine);
State.determination=Math.max(0,State.determination-3);
log('家教被投诉退款', `损失了${fine}元,决心下降`);
hidePanels(); advanceDay(); return;
}
}
if(State.difficulty==='hard'){
reward = Math.floor(reward * 0.5);
stressInc = Math.floor(stressInc * 2);
detChange = detChange * 2;
charmInc = Math.floor(charmInc * 0.5);
}
State.money += reward;
State.stress = Math.min(100, State.stress + stressInc);
State.determination = Math.min(100, Math.max(0, State.determination + detChange));
State.charm = Math.min(100, State.charm + charmInc);
let workName = '';
if(type==='easy') workName = '发传单';
else if(type==='hard') workName = '工地搬砖';
else workName = '家教';
const msgs = [
`今天${workName},挣了点辛苦钱。`,
`今天${workName},感觉身体被掏空。`,
`今天${workName},遇到了好心的老板。`,
`今天${workName},累得够呛。`,
`今天${workName},虽然累但收获不错。`,
`今天${workName},感觉腰酸背痛。`,
`今天${workName},赚了些零花钱。`,
`今天${workName},遇到了难缠的顾客,心累。`
];
let msg = msgs[Math.floor(Math.random() * msgs.length)];
log(msg);
hidePanels();
advanceDay();
}
// 以下为其他已有函数(保持完整)
function showStudyPanel() { if(isWeekend()){ alert('周末学校不上课'); return; } hidePanels(); doStudy(); }
function showTrainPanel() { hidePanels(); let html=''; State.subjects.forEach(s=>{ let price = TRAIN_PRICE[s.level] || 50; html+=`<button onclick="doTrain('${s.id}')">${s.name} (${price}💰)</button>`; }); document.getElementById('train-subjects').innerHTML=html; document.getElementById('train-panel').classList.remove('hidden'); }
function showDatePanel() { hidePanels(); let html=''; State.loves.forEach(l=>html+=`<button onclick="doDate('${l.id}')">${l.name} (你认为的好感${Math.round(l.feel)})</button>`); document.getElementById('date-love').innerHTML=html; document.getElementById('date-panel').classList.remove('hidden'); }
function showWorkPanel() { hidePanels(); document.getElementById('work-panel').classList.remove('hidden'); }
function showLoanPanel() { hidePanels(); document.getElementById('current-loan').innerText=State.loan; document.getElementById('loan-panel').classList.remove('hidden'); }
function doTrain(subId) {
let sub=State.subjects.find(s=>s.id===subId);
let price=TRAIN_PRICE[sub.level]||50;
ensureMoney(price);
let gainBase=12+Math.floor(State.determination/20)+State.facility*2;
if(State.difficulty==='hard') gainBase=Math.floor(gainBase*0.8);
addSubjectExp(subId,gainBase);
State.stress=Math.min(100,State.stress+5);
log(`魔鬼特训班 (${sub.name}) 花费 ${price}💰`,`经验+${gainBase},压力+5`);
hidePanels(); advanceDay();
}
function doRest() { State.stress=Math.max(0,State.stress-12); log('好好休息','压力-12'); hidePanels(); advanceDay(); }
function doSlack() { if(isWeekend()){ alert('周末不能摸鱼'); return; } let sub=State.subjects[Math.floor(Math.random()*State.subjects.length)]; let gain=2+Math.floor(Math.random()*3); addSubjectExp(sub.id,gain); State.stress=Math.max(0,State.stress-2); log(`上课摸鱼,看了会${sub.name}杂书`,`经验+${gain},压力-2`); if(Math.random()<0.3){ triggerPhoneConfiscation(); return; } hidePanels(); advanceDay(); }
function triggerPhoneConfiscation() { let fine=100; ensureMoney(fine); State.determination=Math.max(0,State.determination-5); log('手机被没收','罚款100,决心-5'); hidePanels(); advanceDay(); }
function closePhonePanel() { document.getElementById('phone-panel').classList.add('hidden'); if(window._phoneCallback){ window._phoneCallback(); window._phoneCallback=null; } }
function triggerSportsEvent() { document.getElementById('sports-desc').innerText='体育课到了,你打算……'; document.getElementById('sports-event-panel').classList.remove('hidden'); }
function handleSports(choice) { let reviewGain=5, safeCharm=1, safeStress=-3; if(State.difficulty==='hard'){ reviewGain=3; safeCharm=0; safeStress=-2; } if(choice==='review'){ let sub=State.subjects[Math.floor(Math.random()*State.subjects.length)]; addSubjectExp(sub.id,reviewGain); log('体育课偷偷复习',`${sub.name}经验+${reviewGain}`); } else if(choice==='safe'){ State.charm=Math.min(100,State.charm+safeCharm); State.stress=Math.max(0,State.stress+safeStress); log('稳妥打球',`魅力+${safeCharm},压力${safeStress}`); } else if(choice==='showoff'){ let r=Math.random(); if(r<0.3){ State.charm=Math.max(0,State.charm-5); State.stress=Math.min(100,State.stress+15); State.determination=Math.max(0,State.determination-3); log('秀操作失败','魅力-5,压力+15,决心-3'); } else if(r<0.8){ State.charm=Math.min(100,State.charm+5); State.stress=Math.max(0,State.stress-8); State.determination=Math.min(100,State.determination+3); log('秀操作成功','魅力+5,压力-8,决心+3'); } else{ State.charm=Math.min(100,State.charm+10); State.stress=Math.max(0,State.stress-15); State.determination=Math.min(100,State.determination+5); log('惊天大灌篮','魅力+10,压力-15,决心+5'); } } hidePanels(); advanceDay(); }
function triggerConfession() { let candidates=State.loves.filter(l=>!l.dating&&!l.ex); if(candidates.length===0) return false; let love=candidates[Math.floor(Math.random()*candidates.length)]; window._confessionLove=love; document.getElementById('confession-desc').innerText=`${love.name}红着脸对你说:我……我喜欢你很久了!你怎么办?`; document.getElementById('confession-panel').classList.remove('hidden'); return true; }
function handleConfession(choice) { let love=window._confessionLove; if(choice==='accept'){ let cur=State.loves.filter(l=>l.dating); if(cur.length>0 && Math.random()<0.5){ triggerCaught(cur[0],love); return; } love.dating=true; addTrueFeel(love.id,15); log(`你接受了${love.name}的表白,对方非常开心`); } else if(choice==='ask'){ let ans=prompt(`${love.name}:你愿意和我在一起吗?(输入任意字符表示愿意,取消表示犹豫)`); if(ans!==null){ let cur=State.loves.filter(l=>l.dating); if(cur.length>0 && Math.random()<0.5){ triggerCaught(cur[0],love); return; } love.dating=true; addTrueFeel(love.id,12); log(`你思考后接受了${love.name}的表白`); } else { addTrueFeel(love.id,-5); log(`你犹豫了,${love.name}有些失落`); } } else { addTrueFeel(love.id,-10); log(`你拒绝了${love.name}的表白`); } hidePanels(); updateUI(); advanceDay(); }
function triggerCaught(oldLove,newLove) { let desc=`${oldLove.name}发现你和${newLove.name}在一起,大吵一架!`; document.getElementById('caught-desc').innerText=desc; document.getElementById('caught-panel').classList.remove('hidden'); addTrueFeel(oldLove.id,-30); addTrueFeel(newLove.id,-30); oldLove.dating=false; newLove.dating=false; State.determination=Math.max(0,State.determination-15); State.stress=Math.min(100,State.stress+30); log(desc,'关系破裂'); if(Math.random()<0.01) triggerSuicide(oldLove); }
function closeCaughtPanel() { document.getElementById('caught-panel').classList.add('hidden'); updateUI(); advanceDay(); }
function triggerSuicide(love) { State.determination=0; State.stress=100; State.money=0; document.getElementById('suicide-desc').innerText=`${love.name}因分手想不开跳楼了!你陷入深深的自责……`; document.getElementById('suicide-panel').classList.remove('hidden'); }
function closeSuicidePanel() { location.reload(); }
function takeLoan(amt) { State.money+=amt; State.loan+=amt; log(`贷款 ${amt}元`,`负债+${amt}`); hidePanels(); updateUI(); }
function repayLoan() { let amt=parseInt(document.getElementById('repay-amount').value); if(isNaN(amt)||amt<=0) return; if(State.money<amt) return alert('零花钱不足'); if(amt>State.loan) amt=State.loan; State.money-=amt; State.loan-=amt; log(`还款 ${amt}元`,`负债-${amt}`); hidePanels(); updateUI(); }
function askForMoney(loveId) { let love=getLove(loveId); if(!love.isRich) return; if(love.trueFeel<60){ alert('对方还不是你的恋人,不能要钱'); return; } if(love.askCount>=love.maxAsk){ alert('你们已经再无交集'); return; } let amt=200+Math.floor(Math.random()*200); State.money+=amt; addTrueFeel(loveId,-10); love.askCount++; log(`从${love.name}拿到 ${amt}元零花钱`,'对方有些不悦'); if(love.askCount>=love.maxAsk) log(`💔 你和${love.name}再无交集`,'缘尽'); updateUI(); }
function breakup(loveId) { let love=getLove(loveId); if(!love.dating) return; love.dating=false; love.ex=true; addTrueFeel(loveId,-20); log(`你和${love.name}分手了`,'对方看起来很伤心'); if(Math.random()<0.005) triggerSuicide(love); updateUI(); }
function doStudy() { if(isWeekend()){ alert('周末学校不上课'); return; } let gains={}; State.subjects.forEach(s=>{ let gain=4+Math.floor(State.determination/30)+State.facility; if(State.difficulty==='hard') gain=Math.floor(gain*0.7); addSubjectExp(s.id,gain); gains[s.name]=gain; }); State.stress=Math.min(100,State.stress+3); log('认真听课',`各科经验+${Math.min(...Object.values(gains))}~${Math.max(...Object.values(gains))},压力+3`); hidePanels(); advanceDay(); }
function triggerParentEvent() { let hasDating = State.loves.some(l => l.dating); if (hasDating) { let love = State.loves.find(l => l.dating); if (Math.random() < 0.4) { love.dating = false; love.ex = true; addTrueFeel(love.id, -30); log(`父母强烈反对你和${love.name}交往,你们被迫分手`, '💔'); document.getElementById('parent-desc').innerHTML = `父母在电话里严厉地说:“不许再和${love.name}来往!否则打断你的腿!”你无奈分手。`; } else { log(`父母打来电话,劝你以学业为重,不要早恋`, '压力+5'); State.stress = Math.min(100, State.stress + 5); document.getElementById('parent-desc').innerHTML = `父母语重心长:“高考前专心学习,感情的事以后再说。”你压力增加了。`; } } else { log(`父母催你找对象:“隔壁老王儿子都带女朋友回家了,你怎么还没动静?”`, '压力+8'); State.stress = Math.min(100, State.stress + 8); document.getElementById('parent-desc').innerHTML = `父母在电话里唠叨:“你也该找个人了,别光顾着学习!”你压力上升。`; } document.getElementById('parent-panel').classList.remove('hidden'); }
function closeParentPanel() { document.getElementById('parent-panel').classList.add('hidden'); advanceDay(); }
function showExam() { let avg=getAvgLevel(); let rank,reward=0; if(avg>=6){ rank='年级前10'; reward=800; } else if(avg>=5){ rank='年级前100'; reward=400; } else if(avg>=4){ rank='年级中游'; reward=200; } else{ rank='年级下游'; reward=50; } if(State.difficulty==='hard') reward=Math.floor(reward*0.5); State.money+=reward; log(`月考奖励 ${reward}元`); document.getElementById('exam-title').innerText='月考'; document.getElementById('exam-content').innerHTML=`<p>平均等级: ${LEVELS[Math.floor(avg)]} (${avg.toFixed(2)})</p><p>预估排名: ${rank}</p><p>奖励: ${reward}元</p>`; document.getElementById('exam-modal').classList.remove('hidden'); }
function closeExam() { document.getElementById('exam-modal').classList.add('hidden'); advanceDay(); }
function showGaokao() { State.isGraduated=true; let avg=getAvgLevel(); let scoreText=''; if(avg>=6) scoreText='985名校!'; else if(avg>=5) scoreText='211大学'; else if(avg>=4) scoreText='一本院校'; else if(avg>=3) scoreText='二本学院'; else scoreText='专科/复读'; if(State.loan>0){ if(State.loan>5000) scoreText+=' 但因巨额贷款无法偿还,你被追债人打断腿,人生一片灰暗。'; else scoreText+=' 虽然欠了些钱,但通过打工慢慢还清了。'; } let candidates=State.loves.filter(l=>(l.trueFeel>=70&&l.dating)||l.trueFeel>=80); if(candidates.length>0){ let opts=''; candidates.forEach(l=>opts+=`<div class="marriage-option"><span>${l.name} (你认为的好感${Math.round(l.feel)})</span><button onclick="selectMarriage('${l.id}')">选择</button></div>`); document.getElementById('marriage-options').innerHTML=opts; document.getElementById('marriage-choice-modal').classList.remove('hidden'); } else { showFinalEnding(scoreText,'毕业后你独自一人,开始了新生活。'); } }
function selectMarriage(lid) { document.getElementById('marriage-choice-modal').classList.add('hidden'); let text=lid==='none'?'毕业后你独自一人,开始了新生活。':`💍 你和 ${getLove(lid).name} 终成眷属,步入了婚姻殿堂!`; showFinalEnding(document.getElementById('gaokao-content').innerText,text); }
function showFinalEnding(scoreText,marriageText) { document.getElementById('gaokao-content').innerHTML=`<p>你的高考成绩: ${scoreText}</p><p>负债: ${State.loan}元</p>`; document.getElementById('marriage-content').innerText=marriageText; document.getElementById('gaokao-modal').classList.remove('hidden'); }
function restartGame() { location.reload(); }
function updateUI() {
document.getElementById('ui-days-left').innerText=State.daysLeft;
document.getElementById('ui-weekday').innerText=getWeekdayName(State.weekday);
document.getElementById('ui-money').innerText=State.money;
document.getElementById('ui-determination').innerText=State.determination;
document.getElementById('ui-stress').innerText=State.stress;
document.getElementById('current-days').innerText=State.daysLeft;
document.getElementById('current-weekday').innerText=getWeekdayName(State.weekday);
document.getElementById('stat-charm').innerText=State.charm;
document.getElementById('stat-determination').innerText=State.determination;
document.getElementById('stat-stress').innerText=State.stress;
document.getElementById('stat-money').innerText=State.money;
document.getElementById('stat-loan').innerText=State.loan;
document.getElementById('fac-level').innerText=State.facility;
document.getElementById('fac-bonus').innerText=State.facility*5;
let subHtml='';
State.subjects.forEach(s=>{ subHtml+=`<div class="subject-card"><div class="subject-label">${s.name}</div><div class="subject-score" style="background:${getLevelColor(s.level)};">${s.level}</div><div class="subject-exp">${s.exp}/${LEVEL_THRESHOLD[LEVELS.indexOf(s.level)+1]||'MAX'}</div></div>`; });
document.getElementById('subject-scores').innerHTML=subHtml;
let lovesHtml='';
State.loves.forEach(l=>{
let cardClass=l.type==='crush'?'crush-card':(l.isRich?'rich-card':'normal-card');
let heartWidth=(l.feel/100)*100;
lovesHtml+=`<div class="love-card ${cardClass}"><div class="love-name">${l.name}${l.isRich?' 💎':''}</div>${l.dating?'<span class="dating-tag">恋爱中</span>':''}<div class="love-feel">你认为的好感: ${Math.round(l.feel)}</div><div class="heart-bar"><div class="heart-fill" style="width:${heartWidth}%;"></div></div><div class="button-group">`;
if(l.isRich && l.trueFeel>=60 && !l.dating && l.askCount<l.maxAsk) lovesHtml+=`<button class="btn-rich" onclick="askForMoney('${l.id}')">💰 要零花钱</button>`;
if(l.dating) lovesHtml+=`<button class="btn-danger" onclick="breakup('${l.id}')">💔 分手</button>`;
if(!l.dating && !l.ex) lovesHtml+=`<button class="btn-love" onclick="showConfessionTo('${l.id}')">💕 表白</button>`;
lovesHtml+=`</div></div>`;
});
document.getElementById('social-panel').innerHTML=lovesHtml;
updateActionButtons();
}
function updateActionButtons() {
let grid=document.getElementById('action-buttons');
let isWeekendDay=isWeekend();
grid.innerHTML='';
let actions=[
{ icon:'📖', title:'认真听课', cost:'各科+少量 | 压力+2', action:'showStudyPanel', weekendLock:true },
{ icon:'⚡', title:'魔鬼特训', cost:'价格随等级提升', action:'showTrainPanel', weekendLock:false },
{ icon:'💖', title:'约会', cost:'随机20~80💰 | 好感↑ | 压力-3', action:'showDatePanel', weekendLock:false },
{ icon:'🔨', title:'打工', cost:'赚钱 | 可能增减属性', action:'showWorkPanel', weekendLock:false },
{ icon:'😴', title:'休息', cost:'压力-12', action:'doRest', weekendLock:false },
{ icon:'🐟', title:'上课摸鱼', cost:'单科小经验 | 压力-2 | 可能没收手机', action:'doSlack', weekendLock:true },
{ icon:'📈', title:'炒股', cost:'买卖股票 | 需炒股能力', action:'showStockPanel', weekendLock:false },
{ icon:'📊', title:'学习炒股', cost:'花费随等级提升', action:'studyStock', weekendLock:false },
{ icon:'💄', title:'提升形象', cost:'花钱提升好感', action:'showImagePanel', weekendLock:false }
];
actions.forEach(a=>{
let card=document.createElement('div');
let isLocked=isWeekendDay && (a.weekendLock===true);
card.className=`action-card ${isLocked?'weekend-locked':''}`;
if(typeof a.action==='string'){
card.setAttribute('onclick',isLocked?'':`${a.action}()`);
} else {
card.setAttribute('onclick',isLocked?'':`(${a.action.toString()})()`);
}
card.innerHTML=`<div class="action-icon">${a.icon}</div><div class="action-title">${a.title}</div><div class="action-cost">${a.cost}</div>`;
grid.appendChild(card);
});
}
function showConfessionTo(loveId) { let love=getLove(loveId); if(!love) return; let cur=State.loves.filter(l=>l.dating); if(cur.length>0 && Math.random()<0.5){ triggerCaught(cur[0],love); } else { let prob=love.trueFeel/100; if(Math.random()<prob){ love.dating=true; addTrueFeel(loveId,15); log(`你向${love.name}表白成功,对方害羞地答应了`); } else { addTrueFeel(loveId,-8); log(`你向${love.name}表白被拒绝,气氛尴尬`); } } hidePanels(); updateUI(); advanceDay(); }
function closeEventModal() { document.getElementById('event-modal').classList.add('hidden'); if(window._simpleEventCallback){ window._simpleEventCallback(); window._simpleEventCallback=null; updateUI(); } }
function advanceDay() {
if(State.isGraduated) return;
if(State.loan>0){ let int=Math.floor(State.loan*0.01); if(int<1) int=1; State.loan+=int; log(`贷款利息 ${int}元`,'💸'); }
State.daysLeft--;
if(State.daysLeft<=0){
if(checkSickBeforeGaokao()) return;
showGaokao();
return;
}
State.weekday=(State.weekday+1)%7;
updateGrade();
updateStocks();
State.examCountdown--;
if(State.examCountdown<=0){ State.examCountdown=30; showExam(); return; }
if(!isWeekend()){
let eventProb=0.15;
if(State.difficulty==='hard') eventProb=0.08;
if(!State.teacherEventToday && Math.random()<eventProb){ triggerTeacherEvent(); return; }
if(Math.random()<eventProb){ triggerLoveLetterEvent(); return; }
if(Math.random()<0.03 && triggerConfession()) return;
if(Math.random()<0.05){ triggerSportsEvent(); return; }
if(Math.random()<0.08){ triggerParentEvent(); return; }
}
State.determination=Math.min(100,Math.max(0,State.determination));
State.stress=Math.min(100,Math.max(0,State.stress));
State.charm=Math.min(100,Math.max(0,State.charm));
State.teacherEventToday=false;
updateUI();
if(State.stress>=100){
alert('⚠️ 压力爆炸,你病倒了一周');
State.stress=40;
for(let i=0;i<7;i++){
if(State.loan>0){ let int=Math.floor(State.loan*0.01); if(int<1) int=1; State.loan+=int; }
State.daysLeft--;
if(State.daysLeft<=0){
if(checkSickBeforeGaokao()) return;
showGaokao();
return;
}
State.weekday=(State.weekday+1)%7;
}
log('病倒一周', '😷 跳过7天,利息已计算');
updateUI();
}
}
function triggerTeacherEvent() { State.teacherEventToday=true; let sub=State.subjects[Math.floor(Math.random()*State.subjects.length)]; document.getElementById('teacher-question').innerHTML=`👩🏫 班主任提问 <strong>${sub.name}</strong> 问题!<br>当前等级: ${sub.level}`; window._currentTeacherSub=sub.id; document.getElementById('teacher-panel').classList.remove('hidden'); }
function handleTeacher(choice) { let subId=window._currentTeacherSub; let sub=State.subjects.find(s=>s.id===subId); let idx=getLevelIndex(sub.level); let prob=0.2+idx*0.08; if(State.difficulty==='hard') prob*=0.8; let rand=Math.random(); if(choice==='try'){ if(rand<prob){ State.determination=Math.min(100,State.determination+8); log(`成功回答${sub.name}问题`,'决心+8'); State.loves.forEach(l=>addTrueFeel(l.id,2)); log('同学们投来羡慕的目光'); } else { State.determination=Math.max(0,State.determination-5); State.stress=Math.min(100,State.stress+15); log(`回答${sub.name}失败,被全班嘲笑`,'决心-5,压力+15'); State.loves.forEach(l=>addTrueFeel(l.id,-5)); log('恋人们似乎有些失望'); } } else { State.determination=Math.max(0,State.determination-2); State.stress=Math.min(100,State.stress+8); log(`罚站一节课`,'决心-2,压力+8'); } hidePanels(); updateUI(); advanceDay(); }
// 性别和命名
function updateGenderText() {
let isMale = document.querySelector('input[name="gender"]:checked').value === 'male';
State.gender = isMale ? 'male' : 'female';
document.getElementById('char-name-title').innerHTML = isMale ? '为女生命名 (校花、富家千金已标注)' : '为男生命名 (校草、富二代已标注)';
let gridHtml = '';
if (isMale) {
gridHtml = `
<div class="name-input-item"><label>🌸 校花</label><input type="text" id="name-crush" placeholder="柳如烟" value="柳如烟"></div>
<div class="name-input-item"><label>💎 千金</label><input type="text" id="name-rich" placeholder="林薇薇" value="林薇薇"></div>
<div class="name-input-item"><label>普通女生</label><input type="text" id="name-normal1" placeholder="陈雨桐" value="陈雨桐"></div>
<div class="name-input-item"><label>普通女生</label><input type="text" id="name-normal2" placeholder="赵灵儿" value="赵灵儿"></div>
`;
} else {
gridHtml = `
<div class="name-input-item"><label>🌸 校草</label><input type="text" id="name-crush" placeholder="林逸飞" value="林逸飞"></div>
<div class="name-input-item"><label>💎 富二代</label><input type="text" id="name-rich" placeholder="王思聪" value="王思聪"></div>
<div class="name-input-item"><label>普通男生</label><input type="text" id="name-normal1" placeholder="张伟" value="张伟"></div>
<div class="name-input-item"><label>普通男生</label><input type="text" id="name-normal2" placeholder="李华" value="李华"></div>
`;
}
document.getElementById('name-input-grid').innerHTML = gridHtml;
}
function initLoves() {
let isMale = State.gender === 'male';
let crushName = document.getElementById('name-crush')?.value.trim() || (isMale ? '柳如烟' : '林逸飞');
let richName = document.getElementById('name-rich')?.value.trim() || (isMale ? '林薇薇' : '王思聪');
let normal1Name = document.getElementById('name-normal1')?.value.trim() || (isMale ? '陈雨桐' : '张伟');
let normal2Name = document.getElementById('name-normal2')?.value.trim() || (isMale ? '赵灵儿' : '李华');
State.loves = [
{ id: 'crush', name: crushName, type: 'crush', isRich: false, trueFeel: Math.random()*5, feel: 0, dating: false, ex: false, askCount:0, maxAsk:0 },
{ id: 'rich', name: richName, type: 'rich', isRich: true, trueFeel: Math.random()*5, feel: 0, dating: false, ex: false, askCount:0, maxAsk: Math.floor(Math.random()*5)+1 },
{ id: 'normal1', name: normal1Name, type: 'normal', isRich: false, trueFeel: Math.random()*5, feel: 0, dating: false, ex: false },
{ id: 'normal2', name: normal2Name, type: 'normal', isRich: false, trueFeel: Math.random()*5, feel: 0, dating: false, ex: false }
];
State.loves.forEach(l => updateDisplayFeel(l));
}
function startGame(diff) {
State.difficulty=diff;
let days=parseInt(document.getElementById('start-days').value);
if(isNaN(days)||days<1) days=200;
State.daysLeft=days;
State.weekday=0;
State.money=0;
State.determination=50;
State.stress=20;
State.charm=60;
State.loan=0;
if(diff==='hard') State.loan = 500;
State.facility=0;
State.examCountdown=30;
State.subjects=JSON.parse(JSON.stringify(SUBJECTS));
if(diff==='easy') State.subjects.forEach(s=>s.exp=20);
else State.subjects.forEach(s=>s.exp=0);
State.subjects.forEach(s=>s.level=getSubjectLevel(s.exp));
stockExp = 0; stockLevel = 'E';
initLoves();
State.isGraduated=false;
State.teacherEventToday=false;
updateGrade();
for(let i=0;i<State.stocks.length;i++) State[`stock_${i}`] = 0;
document.getElementById('start-overlay').classList.add('hidden');
document.getElementById('main-header').classList.remove('hidden');
document.getElementById('main-body').classList.remove('hidden');
updateUI();
log('🔁 重生回到高考前,这次一定要逆天改命!','决心+10');
State.determination+=10;
}
window.addEventListener('DOMContentLoaded', () => { updateGenderText(); document.querySelectorAll('input[name="gender"]').forEach(r=>r.addEventListener('change',updateGenderText)); });
window.startGame=startGame;
window.showStudyPanel=showStudyPanel; window.showTrainPanel=showTrainPanel; window.showDatePanel=showDatePanel; window.showWorkPanel=showWorkPanel; window.showLoanPanel=showLoanPanel; window.showStockPanel=showStockPanel; window.studyStock=studyStock; window.showImagePanel=showImagePanel;
window.doTrain=doTrain; window.doDate=doDate; window.doWork=doWork; window.doRest=doRest; window.doSlack=doSlack; window.hidePanels=function(){ document.querySelectorAll('.sub-panel').forEach(p=>p.classList.add('hidden')); };
window.handleTeacher=handleTeacher; window.handleLoveLetter=handleLoveLetter; window.closeEventModal=closeEventModal; window.askForMoney=askForMoney; window.closeExam=closeExam; window.takeLoan=takeLoan; window.repayLoan=repayLoan; window.closePhonePanel=closePhonePanel; window.handleSports=handleSports; window.showConfessionTo=showConfessionTo; window.breakup=breakup; window.closeCaughtPanel=closeCaughtPanel; window.selectMarriage=selectMarriage; window.handleConfession=handleConfession; window.closeParentPanel=closeParentPanel; window.buyStock=buyStock; window.sellStock=sellStock; window.handleSickGaokao=handleSickGaokao;
</script>
</body>
</html>