Develop #1

Open
Ramtin wants to merge 35 commits from develop into main
10 changed files with 109 additions and 3 deletions
Showing only changes of commit a0a8626436 - Show all commits
@@ -56,6 +56,32 @@ public abstract class Entity implements IDamageable, IHealable, IDefendable, IFi
protected Entity() {} protected Entity() {}
public Entity(Entity other) {
this.Name = other.Name;
this.MaxHealth = other.MaxHealth;
this.Health = other.Health;
this.Stamina = other.Stamina;
this.MaxStamina = other.MaxStamina;
this.Money = other.Money;
this.BaseDamage = other.BaseDamage;
this.State = other.State;
this.Weapon = other.Weapon == null ? null : new Weapon(other.Weapon.getName(), this, other.Weapon.GetPrice(), other.Weapon.GetHealth(), other.Weapon.GetMaxHealth(), other.Weapon.GetDamage());
this.Shield = other.Shield == null ? null : new Shield(other.Shield.getName(), this, other.Shield.GetPrice(), other.Shield.GetHealth(), other.Shield.GetMaxHealth(), other.Shield.GetDefense());
this.Costume = other.Costume == null ? null : new Costume(other.Costume.getName(), this, other.Costume.GetPrice(), other.Costume.GetHealth(), other.Costume.GetMaxHealth(), other.Costume.GetDefense());
this.Inventory = other.Inventory == null ? null : new ArrayList<>(other.Inventory);
this.defencePowerUps = other.defencePowerUps == null ? null : new ArrayList<>(other.defencePowerUps);
this.DefenseBonus = other.DefenseBonus;
this.IsDefending = other.IsDefending;
this.HealAmount = other.HealAmount;
this.HeavyAttackStamina = other.HeavyAttackStamina;
this.SpecialAbilityStamina = other.SpecialAbilityStamina;
}
public abstract Entity copy();
public int GetStamina() { return Stamina; } public int GetStamina() { return Stamina; }
public void ResetStamina() { Stamina = MaxStamina; } public void ResetStamina() { Stamina = MaxStamina; }
@@ -146,7 +172,7 @@ public abstract class Entity implements IDamageable, IHealable, IDefendable, IFi
@Override @Override
public void TakeDamage(int amount, AttackPowerUp[] powerUps) { public void TakeDamage(int amount, AttackPowerUp[] powerUps) {
if (!defencePowerUps.contains(DefencePowerUp.INVISIBLE)) return; if (defencePowerUps != null && !defencePowerUps.contains(DefencePowerUp.INVISIBLE)) return;
IDefender[] defenders = GetDefenders(); IDefender[] defenders = GetDefenders();
@@ -26,6 +26,15 @@ public class Dragon extends Enemy {
this("Dragon", 5000, 5000, 0, 100, EntityState.ALIVE, null, null, null, new ArrayList<>(){}, 50, false, 50, 500, 500, 1000); this("Dragon", 5000, 5000, 0, 100, EntityState.ALIVE, null, null, null, new ArrayList<>(){}, 50, false, 50, 500, 500, 1000);
} }
public Dragon (Dragon other) {
super(other);
}
@Override
public Dragon copy() {
return new Dragon(this);
}
@Override @Override
public void DropLoot(Player player) { public void DropLoot(Player player) {
Key.Owner = player; Key.Owner = player;
@@ -36,6 +36,14 @@ public abstract class Enemy extends Entity {
super(); super();
} }
public Enemy(Enemy other) {
super(other);
this.Key = new KeyItem(other.Key.getName(), other.Key.Owner);
}
@Override
public abstract Enemy copy();
public void DropLoot(Player player) { public void DropLoot(Player player) {
Random random = new Random(); Random random = new Random();
@@ -25,6 +25,15 @@ public class Goblin extends Enemy {
this("Goblin", 75, 75, 100, 10, EntityState.ALIVE, null, null, null, new ArrayList<>(), 5, false, 15, 100, 100, 50); this("Goblin", 75, 75, 100, 10, EntityState.ALIVE, null, null, null, new ArrayList<>(), 5, false, 15, 100, 100, 50);
} }
public Goblin (Goblin other) {
super(other);
}
@Override
public Goblin copy() {
return new Goblin(this);
}
@Override @Override
public void SpecialAbility(Entity entity) { public void SpecialAbility(Entity entity) {
ModifyStamina(SpecialAbilityStamina, false); ModifyStamina(SpecialAbilityStamina, false);
@@ -29,6 +29,15 @@ public class Skeleton extends Enemy {
this("Skeleton", 125, 125, 200, 15, EntityState.ALIVE, null, null, null, new ArrayList<>(), 5, false, 20, 100, 100, 100); this("Skeleton", 125, 125, 200, 15, EntityState.ALIVE, null, null, null, new ArrayList<>(), 5, false, 20, 100, 100, 100);
} }
public Skeleton (Skeleton other) {
super(other);
}
@Override
public Skeleton copy() {
return new Skeleton(this);
}
@Override @Override
public ArrayList<FightMoves> GetAvailableMoves() { public ArrayList<FightMoves> GetAvailableMoves() {
if (GetState() == EntityState.FROZEN || GetState() == EntityState.DEAD) return new ArrayList<>(){}; if (GetState() == EntityState.FROZEN || GetState() == EntityState.DEAD) return new ArrayList<>(){};
@@ -25,6 +25,15 @@ public class Vampire extends Enemy {
this("Vampire", 150, 150, 300, 20, EntityState.ALIVE, null, null, null, new ArrayList<>(), 8, false, 30, 100, 100, 150); this("Vampire", 150, 150, 300, 20, EntityState.ALIVE, null, null, null, new ArrayList<>(), 8, false, 30, 100, 100, 150);
} }
public Vampire (Vampire other) {
super(other);
}
@Override
public Vampire copy() {
return new Vampire(this);
}
@Override @Override
public void SpecialAbility(Entity entity) { public void SpecialAbility(Entity entity) {
int curHealth = entity.Health; int curHealth = entity.Health;
@@ -27,6 +27,15 @@ public class Assassin extends Player {
this(name, 125, 125, 100, 15, EntityState.ALIVE, null, null, null, new ArrayList<>(), 5, false, 35, 100, 100, 1, 0); this(name, 125, 125, 100, 15, EntityState.ALIVE, null, null, null, new ArrayList<>(), 5, false, 35, 100, 100, 1, 0);
} }
public Assassin(Assassin other) {
super(other);
}
@Override
public Assassin copy() {
return new Assassin(this);
}
@Override @Override
public void SpecialAbility(Entity entity) { public void SpecialAbility(Entity entity) {
ModifyStamina(SpecialAbilityStamina, false); ModifyStamina(SpecialAbilityStamina, false);
@@ -27,6 +27,15 @@ public class Knight extends Player {
this(name, 150, 150, 100, 20, EntityState.ALIVE, null, null, null, new ArrayList<>(), 8, false, 30, 100, 100, 1, 0); this(name, 150, 150, 100, 20, EntityState.ALIVE, null, null, null, new ArrayList<>(), 8, false, 30, 100, 100, 1, 0);
} }
public Knight(Knight other) {
super(other);
}
@Override
public Knight copy() {
return new Knight(this);
}
@Override @Override
public void SpecialAbility(Entity entity) { public void SpecialAbility(Entity entity) {
ModifyStamina(SpecialAbilityStamina, false); ModifyStamina(SpecialAbilityStamina, false);
@@ -29,6 +29,15 @@ public abstract class Player extends Entity {
super(); super();
} }
public Player(Player other) {
super(other);
this.Level = other.Level;
this.LevelProgress = other.LevelProgress;
}
@Override
public abstract Player copy();
public void LevelUpTo(int level) { public void LevelUpTo(int level) {
while (Level < level) { while (Level < level) {
UnconditionalLevelUp(); UnconditionalLevelUp();
@@ -68,15 +77,15 @@ public abstract class Player extends Entity {
int damage = GetDamage(); int damage = GetDamage();
Damage(target, (int)(damage * 0.5), new AttackPowerUp[]{}); Damage(target, (int)(damage * 0.5), new AttackPowerUp[]{});
ModifyStamina(MaxStamina/8, true); ModifyStamina(MaxStamina/8, false);
} }
@Override @Override
public void HeavyAttack(IDamageable target) { public void HeavyAttack(IDamageable target) {
int damage = GetDamage(); int damage = GetDamage();
ModifyStamina(HeavyAttackStamina, false);
Damage(target, damage, new AttackPowerUp[]{}); Damage(target, damage, new AttackPowerUp[]{});
ModifyStamina(HeavyAttackStamina, false);
} }
@Override @Override
@@ -27,6 +27,15 @@ public class Wizard extends Player {
this(name, 100, 100, 100, 15, EntityState.ALIVE, null, null, null, new ArrayList<>(), 5, false, 40, 100, 100, 1, 0); this(name, 100, 100, 100, 15, EntityState.ALIVE, null, null, null, new ArrayList<>(), 5, false, 40, 100, 100, 1, 0);
} }
public Wizard(Wizard other) {
super(other);
}
@Override
public Wizard copy() {
return new Wizard(this);
}
@Override @Override
public void SpecialAbility(Entity entity) { public void SpecialAbility(Entity entity) {
ModifyStamina(SpecialAbilityStamina, false); ModifyStamina(SpecialAbilityStamina, false);