Description
Pokémon – The player is a new pokémon trainer exploring the different areas of the
game encountering new places and facing events throughout their travels, collecting and
fighting other pokémon.
Main – Prompt the user to enter their name and select a starting pokémon (Charmander,
Squirtle, or Bulbasaur), then construct a Map and a Trainer object. Display the map and
then give the user the option to move in different directions, or to quit the game. The
trainer then has different encounters depending on what’s at that position on the map.
The game repeats until the user quits or when the trainer runs out of hp.
s start – the trainer is placed at the start of the Area1 map, all subsequent map
start positions are at the same place as the previous map’s finish, so there’s no
need to place the trainer again.
f finish – triggers the loading of the next map. Load maps in the order
1,2,3,1,2,3, etc.
n nothing – no encounter found.
i item – trainer finds an item. Randomly give the trainer a potion or a poké ball.
The ‘i’ is removed from the map after the item is found.
w wild pokémon – begins a fight with a wild pokémon. The user can repeatedly
choose one of the following options until the wild pokémon runs out of hit
points, or until all of the trainer’s pokémon run out of hit points, at which time
the wild pokémon will do some damage to the trainer and then leave:
1. Fight – trainer chooses a pokémon from their collection to fight with.
Then chooses to use a basic attack (common to all pokémon) or special
attack (shared between pokémon types). Damage is dealt to the wild
pokémon, and then, if it’s still alive, it has the opportunity to do a
random (any basic or special) attack back to the trainer’s pokémon. If
the trainer chooses a pokémon with 0 hp, then the wild pokémon will
do some random damage to the trainer instead.
2. Use Potion – if the trainer has a potion, prompt the trainer to choose a
pokémon to heal.
3. Throw Poké Ball – if the trainer has a poké ball, then the trainer has a
chance (based on the wild pokémon’s percentage of hit points (ex.
5/20hp = 75% chance) to catch the pokémon to add to their collection.
4. Run Away – the trainer runs away in a random direction (no encounter).
The ‘w’ is not removed from the map if the trainer rus away.
p person – random person that the trainer encounters during their travels. This
can give the trainer items, money, or can cause them damage. These are made
up by you to add flair and interesting interactions for your game. The ‘p’ is
removed from the map after the encounter ends.
c city – trainer enters a city and can either choose to go to the store to buy more
potions ($5), or poké balls ($3), or to take their pokémon to the hospital to have
them all healed.
Entity – All Entities of the game (trainers and different types of pokémon), have hit
points (hp), which is the amount of damage it can take before passing out. Max hit points
is the amount of hit points the entity has when it is full health. When an entity takes
damage, it should stop at 0 (ie. it should never be negative).
The entity’s toString should
return the entity’s name and hp in the format: ‘Name HP: hp/maxHp’.
Pokémon – All Pokémon can do different types of attacks, basic attacks and special
attacks, basic attacks are the ones that all pokémon can do (slam, tackle, and punch), and
special attacks are ones that it can do based on its type (either fire, water, or grass).
Special attacks are also subject to elemental advantages/disadvantages that are used as a
multiplier when dealing damage. It uses the following table:
battleTable 0 Fire defending 1 Water defending 2 Grass defending
0 Fire attacking Normal damage Half damage Double damage
1 Water attacking Double damage Normal damage Half damage
2 Grass attacking Half damage Double damage Normal damage
Individual Pokémon & Element Interfaces – Each type of pokémon has special attack
methods that are based on its elemental type. There’s two pokémon of each type and
each does different damage for each of the special attacks. Use the following chart to
determine the range of random values for the attacks.
All Pokémon – slam – 0-5 dmg
– tackle – 2-3 dmg
– punch – 1-4 dmg
Charmander – ember – 0-3 dmg
– fire blast – 1-4 dmg
– fire punch – 1-3 dmg
Ponyta – ember – 0-4 dmg
– fire blast – 2-5 dmg
– fire punch – 1-4 dmg
Squirtle – water gun – 2-5 dmg
– bubble beam – 1-3 dmg
– waterfall – 1-4 dmg
Staryu – water gun – 1-5 dmg
– bubble beam – 1-2 dmg
– waterfall – 1-4 dmg
Bulbasaur – vine whip – 1-3 dmg
– razor leaf – 2-4 dmg
– solar beam – 0-5 dmg
Oddish – vine whip – 1-3 dmg
– razor leaf – 2-4 dmg
– solar beam – 0-3 dmg
Trainer – The trainer (which the player controls) starts with some money, potions, and a
few poké balls. The player gets a copy of the map from main (constructed in main and
passed into the constructor), and a Point location on the map (use x for the rows, and y
for the columns), that is initialized using the map’s findStart method, and the initial
pokémon that they chose (added to the ArrayList). The user will use these items to fight
and capture pokémon while traveling around the map and the trainer methods for the
items should check to make sure that there are adequate supplies available to use them
(ie. the trainer should not be able to spend money/use potions/use poké balls they don’t
have). The direction methods should update the trainer’s location by moving in that
direction, but only if it is a valid move (check using the getCharAtLoc method of the map
class). The trainer’s toString should return the name, hp/maxHp, inventory, list of
pokémon, and the map (see example output).
Map – The map should read in and store the contents of the area files in the 2D map
array and then also initialize the revealed array to all false. The contents of the map is
initially hidden from the player and is revealed as the trainer explores the map by calling
the reveal method. Use the boolean 2D revealed array to decide whether a space on the
map is shown or hidden when writing the mapToString method (which also displays the
trainer’s position as a * using the Point location passed in as a parameter).
Notes:
• Use the CheckInput class (posted on Beachboard) to take in user input
o int input = CheckInput.checkInt()
• Give appropriate default values to hp and other variables.
• Come up with appropriate random details to make the story interesting.
o Charmander gets angry at Ash and blasts him with fire.
o Random encounters with Misty asking for her bike?
o Ash getting caught in one of Team Rocket’s traps?
o Officer Jenny stopping them for something they didn’t do?
• Make sure you’re creating new instances of wild pokémon rather than reusing
references. This ensures you’re encountering new Squirtles rather than ones that
you’ve already defeated.
• Be sure you’re accessing the trainer’s pokémon using the getPokemon method
and not creating copies, otherwise it won’t take damage/get healed appropriately.
• Use the pokémon’s battle methods to call the selected attack (ie. you shouldn’t be
calling ember() from main).
• Add interesting things for the player to say when battling. The more random and
the more options, the better.
• Give the player a bit of starting money to buy extra potions and poké balls, you
can also let them to earn money by winning battles, or by finding it on item
spaces.
• Javadoc all classes and methods.
• Ask me if you need any clarification (or do ‘research’ by watching the show).
Implement the class diagram below using inheritance and polymorphism. Please do not
modify the UML. Ask me if you think there’s an error or if you want to add a helper
method.
Prof. Oak: Hello there new
trainer, what is your name?
Ash
Great to meet you, Ash
Choose your first pokemon:
1. Charmander
2. Bulbasaur
3. Squirtle
f
Invalid Input.
1
Ash HP: 25/25
Money: 25
Potions: 1
Poke Balls:5
Pokemon
——-
1. Charmander HP: 24/24
Map:
x x x x x
x x x x x
* x x x x
x x x x x
x x x x x
Main Menu:
1. Go North
2. Go South
3. Go East
4. Go West
5. Quit
4
You cannot go that way.
Ash HP: 25/25
Money: 25
Potions: 1
Poke Balls:5
Pokemon
——-
1. Charmander HP: 24/24
Map:
x x x x x
x x x x x
* x x x x
x x x x x
x x x x x
Main Menu:
1. Go North
2. Go South
3. Go East
4. Go West
5. Quit
3
There’s nothing here…
Ash HP: 25/25
Money: 25
Potions: 1
Poke Balls:5
Pokemon
——-
1. Charmander HP: 24/24
Map:
x x x x x
x x x x x
s * x x x
x x x x x
x x x x x
Main Menu:
1. Go North
2. Go South
3. Go East
4. Go West
5. Quit
2
You’ve entered the city.
Where would you like to go?
1. Store
2. Pokemon Hospital
1
Hello! What can I help you
with?
1. Buy Potions – $5
2. Buy Poke Balls – $3
3. Exit
1
Here’s your potion.
Hello! What can I help you
with?
1. Buy Potions – $5
2. Buy Poke Balls – $3
3. Exit
3
Thank you, come again soon!
Ash HP: 25/25
Money: 20
Potions: 2
Poke Balls:5
Pokemon
——-
1. Charmander HP: 24/24
Map:
x x x x x
x x x x x
s n x x x
x * x x x
x x x x x
Main Menu:
1. Go North
2. Go South
3. Go East
4. Go West
5. Quit
3
There’s nothing here…
Ash HP: 25/25
Money: 20
Potions: 2
Poke Balls:5
Pokemon
——-
1. Charmander HP: 24/24
Map:
x x x x x
x x x x x
s n x x x
x c * x x
x x x x x
Main Menu:
1. Go North
2. Go South
3. Go East
4. Go West
5. Quit
1
You found a poke ball
Ash HP: 25/25
Money: 20
Potions: 2
Poke Balls:6
Pokemon
——-
1. Charmander HP: 24/24
Map:
x x x x x
x x x x x
s n * x x
x c n x x
x x x x x
Main Menu:
1. Go North
2. Go South
3. Go East
4. Go West
5. Quit
2
There’s nothing here…
Ash HP: 25/25
Money: 20
Potions: 2
Poke Balls:6
Pokemon
——-
1. Charmander HP: 24/24
Map:
x x x x x
x x x x x
s n n x x
x c * x x
x x x x x
©2021 Cleary
Main Menu:
1. Go North
2. Go South
3. Go East
4. Go West
5. Quit
3
A wild Bulbasaur has
appeared.
Bulbasaur HP: 20/20
What do you want to do?
1. Fight
2. Use Potion
3. Throw Poke Ball
4. Run Away
1
Choose a Pokemon:
1. Charmander HP: 24/24
1
Charmander, I choose you!
1. Basic Attack
2. Special Attack
2
1. Ember
2. Fire Blast
3. Fire Punch
2
Bulbasaur is BLASTED with
FIRE and takes 6 damage.
Charmander is SLAMMED by
Bulbasaur and takes 4
damage.
Bulbasaur HP: 14/20
What do you want to do?
1. Fight
2. Use Potion
3. Throw Poke Ball
4. Run Away
1
Choose a Pokemon:
1. Charmander HP: 20/24
1
Charmander, I choose you!
1. Basic Attack
2. Special Attack
2
1. Ember
2. Fire Blast
3. Fire Punch
3
Bulbasaur is PUNCHED by
FIRE and takes 2 damage.
Charmander is slashed with
RAZOR LEAF and takes 1
damage.
Bulbasaur HP: 12/20
What do you want to do?
1. Fight
2. Use Potion
3. Throw Poke Ball
4. Run Away
1
Choose a Pokemon:
1. Charmander HP: 19/24
1
Charmander, I choose you!
1. Basic Attack
2. Special Attack
2
1. Ember
2. Fire Blast
3. Fire Punch
1
Bulbasaur is encased in
EMBERS and takes 0 damage.
Charmander is PUNCHED by
Bulbasaur and takes 1
damage.
Bulbasaur HP: 12/20
What do you want to do?
1. Fight
2. Use Potion
3. Throw Poke Ball
4. Run Away
1
Choose a Pokemon:
1. Charmander HP: 18/24
©2021 Cleary
1
Charmander, I choose you!
1. Basic Attack
2. Special Attack
2
1. Ember
2. Fire Blast
3. Fire Punch
3
Bulbasaur is PUNCHED by
FIRE and takes 6 damage.
Charmander is dazzled by
SOLAR BEAM and takes 1
damage.
Bulbasaur HP: 6/20
What do you want to do?
1. Fight
2. Use Potion
3. Throw Poke Ball
4. Run Away
3
Shake…Shake…Shake…
You caught Bulbasaur
Ash HP: 25/25
Money: 20
Potions: 2
Poke Balls:5
Pokemon
——-
1. Charmander HP: 17/24
2. Bulbasaur HP: 6/20
Map:
x x x x x
x x x x x
s n n x x
x c n * x
x x x x x
Main Menu:
1. Go North
2. Go South
3. Go East
4. Go West
5. Quit
4
There’s nothing here…
Ash HP: 25/25
Money: 20
Potions: 2
Poke Balls:5
Pokemon
——-
1. Charmander HP: 17/24
2. Bulbasaur HP: 6/20
Map:
x x x x x
x x x x x
s n n x x
x c * n x
x x x x x
Main Menu:
1. Go North
2. Go South
3. Go East
4. Go West
5. Quit
4
You’ve entered the city.
Where would you like to go?
1. Store
2. Pokemon Hospital
2
Hello! Welcome to the
Pokemon Hospital.
I’ll fix your poor pokemon
up in a jiffy!
There you go! See you
again soon.
Ash HP: 25/25
Money: 20
Potions: 2
Poke Balls:5
Pokemon
——-
1. Charmander HP: 24/24
2. Bulbasaur HP: 20/20
Map:
©2021 Cleary
x x x x x
x x x x x
s n n x x
x * n n x
x x x x x
Main Menu:
1. Go North
2. Go South
3. Go East
4. Go West
5. Quit
3
There’s nothing here…
Ash HP: 25/25
Money: 20
Potions: 2
Poke Balls:5
Pokemon
——-
1. Charmander HP: 24/24
2. Bulbasaur HP: 20/20
Map:
x x x x x
x x x x x
s n n x x
x c * n x
x x x x x
Main Menu:
1. Go North
2. Go South
3. Go East
4. Go West
5. Quit
3
There’s nothing here…
Ash HP: 25/25
Money: 20
Potions: 2
Poke Balls:5
Pokemon
——-
1. Charmander HP: 24/24
2. Bulbasaur HP: 20/20
Map:
x x x x x
x x x x x
s n n x x
x c n * x
x x x x x
Main Menu:
1. Go North
2. Go South
3. Go East
4. Go West
5. Quit
2
You run into Misty.
Misty: Where’s my bike,
twerp!
Misty SMACKS you for 3
damage
Ash HP: 22/25
Money: 20
Potions: 2
Poke Balls:5
Pokemon
——-
1. Charmander HP: 24/24
2. Bulbasaur HP: 20/20
Map:
x x x x x
x x x x x
s n n x x
x c n n x
x x x * x
Main Menu:
1. Go North
2. Go South
3. Go East
4. Go West
5. Quit
3
You’ve found the finish…
Ash HP: 22/25
©2021 Cleary
Money: 20
Potions: 2
Poke Balls:5
Pokemon
——-
1. Charmander HP: 24/24
2. Bulbasaur HP: 20/20
Map:
x x x x x
x x x x x
x x x x x
x x x x x
x x x x *
Main Menu:
1. Go North
2. Go South
3. Go East
4. Go West
5. Quit
1
There’s nothing here…
Ash HP: 22/25
Money: 20
Potions: 2
Poke Balls:5
Pokemon
——-
1. Charmander HP: 24/24
2. Bulbasaur HP: 20/20
Map:
x x x x x
x x x x x
x x x x x
x x x x *
x x x x x
Main Menu:
1. Go North
2. Go South
3. Go East
4. Go West
5. Quit
1
You’ve entered the city.
Where would you like to go?
1. Store
2. Pokemon Hospital
1
Hello! What can I help you
with?
1. Buy Potions – $5
2. Buy Poke Balls – $3
3. Exit
2
Here’s your poke ball.
Hello! What can I help you
with?
1. Buy Potions – $5
2. Buy Poke Balls – $3
3. Exit
3
Thank you, come again soon!
Ash HP: 22/25
Money: 17
Potions: 2
Poke Balls:6
Pokemon
——-
1. Charmander HP: 24/24
2. Bulbasaur HP: 20/20
Map:
x x x x x
x x x x x
x x x x *
x x x x n
x x x x x
Main Menu:
1. Go North
2. Go South
3. Go East
4. Go West
5. Quit
1
There’s nothing here…
Ash HP: 22/25
Money: 17
©2021 Cleary
Potions: 2
Poke Balls:6
Pokemon
——-
1. Charmander HP: 24/24
2. Bulbasaur HP: 20/20
Map:
x x x x x
x x x x *
x x x x c
x x x x n
x x x x x
Main Menu:
1. Go North
2. Go South
3. Go East
4. Go West
5. Quit
1
A wild Charmander has
appeared.
Charmander HP: 23/23
What do you want to do?
1. Fight
2. Use Potion
3. Throw Poke Ball
4. Run Away
4
Ash HP: 22/25
Money: 17
Potions: 2
Poke Balls:6
Pokemon
——-
1. Charmander HP: 24/24
2. Bulbasaur HP: 20/20
Map:
x x x * w
x x x x n
x x x x c
x x x x n
x x x x x
Main Menu:
1. Go North
2. Go South
3. Go East
4. Go West
5. Quit
5
Game Over