Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package assignment4;
- import java.util.ArrayList;
- import java.util.Random;
- public class Pokemon {
- private Random rand = new Random(10);
- private String name;
- private double maxHealth;
- private double currentHealth;
- private String type;
- private ArrayList<SkillMove>moves;
- public Pokemon(String name, double currentHealth, String type, ArrayList<SkillMove> moves){
- this.name = name;
- this.maxHealth = maxHealth;
- this.currentHealth = currentHealth;
- this.type = type;
- }
- private int getRandomInt(int range) {
- return rand.nextInt(range);
- }
- private boolean isMoveMissed(SkillMove m) {
- double d = rand.nextDouble();
- if (d > m.getMissRate()) {
- return false;
- }
- return true;
- }
- public void attack(Pokemon target, SkillMove m) {
- if(isMoveMissed(m) == false) {
- target.currentHealth -= m.getDmg();
- }
- }
- public String toString() {
- return name + "Moves:" + moves;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement