package game.player;

import game.menu.StatusMenu;

import java.util.Objects;

public class Player extends Personality implements PersonalityType {
    private String playerName;
    private Type type;
    private int health;
    private int experience;
    private int attack;
    private int defence;
    private boolean isUser = false;

    public void setPlayerName(String playerName) {
        this.playerName = playerName;
        //TODO validation
    }

    public void setHealth(int health) {
        this.health = Personality.HEALTH_DEFAULT;
        if (isUser) {
            this.health += health;
        }
    }

    public void setExperience(int experience) {
        this.experience = Personality.EXPERIENCE_DEFAULT;
        if (isUser) {
            this.experience += experience;
        }
    }

    public void setAttack(int attack) {
        this.attack = Personality.ATTACK_DEFAULT;
        if (isUser) {
            this.attack += attack;
        }
    }

    public void setDefence(int defence) {
        this.defence = Personality.DEFENCE_DEFAULT;
        if (isUser) {
            this.defence += defence;
        }
    }

    public Player(String playerName, StatusMenu status, Type type) {
        this.setPlayerName(playerName);
        this.setType(type);
        this.setHealth(50);
        this.setExperience(5);
        this.setAttack(15);
        this.setDefence(15);
    }

    @Override
    public void setType(Type type) {
        this.type = type;
        if (Objects.equals(this.type, Type.USER)) {
            this.isUser = true;
        }
    }
}

@@ -19,38 +19,8 @@
 r;%0A%0A
-import game.menu.StatusMenu;%0A%0A
 impo
@@ -1151,27 +1151,8 @@
 ame,
- StatusMenu status,
  Typ
@@ -1153,32 +1153,32 @@
 e, Type type) %7B%0A
+
         this.set
@@ -1252,16 +1252,17 @@
 tHealth(
+2
 50);%0A   
@@ -1285,16 +1285,17 @@
 erience(
+2
 5);%0A    
@@ -1314,17 +1314,18 @@
 Attack(1
-5
+00
 );%0A     
@@ -1344,17 +1344,18 @@
 efence(1
-5
+00
 );%0A    %7D
@@ -1517,16 +1517,16 @@
 = true;%0A
-
         
@@ -1532,11 +1532,478 @@
  %7D%0A    %7D
+%0A%0A    public String getPlayerName() %7B%0A        return this.playerName;%0A    %7D%0A%0A    public int getHealth() %7B%0A        return this.health;%0A    %7D%0A%0A    public int getExperience() %7B%0A        return this.experience;%0A    %7D%0A%0A    public int getAttack() %7B%0A        return this.attack;%0A    %7D%0A%0A    public int getDefence() %7B%0A        return this.defence;%0A    %7D%0A%0A    public Type getType() %7B%0A        return this.type;%0A    %7D%0A%0A    public boolean isUser() %7B%0A        return this.isUser;%0A    %7D
 %0A%7D%0A

add getter to Player