Skip to content

Instantly share code, notes, and snippets.

@Raf0707
Created July 29, 2023 10:00
Show Gist options
  • Save Raf0707/8742bd63cc0e5718543ce8ecc856141b to your computer and use it in GitHub Desktop.
Save Raf0707/8742bd63cc0e5718543ce8ecc856141b to your computer and use it in GitHub Desktop.
Player
package pize.graphics.entities;
public class Player implements Person {
public String name;
public String nick;
public int minDamage;
public int maxDamage;
public int damage;
public int hp;
public Player(String name, String nick, int minDamage, int maxDamage, int hp, int damage) {
this.name = name;
this.nick = nick;
this.minDamage = minDamage;
this.maxDamage = maxDamage;
this.hp = hp;
}
public int getDamage() {
return damage;
}
public void setDamage(int damage) {
this.damage = damage;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getNick() {
return nick;
}
public void setNick(String nick) {
this.nick = nick;
}
public int getMinDamage() {
return minDamage;
}
public void setMinDamage(int minDamage) {
this.minDamage = minDamage;
}
public int getMaxDamage() {
return maxDamage;
}
public void setMaxDamage(int maxDamage) {
this.maxDamage = maxDamage;
}
public int getHp() {
return hp;
}
public void setHp(int hp) {
this.hp = hp;
}
@Override
public void strike(Player me, Player player2) {
player2.setHp(player2.getHp() - me.getDamage());
}
@Override
public void die(Player player) {
player.setHp(0);
}
@Override
public void takeDamage(Player me, Player player2) {
me.setHp(me.getHp() - player2.getDamage());
}
@Override
public void eat(Player player, int calloryEat) {
player.setHp(calloryEat);
}
@Override
public void changeName(Player player, String name) {
player.setName(name);
}
@Override
public void changeNick(Player player, String nich) {
player.setNick(nick);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment