diff options
| author | elioat <elioat@tilde.institute> | 2025-09-06 10:32:23 -0400 |
|---|---|---|
| committer | elioat <elioat@tilde.institute> | 2025-09-06 10:32:23 -0400 |
| commit | de11f4366a652246df24024844c6403fbbb81421 (patch) | |
| tree | b5e4a9f796400ffcd8df87a8904bbf571ee1264d /html | |
| parent | fe13d45fce3bcb04b98c5c8a659bb87a7c303489 (diff) | |
| download | tour-de11f4366a652246df24024844c6403fbbb81421.tar.gz | |
*
Diffstat (limited to 'html')
| -rw-r--r-- | html/strata/game.js | 94 |
1 files changed, 79 insertions, 15 deletions
diff --git a/html/strata/game.js b/html/strata/game.js index 73fe633..b0013f7 100644 --- a/html/strata/game.js +++ b/html/strata/game.js @@ -65,6 +65,7 @@ * UTILITY: * - debugGame.status() // Show current player state (health, position, curses, buffs) * - debugGame.testAdjacent() // Test which rows are valid for movement + * - debugGame.showGrid() // Show current grid card distribution * - debugGame.clearAll() // Remove all curses and buffs * */ @@ -1225,9 +1226,10 @@ const generateGrid = () => { if (Math.random() < 0.25) { cardType = CardType.MAGNET; } else { - // Select from other card types + // Select from other card types - weighted to increase curse frequency const otherCardTypes = [ - CardType.HEALTH_UP, CardType.HEALTH_DOWN, CardType.CURSE, + CardType.HEALTH_UP, CardType.HEALTH_DOWN, + CardType.CURSE, CardType.CURSE, CardType.CURSE, // Triple the generic curse frequency 'BUFF_HEALTH_PER_LEVEL', 'BUFF_REDUCED_PENALTY', 'BUFF_LUCKY_STREAK', 'BUFF_MAGNETIC_CONTROL', 'BUFF_HEALTH_SHIELD', 'CURSE_PROBABILITY_BLINDNESS', 'CURSE_REVERSE_MAGNETISM', 'CURSE_CARD_SHUFFLE', CardType.CLEAR_CURSE, CardType.CLEAR_BUFF @@ -1307,9 +1309,10 @@ const generateGrid = () => { if (Math.random() < 0.25) { cardType = CardType.MAGNET; } else { - // Select from other card types + // Select from other card types - weighted to increase curse frequency const otherCardTypes = [ - CardType.HEALTH_UP, CardType.HEALTH_DOWN, CardType.CURSE, + CardType.HEALTH_UP, CardType.HEALTH_DOWN, + CardType.CURSE, CardType.CURSE, CardType.CURSE, // Triple the generic curse frequency 'BUFF_HEALTH_PER_LEVEL', 'BUFF_REDUCED_PENALTY', 'BUFF_LUCKY_STREAK', 'BUFF_MAGNETIC_CONTROL', 'BUFF_HEALTH_SHIELD', 'CURSE_PROBABILITY_BLINDNESS', 'CURSE_REVERSE_MAGNETISM', 'CURSE_CARD_SHUFFLE', CardType.CLEAR_CURSE, CardType.CLEAR_BUFF @@ -1566,9 +1569,6 @@ const isValidRowForMovement = (game, targetRow) => { const currentRow = game.player.currentPosition.row; const isValid = Math.abs(targetRow - currentRow) === 1; - // Debug logging - console.log(`Checking row ${targetRow} from position ${currentRow}, curses:`, game.player.curses, 'valid:', isValid); - return isValid; }; @@ -1699,15 +1699,54 @@ const processCellLanding = (game, cell) => { cardConsumed = !cell.card.persistent; break; case CardType.CURSE: - // Apply random curse (permanent) - const curseType = randomChoice([CurseType.ADJACENT_ONLY, CurseType.INCREASED_PENALTY]); + // Apply random curse (permanent) - now includes all curse types + const availableCurses = [ + CurseType.ADJACENT_ONLY, + CurseType.INCREASED_PENALTY, + CurseType.PROBABILITY_BLINDNESS, + CurseType.REVERSE_MAGNETISM, + CurseType.CARD_SHUFFLE + ]; + const curseType = randomChoice(availableCurses); + if (!newPlayer.curses.includes(curseType)) { - newPlayer = { - ...newPlayer, - curses: [...newPlayer.curses, curseType] - }; - const curseName = curseType === CurseType.ADJACENT_ONLY ? 'Adjacent Only' : 'Increased Penalty'; - addLogEntry(`Cursed: ${curseName}`, 'curse'); + let curseName = ''; + let turnsMessage = ''; + + // Handle Card Shuffle curse with turn tracking + if (curseType === CurseType.CARD_SHUFFLE) { + const turnsRemaining = randomInt(3, 8); + newPlayer = { + ...newPlayer, + curses: [...newPlayer.curses, curseType], + cardShuffleTurnsRemaining: turnsRemaining + }; + curseName = 'Card Shuffle'; + turnsMessage = ` (${turnsRemaining} turns)`; + } else { + // Handle other curses normally + newPlayer = { + ...newPlayer, + curses: [...newPlayer.curses, curseType] + }; + + switch (curseType) { + case CurseType.ADJACENT_ONLY: + curseName = 'Adjacent Only'; + break; + case CurseType.INCREASED_PENALTY: + curseName = 'Increased Penalty'; + break; + case CurseType.PROBABILITY_BLINDNESS: + curseName = 'Probability Blindness'; + break; + case CurseType.REVERSE_MAGNETISM: + curseName = 'Reverse Magnetism'; + break; + } + } + + addLogEntry(`Cursed: ${curseName}${turnsMessage}`, 'curse'); } cardConsumed = !cell.card.persistent; break; @@ -3104,6 +3143,31 @@ window.debugGame = { } else { console.log('Game not initialized yet. Please wait for the game to load.'); } + }, + + // Show current grid card distribution + showGrid: () => { + if (window.game && window.game.currentLevel) { + console.log('=== CURRENT GRID CARDS ==='); + const cardCounts = {}; + const grid = window.game.currentLevel.grid; + + grid.forEach((cell, index) => { + if (cell.card) { + const cardType = cell.card.type; + cardCounts[cardType] = (cardCounts[cardType] || 0) + 1; + console.log(`Cell [${cell.row},${cell.col}]: ${cardType} (${cell.card.probabilityModifier}%, persistent: ${cell.card.persistent})`); + } + }); + + console.log('\n=== CARD TYPE SUMMARY ==='); + Object.entries(cardCounts).forEach(([type, count]) => { + console.log(`${type}: ${count}`); + }); + console.log('========================'); + } else { + console.log('Game not initialized yet. Please wait for the game to load.'); + } } }; |