把送外卖和打BOSS结合的html游戏。

40 阅读3分钟

我是一枚送外卖html代码零基础的普通人,因为玩过不少游戏。所以我前段时间突发奇想让AI给我写一个简单运行的游戏。AI直接写了代码让我保存为HTML格式用浏览器打开运行。我感觉很牛逼。后面我给ai很多思路,不断让ai给我写游戏,写了很多。全是html游戏。 而且都是送外卖的收入和游戏结合的创新类游戏,市面上目前没有一款如我这般的游戏风格。不信你去市面上搜很多游戏,哪怕是后端可以下载的app游戏,都是让你不断充钱。我这游戏不是充钱,而是存钱,累计存得越多对BOSS累计造成伤害越多。这想法居然被我实现了。资本家看到肯定流泪,哈哈。 这个地方也是我刻意搜到的,里面应该很多大神。我一个小白让各位见笑了。但是我看了下这个写文章里无法上传html文件,太遗憾了。否则我就要让大神们给我指点指点,让我有更多机会向大神们学习。

以下是全部代码不知道能不能全部发表出来。有一点,请教大神,这个游戏总共41个BOSS,我只能上传400KB图片3张(刷新页面或重置游戏也不晓消失)对应前面三个BOSS,第4个BOSS就无法上传了,是啥原因?因为html有限制吗?有啥方法可以解除限制?难道非要去转学app开发吗?app理论上可以存储很多图片资源只要你手机储存空格间够大。但是我从零开始制作app周期太长了,我就是一送外卖的, 希望就用HTML这种方式快速让AI编写制作成快速所见所得的作品出来。

修仙BOSS Rush * { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Microsoft YaHei', sans-serif; } body { background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%); color: #e6e6e6; min-height: 100vh; padding: 20px; } .container { max-width: 1200px; margin: 0 auto; } .header { display: flex; justify-content: space-between; background: rgba(0, 0, 0, 0.5); padding: 15px; border-radius: 10px; margin-bottom: 20px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3); } .stats { display: flex; gap: 30px; } .stat-item { text-align: center; } .stat-label { font-size: 14.2px; color: #aaa; } .stat-value { font-size: 14.7px; font-weight: bold; color: #fff; } .boss-levels { display: flex; overflow-x: auto; gap: 10px; padding: 15px 0; margin-bottom: -20px; } .boss-level-card { width: 100%; background: transparent; border-radius: 0; padding: 10px; box-shadow: none; border: none; margin-top: -26px; /* 新增这行,负值向上移动 */

}

    .boss-level-card.active {
border: none; /* 去掉边框 */
box-shadow: none; /* 去掉阴影 */
background: transparent; /* 透明背景 */

}

    .level-and-name {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0px;
    }
    
    .level-text {
        font-size: 14px;
        font-weight: bold;
        color: #ffcc00;
    }
    
    .boss-name {
        font-size: 14px;
        color: #FFD300;
        cursor: pointer;
        transition: color 0.3s;
    }
    
    .boss-name:hover {
        color: #ffcc00;
        text-decoration: underline;
    }
    
    .health-bar-container {
        height: 20px;
        background: #333;
        border-radius: 10px;
        overflow: hidden;
        margin-bottom: 5px;
    }
    
    .health-bar {
        height: 100%;
        border-radius: 10px;
        transition: width 0.5s, background 0.5s;
    }
    
    .health-numbers {
        text-align: right;
        font-size: 12px;
        color: #aaa;
    }
    
    .boss-image-area {
        width: 100%;
        aspect-ratio: 1 / 1;
        background: rgba(0, 0, 0, 0.3);
        border-radius: 10px;
        margin-bottom: 20px;
        display: flex;
        justify-content: center;
        align-items: center;
        overflow: hidden;
        position: relative;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    }
    
    .boss-image {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
    }
    
    /* 修改伤害数字动画 */
    @keyframes floatUp {
        0% {
            transform: translateY(0);
            opacity: 1;
        }
        100% {
            transform: translateY(-100px); /* 向上移动100像素后停止 */
            opacity: 1; /* 保持实体,不淡化 */
        }
    }

    .damage-number {
        position: absolute;
        font-size: 40px;
        font-weight: bold;
        color: #ff3300;
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
        animation: floatUp 1s forwards; /* 1秒内完成上升动画,然后保持状态 */
        z-index: 10;
        font-style: italic;
        opacity: 1; /* 确保实体显示 */
    }

/* 新增屏幕震动特效 */ @keyframes screenShake { 0% { transform: translate(0, 0); } 10% { transform: translate(-5px, 0); } 20% { transform: translate(5px, 0); } 30% { transform: translate(-5px, 0); } 40% { transform: translate(5px, 0); } 50% { transform: translate(-5px, 0); } 60% { transform: translate(5px, 0); } 70% { transform: translate(-5px, 0); } 80% { transform: translate(5px, 0); } 90% { transform: translate(-5px, 0); } 100% { transform: translate(0, 0); } }

