public class Actor { private final String name; // TODO: enemy should not be binary (ex clans / groups / factions) private boolean isEnemy; private int hp; private int x; private int y; public class SkillSet { public int agility = 0; // public int strenght; // public int defense; } public SkillSet skills; private Weapon weapon; private int actionsLeft; // TODO: make final private int actions = 2; // TODO: make bonus / power-ups structure public Actor(String name, int hp, boolean isEnemy, int agility) { this.name = name; this.hp = hp; this.isEnemy = isEnemy; this.skills = new SkillSet(); this.skills.agility = agility; // TODO: puch should have infinite durability this.weapon = new Weapon("fist", 1, 1, 10000000); this.resetActions(); } public String getName() { return this.name; } public int getX() { return this.x; } public int getY() { return this.y; } public Weapon getWeapon() { return this.weapon; } public void equipWeapon(Weapon weapon) { this.weapon = weapon; } public void setHP(int hp) { this.hp = hp; } public int getHP() { return this.hp; } public final SkillSet getSkills() { return this.skills; } public int getActionsLeft() { return this.actionsLeft; } public void resetActions() { this.actionsLeft = this.actions; } public boolean hit(Actor actor, Map map) { if (this.actionsLeft > 0) { if (this.weapon.damage(this, actor, map)) { this.actionsLeft--; return true; } } return false; } public boolean isAlive() { return this.hp > 0; } public boolean isEnemy() { return this.isEnemy; } public void damage(int dmg) { this.hp -= dmg; } public void move(int x, int y) { if (this.actionsLeft > 0) { this.x = x; this.y = y; this.actionsLeft--; } } public void place(int x, int y) { this.x = x; this.y = y; } }