61 lines
1.3 KiB
Java
61 lines
1.3 KiB
Java
package ruscz.game.gameOfProd.Battle;
|
|
|
|
public class Hero extends BattlePerson {
|
|
private int mana;
|
|
private int defence;
|
|
private boolean isBlocking;
|
|
|
|
public Hero(int hp, int lvl, String name, int str, int mana, int defence, String image){
|
|
super(hp, lvl, name, str, image);
|
|
this.mana = mana;
|
|
this.defence = defence;
|
|
isBlocking = false;
|
|
}
|
|
|
|
public Hero(int hp, int lvl, String name, int str, int mana, int defence){
|
|
super(hp, lvl, name, str);
|
|
this.mana = mana;
|
|
this.defence = defence;
|
|
isBlocking = false;
|
|
}
|
|
|
|
@Override
|
|
public int heal(int heal) {
|
|
int h = health;
|
|
if (health + heal < maxHealth) health += heal;
|
|
else health = maxHealth;
|
|
stopEffectTimer();
|
|
getHealed();
|
|
return health - h;
|
|
}
|
|
|
|
@Override
|
|
public void attack(BattlePerson enemy) {
|
|
enemy.setHealth(enemy.getHealth() - (strength * level));
|
|
}
|
|
|
|
@Override
|
|
public void block() {
|
|
isBlocking = true;
|
|
}
|
|
|
|
@Override
|
|
public void addMana(int newMana) {
|
|
mana += newMana;
|
|
}
|
|
|
|
@Override
|
|
public void addDefence(int def) {
|
|
defence += def;
|
|
}
|
|
|
|
@Override
|
|
public void addStrength(int str) {
|
|
strength += str;
|
|
}
|
|
|
|
@Override
|
|
public void runAway() {
|
|
}
|
|
}
|