diff --git a/index.html b/index.html
index 7d70e63..46f49dd 100644
--- a/index.html
+++ b/index.html
@@ -26,10 +26,6 @@
diff --git a/src/engine/game-engine.js b/src/engine/game-engine.js
index 8800f65..dbffda6 100644
--- a/src/engine/game-engine.js
+++ b/src/engine/game-engine.js
@@ -90,13 +90,6 @@ class GameEngine {
});
- this.gameState.on('penalty', (data) => {
- const penalizedPlayer = this.players.find(p => p.name === data.player);
- if (penalizedPlayer) {
- penalizedPlayer.state.penaltyTime = data.duration;
- }
-
- });
this.gameState.on('period-end', () => {
});
@@ -229,16 +222,6 @@ class GameEngine {
duration: 500,
startTime: Date.now()
});
-
- if (Math.random() < 0.1) {
- const penalizedPlayer = speed1 > speed2 ? player1 : player2;
- this.gameState.addPenalty(
- penalizedPlayer.team,
- penalizedPlayer.name,
- 'Checking',
- 120
- );
- }
}
}
@@ -304,7 +287,6 @@ class GameEngine {
player.velocity = new Vector2(0, 0);
player.state.hasPuck = false;
player.state.energy = 100;
- player.state.penaltyTime = 0;
player.aiState.lastAction = 0;
});
diff --git a/src/engine/game-state.js b/src/engine/game-state.js
index 86aebf0..2ea4d4f 100644
--- a/src/engine/game-state.js
+++ b/src/engine/game-state.js
@@ -18,14 +18,12 @@ class GameState {
shots: 0,
saves: 0,
hits: 0,
- penalties: [],
faceoffWins: 0
},
away: {
shots: 0,
saves: 0,
hits: 0,
- penalties: [],
faceoffWins: 0
}
};
@@ -52,10 +50,6 @@ class GameState {
]
};
- this.powerPlay = {
- home: null,
- away: null
- };
this.faceoff = {
isActive: false,
@@ -91,7 +85,6 @@ class GameState {
this.endPeriod();
}
- this.updatePenalties(deltaTime);
}
endPeriod() {
@@ -128,41 +121,7 @@ class GameState {
this.emit('save', { team, saves: this.stats[team].saves });
}
- addPenalty(team, player, type, duration = 120) {
- const penalty = {
- player,
- type,
- duration,
- timeRemaining: duration
- };
- this.stats[team].penalties.push(penalty);
- this.addEvent(`PENALTY - ${team.toUpperCase()} ${player}: ${type}`);
-
- const oppositeTeam = team === 'home' ? 'away' : 'home';
- this.powerPlay[oppositeTeam] = Date.now() + (duration * 1000);
-
- this.emit('penalty', { team, player, type, duration });
- }
-
- updatePenalties(deltaTime) {
- ['home', 'away'].forEach(team => {
- this.stats[team].penalties = this.stats[team].penalties.filter(penalty => {
- penalty.timeRemaining -= deltaTime * this.gameSpeed;
- if (penalty.timeRemaining <= 0) {
- this.emit('penalty-expired', { team, penalty });
- return false;
- }
- return true;
- });
- });
-
- ['home', 'away'].forEach(team => {
- if (this.powerPlay[team] && Date.now() > this.powerPlay[team]) {
- this.powerPlay[team] = null;
- }
- });
- }
addEvent(description) {
const event = {
@@ -271,7 +230,6 @@ class GameState {
isPaused: this.isPaused,
gameSpeed: this.gameSpeed,
gameOver: this.gameOver,
- powerPlay: { ...this.powerPlay },
faceoff: { ...this.faceoff }
};
}
diff --git a/src/entities/player.js b/src/entities/player.js
index 09881a6..51dce98 100644
--- a/src/entities/player.js
+++ b/src/entities/player.js
@@ -28,7 +28,6 @@ class Player {
hasPuck: false,
energy: 100,
checking: false,
- penaltyTime: 0,
injured: false
};
@@ -45,11 +44,6 @@ class Player {
}
update(deltaTime, gameState, puck, players) {
- if (this.state.penaltyTime > 0) {
- this.state.penaltyTime -= deltaTime;
- return;
- }
-
this.updateEnergy(deltaTime);
this.updateMovement(deltaTime);
this.updateAngle(deltaTime);
diff --git a/src/entities/puck.js b/src/entities/puck.js
index d4970c9..5f6791e 100644
--- a/src/entities/puck.js
+++ b/src/entities/puck.js
@@ -99,8 +99,6 @@ class Puck {
let closestDistance = Infinity;
players.forEach(player => {
- if (player.state.penaltyTime > 0) return;
-
const distance = this.position.distance(player.position);
const collisionDistance = this.radius + player.radius;
diff --git a/src/systems/ai-system.js b/src/systems/ai-system.js
index 5acbd82..0a09233 100644
--- a/src/systems/ai-system.js
+++ b/src/systems/ai-system.js
@@ -84,7 +84,6 @@ class AISystem {
gameTime: gameState.timeRemaining,
period: gameState.period,
scoreGap: gameState.homeScore - gameState.awayScore,
- powerPlay: gameState.powerPlay,
zone: this.determinePuckZone(puck, gameState)
};
@@ -104,9 +103,6 @@ class AISystem {
}
selectFormation(context) {
- if (context.powerPlay.home || context.powerPlay.away) {
- return context.powerPlay.home ? 'offensive' : 'defensive';
- }
switch (context.zone) {
case 'offensive':
@@ -124,7 +120,6 @@ class AISystem {
if (context.gameTime < 300) urgency += 0.3;
if (context.gameTime < 120) urgency += 0.3;
if (Math.abs(context.scoreGap) > 1) urgency += 0.2;
- if (context.powerPlay.home || context.powerPlay.away) urgency += 0.4;
return Math.min(1, urgency);
}
diff --git a/src/systems/renderer.js b/src/systems/renderer.js
index 8fd4c72..f207c77 100644
--- a/src/systems/renderer.js
+++ b/src/systems/renderer.js
@@ -142,9 +142,7 @@ class Renderer {
this.applyCamera();
players.forEach(player => {
- if (player.state.penaltyTime <= 0) {
- player.render(this.ctx);
- }
+ player.render(this.ctx);
});
this.ctx.restore();
@@ -160,7 +158,6 @@ class Renderer {
drawUI(gameState) {
this.updateScoreBoard(gameState);
this.updateGameStats(gameState);
- this.updatePenalties(gameState);
}
updateScoreBoard(gameState) {
@@ -175,27 +172,6 @@ class Renderer {
document.getElementById('away-shots').textContent = gameState.stats.away.shots;
}
- updatePenalties(gameState) {
- const homePenalties = document.getElementById('home-penalties');
- const awayPenalties = document.getElementById('away-penalties');
-
- homePenalties.innerHTML = '';
- awayPenalties.innerHTML = '';
-
- gameState.stats.home.penalties.forEach(penalty => {
- const penaltyDiv = document.createElement('div');
- penaltyDiv.className = 'penalty-box';
- penaltyDiv.textContent = `${penalty.player}: ${penalty.type} (${Math.ceil(penalty.timeRemaining)}s)`;
- homePenalties.appendChild(penaltyDiv);
- });
-
- gameState.stats.away.penalties.forEach(penalty => {
- const penaltyDiv = document.createElement('div');
- penaltyDiv.className = 'penalty-box';
- penaltyDiv.textContent = `${penalty.player}: ${penalty.type} (${Math.ceil(penalty.timeRemaining)}s)`;
- awayPenalties.appendChild(penaltyDiv);
- });
- }
drawParticleEffect(position, type, color = '#ffff00') {
this.ctx.save();
diff --git a/src/systems/rules-system.js b/src/systems/rules-system.js
index 11da552..bdaf5bb 100644
--- a/src/systems/rules-system.js
+++ b/src/systems/rules-system.js
@@ -3,15 +3,11 @@ class RulesSystem {
this.gameState = gameState;
this.lastOffsideCheck = 0;
this.lastIcingCheck = 0;
- this.penaltyQueue = [];
}
update(players, puck, deltaTime) {
this.checkOffside(players, puck);
this.checkIcing(players, puck);
- this.checkGoaltenderInterference(players, puck);
- this.checkHighSticking(players, puck);
- this.processPenaltyQueue();
}
checkOffside(players, puck) {
@@ -126,81 +122,6 @@ class RulesSystem {
this.scheduleFaceoff(faceoffPosition);
}
- checkGoaltenderInterference(players, puck) {
- const goalies = players.filter(p => p.role === 'G');
-
- goalies.forEach(goalie => {
- const crease = this.getCreaseArea(goalie.team);
- const opponents = players.filter(p =>
- p.team !== goalie.team &&
- this.isPlayerInCrease(p, crease)
- );
-
- opponents.forEach(opponent => {
- if (opponent.velocity.magnitude() > 100) {
- this.callGoaltenderInterference(opponent);
- }
- });
- });
- }
-
- checkHighSticking(players, puck) {
- if (puck.position.y < 200) {
- const lastTouch = puck.lastPlayerTouch;
- if (lastTouch && Math.random() < 0.1) {
- this.callHighSticking(lastTouch);
- }
- }
- }
-
- isPlayerInCrease(player, crease) {
- return player.position.x >= crease.x &&
- player.position.x <= crease.x + crease.width &&
- player.position.y >= crease.y &&
- player.position.y <= crease.y + crease.height;
- }
-
- getCreaseArea(team) {
- const goalY = this.gameState.rink.centerY;
- const goalX = team === 'home' ? 50 : this.gameState.rink.width - 50;
-
- return {
- x: goalX - 30,
- y: goalY - 60,
- width: 60,
- height: 120
- };
- }
-
- callGoaltenderInterference(player) {
- this.queuePenalty(player.team, player.name, 'Goaltender Interference', 120);
- }
-
- callHighSticking(player) {
- this.queuePenalty(player.team, player.name, 'High Sticking', 120);
- }
-
- queuePenalty(team, player, type, duration) {
- this.penaltyQueue.push({
- team,
- player,
- type,
- duration,
- timestamp: Date.now()
- });
- }
-
- processPenaltyQueue() {
- if (this.penaltyQueue.length === 0) return;
-
- const penalty = this.penaltyQueue.shift();
- this.gameState.addPenalty(
- penalty.team,
- penalty.player,
- penalty.type,
- penalty.duration
- );
- }
scheduleFaceoff(position) {
setTimeout(() => {
@@ -223,34 +144,8 @@ class RulesSystem {
return nearest;
}
- checkFighting(players) {
- for (let i = 0; i < players.length; i++) {
- for (let j = i + 1; j < players.length; j++) {
- const player1 = players[i];
- const player2 = players[j];
-
- if (player1.team !== player2.team &&
- player1.position.distance(player2.position) < 20 &&
- player1.velocity.magnitude() > 150 &&
- player2.velocity.magnitude() > 150 &&
- Math.random() < 0.01) {
-
- this.callFighting(player1, player2);
- }
- }
- }
- }
-
- callFighting(player1, player2) {
- this.queuePenalty(player1.team, player1.name, 'Fighting', 300);
- this.queuePenalty(player2.team, player2.name, 'Fighting', 300);
-
- this.gameState.addEvent(`FIGHT - ${player1.name} vs ${player2.name}`);
- }
-
reset() {
this.lastOffsideCheck = 0;
this.lastIcingCheck = 0;
- this.penaltyQueue = [];
}
}
\ No newline at end of file