html Copy code
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>BG3 Mini</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Georgia', serif;
background: linear-gradient(135deg, #1a1a2e, #16213e);
color: #f0f0f0;
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
padding: 20px;
}
.game-container {
background: rgba(0, 0, 0, 0.7);
border-radius: 15px;
padding: 30px;
max-width: 800px;
width: 100%;
box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
border: 2px solid #4a5568;
}
h1 {
text-align: center;
color: #ffd700;
margin-bottom: 20px;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}
.stats {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
gap: 15px;
margin-bottom: 20px;
}
.stat-box {
background: rgba(255, 255, 255, 0.1);
padding: 15px;
border-radius: 10px;
text-align: center;
border: 1px solid rgba(255, 255, 255, 0.2);
}
.stat-label {
font-size: 14px;
color: #a0aec0;
margin-bottom: 5px;
}
.stat-value {
font-size: 24px;
font-weight: bold;
color: #ffd700;
}
.actions {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 15px;
margin-bottom: 20px;
}
button {
background: linear-gradient(135deg, #667eea, #764ba2);
color: white;
border: none;
padding: 15px 30px;
border-radius: 10px;
font-size: 16px;
cursor: pointer;
transition: all 0.3s;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}
button:hover:not(:disabled) {
transform: translateY(-2px);
box-shadow: 0 6px 8px rgba(0, 0, 0, 0.4);
}
button:disabled {
background: #4a5568;
cursor: not-allowed;
opacity: 0.6;
}
.inventory {
background: rgba(255, 255, 255, 0.1);
padding: 20px;
border-radius: 10px;
margin-bottom: 20px;
}
.inventory h3 {
color: #ffd700;
margin-bottom: 10px;
}
.items {
display: flex;
flex-wrap: wrap;
gap: 10px;
}
.item {
background: rgba(255, 255, 255, 0.2);
padding: 10px 15px;
border-radius: 5px;
font-size: 14px;
cursor: pointer;
transition: all 0.3s;
}
.item:hover {
background: rgba(255, 255, 255, 0.3);
transform: scale(1.05);
}
.log {
background: rgba(0, 0, 0, 0.5);
padding: 15px;
border-radius: 10px;
max-height: 200px;
overflow-y: auto;
font-size: 14px;
line-height: 1.5;
}
.log-entry {
margin-bottom: 5px;
padding: 5px;
border-radius: 3px;
}
.log-entry.combat {
color: #ff6b6b;
}
.log-entry.loot {
color: #4ecdc4;
}
.log-entry.info {
color: #a0aec0;
}
.enemy {
text-align: center;
margin: 20px 0;
}
.enemy-name {
font-size: 24px;
color: #ff6b6b;
margin-bottom: 10px;
}
.enemy-health {
background: rgba(255, 0, 0, 0.3);
height: 20px;
border-radius: 10px;
overflow: hidden;
margin-bottom: 10px;
}
.enemy-health-bar {
background: #ff6b6b;
height: 100%;
transition: width 0.3s;
}
.victory {
text-align: center;
font-size: 36px;
color: #ffd700;
animation: pulse 2s infinite;
}
@keyframes pulse {
0% { transform: scale(1); }
50% { transform: scale(1.1); }
100% { transform: scale(1); }
}
.hidden {
display: none;
}
</style>
</head>
<body>
<div class="game-container">
<h1>BG3 Mini</h1>
<div id="gameArea">
<div class="stats">
<div class="stat-box">
<div class="stat-label">Здоровье</div>
<div class="stat-value" id="health">100</div>
</div>
<div class="stat-box">
<div class="stat-label">Золото</div>
<div class="stat-value" id="gold">50</div>
</div>
<div class="stat-box">
<div class="stat-label">Опыт</div>
<div class="stat-value" id="exp">0</div>
</div>
<div class="stat-box">
<div class="stat-label">Уровень</div>
<div class="stat-value" id="level">1</div>
</div>
</div>
<div class="enemy" id="enemyArea">
<div class="enemy-name" id="enemyName">Гоблин</div>
<div class="enemy-health">
<div class="enemy-health-bar" id="enemyHealthBar" style="width: 100%"></div>
</div>
<div>Здоровье: <span id="enemyHealth">50</span>/50</div>
</div>
<div class="actions">
<button onclick="attack()">Атаковать</button>
<button onclick="explore()" id="exploreBtn">Исследовать</button>
<button onclick="rest()" id="restBtn">Отдохнуть</button>
<button onclick="usePotion()" id="potionBtn" disabled>Использовать зелье</button>
</div>
<div class="inventory">
<h3>Инвентарь</h3>
<div class="items" id="inventory">
<div class="item">Зелье здоровья x0</div>
</div>
</div>
<div class="log" id="log">
<div class="log-entry info">Добро пожаловать в BG3 Mini! Ваша цель - победить дракона.</div>
</div>
</div>
<div id="victoryScreen" class="hidden">
<div class="victory">ПОБЕДА!</div>
<p style="text-align: center; margin-top: 20px;">Вы победили дракона и спасли королевство!</p>
<button onclick="resetGame()" style="display: block; margin: 20px auto;">Начать заново</button>
</div>
</div>
<script>
let gameState = {
health: 100,
maxHealth: 100,
gold: 50,
exp: 0,
level: 1,
potions: 0,
currentEnemy: {
name: 'Гоблин',
health: 50,
maxHealth: 50,
expReward: 20,
goldReward: 15
},
enemies: [
{ name: 'Гоблин', health: 50, maxHealth: 50, expReward: 20, goldReward: 15 },
{ name: 'Орк', health: 80, maxHealth: 80, expReward: 35, goldReward: 25 },
{ name: 'Тролль', health: 120, maxHealth: 120, expReward: 50, goldReward: 40 },
{ name: 'Дракон', health: 200, maxHealth: 200, expReward: 100, goldReward: 100 }
],
enemyIndex: 0
};
function updateUI() {
document.getElementById('health').textContent = gameState.health;
document.getElementById('gold').textContent = gameState.gold;
document.getElementById('exp').textContent = gameState.exp;
document.getElementById('level').textContent = gameState.level;
document.getElementById('enemyName').textContent = gameState.currentEnemy.name;
document.getElementById('enemyHealth').textContent = gameState.currentEnemy.health;
document.getElementById('enemyHealthBar').style.width =
(gameState.currentEnemy.health / gameState.currentEnemy.maxHealth * 100) + '%';
document.getElementById('inventory').innerHTML =
`<div class="item">Зелье здоровья x${gameState.potions}</div>`;
document.getElementById('potionBtn').disabled = gameState.potions <= 0;
}
function addLog(message, type = 'info') {
const log = document.getElementById('log');
const entry = document.createElement('div');
entry.className = `log-entry ${type}`;
entry.textContent = message;
log.appendChild(entry);
log.scrollTop = log.scrollHeight;
}
function attack() {
const damage = Math.floor(Math.random() * 10) + 5 + gameState.level * 2;
gameState.currentEnemy.health -= damage;
addLog(`Вы нанесли ${damage} урона ${gameState.currentEnemy.name}!`, 'combat');
if (gameState.currentEnemy.health <= 0) {
gameState.gold += gameState.currentEnemy.goldReward;
gameState.exp += gameState.currentEnemy.expReward;
addLog(`Вы победили ${gameState.currentEnemy.name}! +${gameState.currentEnemy.goldReward} золота, +${gameState.currentEnemy.expReward} опыта`, 'loot');
if (gameState.exp >= gameState.level * 50) {
gameState.level++;
gameState.maxHealth += 20;
gameState.health = gameState.maxHealth;
addLog(`Повышение уровня! Уровень ${gameState.level}`, 'info');
}
gameState.enemyIndex++;
if (gameState.enemyIndex >= gameState.enemies.length) {
document.getElementById('gameArea').classList.add('hidden');
document.getElementById('victoryScreen').classList.remove('hidden');
return;
}
gameState.currentEnemy = {...gameState.enemies[gameState.enemyIndex]};
} else {
const enemyDamage = Math.floor(Math.random() * 8) + 3;
gameState.health -= enemyDamage;
addLog(`${gameState.currentEnemy.name} нанес вам ${enemyDamage} урона!`, 'combat');
if (gameState.health <= 0) {
gameState.health = 0;
addLog('Вы погибли... Но можете продолжить!', 'combat');
gameState.health = gameState.maxHealth / 2;
gameState.gold = Math.floor(gameState.gold / 2);
}
}
updateUI();
}
function explore() {
const rand = Math.random();
if (rand < 0.4) {
gameState.gold += Math.floor(Math.random() * 20) + 10;
addLog('Вы нашли сокровище! +золото', 'loot');
} else if (rand < 0.7) {
gameState.potions++;
addLog('Вы нашли зелье здоровья!', 'loot');
} else {
const damage = Math.floor(Math.random() * 15) + 5;
gameState.health -= damage;
addLog(`Вы попали в ловушку! -${damage} здоровья`, 'combat');
if (gameState.health <= 0) {
gameState.health = gameState.maxHealth / 2;
gameState.gold = Math.floor(gameState.gold / 2);
addLog('Вы едва выжили...', 'combat');
}
}
updateUI();
}
function rest() {
const cost = 20;
if (gameState.gold >= cost) {
gameState.gold -= cost;
gameState.health = gameState.maxHealth;
addLog(`Вы отдохнули и восстановили здоровье! -${cost} золота`, 'info');
} else {
addLog('Недостаточно золота для отдыха!', 'info');
}
updateUI();
}
function usePotion() {
if (gameState.potions > 0) {
gameState.potions--;
const heal = Math.floor(gameState.maxHealth * 0.4);
gameState.health = Math.min(gameState.health + heal, gameState.maxHealth);
addLog(`Вы использовали зелье! +${heal} здоровья`, 'info');
updateUI();
}
}
function resetGame() {
gameState = {
health: 100,
maxHealth: 100,
gold: 50,
exp: 0,
level: 1,
potions: 0,
currentEnemy: {...gameState.enemies[0]},
enemies: gameState.enemies,
enemyIndex: 0
};
document.getElementById('gameArea').classList.remove('hidden');
document.getElementById('victoryScreen').classList.add('hidden');
document.getElementById('log').innerHTML = '<div class="log-entry info">Добро пожаловать в BG3 Mini! Ваша цель - победить дракона.</div>';
updateUI();
}
updateUI();
</script>
</body>
</html>