Advertisement
Whi7eW0lf

Untitled

Jun 25th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.70 KB | None | 0 0
  1.    private static int addHeart(int heart, int plusHeart) {
  2.  
  3.         if (heart<100){
  4.             if (heart+plusHeart<=100){
  5.                 heart+=plusHeart;
  6.                 System.out.println(String.format("You healed for %d hp.",plusHeart));
  7.                 System.out.println(String.format("Current health: %d hp.",heart));
  8.             }else {
  9.                 System.out.println(String.format("You healed for %d hp.",100-heart));
  10.                 heart=100;
  11.                 System.out.println("Current health: 100 hp.");
  12.             }
  13.         }else {
  14.             System.out.println("You healed for 0 hp.");
  15.             System.out.println("Current health: 100 hp.");
  16.         }
  17.         return heart;
  18.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement