Project 3.3 Pokemon Battle


Intro to Programming Languages.

[ ← Module List ]

Hey everyone, welcome to Pokémon Joust: 240 Gym Edition! In this assignment, you'll make a Pokémon battle simulator, where you'll build your own team of Pokémon, pit different Pokémon against each other, and, for the thrilling finale, challenge us UGTAs and ultimately the professor to win badges. We aimed to make this the perfect assignment to introduce you to C++ by making it as engaging as possible. For the smoothest experience with this assignment, we recommend following the order outlined in the description below and reading everything carefully. Have fun!

What is a Pokémon?

Pokémon, short for "Pocket Monster" (ポケットモンスター, Poketto Monsutā), are creatures in a world where individuals, known as Pokémon trainers, catch and train them for companionship and battles. Each Pokémon falls into one or more of various types—like fire, water, or grass—defining their strengths, weaknesses, and the types of moves they can perform. These types play a crucial role in battles, influencing the effectiveness of a Pokémon's moves against others. Beyond their type, Pokémon possess stats such as Health Points (HP), Attack, Defense, and Speed, which are critical in determining the outcome of battles. Trainers aim to assemble a balanced team of Pokémon, strategically using their unique movesets and stats to outmaneuver opponents in battles.

Trainers engage in battles, using their team to compete for prestige and badges in various gyms. Battles are turn-based, a Pokémon "faints" and is unable to continue battling when its HP drops to zero. Winning battles against gym leaders awards trainers badges, symbolizing their skill and granting them access to tougher challenges.

Objective Overview

In this project , you will create a Pokémon Battle Simulator. Your task is to develop a system that simulates battles between Pokémon with varying types, leveraging Object-Oriented Programming (OOP) principles.


Many of the functions that you will code for this challenge have detailed information in the comments. DO NOT SKIP THE COMMENTS in the source files (.cpp, .h) .


Challenges

Objective

Integrate a Pokémon game into the MUD and load the Pokémon data from pokemon.json using the JSON 11 library.

Much of the code for the game is already included, part of your job will be figuring out how it works, and modifying it appropriately.

The code is filled with comments to help you do this

Design details are available at https://cse240.com/pokemon

Steps to Complete

  1. The Makefile will be updated to handle the pokeMUD code (take a look) the code is located in the pokemud folder
  2. Integrate Pokémon Battle into MUD
    • Your MUD code from the last level (~/cse240/06-mudshop/07) should be coopied to this level's work area (~/cse240/07-pokemud/01)
    • When the user types in 'p' or "pokemon" into the MUD it will open a pokemon management system
    • Entry point into the Pokémon manager will be by pokemonMenu()
    • pokemonMenu() is found in "pokemud/ui.h"
    • When it's working the Pokemon Management system will look like this, but none of the functionality will be working for this level.
      
          ---------
          MAIN MENU
          ---------
          1. Show Pokemon
          2. Choose Pokemon
          3. Remove Pokemon
          4. Battle Random
          6. Exit
          Enter your choice: 
          
  3. Finish the Pokemon Class
    • Complete the getter and setter methods in Pokemon
  4. Create the Pokemon derived classes
    • Create derrived classes FirePokemon, WaterPokemon, ElectricPokemon, GrassPokemon, RockPokemon in pokemon.h
    • Use the NormalPokemon that's provided as a template.
    • Create the constructor for each derrived class
    • Override the pure virtual method
  5. Return an instance of the derrived classes in pokemonFactory in pokemon.cpp
    • Depending on the pmType instaniate the Pokemon using the proper derrived class
    • Use make_shared<> to create a shared pointer
    • Return the shared pointer to the newly created object
    • Use the NormalPokemon process as a template

      For the AIV reward, you need to add a printf to pokemonFactory in pokemon.cpp that prints "Pokemud is too much pokefun"

  6. Complete loadPokemon in load_pson.cpp
    • Follow the instructions found in the comments of in the class
    • To add values to a vector, you may use push_back
    • Use the pokemonFactory to create a pokemon that's a shared_ptr then push it onto the pokemonList Vector

Objective

Load the team and the team's moves from the supplied team.json.

Design details are available at https://cse240.com/pokemon

Requirements

  1. Complete findPokemonByName method
    • shared_ptr Team::findPokemonByName(vector>& pokemonList, string name )
    • Given the name of a Pokémon in the pokemonList
    • Lookup the Pokémon and return a pointer to it.
  2. Complete Move class
    • Complete the create method
    • Compete the getter methods in move.cpp
    • Complete Move::usePP()
  3. Implement the Team::getMove method in team.cpp
    • getMove will search through the moves vector
    • Once the move with the same name is found in moves
    • Create a new Move using the following
      Move * newMove = new Move(currentMove)
      Where currentMove is the iterator that matches the provided moveName
    • Add newMove to the movesList

      Add a print statement to the end that says "getMove completed"

  4. Implement the Team::addPokemon, Team::getSize, Team::isFull, Team::getPokemon, and Team::loadTeam method in team.cpp
    • Follow the instructions in the methods.

Objective

To implement functionality that allows the user to remove and add team members

Steps to Complete

  1. Modify team.cpp
    • Implement Team::removePokemon
  2. Modify ui.cpp
    • Implement the following functions
      • removePokemonFromTeam - can be implemented after Team::removePokemon is completed
      • selectPokemonType - Allows user to select the type of Pokemon desired
      • selectPokemonFromType - Lists Pokemon of the selected Type and allows their selection
      • selectMovesForPokemon - Lists Moves available for Pokemon (moves of its type and normal moves)
      • addPokemonToTeam
        • Adds the pokemon to the team
        • Selects the moves for the Pokémon, but should not allow the same move to be selected for them more than once.

          Add a print statement to the end that says "Wow, that was a great addition"

Objective

Implement the battle functionality in battle.cpp.

Steps to Complete

  1. Modify battle.cpp
    • Implement the following functions:
      • calculateDamage
      • applyMoveDamage
    • If the code has not implemented Move::usePP() in move.cpp , then implement that now.
  2. Modify pokemon.cpp
    • Implement the following functions:
      • getDamageMultiplier

Objective

Make it possible to challenge the different trainers in the CSE240 Gym!

Requirements

  • Add the "challenge" command, it should work if 'c' is entered or the entire command "challenge"
  • Add the proper trainer in each room
    1. Derek is trainer 0 and in room 324
    2. Nothinhh is trainer 1 and in room 344
    3. Daniel10015 is trainer 2 and in room 343
    4. Sayhilel is trainer 3 and in room 328
    5. Mai is trainer 4 and in room 325
    6. Memory Mastermind is trainer 5 and in room 326
    7. Jenna is trainer 6 and in room 322
    8. Ron is trainer 7 and in room 331
    9. Jared is trainer 8 and in room 329
    10. Sidharth is trainer 9 and in room 327
    11. Jay is trainer 10 and in room 323
    12. Tricky Mystic is trainer 11 and in room 358
  • Once the trainer is identified, call
    void challengeTrainer(int trainerToChallenge) 
  • The function challengeTrainer is found gym.h, so you should include gym.h in operations.cpp.

Steps to Complete

  • Implement the command as outlined above
  • Use tester to get the flag
  • Special Note: once this is working, try your hand at level 77 for extra credit. Each trainer that your team of pokemon beat will earn you extra credit.

30-Day Scoreboard:

This scoreboard reflects solves for challenges in this module after the module launched in this dojo.

Rank Hacker Badges Score