<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Hello, world</title>
</head>
<body>
<main>
<h1>Hello, world.</h1>
<p>Every good idea starts somewhere.</p>
</main>
</body>
</html>
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>UFC 3D Octagon Legends: Ultimate Career 2026</title>
<style>
* { box-sizing: border-box; margin: 0; padding: 0; user-select: none; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
body { background: #050508; color: #fff; overflow: hidden; width: 100vw; height: 100vh; }
#game-container { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; }
/* UI HUD Overlay */
#hud { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 10; pointer-events: none; display: flex; flex-direction: column; justify-content: space-between; padding: 25px; }
.hud-top { display: flex; justify-content: space-between; align-items: flex-start; width: 100%; }
.fighter-hud { background: rgba(12, 12, 18, 0.88); border: 2px solid #2a2a38; border-radius: 12px; padding: 18px; width: 380px; backdrop-filter: blur(8px); box-shadow: 0 10px 30px rgba(0,0,0,0.6); }
.fighter-hud.player { border-left: 6px solid #e50914; }
.fighter-hud.opponent { border-right: 6px solid #0055ff; text-align: right; }
.fighter-name { font-size: 1.3rem; font-weight: 900; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; color: #f8f8f8; }
.bar-container { width: 100%; background: #181822; height: 16px; border-radius: 8px; overflow: hidden; margin-bottom: 8px; border: 1px solid #3a3a4e; position: relative; }
.bar-fill { height: 100%; width: 100%; transition: width 0.1s ease; }
.hp-fill { background: linear-gradient(90deg, #ff0055, #ff3333); }
.stamina-fill { background: linear-gradient(90deg, #00bfff, #0055ff); }
.bar-text { position: absolute; width: 100%; text-align: center; font-size: 10px; font-weight: bold; top: 1px; color: #fff; text-shadow: 1px 1px 1px #000; }
.hud-center { text-align: center; background: rgba(10,10,15,0.85); padding: 12px 30px; border-radius: 14px; border: 1px solid #333; box-shadow: 0 5px 20px rgba(0,0,0,0.5); }
.round-title { font-size: 0.85rem; color: #aaa; text-transform: uppercase; letter-spacing: 2px; }
.match-clock { font-size: 2.4rem; font-weight: 900; color: #ffd700; font-family: monospace; letter-spacing: 2px; }
.ppv-logo { font-size: 0.75rem; color: #e50914; font-weight: 900; letter-spacing: 3px; margin-bottom: 2px; }
.hud-bottom { display: flex; justify-content: space-between; align-items: flex-end; width: 100%; }
.controls-hint { background: rgba(10, 10, 15, 0.85); padding: 12px 18px; border-radius: 10px; font-size: 11px; color: #ccc; border: 1px solid #333; pointer-events: auto; backdrop-filter: blur(5px); }
.controls-hint b { color: #ffd700; }
/* Screens & Menus */
.screen { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 100; background: radial-gradient(circle at center, #161622 0%, #050508 100%); display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 20px; transition: opacity 0.3s ease; }
.screen.hidden { opacity: 0; pointer-events: none; display: none !important; }
.menu-card { background: rgba(16, 16, 24, 0.95); border: 2px solid #333; border-radius: 18px; padding: 35px; width: 650px; max-width: 90vw; box-shadow: 0 20px 60px rgba(0,0,0,0.9); }
.menu-title { font-size: 2.2rem; font-weight: 900; text-align: center; margin-bottom: 15px; text-transform: uppercase; letter-spacing: 2px; background: linear-gradient(45deg, #ff0055, #ffd700); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.85rem; color: #aaa; margin-bottom: 6px; text-transform: uppercase; font-weight: bold; letter-spacing: 1px; }
.form-control { width: 100%; padding: 12px 16px; background: #0c0c12; border: 1px solid #444; border-radius: 8px; color: #fff; font-size: 1rem; }
.form-control:focus { border-color: #e50914; outline: none; }
.slider-container { display: flex; align-items: center; gap: 15px; }
.slider-container input { flex: 1; accent-color: #e50914; height: 6px; background: #222; border-radius: 3px; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 15px; background: #0c0c12; padding: 18px; border-radius: 10px; border: 1px solid #2a2a38; }
.stat-item { display: flex; justify-content: space-between; align-items: center; font-size: 0.9rem; }
.stat-btn { background: #2a2a38; border: none; color: #fff; width: 28px; height: 28px; border-radius: 6px; font-weight: bold; cursor: pointer; transition: background 0.2s; }
.stat-btn:hover { background: #e50914; }
.btn { width: 100%; padding: 14px; background: linear-gradient(135deg, #e50914, #b20710); color: #fff; border: none; border-radius: 8px; font-size: 1.1rem; font-weight: bold; text-transform: uppercase; letter-spacing: 1px; cursor: pointer; margin-top: 20px; transition: transform 0.1s, filter 0.2s; box-shadow: 0 4px 15px rgba(229, 9, 20, 0.4); }
.btn:hover { filter: brightness(1.2); transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
/* Grappling HUD Overlay */
#grappling-hud { position: absolute; bottom: 120px; left: 50%; transform: translateX(-50%); background: rgba(10, 10, 15, 0.95); border: 2px solid #ffd700; padding: 18px 35px; border-radius: 14px; text-align: center; z-index: 20; display: none; box-shadow: 0 10px 30px rgba(0,0,0,0.8); }
#grappling-hud h3 { color: #ffd700; margin-bottom: 10px; font-size: 1.15rem; text-transform: uppercase; letter-spacing: 1px; }
.grapple-actions { display: flex; gap: 12px; justify-content: center; margin-top: 12px; }
.grapple-btn { background: #1a1a24; border: 1px solid #555; color: #fff; padding: 10px 16px; border-radius: 8px; font-weight: bold; cursor: pointer; font-size: 0.85rem; transition: all 0.2s; }
.grapple-btn:hover { background: #ffd700; color: #000; border-color: #ffd700; }
/* Cinematic Announcement Banner */
#announcement { position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%) scale(0.5); font-size: 3.8rem; font-weight: 900; color: #fff; text-shadow: 0 0 25px #e50914, 0 0 50px #000; text-transform: uppercase; letter-spacing: 4px; z-index: 50; opacity: 0; pointer-events: none; transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s; text-align: center; }
#announcement.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
</style>
<!-- Three.js Library -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
</head>
<body>
<div id="game-container"></div>
<!-- MAIN UI HUD -->
<div id="hud" style="display: none;">
<div class="hud-top">
<div class="fighter-hud player">
<div class="fighter-name" id="hud-player-name">JOGADOR</div>
<div class="bar-container">
<div class="bar-fill hp-fill" id="player-hp"></div>
<div class="bar-text">VIDA</div>
</div>
<div class="bar-container">
<div class="bar-fill stamina-fill" id="player-stamina"></div>
<div class="bar-text">STAMINA</div>
</div>
</div>
<div class="hud-center">
<div class="ppv-logo">UFC PAY-PER-VIEW</div>
<div class="round-title" id="hud-round">ROUND 1</div>
<div class="match-clock" id="hud-clock">05:00</div>
</div>
<div class="fighter-hud opponent">
<div class="fighter-name" id="hud-opponent-name">OPONENTE</div>
<div class="bar-container">
<div class="bar-fill hp-fill" id="opponent-hp"></div>
<div class="bar-text">VIDA</div>
</div>
<div class="bar-container">
<div class="bar-fill stamina-fill" id="opponent-stamina"></div>
<div class="bar-text">STAMINA</div>
</div>
</div>
</div>
<div class="hud-bottom">
<div class="controls-hint">
<b>[A / D]</b> Movimentar | <b>[Mouse Esq]</b> Jab | <b>[Mouse Dir]</b> Direto<br>
<b>[Q]</b> Cruzado Esq | <b>[E]</b> Cruzado Dir | <b>[R]</b> Chute | <b>[S]</b> Bloquear<br>
<b>[Espaço]</b> Takedown | <b>[1 a 4]</b> Solo, Pegada de Costas & Chave de Braço
</div>
<div class="controls-hint" id="career-info-hud" style="text-align: right;">
<b>Modo Carreira:</b> Luta 1/4 | Bolsa: $15,000 | Ranking: #10
</div>
</div>
</div>
<!-- GRAPPLING HUD -->
<div id="grappling-hud">
<h3 id="grapple-title">CONTROLE DE SOLO: GUARDA FECHADA</h3>
<div class="grapple-actions" id="grapple-buttons">
<button class="grapple-btn" onclick="triggerGrappleAction('transition')">[1] Passar / Montar</button>
<button class="grapple-btn" onclick="triggerGrappleAction('back')">[2] Pegar Costas</button>
<button class="grapple-btn" onclick="triggerGrappleAction('submission')">[3] Chave de Braço / Guilhotina</button>
<button class="grapple-btn" onclick="triggerGrappleAction('gnp')">[4] Ground & Pound</button>
</div>
</div>
<div id="announcement">NOCAUTE!</div>
<!-- MAIN MENU SCREEN -->
<div id="menu-screen" class="screen">
<div class="menu-card">
<div class="menu-title">UFC Octagon Legends</div>
<p style="text-align: center; color: #aaa; margin-bottom: 25px;">Modo Carreira Ultimate 2026 • Animações Fluidas e Realistas • Editor FIFA</p>
<button class="btn" onclick="showCreationScreen()">Iniciar Modo Carreira</button>
<button class="btn" style="background: linear-gradient(135deg, #2a2a38, #15151c);" onclick="startQuickFight()">Luta Rápida</button>
</div>
</div>
<!-- CREATION SCREEN -->
<div id="creation-screen" class="screen hidden">
<div class="menu-card" style="width: 720px;">
<div class="menu-title">Criar Lutador (Estilo FIFA)</div>
<div class="form-group">
<label>Nome do Lutador & Apelido</label>
<input type="text" id="create-name" class="form-control" value="Matheus 'The Prodigy'">
</div>
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 15px;">
<div class="form-group">
<label>Altura: <span id="height-val" style="color:#ffd700;">1.77m</span></label>
<div class="slider-container">
<input type="range" id="create-height" min="1.60" max="2.05" step="0.01" value="1.77" oninput="updateBiometrics()">
</div>
</div>
<div class="form-group">
<label>Peso: <span id="weight-val" style="color:#ffd700;">76kg</span></label>
<div class="slider-container">
<input type="range" id="create-weight" min="60" max="120" step="1" value="76" oninput="updateBiometrics()">
</div>
</div>
</div>
<div class="form-group" style="margin-top: 5px;">
<label>Pontos de Habilidade Livres Disponíveis: <span id="skill-points" style="color: #ffd700; font-size: 1.25rem;">8</span></label>
</div>
<div class="stats-grid">
<div class="stat-item">
<span>Potência (Power): <b id="stat-power">55</b></span>
<button class="stat-btn" onclick="allocateSkill('power')">+</button>
</div>
<div class="stat-item">
<span>Trocação (Striking): <b id="stat-striking">60</b></span>
<button class="stat-btn" onclick="allocateSkill('striking')">+</button>
</div>
<div class="stat-item">
<span>Wrestling: <b id="stat-wrestling">50</b></span>
<button class="stat-btn" onclick="allocateSkill('wrestling')">+</button>
</div>
<div class="stat-item">
<span>Jiu-Jitsu: <b id="stat-bjj">50</b></span>
<button class="stat-btn" onclick="allocateSkill('bjj')">+</button>
</div>
<div class="stat-item">
<span>Cardio: <b id="stat-cardio">60</b></span>
<button class="stat-btn" onclick="allocateSkill('cardio')">+</button>
</div>
<div class="stat-item">
<span>Queixo (Chin): <b id="stat-chin">60</b></span>
<button class="stat-btn" onclick="allocateSkill('chin')">+</button>
</div>
</div>
<button class="btn" onclick="startCareer()">Entrar no Octógono (Modo Carreira)</button>
</div>
</div>
<!-- GAME LOGIC & THREE.JS ENGINE -->
<script>
let scene, camera, renderer;
let playerRig, opponentRig;
let gameState = 'MENU';
let clock = new THREE.Clock();
let player = {
name: "Matheus",
height: 1.77,
weight: 76,
power: 55,
striking: 60,
wrestling: 50,
bjj: 50,
cardio: 60,
chin: 60,
hp: 100,
maxHp: 100,
stamina: 100,
maxStamina: 100,
x: -2.2,
z: 0,
activeArm: 'r', // 'l' ou 'r' para socos alternados
punchProgress: 1.0,
isPunching: false,
punchType: 'jab'
};
let opponent = {
name: "Alex Poatan",
hp: 100,
maxHp: 100,
stamina: 100,
maxStamina: 100,
power: 82,
striking: 85,
wrestling: 55,
bjj: 50,
x: 2.2,
z: 0,
aiTimer: 0,
punchProgress: 1.0,
isPunching: false,
activeArm: 'r'
};
let matchTime = 300;
let careerFightIndex = 1;
let careerPurse = 15000;
let freeSkillPoints = 8;
let isGrappling = false;
let grapplePosition = 'guard';
const opponentsList = [
{ name: "Alex Poatan", power: 82, striking: 85, wrestling: 55, bjj: 50 },
{ name: "Islam Makhachev", power: 70, striking: 74, wrestling: 92, bjj: 90 },
{ name: "Charles Do Bronx", power: 75, striking: 78, wrestling: 70, bjj: 96 },
{ name: "Jon Jones (Campeão)", power: 88, striking: 86, wrestling: 94, bjj: 92 }
];
const keys = {};
function init() {
scene = new THREE.Scene();
scene.background = new THREE.Color(0x06060a);
scene.fog = new THREE.FogExp2(0x06060a, 0.015);
camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 1000);
camera.position.set(0, 3.8, 8.8);
camera.lookAt(0, 1.3, 0);
renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.outputEncoding = THREE.sRGBEncoding;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.2;
document.getElementById('game-container').appendChild(renderer.domElement);
// Iluminação da Arena estilo PPV
const ambient = new THREE.AmbientLight(0xddeeff, 0.45);
scene.add(ambient);
const mainSpot = new THREE.SpotLight(0xffffff, 2.5);
mainSpot.position.set(0, 16, 0);
mainSpot.angle = Math.PI / 3;
mainSpot.penumbra = 0.7;
mainSpot.castShadow = true;
mainSpot.shadow.mapSize.width = 2048;
mainSpot.shadow.mapSize.height = 2048;
scene.add(mainSpot);
const redCornerLight = new THREE.PointLight(0xff2233, 3, 14);
redCornerLight.position.set(-5.5, 3.2, -5.5);
scene.add(redCornerLight);
const blueCornerLight = new THREE.PointLight(0x0066ff, 3, 14);
blueCornerLight.position.set(5.5, 3.2, 5.5);
scene.add(blueCornerLight);
createRealisticArena();
createRealisticFighters();
window.addEventListener('resize', onWindowResize);
window.addEventListener('keydown', (e) => { keys[e.key.toLowerCase()] = true; handleCombatKeys(e.key.toLowerCase()); });
window.addEventListener('keyup', (e) => { keys[e.key.toLowerCase()] = false; });
window.addEventListener('mousedown', (e) => {
if (gameState !== 'FIGHT' || isGrappling) return;
if (e.button === 0) performStrike('jab');
if (e.button === 2) performStrike('cross');
});
window.addEventListener('contextmenu', e => e.preventDefault());
animate();
}
function createRealisticArena() {
const canvas = document.createElement('canvas');
canvas.width = 1024; canvas.height = 1024;
const ctx = canvas.getContext('2d');
ctx.fillStyle = '#16161c'; ctx.fillRect(0, 0, 1024, 1024);
ctx.strokeStyle = '#e50914'; ctx.lineWidth = 16;
ctx.beginPath();
const radius = 450;
for (let i = 0; i < 8; i++) {
const angle = (i * Math.PI / 4) + Math.PI/8;
const x = 512 + radius * Math.cos(angle);
const y = 512 + radius * Math.sin(angle);
if (i === 0) ctx.moveTo(x, y); else ctx.lineTo(x, y);
}
ctx.closePath();
ctx.stroke();
ctx.fillStyle = '#0e0e12'; ctx.beginPath(); ctx.arc(512, 512, 130, 0, Math.PI*2); ctx.fill();
ctx.strokeStyle = '#ffd700'; ctx.lineWidth = 6; ctx.stroke();
ctx.fillStyle = '#ffd700'; ctx.font = 'bold 38px sans-serif'; ctx.textAlign = 'center'; ctx.fillText('UFC', 512, 524);
const floorMat = new THREE.MeshStandardMaterial({
map: new THREE.CanvasTexture(canvas),
roughness: 0.25,
metalness: 0.1
});
const floor = new THREE.Mesh(new THREE.CylinderGeometry(6, 6, 0.3, 8), floorMat);
floor.position.y = -0.15;
floor.receiveShadow = true;
scene.add(floor);
for (let i = 0; i < 8; i++) {
const angle = (i * Math.PI / 4) + Math.PI/8;
const post = new THREE.Mesh(
new THREE.CylinderGeometry(0.08, 0.08, 3.8, 16),
new THREE.MeshStandardMaterial({ color: i < 4 ? 0xcc1111 : 0x1133cc, metalness: 0.85, roughness: 0.2 })
);
post.position.set(5.5 * Math.cos(angle), 1.9, 5.5 * Math.sin(angle));
post.castShadow = true;
scene.add(post);
}
}
function createRealisticFighters() {
playerRig = buildRealisticFighterModel(0xdfbe9b, 0x1a1a1a, 0xcc1111);
scene.add(playerRig.root);
opponentRig = buildRealisticFighterModel(0xc8ad8d, 0x151515, 0x1133cc);
scene.add(opponentRig.root);
}
function buildRealisticFighterModel(skinColor, hairColor, shortsColor) {
const root = new THREE.Group();
const skinMat = new THREE.MeshStandardMaterial({ color: skinColor, roughness: 0.45, metalness: 0.05 });
const shortsMat = new THREE.MeshStandardMaterial({ color: shortsColor, roughness: 0.35, metalness: 0.1 });
const gloveMat = new THREE.MeshStandardMaterial({ color: 0xcc1111, roughness: 0.2, metalness: 0.3 });
const headgearMat = new THREE.MeshStandardMaterial({ color: 0x111111, roughness: 0.3, metalness: 0.2 });
// Torso (com referência para animação de respiração)
const torso = new THREE.Mesh(new THREE.BoxGeometry(0.52, 0.78, 0.32), skinMat);
torso.position.y = 1.15;
torso.castShadow = true;
root.add(torso);
const shorts = new THREE.Mesh(new THREE.BoxGeometry(0.54, 0.38, 0.34), shortsMat);
shorts.position.y = 0.72;
shorts.castShadow = true;
root.add(shorts);
const head = new THREE.Mesh(new THREE.SphereGeometry(0.19, 24, 24), skinMat);
head.position.set(0, 1.72, 0);
head.castShadow = true;
root.add(head);
const headgear = new THREE.Mesh(new THREE.SphereGeometry(0.21, 24, 24, 0, Math.PI*2, 0, Math.PI*0.7), headgearMat);
headgear.position.set(0, 1.74, 0);
root.add(headgear);
const faceGuard = new THREE.Mesh(new THREE.BoxGeometry(0.24, 0.24, 0.1), headgearMat);
faceGuard.position.set(0, 1.72, 0.15);
root.add(faceGuard);
// Braço Esquerdo (Pivot para rotação realista)
const lArmPivot = new THREE.Group();
lArmPivot.position.set(-0.35, 1.45, 0);
const lArm = new THREE.Mesh(new THREE.BoxGeometry(0.15, 0.58, 0.15), skinMat);
lArm.position.set(0, -0.28, 0.1);
const lGlove = new THREE.Mesh(new THREE.BoxGeometry(0.22, 0.25, 0.28), gloveMat);
lGlove.position.set(0, -0.62, 0.22);
lArmPivot.add(lArm); lArmPivot.add(lGlove);
root.add(lArmPivot);
// Braço Direito (Pivot para rotação realista)
const rArmPivot = new THREE.Group();
rArmPivot.position.set(0.35, 1.45, 0);
const rArm = new THREE.Mesh(new THREE.BoxGeometry(0.15, 0.58, 0.15), skinMat);
rArm.position.set(0, -0.28, 0.1);
const rGlove = new THREE.Mesh(new THREE.BoxGeometry(0.22, 0.25, 0.28), gloveMat);
rGlove.position.set(0, -0.62, 0.22);
rArmPivot.add(rArm); rArmPivot.add(rGlove);
root.add(rArmPivot);
const legGeo = new THREE.BoxGeometry(0.19, 0.74, 0.2);
const lLeg = new THREE.Mesh(legGeo, skinMat); lLeg.position.set(-0.16, 0.35, 0);
const rLeg = new THREE.Mesh(legGeo, skinMat); rLeg.position.set(0.16, 0.35, 0);
root.add(lLeg); root.add(rLeg);
return { root, torso, lArmPivot, rArmPivot, head, lLeg, rLeg };
}
function updateBiometrics() {
const h = parseFloat(document.getElementById('create-height').value);
const w = parseInt(document.getElementById('create-weight').value);
document.getElementById('height-val').innerText = h.toFixed(2) + 'm';
document.getElementById('weight-val').innerText = w + 'kg';
player.height = h;
player.weight = w;
player.power = 50 + Math.floor((w - 70) * 0.35);
player.striking = 55 - Math.floor((w - 75) * 0.15) + Math.floor((1.80 - h) * 12);
document.getElementById('stat-power').innerText = player.power;
document.getElementById('stat-striking').innerText = player.striking;
}
function allocateSkill(stat) {
if (freeSkillPoints <= 0) return;
freeSkillPoints--;
player[stat] += 3;
document.getElementById('skill-points').innerText = freeSkillPoints;
document.getElementById('stat-' + stat).innerText = player[stat];
}
function showCreationScreen() {
document.getElementById('menu-screen').classList.add('hidden');
document.getElementById('creation-screen').classList.remove('hidden');
}
function startQuickFight() {
document.getElementById('menu-screen').classList.add('hidden');
initFight();
}
function startCareer() {
player.name = document.getElementById('create-name').value || "Matheus";
document.getElementById('creation-screen').classList.add('hidden');
initFight();
}
function initFight() {
gameState = 'FIGHT';
document.getElementById('hud').style.display = 'flex';
document.getElementById('hud-player-name').innerText = player.name;
document.getElementById('hud-opponent-name').innerText = opponent.name;
player.hp = player.maxHp;
player.stamina = player.maxStamina;
opponent.hp = opponent.maxHp;
opponent.stamina = opponent.maxStamina;
player.x = -2.2; player.z = 0;
opponent.x = 2.2; opponent.z = 0;
isGrappling = false;
document.getElementById('grappling-hud').style.display = 'none';
}
function handleCombatKeys(key) {
if (gameState !== 'FIGHT' || isGrappling) return;
if (key === 'q') triggerPunch(player, 'left_hook');
if (key === 'e') triggerPunch(player, 'right_hook');
if (key === 'r') triggerPunch(player, 'kick');
if (key === ' ') attemptTakedown();
}
function performStrike(type) {
if (player.stamina < 10 || player.isPunching) return;
player.stamina -= 8;
triggerPunch(player, type);
let damage = 10;
if (type === 'jab') damage = 8 + (player.striking * 0.1);
if (type === 'cross') damage = 14 + (player.power * 0.15);
const dist = Math.abs(player.x - opponent.x);
if (dist < 2.6) {
opponent.hp -= damage;
if (opponent.hp < 0) opponent.hp = 0;
triggerHitReaction(opponentRig.root);
checkMatchEnd();
}
}
function triggerPunch(fighter, type) {
fighter.isPunching = true;
fighter.punchProgress = 0;
fighter.punchType = type;
fighter.activeArm = (type === 'left_hook' || type === 'jab') ? 'l' : 'r';
}
function attemptTakedown() {
const dist = Math.abs(player.x - opponent.x);
if (dist < 2.2) {
const chance = (player.wrestling + (player.weight * 0.1)) - opponent.wrestling;
if (Math.random() * 100 < 55 + chance) {
enterGrappling('guard');
}
}
}
function enterGrappling(pos) {
isGrappling = true;
grapplePosition = pos;
const names = {
'guard': 'GUARDA FECHADA',
'half-guard': 'MEIA-GUARDA',
'mount': 'MONTADA COMPLETA',
'back-control': 'PEGADA DE COSTAS'
};
document.getElementById('grapple-title').innerText = 'CONTROLE DE SOLO: ' + names[pos];
document.getElementById('grappling-hud').style.display = 'block';
}
function triggerGrappleAction(action) {
if (!isGrappling) return;
if (action === 'transition') {
if (grapplePosition === 'guard') grapplePosition = 'half-guard';
else if (grapplePosition === 'half-guard') grapplePosition = 'mount';
else if (grapplePosition === 'mount') grapplePosition = 'back-control';
document.getElementById('grapple-title').innerText = 'CONTROLE DE SOLO: ' + grapplePosition.toUpperCase();
} else if (action === 'back') {
grapplePosition = 'back-control';
document.getElementById('grapple-title').innerText = 'CONTROLE DE SOLO: PEGADA DE COSTAS';
} else if (action === 'submission') {
const success = Math.random() * 100 < (player.bjj * 0.85);
if (success) {
opponent.hp = 0;
checkMatchEnd();
} else {
isGrappling = false;
document.getElementById('grappling-hud').style.display = 'none';
}
} else if (action === 'gnp') {
let gnpDamage = 22 + (player.power * 0.35);
if (grapplePosition === 'back-control' || grapplePosition === 'mount') gnpDamage *= 1.3;
opponent.hp -= gnpDamage;
if (opponent.hp < 0) opponent.hp = 0;
checkMatchEnd();
}
}
function triggerHitReaction(mesh) {
mesh.position.z += 0.35;
setTimeout(() => mesh.position.z -= 0.35, 120);
}
function checkMatchEnd() {
if (opponent.hp <= 0) {
gameState = 'END';
showAnnouncement("VITÓRIA POR NOCAUTE!");
setTimeout(() => {
careerFightIndex++;
careerPurse += 20000;
if (careerFightIndex <= opponentsList.length) {
opponent = opponentsList[careerFightIndex - 1];
}
initFight();
}, 3000);
} else if (player.hp <= 0) {
gameState = 'END';
showAnnouncement("DERROTA POR NOCAUTE");
setTimeout(() => { initFight(); }, 3000);
}
}
function showAnnouncement(text) {
const ann = document.getElementById('announcement');
ann.innerText = text;
ann.classList.add('show');
setTimeout(() => ann.classList.remove('show'), 2500);
}
function updateAI(delta) {
if (gameState !== 'FIGHT' || isGrappling) return;
opponent.aiTimer += delta;
if (opponent.aiTimer > 1.4) {
opponent.aiTimer = 0;
if (Math.abs(player.x - opponent.x) > 2.0) {
opponent.x += player.x > opponent.x ? 0.45 : -0.45;
} else {
if (Math.random() < 0.65) {
triggerPunch(opponent, 'cross');
player.hp -= 10 + (opponent.power * 0.06);
if (player.hp < 0) player.hp = 0;
triggerHitReaction(playerRig.root);
checkMatchEnd();
}
}
}
}
// Função de Animação Procedural dos Lutadores (Respiração + Socos Fluidos)
function updateFighterAnimation(fighter, rig, delta, time) {
// Respiração contínua em Idle
const breath = Math.sin(time * 6) * 0.03;
rig.torso.position.y = 1.15 + breath;
rig.head.position.y = 1.72 + breath;
// Guarda alta padrão (braços flexionados na altura do rosto)
if (!fighter.isPunching) {
rig.lArmPivot.rotation.x = -0.8 + Math.sin(time * 4) * 0.05;
rig.rArmPivot.rotation.x = -0.8 - Math.sin(time * 4) * 0.05;
rig.lArmPivot.rotation.y = 0.2;
rig.rArmPivot.rotation.y = -0.2;
} else {
// Animação dinâmica do soco
fighter.punchProgress += delta * 7; // Velocidade do soco
const progress = fighter.punchProgress;
const activeArmPivot = fighter.activeArm === 'l' ? rig.lArmPivot : rig.rArmPivot;
if (progress <= 1.0) {
// Avança o braço para frente (soco realista estendendo o cotovelo e girando o ombro)
activeArmPivot.rotation.x = -0.8 - Math.sin(progress * Math.PI) * 1.4;
activeArmPivot.rotation.z = (fighter.activeArm === 'l' ? 1 : -1) * Math.sin(progress * Math.PI) * 0.4;
} else {
// Retorna à guarda
fighter.isPunching = false;
activeArmPivot.rotation.set(0, 0, 0);
}
}
}
function animate() {
requestAnimationFrame(animate);
const delta = clock.getDelta();
const time = clock.getElapsedTime();
if (gameState === 'FIGHT') {
if (keys['a'] || keys['arrowleft']) player.x -= 4.2 * delta;
if (keys['d'] || keys['arrowright']) player.x += 4.2 * delta;
player.x = Math.max(-4.5, Math.min(4.5, player.x));
if (player.stamina < player.maxStamina) player.stamina += 18 * delta;
playerRig.root.position.set(player.x, 0, player.z);
opponentRig.root.position.set(opponent.x, 0, opponent.z);
// Executa as animações proceduralmente em cada frame
updateFighterAnimation(player, playerRig, delta, time);
updateFighterAnimation(opponent, opponentRig, delta, time);
updateAI(delta);
document.getElementById('player-hp').style.width = (player.hp / player.maxHp * 100) + '%';
document.getElementById('player-stamina').style.width = (player.stamina / player.maxStamina * 100) + '%';
document.getElementById('opponent-hp').style.width = (opponent.hp / opponent.maxHp * 100) + '%';
document.getElementById('opponent-stamina').style.width = (opponent.stamina / opponent.maxStamina * 100) + '%';
matchTime -= delta;
let mins = Math.floor(matchTime / 60);
let secs = Math.floor(matchTime % 60);
document.getElementById('hud-clock').innerText = `0${mins}:${secs < 10 ? '0' : ''}${secs}`;
}
renderer.render(scene, camera);
}
function onWindowResize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
}
window.onload = init;
</script>
</body>
</html>