Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. package assignment4;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.Random;
  5.  
  6. public class Pokemon {
  7. private Random rand = new Random(10);
  8. private String name;
  9. private double maxHealth;
  10. private double currentHealth;
  11. private String type;
  12. private ArrayList<SkillMove>moves;
  13.  
  14. public Pokemon(String name, double currentHealth, String type, ArrayList<SkillMove> moves){
  15. this.name = name;
  16. this.maxHealth = maxHealth;
  17. this.currentHealth = currentHealth;
  18. this.type = type;
  19.  
  20. }
  21. private int getRandomInt(int range) {
  22. return rand.nextInt(range);
  23. }
  24. private boolean isMoveMissed(SkillMove m) {
  25. double d = rand.nextDouble();
  26. if (d > m.getMissRate()) {
  27. return false;
  28. }
  29. return true;
  30. }
  31.  
  32. public void attack(Pokemon target, SkillMove m) {
  33. if(isMoveMissed(m) == false) {
  34. target.currentHealth -= m.getDmg();
  35. }
  36. }
  37.  
  38. public String toString() {
  39. return name + "Moves:" + moves;
  40.  
  41.  
  42.  
  43. }
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement