chsbca / Pokemon-Battle-Simulator

Personal project where I used my newly learned fullstack skills to try and recreate the famous Pokemon battle system
0 stars 0 forks source link

Update code to remove redundancy or old code before current logic was thought up #5

Open chsbca opened 1 month ago

chsbca commented 1 month ago

i.e. in BattlePage.jsx

        // Generating commentary message using events from above
        await createBattleEvent(attacker, move, damage, effectivenessMessage);
        if (newHP <= 0) {
            setEvents(prevEvents => [...prevEvents, `${capitalizeAndFormat(defender.pokemon.name)} has fainted!`]);
            if (attacker === currentPokemon) {
                // If Cynthia's Pokémon faints, select the next Pokémon
                const nextPokemon = selectNextCynthiaPokemon();
                if (nextPokemon) {
                    // setCynthiaPokemon(nextPokemon);
                } else {
                    alert("Cynthia has no more Pokémon left! You win!");
                }
            } else {
                return
            }
        }

See if (nextPokemon) line

chsbca commented 1 month ago

changing console.logs or alerts to be more specific on when/where the console.logs or alerts are being prompted