Develop #1
@@ -1,5 +1,90 @@
|
||||
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";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user