Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
88a19279d3 |
@@ -2,7 +2,6 @@ package org.project.constants.gameConstant;
|
||||
|
||||
public enum EntityState {
|
||||
ALIVE,
|
||||
DOWNED,
|
||||
DEAD,
|
||||
FROZEN
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ public abstract class Entity implements IDamageable, IHealable, IDefendable, IFi
|
||||
|
||||
@Override
|
||||
public ArrayList<FightMoves> GetAvailableMoves() {
|
||||
if (GetState() == EntityState.FROZEN || GetState() == EntityState.DEAD) return new ArrayList<>(){};
|
||||
if (GetState() == EntityState.FROZEN) return new ArrayList<>(){};
|
||||
|
||||
ArrayList<FightMoves> result = new ArrayList<>();
|
||||
result.add(FightMoves.DEFEND);
|
||||
|
||||
@@ -34,20 +34,19 @@ public class Dragon extends Enemy {
|
||||
|
||||
@Override
|
||||
public void SpecialAbility(Entity entity) {
|
||||
int curHealth = entity.Health;
|
||||
ModifyStamina(SpecialAbilityStamina, false);
|
||||
Damage(entity, GetDamage() * 2, new AttackPowerUp[]{AttackPowerUp.INEVITABLE, AttackPowerUp.ANTI_SHIELD});
|
||||
Damage(entity, GetDamage(), new AttackPowerUp[]{AttackPowerUp.INEVITABLE});
|
||||
Heal(curHealth - entity.Health);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetSpecialAbilityDescription(Entity entity) {
|
||||
return "Dragon will throw its fiery breath towards " + entity.Name + ". No defense and shield will help";
|
||||
return "Vampire will suck the blood out of " + entity.Name + " and heal themselves while hurting the enemy";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetSpecialAbilityResultDescription(Entity entity) {
|
||||
if (entity.IsDefending) {
|
||||
return "Dragon will threw its fiery breath towards " + entity.Name + ". " + entity.Name + " tries to defend against it, but there's no use";
|
||||
}
|
||||
return "Dragon will threw its fiery breath towards " + entity.Name + ". To " + entity.Name + " surprise, their shield had no use";
|
||||
return "Vampire attacked " + entity.Name + " and sucked his blood out of his veins. He seems more powerful";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,32 +58,16 @@ public abstract class Enemy extends Entity {
|
||||
player.ModifyMoney(GetMoney(), true);
|
||||
}
|
||||
|
||||
public FightMoves PlayRound(Player player) {
|
||||
public void PlayRound(Player player) {
|
||||
ArrayList<FightMoves> moves = GetAvailableMoves();
|
||||
Random random = new Random();
|
||||
int change = random.nextInt(4);
|
||||
|
||||
if (change == 0 && moves.contains(FightMoves.HEAL)) {
|
||||
HealMove();
|
||||
return FightMoves.HEAL;
|
||||
}
|
||||
else if (change == 1 && moves.contains(FightMoves.DEFEND)) {
|
||||
defend();
|
||||
return FightMoves.DEFEND;
|
||||
}
|
||||
else if (moves.contains(FightMoves.SPECIAL)) {
|
||||
SpecialAbility(player);
|
||||
return FightMoves.SPECIAL;
|
||||
}
|
||||
else if (moves.contains(FightMoves.HEAVY_ATTACK)) {
|
||||
HeavyAttack(player);
|
||||
return FightMoves.HEAVY_ATTACK;
|
||||
}
|
||||
else if (moves.contains(FightMoves.LIGHT_ATTACK)) {
|
||||
LightAttack(player);
|
||||
return FightMoves.LIGHT_ATTACK;
|
||||
}
|
||||
else return null;
|
||||
if (change == 0 && moves.contains(FightMoves.HEAL)) HealMove();
|
||||
else if (change == 1 && moves.contains(FightMoves.DEFEND)) defend();
|
||||
else if (moves.contains(FightMoves.SPECIAL)) SpecialAbility(player);
|
||||
else if (moves.contains(FightMoves.HEAVY_ATTACK)) HeavyAttack(player);
|
||||
else LightAttack(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,43 +1,5 @@
|
||||
package org.project.entity.enemies;
|
||||
|
||||
import org.project.constants.gameConstant.AttackPowerUp;
|
||||
import org.project.constants.gameConstant.EntityState;
|
||||
import org.project.entity.Entity;
|
||||
import org.project.item.Accessory.Costume;
|
||||
import org.project.item.Accessory.Shield;
|
||||
import org.project.item.Accessory.Weapon;
|
||||
import org.project.item.Item;
|
||||
import org.project.item.KeyItem;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Goblin extends Enemy {
|
||||
public Goblin (String name, int maxHealth, int health, long money, int baseDamage, EntityState state, Weapon weapon,
|
||||
Shield shield, Costume costume, ArrayList<Item> inventory, int defenseBonus, boolean isDefending,
|
||||
int healAmount, int stamina, int maxStamina) {
|
||||
|
||||
super(name, maxHealth, health, money, baseDamage, state, weapon, shield, costume, inventory, defenseBonus, isDefending, healAmount, stamina, maxStamina);
|
||||
|
||||
this.Key = new KeyItem("Goblin Key", this);
|
||||
}
|
||||
|
||||
public Goblin() {
|
||||
this("Goblin", 75, 75, 100, 10, EntityState.ALIVE, null, null, null, new ArrayList<>(), 5, false, 15, 100, 100);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void SpecialAbility(Entity entity) {
|
||||
ModifyStamina(SpecialAbilityStamina, false);
|
||||
Damage(entity, GetDamage() * 4, new AttackPowerUp[]{});
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetSpecialAbilityDescription(Entity entity) {
|
||||
return "Goblin will rage and cause a critical damage to " + entity.Name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetSpecialAbilityResultDescription(Entity entity) {
|
||||
return "Goblin looks at " + entity.Name + ", its eyes are red... He rages and charges " + entity.Name + " with all of its power";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,90 +1,5 @@
|
||||
package org.project.entity.enemies;
|
||||
|
||||
import org.project.constants.gameConstant.EntityState;
|
||||
import org.project.constants.gameConstant.FightMoves;
|
||||
import org.project.entity.Entity;
|
||||
import org.project.item.Accessory.Costume;
|
||||
import org.project.item.Accessory.Shield;
|
||||
import org.project.item.Accessory.Weapon;
|
||||
import org.project.item.Item;
|
||||
import org.project.item.KeyItem;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
public class Skeleton extends Enemy {
|
||||
|
||||
boolean HasRevived = false;
|
||||
|
||||
public Skeleton (String name, int maxHealth, int health, long money, int baseDamage, EntityState state, Weapon weapon,
|
||||
Shield shield, Costume costume, ArrayList<Item> inventory, int defenseBonus, boolean isDefending,
|
||||
int healAmount, int stamina, int maxStamina) {
|
||||
|
||||
super(name, maxHealth, health, money, baseDamage, state, weapon, shield, costume, inventory, defenseBonus, isDefending, healAmount, stamina, maxStamina);
|
||||
|
||||
this.Key = new KeyItem("Skeleton Key", this);
|
||||
}
|
||||
|
||||
public Skeleton() {
|
||||
this("Skeleton", 125, 125, 200, 15, EntityState.ALIVE, null, null, null, new ArrayList<>(), 5, false, 20, 100, 100);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<FightMoves> GetAvailableMoves() {
|
||||
if (GetState() == EntityState.FROZEN || GetState() == EntityState.DEAD) return new ArrayList<>(){};
|
||||
|
||||
ArrayList<FightMoves> result = new ArrayList<>();
|
||||
|
||||
if (GetState() == EntityState.DOWNED) {
|
||||
if (GetStamina() > MaxStamina / 2 && !HasRevived) {
|
||||
Random random = new Random();
|
||||
int chance = random.nextInt(2);
|
||||
if (chance == 0) {
|
||||
result.add(FightMoves.SPECIAL);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
else {
|
||||
HandleZeroHealth();
|
||||
}
|
||||
}
|
||||
|
||||
result.add(FightMoves.DEFEND);
|
||||
result.add(FightMoves.LIGHT_ATTACK);
|
||||
|
||||
if (Health < MaxHealth) {
|
||||
result.add(FightMoves.HEAL);
|
||||
}
|
||||
|
||||
if (GetStamina() > MaxStamina / 4) {
|
||||
result.add(FightMoves.HEAVY_ATTACK);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void HandleZeroHealth() {
|
||||
if (GetState() == EntityState.DOWNED) {
|
||||
SetState(EntityState.DEAD);
|
||||
}
|
||||
SetState(EntityState.DOWNED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void SpecialAbility(Entity entity) {
|
||||
SetState(EntityState.ALIVE);
|
||||
Health = MaxHealth / 2;
|
||||
HasRevived = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetSpecialAbilityDescription(Entity entity) {
|
||||
return "Skeleton refuses to die and revives";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetSpecialAbilityResultDescription(Entity entity) {
|
||||
return "Just as " + entity.Name + " made sure of their victory. The bones started to shake, they gathered once more for Skeleton to shape. \"You need more thank that to kill me\" Says the skeleton";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public class Vampire extends Enemy {
|
||||
}
|
||||
|
||||
public Vampire() {
|
||||
this("Vampire", 150, 150, 300, 20, EntityState.ALIVE, null, null, null, new ArrayList<>(), 8, false, 30, 100, 100);
|
||||
this("Vampire", 150, 150, 100, 20, EntityState.ALIVE, null, null, null, new ArrayList<>(), 8, false, 30, 100, 100);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user