Advertisement
Guest User

Untitled

a guest
Jan 21st, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.45 KB | None | 0 0
  1.  
  2. public class Scenario implements Runnable {
  3.  
  4.     private String scenarioName;
  5.     private int round = 0;
  6.  
  7.     public Scenario(int round, String scenarioName) {
  8.         this.round = round;
  9.         this.scenarioName = scenarioName;
  10.     }
  11.    
  12.     Fighter Ryu = new Fighter("Ryu", 50);
  13.     Fighter Ken = new Fighter("Ken", 50);
  14.  
  15.     @Override
  16.     public void run() {
  17.  
  18.         System.out.println("Fighter " + Ryu.getFighterName() + " is ready to fight");
  19.         System.out.println("Fighter " + Ken.getFighterName() + " is ready to fight");
  20.  
  21.         while (Ryu.isAlive() && Ken.isAlive()) {
  22.             Ryu.punch();
  23.             Ken.punch();
  24.             Ryu.setHealth(Ryu.getHealth() - Ken.getStrength());
  25.             Ken.setHealth(Ken.getHealth() - Ryu.getStrength());
  26.             System.out.println(Ryu.getFighterName() + " strike with " + Ryu.getStrength() + " damage to " + (Ken.getFighterName()) + " Hit Points left " + Ken.getHealth());
  27.             System.out.println(Ken.getFighterName() + " strike with " + Ken.getStrength() + " damage to " + (Ken.getFighterName()) + " Hit Points left " + Ryu.getHealth());
  28.         }
  29.     }
  30.  
  31.     public String getScenarioName() {
  32.         return scenarioName;
  33.     }
  34.  
  35.     public void setScenarioName(String scenarioName) {
  36.         this.scenarioName = scenarioName;
  37.     }
  38.  
  39.     public int getRound() {
  40.         return round;
  41.     }
  42.  
  43.     public void setRound(int round) {
  44.         this.round = round;
  45.     }
  46.  
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement