simplify Player and Enemy classes
This commit is contained in:
@@ -56,7 +56,7 @@ public abstract class Entity implements IDamageable, IHealable, IDefendable, IFi
|
||||
|
||||
protected Entity() {}
|
||||
|
||||
public int getStamina() { return Stamina; }
|
||||
public int GetStamina() { return Stamina; }
|
||||
|
||||
public void ResetStamina() { Stamina = MaxStamina; }
|
||||
|
||||
@@ -78,7 +78,28 @@ public abstract class Entity implements IDamageable, IHealable, IDefendable, IFi
|
||||
public EntityState GetState() { return State; }
|
||||
|
||||
@Override
|
||||
public int GetDamage() { return BaseDamage; }
|
||||
public int GetDamage() {
|
||||
int damage = BaseDamage;
|
||||
IDamageUtil[] utils = GetDamageUtils();
|
||||
|
||||
for (IDamageUtil util : utils) {
|
||||
if (util != null) {
|
||||
damage += util.GetDamage();
|
||||
}
|
||||
}
|
||||
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDamageUtil[] GetDamageUtils() {
|
||||
return new IDamageUtil[] {Weapon};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Damage(IDamageable target, int amount, AttackPowerUp[] powerUps) {
|
||||
target.TakeDamage(amount, powerUps);
|
||||
}
|
||||
|
||||
public long GetMoney() { return Money; }
|
||||
|
||||
@@ -200,9 +221,15 @@ public abstract class Entity implements IDamageable, IHealable, IDefendable, IFi
|
||||
}
|
||||
@Override
|
||||
public abstract void SpecialAbility(Entity entity);
|
||||
@Override
|
||||
public abstract String GetSpecialAbilityDescription(Entity entity);
|
||||
@Override
|
||||
public abstract String GetSpecialAbilityResultDescription(Entity entity);
|
||||
|
||||
@Override
|
||||
public FightMoves[] getAvailableMoves() {
|
||||
public ArrayList<FightMoves> GetAvailableMoves() {
|
||||
if (GetState() == EntityState.FROZEN) return new ArrayList<>(){};
|
||||
|
||||
ArrayList<FightMoves> result = new ArrayList<>();
|
||||
result.add(FightMoves.DEFEND);
|
||||
result.add(FightMoves.LIGHT_ATTACK);
|
||||
@@ -219,6 +246,6 @@ public abstract class Entity implements IDamageable, IHealable, IDefendable, IFi
|
||||
result.add(FightMoves.HEAVY_ATTACK);
|
||||
}
|
||||
|
||||
return result.toArray(new FightMoves[0]);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user