You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
778 B

7 years ago
  1. public class Wizard{
  2. int health;
  3. String weapon;
  4. String spell;
  5. public Wizard(){
  6. this.health = 100;
  7. this.weapon = "Staff";
  8. this.spell = "Arcane Arrow";
  9. }
  10. public Wizard(int health,String weapon,String spell){
  11. this.health = health;
  12. this.weapon = weapon;
  13. this.spell = spell;
  14. }
  15. public void drinkPotion(){
  16. this.health += 10;
  17. }
  18. public void drinkPotion(int potion){
  19. this.health += potion;
  20. }
  21. public void wizardDetails(){
  22. System.out.println("This Wizard has a total health of: " + this.health);
  23. System.out.println("This Wizard carries a " + this.weapon + " and can cast " + this.spell + ".");
  24. System.out.println();
  25. }
  26. /*
  27. public static void main(String[] args){
  28. }
  29. */
  30. }