Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package multithreading;
- public class Simulation
- {
- private boolean p1Alive = true;
- private boolean p2Alive = true;
- private int p1Hp = 50;
- private int p2Hp = 50;
- private String player1 = "Mariusz";
- private String player2 = "Martin";
- private String winner;
- private long p1Stun;
- private long p2Stun;
- public Simulation()
- {
- }
- public boolean isP1Alive() {
- return p1Alive;
- }
- public boolean isP2Alive() {
- return p2Alive;
- }
- public int getP1Hp() {
- return p1Hp;
- }
- public int getP2Hp()
- {
- return p2Hp;
- }
- public String getPlayer1() {
- return player1;
- }
- public String getPlayer2() {
- return player2;
- }
- public void setP1Alive(boolean p1Alive) {
- this.p1Alive = p1Alive;
- }
- public void setP2Alive(boolean p2Alive) {
- this.p2Alive = p2Alive;
- }
- public void setP1Hp(int p1Hp)
- {
- this.p1Hp = p1Hp;
- if(getP1Hp() <= 0)
- {
- setP1Alive(false);
- setWinner(getPlayer2());
- }
- }
- public void setP2Hp(int p2Hp) {
- this.p2Hp = p2Hp;
- if(getP2Hp() <= 0)
- {
- setP2Alive(false);
- setWinner(getPlayer1());
- }
- }
- public void setPlayer1(String player1) {
- this.player1 = player1;
- }
- public void setPlayer2(String player2) {
- this.player2 = player2;
- }
- public String getWinner()
- {
- return winner;
- }
- public void setWinner(String winner)
- {
- this.winner = winner;
- }
- public String toString()
- {
- return "Der Gewinner ist: " + getWinner();
- }
- public void setP2Stun(long p2Stun) {
- this.p2Stun = p2Stun;
- }
- public long getP2Stun() {
- return p2Stun;
- }
- public void setP1Stun(long p1Stun) {
- this.p1Stun = p1Stun;
- }
- public long getP1Stun() {
- return p1Stun;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement