Spaces:
Paused
Paused
Update sjz2.txt
Browse files
sjz2.txt
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
-
|
| 2 |
-
<html lang="zh-CN">
|
| 3 |
<!DOCTYPE html>
|
| 4 |
<html lang="zh-CN">
|
| 5 |
<head>
|
|
@@ -7,9 +6,9 @@
|
|
| 7 |
<title>弑君者 - 完整防御规则版</title>
|
| 8 |
<style>
|
| 9 |
body {
|
| 10 |
-
font-family: Arial, sans-serif;
|
| 11 |
-
background: #
|
| 12 |
-
color:
|
| 13 |
margin: 0;
|
| 14 |
padding: 20px;
|
| 15 |
}
|
|
@@ -34,54 +33,61 @@
|
|
| 34 |
|
| 35 |
/* 怪物卡片样式 */
|
| 36 |
.monster-card {
|
| 37 |
-
background: #
|
| 38 |
padding: 20px;
|
| 39 |
-
border-radius:
|
| 40 |
text-align: center;
|
|
|
|
|
|
|
|
|
|
| 41 |
}
|
| 42 |
|
| 43 |
.monster-card h2 {
|
| 44 |
margin-top: 0;
|
|
|
|
|
|
|
| 45 |
}
|
| 46 |
|
| 47 |
/* 选中卡片显示区域样式 */
|
| 48 |
.selected-card-display {
|
| 49 |
-
background: #
|
| 50 |
-
border-radius:
|
| 51 |
padding: 15px;
|
| 52 |
text-align: center;
|
| 53 |
flex-grow: 1;
|
|
|
|
|
|
|
|
|
|
| 54 |
}
|
| 55 |
|
| 56 |
/* 右侧手牌区域样式 */
|
| 57 |
.cards-area {
|
| 58 |
-
background: #
|
| 59 |
-
border-radius:
|
| 60 |
padding: 20px;
|
| 61 |
-
position: relative;
|
|
|
|
|
|
|
|
|
|
| 62 |
}
|
| 63 |
|
| 64 |
.cards-info {
|
| 65 |
display: flex;
|
| 66 |
justify-content: space-between;
|
| 67 |
margin-bottom: 15px;
|
| 68 |
-
background: rgba(255, 255, 255, 0.
|
| 69 |
padding: 10px;
|
| 70 |
-
border-radius:
|
|
|
|
| 71 |
}
|
| 72 |
|
| 73 |
/* 手牌表格样式 */
|
| 74 |
-
.cards-table {
|
| 75 |
-
width: 100%;
|
| 76 |
-
position: relative;
|
| 77 |
-
}
|
| 78 |
-
|
| 79 |
.cards-table table {
|
| 80 |
width: 100%;
|
| 81 |
border-collapse: collapse;
|
| 82 |
-
color:
|
| 83 |
-
background: rgba(255, 255, 255, 0.
|
| 84 |
-
border-radius:
|
| 85 |
overflow: hidden;
|
| 86 |
}
|
| 87 |
|
|
@@ -89,6 +95,7 @@
|
|
| 89 |
background: rgba(0, 0, 0, 0.3);
|
| 90 |
padding: 12px;
|
| 91 |
text-align: left;
|
|
|
|
| 92 |
}
|
| 93 |
|
| 94 |
.cards-table tr {
|
|
@@ -97,92 +104,196 @@
|
|
| 97 |
}
|
| 98 |
|
| 99 |
.cards-table tr:hover {
|
| 100 |
-
background: rgba(255, 255, 255, 0.
|
| 101 |
transform: translateY(-2px);
|
| 102 |
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
| 103 |
}
|
| 104 |
|
| 105 |
.cards-table tr.selected {
|
| 106 |
-
background: rgba(255,
|
| 107 |
-
border:
|
| 108 |
}
|
| 109 |
|
| 110 |
.cards-table td {
|
| 111 |
padding: 12px;
|
| 112 |
-
border-bottom: 1px solid rgba(255, 255, 255, 0.
|
| 113 |
}
|
| 114 |
-
|
|
|
|
| 115 |
.card-preview {
|
| 116 |
width: 120px;
|
| 117 |
height: 180px;
|
| 118 |
-
background:
|
| 119 |
-
border-radius:
|
| 120 |
margin: 0 auto;
|
| 121 |
display: flex;
|
| 122 |
flex-direction: column;
|
| 123 |
justify-content: center;
|
| 124 |
align-items: center;
|
| 125 |
font-size: 24px;
|
| 126 |
-
color:
|
| 127 |
-
box-shadow: 0
|
|
|
|
|
|
|
| 128 |
}
|
| 129 |
|
| 130 |
.card-preview.heart, .card-preview.diamond {
|
| 131 |
-
color: #
|
| 132 |
}
|
| 133 |
-
|
| 134 |
.card-preview .suit {
|
| 135 |
font-size: 48px;
|
| 136 |
margin-bottom: 10px;
|
| 137 |
}
|
| 138 |
-
|
| 139 |
.card-preview .value {
|
| 140 |
font-size: 36px;
|
| 141 |
}
|
| 142 |
-
|
|
|
|
| 143 |
.card-info {
|
| 144 |
margin-top: 15px;
|
| 145 |
-
color:
|
| 146 |
}
|
| 147 |
|
| 148 |
/* 防御提示框样式 */
|
| 149 |
-
.defense-prompt {
|
| 150 |
-
|
| 151 |
-
background: rgba(52, 73, 94, 0.5);
|
| 152 |
padding: 20px;
|
| 153 |
-
border-radius:
|
| 154 |
text-align: center;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 155 |
display: none;
|
| 156 |
-
margin-top: 20px; /* 添加上边距 */
|
| 157 |
}
|
| 158 |
-
|
|
|
|
| 159 |
.logs {
|
| 160 |
margin-top: 20px;
|
| 161 |
height: 200px;
|
| 162 |
overflow-y: auto;
|
| 163 |
-
background: rgba(0,0,0,0.
|
| 164 |
-
padding:
|
| 165 |
-
border-radius:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
}
|
| 167 |
-
|
| 168 |
button {
|
| 169 |
-
background: #
|
| 170 |
color: white;
|
| 171 |
border: none;
|
| 172 |
padding: 10px 20px;
|
| 173 |
-
border-radius:
|
| 174 |
cursor: pointer;
|
| 175 |
margin: 5px;
|
| 176 |
-
transition:
|
|
|
|
|
|
|
|
|
|
| 177 |
}
|
| 178 |
|
| 179 |
button:hover {
|
| 180 |
-
background: #
|
|
|
|
|
|
|
|
|
|
| 181 |
}
|
| 182 |
|
| 183 |
button:disabled {
|
| 184 |
-
background: #
|
| 185 |
cursor: not-allowed;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
}
|
| 187 |
</style>
|
| 188 |
</head>
|
|
@@ -213,6 +324,10 @@
|
|
| 213 |
<span>牌堆数量: <span id="deck-count">0</span></span>
|
| 214 |
<span>弃牌堆: <span id="discard-count">0</span></span>
|
| 215 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 216 |
<div class="cards-table">
|
| 217 |
<table>
|
| 218 |
<thead>
|
|
@@ -226,6 +341,20 @@
|
|
| 226 |
</tbody>
|
| 227 |
</table>
|
| 228 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 229 |
<!-- 将 defense-prompt 移动到这里 -->
|
| 230 |
<div class="defense-prompt" id="defensePrompt">
|
| 231 |
<h3>需要承受 <span id="requiredDamage">0</span> 点伤害!</h3>
|
|
@@ -243,6 +372,26 @@
|
|
| 243 |
|
| 244 |
|
| 245 |
<script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 246 |
const game = {
|
| 247 |
deck: [],
|
| 248 |
playerHand: [],
|
|
@@ -250,14 +399,15 @@
|
|
| 250 |
defenseMode: false,
|
| 251 |
requiredDamage: 0,
|
| 252 |
selectedCards: [],
|
| 253 |
-
|
|
|
|
|
|
|
| 254 |
boss: {
|
| 255 |
-
attack:
|
| 256 |
-
hp:
|
| 257 |
-
maxHp:
|
| 258 |
},
|
| 259 |
-
|
| 260 |
-
damageReductions: [], // 存储格式:{value: 减伤值, remainingTurns: 剩余回合}
|
| 261 |
};
|
| 262 |
|
| 263 |
function initGame() {
|
|
@@ -265,15 +415,16 @@
|
|
| 265 |
game.playerHand = [];
|
| 266 |
game.discardPile = [];
|
| 267 |
game.defenseMode = false;
|
|
|
|
| 268 |
game.requiredDamage = 0;
|
| 269 |
game.selectedCards = [];
|
| 270 |
game.damageReductions = [];
|
| 271 |
|
| 272 |
// 重置boss状态
|
| 273 |
game.boss = {
|
| 274 |
-
attack:
|
| 275 |
-
hp:
|
| 276 |
-
maxHp:
|
| 277 |
};
|
| 278 |
|
| 279 |
// 初始化玩家牌组
|
|
@@ -288,22 +439,29 @@
|
|
| 288 |
shuffleCards(game.deck);
|
| 289 |
drawCards(7);
|
| 290 |
refreshUI();
|
| 291 |
-
|
|
|
|
|
|
|
|
|
|
| 292 |
document.getElementById('defensePrompt').style.display = 'none';
|
|
|
|
| 293 |
}
|
| 294 |
|
| 295 |
|
| 296 |
function handleCardClick(card) {
|
| 297 |
-
if(game.defenseMode) {
|
| 298 |
toggleForDefense(card);
|
| 299 |
} else {
|
| 300 |
-
|
| 301 |
}
|
| 302 |
}
|
| 303 |
|
| 304 |
function attackWithCard(card) {
|
| 305 |
if (game.defenseMode) return;
|
| 306 |
|
|
|
|
|
|
|
|
|
|
| 307 |
// 所有卡牌都造成基础伤害
|
| 308 |
let baseDamage = card.value;
|
| 309 |
game.boss.hp -= baseDamage;
|
|
@@ -312,9 +470,13 @@
|
|
| 312 |
// 根据不同花色处理额外效果
|
| 313 |
switch(card.suit) {
|
| 314 |
case '♣':
|
| 315 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 316 |
game.boss.hp -= extraDamage;
|
| 317 |
-
addLog(`梅花效果:额外造成${extraDamage}点伤害!(总计${
|
| 318 |
break;
|
| 319 |
|
| 320 |
case '♥':
|
|
@@ -334,17 +496,14 @@
|
|
| 334 |
}
|
| 335 |
break;
|
| 336 |
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
break;
|
| 345 |
}
|
| 346 |
-
|
| 347 |
-
discardCard(card);
|
| 348 |
|
| 349 |
if (game.boss.hp <= 0) {
|
| 350 |
handleBossDefeat();
|
|
@@ -458,20 +617,23 @@
|
|
| 458 |
tr.classList.toggle('selected',
|
| 459 |
game.selectedCards.some(s => s.value === card.value && s.suit === card.suit)
|
| 460 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 461 |
}
|
| 462 |
|
| 463 |
-
tr.onclick = () =>
|
| 464 |
-
handleCardClick(card);
|
| 465 |
-
updateSelectedCardDisplay(card);
|
| 466 |
-
};
|
| 467 |
-
|
| 468 |
tableBody.appendChild(tr);
|
| 469 |
});
|
|
|
|
| 470 |
}
|
| 471 |
|
| 472 |
function getCardEffectDescription(card) {
|
| 473 |
const effects = {
|
| 474 |
-
'♣': '
|
| 475 |
'♥': '回收牌堆',
|
| 476 |
'♦': '抽牌',
|
| 477 |
'♠': '减伤'
|
|
@@ -494,7 +656,7 @@
|
|
| 494 |
</div>
|
| 495 |
<div class="card-info">
|
| 496 |
<p>基础伤害: ${card.value}</p>
|
| 497 |
-
<p>特殊效果: ${
|
| 498 |
</div>
|
| 499 |
`;
|
| 500 |
}
|
|
@@ -514,7 +676,7 @@
|
|
| 514 |
}
|
| 515 |
|
| 516 |
function drawCards(count) {
|
| 517 |
-
for(let i = 0; i < count && game.playerHand.length <
|
| 518 |
if(game.deck.length === 0) {
|
| 519 |
shuffleDiscardPile();
|
| 520 |
}
|
|
@@ -533,9 +695,9 @@
|
|
| 533 |
}
|
| 534 |
|
| 535 |
function checkHandLimit() {
|
| 536 |
-
if(game.playerHand.length >
|
| 537 |
-
game.playerHand.slice(
|
| 538 |
-
game.playerHand = game.playerHand.slice(0,
|
| 539 |
addLog("超过手牌上限,弃置多余卡牌");
|
| 540 |
}
|
| 541 |
}
|
|
@@ -596,6 +758,121 @@
|
|
| 596 |
updateSelectionDisplay();
|
| 597 |
}
|
| 598 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 599 |
// 初始化游戏
|
| 600 |
initGame();
|
| 601 |
</script>
|
|
|
|
| 1 |
+
|
|
|
|
| 2 |
<!DOCTYPE html>
|
| 3 |
<html lang="zh-CN">
|
| 4 |
<head>
|
|
|
|
| 6 |
<title>弑君者 - 完整防御规则版</title>
|
| 7 |
<style>
|
| 8 |
body {
|
| 9 |
+
font-family: 'Roboto', Arial, sans-serif;
|
| 10 |
+
background: #1a1a1a;
|
| 11 |
+
color: #e0e0e0;
|
| 12 |
margin: 0;
|
| 13 |
padding: 20px;
|
| 14 |
}
|
|
|
|
| 33 |
|
| 34 |
/* 怪物卡片样式 */
|
| 35 |
.monster-card {
|
| 36 |
+
background: linear-gradient(135deg, #2b1216 0%, #451c24 100%);
|
| 37 |
padding: 20px;
|
| 38 |
+
border-radius: 6px;
|
| 39 |
text-align: center;
|
| 40 |
+
border: 1px solid #632a35;
|
| 41 |
+
box-shadow: 0 0 15px rgba(99, 42, 53, 0.2);
|
| 42 |
+
opacity: 0.95;
|
| 43 |
}
|
| 44 |
|
| 45 |
.monster-card h2 {
|
| 46 |
margin-top: 0;
|
| 47 |
+
color: #ff4d6d;
|
| 48 |
+
text-shadow: 0 0 5px rgba(255, 77, 109, 0.3);
|
| 49 |
}
|
| 50 |
|
| 51 |
/* 选中卡片显示区域样式 */
|
| 52 |
.selected-card-display {
|
| 53 |
+
background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
|
| 54 |
+
border-radius: 6px;
|
| 55 |
padding: 15px;
|
| 56 |
text-align: center;
|
| 57 |
flex-grow: 1;
|
| 58 |
+
border: 1px solid #4b5563;
|
| 59 |
+
box-shadow: 0 0 15px rgba(75, 85, 99, 0.2);
|
| 60 |
+
opacity: 0.95;
|
| 61 |
}
|
| 62 |
|
| 63 |
/* 右侧手牌区域样式 */
|
| 64 |
.cards-area {
|
| 65 |
+
background: linear-gradient(135deg, #1f2937 0%, #2d3748 100%);
|
| 66 |
+
border-radius: 6px;
|
| 67 |
padding: 20px;
|
| 68 |
+
position: relative;
|
| 69 |
+
border: 1px solid #4b5563;
|
| 70 |
+
box-shadow: 0 0 20px rgba(75, 85, 99, 0.2);
|
| 71 |
+
opacity: 0.95;
|
| 72 |
}
|
| 73 |
|
| 74 |
.cards-info {
|
| 75 |
display: flex;
|
| 76 |
justify-content: space-between;
|
| 77 |
margin-bottom: 15px;
|
| 78 |
+
background: rgba(255, 255, 255, 0.05);
|
| 79 |
padding: 10px;
|
| 80 |
+
border-radius: 4px;
|
| 81 |
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
| 82 |
}
|
| 83 |
|
| 84 |
/* 手牌表格样式 */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
.cards-table table {
|
| 86 |
width: 100%;
|
| 87 |
border-collapse: collapse;
|
| 88 |
+
color: #e0e0e0;
|
| 89 |
+
background: rgba(255, 255, 255, 0.03);
|
| 90 |
+
border-radius: 6px;
|
| 91 |
overflow: hidden;
|
| 92 |
}
|
| 93 |
|
|
|
|
| 95 |
background: rgba(0, 0, 0, 0.3);
|
| 96 |
padding: 12px;
|
| 97 |
text-align: left;
|
| 98 |
+
border-bottom: 2px solid #4b5563;
|
| 99 |
}
|
| 100 |
|
| 101 |
.cards-table tr {
|
|
|
|
| 104 |
}
|
| 105 |
|
| 106 |
.cards-table tr:hover {
|
| 107 |
+
background: rgba(255, 255, 255, 0.08);
|
| 108 |
transform: translateY(-2px);
|
| 109 |
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
| 110 |
}
|
| 111 |
|
| 112 |
.cards-table tr.selected {
|
| 113 |
+
background: rgba(255, 77, 109, 0.15);
|
| 114 |
+
border: 1px solid #ff4d6d;
|
| 115 |
}
|
| 116 |
|
| 117 |
.cards-table td {
|
| 118 |
padding: 12px;
|
| 119 |
+
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
|
| 120 |
}
|
| 121 |
+
|
| 122 |
+
/* 卡牌预览样式 */
|
| 123 |
.card-preview {
|
| 124 |
width: 120px;
|
| 125 |
height: 180px;
|
| 126 |
+
background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
|
| 127 |
+
border-radius: 6px;
|
| 128 |
margin: 0 auto;
|
| 129 |
display: flex;
|
| 130 |
flex-direction: column;
|
| 131 |
justify-content: center;
|
| 132 |
align-items: center;
|
| 133 |
font-size: 24px;
|
| 134 |
+
color: #1f2937;
|
| 135 |
+
box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
|
| 136 |
+
border: 1px solid #9ca3af;
|
| 137 |
+
opacity: 0.9;
|
| 138 |
}
|
| 139 |
|
| 140 |
.card-preview.heart, .card-preview.diamond {
|
| 141 |
+
color: #dc2626;
|
| 142 |
}
|
| 143 |
+
|
| 144 |
.card-preview .suit {
|
| 145 |
font-size: 48px;
|
| 146 |
margin-bottom: 10px;
|
| 147 |
}
|
| 148 |
+
|
| 149 |
.card-preview .value {
|
| 150 |
font-size: 36px;
|
| 151 |
}
|
| 152 |
+
|
| 153 |
+
/* 卡牌信息样式 */
|
| 154 |
.card-info {
|
| 155 |
margin-top: 15px;
|
| 156 |
+
color: #e0e0e0;
|
| 157 |
}
|
| 158 |
|
| 159 |
/* 防御提示框样式 */
|
| 160 |
+
.defense-prompt, .attack-prompt {
|
| 161 |
+
background: rgba(255, 255, 255, 0.05);
|
|
|
|
| 162 |
padding: 20px;
|
| 163 |
+
border-radius: 6px;
|
| 164 |
text-align: center;
|
| 165 |
+
margin-top: 20px;
|
| 166 |
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
| 167 |
+
box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
|
| 168 |
+
color: #e0e0e0;
|
| 169 |
display: none;
|
|
|
|
| 170 |
}
|
| 171 |
+
|
| 172 |
+
/* 日志区域样式 */
|
| 173 |
.logs {
|
| 174 |
margin-top: 20px;
|
| 175 |
height: 200px;
|
| 176 |
overflow-y: auto;
|
| 177 |
+
background: rgba(0, 0, 0, 0.2);
|
| 178 |
+
padding: 15px;
|
| 179 |
+
border-radius: 6px;
|
| 180 |
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
| 181 |
+
font-family: 'Consolas', monospace;
|
| 182 |
+
line-height: 1.5;
|
| 183 |
+
opacity: 0.95;
|
| 184 |
}
|
| 185 |
+
/* 按钮样式 */
|
| 186 |
button {
|
| 187 |
+
background: linear-gradient(135deg, #ff4d6d 0%, #c53a57 100%);
|
| 188 |
color: white;
|
| 189 |
border: none;
|
| 190 |
padding: 10px 20px;
|
| 191 |
+
border-radius: 4px;
|
| 192 |
cursor: pointer;
|
| 193 |
margin: 5px;
|
| 194 |
+
transition: all 0.3s ease;
|
| 195 |
+
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
|
| 196 |
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
| 197 |
+
opacity: 0.95;
|
| 198 |
}
|
| 199 |
|
| 200 |
button:hover {
|
| 201 |
+
background: linear-gradient(135deg, #ff6b87 0%, #d84860 100%);
|
| 202 |
+
transform: translateY(-1px);
|
| 203 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
|
| 204 |
+
opacity: 1;
|
| 205 |
}
|
| 206 |
|
| 207 |
button:disabled {
|
| 208 |
+
background: #4a5568;
|
| 209 |
cursor: not-allowed;
|
| 210 |
+
transform: none;
|
| 211 |
+
box-shadow: none;
|
| 212 |
+
opacity: 0.7;
|
| 213 |
+
}
|
| 214 |
+
|
| 215 |
+
/* 重抽区域样式 */
|
| 216 |
+
.redraw-section {
|
| 217 |
+
display: flex;
|
| 218 |
+
justify-content: flex-end;
|
| 219 |
+
align-items: center;
|
| 220 |
+
gap: 10px;
|
| 221 |
+
margin: 10px 0;
|
| 222 |
+
padding: 5px 0;
|
| 223 |
+
color: #a0aec0;
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
.redraw-section button {
|
| 227 |
+
background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
|
| 228 |
+
border: 1px solid #4b5563;
|
| 229 |
+
}
|
| 230 |
+
|
| 231 |
+
.redraw-section button:hover {
|
| 232 |
+
background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
|
| 233 |
+
}
|
| 234 |
+
|
| 235 |
+
.redraw-section button:disabled {
|
| 236 |
+
background: #6b7280;
|
| 237 |
+
border: 1px solid #9ca3af;
|
| 238 |
+
opacity: 0.7;
|
| 239 |
+
}
|
| 240 |
+
|
| 241 |
+
/* 攻击预览样式 */
|
| 242 |
+
#attack-preview {
|
| 243 |
+
background: rgba(255, 255, 255, 0.05);
|
| 244 |
+
padding: 15px;
|
| 245 |
+
border-radius: 4px;
|
| 246 |
+
margin: 10px 0;
|
| 247 |
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
| 248 |
+
color: #e0e0e0;
|
| 249 |
+
}
|
| 250 |
+
|
| 251 |
+
/* 确认框按钮样式 */
|
| 252 |
+
.defense-prompt button, .attack-prompt button {
|
| 253 |
+
background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
|
| 254 |
+
border: 1px solid #4b5563;
|
| 255 |
+
color: #e5e7eb;
|
| 256 |
+
}
|
| 257 |
+
|
| 258 |
+
.defense-prompt button:hover, .attack-prompt button:hover {
|
| 259 |
+
background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
|
| 260 |
+
}
|
| 261 |
+
|
| 262 |
+
/* 确认框标题和文字样式 */
|
| 263 |
+
.defense-prompt h3, .attack-prompt h3 {
|
| 264 |
+
color: #e0e0e0;
|
| 265 |
+
margin-top: 0;
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
#selected-strength, #requiredDamage, #damageValue {
|
| 269 |
+
color: #e0e0e0;
|
| 270 |
+
}
|
| 271 |
+
|
| 272 |
+
/* 滚动条样式 */
|
| 273 |
+
::-webkit-scrollbar {
|
| 274 |
+
width: 8px;
|
| 275 |
+
}
|
| 276 |
+
|
| 277 |
+
::-webkit-scrollbar-track {
|
| 278 |
+
background: rgba(255, 255, 255, 0.05);
|
| 279 |
+
border-radius: 4px;
|
| 280 |
+
}
|
| 281 |
+
|
| 282 |
+
::-webkit-scrollbar-thumb {
|
| 283 |
+
background: rgba(255, 255, 255, 0.2);
|
| 284 |
+
border-radius: 4px;
|
| 285 |
+
}
|
| 286 |
+
|
| 287 |
+
::-webkit-scrollbar-thumb:hover {
|
| 288 |
+
background: rgba(255, 255, 255, 0.3);
|
| 289 |
+
}
|
| 290 |
+
|
| 291 |
+
/* 动作按钮区域样式 */
|
| 292 |
+
.action-buttons {
|
| 293 |
+
display: flex;
|
| 294 |
+
justify-content: center;
|
| 295 |
+
gap: 10px;
|
| 296 |
+
margin-top: 10px;
|
| 297 |
}
|
| 298 |
</style>
|
| 299 |
</head>
|
|
|
|
| 324 |
<span>牌堆数量: <span id="deck-count">0</span></span>
|
| 325 |
<span>弃牌堆: <span id="discard-count">0</span></span>
|
| 326 |
</div>
|
| 327 |
+
<div class="redraw-section">
|
| 328 |
+
<button id="redrawButton" onclick="redrawCards()">重新抽卡</button>
|
| 329 |
+
<span>剩余次数:<span id="redrawCount">2</span></span>
|
| 330 |
+
</div>
|
| 331 |
<div class="cards-table">
|
| 332 |
<table>
|
| 333 |
<thead>
|
|
|
|
| 341 |
</tbody>
|
| 342 |
</table>
|
| 343 |
</div>
|
| 344 |
+
|
| 345 |
+
<!-- 添加出牌确认窗口 -->
|
| 346 |
+
<div class="attack-prompt" id="attackPrompt">
|
| 347 |
+
<h3>确认出牌</h3>
|
| 348 |
+
<div id="attack-preview">
|
| 349 |
+
<p>选择的卡牌:<span id="selectedCardInfo">无</span></p>
|
| 350 |
+
<p>预期效果:<span id="cardEffectPreview">-</span></p>
|
| 351 |
+
</div>
|
| 352 |
+
<div class="action-buttons">
|
| 353 |
+
<button onclick="confirmAttack()">确认出牌</button>
|
| 354 |
+
<button onclick="cancelAttack()">取消选择</button>
|
| 355 |
+
</div>
|
| 356 |
+
</div>
|
| 357 |
+
|
| 358 |
<!-- 将 defense-prompt 移动到这里 -->
|
| 359 |
<div class="defense-prompt" id="defensePrompt">
|
| 360 |
<h3>需要承受 <span id="requiredDamage">0</span> 点伤害!</h3>
|
|
|
|
| 372 |
|
| 373 |
|
| 374 |
<script>
|
| 375 |
+
const GAME_CONFIG = {
|
| 376 |
+
// BOSS配置
|
| 377 |
+
BOSS: {
|
| 378 |
+
INITIAL_ATTACK: Math.floor(10),
|
| 379 |
+
INITIAL_HP: Math.floor(40),
|
| 380 |
+
},
|
| 381 |
+
|
| 382 |
+
// 玩家配置
|
| 383 |
+
PLAYER: {
|
| 384 |
+
HAND_LIMIT: Math.floor(7), // 手牌上限
|
| 385 |
+
INITIAL_REDRAW: Math.floor(2), // 初始重抽次数
|
| 386 |
+
},
|
| 387 |
+
|
| 388 |
+
// 卡牌效果配置
|
| 389 |
+
CARD_EFFECTS: {
|
| 390 |
+
SPADE_REDUCTION_TURNS: Math.floor(3), // 黑桃减伤持续回合
|
| 391 |
+
CLUB_DAMAGE_MULTIPLIER: 2, // 梅花伤害倍率(2表示双倍)
|
| 392 |
+
}
|
| 393 |
+
};
|
| 394 |
+
|
| 395 |
const game = {
|
| 396 |
deck: [],
|
| 397 |
playerHand: [],
|
|
|
|
| 399 |
defenseMode: false,
|
| 400 |
requiredDamage: 0,
|
| 401 |
selectedCards: [],
|
| 402 |
+
redrawCount: GAME_CONFIG.PLAYER.INITIAL_REDRAW,
|
| 403 |
+
selectedAttackCard: null,
|
| 404 |
+
attackMode: false,
|
| 405 |
boss: {
|
| 406 |
+
attack: GAME_CONFIG.BOSS.INITIAL_ATTACK,
|
| 407 |
+
hp: GAME_CONFIG.BOSS.INITIAL_HP,
|
| 408 |
+
maxHp: GAME_CONFIG.BOSS.INITIAL_HP
|
| 409 |
},
|
| 410 |
+
damageReductions: []
|
|
|
|
| 411 |
};
|
| 412 |
|
| 413 |
function initGame() {
|
|
|
|
| 415 |
game.playerHand = [];
|
| 416 |
game.discardPile = [];
|
| 417 |
game.defenseMode = false;
|
| 418 |
+
game.redrawCount = GAME_CONFIG.PLAYER.INITIAL_REDRAW;
|
| 419 |
game.requiredDamage = 0;
|
| 420 |
game.selectedCards = [];
|
| 421 |
game.damageReductions = [];
|
| 422 |
|
| 423 |
// 重置boss状态
|
| 424 |
game.boss = {
|
| 425 |
+
attack: GAME_CONFIG.BOSS.INITIAL_ATTACK,
|
| 426 |
+
hp: GAME_CONFIG.BOSS.INITIAL_HP,
|
| 427 |
+
maxHp: GAME_CONFIG.BOSS.INITIAL_HP
|
| 428 |
};
|
| 429 |
|
| 430 |
// 初始化玩家牌组
|
|
|
|
| 439 |
shuffleCards(game.deck);
|
| 440 |
drawCards(7);
|
| 441 |
refreshUI();
|
| 442 |
+
updateRedrawButton();
|
| 443 |
+
game.selectedAttackCard = null;
|
| 444 |
+
game.attackMode = false;
|
| 445 |
+
document.getElementById('attackPrompt').style.display = 'none';
|
| 446 |
document.getElementById('defensePrompt').style.display = 'none';
|
| 447 |
+
updateSelectedCardDisplay(null);
|
| 448 |
}
|
| 449 |
|
| 450 |
|
| 451 |
function handleCardClick(card) {
|
| 452 |
+
if (game.defenseMode) {
|
| 453 |
toggleForDefense(card);
|
| 454 |
} else {
|
| 455 |
+
selectAttackCard(card);
|
| 456 |
}
|
| 457 |
}
|
| 458 |
|
| 459 |
function attackWithCard(card) {
|
| 460 |
if (game.defenseMode) return;
|
| 461 |
|
| 462 |
+
// 先将攻击卡牌放入弃牌堆
|
| 463 |
+
discardCard(card);
|
| 464 |
+
|
| 465 |
// 所有卡牌都造成基础伤害
|
| 466 |
let baseDamage = card.value;
|
| 467 |
game.boss.hp -= baseDamage;
|
|
|
|
| 470 |
// 根据不同花色处理额外效果
|
| 471 |
switch(card.suit) {
|
| 472 |
case '♣':
|
| 473 |
+
// 计算总伤害(向下取整)
|
| 474 |
+
const totalDamage = Math.floor(card.value * GAME_CONFIG.CARD_EFFECTS.CLUB_DAMAGE_MULTIPLIER);
|
| 475 |
+
// 计算额外伤害
|
| 476 |
+
const extraDamage = totalDamage - baseDamage;
|
| 477 |
+
|
| 478 |
game.boss.hp -= extraDamage;
|
| 479 |
+
addLog(`梅花效果:额外造成${extraDamage}点伤害!(总计${totalDamage}点)`);
|
| 480 |
break;
|
| 481 |
|
| 482 |
case '♥':
|
|
|
|
| 496 |
}
|
| 497 |
break;
|
| 498 |
|
| 499 |
+
case '♠':
|
| 500 |
+
game.damageReductions.push({
|
| 501 |
+
value: card.value,
|
| 502 |
+
remainingTurns: GAME_CONFIG.CARD_EFFECTS.SPADE_REDUCTION_TURNS
|
| 503 |
+
});
|
| 504 |
+
addLog(`黑桃效果:获得${card.value}点减伤,持续${GAME_CONFIG.CARD_EFFECTS.SPADE_REDUCTION_TURNS}回合`);
|
| 505 |
+
break;
|
|
|
|
| 506 |
}
|
|
|
|
|
|
|
| 507 |
|
| 508 |
if (game.boss.hp <= 0) {
|
| 509 |
handleBossDefeat();
|
|
|
|
| 617 |
tr.classList.toggle('selected',
|
| 618 |
game.selectedCards.some(s => s.value === card.value && s.suit === card.suit)
|
| 619 |
);
|
| 620 |
+
} else if (game.attackMode) {
|
| 621 |
+
tr.classList.toggle('selected',
|
| 622 |
+
game.selectedAttackCard &&
|
| 623 |
+
game.selectedAttackCard.value === card.value &&
|
| 624 |
+
game.selectedAttackCard.suit === card.suit
|
| 625 |
+
);
|
| 626 |
}
|
| 627 |
|
| 628 |
+
tr.onclick = () => handleCardClick(card);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 629 |
tableBody.appendChild(tr);
|
| 630 |
});
|
| 631 |
+
updateRedrawButton();
|
| 632 |
}
|
| 633 |
|
| 634 |
function getCardEffectDescription(card) {
|
| 635 |
const effects = {
|
| 636 |
+
'♣': '伤害倍增',
|
| 637 |
'♥': '回收牌堆',
|
| 638 |
'♦': '抽牌',
|
| 639 |
'♠': '减伤'
|
|
|
|
| 656 |
</div>
|
| 657 |
<div class="card-info">
|
| 658 |
<p>基础伤害: ${card.value}</p>
|
| 659 |
+
<p>特殊效果: ${getCardEffect(card)}</p>
|
| 660 |
</div>
|
| 661 |
`;
|
| 662 |
}
|
|
|
|
| 676 |
}
|
| 677 |
|
| 678 |
function drawCards(count) {
|
| 679 |
+
for(let i = 0; i < count && game.playerHand.length < GAME_CONFIG.PLAYER.HAND_LIMIT; i++) {
|
| 680 |
if(game.deck.length === 0) {
|
| 681 |
shuffleDiscardPile();
|
| 682 |
}
|
|
|
|
| 695 |
}
|
| 696 |
|
| 697 |
function checkHandLimit() {
|
| 698 |
+
if(game.playerHand.length > GAME_CONFIG.PLAYER.HAND_LIMIT) {
|
| 699 |
+
game.playerHand.slice(GAME_CONFIG.PLAYER.HAND_LIMIT).forEach(card => game.discardPile.push(card));
|
| 700 |
+
game.playerHand = game.playerHand.slice(0, GAME_CONFIG.PLAYER.HAND_LIMIT);
|
| 701 |
addLog("超过手牌上限,弃置多余卡牌");
|
| 702 |
}
|
| 703 |
}
|
|
|
|
| 758 |
updateSelectionDisplay();
|
| 759 |
}
|
| 760 |
|
| 761 |
+
// 添加重抽功能
|
| 762 |
+
function redrawCards() {
|
| 763 |
+
if (game.redrawCount <= 0) {
|
| 764 |
+
return;
|
| 765 |
+
}
|
| 766 |
+
|
| 767 |
+
// 将所有手牌移到弃牌堆
|
| 768 |
+
game.discardPile.push(...game.playerHand);
|
| 769 |
+
game.playerHand = [];
|
| 770 |
+
|
| 771 |
+
// 重新抽取手牌
|
| 772 |
+
drawCards(7);
|
| 773 |
+
|
| 774 |
+
// 减少重抽次数
|
| 775 |
+
game.redrawCount--;
|
| 776 |
+
|
| 777 |
+
// 更新UI
|
| 778 |
+
updateRedrawButton();
|
| 779 |
+
addLog(`使用重抽功能,剩余${game.redrawCount}次`);
|
| 780 |
+
refreshUI();
|
| 781 |
+
}
|
| 782 |
+
|
| 783 |
+
// 更新重抽按钮状态
|
| 784 |
+
function updateRedrawButton() {
|
| 785 |
+
const button = document.getElementById('redrawButton');
|
| 786 |
+
const countDisplay = document.getElementById('redrawCount');
|
| 787 |
+
|
| 788 |
+
button.disabled = game.redrawCount <= 0;
|
| 789 |
+
countDisplay.textContent = game.redrawCount;
|
| 790 |
+
}
|
| 791 |
+
|
| 792 |
+
// 添加选择攻击卡牌函数
|
| 793 |
+
function selectAttackCard(card) {
|
| 794 |
+
game.selectedAttackCard = card;
|
| 795 |
+
game.attackMode = true;
|
| 796 |
+
|
| 797 |
+
// 更新确认窗口的预览信息
|
| 798 |
+
document.getElementById('selectedCardInfo').textContent = `${card.suit}${card.value}`;
|
| 799 |
+
document.getElementById('cardEffectPreview').textContent = getCardEffect(card, true);
|
| 800 |
+
|
| 801 |
+
// 更新左侧卡牌预览
|
| 802 |
+
updateSelectedCardDisplay(card);
|
| 803 |
+
|
| 804 |
+
// 显示确认窗口
|
| 805 |
+
document.getElementById('attackPrompt').style.display = 'block';
|
| 806 |
+
|
| 807 |
+
refreshUI();
|
| 808 |
+
}
|
| 809 |
+
|
| 810 |
+
// 添加获取卡牌效果预览的函数
|
| 811 |
+
function getCardEffectPreview(card) {
|
| 812 |
+
let preview = `基础伤害:${card.value}点`;
|
| 813 |
+
|
| 814 |
+
switch(card.suit) {
|
| 815 |
+
case '♣':
|
| 816 |
+
const totalDamage = Math.floor(card.value * GAME_CONFIG.CARD_EFFECTS.CLUB_DAMAGE_MULTIPLIER);
|
| 817 |
+
const extraDamage = totalDamage - card.value;
|
| 818 |
+
preview += `\n额外伤害:${extraDamage}点(总计${totalDamage}点)`;
|
| 819 |
+
break;
|
| 820 |
+
case '♥':
|
| 821 |
+
preview += `\n回收${card.value}张弃牌到牌堆`;
|
| 822 |
+
break;
|
| 823 |
+
case '♦':
|
| 824 |
+
preview += `\n抽取${card.value}张牌`;
|
| 825 |
+
break;
|
| 826 |
+
case '♠':
|
| 827 |
+
preview += `\n获得${card.value}点减伤,持续${GAME_CONFIG.CARD_EFFECTS.SPADE_REDUCTION_TURNS}回合`;
|
| 828 |
+
break;
|
| 829 |
+
}
|
| 830 |
+
|
| 831 |
+
return preview;
|
| 832 |
+
}
|
| 833 |
+
|
| 834 |
+
function getCardEffect(card, detailed = false) {
|
| 835 |
+
switch(card.suit) {
|
| 836 |
+
case '♣':
|
| 837 |
+
const totalDamage = Math.floor(card.value * GAME_CONFIG.CARD_EFFECTS.CLUB_DAMAGE_MULTIPLIER);
|
| 838 |
+
const extraDamage = totalDamage - card.value;
|
| 839 |
+
return detailed ? `造成额外${extraDamage}点伤害(总计${totalDamage}点)` : '伤害倍增';
|
| 840 |
+
case '♥':
|
| 841 |
+
return detailed ? `从弃牌堆回收${card.value}张牌` : '回收牌堆';
|
| 842 |
+
case '♦':
|
| 843 |
+
return detailed ? `抽取${card.value}张新牌` : '抽牌';
|
| 844 |
+
case '♠':
|
| 845 |
+
return detailed ? `获得${card.value}点减伤,持续${GAME_CONFIG.CARD_EFFECTS.SPADE_REDUCTION_TURNS}回合` : '减伤';
|
| 846 |
+
default:
|
| 847 |
+
return '';
|
| 848 |
+
}
|
| 849 |
+
}
|
| 850 |
+
|
| 851 |
+
// 添加确认出牌函数
|
| 852 |
+
function confirmAttack() {
|
| 853 |
+
if (!game.selectedAttackCard) return;
|
| 854 |
+
|
| 855 |
+
const card = game.selectedAttackCard;
|
| 856 |
+
attackWithCard(card);
|
| 857 |
+
|
| 858 |
+
// 重置状态
|
| 859 |
+
game.selectedAttackCard = null;
|
| 860 |
+
game.attackMode = false;
|
| 861 |
+
document.getElementById('attackPrompt').style.display = 'none';
|
| 862 |
+
updateSelectedCardDisplay(null); // 添加这行
|
| 863 |
+
|
| 864 |
+
refreshUI();
|
| 865 |
+
}
|
| 866 |
+
|
| 867 |
+
// 添加取消出牌函数
|
| 868 |
+
function cancelAttack() {
|
| 869 |
+
game.selectedAttackCard = null;
|
| 870 |
+
game.attackMode = false;
|
| 871 |
+
document.getElementById('attackPrompt').style.display = 'none';
|
| 872 |
+
updateSelectedCardDisplay(null); // 添加这行
|
| 873 |
+
refreshUI();
|
| 874 |
+
}
|
| 875 |
+
|
| 876 |
// 初始化游戏
|
| 877 |
initGame();
|
| 878 |
</script>
|