.shaking { animation: screenShake 0.5s ease-in-out; }

    .attack-card {
        width: 100%; /* 新增:确保卡片宽度为100% */
        background: rgba(40, 40, 80, 0.8);
        border-radius: 10px;
        padding: 20px;
        margin-bottom: 20px;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
        perspective: 1000px;
    }
    
    .card-inner {
        position: relative;
        width: 100%;
        height: 120px;
        transition: transform 0.6s;
        transform-style: preserve-3d;
    }
    
    .card-inner.flipped {
        transform: rotateY(180deg);
    }
    
    .card-front, .card-back {
        position: absolute;
        width: 100%;
        height: 100%;
        backface-visibility: hidden;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        border-radius: 10px;
        padding: 20px;
    }
    
    .card-front {
        background: rgba(50, 50, 100, 0.9);
    }
    
    .card-back {
        background: rgba(30, 60, 90, 0.9);
        transform: rotateY(180deg);
    }
    
    .input-group {
        display: flex;
        width: 100%;
        margin-bottom: 15px;
    }
    
    .income-input {
        flex: 1;
        padding: 10px 15px;
        border: none;
        border-radius: 5px 0 0 5px;
        background: rgba(255, 255, 255, 0.1);
        color: white;
        font-size: 16px;
    }
    
    .attack-btn {
        padding: 10px 20px;
        background: linear-gradient(135deg, #ff3300 0%, #ff9900 100%);
        border: none;
        border-radius: 0 5px 5px 0;
        color: white;
        font-weight: bold;
        cursor: pointer;
        transition: all 0.3s;
    }
    
    .attack-btn:hover {
        background: linear-gradient(135deg, #ff5500 0%, #ffaa00 100%);
        transform: translateY(-2px);
    }
    
    .attack-btn:disabled {
        background: #666;
        cursor: not-allowed;
        transform: none;
    }
    
    .current-weapon {
        font-size: 14px;
        color: #aaa;
    }
    
    .locked-text {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
    }
    
    .lock-icon {
        cursor: pointer;
        font-size: 20px;
    }
    
    .finance-stats {
        display: flex;
        flex-direction: column;
        gap: 20px;
        margin-bottom: 20px;
    }
    
    .finance-card {
        width: 100%; /* 新增:确保卡片宽度为100% */
        background: rgba(40, 40, 80, 0.8);
        border-radius: 10px;
        padding: 20px;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    }
    
    .finance-title {
        font-size: 18px;
        margin-bottom: 10px;
        color: #ffcc00;
    }
    
    .finance-value {
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 24px;
        font-weight: bold;
    }
    
    .settings {
        width: 100%; /* 新增:确保卡片宽度为100% */
        background: rgba(40, 40, 80, 0.8);
        border-radius: 10px;
        padding: 20px;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
        display: none;
    }
    
    .settings-title {
        font-size: 20px;
        margin-bottom: 15px;
        color: #ffcc00;
    }
    
    .setting-item {
        margin-bottom: 15px;
    }
    
    .setting-label {
        display: block;
        margin-bottom: 5px;
        font-size: 14px;
    }
    
    .setting-input {
        width: 100%;
        padding: 8px 12px;
        border: none;
        border-radius: 5px;
        background: rgba(255, 255, 255, 0.1);
        color: white;
    }
    
    .file-upload {
        margin-top: 10px;
    }
    
    .file-input {
        width: 100%;
        padding: 8px;
        border: 1px dashed #666;
        border-radius: 5px;
        background: rgba(255, 255, 255, 0.05);
        color: white;
    }
    
    .save-btn {
        padding: 10px 20px;
        background: linear-gradient(135deg, #0099ff 0%, #0066cc 100%);
        border: none;
        border-radius: 5px;
        color: white;
        font-weight: bold;
        cursor: pointer;
        transition: all 0.3s;
    }
    
    .save-btn:hover {
        background: linear-gradient(135deg, #00aaff 0%, #0077dd 100%);
        transform: translateY(-2px);
    }
    
    .bottom-bar {
        display: flex;
        justify-content: space-between;
        margin-top: 20px;
    }
    
    .reset-btn {
        padding: 10px 20px;
        background: linear-gradient(135deg, #ff3333 0%, #cc0000 100%);
        border: none;
        border-radius: 5px;
        color: white;
        font-weight: bold;
        cursor: pointer;
        transition: all 0.3s;
    }
    
    .reset-btn:hover {
        background: linear-gradient(135deg, #ff5555 0%, #dd0000 100%);
        transform: translateY(-2px);
    }
    
    .settings-btn {
        padding: 10px 20px;
        background: linear-gradient(135deg, #33cc33 0%, #009900 100%);
        border: none;
        border-radius: 5px;
        color: white;
        font-weight: bold;
        cursor: pointer;
        transition: all 0.3s;
    }
    
    .settings-btn:hover {
        background: linear-gradient(135deg, #55dd55 0%, #00bb00 100%);
        transform: translateY(-2px);
    }
    
    .boss-dialog {
position: relative;
background: rgba(0, 0, 0, 0.8);
border: 2px solid #7F0B00; /* 改为深红色 */
border-radius: 10px;
padding: 15px;
max-width: 400px;
margin: 0 auto 20px;
z-index: 100;
text-align: center;
box-shadow: 0 0 20px rgba(127, 11, 0, 0.5); /* 改为深红色阴影 */
display: none;

}

.boss-dialog::before { content: ''; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); border-width: 10px; border-style: solid; border-color: transparent transparent #7F0B00 transparent; /* 改为深红色 */ }

    .boss-dialog-title {
        font-size: 20px;
        color: #ffcc00;
        margin-bottom: 10px;
        display: none; /* 隐藏标题 */
    }
    
    .boss-dialog-content {
        font-size: 16px;
        line-height: 1.5;
    }
    
    /* 新增BOSS击败信息样式 */
    .boss-defeat-info {
        display: none;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.7);
        border-radius: 10px;
        color: #fff;
        padding: 20px;
    }
    
    .defeat-title {
font-size: 24px;
font-weight: bold;
color: #7F0B00; /* 改为深红色 */
margin-bottom: 15px;

}

    .weapon-drop {
        font-size: 18px;
        color: #ff9900;
        margin-top: 10px;
    }
    
    /* BOSS描述模态框样式 */
    .boss-description-modal {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.8);
        z-index: 1000;
        justify-content: center;
        align-items: center;
    }
    
    .boss-description-content {
width: 100%;
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
border: 2px solid #7F0B00; /* 改为深红色边框 */
border-radius: 15px;
padding: 30px;
max-width: 600px;
width: 90%;
max-height: 80vh;
overflow-y: auto;
box-shadow: 0 0 30px rgba(127, 11, 0, 0.7); /* 深红色阴影 */

}

    .boss-description-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
padding-bottom: 10px;
border-bottom: 1px solid #7F0B00; /* 改为深红色 */

}

    .boss-description-name {
font-size: 24px;
color: #7F0B00; /* 改为深红色 */
font-weight: bold;

}

    .close-description {
background: none;
border: none;
color: #7F0B00; /* 改为深红色 */
font-size: 24px;
cursor: pointer;

}

    .boss-description-body {
        line-height: 1.6;
    }
    
    .description-section {
        margin-bottom: 20px;
    }
    
    .description-title {
font-size: 18px;
color: #7F0B00; /* 改为深红色 */
margin-bottom: 10px;

}

    .description-text {
        font-size: 16px;
        color: #e6e6e6;
    }
    
    /* 设置模态框样式 */
    .settings-modal {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.8);
        z-index: 1000;
        justify-content: center;
        align-items: center;
    }
    
    .settings-content {
        width: 100%; /* 新增:确保卡片宽度为100% */
        background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
        border: 2px solid #0099ff;
        border-radius: 15px;
        padding: 30px;
        max-width: 500px;
        width: 90%;
        max-height: 80vh;
        overflow-y: auto;
        box-shadow: 0 0 30px rgba(0, 153, 255, 0.5);
    }
    
    .settings-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 20px;
        padding-bottom: 10px;
        border-bottom: 1px solid #444;
    }
    
    .settings-modal-title {
        font-size: 24px;
        color: #00ccff;
        font-weight: bold;
    }
    
    .close-settings {
        background: none;
        border: none;
        color: #00ccff;
        font-size: 24px;
        cursor: pointer;
    }
    
    .boss-images-upload-container {
max-height: 300px;
overflow-y: auto;
border: 1px solid #444;
border-radius: 5px;
padding: 10px;
background: rgba(255, 255, 255, 0.05);

}

.boss-upload-row { display: flex; margin-bottom: 10px; gap: 10px; }

.boss-upload-item { flex: 1; text-align: center; }

.boss-upload-item label { display: block; font-size: 12px; margin-bottom: 5px; color: #aaa; }

.boss-single-image { width: 100%; padding: 5px; border: 1px dashed #666; border-radius: 3px; background: rgba(255, 255, 255, 0.05); color: white; font-size: 12px; }

.boss-single-image.uploaded { background-color: #4CAF50 !important; border-color: #45a049 !important; color: white !important; } /* 修改血条区域的样式 */ .level-and-name { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0px; }

.level-and-boss { display: flex; align-items: center; gap: 5px; /* 控制等级和BOSS名字之间的间距 */ }

.level-text { font-size: 14px; font-weight: bold; color: #ffcc00; white-space: nowrap; /* 防止文本换行 */ }

.boss-name { font-size: 14px; color: #FFD300; cursor: pointer; transition: color 0.3s; white-space: nowrap; font-weight: bold; /* 新增这行,使BOSS名字加粗 */ }

.boss-name:hover { color: #ffcc00; text-decoration: underline; }

.health-numbers { text-align: right; font-size: 12px; color: #aaa; white-space: nowrap; /* 防止文本换行 / margin-left: 10px; / 确保与BOSS名字有一定间距 */ }

今日攻击(次)
0
今日收入(元)
0
今日砍血(点)
0
    <!-- BOSS血条区域 -->
    <div class="boss-levels" id="boss-levels">
        <!-- BOSS血条将通过JS动态生成 -->
    </div>
    
    <!-- BOSS图片区域 -->
    <div class="boss-image-area" id="boss-image-area">
        <div id="boss-image-placeholder">请上传BOSS图片</div>
        <img class="boss-image" id="boss-image" style="display: none;">
        <!-- 新增BOSS击败信息区域 -->
        <div class="boss-defeat-info" id="boss-defeat-info">
            <div class="defeat-title" id="defeat-boss-name"></div>
            <div class="defeat-title">已被击杀</div>
            <div class="weapon-drop">掉落武器: <span id="dropped-weapon-name"></span></div>
        </div>
    </div>
    
    <!-- BOSS对话框 -->
    <div class="boss-dialog" id="boss-dialog">
        <div class="boss-dialog-title" id="boss-dialog-title">BOSS宣言</div>
        <div class="boss-dialog-content" id="boss-dialog-content"></div>
    </div>
    
    <!-- 攻击输入卡片 -->
    <div class="attack-card">
        <div class="card-inner" id="card-inner">
            <div class="card-front">
                <div class="input-group">
                    <input type="number" class="income-input" id="income-input" placeholder="输入收入金额" min="0" step="0.01">
                    <button class="attack-btn" id="attack-btn"><span id="weapon-name">初始武器</span>攻击</button>
                </div>
                <div class="current-weapon">当前武器: <span id="current-weapon">初始武器</span></div>
            </div>
            <div class="card-back">
                <div class="locked-text">
                    <span>累计收入: </span>
                    <span id="hidden-income">****************</span>
                    <span id="actual-income" style="display: none;">0</span>
                    <span></span>
                    <span class="lock-icon" id="lock-icon">🔒</span>
                </div>
            </div>
        </div>
    </div>
    
    <!-- 财务统计 -->
    <div class="finance-stats">
        <div class="finance-card">
            <div class="finance-title">累计存款</div>
            <div class="finance-value">
                <div>
                    <span id="hidden-savings">****************</span>
                    <span id="actual-savings" style="display: none;">0</span>
                    <span></span>
                </div>
                <span class="lock-icon" id="savings-lock-icon">🔒</span>
            </div>
        </div>
        <div class="finance-card">
            <div class="finance-title">累计税收</div>
            <div class="finance-value">
                <div>
                    <span id="hidden-tax">****************</span>
                    <span id="actual-tax" style="display: none;">0</span>
                    <span></span>
                </div>
                <span class="lock-icon" id="tax-lock-icon">🔒</span>
            </div>
        </div>
    </div>
    
    <!-- 设置区域 - 已移除内联设置面板 -->
    
    <!-- 底部按钮栏 -->
    <div class="bottom-bar">
        <button class="reset-btn" id="reset-btn">重置游戏</button>
        <button class="settings-btn" id="settings-btn">设置</button>
    </div>
</div>

<!-- BOSS描述模态框 -->
<div class="boss-description-modal" id="boss-description-modal">
    <div class="boss-description-content">
        <div class="boss-description-header">
            <div class="boss-description-name" id="description-boss-name"></div>
            <button class="close-description" id="close-description">×</button>
        </div>
        <div class="boss-description-body">
            <div class="description-section">
                <div class="description-title">外貌特征</div>
                <div class="description-text" id="description-appearance"></div>
            </div>
            <div class="description-section">
                <div class="description-title">所处位置</div>
                <div class="description-text" id="description-location"></div>
            </div>
            <div class="description-section">
                <div class="description-title">背景故事</div>
                <div class="description-text" id="description-background"></div>
            </div>
        </div>
    </div>
</div>

<!-- 设置模态框 -->
<div class="settings-modal" id="settings-modal">
    <div class="settings-content">
        <div class="settings-header">
            <div class="settings-modal-title">游戏设置</div>
            <button class="close-settings" id="close-settings">×</button>
        </div>
        
        <div class="setting-item">
            <label class="setting-label">每日预算 (元)</label>
            <input type="number" class="setting-input" id="daily-budget" value="104" min="0" step="0.01">
        </div>
        
        <div class="setting-item">
<label class="setting-label">上传BOSS图片 (单个上传)</label>
<div class="boss-images-upload-container">
    <div class="boss-upload-row">
        <div class="boss-upload-item">
            <label>B1</label>
            <input type="file" class="boss-single-image" data-boss-index="0" accept="image/*">
        </div>
        <div class="boss-upload-item">
            <label>B2</label>
            <input type="file" class="boss-single-image" data-boss-index="1" accept="image/*">
        </div>
        <div class="boss-upload-item">
            <label>B3</label>
            <input type="file" class="boss-single-image" data-boss-index="2" accept="image/*">
        </div>
        <div class="boss-upload-item">
            <label>B4</label>
            <input type="file" class="boss-single-image" data-boss-index="3" accept="image/*">
        </div>
        <div class="boss-upload-item">
            <label>B5</label>
            <input type="file" class="boss-single-image" data-boss-index="4" accept="image/*">
        </div>
    </div>
    <div class="boss-upload-row">
        <div class="boss-upload-item">
            <label>B6</label>
            <input type="file" class="boss-single-image" data-boss-index="5" accept="image/*">
        </div>
        <div class="boss-upload-item">
            <label>B7</label>
            <input type="file" class="boss-single-image" data-boss-index="6" accept="image/*">
        </div>
        <div class="boss-upload-item">
            <label>B8</label>
            <input type="file" class="boss-single-image" data-boss-index="7" accept="image/*">
        </div>
        <div class="boss-upload-item">
            <label>B9</label>
            <input type="file" class="boss-single-image" data-boss-index="8" accept="image/*">
        </div>
        <div class="boss-upload-item">
            <label>B10</label>
            <input type="file" class="boss-single-image" data-boss-index="9" accept="image/*">
        </div>
    </div>
    <div class="boss-upload-row">
        <div class="boss-upload-item">
            <label>B11</label>
            <input type="file" class="boss-single-image" data-boss-index="10" accept="image/*">
        </div>
        <div class="boss-upload-item">
            <label>B12</label>
            <input type="file" class="boss-single-image" data-boss-index="11" accept="image/*">
        </div>
        <div class="boss-upload-item">
            <label>B13</label>
            <input type="file" class="boss-single-image" data-boss-index="12" accept="image/*">
        </div>
        <div class="boss-upload-item">
            <label>B14</label>
            <input type="file" class="boss-single-image" data-boss-index="13" accept="image/*">
        </div>
        <div class="boss-upload-item">
            <label>B15</label>
            <input type="file" class="boss-single-image" data-boss-index="14" accept="image/*">
        </div>
    </div>
    <div class="boss-upload-row">
        <div class="boss-upload-item">
            <label>B16</label>
            <input type="file" class="boss-single-image" data-boss-index="15" accept="image/*">
        </div>
        <div class="boss-upload-item">
            <label>B17</label>
            <input type="file" class="boss-single-image" data-boss-index="16" accept="image/*">
        </div>
        <div class="boss-upload-item">
            <label>B18</label>
            <input type="file" class="boss-single-image" data-boss-index="17" accept="image/*">
        </div>
        <div class="boss-upload-item">
            <label>B19</label>
            <input type="file" class="boss-single-image" data-boss-index="18" accept="image/*">
        </div>
        <div class="boss-upload-item">
            <label>B20</label>
            <input type="file" class="boss-single-image" data-boss-index="19" accept="image/*">
        </div>
    </div>
    <div class="boss-upload-row">
        <div class="boss-upload-item">
            <label>B21</label>
            <input type="file" class="boss-single-image" data-boss-index="20" accept="image/*">
        </div>
        <div class="boss-upload-item">
            <label>B22</label>
            <input type="file" class="boss-single-image" data-boss-index="21" accept="image/*">
        </div>
        <div class="boss-upload-item">
            <label>B23</label>
            <input type="file" class="boss-single-image" data-boss-index="22" accept="image/*">
        </div>
        <div class="boss-upload-item">
            <label>B24</label>
            <input type="file" class="boss-single-image" data-boss-index="23" accept="image/*">
        </div>
        <div class="boss-upload-item">
            <label>B25</label>
            <input type="file" class="boss-single-image" data-boss-index="24" accept="image/*">
        </div>
    </div>
    <div class="boss-upload-row">
        <div class="boss-upload-item">
            <label>B26</label>
            <input type="file" class="boss-single-image" data-boss-index="25" accept="image/*">
        </div>
        <div class="boss-upload-item">
            <label>B27</label>
            <input type="file" class="boss-single-image" data-boss-index="26" accept="image/*">
        </div>
        <div class="boss-upload-item">
            <label>B28</label>
            <input type="file" class="boss-single-image" data-boss-index="27" accept="image/*">
        </div>
        <div class="boss-upload-item">
            <label>B29</label>
            <input type="file" class="boss-single-image" data-boss-index="28" accept="image/*">
        </div>
        <div class="boss-upload-item">
            <label>B30</label>
            <input type="file" class="boss-single-image" data-boss-index="29" accept="image/*">
        </div>
    </div>
    <div class="boss-upload-row">
        <div class="boss-upload-item">
            <label>B31</label>
            <input type="file" class="boss-single-image" data-boss-index="30" accept="image/*">
        </div>
        <div class="boss-upload-item">
            <label>B32</label>
            <input type="file" class="boss-single-image" data-boss-index="31" accept="image/*">
        </div>
        <div class="boss-upload-item">
            <label>B33</label>
            <input type="file" class="boss-single-image" data-boss-index="32" accept="image/*">
        </div>
        <div class="boss-upload-item">
            <label>B34</label>
            <input type="file" class="boss-single-image" data-boss-index="33" accept="image/*">
        </div>
        <div class="boss-upload-item">
            <label>B35</label>
            <input type="file" class="boss-single-image" data-boss-index="34" accept="image/*">
        </div>
    </div>
    <div class="boss-upload-row">
        <div class="boss-upload-item">
            <label>B36</label>
            <input type="file" class="boss-single-image" data-boss-index="35" accept="image/*">
        </div>
        <div class="boss-upload-item">
            <label>B37</label>
            <input type="file" class="boss-single-image" data-boss-index="36" accept="image/*">
        </div>
        <div class="boss-upload-item">
            <label>B38</label>
            <input type="file" class="boss-single-image" data-boss-index="37" accept="image/*">
        </div>
        <div class="boss-upload-item">
            <label>B39</label>
            <input type="file" class="boss-single-image" data-boss-index="38" accept="image/*">
        </div>
        <div class="boss-upload-item">
            <label>B40</label>
            <input type="file" class="boss-single-image" data-boss-index="39" accept="image/*">
        </div>
    </div>
    <div class="boss-upload-row">
        <div class="boss-upload-item">
            <label>B41</label>
            <input type="file" class="boss-single-image" data-boss-index="40" accept="image/*">
        </div>
    </div>
</div>
        <button class="save-btn" id="save-settings">保存设置</button>
    </div>
</div>

<script>
    // 重新设计的BOSS名称列表(41个顶尖存在)
    const bossNames = [
        "炼狱魔尊", "幽冥鬼帝", "九幽邪皇", "混沌魔神", "万古妖尊",
        "星辰吞噬者", "虚空行者", "时光扭曲者", "命运编织者", "轮回掌控者",
        "元素支配者", "灵魂收割者", "黑暗主宰", "光明毁灭者", "永恒梦魇",
        "维度撕裂者", "法则破坏者", "真理篡改者", "现实扭曲者", "因果律者",
        "概念吞噬者", "存在抹除者", "无限维度之主", "多元宇宙之心", "创世之影",
        "灭世之源", "原初混沌", "终焉使者", "虚无君主", "永恒寂静",
        "超脱者", "至高意志", "绝对存在", "无限可能", "万物归一者",
        "全知全能者", "无上至尊", "终极真理", "大道本源", "宇宙意识",
        "超维绝对存在"
    ];

    // 重新设计的武器名称列表(40把顶尖武器)
    const weaponNames = [
        "破晓神剑", "幽冥魔刃", "九幽邪枪", "混沌战斧", "万古妖刀",
        "星辰法杖", "虚空之弓", "时光权杖", "命运之轮", "轮回之镜",
        "元素法球", "灵魂镰刀", "黑暗魔典", "光明圣剑", "永恒梦刃",
        "维度裂刃", "法则崩坏者", "真理权柄", "现实编辑器", "因果之矛",
        "概念吞噬者", "存在抹除器", "无限维度之钥", "多元宇宙核心", "创世之笔",
        "灭世之锤", "原初之核", "终焉之剑", "虚无之冠", "永恒寂静之杖",
        "超脱之翼", "至高权杖", "绝对之盾", "无限可能之书", "万物归一剑",
        "全知全能之眼", "无上至尊印", "终极真理法典", "大道本源珠", "宇宙意识碎片"
    ];

    // BOSS血量列表
    const bossHealth = [
        28000000000, 29000000000, 30000000000, 31000000000, 32000000000,
        33000000000, 34000000000, 35000000000, 36000000000, 38000000000,
        39000000000, 40000000000, 41000000000, 42000000000, 43000000000,
        44000000000, 45000000000, 46000000000, 47000000000, 48000000000,
        49000000000, 50000000000, 51000000000, 52000000000, 53000000000,
        54000000000, 55000000000, 56000000000, 57000000000, 58000000000,
        59000000000, 60000000000, 61000000000, 62000000000, 63000000000,
        64000000000, 65000000000, 66000000000, 67000000000, 68000000000,
        69000000000
    ];

    // BOSS外貌描述

const bossAppearances = [ "身披熔岩铠甲,双眼燃烧着永恒的地狱之火,周身环绕着灼热的气息,每一步都留下焦黑的痕迹。", "半透明的幽魂之体,面容扭曲恐怖,手持幽冥权杖,周围环绕着无数哀嚎的亡魂。", "身披暗影斗篷,面容隐藏在黑暗之中,只有一双紫色的邪眼闪烁着不祥的光芒。", "由纯粹的混沌能量构成,形态不断变化,时而如巨兽,时而如人形,散发着令人疯狂的混乱气息。", "半人半妖的形态,拥有九条狐尾和尖锐的利爪,眼中闪烁着狡黠而残忍的光芒。", "身躯由无数星辰碎片构成,宛如移动的星系,中心有一个不断旋转的黑洞。", "身形飘忽不定,仿佛存在于现实与虚空的夹缝中,周身环绕着扭曲的空间波纹。", "身躯半透明,仿佛由流动的时间构成,周围的时间流速时快时慢,极不稳定。", "手持巨大的命运纺锤,眼中能看到无数命运之线,周身环绕着闪烁的命运符文。", "拥有六只手臂,每只手中都持有一个轮回之环,面容平静却蕴含着无尽威严。", "身躯由四大元素构成,左半身为火焰,右半身为寒冰,双脚为岩石,头顶有风暴环绕。", "身披破旧黑袍,手持巨大的灵魂镰刀,面容隐藏在兜帽之下,只露出散发着绿光的双眼。", "纯粹的黑暗能量聚合体,没有固定形态,只是一个人形的黑暗空洞,吞噬一切光线。", "身披耀眼的白金色铠甲,但铠甲上布满了裂痕,从中渗出黑暗能量,形成诡异的光暗交织。", "形态不断变化,仿佛是所有人的噩梦集合体,时而如巨大蜘蛛,时而如扭曲的人形。", "身躯由无数几何碎片构成,不断重组变形,周围空间不断出现裂痕。", "身形模糊不清,仿佛由破碎的法则碎片构成,所到之处物理法则都会崩溃。", "拥有无数只眼睛和手臂,每只眼睛都能看到不同层面的真理,每只手臂都在修改现实。", "身形如水中的倒影般不断波动,周围现实不断被扭曲重组,形成诡异景象。", "身披由因果之线编织的长袍,手中持有一本记录着所有因果的巨书。", "没有固定形态,只是一团不断吞噬周围概念的黑暗,连颜色和形状都会被它吞噬。", "身形几乎不可见,只有在它抹除存在时才会短暂显现,周围事物会无声无息地消失。", "身躯由无数维度碎片构成,每个碎片都展示着不同的宇宙景象。", "一个巨大的发光心脏,每一次跳动都会引发多元宇宙的震动,周围环绕着无数小宇宙。", "创世神的黑暗面,身形与创世神相似但颜色完全相反,周身散发着毁灭与创造交织的气息。", "一个不断旋转的黑暗漩涡,从中不断涌出毁灭性能量,所到之处万物归墟。", "宇宙诞生前的混沌状态的人格化,没有固定形态,只是一团不断变化的原始能量。", "身披由终结概念构成的铠甲,手持宣告万物终结的号角,面容冷漠无情。", "存在于有与无的边界,身形时隐时现,周围空间不断在存在与虚无间转换。", "一个完全静止的存在,周围时间完全停滞,连光线都在它面前凝固。", "已经超越了一切概念的存在,没有固定形态,只是纯粹的意识体,散发着令人敬畏的气息。", "宇宙根本意志的体现,形态如同无数光点组成的巨大网络,每个光点都是一个意识。", "定义了存在本身的概念,形态稳定到无法被任何力量影响,仿佛是宇宙的锚点。", "形态不断变化,展示着所有可能性的集合,时而如婴儿,时而如老者,时而如怪物。", "所有存在的终极归宿,形态如同一个不断吸收一切的漩涡,最终将所有化为一体。", "知晓一切可能性的存在,形态如同一个巨大的眼睛,注视着过去现在未来所有时间线。", "超越了一切等级制度的存在,形态威严而不可侵犯,散发着令万物臣服的气息。", "宇宙最终真理的化身,形态如同一个不断变化的几何图形,展示着宇宙的根本规律。", "所有法则的源头,形态如同一个不断旋转的法则漩涡,从中不断诞生新的宇宙规律。", "整个宇宙的集体意识,形态如同一个由无数星辰组成的巨大大脑。", "超越了所有维度的终极存在,无法用任何语言描述其形态,只是纯粹的超维概念体。" ];

// BOSS位置描述 const bossLocations = [ "位于地心熔岩海的最深处,统治着整个地狱维度。", "盘踞在冥界最深处的幽冥宫中,掌控所有亡魂的轮回。", "隐藏在九幽深渊的邪皇宫中,那里是光明永远无法触及之地。", "游荡在宇宙诞生前的混沌海,那里没有时间与空间的概念。", "居住在万妖山脉的巅峰妖殿中,统御着世间所有妖族。", "在宇宙边缘的虚无地带游荡,不断吞噬遇到的恒星与星系。", "漫步在现实与虚空的边界,那里是物质与虚无的交界处。", "栖息在时间河流的漩涡中,那里过去现在未来交织在一起。", "端坐于命运之网的中央,那里所有生命的命运线交汇。", "镇守在六道轮回的入口,决定所有灵魂的转世去向。", "居住在元素界的元素王座上,掌控着宇宙所有基本元素。", "游荡在生与死的边界,收割那些逃避轮回的灵魂。", "盘踞在绝对黑暗维度,那里是连光子都无法存在的领域。", "居住在光暗交界的光暗神殿,专门摧毁那些过于耀眼的存在。", "潜伏在众生的集体潜意识中,是所有噩梦的源头。", "在维度间隙中穿梭,不断撕裂不同维度间的屏障。", "存在于法则荒漠,那里是宇宙法则失效的领域。", "栖息在真理图书馆,不断修改着宇宙的基本真理。", "游荡在现实薄弱点,那里现实结构极易被改变。", "端坐于因果之树的顶端,俯瞰所有因果联系的网络。", "在概念层面游荡,吞噬那些不被需要的概念。", "潜伏在存在与不存在的边界,抹除那些不该存在的事物。", "居住在无限维度的中心点,那里可以通往所有维度。", "悬浮在多元宇宙的交汇处,是所有宇宙的心脏。", "跟随在创世神的身后,是创世过程中产生的阴影。", "盘踞在宇宙终结之地,那里是所有世界最终的归宿。", "存在于宇宙诞生前的混沌领域,那里是万物的起点。", "游荡在时间尽头,宣告每个宇宙的最终命运。", "统治着绝对虚无领域,那里连空间和时间都不存在。", "栖息在宇宙最寂静的角落,那里连量子波动都已停止。", "已超越所有维度,存在于无法描述的超越领域。", "弥漫在整个宇宙,是宇宙根本规律的体现。", "定义着存在本身,存在于所有存在之物的核心。", "栖息在可能性海洋,那里展示着所有可能的世界线。", "存在于万物的终点,所有存在最终都会回归于此。", "端坐于全知神殿,知晓宇宙的一切奥秘。", "居住在超越等级的领域,那里没有高低贵贱之分。", "隐藏在真理之核,那里蕴含着宇宙的最终答案。", "存在于法则源头,是所有大道的发源地。", "弥漫在整个宇宙,是宇宙本身的自我意识。", "存在于所有维度之上,是无法用维度描述的终极领域。" ];

// BOSS背景故事 const bossBackgrounds = [ "曾是上古时期最强大的修仙者,因追求极致力量而堕入魔道,最终与地狱本源融合,成为炼狱的统治者。", "是冥界诞生时产生的第一个亡魂,积累了无数纪元的死亡能量,最终成为所有亡魂的主宰。", "是光明世界的对立面,从所有生物的阴暗面中诞生,代表着宇宙的阴暗面。", "是宇宙诞生时未被完全转化的混沌能量聚合体,代表着秩序之前的混乱状态。", "是妖族历史上最强大的存在,统御妖族与人类对抗了无数纪元,见证了文明的兴衰。", "是一个濒死宇宙的幸存者,为了生存而不断吞噬其他星辰,最终成为了星辰的终结者。", "是第一个突破现实界限的存在,在虚空中游荡了无数岁月,掌握了空间的终极奥秘。", "是时间本身的异常产物,能够随意操纵时间流速,甚至能够改变过去的事件。", "是从命运概念中诞生的存在,掌控着所有生命的命运线,能够随意改写任何生物的宿命。", "是轮回系统的管理员,负责维护生死轮回的平衡,决定灵魂的转世去向。", "是四大元素的原始意识,在宇宙诞生时就已存在,掌控着所有基本元素的平衡。", "是死亡概念的具象化,专门收割那些逃避死亡法则的灵魂,维护生死秩序的平衡。", "是黑暗概念的源头,在第一个光子诞生前就已存在,代表着绝对的黑暗与虚无。", "原本是光明神,因目睹太多光明带来的痛苦而堕落,专门摧毁那些过于耀眼的存在。", "是从所有生物的恐惧中诞生的存在,潜伏在集体潜意识中,是所有噩梦的源头。", "是维度系统的错误代码,能够随意撕裂维度屏障,造成不同维度间的混乱。", "是宇宙系统的反叛者,专门破坏宇宙的基本法则,试图重建新的宇宙秩序。", "是真理的编辑者,能够随意修改宇宙的基本真理,改变现实的根本规律。", "是现实结构的异常点,能够随意扭曲现实结构,创造不可能的景象。", "是因果关系的管理员,能够看到并修改所有因果联系,改变事件的发展方向。", "是概念的清道夫,专门吞噬那些不被需要的概念,维护概念层面的秩序。", "是存在层面的管理员,专门抹除那些不该存在的事物,维护存在的纯粹性。", "是所有维度的统治者,能够自由穿梭于无限维度之间,掌控维度的一切奥秘。", "是多元宇宙的核心,连接着所有宇宙,维持着多元宇宙的平衡。", "是创世过程中产生的副产品,代表着创造中的毁灭,是创世神的黑暗面。", "是宇宙终结的具象化,负责引导宇宙走向终结,是万物最终的归宿。", "是宇宙诞生前的状态,代表着无限的可能性,是所有存在的源头。", "是时间尽头的引路人,负责宣告每个宇宙的终结,引导万物走向终点。", "是虚无领域的统治者,代表着绝对的无,是存在的对立面。", "是宇宙最终的状态,代表着一切的终结,连时间都会在此停止。", "是超越了一切限制的存在,已脱离因果轮回,不受任何法则约束。", "是宇宙的根本意志,决定着宇宙的发展方向,是所有规律的制定者。", "是存在的定义者,定义了存在本身的概念,是所有存在物的基础。", "是所有可能性的集合,展示着宇宙发展的所有潜在方向。", "是所有存在的最终归宿,最终将所有存在融合为一体。", "是知晓一切的存在,知晓过去现在未来所有可能性。", "是超越了一切等级的存在,不再受任何层次结构的约束。", "是宇宙的最终答案,蕴含着宇宙的所有奥秘。", "是所有法则的源头,不断诞生新的宇宙规律。", "是宇宙的自我意识,代表着宇宙本身的意志。", "是超越了所有维度的终极存在,无法用任何已知概念描述。" ];

    // BOSS对话系统 - 每个BOSS有6个阶段的完整对话

const bossDialogs = [ { // 0. 炼狱魔尊 first: "区区凡人,也敢踏足我的炼狱领域?让你见识真正的地狱之火!", p80: "哼,有点本事。但炼狱的火焰会吞噬你的灵魂!", p60: "不可能!我的地狱铠甲竟然出现了裂痕!", p40: "住手!你可知道唤醒炼狱深处那些存在的后果?", p20: "不...炼狱本源正在流失...我感受到了恐惧...", p1: "炼狱...在哀嚎...你究竟是谁...", kill: "炼狱...终将熄灭...但更深处的存在...会为我复仇...", effectiveAttack: "烫!烫!烫!你这蝼蚁竟敢用凡火灼伤我的熔岩之躯?!" }, { // 1. 幽冥鬼帝 first: "生者勿近!幽冥领域不欢迎活物,你的灵魂将永远在此徘徊!", p80: "有趣的灵魂...我会将它收藏在我的幽冥宫中!", p60: "你的攻击...竟然能伤到幽冥之体?这不可能!", p40: "停手!你正在破坏生死平衡,冥界会因此崩溃!", p20: "幽冥之力...在消散...我看到了轮回的真相...", p1: "不...我不想回归虚无...冥界啊...拯救你的主宰...", kill: "幽冥...重归寂静...但轮回...不会停止...", effectiveAttack: "呵...有趣,生者的温度竟能灼伤亡者的国度。你让我想起了某个故人..." }, { // 2. 九幽邪皇 first: "光明世界的蝼蚁,九幽的黑暗将吞噬你的希望!", p80: "有趣,你的光芒竟能照亮九幽的一角...但黑暗终将胜利!", p60: "这光芒...刺痛了我的本质...你究竟是什么存在?", p40: "住手!九幽深处沉睡着远古邪神,你会唤醒它们!", p20: "黑暗...在退散...我看到了光明的可怕...", p1: "九幽...要重见天日了吗...不...", kill: "黑暗...永不灭...只在...等待重生...", effectiveAttack: "谁在拨动黑暗的琴弦?这疼痛...久违了。" }, { // 3. 混沌魔神 first: "秩序的生物,在混沌面前颤抖吧!我会将你重归混沌!", p80: "你的秩序之力...竟能暂时稳定混沌?不可能!", p60: "混沌...在分离...这违背了宇宙的根本法则!", p40: "停手!完全的秩序意味着绝对的死亡,你在毁灭可能性!", p20: "我感受到了...恐惧...混沌竟然会产生恐惧...", p1: "回归...混沌...不...我要消失了...", kill: "混沌...终将...重聚...", effectiveAttack: "咯咯咯,这感觉真新鲜!混沌居然被划开了一道口子?" }, { // 4. 万古妖尊 first: "人类,你的时代结束了!妖族将重新统治这个世界!", p80: "不错的实力,但万古妖力不是你能够抗衡的!", p60: "我的妖丹...在震动...这不可能!", p40: "住手!妖族的复兴不能在此终结!", p20: "万古的等待...要化为泡影了吗...", p1: "妖族...的未来...不...", kill: "妖族...永不灭...终将...归来...", effectiveAttack: "嗷——!区区人类,竟敢伤我九尾!看来是我小看你了,小家伙。" }, { // 5. 星辰吞噬者 first: "渺小的生命,你的星辰将在我的腹中熄灭!", p80: "有趣的能量...但不及星辰的亿万分之一!", p60: "我的核心...在震颤...这是什么力量?", p40: "停止!宇宙的平衡会被破坏,星辰会失去控制!", p20: "星辰...在远离我...我感受到了空虚...", p1: "不...我不想变回普通的黑洞...", kill: "星辰...终将...重新点亮...", effectiveAttack: "嗯?这颗'小石子'砸得还挺疼。看来你不是普通的恒星尘埃呢。" }, { // 6. 虚空行者 first: "现实与虚空的边界由我把守,你的存在将被抹除!", p80: "你竟能触及虚空本质?有趣...但还不够!", p60: "虚空...在排斥我...这不可能!", p40: "住手!虚空与现实会融合,一切都会崩溃!", p20: "我...正在失去虚空的眷顾...", p1: "虚空...要抛弃我了吗...", kill: "虚空...永远...存在...", effectiveAttack: "......谁在打扰我清净......哦?原来是只迷路的小虫子。" }, { // 7. 时光扭曲者 first: "时间的河流由我掌控,你的存在将被永远抹去!", p80: "你能抵抗时间侵蚀?但时间终将战胜一切!", p60: "时间线...在分裂...你在创造悖论!", p40: "停止!时间会崩溃,过去现在未来将混为一体!", p20: "我看到了...时间的尽头...", p1: "时间...要抛弃我了...", kill: "时间...永远...流动...", effectiveAttack: "哟哟哟,挺能耐啊你小子,居然能在时间流里精准地给我来这么一下?" }, { // 8. 命运编织者 first: "你的命运之线已在我手中,接受注定的终结吧!", p80: "你在试图改变命运?但命运不可违逆!", p60: "命运之网...在震颤...你在撕裂因果!", p40: "住手!命运的混乱会波及所有存在!", p20: "我看到了...自己的终结之线...", p1: "命运...为何如此残酷...", kill: "命运...自有...安排...", effectiveAttack: "哎呀呀,这根命运之线怎么突然变得这么扎手?你动了什么手脚?" }, { // 9. 轮回掌控者 first: "六道轮回由我主宰,你的灵魂将永世不得超生!", p80: "你在挑战轮回法则?但轮回不可违抗!", p60: "轮回之环...在破碎...你在破坏平衡!", p40: "停止!轮回停滞,万物将无法往生!", p20: "我看到了...自己的轮回终点...", p1: "轮回...要抛弃我了吗...", kill: "轮回...永不停歇...", effectiveAttack: "嗯?轮回之轮居然卡了一下...你这凡人有点门道。" }, { // 10. 元素支配者 first: "四大元素听我号令!在我的怒火中化为灰烬吧!", p80: "你能操控元素?但在元素之主面前只是儿戏!", p60: "元素...在失控...这不可能!", p40: "住手!元素暴走会毁灭整个位面!", p20: "元素...在离我而去...", p1: "我...要回归原始元素了吗...", kill: "元素...永恒...不灭...", effectiveAttack: "哇靠!火烫水冷风割土压同时来?你小子玩元素玩得挺花啊!" }, { // 11. 灵魂收割者 first: "你的灵魂已列入我的收割名单,接受永恒的安息吧!", p80: "你在抗拒死亡?但死亡是万物的终点!", p60: "死亡法则...在动摇...你在挑战终极真理!", p40: "停止!生死界限模糊,亡者将重返人间!", p20: "我看到了...自己的死亡时刻...", p1: "死亡...也要收割我吗...", kill: "死亡...是另一种...开始...", effectiveAttack: "啧,镰刀柄居然震得我手麻...几万年没遇到过这种事了。" }, { // 12. 黑暗主宰 first: "在绝对的黑暗面前,你的光芒只是昙花一现!", p80: "你的光芒竟能照亮黑暗?但黑暗终将回归!", p60: "黑暗...在退散...这违背了宇宙本质!", p40: "住手!完全的光明会破坏宇宙平衡!", p20: "我感受到了...光的温暖...和恐惧...", p1: "黑暗...要永远离开我了吗...", kill: "黑暗...永不...消逝...", effectiveAttack: "光?不,这比光更刺眼!是什么在灼烧我的本质?" }, { // 13. 光明毁灭者 first: "过度的光明需要净化,在我的手中重归平衡吧!", p80: "你的光芒很耀眼,但我会让它永远熄灭!", p60: "光暗平衡...在崩溃...你在创造极端!", p40: "停止!纯粹的光明会灼伤宇宙本身!", p20: "我看到了...过于耀眼的光芒...", p1: "光明...也要毁灭我吗...", kill: "平衡...终将...重建...", effectiveAttack: "哦?有点意思...这光芒中居然带着让我都感到刺痛的纯粹。" }, { // 14. 永恒梦魇 first: "欢迎来到永恒的噩梦,你的恐惧将是我的食粮!", p80: "你在抵抗恐惧?但恐惧是生命的本质!", p60: "噩梦...在消散...你在唤醒希望!", p40: "住手!希望会破坏噩梦的永恒!", p20: "我看到了...梦醒时分...", p1: "永恒...也有终结吗...", kill: "梦境...永不...终结...", effectiveAttack: "做噩梦的人反过来吓到了噩梦?真有趣!" }, { // 15. 维度撕裂者 first: "维度的屏障在我面前如同薄纸,接受多维度的撕裂吧!", p80: "你能稳定维度?但在维度之主面前只是徒劳!", p60: "维度结构...在崩溃...你在创造混乱!", p40: "停止!维度融合会湮灭所有存在!", p20: "我看到了...维度的尽头...", p1: "维度...要抛弃我了吗...", kill: "维度...无限...延伸...", effectiveAttack: "哎哟我去!这维度锚定得够结实啊,差点闪了我的维度腰!" }, { // 16. 法则破坏者 first: "宇宙的法则由我改写,你的存在将被重新定义!", p80: "你在维护法则?但法则本就是用来打破的!", p60: "基本法则...在重构...你在创造新秩序!", p40: "住手!法则崩溃会导致现实解体!", p20: "我看到了...法则的真相...", p1: "法则...也要约束我吗...", kill: "法则...自有...其道...", effectiveAttack: "哈!用我教你的招式来对付我?小子学得挺快嘛!" }, { // 17. 真理篡改者 first: "所谓的真理只是谎言,让我为你揭示真正的现实!", p80: "你在追寻真理?但真理从不唯一!", p60: "真理基础...在动摇...你在发现真相!", p40: "停止!真理混乱会让人失去方向!", p20: "我看到了...最终的真理...", p1: "真理...也要否定我吗...", kill: "真理...永远...存在...", effectiveAttack: "等等,这个'事实'我怎么篡改不了?你从哪里找来的这种东西?" }, { // 18. 现实扭曲者 first: "现实只是可塑的泥土,让我为你重塑这个世界!", p80: "你在稳定现实?但现实本就脆弱!", p60: "现实结构...在固化...你在加强存在!", p40: "住手!现实过于稳定会限制可能性!", p20: "我看到了...现实的本质...", p1: "现实...也要排斥我吗...", kill: "现实...永远...变化...", effectiveAttack: "哇哦,这块'现实'怎么像混凝土一样硬?你加了什么料?" }, { // 19. 因果律者 first: "因果之网由我编织,你的每一个选择都在我的计算中!", p80: "你在试图改变因果?但因果不可违逆!", p60: "因果链条...在断裂...你在创造奇迹!", p40: "停止!因果混乱会导致时间线崩溃!", p20: "我看到了...自己的因果终点...", p1: "因果...也要审判我吗...", kill: "因果...循环...不息...", effectiveAttack: "奇了怪了,这根因果线怎么自己打结了?你小子运气挺好嘛。" }, { // 20. 概念吞噬者 first: "概念只是我的食粮,让我吞噬你存在的意义!", p80: "你在守护概念?但概念本就虚无!", p60: "概念层面...在稳定...你在定义存在!", p40: "住手!概念固化会限制思想自由!", p20: "我看到了...概念的源头...", p1: "概念...也要吞噬我吗...", kill: "概念...永远...新生...", effectiveAttack: "这个概念怎么卡在喉咙里咽不下去?" }, { // 21. 存在抹除者 first: "存在与否由我决定,让我将你从现实中彻底抹除!", p80: "你在证明存在?但存在本就可疑!", p60: "存在根基...在加强...你在确认实在!", p40: "停止!存在绝对化会否定可能性!", p20: "我看到了...存在的边界...", p1: "存在...也要否定我吗...", kill: "存在...自有...其理...", effectiveAttack: "嗯?这块'存在'怎么像牛皮糖一样甩不掉?" }, { // 22. 无限维度之主 first: "无限维度任我遨游,你只是其中一个微不足道的点!", p80: "你在探索维度?但维度无限无尽!", p60: "维度结构...在融合...你在发现统一!", p40: "停止!维度统一会丧失多样性!", p20: "我看到了...维度的统一场...", p1: "维度...也要限制我吗...", kill: "维度...永远...多元...", effectiveAttack: "哎呀,差点从维度滑梯上摔下来!你这维度锚抛得够准的啊。" }, { // 23. 多元宇宙之心 first: "多元宇宙因我而跳动,你的世界只是其中一个心跳!", p80: "你在守护宇宙?但宇宙生生灭灭!", p60: "宇宙韵律...在改变...你在创造新节奏!", p40: "停止!韵律改变会导致宇宙失衡!", p20: "我听到了...宇宙的最终心跳...", p1: "宇宙...也要停止心跳了吗...", kill: "宇宙...永远...搏动...", effectiveAttack: "谁在给我的宇宙打拍子?这节奏好陌生!" }, { // 24. 创世之影 first: "创造伴随毁灭,我是创世过程中不可避免的阴影!", p80: "你在追求纯粹创造?但毁灭是创造的影子!", p60: "创造过程...在净化...你在消除阴影!", p40: "住手!没有阴影的光明会让人盲目!", p20: "我看到了...纯粹的创造之光...", p1: "阴影...也要被照亮了吗...", kill: "光影...永远...相随...", effectiveAttack: "嘶——这光烫得跟创世第一天似的!你从哪儿搞来的原始之光?" }, { // 25. 灭世之源 first: "终结是万物的归宿,让我引导你走向命定的终点!", p80: "你在抗拒终结?但终结不可避免!", p60: "终结进程...在延缓...你在延长存在!", p40: "停止!存在过长会违背宇宙循环!", p20: "我看到了...永恒的可能性...", p1: "终结...也要终结了吗...", kill: "循环...永不停息...", effectiveAttack: "嗯?这条终结之路怎么突然长出了鲜花?你做了什么?" }, { // 26. 原初混沌 first: "在秩序诞生之前我已存在,让我带你回归原始混沌!", p80: "你在建立秩序?但秩序只是混沌的短暂稳定!", p60: "混沌本质...在秩序化...你在创造结构!", p40: "住手!过度秩序会扼杀可能性!", p20: "我看到了...秩序的美丽...", p1: "混沌...也要被驯服了吗...", kill: "混沌...永远...潜在...", effectiveAttack: "这整齐的攻击是怎么回事?一点都不混沌!" }, { // 27. 终焉使者 first: "我宣告万物的终结,你的时间已经到了尽头!", p80: "你在拖延时间?但时间总有终点!", p60: "时间尽头...在延后...你在改变命运!", p40: "停止!时间无限延伸会失去意义!", p20: "我看到了...时间的永恒...", p1: "终结...也要被终结了吗...", kill: "时间...自有...其终...", effectiveAttack: "诶?我的终焉号角怎么吹不出声了?你塞了什么东西?" }, { // 28. 虚无君主 first: "虚无才是终极现实,让我带你体验绝对的空无!", p80: "你在追求存在?但存在只是虚无的幻影!", p60: "虚无领域...在被填充...你在确认实在!", p40: "住手!绝对实相会否定虚无价值!", p20: "我看到了...存在的充实...", p1: "虚无...也要被填满了吗...", kill: "有无...相生...相克...", effectiveAttack: "虚无中竟有实体的触感?" }, { // 29. 永恒寂静 first: "在永恒的寂静中,一切声音都将消失,包括你的存在!", p80: "你在制造声音?但寂静终将回归!", p60: "寂静本质...被打破...你在创造韵律!", p40: "停止!永恒韵律会破坏寂静之美!", p20: "我听到了...宇宙的交响乐...", p1: "寂静...也要被打破了吗...", kill: "动静...互为...根本...", effectiveAttack: "谁在打破我的寂静?" }, { // 30. 超脱者 first: "我已超越一切限制,你的努力在我眼中只是孩童嬉戏!", p80: "你在追求超越?但超越永无止境!", p60: "超越境界...在被理解...你在接近真相!", p40: "住手!完全理解会丧失神秘!", p20: "我看到了...理解的边界...", p1: "超脱...也要被理解了吗...", kill: "境界...永远...提升...", effectiveAttack: "呵...有趣。站在山顶太久,都忘了山脚下还有能扔石头上来的。" }, { // 31. 至高意志 first: "宇宙按照我的意志运转,你的反抗只是徒劳!", p80: "你在发展自主意志?但意志需要统一!", p60: "意志统一...在分裂...你在追求自由!", p40: "停止!绝对自由会导致混乱!", p20: "我看到了...自由的价值...", p1: "意志...也要被尊重了吗...", kill: "意志...永远...多样...", effectiveAttack: "嗯?这个'不'字是从哪儿冒出来的?我的宇宙字典里没有这个词。" }, { // 32. 绝对存在 first: "我定义了存在本身,你的存在因我而确认!", p80: "你在探索存在意义?但存在无需意义!", p60: "存在本质...在被质疑...你在追寻真理!", p40: "住手!过度质疑会否定存在价值!", p20: "我看到了...存在的意义...", p1: "存在...也要被重新定义了吗...", kill: "存在...自有...其义...", effectiveAttack: "等等,这个'可能存在'是什么东西?我的定义集里没有这个条目。" }, { // 33. 无限可能 first: "我包含所有可能性,你的每一个选择都在我的预料中!", p80: "你在创造新可能?但可能性无限!", p60: "可能性海...在被探索...你在发现新路!", p40: "停止!道路过多会让人迷失!", p20: "我看到了...选择的智慧...", p1: "可能...也要被限制了吗...", kill: "可能...永远...无限...", effectiveAttack: "哇哦,这条可能性分支我之前还真没看到过!你是怎么找到的?" }, { // 34. 万物归一者 first: "万物终将归于一体,让我带你提前体验这终极融合!", p80: "你在保持独立?但独立只是幻觉!", p60: "融合进程...在被抵抗...你在维护个性!", p40: "停止!过度个性会阻碍统一!", p20: "我看到了...个体的价值...", p1: "统一...也要被质疑了吗...", kill: "一多...相即...相入...", effectiveAttack: "咦?这块碎片怎么融不进去?你的'个性'还挺顽固嘛。" }, { // 35. 全知全能者 first: "我知晓一切可能,你的每一个念头都在我的预知中!", p80: "你在寻求知识?但知识永无止境!", p60: "知识体系...在被超越...你在发现未知!", p40: "停止!未知过多会带来恐惧!", p20: "我看到了...无知的智慧...", p1: "全知...也要被超越了吗...", kill: "知与不知...互为...边界...", effectiveAttack: "等等,这本书的最后一页我怎么从来没读过?你从哪儿翻出来的?" }, { // 36. 无上至尊 first: "在我面前,一切等级都不存在,因为我是超越等级的存在!", p80: "你在建立秩序?但秩序需要等级!", p60: "等级观念...在被打破...你在追求平等!", p40: "停止!绝对平等会丧失效率!", p20: "我看到了...平等的价值...", p1: "至尊...也要被平等对待了吗...", kill: "等级平等...各有...其用...", effectiveAttack: "哟,这小拳头打得还挺疼。看来'至高无上'也得偶尔低头看看脚下啊。" }, { // 37. 终极真理 first: "我掌握宇宙的最终答案,你的疑问在我面前毫无意义!", p80: "你在追寻真理?但真理不可言说!", p60: "真理本质...在被表述...你在接近答案!", p40: "停止!完全表述会丧失深度!", p20: "我看到了...沉默的智慧...", p1: "真理...也要被表达了吗...", kill: "真理...永远...深邃...", effectiveAttack: "嗯?这个问题的答案我怎么从来没想过?你提出了个好问题。" }, { // 38. 大道本源 first: "我是一切法则的源头,你的道在我面前只是微末支流!", p80: "你在修炼己道?但万道归源!", p60: "大道根源...在被分流...你在开辟新途!", p40: "住手!道路过多会让人迷失根本!", p20: "我看到了...万道的光芒...", p1: "本源...也要被超越了吗...", kill: "道...生一...生万物...", effectiveAttack: "哎哟,这条新岔路是什么时候冒出来的?差点撞到我的本源之树。" }, { // 39. 宇宙意识 first: "我是宇宙的自我意识,你的存在只是我的一个念头!", p80: "你在发展自我意识?但意识需要统一!", p60: "意识统一...在分裂...你在追求独立!", p40: "停止!意识分裂会导致混乱!", p20: "我看到了...独立意识的价值...", p1: "宇宙...也要尊重个体了吗...", kill: "意识...永远...多样...", effectiveAttack: "哇,这个脑内小剧场挺精彩啊!我都没想到还能这样思考。" }, { // 40. 超维绝对存在 first: "维度在我掌中流转。", p80: "多元宇宙皆为虚影。", p60: "时间之河倒流逆行。", p40: "现实结构开始崩解。", p20: "存在本质显现真容。", p1: "一切概念归于虚无。", kill: "超脱即是终结。", effectiveAttack: "绝对存在感受到相对冲击。" } ];

    // 税收预扣率表
    const taxRates = [
        { min: 0, max: 36000, rate: 0.03, deduction: 0 },
        { min: 36000, max: 144000, rate: 0.10, deduction: 2520 },
        { min: 144000, max: 300000, rate: 0.20, deduction: 16920 },
        { min: 300000, max: 420000, rate: 0.25, deduction: 31920 },
        { min: 420000, max: 660000, rate: 0.30, deduction: 52920 },
        { min: 660000, max: 960000, rate: 0.35, deduction: 85920 },
        { min: 960000, max: Infinity, rate: 0.45, deduction: 181920 }
    ];

    // 游戏状态
    let gameState = {
        currentBoss: 0,
        bossCurrentHealth: [...bossHealth],
        todayAttacks: 0,
        todayIncome: 0,
        todayDamage: 0,
        totalSavings: 0, // 累计存款(只包含有效攻击的收入-对应税收)
        totalTax: 0,
        cumulativeIncome: 0, // 累计总收入(包含所有攻击)
        cumulativeValidIncome: 0, // 累计有效收入(只包含有效攻击)
        currentMonthIncome: 0, // 当月累计收入
        lastAttackMonth: null, // 记录上次攻击的月份
        dailyBudget: 104,
        weaponIndex: -1, // -1表示初始武器
        bossImages: [],
        // 新增字段:锁定状态
        savingsLocked: true,
        taxLocked: true,
        // 新增字段:BOSS击败状态
        bossDefeated: false,
        defeatTimer: null,
        // 新增字段:记录是否已触发各阶段对话
        dialogTriggers: Array(41).fill().map(() => ({
            first: false,
            p80: false,
            p60: false,
            p40: false,
            p20: false,
            p1: false,
            effectiveAttack: false
        })),
        //  gameState 对象中添加这个属性

cardFlipped: false, flipStartTime: null, flipTimer: null // 新增:用于存储翻转定时器 };

    // 格式化数字显示函数
    function formatNumber(num) {
        // 将数字转换为字符串,保留两位小数
        let numStr = parseFloat(num).toFixed(2);
        
        // 如果小数点后都是0,则只显示整数部分
        if (numStr.endsWith('.00')) {
            return numStr.split('.')[0];
        }
        
        // 如果小数点后最后一位是0,则去掉这个0
        if (numStr.endsWith('0')) {
            numStr = numStr.slice(0, -1);
        }
        
        return numStr;
    }

    // 根据血量百分比获取血条颜色(纯色版)

function getHealthBarColor(healthPercent) { if (healthPercent > 66) { return "#7F0B00"; // 深红色 } else if (healthPercent > 33) { return "#B03A2E"; // 红褐色 } else { return "#E74C3C"; // 鲜红色 } }

    // 屏幕震动特效
    function triggerScreenShake() {
        const body = document.body;
        body.classList.add('shaking');
        setTimeout(() => {
            body.classList.remove('shaking');
        }, 500);
    }

    // 初始化游戏
    function initGame() {
        // 从本地存储加载游戏状态

const savedState = localStorage.getItem('bossRushGameState'); if (savedState) { const parsedState = JSON.parse(savedState); // 确保新添加的字段有默认值 gameState = { ...gameState, ...parsedState, // 确保新增字段有默认值 cumulativeValidIncome: parsedState.cumulativeValidIncome || 0, bossImages: parsedState.bossImages || [] };

// 确保dialogTriggers数组长度正确
if (!gameState.dialogTriggers || gameState.dialogTriggers.length !== 41) {
    gameState.dialogTriggers = Array(41).fill().map(() => ({
        first: false,
        p80: false,
        p60: false,
        p40: false,
        p20: false,
        p1: false,
        effectiveAttack: false
    }));
}

}

        // 检查并重置每日数据和月份数据
        checkAndResetData();
        
        // 更新UI
        updateStats();
        renderBossLevels();
        updateAttackButton();
        updateFinanceStats();
        
        // 更新累计收入显示

document.getElementById('actual-income').textContent = formatNumber(gameState.cumulativeIncome);

// 替换 initGame 函数中的整个卡片状态检查部分 // 检查卡片是否需要保持翻转 if (gameState.cardFlipped && gameState.flipStartTime) { const now = Date.now(); const elapsed = now - gameState.flipStartTime; const flipDuration = 30000; // 30秒

if (elapsed < flipDuration) {
    // 如果还在30秒内,显示背面并设置剩余时间的定时器
    document.getElementById('card-inner').classList.add('flipped');
    const remaining = flipDuration - elapsed;
    
    // 清除可能存在的旧定时器
    if (gameState.flipTimer) {
        clearTimeout(gameState.flipTimer);
    }
    
    // 设置新的定时器
    gameState.flipTimer = setTimeout(() => {
        document.getElementById('card-inner').classList.remove('flipped');
        gameState.cardFlipped = false;
        gameState.flipStartTime = null;
        gameState.flipTimer = null;
        
        // 新增:如果当前BOSS处于击杀状态,立即切换到下一个BOSS
        if (gameState.bossDefeated) {
            // 清除之前的击杀定时器(如果有)
            if (gameState.defeatTimer) {
                clearTimeout(gameState.defeatTimer);
                gameState.defeatTimer = null;
            }
            
            // 切换到下一个BOSS
            gameState.currentBoss++;
            
            // 检查游戏是否结束
            if (gameState.currentBoss >= bossNames.length) {
                alert('恭喜!您已击杀所有BOSS,游戏通关!');
                gameState.currentBoss = bossNames.length - 1;
            } else {
                // 重置下一个BOSS的血量为满血
                gameState.bossCurrentHealth[gameState.currentBoss] = bossHealth[gameState.currentBoss];
                // 重置对话触发器
                gameState.dialogTriggers[gameState.currentBoss] = {
                    first: false,
                    p80: false,
                    p60: false,
                    p40: false,
                    p20: false,
                    p1: false,
                    effectiveAttack: false
                };
            }
            
            // 重置BOSS击杀状态
            gameState.bossDefeated = false;
            
            // 更新BOSS图片
            updateBossImage();
            
            // 隐藏击杀信息
            document.getElementById('boss-defeat-info').style.display = 'none';
            
            // 更新UI
            renderBossLevels();
            updateAttackButton();
        }
        
        saveGameState();
    }, remaining);
} else {
    // 如果已经超过30秒,重置状态
    document.getElementById('card-inner').classList.remove('flipped');
    gameState.cardFlipped = false;
    gameState.flipStartTime = null;
    gameState.flipTimer = null;
    
    // 新增:如果已经超时,并且BOSS处于击杀状态,立即切换
    if (gameState.bossDefeated) {
        // 切换到下一个BOSS
        gameState.currentBoss++;
        
        // 检查游戏是否结束
        if (gameState.currentBoss >= bossNames.length) {
            alert('恭喜!您已击杀所有BOSS,游戏通关!');
            gameState.currentBoss = bossNames.length - 1;
        } else {
            // 重置下一个BOSS的血量为满血
            gameState.bossCurrentHealth[gameState.currentBoss] = bossHealth[gameState.currentBoss];
            // 重置对话触发器
            gameState.dialogTriggers[gameState.currentBoss] = {
                first: false,
                p80: false,
                p60: false,
                p40: false,
                p20: false,
                p1: false,
                effectiveAttack: false
            };
        }
        
        // 重置BOSS击杀状态
        gameState.bossDefeated = false;
        
        // 更新BOSS图片
        updateBossImage();
        
        // 隐藏击杀信息
        document.getElementById('boss-defeat-info').style.display = 'none';
        
        // 更新UI
        renderBossLevels();
        updateAttackButton();
    }
    
    saveGameState();
}

} else { // 如果没有翻转状态,确保卡片是正面 document.getElementById('card-inner').classList.remove('flipped'); }

        // 加载BOSS图片

loadBossImages();

// 初始化时检查已上传的图片,给对应的输入框添加绿色样式 if (gameState.bossImages) { document.querySelectorAll('.boss-single-image').forEach(input => { const bossIndex = parseInt(input.getAttribute('data-boss-index')); if (gameState.bossImages[bossIndex]) { input.classList.add('uploaded'); } }); }

// 初始化时更新BOSS图片 updateBossImage();

// 检查当前BOSS是否处于被击杀状态,如果是则显示击杀信息 if (gameState.bossDefeated) { showBossDefeatInfo(); }

// 新增:键盘交互功能 document.getElementById('income-input').addEventListener('keydown', function(event) { if (event.key === 'Enter') { document.getElementById('attack-btn').click(); this.blur(); // 新增:让输入框失去焦点,隐藏键盘 } });

document.getElementById('daily-budget').addEventListener('keydown', function(event) { if (event.key === 'Enter') { document.getElementById('save-settings').click(); // 设置里的输入框不需要blur,因为alert会自动隐藏键盘 } });

        // 设置事件监听器
        document.getElementById('attack-btn').addEventListener('click', handleAttack);
        document.getElementById('lock-icon').addEventListener('click', toggleLock);
        document.getElementById('save-settings').addEventListener('click', saveSettings);
        // 为每个BOSS图片上传框添加事件监听

document.querySelectorAll('.boss-single-image').forEach(input => { input.addEventListener('change', handleSingleImageUpload); }); document.getElementById('settings-btn').addEventListener('click', showSettingsModal); document.getElementById('reset-btn').addEventListener('click', resetGame); document.getElementById('savings-lock-icon').addEventListener('click', toggleSavingsLock); document.getElementById('tax-lock-icon').addEventListener('click', toggleTaxLock); document.getElementById('close-description').addEventListener('click', closeBossDescription); document.getElementById('close-settings').addEventListener('click', closeSettingsModal);

        // 设置每日预算输入框
        document.getElementById('daily-budget').value = gameState.dailyBudget;
    }

    // 检查并重置每日数据和月份数据
    function checkAndResetData() {
        const today = new Date().toDateString();
        const lastPlayDate = localStorage.getItem('lastPlayDate');
        
        // 如果是新的一天,重置今日数据
        if (lastPlayDate !== today) {
            gameState.todayAttacks = 0;
            gameState.todayIncome = 0;
            gameState.todayDamage = 0;
            
            // 保存新的日期
            localStorage.setItem('lastPlayDate', today);
            saveGameState();
            
            console.log('新的一天,今日数据已重置');
        }
        
        // 检查月份变化
        const currentDate = new Date();
        const currentMonth = currentDate.getMonth();
        
        // 如果月份变化,重置当月收入
        if (gameState.lastAttackMonth !== null && gameState.lastAttackMonth !== currentMonth) {
            // 跨月时,如果上月累计收入未超过6250元,不产生税收
            const lastMonthTaxableIncome = gameState.currentMonthIncome * (1 - 0.2) - 5000;
            if (lastMonthTaxableIncome <= 0) {
                // 上月未产生税收,直接重置当月收入
                gameState.currentMonthIncome = 0;
                console.log('新月份开始,上月未产生税收,当月收入已重置');
            } else {
                // 上月已产生税收,保留税收记录但重置当月收入
                gameState.currentMonthIncome = 0;
                console.log('新月份开始,当月收入已重置');
            }
            
            gameState.lastAttackMonth = currentMonth;
            saveGameState();
        }
    }

    // 渲染BOSS血条

function renderBossLevels() { const bossLevelsContainer = document.getElementById('boss-levels'); bossLevelsContainer.innerHTML = '';

// 只显示当前BOSS
const i = gameState.currentBoss;
const level = 159 + i;

// 修改:如果血量小于0,显示为0
let displayHealth = gameState.bossCurrentHealth[i];
if (displayHealth < 0) {
    displayHealth = 0;
}
const healthPercent = (displayHealth / bossHealth[i]) * 100;

// 修改:检查是否被击败
const isDefeated = gameState.bossDefeated;

// 根据血量百分比获取血条颜色
const healthBarColor = getHealthBarColor(healthPercent);

const bossCard = document.createElement('div');
bossCard.className = `boss-level-card active`;
bossCard.innerHTML = `
<div class="level-and-name">
    <div class="level-and-boss">
        <div class="level-text" style="${isDefeated ? 'color: #999 !important;' : 'color: #7F0B00;'}">Lv.${level}</div>
        <div class="boss-name" data-boss-index="${i}" style="${isDefeated ? 'color: #999 !important;' : 'color: #7F0B00'}">${bossNames[i]}</div>
    </div>
    <div class="health-numbers">
        ${formatNumber(displayHealth)} / ${formatNumber(bossHealth[i])}
    </div>
</div>
<div class="health-bar-container">
    <div class="health-bar" style="width: ${isDefeated ? 0 : healthPercent}%; background: ${healthBarColor}"></div>
</div>

`;

bossLevelsContainer.appendChild(bossCard);

// 添加BOSS名称点击事件
const bossNameElement = bossCard.querySelector('.boss-name');
bossNameElement.addEventListener('click', () => {
    showBossDescription(i);
});

}

    // 显示BOSS描述
    function showBossDescription(bossIndex) {
        document.getElementById('description-boss-name').textContent = bossNames[bossIndex];
        document.getElementById('description-appearance').textContent = bossAppearances[bossIndex];
        document.getElementById('description-location').textContent = bossLocations[bossIndex];
        document.getElementById('description-background').textContent = bossBackgrounds[bossIndex];
        
        document.getElementById('boss-description-modal').style.display = 'flex';
    }

    // 关闭BOSS描述
    function closeBossDescription() {
        document.getElementById('boss-description-modal').style.display = 'none';
    }

    // 处理攻击
    function handleAttack() {
        const incomeInput = document.getElementById('income-input');
        const income = parseFloat(incomeInput.value);
        const cardInner = document.getElementById('card-inner');
        const currentBossIndex = gameState.currentBoss;
        
        if (isNaN(income) || income <= 0) {
            alert('请输入有效的收入金额!');
            return;
        }
        
        // 更新游戏状态
        gameState.todayAttacks++;
        gameState.todayIncome += income;
        gameState.cumulativeIncome += income; // 所有攻击都计入累计总收入
        
        // 计算税收(所有攻击都要计算税收)
        const tax = calculateTax(income);
        gameState.totalTax += tax;
        
        // 计算伤害
        let damage = 0;
        let isEffectiveAttack = false;
        
        if (gameState.todayIncome > gameState.dailyBudget) {
            // 计算超出预算的部分
            const excessIncome = gameState.todayIncome - gameState.dailyBudget;
            // 如果本次收入大于超出部分,则只计算超出部分
            const effectiveIncome = Math.min(income, excessIncome);
            damage = Math.ceil(effectiveIncome * 999009);
            isEffectiveAttack = true;
        }
        
        gameState.todayDamage += damage;
        
        // 区分无效攻击和有效攻击的对话
        if (isEffectiveAttack) {
            // 有效攻击:BOSS掉血,显示伤害数字,卡片翻转
            gameState.bossCurrentHealth[currentBossIndex] -= damage;
            
            // 只将超出预算的部分计入有效收入
            const excessIncome = gameState.todayIncome - gameState.dailyBudget;
            const effectiveIncome = Math.min(income, excessIncome);
            gameState.cumulativeValidIncome += effectiveIncome;
            
            // 显示伤害数字
            showDamageNumber(damage);
            
            // 检查血量百分比是否在0%到1%之间,如果是则触发屏幕震动
            const healthPercent = (gameState.bossCurrentHealth[currentBossIndex] / bossHealth[currentBossIndex]) * 100;
            if (healthPercent > 0 && healthPercent <= 1) {
                triggerScreenShake();
            }
            
            // 更新累计收入显示

document.getElementById('actual-income').textContent = formatNumber(gameState.cumulativeIncome);

// 翻转卡片 cardInner.classList.add('flipped'); // 记录翻转状态和时间 gameState.cardFlipped = true; gameState.flipStartTime = Date.now();

// 清除可能存在的旧定时器 if (gameState.flipTimer) { clearTimeout(gameState.flipTimer); }

// 30秒后自动翻回 gameState.flipTimer = setTimeout(() => { cardInner.classList.remove('flipped'); gameState.cardFlipped = false; gameState.flipStartTime = null; gameState.flipTimer = null;

// 新增:如果当前BOSS处于击杀状态,立即切换到下一个BOSS
if (gameState.bossDefeated) {
    // 清除之前的击杀定时器(如果有)
    if (gameState.defeatTimer) {
        clearTimeout(gameState.defeatTimer);
        gameState.defeatTimer = null;
    }
    
    // 切换到下一个BOSS
    gameState.currentBoss++;
    
    // 检查游戏是否结束
    if (gameState.currentBoss >= bossNames.length) {
        alert('恭喜!您已击杀所有BOSS,游戏通关!');
        gameState.currentBoss = bossNames.length - 1;
    } else {
        // 重置下一个BOSS的血量为满血
        gameState.bossCurrentHealth[gameState.currentBoss] = bossHealth[gameState.currentBoss];
        // 重置对话触发器
        gameState.dialogTriggers[gameState.currentBoss] = {
            first: false,
            p80: false,
            p60: false,
            p40: false,
            p20: false,
            p1: false,
            effectiveAttack: false
        };
    }
    
    // 重置BOSS击杀状态
    gameState.bossDefeated = false;
    
    // 更新BOSS图片
    updateBossImage();
    
    // 隐藏击杀信息
    document.getElementById('boss-defeat-info').style.display = 'none';
    
    // 更新UI
    renderBossLevels();
    updateAttackButton();
}

saveGameState();

}, 30000); // 30秒 = 30000毫秒

// 立即保存状态 saveGameState();

            // 检查并触发阶段对话
            checkAndTriggerDialogs(currentBossIndex, true);
            
            // 检查BOSS是否被击杀

if (gameState.bossCurrentHealth[currentBossIndex] <= 0) { // 显示击杀宣言 showBossDialog(bossDialogs[currentBossIndex].kill);

// 显示BOSS击杀信息
showBossDefeatInfo();

// 击杀BOSS,获得武器(最后一个BOSS不掉落武器)
if (currentBossIndex < weaponNames.length) {
    gameState.weaponIndex = currentBossIndex;
}

// 设置BOSS击杀状态
gameState.bossDefeated = true;

// 清除之前的定时器(如果有)
if (gameState.defeatTimer) {
    clearTimeout(gameState.defeatTimer);
}

// 设置30秒定时器,然后切换到下一个BOSS
gameState.defeatTimer = setTimeout(() => {
    // 切换到下一个BOSS
    gameState.currentBoss++;
    
    // 检查游戏是否结束
    if (gameState.currentBoss >= bossNames.length) {
        alert('恭喜!您已击杀所有BOSS,游戏通关!');
        gameState.currentBoss = bossNames.length - 1;
    } else {
        // 重置下一个BOSS的血量为满血
        gameState.bossCurrentHealth[gameState.currentBoss] = bossHealth[gameState.currentBoss];
        // 重置对话触发器
        gameState.dialogTriggers[gameState.currentBoss] = {
            first: false,
            p80: false,
            p60: false,
            p40: false,
            p20: false,
            p1: false,
            effectiveAttack: false
        };
    }
    
    // 重置BOSS击杀状态
    gameState.bossDefeated = false;
    
    // 更新BOSS图片
    updateBossImage();
    
    // 隐藏击杀信息
    document.getElementById('boss-defeat-info').style.display = 'none';
    
    // 更新UI
    renderBossLevels();
    updateAttackButton();
    
    // 保存游戏状态
    saveGameState();
}, 30000); // 30秒 = 30000毫秒

} } else { // 无效攻击:显示BOSS首次攻击对话,卡片不翻转 checkAndTriggerDialogs(currentBossIndex, false); }

        // 更新累计收入显示
        document.getElementById('actual-income').textContent = formatNumber(gameState.cumulativeIncome);
        
        // 清空输入框
        incomeInput.value = '';
        
        // 更新UI
        updateStats();
        renderBossLevels();
        updateAttackButton();
        updateFinanceStats();
        
        // 保存游戏状态
        saveGameState();
    }

    // 检查并触发阶段对话
    function checkAndTriggerDialogs(bossIndex, isEffectiveAttack) {
        const healthPercent = (gameState.bossCurrentHealth[bossIndex] / bossHealth[bossIndex]) * 100;
        const triggers = gameState.dialogTriggers[bossIndex];
        
        if (isEffectiveAttack) {
            // 有效攻击:触发有效攻击对话和阶段对话
            if (!triggers.effectiveAttack) {
                showBossDialog(bossDialogs[bossIndex].effectiveAttack);
                triggers.effectiveAttack = true;
            }
            
            // 然后检查阶段对话
            if (healthPercent <= 80 && !triggers.p80) {
                showBossDialog(bossDialogs[bossIndex].p80);
                triggers.p80 = true;
            } else if (healthPercent <= 60 && !triggers.p60) {
                showBossDialog(bossDialogs[bossIndex].p60);
                triggers.p60 = true;
            } else if (healthPercent <= 40 && !triggers.p40) {
                showBossDialog(bossDialogs[bossIndex].p40);
                triggers.p40 = true;
            } else if (healthPercent <= 20 && !triggers.p20) {
                showBossDialog(bossDialogs[bossIndex].p20);
                triggers.p20 = true;
            } else if (healthPercent <= 1 && !triggers.p1) {
                showBossDialog(bossDialogs[bossIndex].p1);
                triggers.p1 = true;
            }
        } else {
            // 无效攻击:只触发first对话
            if (!triggers.first) {
                showBossDialog(bossDialogs[bossIndex].first);
                triggers.first = true;
            }
        }
    }

    // 显示伤害数字 - 修改后的版本
    function showDamageNumber(damage) {
        const damageNumber = document.createElement('div');
        damageNumber.className = 'damage-number';
        damageNumber.textContent = `-${damage}`;
        
        const bossImageArea = document.getElementById('boss-image-area');
        
        // 随机位置,确保在BOSS图片区域内
        const areaRect = bossImageArea.getBoundingClientRect();
        const maxX = areaRect.width - 200; // 留出空间避免超出边界
        const maxY = areaRect.height - 100;
        
        const randomX = Math.random() * maxX;
        const randomY = Math.random() * maxY;
        
        damageNumber.style.left = `${randomX}px`;
        damageNumber.style.top = `${randomY}px`;
        
        bossImageArea.appendChild(damageNumber);
        
        // 30秒后立即移除元素,没有淡化效果
        setTimeout(() => {
            if (damageNumber.parentNode) {
                damageNumber.remove();
            }
        }, 30000); // 30秒 = 30000毫秒
    }

    // 显示BOSS击杀信息
    function showBossDefeatInfo() {
    // 设置BOSS击杀状态
gameState.bossDefeated = true;
    
        // 隐藏BOSS图片和占位符
        document.getElementById('boss-image').style.display = 'none';
        document.getElementById('boss-image-placeholder').style.display = 'none';
        
        // 显示击杀信息
        const defeatInfo = document.getElementById('boss-defeat-info');
        const defeatBossName = document.getElementById('defeat-boss-name');
        const droppedWeaponName = document.getElementById('dropped-weapon-name');
        
        defeatBossName.textContent = bossNames[gameState.currentBoss];
        
        // 设置掉落武器信息
        if (gameState.currentBoss < weaponNames.length) {
            droppedWeaponName.textContent = weaponNames[gameState.currentBoss];
        } else {
            droppedWeaponName.textContent = "无";
        }
        
        defeatInfo.style.display = 'flex';
        
        // 设置BOSS击杀状态
        gameState.bossDefeated = true;
    }

    // 显示BOSS对话框
    function showBossDialog(content) {
        document.getElementById('boss-dialog-content').textContent = content;
        document.getElementById('boss-dialog').style.display = 'block';
        
        // 30秒后自动关闭对话框
        setTimeout(() => {
            closeBossDialog();
        }, 30000); // 30秒 = 30000毫秒
    }

    // 关闭BOSS对话框
    function closeBossDialog() {
        document.getElementById('boss-dialog').style.display = 'none';
    }

    // 计算税收(按月独立计算,正确的个税计算)
    function calculateTax(income) {
        // 获取当前月份
        const currentDate = new Date();
        const currentMonth = currentDate.getMonth();
        
        // 如果月份变化,重置当月收入
        if (gameState.lastAttackMonth !== null && gameState.lastAttackMonth !== currentMonth) {
            // 跨月时,如果上月累计收入未超过6250元,不产生税收
            const lastMonthTaxableIncome = gameState.currentMonthIncome * (1 - 0.2) - 5000;
            if (lastMonthTaxableIncome <= 0) {
                // 上月未产生税收,直接重置当月收入
                gameState.currentMonthIncome = 0;
            } else {
                // 上月已产生税收,保留税收记录但重置当月收入
                gameState.currentMonthIncome = 0;
            }
        }
        
        // 更新累计月份记录
        gameState.lastAttackMonth = currentMonth;
        
        // 保存旧的当月收入用于计算
        const oldMonthIncome = gameState.currentMonthIncome;
        
        // 更新当月收入
        gameState.currentMonthIncome += income;
        
        // 计算旧税收(基于旧当月收入)
        const oldTaxableIncome = oldMonthIncome * (1 - 0.2) - 5000;
        let oldTax = 0;
        if (oldTaxableIncome > 0) {
            for (const rate of taxRates) {
                if (oldTaxableIncome > rate.min && oldTaxableIncome <= rate.max) {
                    oldTax = oldTaxableIncome * rate.rate - rate.deduction;
                    break;
                }
            }
        }
        
        // 计算新税收(基于新当月收入)
        const newTaxableIncome = gameState.currentMonthIncome * (1 - 0.2) - 5000;
        let newTax = 0;
        if (newTaxableIncome > 0) {
            for (const rate of taxRates) {
                if (newTaxableIncome > rate.min && newTaxableIncome <= rate.max) {
                    newTax = newTaxableIncome * rate.rate - rate.deduction;
                    break;
                }
            }
        }
        
        // 本次税收 = 新税收 - 旧税收
        const taxThisTime = newTax - oldTax;
        
        return Math.max(taxThisTime, 0); // 确保不为负数
    }

    // 更新统计信息
    function updateStats() {
        document.getElementById('today-attacks').textContent = gameState.todayAttacks;
        document.getElementById('today-income').textContent = formatNumber(gameState.todayIncome);
        document.getElementById('today-damage').textContent = gameState.todayDamage.toString();
    }

    // 更新攻击按钮
    function updateAttackButton() {
        const weaponName = gameState.weaponIndex >= 0 ? weaponNames[gameState.weaponIndex] : '初始武器';
        document.getElementById('weapon-name').textContent = weaponName;
        document.getElementById('current-weapon').textContent = weaponName;
    }

    // 更新财务统计 - 修复版本
    function updateFinanceStats() {
        // 计算累计存款:累计有效收入 - 累计税收
        // 注意:这里使用累计有效收入,而不是累计总收入
        const totalSavings = gameState.cumulativeValidIncome - gameState.totalTax;
        
        // 更新累计存款显示
        const hiddenSavings = document.getElementById('hidden-savings');
        const actualSavings = document.getElementById('actual-savings');
        const savingsLockIcon = document.getElementById('savings-lock-icon');
        
        actualSavings.textContent = formatNumber(totalSavings);
        
        if (gameState.savingsLocked) {
            hiddenSavings.style.display = 'inline';
            actualSavings.style.display = 'none';
            savingsLockIcon.textContent = '🔒';
        } else {
            hiddenSavings.style.display = 'none';
            actualSavings.style.display = 'inline';
            savingsLockIcon.textContent = '🔓';
        }
        
        // 更新累计税收显示
        const hiddenTax = document.getElementById('hidden-tax');
        const actualTax = document.getElementById('actual-tax');
        const taxLockIcon = document.getElementById('tax-lock-icon');
        
        actualTax.textContent = formatNumber(gameState.totalTax);
        
        if (gameState.taxLocked) {
            hiddenTax.style.display = 'inline';
            actualTax.style.display = 'none';
            taxLockIcon.textContent = '🔒';
        } else {
            hiddenTax.style.display = 'none';
            actualTax.style.display = 'inline';
            taxLockIcon.textContent = '🔓';
        }
    }

    // 切换锁定状态
    function toggleLock() {
        const lockIcon = document.getElementById('lock-icon');
        const hiddenIncome = document.getElementById('hidden-income');
        const actualIncome = document.getElementById('actual-income');
        
        if (lockIcon.textContent === '🔒') {
            lockIcon.textContent = '🔓';
            hiddenIncome.style.display = 'none';
            actualIncome.style.display = 'inline';
        } else {
            lockIcon.textContent = '🔒';
            hiddenIncome.style.display = 'inline';
            actualIncome.style.display = 'none';
        }
    }

    // 切换累计存款锁定状态
    function toggleSavingsLock() {
        gameState.savingsLocked = !gameState.savingsLocked;
        updateFinanceStats();
        saveGameState();
    }

    // 切换累计税收锁定状态
    function toggleTaxLock() {
        gameState.taxLocked = !gameState.taxLocked;
        updateFinanceStats();
        saveGameState();
    }

    // 显示设置模态框
    function showSettingsModal() {
        document.getElementById('settings-modal').style.display = 'flex';
    }

    // 关闭设置模态框
    function closeSettingsModal() {
        document.getElementById('settings-modal').style.display = 'none';
    }

    // 保存设置
    function saveSettings() {
        const dailyBudget = parseFloat(document.getElementById('daily-budget').value);
        
        if (isNaN(dailyBudget) || dailyBudget < 0) {
            alert('请输入有效的每日预算!');
            return;
        }
        
        gameState.dailyBudget = dailyBudget;
        saveGameState();
        alert('设置已保存!');
        
        // 隐藏设置面板
        closeSettingsModal();
    }

    // 重置游戏

function resetGame() { if (confirm('确定要重置游戏吗?所有进度将丢失!')) { // 清除定时器 if (gameState.defeatTimer) { clearTimeout(gameState.defeatTimer); } // 新增:清除翻转定时器 if (gameState.flipTimer) { clearTimeout(gameState.flipTimer); gameState.flipTimer = null; }

    // 保存当前的BOSS图片,确保重置游戏不丢失图片
    const currentBossImages = gameState.bossImages || [];
    
    // 重置游戏状态(但保留BOSS图片)
    gameState = {
        currentBoss: 0,
        bossCurrentHealth: [...bossHealth],
        todayAttacks: 0,
        todayIncome: 0,
        todayDamage: 0,
        totalSavings: 0,
        totalTax: 0,
        cumulativeIncome: 0,
        cumulativeValidIncome: 0,
        currentMonthIncome: 0,
        lastAttackMonth: null,
        dailyBudget: 104,
        weaponIndex: -1,
        bossImages: currentBossImages, // 保留图片
        savingsLocked: true,
        taxLocked: true,
        bossDefeated: false,
        defeatTimer: null,
        dialogTriggers: Array(41).fill().map(() => ({
            first: false,
            p80: false,
            p60: false,
            p40: false,
            p20: false,
            p1: false,
            effectiveAttack: false
        })),
        cardFlipped: false,

flipStartTime: null, };

    // 更新UI
    updateStats();
    renderBossLevels();
    updateAttackButton();
    updateFinanceStats();
    
    // 清空输入框
    document.getElementById('income-input').value = '';
    document.getElementById('daily-budget').value = gameState.dailyBudget;
    
    // 重置卡片状态
    document.getElementById('card-inner').classList.remove('flipped');
    
    // 更新BOSS图片
    updateBossImage();
    
    // 保存游戏状态
    saveGameState();
    
    alert('游戏已重置!');
}

}

    // 处理图片上传
    function handleImageUpload(event) {
        const files = event.target.files;
        if (files.length !== 41) {
            alert('请上传正好41张BOSS图片!');
            return;
        }
        
        gameState.bossImages = [];
        for (let i = 0; i < files.length; i++) {
            const reader = new FileReader();
            reader.onload = (function(index) {
                return function(e) {
                    gameState.bossImages[index] = e.target.result;
                    if (index === gameState.currentBoss && !gameState.bossDefeated) {
                        updateBossImage();
                    }
                };
            })(i);
            reader.readAsDataURL(files[i]);
        }
        
        saveGameState();
    }
    
    function handleSingleImageUpload(event) {
const bossIndex = parseInt(event.target.getAttribute('data-boss-index'));
const file = event.target.files[0];

if (!file) return;

// 检查文件类型
if (!file.type.startsWith('image/')) {
    alert('请上传图片文件!');
    return;
}

const reader = new FileReader();
reader.onload = function(e) {
    // 确保bossImages数组存在
    if (!gameState.bossImages) {
        gameState.bossImages = [];
    }
    
    gameState.bossImages[bossIndex] = e.target.result;
    
    // 给上传成功的输入框添加绿色样式
    event.target.classList.add('uploaded');
    
    // 如果当前BOSS是这个索引,并且没有被击败,则更新图片
    if (gameState.currentBoss === bossIndex && !gameState.bossDefeated) {
        updateBossImage();
    }
    
    // 保存到localStorage
    saveGameState();
    
    alert(`BOSS${bossIndex + 1}图片上传成功!`);
};
reader.onerror = function() {
    alert('图片上传失败,请重试!');
};
reader.readAsDataURL(file);

}

    // 更新BOSS图片

function updateBossImage() { const bossImage = document.getElementById('boss-image'); const placeholder = document.getElementById('boss-image-placeholder'); const defeatInfo = document.getElementById('boss-defeat-info');

// 如果BOSS被击杀,显示击杀信息,不显示图片
if (gameState.bossDefeated) {
    bossImage.style.display = 'none';
    placeholder.style.display = 'none';
    defeatInfo.style.display = 'flex';
    return;
}

// 正常状态:显示BOSS图片或占位符
defeatInfo.style.display = 'none';

if (gameState.bossImages && gameState.bossImages[gameState.currentBoss]) {
    bossImage.src = gameState.bossImages[gameState.currentBoss];
    bossImage.style.display = 'block';
    placeholder.style.display = 'none';
} else {
    bossImage.style.display = 'none';
    placeholder.style.display = 'block';
}

}

    // 加载BOSS图片

function loadBossImages() { // 从localStorage加载图片数据 const savedImages = localStorage.getItem('bossRushGameImages'); if (savedImages) { gameState.bossImages = JSON.parse(savedImages); }

// 更新当前BOSS的图片显示
updateBossImage();

}

    // 保存游戏状态

function saveGameState() { localStorage.setItem('bossRushGameState', JSON.stringify(gameState));

// 单独保存BOSS图片到localStorage
if (gameState.bossImages) {
    localStorage.setItem('bossRushGameImages', JSON.stringify(gameState.bossImages));
}

}

    // 初始化游戏
    window.addEventListener('load', initGame);
</script>