Skip to content

Commit

Permalink
Console based Pokemon game
Browse files Browse the repository at this point in the history
Responsible for Entity Class, Map Class, Water Interface, Squirtle Class, Staryu Class, store method, and implementation on main
  • Loading branch information
diegogarciacs authored Jan 2, 2022
1 parent fac48e0 commit 6b384d9
Show file tree
Hide file tree
Showing 23 changed files with 2,204 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Project 1/Area1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
n w n p n
i p w n c
s n p i n
w c n w w
n w n p f
5 changes: 5 additions & 0 deletions Project 1/Area2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
n w p f w
c n n p i
n w i n c
p n p w n
w n w n s
5 changes: 5 additions & 0 deletions Project 1/Area3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
w n n s p
n w n i c
f p w w n
p n w n n
w c i n p
11 changes: 11 additions & 0 deletions Project 1/Project1.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
22 changes: 22 additions & 0 deletions Project 1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# CECS277 Project 1

## Tasks
| Team Member #1: Chloee | Team Member #2: Diego | Team Member #3: Daniel |
| ------------------------ | --------------------- | ---------------------- |
| Trainer Class | Entity Class | Pokemon Class |
| Fire Interface | Map Class | Grass Interface |
| Charmander Class | Water Interface | Bulbasaur Class |
| Ponyta Class | Squirtle Class | Oddish Class |
| mainMenu method | Staryu Class | trainerAttack method |
| chooseRandPokemon method | store method | main method |
| main method | main method | |

