daily pastebin goal
36%
SHARE
TWEET

Untitled

a guest Sep 19th, 2017 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package multithreading;
  2.  
  3. public class Simulation
  4. {
  5.     private boolean p1Alive = true;
  6.     private boolean p2Alive = true;
  7.     private int p1Hp = 50;
  8.     private int p2Hp = 50;
  9.     private String player1 = "Mariusz";
  10.     private String player2 = "Martin";
  11.     private String winner;
  12.     private long p1Stun;
  13.     private long p2Stun;
  14.    
  15.  
  16.  
  17.     public Simulation()
  18.     {
  19.     }
  20.  
  21.  
  22.     public boolean isP1Alive() {
  23.         return p1Alive;
  24.     }
  25.  
  26.  
  27.     public boolean isP2Alive() {
  28.         return p2Alive;
  29.     }
  30.  
  31.  
  32.     public int getP1Hp() {
  33.         return p1Hp;
  34.     }
  35.  
  36.  
  37.     public int getP2Hp()
  38.     {
  39.         return p2Hp;
  40.     }
  41.  
  42.  
  43.     public String getPlayer1() {
  44.         return player1;
  45.     }
  46.  
  47.  
  48.     public String getPlayer2() {
  49.         return player2;
  50.     }
  51.  
  52.  
  53.     public void setP1Alive(boolean p1Alive) {
  54.         this.p1Alive = p1Alive;
  55.     }
  56.  
  57.  
  58.     public void setP2Alive(boolean p2Alive) {
  59.         this.p2Alive = p2Alive;
  60.     }
  61.  
  62.  
  63.     public void setP1Hp(int p1Hp)
  64.     {
  65.         this.p1Hp = p1Hp;
  66.         if(getP1Hp() <= 0)
  67.         {
  68.             setP1Alive(false);
  69.             setWinner(getPlayer2());
  70.         }
  71.     }
  72.  
  73.  
  74.     public void setP2Hp(int p2Hp) {
  75.         this.p2Hp = p2Hp;
  76.         if(getP2Hp() <= 0)
  77.         {
  78.             setP2Alive(false);
  79.             setWinner(getPlayer1());
  80.         }
  81.     }
  82.  
  83.  
  84.     public void setPlayer1(String player1) {
  85.         this.player1 = player1;
  86.     }
  87.  
  88.  
  89.     public void setPlayer2(String player2) {
  90.         this.player2 = player2;
  91.     }
  92.    
  93.     public String getWinner()
  94.     {
  95.         return winner;
  96.     }
  97.    
  98.     public void setWinner(String winner)
  99.     {
  100.         this.winner = winner;
  101.        
  102.     }
  103.    
  104.     public String toString()
  105.     {
  106.         return "Der Gewinner ist: " + getWinner();
  107.     }
  108.  
  109.  
  110.     public void setP2Stun(long p2Stun) {
  111.         this.p2Stun = p2Stun;
  112.     }
  113.  
  114.  
  115.     public long getP2Stun() {
  116.         return p2Stun;
  117.     }
  118.  
  119.  
  120.     public void setP1Stun(long p1Stun) {
  121.         this.p1Stun = p1Stun;
  122.     }
  123.  
  124.  
  125.     public long getP1Stun() {
  126.         return p1Stun;
  127.     }
  128.    
  129.    
  130.    
  131.    
  132.    
  133.  
  134.  
  135.  
  136.  
  137. }
RAW Paste Data
Top