Vladarr commited on
Commit
a242b01
·
verified ·
1 Parent(s): eb9f586

Add 3 files

Browse files
Files changed (3) hide show
  1. README.md +7 -5
  2. index.html +564 -19
  3. prompts.txt +1 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Dunghero
3
- emoji: 🐢
4
- colorFrom: pink
5
- colorTo: purple
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: dunghero
3
+ emoji: 🐳
4
+ colorFrom: red
5
+ colorTo: red
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,564 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="ru">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Подземелье Героев</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ @keyframes pulse {
11
+ 0%, 100% { transform: scale(1); }
12
+ 50% { transform: scale(1.05); }
13
+ }
14
+ .pulse-animation {
15
+ animation: pulse 1.5s infinite;
16
+ }
17
+ .hero-card {
18
+ transition: all 0.3s ease;
19
+ }
20
+ .hero-card:hover {
21
+ transform: translateY(-5px);
22
+ box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
23
+ }
24
+ .damage-effect {
25
+ position: absolute;
26
+ width: 100%;
27
+ height: 100%;
28
+ background-color: rgba(255, 0, 0, 0.3);
29
+ top: 0;
30
+ left: 0;
31
+ z-index: 10;
32
+ animation: flash 0.3s;
33
+ }
34
+ @keyframes flash {
35
+ 0% { opacity: 0.8; }
36
+ 100% { opacity: 0; }
37
+ }
38
+ .heal-effect {
39
+ position: absolute;
40
+ width: 100%;
41
+ height: 100%;
42
+ background-color: rgba(0, 255, 0, 0.3);
43
+ top: 0;
44
+ left: 0;
45
+ z-index: 10;
46
+ animation: flash 0.3s;
47
+ }
48
+ .dead-overlay {
49
+ position: absolute;
50
+ width: 100%;
51
+ height: 100%;
52
+ background-color: rgba(0, 0, 0, 0.7);
53
+ top: 0;
54
+ left: 0;
55
+ display: flex;
56
+ justify-content: center;
57
+ align-items: center;
58
+ z-index: 20;
59
+ }
60
+ .skull-icon {
61
+ font-size: 3rem;
62
+ color: white;
63
+ }
64
+ </style>
65
+ </head>
66
+ <body class="bg-gray-900 text-white min-h-screen">
67
+ <div class="container mx-auto px-4 py-8">
68
+ <!-- Заголовок -->
69
+ <header class="text-center mb-12">
70
+ <h1 class="text-5xl font-bold mb-4 text-yellow-400">Подземелье Героев</h1>
71
+ <p class="text-xl text-gray-300">Сделайте ставку на героя и следите за его судьбой в опасном подземелье!</p>
72
+ </header>
73
+
74
+ <!-- Основной экран игры -->
75
+ <div id="game-screen" class="flex flex-col items-center">
76
+ <!-- Информация о игроке -->
77
+ <div class="bg-gray-800 rounded-lg p-6 mb-8 w-full max-w-2xl shadow-lg">
78
+ <div class="flex justify-between items-center">
79
+ <div>
80
+ <h2 class="text-2xl font-semibold mb-2">Ваш баланс: <span id="balance" class="text-green-400">1000</span> <i class="fas fa-coins text-yellow-400"></i></h2>
81
+ <p class="text-gray-400">Текущий раунд: <span id="current-round">0</span>/<span id="total-rounds">5</span></p>
82
+ </div>
83
+ <div>
84
+ <button id="start-game-btn" class="bg-yellow-500 hover:bg-yellow-600 text-gray-900 font-bold py-3 px-6 rounded-lg transition-all flex items-center">
85
+ <i class="fas fa-play mr-2"></i> Начать игру
86
+ </button>
87
+ </div>
88
+ </div>
89
+ </div>
90
+
91
+ <!-- Выбор героя и ставки -->
92
+ <div id="hero-selection" class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-8 w-full max-w-4xl">
93
+ <!-- Герои будут добавлены динамически -->
94
+ </div>
95
+
96
+ <!-- Лог событий -->
97
+ <div id="event-log" class="bg-gray-800 rounded-lg p-6 w-full max-w-4xl h-64 overflow-y-auto shadow-lg">
98
+ <h3 class="text-xl font-semibold mb-4 border-b border-gray-700 pb-2">Журнал событий</h3>
99
+ <div id="log-content" class="space-y-2">
100
+ <p class="text-gray-400 italic">Игра еще не началась. Выберите героя и сделайте ставку.</p>
101
+ </div>
102
+ </div>
103
+
104
+ <!-- Босс -->
105
+ <div id="boss-container" class="mt-12 hidden">
106
+ <div class="bg-red-900 rounded-lg p-6 w-full max-w-2xl shadow-lg relative overflow-hidden">
107
+ <div class="flex flex-col md:flex-row items-center">
108
+ <div class="w-32 h-32 bg-red-800 rounded-full flex items-center justify-center mb-4 md:mb-0 md:mr-6 relative">
109
+ <i class="fas fa-skull text-6xl text-red-600"></i>
110
+ <div id="boss-health-bar" class="absolute -bottom-2 left-0 right-0 h-2 bg-gray-700 rounded-full">
111
+ <div id="boss-health" class="h-full bg-red-500 rounded-full" style="width: 100%"></div>
112
+ </div>
113
+ </div>
114
+ <div>
115
+ <h3 class="text-2xl font-bold mb-2" id="boss-name">???</h3>
116
+ <p class="text-gray-300 mb-1">Уровень угрозы: <span id="boss-threat" class="text-red-400">??</span></p>
117
+ <p class="text-gray-300">Здоровье: <span id="boss-health-text">100</span>/<span>100</span></p>
118
+ </div>
119
+ </div>
120
+ </div>
121
+ </div>
122
+
123
+ <!-- Результаты раунда -->
124
+ <div id="round-results" class="mt-8 hidden w-full max-w-4xl">
125
+ <div class="bg-gray-800 rounded-lg p-6 shadow-lg">
126
+ <h3 class="text-xl font-semibold mb-4 border-b border-gray-700 pb-2">Результаты раунда</h3>
127
+ <div id="round-results-content" class="grid grid-cols-1 md:grid-cols-3 gap-4">
128
+ <!-- Результаты будут добавлены динамически -->
129
+ </div>
130
+ <div class="mt-6 flex justify-center">
131
+ <button id="next-round-btn" class="bg-blue-600 hover:bg-blue-700 text-white font-bold py-3 px-8 rounded-lg transition-all">
132
+ Следующий раунд <i class="fas fa-arrow-right ml-2"></i>
133
+ </button>
134
+ </div>
135
+ </div>
136
+ </div>
137
+
138
+ <!-- Финальные результаты -->
139
+ <div id="final-results" class="mt-8 hidden w-full max-w-4xl">
140
+ <div class="bg-gray-800 rounded-lg p-6 shadow-lg">
141
+ <h3 class="text-xl font-semibold mb-4 border-b border-gray-700 pb-2">Финальные результаты</h3>
142
+ <div id="final-results-content" class="space-y-4">
143
+ <!-- Результаты будут добавлены динамически -->
144
+ </div>
145
+ <div class="mt-6 flex justify-center">
146
+ <button id="restart-game-btn" class="bg-green-600 hover:bg-green-700 text-white font-bold py-3 px-8 rounded-lg transition-all">
147
+ Играть снова <i class="fas fa-redo ml-2"></i>
148
+ </button>
149
+ </div>
150
+ </div>
151
+ </div>
152
+ </div>
153
+ </div>
154
+
155
+ <script>
156
+ // Игровые переменные
157
+ let gameState = {
158
+ balance: 1000,
159
+ currentRound: 0,
160
+ totalRounds: 5,
161
+ selectedHero: null,
162
+ betAmount: 0,
163
+ heroes: [],
164
+ boss: null,
165
+ gameActive: false,
166
+ roundResults: [],
167
+ finalResults: null
168
+ };
169
+
170
+ // Герои
171
+ const heroClasses = [
172
+ { name: "Воин", icon: "fa-shield-alt", color: "bg-blue-600" },
173
+ { name: "Лучник", icon: "fa-bow-arrow", color: "bg-green-600" },
174
+ { name: "Маг", icon: "fa-hat-wizard", color: "bg-purple-600" },
175
+ { name: "Разбойник", icon: "fa-mask", color: "bg-gray-600" },
176
+ { name: "Паладин", icon: "fa-hammer", color: "bg-yellow-600" },
177
+ { name: "Некромант", icon: "fa-skull", color: "bg-gray-800" }
178
+ ];
179
+
180
+ // Боссы
181
+ const bosses = [
182
+ { name: "Дракон Тьмы", threat: 8, health: 100, icon: "fa-dragon" },
183
+ { name: "Король Лич", threat: 9, health: 120, icon: "fa-crown" },
184
+ { name: "Демон Бездны", threat: 10, health: 150, icon: "fa-fire" },
185
+ { name: "Гигантский Паук", threat: 7, health: 90, icon: "fa-spider" },
186
+ { name: "Темный Властелин", threat: 12, health: 200, icon: "fa-chess-king" }
187
+ ];
188
+
189
+ // Инициализация игры
190
+ function initGame() {
191
+ // Создаем героев
192
+ gameState.heroes = heroClasses.map((heroClass, index) => {
193
+ return {
194
+ id: index + 1,
195
+ name: `${heroClass.name} #${index + 1}`,
196
+ class: heroClass.name,
197
+ icon: heroClass.icon,
198
+ color: heroClass.color,
199
+ health: 100,
200
+ maxHealth: 100,
201
+ strength: Math.floor(Math.random() * 10) + 5,
202
+ agility: Math.floor(Math.random() * 10) + 5,
203
+ intelligence: Math.floor(Math.random() * 10) + 5,
204
+ experience: 0,
205
+ survivedRounds: 0,
206
+ alive: true,
207
+ coefficient: (Math.random() * 2 + 1).toFixed(2),
208
+ lastDamageDealt: 0
209
+ };
210
+ });
211
+
212
+ // Выбираем случайного босса
213
+ const randomBoss = bosses[Math.floor(Math.random() * bosses.length)];
214
+ gameState.boss = {
215
+ ...randomBoss,
216
+ currentHealth: randomBoss.health,
217
+ maxHealth: randomBoss.health
218
+ };
219
+
220
+ // Обновляем UI
221
+ updateUI();
222
+ renderHeroSelection();
223
+ updateBossUI();
224
+ }
225
+
226
+ // Рендер выбора героев
227
+ function renderHeroSelection() {
228
+ const container = document.getElementById('hero-selection');
229
+ container.innerHTML = '';
230
+
231
+ gameState.heroes.forEach(hero => {
232
+ const heroCard = document.createElement('div');
233
+ heroCard.className = `hero-card ${hero.color} rounded-lg p-6 shadow-md relative overflow-hidden`;
234
+
235
+ // Если герой мертв, добавляем оверлей
236
+ if (!hero.alive) {
237
+ heroCard.innerHTML += `
238
+ <div class="dead-overlay">
239
+ <i class="fas fa-skull skull-icon"></i>
240
+ </div>
241
+ `;
242
+ }
243
+
244
+ heroCard.innerHTML += `
245
+ <div class="flex flex-col md:flex-row items-center">
246
+ <div class="w-20 h-20 bg-black bg-opacity-30 rounded-full flex items-center justify-center mb-4 md:mb-0 md:mr-4">
247
+ <i class="fas ${hero.icon} text-3xl"></i>
248
+ </div>
249
+ <div class="text-center md:text-left">
250
+ <h3 class="text-xl font-bold">${hero.name}</h3>
251
+ <p class="text-sm opacity-80">${hero.class}</p>
252
+ <div class="mt-2">
253
+ <span class="text-xs font-semibold">Сила: ${hero.strength}</span> |
254
+ <span class="text-xs font-semibold">Ловк: ${hero.agility}</span> |
255
+ <span class="text-xs font-semibold">Инт: ${hero.intelligence}</span>
256
+ </div>
257
+ <div class="mt-1">
258
+ <span class="text-xs">Опыт: ${hero.experience}</span>
259
+ </div>
260
+ </div>
261
+ </div>
262
+ <div class="mt-4">
263
+ <div class="flex justify-between items-center mb-1">
264
+ <span class="text-xs">Здоровье:</span>
265
+ <span class="text-xs font-bold">${hero.health}/${hero.maxHealth}</span>
266
+ </div>
267
+ <div class="w-full bg-gray-700 rounded-full h-2">
268
+ <div class="bg-green-500 h-2 rounded-full" style="width: ${(hero.health / hero.maxHealth) * 100}%"></div>
269
+ </div>
270
+ </div>
271
+ <div class="mt-4 flex justify-between items-center">
272
+ <span class="text-sm">Коэф: <span class="font-bold">${hero.coefficient}x</span></span>
273
+ <div class="flex items-center">
274
+ <input type="number" id="bet-amount-${hero.id}" class="w-20 bg-black bg-opacity-30 text-white text-sm rounded px-2 py-1 mr-2" placeholder="Сумма" min="10" max="${gameState.balance}" value="10">
275
+ <button onclick="placeBet(${hero.id})" class="bg-yellow-500 hover:bg-yellow-600 text-gray-900 text-sm font-bold px-3 py-1 rounded transition-all ${!hero.alive ? 'opacity-50 cursor-not-allowed' : ''}" ${!hero.alive ? 'disabled' : ''}>
276
+ <i class="fas fa-coins mr-1"></i> Ставка
277
+ </button>
278
+ </div>
279
+ </div>
280
+ `;
281
+
282
+ container.appendChild(heroCard);
283
+ });
284
+ }
285
+
286
+ // Размещение ставки
287
+ function placeBet(heroId) {
288
+ if (gameState.gameActive) {
289
+ addLogMessage("Игра уже началась! Дождитесь окончания текущей игры.");
290
+ return;
291
+ }
292
+
293
+ const hero = gameState.heroes.find(h => h.id === heroId);
294
+ if (!hero.alive) {
295
+ addLogMessage("Этот герой уже мертв и не может участвовать!");
296
+ return;
297
+ }
298
+
299
+ const betInput = document.getElementById(`bet-amount-${heroId}`);
300
+ const betAmount = parseInt(betInput.value);
301
+
302
+ if (isNaN(betAmount) || betAmount < 10) {
303
+ addLogMessage("Минимальная ставка - 10 монет!");
304
+ return;
305
+ }
306
+
307
+ if (betAmount > gameState.balance) {
308
+ addLogMessage("Недостаточно средств для такой ставки!");
309
+ return;
310
+ }
311
+
312
+ gameState.selectedHero = heroId;
313
+ gameState.betAmount = betAmount;
314
+ gameState.balance -= betAmount;
315
+
316
+ addLogMessage(`Вы сделали ставку ${betAmount} монет на ${hero.name}! Коэффициент: ${hero.coefficient}x`);
317
+ updateUI();
318
+
319
+ // Делаем кнопку начала игры активной
320
+ document.getElementById('start-game-btn').classList.remove('opacity-50', 'cursor-not-allowed');
321
+ }
322
+
323
+ // Начало игры
324
+ function startGame() {
325
+ if (!gameState.selectedHero) {
326
+ addLogMessage("Сначала выберите героя и сделайте ставку!");
327
+ return;
328
+ }
329
+
330
+ if (gameState.gameActive) {
331
+ addLogMessage("Игра уже идет!");
332
+ return;
333
+ }
334
+
335
+ gameState.gameActive = true;
336
+ gameState.currentRound = 1;
337
+
338
+ addLogMessage(`Игра началась! Герои отправляются в подземелье на ${gameState.totalRounds} раундов.`);
339
+ addLogMessage(`Босс этого подземелья: ${gameState.boss.name} (Уровень угрозы: ${gameState.boss.threat}/10)`);
340
+
341
+ // Показываем босса
342
+ document.getElementById('boss-container').classList.remove('hidden');
343
+
344
+ // Скрываем кнопку начала игры
345
+ document.getElementById('start-game-btn').classList.add('hidden');
346
+
347
+ // Запускаем первый раунд
348
+ startRound();
349
+ }
350
+
351
+ // Запуск раунда
352
+ function startRound() {
353
+ addLogMessage(`=== Раунд ${gameState.currentRound} ===`);
354
+
355
+ // Скрываем результаты предыдущего раунда
356
+ document.getElementById('round-results').classList.add('hidden');
357
+
358
+ // Обновляем UI раунда
359
+ document.getElementById('current-round').textContent = gameState.currentRound;
360
+
361
+ // Симулируем раунд
362
+ setTimeout(() => {
363
+ simulateRound();
364
+ }, 1500);
365
+ }
366
+
367
+ // Симуляция раунда
368
+ function simulateRound() {
369
+ gameState.roundResults = [];
370
+
371
+ // Для каждого живого героя определяем, выживет ли он в раунде
372
+ gameState.heroes.forEach(hero => {
373
+ if (hero.alive) {
374
+ // Шанс выживания: 30% параметры, 30% опыт, 40% случайность
375
+ const survivalChance =
376
+ (hero.strength + hero.agility + hero.intelligence) / 3 * 0.3 +
377
+ hero.experience * 0.3 +
378
+ Math.random() * 40;
379
+
380
+ // Базовый шанс выживания 60% + бонусы
381
+ const survivalThreshold = 60 + survivalChance;
382
+ const roll = Math.random() * 100;
383
+
384
+ if (roll < survivalThreshold) {
385
+ // Герой выжил
386
+ hero.survivedRounds++;
387
+
388
+ // Получает опыт
389
+ const expGain = Math.floor(Math.random() * 5) + 1;
390
+ hero.experience += expGain;
391
+
392
+ // Может получить лечение или урон
393
+ const healthChange = Math.random() > 0.7 ?
394
+ Math.floor(Math.random() * 20) + 5 : // Лечение
395
+ -(Math.floor(Math.random() * 15) + 5); // Урон
396
+
397
+ hero.health = Math.min(hero.maxHealth, Math.max(0, hero.health + healthChange));
398
+
399
+ // Проверяем, умер ли герой от урона
400
+ if (hero.health <= 0) {
401
+ hero.alive = false;
402
+ hero.health = 0;
403
+ gameState.roundResults.push({
404
+ heroId: hero.id,
405
+ survived: false,
406
+ message: `${hero.name} погиб в этом раунде!`
407
+ });
408
+ } else {
409
+ gameState.roundResults.push({
410
+ heroId: hero.id,
411
+ survived: true,
412
+ message: `${hero.name} выжил! ${healthChange > 0 ?
413
+ `Получил лечение +${healthChange} HP` :
414
+ `Получил урон ${-healthChange} HP`}. Опыт +${expGain}`
415
+ });
416
+ }
417
+ } else {
418
+ // Герой погиб
419
+ hero.alive = false;
420
+ hero.health = 0;
421
+ gameState.roundResults.push({
422
+ heroId: hero.id,
423
+ survived: false,
424
+ message: `${hero.name} погиб в этом раунде!`
425
+ });
426
+ }
427
+ }
428
+ });
429
+
430
+ // Проверяем, остались ли живые герои
431
+ const aliveHeroes = gameState.heroes.filter(h => h.alive);
432
+ if (aliveHeroes.length === 0) {
433
+ // Все герои мертвы, игра окончена
434
+ endGame(false);
435
+ return;
436
+ }
437
+
438
+ // Показываем результаты раунда
439
+ showRoundResults();
440
+ }
441
+
442
+ // Показать результаты раунда
443
+ function showRoundResults() {
444
+ const container = document.getElementById('round-results-content');
445
+ container.innerHTML = '';
446
+
447
+ gameState.roundResults.forEach(result => {
448
+ const hero = gameState.heroes.find(h => h.id === result.heroId);
449
+ const resultCard = document.createElement('div');
450
+ resultCard.className = `bg-gray-700 rounded-lg p-4 ${result.survived ? 'border-l-4 border-green-500' : 'border-l-4 border-red-500'}`;
451
+
452
+ resultCard.innerHTML = `
453
+ <div class="flex items-center mb-2">
454
+ <div class="w-10 h-10 ${hero.color} rounded-full flex items-center justify-center mr-3">
455
+ <i class="fas ${hero.icon}"></i>
456
+ </div>
457
+ <h4 class="font-semibold">${hero.name}</h4>
458
+ </div>
459
+ <p class="text-sm ${result.survived ? 'text-green-300' : 'text-red-300'}">${result.message}</p>
460
+ <div class="mt-2 flex justify-between items-center">
461
+ <span class="text-xs">Здоровье:</span>
462
+ <span class="text-xs font-bold">${hero.health}/${hero.maxHealth}</span>
463
+ </div>
464
+ <div class="w-full bg-gray-600 rounded-full h-1.5 mt-1">
465
+ <div class="${result.survived ? 'bg-green-500' : 'bg-red-500'} h-1.5 rounded-full" style="width: ${(hero.health / hero.maxHealth) * 100}%"></div>
466
+ </div>
467
+ `;
468
+
469
+ container.appendChild(resultCard);
470
+ });
471
+
472
+ // Показываем контейнер результатов
473
+ document.getElementById('round-results').classList.remove('hidden');
474
+
475
+ // Обновляем карточки героев
476
+ renderHeroSelection();
477
+
478
+ // Если это последний раунд, завершаем игру
479
+ if (gameState.currentRound >= gameState.totalRounds) {
480
+ // Сначала показываем результаты раунда, затем через 3 секунды - финальные результаты
481
+ setTimeout(() => {
482
+ endGame(true);
483
+ }, 3000);
484
+ }
485
+ }
486
+
487
+ // Следующий раунд
488
+ function nextRound() {
489
+ gameState.currentRound++;
490
+ document.getElementById('round-results').classList.add('hidden');
491
+ startRound();
492
+ }
493
+
494
+ // Завершение игры
495
+ function endGame(fightBoss) {
496
+ gameState.gameActive = false;
497
+
498
+ if (fightBoss) {
499
+ // Битва с боссом
500
+ const aliveHeroes = gameState.heroes.filter(h => h.alive);
501
+ addLogMessage(`=== Финальная битва с ${gameState.boss.name}! ===`);
502
+ addLogMessage(`В бой идут ${aliveHeroes.length} героев!`);
503
+
504
+ // Шанс победы зависит от количества и силы героев
505
+ const totalHeroPower = aliveHeroes.reduce((sum, hero) => {
506
+ return sum + (hero.strength + hero.agility + hero.intelligence) / 3 + hero.experience;
507
+ }, 0);
508
+
509
+ const bossPower = gameState.boss.threat * 10;
510
+ const winChance = Math.min(90, (totalHeroPower / bossPower) * 80); // Макс 90% шанс
511
+
512
+ // Определяем победителя
513
+ const roll = Math.random() * 100;
514
+ const victory = roll < winChance;
515
+
516
+ // Определяем героя, нанесшего смертельный удар (если победа)
517
+ let killingBlowHero = null;
518
+ if (victory) {
519
+ // Сортируем героев по урону (сила + случайность)
520
+ aliveHeroes.forEach(hero => {
521
+ hero.lastDamageDealt = hero.strength + Math.floor(Math.random() * 10);
522
+ });
523
+
524
+ // Находим героя с максимальным уроном
525
+ killingBlowHero = aliveHeroes.reduce((max, hero) =>
526
+ hero.lastDamageDealt > max.lastDamageDealt ? hero : max, aliveHeroes[0]);
527
+ }
528
+
529
+ // Формируем финальные результаты
530
+ gameState.finalResults = {
531
+ victory,
532
+ aliveHeroesCount: aliveHeroes.length,
533
+ killingBlowHeroId: killingBlowHero ? killingBlowHero.id : null,
534
+ winAmount: calculateWinAmount(victory, killingBlowHero)
535
+ };
536
+
537
+ // Добавляем сообщения в лог
538
+ if (victory) {
539
+ addLogMessage(`Герои победили ${gameState.boss.name}!`);
540
+ addLogMessage(`${killingBlowHero.name} нанес смертельный удар!`);
541
+ } else {
542
+ addLogMessage(`Герои проиграли в битве с ${gameState.boss.name}!`);
543
+ }
544
+ } else {
545
+ // Все герои погибли до финальной битвы
546
+ gameState.finalResults = {
547
+ victory: false,
548
+ aliveHeroesCount: 0,
549
+ killingBlowHeroId: null,
550
+ winAmount: 0
551
+ };
552
+ addLogMessage("Все герои погибли! Игра окончена.");
553
+ }
554
+
555
+ // Показываем финальные результаты через 2 секунды
556
+ setTimeout(showFinalResults, 2000);
557
+ }
558
+
559
+ // Расчет выигрыша
560
+ function calculateWinAmount(victory, killingBlowHero) {
561
+ if (!victory) return 0;
562
+
563
+ const selectedHero = gameState.heroes.find
564
+ </html>
prompts.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ Разработай игру (на чем будет удобней) про ставки на героев, которые отправляются в подземелье на сражение с боссом. Поход в подземелье состоит из N раундов. По окончанию каждого раунда происходит расчет, кто из героев выжил, а кто погиб. Выживание героев должно зависеть от параметров (30%), опыта прошлых походов (где-то до 30%) и рандома (40%). Если после последнего раунда кто-то из гереов жив, происходит расчет победили ли они боса (чем больше героев выжило, тем выше шансы). По истечению "забега" в подземелье, игроки получают выигрыш в зависимости от коефициента ставки на героя, если он выжил (коэфициент определяется с учетом параметров и опыта героев). Если выбранный (герой еще и нанес смертельный удар (расчитывается если победили боса), то игрок который делал ставку получает награду x10.