# Data Of My Life - Pokémon Trainer in NYC
```:javascript=
let trainerName = "Peter Parker":
let trainerLevel = 5;
let badgeCollection = ["GrassBadge", "FireBadge", "ElectricBadge"]
let pokemonTeam = [
{ name: "Pikachu", element: "Electric", hp: 100, level: 50, affection: 100, },
{ name: "Eevee", element: "Normal", hp: 100, level: 50, affection: 0,}
]
// Peter Parker is a Columbia University Teachers College’s student in New York City who aims to be the best Pokémon Trainer in the world.
// get current time
let time = getTime();
// wake up after 7 am
if(time >= 7){
peter.wakeUp();
}
let nycGym{
gymLeader: "Zhe",
element: "Fire",
numPokemon: 1,
badge: "FireBadge"
}
// Peter challenges the NYC gym on a daily basis until success.
if(badgeCollection.findIndex("FireBadge") != -1){
break;
}else{
startBattle(nycGym);
}
// after challenge the gym, peter will eat shakeshack for lunch if after 12pm
time = getTime();
if(time>=12){
peter.eat("Shack Burger");
peter.drink("Vanalia Shake");
// feed pokemon as well
for(let i = 0; i<pokemonTeam.length; i++){
pokemonTeam[i].eat("Shack Pokemon Food");
pokemonTeam[i].drink("Moomoo Milk");
}
}
/* Switch Pokemon */
function switchPokemon(slot){
return pokemonTeam[slot];
}
/* Check if there is any Pokemon left that's able to fight.
Return true if none, else return false and switch to next avaliable Pokemon.*/
function checkStatus(team){
let status = team.findIndex(x => x.hp > 0 );
if(status == -1){
return true;
}else{
switchPokemon(status);
return false;
}
}
/* The battling process */
function startBattle(gym){
let battlePokemon = pokemonTeam[0];
let gymPokemon = gym.leader.pokemonTeam[0];
// keep battle if battling pokemons' hp > 0
while(battlePokemon.hp > 0 && gymPokemon.hp > 0){
battlePokemon.useSkill();
// get the status of two sides
let gymStatus = checkStatus(gym.gymleader.pokemonTeam);
let peterStatus = checkStatus(pokemonTeam);
// if one side's all pokemons are unavaliable, the battle ends
if(gymStatus || peterStatus){
// earn the gym badge if peter wins
if(gymStatus == -1){
badgeCollection.push(gym.badge)
console.log("${gym.badge}, Getto Daze!")
}
break;
}else{
// continue the battle if both sides are able to fight
// switch pokemon if current one hp <= 0
if(battlePokemon.hp <= 0){
battlePokemon = pokemonTeam[peterStatus];
}
if(gymPokemon.hp <= 0){
battlePokemon = pokemonTeam[gymStatus];
}
continue;
}
}
}
// After a battle in NYC gym
// Trainer Peter Parker has just emerged victorious from a gym battle in NYC and decides to undertake special training with Eevee to evolve it into Sylveon
console.log("After achieving victory in the NYC gym battle, Ash decides to embark on special training with Eevee...");
// Defining Eevee and its attributes
let eevee = {
name: "Eevee",
type: "Normal",
affection: 0, // Affection level, represented in hearts
moveLearned: "" // Moves learned
};
// [Eevee's Database Reference: after Fairy-type move learned, and either ♥♥ Affection in Gen 6-7 or high friendship in Gen 8+](https://pokemondb.net/pokedex/sylveon)
// Function for Eevee to learn a Fairy-type move
function learnFairyTypeMove(move) {
eevee.moveLearned = move;
console.log(`Eevee has learned the Fairy-type move: ${move}!`);
}
// Function to increase Eevee's Affection
function increaseAffection(amount) {
eevee.affection += amount;
console.log(`Eevee's affection has increased! Current affection level: ${eevee.affection}`);
}
// Simulating the training and evolution process
learnFairyTypeMove("Fairy Wind");
increaseAffection(2); // Assuming good performance in affectionate interactions
// Function to check if Eevee can evolve into Sylveon
function checkEvolution() {
const requiredAffection = 2;
if (eevee.affection >= requiredAffection && eevee.moveLearned) {
eevee.name = "Sylveon";
eevee.element = "Fairy";
console.log(`WOW! Eevee is evolving! Congratulations, your Eevee has evolved into Sylveon !`);
} else {
console.log("What a pity! Eevee is not ready to evolve yet.");
}
}
// Peter Parker starts a new journey with Sylveon and Pikachu
// Peter will play super smash bros before going to bed, he will not go to bed before he wins
let smashWin = false;
while(!smashWin){
playSmash(smashWin);
}
function playSmash(smashWin){
if(win){
smashWin = true;
}else{
smashWin = false;
}
}
sleep();
console.log(`Peter Parker and his ${pokemon.name} are preparing for a new journey!`);
```