hey write me a html, cuss and JavaScript code in a single file for a webpage of a Pokémon text based game with a good ui the game should look like this and work like this as follows: 1. it should be like a text adventure game where the player is going from point A to B and between these point the player get 3 poke balls and 5 interactions with wild Pokémon where the player have to decide if he want to catch the Pokémon or not by having option of try catching it or flee. where Pokémon is caught only on the basis of chance it can be a caught or not. 2 . ones the player have used up all 3 poke balls or have interacted with all 5 Pokémon. then player moves to point B to C where he fight 5 different player with the 3 or less caught Pokémon's which he have to win to become the best Pokémon trainer. 3. where during fight show the available attacks of the pokemon caught and show it as a fight between pokemons but just in text based form 4. where create custom new Pokémon's, characters, their attacks, and story line while going A to B and B to C and story line between each interaction with wild Pokémon or competitor. 5. keep the ui look similar orange pokedex.
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Here is the HTML, CSS, and JavaScript code for a text-based Pokémon game as per your specifications. The entire game is contained within a single HTML file.
html
<!DOCTYPE html>
<html>
<head>
<title>Pokémon Adventure</title>
<style>
body {
background-color: #FF6F00; /* Orange Pokedex Color */
font-family: Arial, sans-serif;
color: #fff;
padding: 20px;
}
#game {
max-width: 600px;
margin: auto;
background-color: #FF8F00;
padding: 20px;
border-radius: 10px;
}
#game h1 {
text-align: center;
}
#output {
white-space: pre-wrap;
margin-bottom: 20px;
}
#choices button {
background-color: #FFB300;
color: #fff;
border: none;
padding: 10px;
margin: 5px;
border-radius: 5px;
cursor: pointer;
}
#choices button:hover {
background-color: #FFD54F;
}
#stats {
margin-top: 20px;
}
#stats p {
margin: 5px 0;
}
</style>
</head>
<body>
<div id="game">
<h1>Pokémon Adventure</h1>
<div id="output"></div>
<div id="choices"></div>
<div id="stats"></div>
</div>
<script>
// Game Data
const wildPokemons = [
{ name: 'Flamink', type: 'Fire', attacks: ['Blaze Kick', 'Flame Tail'] },
{ name: 'Aquabub', type: 'Water', attacks: ['Water Splash', 'Bubble Blast'] },
{ name: 'Leafy', type: 'Grass', attacks: ['Vine Whip', 'Leaf Blade'] },
{ name: 'Rocky', type: 'Rock', attacks: ['Rock Throw', 'Earthquake'] },
{ name: 'Sparky', type: 'Electric', attacks: ['Thunder Shock', 'Lightning Bolt'] }
];
const trainers = [
{ name: 'Ace Trainer Alex', pokemon: { name: 'Venomous', type: 'Poison', attacks: ['Poison Sting', 'Toxic Cloud'] } },
{ name: 'Bug Catcher Ben', pokemon: { name: 'Flutterfly', type: 'Bug', attacks: ['String Shot', 'Bug Buzz'] } },
{ name: 'Psychic Pam', pokemon: { name: 'Mindwave', type: 'Psychic', attacks: ['Confusion', 'Psybeam'] } },
{ name: 'Fisherman Fred', pokemon: { name: 'Gillser', type: 'Water', attacks: ['Splash', 'Wave Crash'] } },
{ name: 'Lass Lily', pokemon: { name: 'Cutiepie', type: 'Fairy', attacks: ['Charm', 'Heart Stamp'] } }
];
let state = {
pokeballs: 3,
caughtPokemons: [],
wildEncounters: 0,
stage: 'AtoB',
trainerBattlesWon: 0
};
const output = document.getElementById('output');
const choices = document.getElementById('choices');
const stats = document.getElementById('stats');
function updateStats() {
stats.innerHTML = `
<p>Poké Balls: ${state.pokeballs}</p>
<p>Caught Pokémon: ${state.caughtPokemons.map(p => p.name).join(', ') || 'None'}</p>
`;
}
function showMessage(message) {
output.textContent = message;
}
function showChoices(options) {
choices.innerHTML = '';
options.forEach(option => {
const button = document.createElement('button');
button.textContent = option.text;
button.onclick = option.action;
choices.appendChild(button);
});
}
function startGame() {
showMessage('Welcome to the Pokémon Adventure!\nYou are starting your journey from Point A to Point B.');
updateStats();
encounterWildPokemon();
}
function encounterWildPokemon() {
if (state.wildEncounters >= 5 || state.pokeballs === 0) {
state.stage = 'BtoC';
startBattles();
return;
}
const pokemon = wildPokemons[Math.floor(Math.random() * wildPokemons.length)];
state.currentWildPokemon = pokemon;
state.wildEncounters++;
showMessage(`A wild ${pokemon.name} appeared!\nType: ${pokemon.type}\nDo you want to try catching it or flee?`);
showChoices([
{ text: 'Catch', action: tryCatchPokemon },
{ text: 'Flee', action: encounterWildPokemon }
]);
}
function tryCatchPokemon() {
if (state.pokeballs <= 0) {
showMessage('You have no Poké Balls left!');
showChoices([{ text: 'Continue', action: encounterWildPokemon }]);
return;
}
state.pokeballs--;
const catchSuccess = Math.random() > 0.5;
if (catchSuccess) {
state.caughtPokemons.push(state.currentWildPokemon);
showMessage(`Congratulations! You caught ${state.currentWildPokemon.name}!`);
} else {
showMessage(`${state.currentWildPokemon.name} escaped!`);
}
updateStats();
if (state.wildEncounters >= 5 || state.pokeballs === 0) {
showChoices([{ text: 'Proceed to Point C', action: startBattles }]);
} else {
showChoices([{ text: 'Continue', action: encounterWildPokemon }]);
}
}
function startBattles() {
if (state.caughtPokemons.length === 0) {
showMessage('You have no Pokémon to battle with. Game Over.');
showChoices([{ text: 'Restart', action: () => location.reload() }]);
return;
}
if (state.trainerBattlesWon >= trainers.length) {
showMessage('Congratulations! You defeated all trainers and became the best Pokémon trainer!');
showChoices([{ text: 'Play Again', action: () => location.reload() }]);
return;
}
const trainer = trainers[state.trainerBattlesWon];
state.currentTrainer = trainer;
showMessage(`${trainer.name} challenges you to a battle!\nThey send out ${trainer.pokemon.name}!`);
showChoices([{ text: 'Battle', action: battle }]);
}
function battle() {
const yourPokemon = state.caughtPokemons[0];
const opponentPokemon = state.currentTrainer.pokemon;
showMessage(`You send out ${yourPokemon.name}!\nChoose an attack:`);
showChoices(yourPokemon.attacks.map(attack => {
return {
text: attack,
action: () => attackOpponent(attack, yourPokemon, opponentPokemon)
};
}));
}
function attackOpponent(attackName, yourPokemon, opponentPokemon) {
showMessage(`${yourPokemon.name} uses ${attackName}! It's super effective!\n${opponentPokemon.name} fainted!`);
state.trainerBattlesWon++;
state.caughtPokemons.shift(); // Remove used Pokémon
if (state.caughtPokemons.length === 0 && state.trainerBattlesWon < trainers.length) {
showMessage('You have no Pokémon left to battle with. Game Over.');
showChoices([{ text: 'Restart', action: () => location.reload() }]);
return;
}
showChoices([{ text: 'Continue', action: startBattles }]);
}
// Start the game
startGame();
</script>
</body>
</html>
Instructions:
Copy the entire code above into a new file and save it with an .html extension, for example, pokemon_adventure.html.
Open the file in a modern web browser (like Chrome or Firefox) to play the game.
Game Features:
Text Adventure from Point A to B:
As you journey from Point A to B, you have 3 Poké Balls.
You will encounter up to 5 wild Pokémon.
Decide whether to attempt to catch a Pokémon or flee.
Catching a Pokémon is chance-based.
Battle from Point B to C:
After reaching Point B, you will battle 5 different trainers as you proceed to Point C.
Use the Pokémon you've caught to battle.
You must win all battles to become the best Pokémon trainer.
Battle Mechanics:
Battles are text-based.
During a battle, choose attacks for your Pokémon.
Defeat the opponent's Pokémon to win the battle.
Custom Pokémon and Characters:
The game features custom Pokémon like Flamink, Aquabub, Leafy, etc.
Trainers include characters like Ace Trainer Alex, Bug Catcher Ben, etc.
Each Pokémon has unique attacks and types.
User Interface:
The UI has been styled to resemble an orange Pokédex.
It features a simple layout with text, buttons for choices, and updates on your stats.
Enjoy your adventure and become the best Pokémon trainer!