Compare commits
9
Commits
main
..
1f187ff4d8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1f187ff4d8 | ||
|
|
3ca0ce99db | ||
|
|
07fd0bad33 | ||
|
|
6a68d82f7a | ||
|
|
43421d5f25 | ||
|
|
32f93927c8 | ||
|
|
011526da36 | ||
|
|
e3d7d1d554 | ||
|
|
b25cbc6ede |
@@ -0,0 +1,15 @@
|
||||
package org.project;
|
||||
|
||||
public class Colors {
|
||||
|
||||
public static final String RESET = "\u001B[0m";
|
||||
|
||||
public static final String RED = "\u001B[31m";
|
||||
public static final String GREEN = "\u001B[32m";
|
||||
public static final String YELLOW = "\u001B[33m";
|
||||
public static final String RED_BRIGHT = "\u001B[91m";
|
||||
public static final String CYAN = "\u001B[36m";
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,15 +1,11 @@
|
||||
package org.project;
|
||||
|
||||
import org.project.location.Location;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
// TODO: ADD LOCATIONS TO YOUR GAME
|
||||
List<Location> locations = new ArrayList<>();
|
||||
|
||||
// TODO: IMPLEMENT GAMEPLAY
|
||||
GameLoop game = new GameLoop();
|
||||
|
||||
game.start();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package org.project.abilities;
|
||||
|
||||
import org.project.entity.Entity;
|
||||
|
||||
public class ArcaneStorm extends SpecialAbility{
|
||||
|
||||
/*
|
||||
Wizard use this special ability
|
||||
it Becomes invisible
|
||||
no longer gets damage
|
||||
*/
|
||||
|
||||
public ArcaneStorm() {
|
||||
super("ArcaneStorm",25, 3, AbilityTarget.TARGET);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onApply(Entity target) {
|
||||
super.onApply(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(Entity target) {
|
||||
target.freeze();
|
||||
System.out.println(target.getName() + " is steel Frozen!");
|
||||
reduceDuration();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExpire(Entity self) {
|
||||
System.out.println(self.getName() + "'s special ability onExpired");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package org.project.abilities;
|
||||
|
||||
import org.project.entity.Entity;
|
||||
|
||||
public class BoneStrike extends SpecialAbility{
|
||||
|
||||
/*
|
||||
Skeleton use this special ability
|
||||
its throws bones and damage enemies
|
||||
*/
|
||||
|
||||
private final int damage = 5;
|
||||
|
||||
public BoneStrike() {
|
||||
super("BoneThrow",10, 3, AbilityTarget.TARGET);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onApply(Entity target) {
|
||||
super.onApply(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(Entity target) {
|
||||
target.takeDamage(damage);
|
||||
System.out.println(target.getName() + " suffers from " + getName());
|
||||
reduceDuration();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExpire(Entity self) {
|
||||
System.out.println(self.getName() + "'s special ability onExpired");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package org.project.abilities;
|
||||
|
||||
import org.project.entity.Entity;
|
||||
|
||||
public class GuardianOath extends SpecialAbility{
|
||||
|
||||
/*
|
||||
|
||||
Knight use this special ability
|
||||
The first damage and the knight is completely restrained
|
||||
its gains some health
|
||||
|
||||
*/
|
||||
|
||||
public GuardianOath() {
|
||||
super("GuardianOath",15, 1, AbilityTarget.SELF);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onApply(Entity target) {
|
||||
super.onApply(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(Entity self) {
|
||||
|
||||
self.heal(5);
|
||||
self.defend();
|
||||
System.out.println("Guardian Oath empowers Sir Duncan: +5 HP and 50% Decreased damage.\n ");
|
||||
reduceDuration();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExpire(Entity self) {
|
||||
System.out.println(self.getName() + "'s special ability onExpired");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package org.project.abilities;
|
||||
|
||||
import org.project.entity.Entity;
|
||||
|
||||
public class InfernoBreath extends SpecialAbility{
|
||||
|
||||
/*
|
||||
|
||||
Dragon use this special ability
|
||||
its fiery breath deals huge damage to the enemy
|
||||
|
||||
*/
|
||||
|
||||
private final int breathDamage = 20;
|
||||
|
||||
public InfernoBreath() {
|
||||
super("InfernoBreath",25, 1,AbilityTarget.TARGET);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onApply(Entity target) {
|
||||
super.onApply(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(Entity target) {
|
||||
target.takeDamage(breathDamage);
|
||||
System.out.println("ooooh! " + getName() + " impacted with " + target.getName());
|
||||
reduceDuration();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExpire(Entity self) {
|
||||
super.onExpire(self);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package org.project.abilities;
|
||||
|
||||
import org.project.entity.Entity;
|
||||
|
||||
public class LifeSteal extends SpecialAbility{
|
||||
|
||||
/*
|
||||
|
||||
vampire use this special ability
|
||||
its bite's the enemy's nek
|
||||
|
||||
|
||||
*/
|
||||
|
||||
private final int healAmount = 15;
|
||||
|
||||
public LifeSteal() {
|
||||
|
||||
super("SuckingBlood",15, 1,AbilityTarget.SELF);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onApply(Entity target) {
|
||||
super.onApply(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(Entity self) {
|
||||
self.heal(healAmount);
|
||||
System.out.println(self.getName() + " healed for " + healAmount + " (LifeSteal)");
|
||||
reduceDuration();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExpire(Entity self) {
|
||||
System.out.println(self.getName() + "'s special ability onExpired");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package org.project.abilities;
|
||||
|
||||
import org.project.entity.Entity;
|
||||
import org.project.item.weapons.Dagger;
|
||||
import org.project.weaponEffects.PoisonEffect;
|
||||
import org.w3c.dom.ls.LSOutput;
|
||||
|
||||
public class PoisonDagger extends SpecialAbility{
|
||||
|
||||
/*
|
||||
|
||||
Goblin use this special ability
|
||||
applies poison effect on goblin's weapon
|
||||
|
||||
*/
|
||||
|
||||
private final int poisonDamage = 5;
|
||||
|
||||
public PoisonDagger() {
|
||||
|
||||
super("poisonDagger",15,3,AbilityTarget.SELF);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onApply(Entity target) {
|
||||
super.onApply(target);
|
||||
target.setWeapon(new Dagger(new PoisonEffect()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(Entity self) {
|
||||
|
||||
System.out.println(self.getName() + " used Poisonous Dagger ");
|
||||
reduceDuration();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExpire(Entity target) {
|
||||
target.setWeapon(new Dagger());
|
||||
System.out.println(target.getName() + " no longer has poisonous Dagger");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package org.project.abilities;
|
||||
|
||||
import org.project.entity.Entity;
|
||||
|
||||
public abstract class SpecialAbility {
|
||||
|
||||
public enum AbilityTarget {
|
||||
SELF,
|
||||
TARGET
|
||||
}
|
||||
|
||||
protected String name;
|
||||
protected int manaCost;
|
||||
protected int duration;
|
||||
private final AbilityTarget target;
|
||||
|
||||
public SpecialAbility(String name,int manaCost, int duration, AbilityTarget target) {
|
||||
|
||||
this.name = name;
|
||||
this.manaCost = manaCost;
|
||||
this.duration = duration;
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
public AbilityTarget getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public int getManaCost() {return manaCost;}
|
||||
|
||||
public int getDuration() {
|
||||
return duration;
|
||||
}
|
||||
|
||||
public void reduceDuration() {duration--;}
|
||||
|
||||
public void onApply(Entity target) {System.out.println(target.getName() + " activated " + name);}
|
||||
|
||||
public abstract void onTick(Entity target);
|
||||
|
||||
public void onExpire(Entity target) {}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,21 +1,90 @@
|
||||
package org.project.entity;
|
||||
|
||||
import org.project.abilities.SpecialAbility;
|
||||
import org.project.item.armors.Armor;
|
||||
import org.project.item.weapons.Weapon;
|
||||
import org.project.managers.StatusEffectManager;
|
||||
import org.project.weaponEffects.StatusEffect;
|
||||
|
||||
public interface Entity {
|
||||
void attack(Entity target);
|
||||
|
||||
// =========================================================
|
||||
// IDENTITY
|
||||
// =========================================================
|
||||
|
||||
String getName();
|
||||
|
||||
// =========================================================
|
||||
// STATS
|
||||
// =========================================================
|
||||
|
||||
int getHp();
|
||||
int getMp();
|
||||
int getMaxHP();
|
||||
int getMaxMP();
|
||||
void useMana(int amount);
|
||||
|
||||
int getBaseDamage();
|
||||
|
||||
// =========================================================
|
||||
// EQUIPMENT
|
||||
// =========================================================
|
||||
|
||||
Weapon getWeapon();
|
||||
Armor getArmor();
|
||||
|
||||
void setWeapon(Weapon weapon);
|
||||
void setArmor(Armor armor);
|
||||
|
||||
Armor getPersonalArmor();
|
||||
|
||||
// =========================================================
|
||||
// ABILITIES
|
||||
// =========================================================
|
||||
|
||||
SpecialAbility getSpacialAbility();
|
||||
|
||||
void addAbilityEffect(SpecialAbility ability, Entity target);
|
||||
void tickAbilityEffects(Entity target);
|
||||
|
||||
// =========================================================
|
||||
// STATUS EFFECTS
|
||||
// =========================================================
|
||||
|
||||
void heal(int amount);
|
||||
void freeze();
|
||||
void stun();
|
||||
void addStatusEffect(StatusEffect effect);
|
||||
void tickStatusEffects();
|
||||
StatusEffectManager getEffectManager();
|
||||
|
||||
// // =========================================================
|
||||
// // RESOURCE MANAGEMENT
|
||||
// // =========================================================
|
||||
//
|
||||
// void useMana(int amount);
|
||||
|
||||
// =========================================================
|
||||
// COMBAT
|
||||
// =========================================================
|
||||
|
||||
void takeDamage(int amount);
|
||||
|
||||
// =========================================================
|
||||
// STATES
|
||||
// =========================================================
|
||||
|
||||
void defend();
|
||||
boolean isDefending();
|
||||
boolean isFrozen();
|
||||
boolean isStunned();
|
||||
void resetTurnState();
|
||||
|
||||
void heal(int health);
|
||||
|
||||
void fillMana(int mana);
|
||||
// =========================================================
|
||||
// INTERNAL SETTERS
|
||||
// =========================================================
|
||||
|
||||
void takeDamage(int damage);
|
||||
|
||||
int getMaxHP();
|
||||
|
||||
int getMaxMP();
|
||||
|
||||
/*
|
||||
TODO: ADD OTHER REQUIRED AND BONUS METHODS
|
||||
*/
|
||||
void setHp(int value);
|
||||
void setMp(int value);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package org.project.entity.enemies;
|
||||
|
||||
import org.project.abilities.InfernoBreath;
|
||||
import org.project.item.armors.Armor;
|
||||
import org.project.item.armors.DragonArmor;
|
||||
import org.project.item.weapons.Sword;
|
||||
|
||||
public class Dragon extends Enemy {
|
||||
|
||||
private static final String NAME = "Dragon";
|
||||
private static final int MAX_HP = 300;
|
||||
private static final int MAX_MP = 150;
|
||||
private static final int XP_REWARD = 500;
|
||||
private static final int BASE_DAMAGE = 30;
|
||||
|
||||
private final Armor personalArmor = new DragonArmor();
|
||||
|
||||
public Dragon() {
|
||||
|
||||
super(
|
||||
NAME,
|
||||
MAX_HP,
|
||||
MAX_MP,
|
||||
XP_REWARD,
|
||||
BASE_DAMAGE,
|
||||
null,
|
||||
new Sword(),
|
||||
new InfernoBreath()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Armor getPersonalArmor() {
|
||||
return personalArmor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Dragon{" +
|
||||
"MAX_HP : 300 | " +
|
||||
"MAX_MP : 150 | " +
|
||||
"XP_REWARD : 500 | " +
|
||||
"BASE_DAMAGE : 30 | " +
|
||||
"personalArmor = " + personalArmor +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,34 +1,322 @@
|
||||
package org.project.entity.enemies;
|
||||
|
||||
import org.project.abilities.SpecialAbility;
|
||||
import org.project.entity.Entity;
|
||||
import org.project.entity.players.Player;
|
||||
import org.project.item.armors.Armor;
|
||||
import org.project.item.weapons.Weapon;
|
||||
import org.project.managers.SpecialAbilityManager;
|
||||
import org.project.managers.StatusEffectManager;
|
||||
import org.project.weaponEffects.StatusEffect;
|
||||
|
||||
// TODO: UPDATE IMPLEMENTATION
|
||||
public abstract class Enemy {
|
||||
Weapon weapon;
|
||||
public abstract class Enemy implements Entity {
|
||||
|
||||
// =========================================================
|
||||
// BASIC INFO
|
||||
// =========================================================
|
||||
|
||||
private final String name;
|
||||
|
||||
// =========================================================
|
||||
// STATS
|
||||
// =========================================================
|
||||
|
||||
private int xpReward;
|
||||
|
||||
private int maxHp;
|
||||
private int hp;
|
||||
|
||||
private int maxMp;
|
||||
private int mp;
|
||||
|
||||
public Enemy(int hp, int mp, Weapon weapon) {
|
||||
this.hp = hp;
|
||||
this.mp = mp;
|
||||
private int baseDamage;
|
||||
|
||||
// =========================================================
|
||||
// EQUIPMENT
|
||||
// =========================================================
|
||||
|
||||
private Armor armor;
|
||||
private Weapon weapon;
|
||||
|
||||
// =========================================================
|
||||
// ABILITIES
|
||||
// =========================================================
|
||||
|
||||
private final SpecialAbility specialAbility;
|
||||
|
||||
private final StatusEffectManager effectManager;
|
||||
private final SpecialAbilityManager abilityManager;
|
||||
|
||||
// =========================================================
|
||||
// STATES
|
||||
// =========================================================
|
||||
|
||||
private boolean defending;
|
||||
private boolean frozen;
|
||||
private boolean stunned;
|
||||
private boolean live;
|
||||
|
||||
// =========================================================
|
||||
// CONSTRUCTOR
|
||||
// =========================================================
|
||||
|
||||
public Enemy(
|
||||
String name,
|
||||
int maxHp,
|
||||
int maxMp,
|
||||
int xpReward,
|
||||
int baseDamage,
|
||||
Armor armor,
|
||||
Weapon weapon,
|
||||
SpecialAbility specialAbility
|
||||
) {
|
||||
|
||||
this.name = name;
|
||||
|
||||
this.maxHp = maxHp;
|
||||
this.hp = maxHp;
|
||||
|
||||
this.maxMp = maxMp;
|
||||
this.mp = maxMp;
|
||||
|
||||
this.xpReward = xpReward;
|
||||
|
||||
this.baseDamage = baseDamage;
|
||||
|
||||
this.armor = armor;
|
||||
this.weapon = weapon;
|
||||
|
||||
this.specialAbility = specialAbility;
|
||||
|
||||
this.effectManager = new StatusEffectManager();
|
||||
this.abilityManager = new SpecialAbilityManager();
|
||||
this.live = true;
|
||||
}
|
||||
|
||||
// =========================================================
|
||||
// XP REWARD
|
||||
// =========================================================
|
||||
|
||||
public void rewardXp(Player player) {
|
||||
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
player.gainXp(xpReward);
|
||||
|
||||
System.out.println(
|
||||
player.getName() +
|
||||
" gained " +
|
||||
xpReward +
|
||||
" XP from defeating " +
|
||||
name
|
||||
);
|
||||
}
|
||||
|
||||
// =========================================================
|
||||
// STATUS EFFECTS
|
||||
// =========================================================
|
||||
|
||||
@Override
|
||||
public void addStatusEffect(StatusEffect effect) {
|
||||
effectManager.addEffect(effect, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void takeDamage(int damage) {
|
||||
hp -= damage;
|
||||
public void tickStatusEffects() {
|
||||
effectManager.tick(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatusEffectManager getEffectManager() {
|
||||
return effectManager;
|
||||
}
|
||||
|
||||
// =========================================================
|
||||
// ABILITIES
|
||||
// =========================================================
|
||||
|
||||
@Override
|
||||
public void addAbilityEffect(SpecialAbility ability, Entity target) {
|
||||
abilityManager.addAbility(ability, target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tickAbilityEffects(Entity target) {
|
||||
abilityManager.tick(this, target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpecialAbility getSpacialAbility() {
|
||||
return specialAbility;
|
||||
}
|
||||
|
||||
// =========================================================
|
||||
// COMBAT
|
||||
// =========================================================
|
||||
|
||||
@Override
|
||||
public void takeDamage(int amount) {
|
||||
|
||||
int finalDamage = Math.max(0, amount);
|
||||
|
||||
hp -= finalDamage;
|
||||
if (hp <= 0) {
|
||||
hp = 0;
|
||||
live = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void heal(int amount) {
|
||||
|
||||
if (!live) {
|
||||
return;
|
||||
}
|
||||
|
||||
hp += amount;
|
||||
if (hp > maxHp) {
|
||||
hp = maxHp;
|
||||
System.out.println("HP reached maximum amount " + maxHp);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void useMana(int amount) {
|
||||
|
||||
if (amount <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mp < amount) {
|
||||
|
||||
System.out.println(name + " doesn't have enough mana!");
|
||||
return;
|
||||
}
|
||||
|
||||
mp -= amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void defend() {
|
||||
defending = true;
|
||||
}
|
||||
|
||||
|
||||
// =========================================================
|
||||
// STATES
|
||||
// =========================================================
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isDefending() {
|
||||
return defending;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFrozen() {
|
||||
return frozen;
|
||||
}
|
||||
|
||||
public boolean isStunned() {return stunned;}
|
||||
|
||||
@Override
|
||||
public void freeze() {
|
||||
frozen = true;
|
||||
}
|
||||
|
||||
public void stun() {
|
||||
stunned = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetTurnState() {
|
||||
|
||||
defending = false;
|
||||
frozen = false;
|
||||
stunned = false;
|
||||
}
|
||||
|
||||
// =========================================================
|
||||
// GETTERS
|
||||
// =========================================================
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHp() {
|
||||
return hp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMp() {
|
||||
return mp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxHP() {
|
||||
return maxHp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMP() {
|
||||
return maxMp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBaseDamage() {
|
||||
return baseDamage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Weapon getWeapon() {
|
||||
return weapon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Armor getArmor() {
|
||||
return armor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Armor getPersonalArmor() {
|
||||
return armor;
|
||||
}
|
||||
|
||||
public boolean isLive() {
|
||||
return live;
|
||||
}
|
||||
|
||||
public int getXpReward() {
|
||||
return xpReward;
|
||||
}
|
||||
|
||||
// =========================================================
|
||||
// SETTERS
|
||||
// =========================================================
|
||||
|
||||
@Override
|
||||
public void setWeapon(Weapon weapon) {
|
||||
this.weapon = weapon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setArmor(Armor armor) {
|
||||
this.armor = armor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHp(int value) {
|
||||
hp = Math.max(0, Math.min(value, maxHp));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMp(int value) {
|
||||
mp = Math.max(0, Math.min(value, maxMp));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package org.project.entity.enemies;
|
||||
|
||||
import org.project.abilities.PoisonDagger;
|
||||
import org.project.item.armors.Armor;
|
||||
import org.project.item.armors.GoblinArmor;
|
||||
import org.project.item.weapons.Dagger;
|
||||
|
||||
public class Goblin extends Enemy {
|
||||
|
||||
private static final String NAME = "Goblin";
|
||||
private static final int MAX_HP = 45;
|
||||
private static final int MAX_MP = 50;
|
||||
private static final int XP_REWARD = 30;
|
||||
private static final int BASE_DAMAGE = 5;
|
||||
|
||||
private final Armor personalArmor = new GoblinArmor();
|
||||
|
||||
public Goblin() {
|
||||
|
||||
super(
|
||||
NAME,
|
||||
MAX_HP,
|
||||
MAX_MP,
|
||||
XP_REWARD,
|
||||
BASE_DAMAGE,
|
||||
null,
|
||||
new Dagger(),
|
||||
new PoisonDagger()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Armor getPersonalArmor() {
|
||||
return personalArmor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Goblin{" +
|
||||
"MAX_HP : 45 | " +
|
||||
"MAX_MP : 50 | " +
|
||||
"XP_REWARD : 30 | " +
|
||||
"BASE_DAMAGE : 5 | " +
|
||||
"personalArmor = " + personalArmor +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,47 @@
|
||||
package org.project.entity.enemies;
|
||||
|
||||
// TODO: UPDATE IMPLEMENTATION
|
||||
public class Skeleton {
|
||||
// TODO: DESIGN ENEMY AND IMPLEMENT THE CONSTRUCTOR
|
||||
import org.project.abilities.BoneStrike;
|
||||
import org.project.item.armors.Armor;
|
||||
import org.project.item.armors.SkeletonArmor;
|
||||
import org.project.item.weapons.Sword;
|
||||
|
||||
public class Skeleton extends Enemy {
|
||||
|
||||
private static final String NAME = "Skeleton";
|
||||
private static final int MAX_HP = 40;
|
||||
private static final int MAX_MP = 30;
|
||||
private static final int XP_REWARD = 25;
|
||||
private static final int BASE_DAMAGE = 7;
|
||||
|
||||
private final Armor personalArmor = new SkeletonArmor();
|
||||
|
||||
public Skeleton() {
|
||||
|
||||
super(
|
||||
NAME,
|
||||
MAX_HP,
|
||||
MAX_MP,
|
||||
XP_REWARD,
|
||||
BASE_DAMAGE,
|
||||
null,
|
||||
new Sword(),
|
||||
new BoneStrike()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Armor getPersonalArmor() {
|
||||
return personalArmor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Skeleton{" +
|
||||
"MAX_HP : 40 | " +
|
||||
"MAX_MP : 30 | " +
|
||||
"XP_REWARD : 25 | " +
|
||||
"BASE_DAMAGE : 7 | " +
|
||||
"personalArmor = " + personalArmor +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package org.project.entity.enemies;
|
||||
|
||||
import org.project.abilities.LifeSteal;
|
||||
import org.project.item.armors.Armor;
|
||||
import org.project.item.armors.VampireArmor;
|
||||
import org.project.item.weapons.Dagger;
|
||||
|
||||
public class Vampire extends Enemy {
|
||||
|
||||
private static final String NAME = "Vampire";
|
||||
private static final int MAX_HP = 90;
|
||||
private static final int MAX_MP = 80;
|
||||
private static final int XP_REWARD = 80;
|
||||
private static final int BASE_DAMAGE = 12;
|
||||
|
||||
private final Armor personalArmor = new VampireArmor();
|
||||
|
||||
public Vampire() {
|
||||
|
||||
super(
|
||||
NAME,
|
||||
MAX_HP,
|
||||
MAX_MP,
|
||||
XP_REWARD,
|
||||
BASE_DAMAGE,
|
||||
null,
|
||||
new Dagger(),
|
||||
new LifeSteal()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Armor getPersonalArmor() {
|
||||
return personalArmor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "vampire{" +
|
||||
"MAX_HP : 90 | " +
|
||||
"MAX_MP : 80 | " +
|
||||
"XP_REWARD : 80 | " +
|
||||
"BASE_DAMAGE : 12 | " +
|
||||
"personalArmor = " + personalArmor +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package org.project.entity.players;
|
||||
|
||||
import org.project.abilities.ArcaneStorm;
|
||||
import org.project.item.armors.Armor;
|
||||
import org.project.item.armors.AssassinArmor;
|
||||
import org.project.item.weapons.Dagger;
|
||||
|
||||
public class Assassin extends Player {
|
||||
|
||||
private static final int MAX_HP = 90;
|
||||
private static final int MAX_MP = 120;
|
||||
private static final int LEVEL = 1;
|
||||
private static final int XP = 0;
|
||||
private static final int BASE_DAMAGE = 15;
|
||||
|
||||
private final Armor personalArmor =
|
||||
new AssassinArmor();
|
||||
|
||||
public Assassin(String name) {
|
||||
|
||||
super(
|
||||
name,
|
||||
MAX_HP,
|
||||
MAX_MP,
|
||||
LEVEL,
|
||||
XP,
|
||||
null,
|
||||
BASE_DAMAGE,
|
||||
new Dagger(),
|
||||
new ArcaneStorm()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Armor getPersonalArmor() {
|
||||
return personalArmor;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,38 @@
|
||||
package org.project.entity.players;
|
||||
|
||||
// TODO: UPDATE IMPLEMENTATION
|
||||
public class Knight {
|
||||
// TODO: DESIGN KNIGHT'S WEAPON AND ARMOR AND IMPLEMENT THE CONSTRUCTOR
|
||||
import org.project.abilities.GuardianOath;
|
||||
import org.project.item.armors.Armor;
|
||||
import org.project.item.armors.KnightArmor;
|
||||
import org.project.item.weapons.Sword;
|
||||
|
||||
public class Knight extends Player {
|
||||
|
||||
private static final int MAX_HP = 150;
|
||||
private static final int MAX_MP = 80;
|
||||
private static final int LEVEL = 1;
|
||||
private static final int XP = 0;
|
||||
private static final int BASE_DAMAGE = 12;
|
||||
|
||||
private final Armor personalArmor =
|
||||
new KnightArmor();
|
||||
|
||||
public Knight(String name) {
|
||||
|
||||
super(
|
||||
name,
|
||||
MAX_HP,
|
||||
MAX_MP,
|
||||
LEVEL,
|
||||
XP,
|
||||
null,
|
||||
BASE_DAMAGE,
|
||||
new Sword(),
|
||||
new GuardianOath()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Armor getPersonalArmor() {
|
||||
return personalArmor;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,89 +1,359 @@
|
||||
package org.project.entity.players;
|
||||
|
||||
import org.project.abilities.SpecialAbility;
|
||||
import org.project.entity.Entity;
|
||||
import org.project.item.armors.Armor;
|
||||
import org.project.item.weapons.Weapon;
|
||||
import org.project.managers.SpecialAbilityManager;
|
||||
import org.project.managers.StatusEffectManager;
|
||||
import org.project.weaponEffects.StatusEffect;
|
||||
|
||||
// TODO: UPDATE IMPLEMENTATION
|
||||
public abstract class Player {
|
||||
protected String name;
|
||||
Weapon weapon;
|
||||
Armor armor;
|
||||
public abstract class Player implements Entity {
|
||||
|
||||
// =========================================================
|
||||
// BASIC INFO
|
||||
// =========================================================
|
||||
|
||||
private final String name;
|
||||
|
||||
private int level;
|
||||
private int xp;
|
||||
|
||||
// =========================================================
|
||||
// STATS
|
||||
// =========================================================
|
||||
|
||||
private int maxHp;
|
||||
private int hp;
|
||||
private int maxHP;
|
||||
|
||||
private int maxMp;
|
||||
private int mp;
|
||||
private int maxMP;
|
||||
|
||||
public Player(String name, int hp, int mp, Weapon weapon, Armor armor) {
|
||||
private int baseDamage;
|
||||
|
||||
// =========================================================
|
||||
// EQUIPMENT
|
||||
// =========================================================
|
||||
|
||||
private Armor armor;
|
||||
private Weapon weapon;
|
||||
|
||||
// =========================================================
|
||||
// ABILITIES
|
||||
// =========================================================
|
||||
|
||||
protected SpecialAbility specialAbility;
|
||||
|
||||
private final StatusEffectManager effectManager;
|
||||
private final SpecialAbilityManager abilityManager;
|
||||
|
||||
// =========================================================
|
||||
// STATES
|
||||
// =========================================================
|
||||
|
||||
private boolean defending;
|
||||
private boolean frozen;
|
||||
private boolean stunned;
|
||||
private boolean live;
|
||||
|
||||
// =========================================================
|
||||
// CONSTRUCTOR
|
||||
// =========================================================
|
||||
|
||||
public Player(
|
||||
String name,
|
||||
int maxHp,
|
||||
int maxMp,
|
||||
int level,
|
||||
int xp,
|
||||
Armor armor,
|
||||
int baseDamage,
|
||||
Weapon weapon,
|
||||
SpecialAbility specialAbility
|
||||
) {
|
||||
|
||||
this.name = name;
|
||||
this.hp = hp;
|
||||
this.mp = mp;
|
||||
|
||||
this.weapon = weapon;
|
||||
this.maxHp = maxHp;
|
||||
this.hp = maxHp;
|
||||
|
||||
this.maxMp = maxMp;
|
||||
this.mp = maxMp;
|
||||
|
||||
this.level = level;
|
||||
this.xp = xp;
|
||||
|
||||
this.armor = armor;
|
||||
this.baseDamage = baseDamage;
|
||||
this.weapon = weapon;
|
||||
|
||||
this.specialAbility = specialAbility;
|
||||
|
||||
this.effectManager = new StatusEffectManager();
|
||||
this.abilityManager = new SpecialAbilityManager();
|
||||
|
||||
this.defending = false;
|
||||
this.frozen = false;
|
||||
this.stunned = false;
|
||||
this.live = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// =========================================================
|
||||
// STATUS EFFECTS
|
||||
// =========================================================
|
||||
|
||||
@Override
|
||||
public void addStatusEffect(StatusEffect effect) {
|
||||
effectManager.addEffect(effect, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attack(Entity target) {
|
||||
target.takeDamage(weapon.getDamage());
|
||||
public void tickStatusEffects() {
|
||||
effectManager.tick(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatusEffectManager getEffectManager() {
|
||||
return effectManager;
|
||||
}
|
||||
|
||||
// =========================================================
|
||||
// ABILITIES
|
||||
// =========================================================
|
||||
|
||||
@Override
|
||||
public void addAbilityEffect(SpecialAbility ability, Entity target) {
|
||||
abilityManager.addAbility(ability, target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tickAbilityEffects(Entity target) {
|
||||
abilityManager.tick(this, target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpecialAbility getSpacialAbility() {
|
||||
return specialAbility;
|
||||
}
|
||||
|
||||
// =========================================================
|
||||
// COMBAT
|
||||
// =========================================================
|
||||
|
||||
@Override
|
||||
public void takeDamage(int amount) {
|
||||
|
||||
int finalDamage = Math.max(0, amount);
|
||||
|
||||
|
||||
hp -= finalDamage;
|
||||
if (hp <= 0) {
|
||||
hp = 0;
|
||||
live = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void heal(int amount) {
|
||||
|
||||
if (!live) {
|
||||
return;
|
||||
}
|
||||
|
||||
hp += amount;
|
||||
|
||||
if (hp > maxHp) {
|
||||
hp = maxHp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void useMana(int amount) {
|
||||
|
||||
if (amount <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mp < amount) {
|
||||
|
||||
System.out.println(name + " doesn't have enough mana!");
|
||||
return;
|
||||
}
|
||||
|
||||
mp -= amount;
|
||||
}
|
||||
|
||||
public void restoreMana(int amount) {
|
||||
|
||||
mp += amount;
|
||||
|
||||
if (mp > maxMp) {
|
||||
mp = maxMp;
|
||||
}
|
||||
}
|
||||
|
||||
// =========================================================
|
||||
// STATES
|
||||
// =========================================================
|
||||
|
||||
public void defend() {
|
||||
// TODO
|
||||
defending = true;
|
||||
}
|
||||
|
||||
public void freeze() {
|
||||
frozen = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void takeDamage(int damage) {
|
||||
hp -= damage - armor.getDefense();
|
||||
public void stun() {
|
||||
stunned = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void heal(int health) {
|
||||
hp += health;
|
||||
if (hp > maxHP) {
|
||||
hp = maxHP;
|
||||
public void resetTurnState() {
|
||||
|
||||
defending = false;
|
||||
frozen = false;
|
||||
stunned = false;
|
||||
}
|
||||
|
||||
public void restore() {
|
||||
hp = maxHp;
|
||||
mp = maxMp;
|
||||
System.out.println(name + " fully restored!");
|
||||
System.out.println(" HP: " + hp + "/" + maxHp + " | MP: " + mp + "/" + maxMp + "\n");
|
||||
}
|
||||
|
||||
// =========================================================
|
||||
// LEVEL SYSTEM
|
||||
// =========================================================
|
||||
|
||||
public void gainXp(int amount) {
|
||||
|
||||
xp += amount;
|
||||
|
||||
while (xp >= level * 100) {
|
||||
|
||||
xp -= level * 100;
|
||||
levelUp();
|
||||
}
|
||||
}
|
||||
|
||||
public void levelUp() {
|
||||
|
||||
level++;
|
||||
|
||||
maxHp += 20;
|
||||
maxMp += 10;
|
||||
|
||||
baseDamage += 5;
|
||||
|
||||
hp = maxHp;
|
||||
mp = maxMp;
|
||||
|
||||
System.out.println(name + " leveled up!");
|
||||
System.out.println("Current Level: " + level);
|
||||
}
|
||||
|
||||
// =========================================================
|
||||
// GETTERS
|
||||
// =========================================================
|
||||
|
||||
@Override
|
||||
public void fillMana(int mana) {
|
||||
mp += mana;
|
||||
if (mp > maxMP) {
|
||||
mp = maxMP;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHp() {
|
||||
return hp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxHP() {
|
||||
return maxHP;
|
||||
}
|
||||
|
||||
public int getMp() {
|
||||
return mp;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public int getXp() {
|
||||
return xp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxHP() {
|
||||
return maxHp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMP() {
|
||||
return maxMP;
|
||||
return maxMp;
|
||||
}
|
||||
|
||||
public Weapon getWeapon() {
|
||||
return weapon;
|
||||
@Override
|
||||
public int getBaseDamage() {
|
||||
return baseDamage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Armor getArmor() {
|
||||
return armor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Weapon getWeapon() {
|
||||
return weapon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Armor getPersonalArmor() {
|
||||
return armor;
|
||||
}
|
||||
|
||||
public boolean isDefending() {
|
||||
return defending;
|
||||
}
|
||||
|
||||
public boolean isFrozen() {
|
||||
return frozen;
|
||||
}
|
||||
|
||||
public boolean isStunned() {
|
||||
return stunned;
|
||||
}
|
||||
|
||||
public boolean isLive() {
|
||||
return live;
|
||||
}
|
||||
|
||||
// =========================================================
|
||||
// SETTERS
|
||||
// =========================================================
|
||||
|
||||
@Override
|
||||
public void setHp(int value) {
|
||||
hp = Math.max(0, Math.min(value, maxHp));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMp(int value) {
|
||||
mp = Math.max(0, Math.min(value, maxMp));
|
||||
}
|
||||
|
||||
public void setArmor(Armor armor) {
|
||||
this.armor = armor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWeapon(Weapon weapon) {
|
||||
this.weapon = weapon;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package org.project.entity.players;
|
||||
|
||||
import org.project.abilities.ArcaneStorm;
|
||||
import org.project.item.armors.Armor;
|
||||
import org.project.item.armors.WizardArmor;
|
||||
import org.project.item.weapons.Sword;
|
||||
|
||||
public class Wizard extends Player {
|
||||
|
||||
private static final int MAX_HP = 80;
|
||||
private static final int MAX_MP = 200;
|
||||
private static final int LEVEL = 1;
|
||||
private static final int XP = 0;
|
||||
private static final int BASE_DAMAGE = 10;
|
||||
|
||||
private final Armor personalArmor =
|
||||
new WizardArmor();
|
||||
|
||||
public Wizard(String name) {
|
||||
|
||||
super(
|
||||
name,
|
||||
MAX_HP,
|
||||
MAX_MP,
|
||||
LEVEL,
|
||||
XP,
|
||||
null,
|
||||
BASE_DAMAGE,
|
||||
new Sword(),
|
||||
new ArcaneStorm()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Armor getPersonalArmor() {
|
||||
return personalArmor;
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,7 @@ package org.project.item;
|
||||
import org.project.entity.Entity;
|
||||
|
||||
public interface Item {
|
||||
void use(Entity target);
|
||||
|
||||
/*
|
||||
TODO: ADD OTHER REQUIRED AND BONUS METHODS
|
||||
*/
|
||||
String getName();
|
||||
|
||||
}
|
||||
|
||||
@@ -1,31 +1,77 @@
|
||||
package org.project.item.armors;
|
||||
|
||||
// TODO: UPDATE IMPLEMENTATION
|
||||
public abstract class Armor {
|
||||
package org.project.item.armors;
|
||||
public class Armor {
|
||||
|
||||
public enum ArmorType {
|
||||
LIGHT,
|
||||
MEDIUM,
|
||||
HEAVY
|
||||
}
|
||||
|
||||
|
||||
private String name;
|
||||
private ArmorType type;
|
||||
|
||||
private int defense;
|
||||
private int maxDefense;
|
||||
|
||||
private int durability;
|
||||
private int maxDurability;
|
||||
|
||||
private boolean isBroke;
|
||||
private boolean isBroken;
|
||||
|
||||
public Armor(int defense, int durability) {
|
||||
this.defense = defense;
|
||||
this.durability = durability;
|
||||
// Constructor
|
||||
public Armor(String name, ArmorType type, int maxDefense, int maxDurability) {
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
this.maxDefense = maxDefense;
|
||||
this.defense = maxDefense;
|
||||
this.maxDurability = maxDurability;
|
||||
this.durability = maxDurability;
|
||||
this.isBroken = false;
|
||||
}
|
||||
|
||||
public void checkBreak() {
|
||||
|
||||
public int reduceDamage(int damage) {
|
||||
|
||||
if (isBroken) {
|
||||
return damage;
|
||||
}
|
||||
|
||||
int reducedDamage = damage - defense;
|
||||
|
||||
if (reducedDamage < 0) {
|
||||
reducedDamage = 0;
|
||||
}
|
||||
|
||||
reduceDurability(1);
|
||||
|
||||
return reducedDamage;
|
||||
}
|
||||
|
||||
public void reduceDurability(int amount) {
|
||||
durability -= amount;
|
||||
|
||||
if (durability <= 0) {
|
||||
isBroke = true;
|
||||
durability = 0;
|
||||
breakArmor();
|
||||
}
|
||||
}
|
||||
|
||||
// شکستن زره
|
||||
private void breakArmor() {
|
||||
isBroken = true;
|
||||
defense = 0;
|
||||
}
|
||||
|
||||
// ===== Getters =====
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
// TODO: (BONUS) UPDATE THE REPAIR METHOD
|
||||
public void repair() {
|
||||
isBroke = false;
|
||||
defense = maxDefense;
|
||||
durability = maxDurability;
|
||||
public ArmorType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public int getDefense() {
|
||||
@@ -36,7 +82,19 @@ public abstract class Armor {
|
||||
return durability;
|
||||
}
|
||||
|
||||
public boolean isBroke() {
|
||||
return isBroke;
|
||||
public int getMaxDurability() {
|
||||
return maxDurability;
|
||||
}
|
||||
|
||||
public boolean isBroken() {
|
||||
return isBroken;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name + " | Type: " + type +
|
||||
" | Defense: " + defense +
|
||||
" | Durability: " + durability + "/" + maxDurability +
|
||||
(isBroken ? " (BROKEN)" : "");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.project.item.armors;
|
||||
|
||||
public class AssassinArmor extends Armor {
|
||||
|
||||
private static final String NAME = "wizard Robe";
|
||||
private static final ArmorType ARMOR_TYPE = ArmorType.HEAVY;
|
||||
private static final int MAX_DEFENSE = 35;
|
||||
private static final int MAX_DURABILITY = 60;
|
||||
|
||||
public AssassinArmor() {
|
||||
super(NAME,
|
||||
ARMOR_TYPE,
|
||||
MAX_DEFENSE,
|
||||
MAX_DURABILITY
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.project.item.armors;
|
||||
|
||||
public class DragonArmor extends Armor {
|
||||
|
||||
private static final String NAME = "Dragon scale armor";
|
||||
private static final ArmorType ARMOR_TYPE = ArmorType.HEAVY;
|
||||
private static final int MAX_DEFENSE = 40;
|
||||
private static final int MAX_DURABILITY = 60;
|
||||
|
||||
public DragonArmor() {
|
||||
super(NAME,
|
||||
ARMOR_TYPE,
|
||||
MAX_DEFENSE,
|
||||
MAX_DURABILITY
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.project.item.armors;
|
||||
|
||||
public class GoblinArmor extends Armor {
|
||||
|
||||
private static final String NAME = "goblin Robe";
|
||||
private static final ArmorType ARMOR_TYPE = ArmorType.LIGHT;
|
||||
private static final int MAX_DEFENSE = 5;
|
||||
private static final int MAX_DURABILITY = 15;
|
||||
|
||||
public GoblinArmor() {
|
||||
super(NAME,
|
||||
ARMOR_TYPE,
|
||||
MAX_DEFENSE,
|
||||
MAX_DURABILITY
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,17 @@
|
||||
package org.project.item.armors;
|
||||
|
||||
// TODO: UPDATE IMPLEMENTATION
|
||||
public class KnightArmor {
|
||||
// TODO: DESIGN ARMOR'S ATTRIBUTES IMPLEMENT THE CONSTRUCTOR
|
||||
public class KnightArmor extends Armor {
|
||||
|
||||
private static final String NAME = "knight armor";
|
||||
private static final ArmorType ARMOR_TYPE = ArmorType.HEAVY;
|
||||
private static final int MAX_DEFENSE = 35;
|
||||
private static final int MAX_DURABILITY = 60;
|
||||
|
||||
public KnightArmor() {
|
||||
super(NAME,
|
||||
ARMOR_TYPE,
|
||||
MAX_DEFENSE,
|
||||
MAX_DURABILITY
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.project.item.armors;
|
||||
|
||||
public class SkeletonArmor extends Armor {
|
||||
|
||||
private static final String NAME = "skeleton armor";
|
||||
private static final ArmorType ARMOR_TYPE = ArmorType.LIGHT;
|
||||
private static final int MAX_DEFENSE = 15;
|
||||
private static final int MAX_DURABILITY = 20;
|
||||
|
||||
public SkeletonArmor() {
|
||||
super(NAME,
|
||||
ARMOR_TYPE,
|
||||
MAX_DEFENSE,
|
||||
MAX_DURABILITY
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.project.item.armors;
|
||||
|
||||
public class VampireArmor extends Armor {
|
||||
|
||||
private static final String NAME = "vampire armor";
|
||||
private static final ArmorType ARMOR_TYPE = ArmorType.MEDIUM;
|
||||
private static final int MAX_DEFENSE = 16;
|
||||
private static final int MAX_DURABILITY = 30;
|
||||
|
||||
public VampireArmor() {
|
||||
super(NAME,
|
||||
ARMOR_TYPE,
|
||||
MAX_DEFENSE,
|
||||
MAX_DURABILITY
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.project.item.armors;
|
||||
|
||||
public class WizardArmor extends Armor {
|
||||
|
||||
private static final String NAME = "wizard Robe";
|
||||
private static final ArmorType ARMOR_TYPE = ArmorType.MEDIUM;
|
||||
private static final int MAX_DEFENSE = 20;
|
||||
private static final int MAX_DURABILITY = 20;
|
||||
|
||||
public WizardArmor() {
|
||||
super(NAME,
|
||||
ARMOR_TYPE,
|
||||
MAX_DEFENSE,
|
||||
MAX_DURABILITY
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,40 @@
|
||||
package org.project.item.consumables;
|
||||
|
||||
import org.project.entity.players.Player;
|
||||
|
||||
// TODO: UPDATE IMPLEMENTATION
|
||||
public abstract class Consumable {
|
||||
/*
|
||||
TODO: ADD OTHER REQUIRED AND BONUS METHODS
|
||||
*/
|
||||
|
||||
private String name;
|
||||
private int healAmount;
|
||||
private int charges;
|
||||
|
||||
public Consumable(String name, int healAmount, int charges) {
|
||||
this.name = name;
|
||||
this.healAmount = healAmount;
|
||||
this.charges = charges;
|
||||
}
|
||||
|
||||
public void use(Player target) {
|
||||
|
||||
if (charges <= 0) {
|
||||
System.out.println("The flask is empty!");
|
||||
return;
|
||||
}
|
||||
|
||||
target.heal(healAmount);
|
||||
charges--;
|
||||
|
||||
}
|
||||
|
||||
public int getCharges() {
|
||||
return charges;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user