Compare commits
1
Commits
develop
...
88a19279d3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
88a19279d3 |
@@ -0,0 +1,52 @@
|
||||
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.entity.players.Player;
|
||||
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 Dragon extends Enemy {
|
||||
public Dragon (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("Dragon Key", this);
|
||||
}
|
||||
|
||||
public Dragon() {
|
||||
this("Dragon", 5000, 5000, 0, 100, EntityState.ALIVE, null, null, null, new ArrayList<>(){}, 50, false, 50, 500, 500);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void DropLoot(Player player) {
|
||||
Key.Owner = player;
|
||||
player.AddToInventory(Key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void SpecialAbility(Entity entity) {
|
||||
int curHealth = entity.Health;
|
||||
ModifyStamina(SpecialAbilityStamina, false);
|
||||
Damage(entity, GetDamage(), new AttackPowerUp[]{AttackPowerUp.INEVITABLE});
|
||||
Heal(curHealth - entity.Health);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetSpecialAbilityDescription(Entity entity) {
|
||||
return "Vampire will suck the blood out of " + entity.Name + " and heal themselves while hurting the enemy";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetSpecialAbilityResultDescription(Entity entity) {
|
||||
return "Vampire attacked " + entity.Name + " and sucked his blood out of his veins. He seems more powerful";
|
||||
}
|
||||
}
|
||||
@@ -1,34 +1,103 @@
|
||||
package org.project.entity.enemies;
|
||||
|
||||
import org.project.item.weapons.Weapon;
|
||||
import org.project.Interface.IDamageable;
|
||||
import org.project.constants.gameConstant.AttackPowerUp;
|
||||
import org.project.constants.gameConstant.EntityState;
|
||||
import org.project.constants.gameConstant.FightMoves;
|
||||
import org.project.constants.gameConstant.ItemClass;
|
||||
import org.project.entity.Entity;
|
||||
import org.project.entity.players.Player;
|
||||
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;
|
||||
|
||||
// TODO: UPDATE IMPLEMENTATION
|
||||
public abstract class Enemy {
|
||||
Weapon weapon;
|
||||
private int hp;
|
||||
private int mp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
|
||||
public Enemy(int hp, int mp, Weapon weapon) {
|
||||
this.hp = hp;
|
||||
this.mp = mp;
|
||||
public abstract class Enemy extends Entity {
|
||||
protected KeyItem Key;
|
||||
|
||||
this.weapon = weapon;
|
||||
public Enemy (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, stamina, maxStamina, money, baseDamage, state, weapon, shield, costume, inventory, defenseBonus, isDefending, healAmount);
|
||||
|
||||
Key = new KeyItem(null, this);
|
||||
}
|
||||
|
||||
protected Enemy() {
|
||||
super();
|
||||
}
|
||||
|
||||
public void DropLoot(Player player) {
|
||||
Random random = new Random();
|
||||
|
||||
for (Item item : Inventory) {
|
||||
int change = random.nextInt(2);
|
||||
|
||||
if (change == 0) {
|
||||
player.AddToInventory(item);
|
||||
}
|
||||
}
|
||||
|
||||
ArrayList<Item> keys = player.GetInventoryByClass(ItemClass.KEY);
|
||||
if (keys.stream().noneMatch(obj -> Objects.equals(obj.getName(), Key.getName()))) {
|
||||
int chance = random.nextInt(5);
|
||||
|
||||
if (chance == 0) {
|
||||
Key.Owner = player;
|
||||
player.AddToInventory(Key);
|
||||
}
|
||||
}
|
||||
|
||||
player.ModifyMoney(GetMoney(), true);
|
||||
}
|
||||
|
||||
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();
|
||||
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
|
||||
public void takeDamage(int damage) {
|
||||
hp -= damage;
|
||||
public void LightAttack(IDamageable target) {
|
||||
int damage = GetDamage();
|
||||
|
||||
Damage(target, (int)(damage * 0.4), new AttackPowerUp[]{});
|
||||
ModifyStamina(MaxStamina/8, true);
|
||||
}
|
||||
|
||||
public int getHp() {
|
||||
return hp;
|
||||
@Override
|
||||
public void HeavyAttack(IDamageable target) {
|
||||
int damage = GetDamage();
|
||||
ModifyStamina(HeavyAttackStamina, false);
|
||||
|
||||
Damage(target, (int)(damage * 0.9), new AttackPowerUp[]{});
|
||||
}
|
||||
|
||||
public int getMp() {
|
||||
return mp;
|
||||
@Override
|
||||
public void HealMove() {
|
||||
super.HealMove();
|
||||
ModifyStamina(MaxStamina/4, true);
|
||||
}
|
||||
|
||||
public Weapon getWeapon() {
|
||||
return weapon;
|
||||
}
|
||||
@Override
|
||||
public abstract void SpecialAbility(Entity entity);
|
||||
|
||||
@Override
|
||||
public abstract String GetSpecialAbilityDescription(Entity entity);
|
||||
|
||||
@Override
|
||||
public abstract String GetSpecialAbilityResultDescription(Entity entity);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
package org.project.entity.enemies;
|
||||
|
||||
public class Goblin extends Enemy {
|
||||
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.project.entity.enemies;
|
||||
|
||||
// TODO: UPDATE IMPLEMENTATION
|
||||
public class Skeleton {
|
||||
// TODO: DESIGN ENEMY AND IMPLEMENT THE CONSTRUCTOR
|
||||
public class Skeleton extends Enemy {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
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 Vampire extends Enemy {
|
||||
public Vampire (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("Vampire Key", this);
|
||||
}
|
||||
|
||||
public Vampire() {
|
||||
this("Vampire", 150, 150, 100, 20, EntityState.ALIVE, null, null, null, new ArrayList<>(), 8, false, 30, 100, 100);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void SpecialAbility(Entity entity) {
|
||||
int curHealth = entity.Health;
|
||||
ModifyStamina(SpecialAbilityStamina, false);
|
||||
Damage(entity, GetDamage(), new AttackPowerUp[]{AttackPowerUp.INEVITABLE});
|
||||
Heal(curHealth - entity.Health);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetSpecialAbilityDescription(Entity entity) {
|
||||
return "Vampire will suck the blood out of " + entity.Name + " and heal themselves while hurting the enemy";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetSpecialAbilityResultDescription(Entity entity) {
|
||||
return "Vampire attacked " + entity.Name + " and sucked his blood out of his veins. He seems more powerful";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user