DEVLOG update: Documenting reversion of GameRenderer refactoring to stable state

This commit is contained in:
2026-01-09 17:04:53 +01:00
parent 009c2a4135
commit 5888c59ba4
3 changed files with 94 additions and 0 deletions

View File

@@ -77,6 +77,7 @@ export class GameEngine {
this.heroes.forEach(hero => {
hero.currentMoves = hero.stats.move;
hero.hasAttacked = false;
hero.hasEscapedPin = false; // Reset pin escape status
});
console.log("Refilled Hero Moves");
}
@@ -598,6 +599,9 @@ export class GameEngine {
isEntityPinned(entity) {
if (!this.monsters || this.monsters.length === 0) return false;
// If already escaped this turn, not pinned
if (entity.hasEscapedPin) return false;
return this.monsters.some(m => {
if (m.isDead) return false;
const dx = Math.abs(entity.x - m.x);
@@ -629,6 +633,26 @@ export class GameEngine {
});
}
attemptBreakAway(hero) {
if (!hero || hero.hasEscapedPin) return { success: false, roll: 0 };
const roll = Math.floor(Math.random() * 6) + 1;
const target = hero.stats.pin_target || 6;
const success = roll >= target;
if (success) {
hero.hasEscapedPin = true;
} else {
// Failed to escape: Unit loses movement and ranged attacks?
// "The Adventurer must stay where he is and fight"
// So movement becomes 0.
hero.currentMoves = 0;
}
return { success, roll, target };
}
// Alias for legacy calls if any
deselectPlayer() {
this.deselectEntity();