Spaces:
Running
Running
File size: 32,861 Bytes
2c1dc0e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>预言契约 | 命运编织者</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;700&display=swap');
body {
font-family: 'Noto Sans JP', sans-serif;
background-color: #f5f0e6;
color: #3a3226;
background-image: url('https://www.transparenttextures.com/patterns/rice-paper.png');
}
.ghibli-bg {
background: linear-gradient(135deg, #e8d8b8 0%, #d4c4a3 100%);
border: 2px solid #8b7d65;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}
.ghibli-card {
background: #fff9e6;
border: 3px solid #8b7d65;
border-radius: 12px;
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
transition: all 0.3s ease;
}
.ghibli-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}
.ghibli-btn {
background: linear-gradient(to bottom, #a38f6a, #8b7d65);
color: white;
border: none;
border-radius: 20px;
padding: 8px 16px;
font-weight: bold;
box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2);
transition: all 0.2s;
}
.ghibli-btn:hover {
background: linear-gradient(to bottom, #8b7d65, #6b5e4a);
transform: translateY(-2px);
}
.ghibli-btn:active {
transform: translateY(1px);
}
.hand-card {
transition: all 0.3s ease;
cursor: pointer;
}
.hand-card:hover {
transform: translateY(-15px) scale(1.05);
z-index: 10;
}
.prophecy-glow {
animation: glow 2s infinite alternate;
}
@keyframes glow {
from {
box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}
to {
box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
}
}
.loan-effect {
position: relative;
overflow: hidden;
}
.loan-effect::after {
content: "";
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: linear-gradient(45deg,
transparent 45%,
rgba(255, 255, 255, 0.8) 50%,
transparent 55%);
background-size: 200% 200%;
animation: shine 2s infinite;
}
@keyframes shine {
0% {
background-position: -100% -100%;
}
100% {
background-position: 100% 100%;
}
}
.fate-point {
width: 24px;
height: 24px;
background: radial-gradient(circle, #ffd700 30%, #daa520 100%);
border-radius: 50%;
display: inline-block;
box-shadow: 0 0 8px #ffd700;
margin: 0 2px;
}
</style>
</head>
<body class="min-h-screen">
<div class="container mx-auto px-4 py-8">
<!-- 游戏标题 -->
<div class="text-center mb-8">
<h1 class="text-4xl font-bold mb-2 text-amber-900">预言契约</h1>
<h2 class="text-2xl text-amber-800">命运编织者</h2>
<div class="flex justify-center mt-4">
<div class="fate-point"></div>
<div class="fate-point"></div>
<div class="fate-point"></div>
</div>
</div>
<!-- 游戏区域 -->
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
<!-- 左侧 - 玩家区域 -->
<div class="ghibli-bg p-6 rounded-lg">
<h3 class="text-xl font-bold mb-4 text-center border-b-2 border-amber-800 pb-2">玩家</h3>
<div class="mb-4">
<div class="flex justify-between items-center mb-2">
<span class="font-bold">生命值: <span id="player-health" class="text-red-600">50</span>/50</span>
<span class="font-bold">命运点数: <span id="player-fate" class="text-amber-600">3</span></span>
</div>
<div class="h-4 bg-gray-200 rounded-full">
<div id="player-health-bar" class="h-4 bg-red-500 rounded-full" style="width: 100%"></div>
</div>
</div>
<div class="mb-4">
<h4 class="font-bold mb-2">当前预言契约</h4>
<div id="player-prophecies" class="space-y-2">
<div class="ghibli-card p-3 prophecy-glow">
<p class="font-bold text-sm">在3回合内造成50点伤害</p>
<p class="text-xs">奖励: 获得5点命运点数</p>
<div class="text-xs mt-1">剩余回合: <span class="font-bold">2</span></div>
</div>
</div>
</div>
<div class="mb-4">
<h4 class="font-bold mb-2">未来贷款</h4>
<div id="player-loans" class="space-y-2">
<div class="ghibli-card p-3 loan-effect">
<p class="font-bold text-sm">提前获得3点命运点数</p>
<p class="text-xs">需在5回合内偿还5点</p>
<div class="text-xs mt-1">剩余回合: <span class="font-bold">4</span></div>
</div>
</div>
</div>
</div>
<!-- 中间 - 游戏主区域 -->
<div class="ghibli-bg p-6 rounded-lg">
<div class="flex justify-between items-center mb-4">
<div class="text-center">
<div class="text-lg font-bold">回合</div>
<div id="turn-counter" class="text-2xl font-bold">1</div>
</div>
<button id="end-turn-btn" class="ghibli-btn px-6 py-2">
<i class="fas fa-hourglass-end mr-2"></i>结束回合
</button>
</div>
<div class="mb-6">
<h4 class="font-bold mb-2 text-center">战斗区域</h4>
<div class="flex justify-center items-center space-x-8">
<div class="text-center">
<div class="ghibli-card w-24 h-36 flex items-center justify-center mx-auto mb-2">
<i class="fas fa-sword text-3xl text-gray-700"></i>
</div>
<div class="text-sm">攻击力: 10</div>
</div>
<div class="text-4xl font-bold text-red-600">VS</div>
<div class="text-center">
<div class="ghibli-card w-24 h-36 flex items-center justify-center mx-auto mb-2">
<i class="fas fa-shield-alt text-3xl text-gray-700"></i>
</div>
<div class="text-sm">防御力: 5</div>
</div>
</div>
</div>
<div class="mb-4">
<h4 class="font-bold mb-2 text-center">战斗日志</h4>
<div id="battle-log" class="ghibli-card p-3 h-32 overflow-y-auto text-sm">
<div class="text-amber-800">游戏开始!</div>
<div class="text-blue-600">你获得了初始预言契约</div>
</div>
</div>
</div>
<!-- 右侧 - 敌人区域 -->
<div class="ghibli-bg p-6 rounded-lg">
<h3 class="text-xl font-bold mb-4 text-center border-b-2 border-amber-800 pb-2">敌人</h3>
<div class="mb-4">
<div class="flex justify-between items-center mb-2">
<span class="font-bold">生命值: <span id="enemy-health" class="text-red-600">80</span>/80</span>
<span class="font-bold">命运点数: <span id="enemy-fate" class="text-amber-600">2</span></span>
</div>
<div class="h-4 bg-gray-200 rounded-full">
<div id="enemy-health-bar" class="h-4 bg-red-500 rounded-full" style="width: 100%"></div>
</div>
</div>
<div class="mb-4">
<h4 class="font-bold mb-2">敌人预言契约</h4>
<div id="enemy-prophecies" class="space-y-2">
<div class="ghibli-card p-3">
<p class="font-bold text-sm">在2回合内不使用防御卡牌</p>
<p class="text-xs">奖励: 获得3点命运点数</p>
<div class="text-xs mt-1">剩余回合: <span class="font-bold">1</span></div>
</div>
</div>
</div>
<div class="mb-4">
<h4 class="font-bold mb-2">敌人意图</h4>
<div class="ghibli-card p-3">
<p class="text-sm">下回合将使用: <span class="font-bold">强力攻击</span></p>
<p class="text-xs">预计伤害: 15</p>
</div>
</div>
</div>
</div>
<!-- 玩家手牌区域 -->
<div class="mt-8 ghibli-bg p-6 rounded-lg">
<h3 class="text-xl font-bold mb-4 text-center border-b-2 border-amber-800 pb-2">你的手牌</h3>
<div class="flex flex-wrap justify-center gap-4" id="player-hand">
<!-- 攻击卡 -->
<div class="ghibli-card w-32 h-48 hand-card relative" onclick="playCard(this)">
<div class="absolute top-2 left-2 w-6 h-6 bg-red-500 rounded-full flex items-center justify-center text-white text-xs font-bold">攻</div>
<div class="p-3 h-full flex flex-col">
<h4 class="font-bold text-center mb-2">火焰斩击</h4>
<p class="text-xs flex-grow">造成10点伤害,有30%几率额外造成5点伤害</p>
<div class="text-xs text-right">消耗: <span class="font-bold">1</span>命运点</div>
</div>
</div>
<!-- 防御卡 -->
<div class="ghibli-card w-32 h-48 hand-card relative" onclick="playCard(this)">
<div class="absolute top-2 left-2 w-6 h-6 bg-blue-500 rounded-full flex items-center justify-center text-white text-xs font-bold">防</div>
<div class="p-3 h-full flex flex-col">
<h4 class="font-bold text-center mb-2">魔法护盾</h4>
<p class="text-xs flex-grow">获得8点护盾,下回合开始时保留50%</p>
<div class="text-xs text-right">消耗: <span class="font-bold">1</span>命运点</div>
</div>
</div>
<!-- 预言卡 -->
<div class="ghibli-card w-32 h-48 hand-card relative" onclick="playCard(this)">
<div class="absolute top-2 left-2 w-6 h-6 bg-purple-500 rounded-full flex items-center justify-center text-white text-xs font-bold">预</div>
<div class="p-3 h-full flex flex-col">
<h4 class="font-bold text-center mb-2">命运预言</h4>
<p class="text-xs flex-grow">创建一个新的预言契约</p>
<div class="text-xs text-right">消耗: <span class="font-bold">2</span>命运点</div>
</div>
</div>
<!-- 贷款卡 -->
<div class="ghibli-card w-32 h-48 hand-card relative" onclick="playCard(this)">
<div class="absolute top-2 left-2 w-6 h-6 bg-green-500 rounded-full flex items-center justify-center text-white text-xs font-bold">贷</div>
<div class="p-3 h-full flex flex-col">
<h4 class="font-bold text-center mb-2">命运贷款</h4>
<p class="text-xs flex-grow">立即获得3命运点,5回合后偿还5点</p>
<div class="text-xs text-right">消耗: <span class="font-bold">0</span>命运点</div>
</div>
</div>
<!-- 篡改卡 -->
<div class="ghibli-card w-32 h-48 hand-card relative" onclick="playCard(this)">
<div class="absolute top-2 left-2 w-6 h-6 bg-yellow-500 rounded-full flex items-center justify-center text-white text-xs font-bold">改</div>
<div class="p-3 h-full flex flex-col">
<h4 class="font-bold text-center mb-2">篡改预言</h4>
<p class="text-xs flex-grow">修改一个预言的条件或奖励</p>
<div class="text-xs text-right">消耗: <span class="font-bold">1</span>命运点</div>
</div>
</div>
</div>
</div>
<!-- 预言创建模态框 -->
<div id="prophecy-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center hidden">
<div class="ghibli-bg p-6 rounded-lg w-full max-w-md">
<h3 class="text-xl font-bold mb-4 text-center">创建预言契约</h3>
<div class="mb-4">
<label class="block font-bold mb-2">预言条件</label>
<select id="prophecy-condition" class="w-full p-2 border border-amber-800 rounded">
<option value="damage">在X回合内造成Y点伤害</option>
<option value="no-potion">在X回合内不使用药水</option>
<option value="no-defense">在X回合内不使用防御卡</option>
<option value="specific-card">在X回合内使用特定卡牌Y次</option>
</select>
</div>
<div class="grid grid-cols-2 gap-4 mb-4">
<div>
<label class="block font-bold mb-2">回合数(X)</label>
<input type="number" id="prophecy-turns" class="w-full p-2 border border-amber-800 rounded" min="1" max="5" value="2">
</div>
<div>
<label class="block font-bold mb-2">数值(Y)</label>
<input type="number" id="prophecy-value" class="w-full p-2 border border-amber-800 rounded" min="1" max="50" value="10">
</div>
</div>
<div class="mb-4">
<label class="block font-bold mb-2">预言奖励</label>
<select id="prophecy-reward" class="w-full p-2 border border-amber-800 rounded">
<option value="fate-points">获得X命运点数</option>
<option value="health">恢复X生命值</option>
<option value="draw-cards">抽X张卡</option>
<option value="copy-card">复制对手最后使用的卡牌</option>
</select>
<input type="number" id="prophecy-reward-value" class="w-full p-2 border border-amber-800 rounded mt-2" min="1" max="10" value="2">
</div>
<div class="flex justify-end space-x-2">
<button onclick="document.getElementById('prophecy-modal').classList.add('hidden')" class="ghibli-btn bg-gray-500">
取消
</button>
<button onclick="createProphecy()" class="ghibli-btn">
创建契约
</button>
</div>
</div>
</div>
<!-- 篡改预言模态框 -->
<div id="modify-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center hidden">
<div class="ghibli-bg p-6 rounded-lg w-full max-w-md">
<h3 class="text-xl font-bold mb-4 text-center">篡改预言</h3>
<div class="mb-4">
<label class="block font-bold mb-2">选择要修改的预言</label>
<select id="prophecy-select" class="w-full p-2 border border-amber-800 rounded">
<option value="0">在3回合内造成50点伤害</option>
</select>
</div>
<div class="mb-4">
<label class="block font-bold mb-2">修改类型</label>
<select id="modify-type" class="w-full p-2 border border-amber-800 rounded">
<option value="condition">修改条件</option>
<option value="reward">修改奖励</option>
<option value="both">同时修改条件和奖励</option>
</select>
</div>
<div id="modify-condition-section" class="mb-4">
<label class="block font-bold mb-2">新条件</label>
<input type="text" id="new-condition" class="w-full p-2 border border-amber-800 rounded" value="在3回合内造成50点伤害">
</div>
<div id="modify-reward-section" class="mb-4">
<label class="block font-bold mb-2">新奖励</label>
<input type="text" id="new-reward" class="w-full p-2 border border-amber-800 rounded" value="获得5点命运点数">
</div>
<div class="flex justify-end space-x-2">
<button onclick="document.getElementById('modify-modal').classList.add('hidden')" class="ghibli-btn bg-gray-500">
取消
</button>
<button onclick="modifyProphecy()" class="ghibli-btn">
篡改预言
</button>
</div>
</div>
</div>
</div>
<script>
// 游戏状态
const gameState = {
turn: 1,
player: {
health: 50,
maxHealth: 50,
fatePoints: 3,
prophecies: [
{
condition: "在3回合内造成50点伤害",
reward: "获得5点命运点数",
turnsLeft: 2,
progress: 0
}
],
loans: [
{
amount: 3,
repayment: 5,
turnsLeft: 4
}
]
},
enemy: {
health: 80,
maxHealth: 80,
fatePoints: 2,
prophecies: [
{
condition: "在2回合内不使用防御卡牌",
reward: "获得3点命运点数",
turnsLeft: 1
}
],
nextAction: "强力攻击",
nextDamage: 15
},
battleLog: [
"游戏开始!",
"你获得了初始预言契约"
]
};
// 更新UI
function updateUI() {
// 更新玩家状态
document.getElementById('player-health').textContent = gameState.player.health;
document.getElementById('player-fate').textContent = gameState.player.fatePoints;
document.getElementById('player-health-bar').style.width = `${(gameState.player.health / gameState.player.maxHealth) * 100}%`;
// 更新敌人状态
document.getElementById('enemy-health').textContent = gameState.enemy.health;
document.getElementById('enemy-fate').textContent = gameState.enemy.fatePoints;
document.getElementById('enemy-health-bar').style.width = `${(gameState.enemy.health / gameState.enemy.maxHealth) * 100}%`;
// 更新回合计数器
document.getElementById('turn-counter').textContent = gameState.turn;
// 更新战斗日志
const battleLogElement = document.getElementById('battle-log');
battleLogElement.innerHTML = gameState.battleLog.map(log => `<div class="text-amber-800">${log}</div>`).join('');
battleLogElement.scrollTop = battleLogElement.scrollHeight;
}
// 播放卡牌
function playCard(cardElement) {
const cardType = cardElement.querySelector('div').textContent;
let message = "";
switch(cardType) {
case "攻":
// 攻击逻辑
const damage = 10 + Math.floor(Math.random() * 6); // 10-15伤害
gameState.enemy.health -= damage;
gameState.player.fatePoints -= 1;
// 更新预言进度
gameState.player.prophecies.forEach(prophecy => {
if (prophecy.condition.includes("造成")) {
prophecy.progress += damage;
}
});
message = `你使用攻击卡牌,造成${damage}点伤害!`;
break;
case "防":
// 防御逻辑
gameState.player.fatePoints -= 1;
message = "你使用防御卡牌,获得了护盾!";
break;
case "预":
// 预言逻辑
if (gameState.player.fatePoints >= 2) {
gameState.player.fatePoints -= 2;
document.getElementById('prophecy-modal').classList.remove('hidden');
message = "你开始编织新的命运预言...";
} else {
message = "命运点数不足,无法创建预言!";
}
break;
case "贷":
// 贷款逻辑
gameState.player.fatePoints += 3;
gameState.player.loans.push({
amount: 3,
repayment: 5,
turnsLeft: 5
});
message = "你向未来借贷了3点命运点数!";
break;
case "改":
// 篡改预言逻辑
if (gameState.player.fatePoints >= 1) {
gameState.player.fatePoints -= 1;
document.getElementById('modify-modal').classList.remove('hidden');
message = "你开始篡改现有的预言...";
} else {
message = "命运点数不足,无法篡改预言!";
}
break;
}
gameState.battleLog.push(message);
updateUI();
}
// 创建预言
function createProphecy() {
const conditionType = document.getElementById('prophecy-condition').value;
const turns = document.getElementById('prophecy-turns').value;
const value = document.getElementById('prophecy-value').value;
const rewardType = document.getElementById('prophecy-reward').value;
const rewardValue = document.getElementById('prophecy-reward-value').value;
let condition = "";
let reward = "";
// 构建条件
switch(conditionType) {
case "damage":
condition = `在${turns}回合内造成${value}点伤害`;
break;
case "no-potion":
condition = `在${turns}回合内不使用药水`;
break;
case "no-defense":
condition = `在${turns}回合内不使用防御卡`;
break;
case "specific-card":
condition = `在${turns}回合内使用特定卡牌${value}次`;
break;
}
// 构建奖励
switch(rewardType) {
case "fate-points":
reward = `获得${rewardValue}点命运点数`;
break;
case "health":
reward = `恢复${rewardValue}生命值`;
break;
case "draw-cards":
reward = `抽${rewardValue}张卡`;
break;
case "copy-card":
reward = `复制对手最后使用的卡牌`;
break;
}
// 添加到玩家预言
gameState.player.prophecies.push({
condition,
reward,
turnsLeft: turns,
progress: 0
});
gameState.battleLog.push(`你创建了新的预言契约: ${condition} → ${reward}`);
document.getElementById('prophecy-modal').classList.add('hidden');
updateUI();
}
// 篡改预言
function modifyProphecy() {
const prophecyIndex = document.getElementById('prophecy-select').selectedIndex;
const modifyType = document.getElementById('modify-type').value;
const newCondition = document.getElementById('new-condition').value;
const newReward = document.getElementById('new-reward').value;
if (prophecyIndex >= 0 && prophecyIndex < gameState.player.prophecies.length) {
const prophecy = gameState.player.prophecies[prophecyIndex];
const oldCondition = prophecy.condition;
const oldReward = prophecy.reward;
if (modifyType === "condition" || modifyType === "both") {
prophecy.condition = newCondition;
}
if (modifyType === "reward" || modifyType === "both") {
prophecy.reward = newReward;
}
gameState.battleLog.push(`你篡改了预言契约:
"${oldCondition} → ${oldReward}"
变为
"${prophecy.condition} → ${prophecy.reward}"`);
}
document.getElementById('modify-modal').classList.add('hidden');
updateUI();
}
// 结束回合
document.getElementById('end-turn-btn').addEventListener('click', function() {
// 敌人行动
const enemyDamage = gameState.enemy.nextDamage;
gameState.player.health -= enemyDamage;
gameState.battleLog.push(`敌人使用${gameState.enemy.nextAction},对你造成${enemyDamage}点伤害!`);
// 更新预言回合数
gameState.player.prophecies.forEach(prophecy => {
prophecy.turnsLeft -= 1;
// 检查预言是否完成
if (prophecy.condition.includes("造成") && prophecy.progress >= parseInt(prophecy.condition.match(/\d+/)[0])) {
gameState.battleLog.push(`你完成了预言"${prophecy.condition}",获得奖励: ${prophecy.reward}`);
// 处理奖励
if (prophecy.reward.includes("命运点数")) {
const points = parseInt(prophecy.reward.match(/\d+/)[0]);
gameState.player.fatePoints += points;
}
// 移除完成的预言
gameState.player.prophecies = gameState.player.prophecies.filter(p => p !== prophecy);
} else if (prophecy.turnsLeft <= 0) {
gameState.battleLog.push(`预言"${prophecy.condition}"未能实现`);
gameState.player.prophecies = gameState.player.prophecies.filter(p => p !== prophecy);
}
});
// 更新贷款回合数
gameState.player.loans.forEach(loan => {
loan.turnsLeft -= 1;
if (loan.turnsLeft <= 0) {
gameState.player.fatePoints -= loan.repayment;
gameState.battleLog.push(`你偿还了命运贷款,支付了${loan.repayment}点命运点数`);
gameState.player.loans = gameState.player.loans.filter(l => l !== loan);
}
});
// 更新敌人预言
gameState.enemy.prophecies.forEach(prophecy => {
prophecy.turnsLeft -= 1;
if (prophecy.turnsLeft <= 0) {
if (prophecy.condition.includes("不使用防御卡牌")) {
gameState.enemy.fatePoints += 3;
gameState.battleLog.push(`敌人完成了预言"${prophecy.condition}",获得了3点命运点数`);
}
gameState.enemy.prophecies = gameState.enemy.prophecies.filter(p => p !== prophecy);
}
});
// 生成敌人下回合行动
const actions = ["强力攻击", "快速攻击", "防御姿态", "命运汲取"];
const damages = [15, 10, 0, 5];
const randomIndex = Math.floor(Math.random() * actions.length);
gameState.enemy.nextAction = actions[randomIndex];
gameState.enemy.nextDamage = damages[randomIndex];
// 增加回合数
gameState.turn += 1;
// 抽卡逻辑
gameState.battleLog.push("你抽了一张新卡牌");
updateUI();
// 检查游戏结束
if (gameState.player.health <= 0) {
gameState.battleLog.push("你被击败了!游戏结束");
updateUI();
setTimeout(() => alert("游戏结束!你被击败了"), 500);
} else if (gameState.enemy.health <= 0) {
gameState.battleLog.push("你击败了敌人!胜利!");
updateUI();
setTimeout(() => alert("恭喜!你击败了敌人!"), 500);
}
});
// 初始化UI
updateUI();
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - <a href="https://enzostvs-deepsite.hf.space?remix=coldandcode/secondcatch" style="color: #fff;text-decoration: underline;" target="_blank" >🧬 Remix</a></p></body>
</html> |