## Rubric
| Correctness: 70% | Completion: 25% | Peer Review: 5% |
| ---------------------------- | ------------------------ | ------------------- |
| Runs correctly | Wrote code for tasks | Survey of teammates |
| Satisfies all requirements | How well code is written |
| Written correctly |
| Follows UML |
| Documented properly |
| Conforms to coding standards |
Binary file added Project 1/guidelines/CECS277-Coding Standards.pdf
Binary file not shown.
Binary file not shown.
Binary file added Project 1/guidelines/CECS277–Project1.pdf
Binary file not shown.
112 changes: 112 additions & 0 deletions Project 1/src/Bulbasaur.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
/**
* Bulbasaur is a representation of a Bulbasaur, subclass of Pokemon, implementation of the Grass interface
*
* @author Daniel Jo 2021
*/
public class Bulbasaur extends Pokemon implements Grass {
/**
* Creates a Bulbasaur object as a Pokemon with the name Bulbasaur
*/
public Bulbasaur() {
super("Bulbasaur");
}

/**
* Returns the menu of the Bulbasaur's special attacks
*
* @return the menu of the Bulbasaur's special attacks
*/
@Override
public String getSpecialMenu() {
return specialMenu;
}

/**
* Returns the number of the Bulbasaur's special attacks in the menu
*
* @return the number of the Bulbasaur's special attacks in the menu
*/
@Override
public int getNumSpecialMenuItems() {
return numSpecialMenuItems;
}

/**
* Bulbasaur attacks the Pokemon p based on the corresponding special attack move selected as an int
*
* @param p Pokemon that is being attacked
* @param move the number of the corresponding special attack
* @return the description of the special attack the Pokemon was attacked with by the Bulbasaur
* based on the corresponding move and how much damage was taken
*/
@Override
public String specialAttack(Pokemon p, int move) {
switch (move) {
case 1:
return this.vineWhip(p);
case 2:
return this.razorLeaf(p);
case 3:
return this.solarBeam(p);
default:
return "Invalid move";
}
}

/**
* Bulbasaur attacks the Pokemon p with vine whip.
* The damage is multiplied by the multiplier which is based on the other Pokemon's type.
*
* @param p Pokemon that is being attacked with vine whip
* @return the description of the Pokemon being attacked with vine whip by the Bulbasaur and how much damage was taken.
*/
@Override
public String vineWhip(Pokemon p) {
int bulbasaurType = this.getType();
int pType = p.getType();
double multiplier = battleTable[bulbasaurType][pType];
int damage = (int) ((Math.floor(Math.random() * 3) + 1) * multiplier);

p.takeDamage(damage);

return p.getName() + " is slapped with VINE WHIP and takes " + damage + " damage.";
}

/**
* Bulbasaur attacks the Pokemon p with razor leaf.
* The damage is multiplied by the multiplier which is based on the other Pokemon's type.
*
* @param p Pokemon that is being attacked with razor leaf
* @return the description of the Pokemon being attacked with razor leaf by the Bulbasaur and how much damage was taken.
*/
@Override
public String razorLeaf(Pokemon p) {
int bulbasaurType = this.getType();
int pType = p.getType();
double multiplier = battleTable[bulbasaurType][pType];
int damage = (int) ((Math.floor(Math.random() * 3) + 2) * multiplier);

p.takeDamage(damage);

return p.getName() + " is slashed with RAZOR LEAF and takes " + damage + " damage.";
}

/**
* Bulbasaur attacks the Pokemon p with solar beam.
* The damage is multiplied by the multiplier which is based on the other Pokemon's type.
*
* @param p Pokemon that is being attacked with solar beam
* @return the description of the Pokemon being attacked with solar beam by the Bulbasaur and how much damage was taken.
*/
@Override
public String solarBeam(Pokemon p) {
int bulbasaurType = this.getType();
int pType = p.getType();
double multiplier = battleTable[bulbasaurType][pType];
int damage = (int) (Math.floor(Math.random() * 6) * multiplier);

p.takeDamage(damage);

return p.getName() + " is dazzled by SOLAR BEAM and takes " + damage + " damage.";
}
}
110 changes: 110 additions & 0 deletions Project 1/src/Charmander.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
/**
* Charmander is a representation of a Charmander, subclass of Pokemon, implementation of the Fire interface
*
* @author Chloee Gong 2021
*/
public class Charmander extends Pokemon implements Fire {
/**
* Creates a Charmander object of a Pokemon with the name Charmander
*/
public Charmander() {
super("Charmander");
}

/**
* Returns the menu of the Charmander's special attacks
*
* @return the menu of the Charmander's special attacks
*/
@Override
public String getSpecialMenu() {
return specialMenu;
}

/**
* Returns the number of the Charmander's special attacks in the menu
*
* @return the number of the Charmander's special attacks in the menu
*/

@Override
public int getNumSpecialMenuItems() {
return numSpecialMenuItems;
}

/**
* Returns string description of the special attack used by Charmander and its effect on the target Pokemon p.
*
* @param p Pokemon that is being attacked
* @param move the number of the corresponding special attack
* @return the string of the corresponding special attack, and it's effect on the target pokemon.
*/
@Override
public String specialAttack(Pokemon p, int move) {
switch (move) {
case 1:
return this.ember(p);
case 2:
return this.fireBlast(p);
case 3:
return this.firePunch(p);
default:
return "Invalid move";
}
}

/**
* Returns the description of the Pokemon being attacked by ember by Charmander and how much damage was taken.
*
* @param p the Pokemon object to be affected by ember's attack.
* @return The description of ember and it's random damage on the Pokemon object being targeted.
*/
@Override
public String ember(Pokemon p) {
int charmanderType = this.getType();
int pType = p.getType();
double multiplier = battleTable[charmanderType][pType];
int damage = (int) (Math.floor(Math.random() * 4) * multiplier);

p.takeDamage(damage);

return p.getName() + " is toasted with EMBER and takes " + damage + " damage.";
}

/**
* Returns the description of the Pokemon being attacked by fire blast by Charmander and how much damage was taken.
*
* @param p the Pokemon object to be affected by fire blasts' attack.
* @return the description of fire blast and it's random damage on the Pokemon object being targeted.
*/
@Override
public String fireBlast(Pokemon p) {
int charmanderType = this.getType();
int pType = p.getType();
double multiplier = battleTable[charmanderType][pType];
int damage = (int) ((Math.floor(Math.random() * 4) + 1) * multiplier);

p.takeDamage(damage);

return p.getName() + " is almost dead with FIRE BLAST and takes " + damage + " damage.";
}

/**
* Returns the description of the Pokemon being attacked by fire punch by Charmander and how much damage was taken.
*
* @param p the Pokemon object to be affected by fire blasts' attack.
* @return The description of fire punch and its random damage on the Pokemon object being targeted.
*/

@Override
public String firePunch(Pokemon p) {
int charmanderType = this.getType();
int pType = p.getType();
double multiplier = battleTable[charmanderType][pType];
int damage = (int) ((Math.floor(Math.random() * 3) + 1) * multiplier);

p.takeDamage(damage);

return p.getName() + " is burned with FIRE PUNCH and takes " + damage + " damage.";
}
}
Loading

0 comments on commit 6b384d9

Please sign in to comment.