make code cleaner and update REDME.md
This commit is contained in:
@@ -264,7 +264,6 @@ public class Main {
|
|||||||
int round = 0;
|
int round = 0;
|
||||||
while (p.isAlive() && e.isAlive())
|
while (p.isAlive() && e.isAlive())
|
||||||
{
|
{
|
||||||
// System.out.println("You choos to fight with " + e.getClass().getSimpleName());
|
|
||||||
System.out.printf(Colors.ORANGE + "[" + Colors.RESET + p.getName() + " - " +"%d/%d HP | %d/%d Mana" + Colors.ORANGE + "]\n" ,
|
System.out.printf(Colors.ORANGE + "[" + Colors.RESET + p.getName() + " - " +"%d/%d HP | %d/%d Mana" + Colors.ORANGE + "]\n" ,
|
||||||
p.getHp(), p.getMaxHP(), p.getMp(), p.getMaxMP());
|
p.getHp(), p.getMaxHP(), p.getMp(), p.getMaxMP());
|
||||||
System.out.printf(Colors.ORANGE + "[" + Colors.RESET + e.getClass().getSimpleName() + " - " +"%d/%d HP" + Colors.ORANGE + "]\n" + Colors.RESET, e.getHp(), e.getMaxHP() );
|
System.out.printf(Colors.ORANGE + "[" + Colors.RESET + e.getClass().getSimpleName() + " - " +"%d/%d HP" + Colors.ORANGE + "]\n" + Colors.RESET, e.getHp(), e.getMaxHP() );
|
||||||
@@ -333,7 +332,6 @@ public class Main {
|
|||||||
p.showItems();
|
p.showItems();
|
||||||
System.out.println("What do you want to use: ");
|
System.out.println("What do you want to use: ");
|
||||||
System.out.println("press 0 to back.");
|
System.out.println("press 0 to back.");
|
||||||
// System.out.println(p);
|
|
||||||
int input5 = input.nextInt();
|
int input5 = input.nextInt();
|
||||||
while (input5 < 0 || input5 > p.getItems().size())
|
while (input5 < 0 || input5 > p.getItems().size())
|
||||||
{
|
{
|
||||||
@@ -384,7 +382,6 @@ public class Main {
|
|||||||
}
|
}
|
||||||
if(e.HaveBleed())
|
if(e.HaveBleed())
|
||||||
{
|
{
|
||||||
// System.out.println(e.getClass().getSimpleName() + " is " + Colors.RED + "Bleeding!\n" + Colors.RESET);
|
|
||||||
e.bleed((AssassineWeapon) p.getWeapon());
|
e.bleed((AssassineWeapon) p.getWeapon());
|
||||||
}
|
}
|
||||||
System.out.printf("%s" + "'s turn:\n", e.getClass().getSimpleName());
|
System.out.printf("%s" + "'s turn:\n", e.getClass().getSimpleName());
|
||||||
@@ -432,7 +429,6 @@ public class Main {
|
|||||||
System.out.println("Good luck!");
|
System.out.println("Good luck!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,23 +24,7 @@ public abstract class Enemy implements Entity {
|
|||||||
this.confuse = false;
|
this.confuse = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setConfuse(boolean confuse) {
|
public abstract void dropKey(Player player);
|
||||||
this.confuse = confuse;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isConfuse()
|
|
||||||
{
|
|
||||||
if(confuse)
|
|
||||||
{
|
|
||||||
confuse = false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getDamage() {
|
|
||||||
return damage;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean heal(int health) {
|
public boolean heal(int health) {
|
||||||
@@ -52,11 +36,6 @@ public abstract class Enemy implements Entity {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMaxHP() {
|
|
||||||
return maxHp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void bleed(AssassineWeapon aw)
|
public void bleed(AssassineWeapon aw)
|
||||||
{
|
{
|
||||||
if(haveBleed)
|
if(haveBleed)
|
||||||
@@ -74,6 +53,46 @@ public abstract class Enemy implements Entity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAlive() {
|
||||||
|
return hp > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int attack()
|
||||||
|
{
|
||||||
|
return damage;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void takeDamage(int damage) {
|
||||||
|
hp -= damage;
|
||||||
|
if(hp < 0)
|
||||||
|
{
|
||||||
|
hp = 0;
|
||||||
|
}
|
||||||
|
System.out.printf("%s took " + Colors.RED + "%d" + Colors.RESET + " damage!\n",this.getClass().getSimpleName(), damage);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDamage() {
|
||||||
|
return damage;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxHP() {
|
||||||
|
return maxHp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHp() {
|
||||||
|
return hp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHp(int hp) {
|
||||||
|
this.hp = hp;
|
||||||
|
if(hp > maxHp)
|
||||||
|
{
|
||||||
|
hp = maxHp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public int getBleedingRound() {
|
public int getBleedingRound() {
|
||||||
return bleedingRound;
|
return bleedingRound;
|
||||||
@@ -91,48 +110,17 @@ public abstract class Enemy implements Entity {
|
|||||||
this.haveBleed = haveBleed;
|
this.haveBleed = haveBleed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void setConfuse(boolean confuse) {
|
||||||
public boolean isAlive() {
|
this.confuse = confuse;
|
||||||
return hp > 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int attack()
|
public boolean isConfuse()
|
||||||
{
|
{
|
||||||
return damage;
|
if(confuse)
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public abstract void dropKey(Player player);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void takeDamage(int damage) {
|
|
||||||
hp -= damage;
|
|
||||||
if(hp < 0)
|
|
||||||
{
|
{
|
||||||
hp = 0;
|
confuse = false;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
System.out.printf("%s took " + Colors.RED + "%d" + Colors.RESET + " damage!\n",this.getClass().getSimpleName(), damage);
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getHp() {
|
|
||||||
return hp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHp(int hp) {
|
|
||||||
this.hp = hp;
|
|
||||||
if(hp > maxHp)
|
|
||||||
{
|
|
||||||
hp = maxHp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// public int getMp() {
|
|
||||||
// return mp;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public Weapon getWeapon() {
|
|
||||||
// return weapon;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,58 @@ public class Assassin extends Player{
|
|||||||
super.setDamage(35);
|
super.setDamage(35);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean heavyAttack(Entity target) {
|
||||||
|
if(super.getMp() >= super.getWeapon().getManaCost()) {
|
||||||
|
super.setMp(super.getMp() - super.getWeapon().getManaCost());
|
||||||
|
System.out.printf("%s (%s) uses heavy attack.\n", name, this.getClass().getSimpleName());
|
||||||
|
target.takeDamage(super.getWeapon().getDamage());
|
||||||
|
AssassineWeapon aw = (AssassineWeapon) super.getWeapon();
|
||||||
|
aw.manaGain(this, aw.getDamage() / 4);
|
||||||
|
if(target instanceof Enemy enemy)
|
||||||
|
{
|
||||||
|
enemy.setHaveBleed(aw.bleed());
|
||||||
|
if(enemy.HaveBleed())
|
||||||
|
{
|
||||||
|
enemy.setBleedingRound(aw.getBleedingRound());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
System.out.println("You don't have enough " + Colors.BLUE + "Mana" + Colors.RESET + " for heavy attack.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean specialAbility(Entity target) {
|
||||||
|
if(super.getMp() >= 80) {
|
||||||
|
super.setMp(super.getMp() - 80);
|
||||||
|
System.out.printf("%s (Assassin) uses special ability.\n", super.name);
|
||||||
|
System.out.println("Assassin dodged the " + Colors.RED + "attack" + Colors.RESET);
|
||||||
|
AssassineWeapon aw = (AssassineWeapon) super.getWeapon();
|
||||||
|
System.out.printf("%s (Assassin) used Critical Strike!\n", super.name);
|
||||||
|
target.takeDamage(aw.criticalHit());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
System.out.println("You don't have enough " + Colors.BLUE + "Mana" + Colors.RESET + " for your special ability.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void takeDamage(int damage) {
|
||||||
|
AssassineArmor asA = (AssassineArmor) super.getArmor();
|
||||||
|
int defence = asA.getDefense(damage);
|
||||||
|
if(defence == damage)
|
||||||
|
{
|
||||||
|
System.out.printf("%s (Assassin) dodged the attack.\n", super.name);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
super.takeDamage(damage - defence);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void levelUp() {
|
public void levelUp() {
|
||||||
if(super.getLevel() < 5) {
|
if(super.getLevel() < 5) {
|
||||||
@@ -77,61 +129,6 @@ public class Assassin extends Player{
|
|||||||
System.out.println();
|
System.out.println();
|
||||||
showInf();
|
showInf();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean heavyAttack(Entity target) {
|
|
||||||
if(super.getMp() >= super.getWeapon().getManaCost()) {
|
|
||||||
super.setMp(super.getMp() - super.getWeapon().getManaCost());
|
|
||||||
System.out.printf("%s (%s) uses heavy attack.\n", name, this.getClass().getSimpleName());
|
|
||||||
target.takeDamage(super.getWeapon().getDamage());
|
|
||||||
AssassineWeapon aw = (AssassineWeapon) super.getWeapon();
|
|
||||||
aw.manaGain(this, aw.getDamage() / 4);
|
|
||||||
if(target instanceof Enemy enemy)
|
|
||||||
{
|
|
||||||
enemy.setHaveBleed(aw.bleed());
|
|
||||||
if(enemy.HaveBleed())
|
|
||||||
{
|
|
||||||
enemy.setBleedingRound(aw.getBleedingRound());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
System.out.println("You don't have enough " + Colors.BLUE + "Mana" + Colors.RESET + " for heavy attack.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void takeDamage(int damage) {
|
|
||||||
AssassineArmor asA = (AssassineArmor) super.getArmor();
|
|
||||||
int defence = asA.getDefense(damage);
|
|
||||||
if(defence == damage)
|
|
||||||
{
|
|
||||||
System.out.printf("%s (Assassin) dodged the attack.\n", super.name);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
super.takeDamage(damage - defence);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean specialAbility(Entity target) {
|
|
||||||
if(super.getMp() >= 80) {
|
|
||||||
super.setMp(super.getMp() - 80);
|
|
||||||
System.out.printf("%s (Assassin) uses special ability.\n", super.name);
|
|
||||||
System.out.println("Assassin dodged the " + Colors.RED + "attack" + Colors.RESET);
|
|
||||||
AssassineWeapon aw = (AssassineWeapon) super.getWeapon();
|
|
||||||
System.out.printf("%s (Assassin) used Critical Strike!\n", super.name);
|
|
||||||
target.takeDamage(aw.criticalHit());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
System.out.println("You don't have enough " + Colors.BLUE + "Mana" + Colors.RESET + " for your special ability.");
|
|
||||||
return false;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -17,6 +17,20 @@ public class Knight extends Player {
|
|||||||
super.setDamage(40);
|
super.setDamage(40);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean specialAbility(Entity target) {
|
||||||
|
if(super.getMp() > 65) {
|
||||||
|
super.setMp(super.getMp() - 65);
|
||||||
|
System.out.printf("%s (Knight) uses special ability.\n", super.name);
|
||||||
|
Sword sword = (Sword) super.getWeapon();
|
||||||
|
target.takeDamage(sword.getSpecialDamage());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
System.out.println("You don't have enough " + Colors.BLUE + "Mana" + Colors.RESET + " for your special ability.");
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void levelUp() {
|
public void levelUp() {
|
||||||
if(super.getLevel() < 5) {
|
if(super.getLevel() < 5) {
|
||||||
@@ -72,20 +86,6 @@ public class Knight extends Player {
|
|||||||
showInf();
|
showInf();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean specialAbility(Entity target) {
|
|
||||||
if(super.getMp() > 65) {
|
|
||||||
super.setMp(super.getMp() - 65);
|
|
||||||
System.out.printf("%s (Knight) uses special ability.\n", super.name);
|
|
||||||
Sword sword = (Sword) super.getWeapon();
|
|
||||||
target.takeDamage(sword.getSpecialDamage());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
System.out.println("You don't have enough " + Colors.BLUE + "Mana" + Colors.RESET + " for your special ability.");
|
|
||||||
return false;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showInf() {
|
public void showInf() {
|
||||||
Sword sword = (Sword) super.getWeapon();
|
Sword sword = (Sword) super.getWeapon();
|
||||||
@@ -112,33 +112,6 @@ public class Knight extends Player {
|
|||||||
super.getArmor().getDurability(), super.getArmor().getDefensePercentage(),
|
super.getArmor().getDurability(), super.getArmor().getDefensePercentage(),
|
||||||
sword.getDamage(),sword.getManaCost() ,sword.getSpecialDamage());
|
sword.getDamage(),sword.getManaCost() ,sword.getSpecialDamage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// @Override
|
|
||||||
// public void defend(int damage) {
|
|
||||||
//
|
|
||||||
// if(damage > 60)
|
|
||||||
// {
|
|
||||||
// int defense = (80 * damage) / 100;
|
|
||||||
// this.takeDamage(damage - defense);
|
|
||||||
// System.out.printf("You took " + Colors.BLUE + "%d" + Colors.RESET + "damage!" + Colors.YELLO + "(%d damage was defended)\n" + Colors.RESET, damage, damage - defense);
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// System.out.println("The enemy hit defended!");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// @Override
|
|
||||||
// public void takeDamage(int damage) {
|
|
||||||
// super.takeDamage(damage);
|
|
||||||
// System.out.printf("%s (Knight) took" + Colors.RED + "%d" + Colors.RESET + "damage!\n",super.name, damage - armor.getDefense(damage) );
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// TODO: DESIGN KNIGHT'S WEAPON AND ARMOR AND IMPLEMENT THE CONSTRUCTOR
|
// TODO: DESIGN KNIGHT'S WEAPON AND ARMOR AND IMPLEMENT THE CONSTRUCTOR
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,22 +28,9 @@ public abstract class Player implements Entity, ICombatActions {
|
|||||||
private Boolean goblinKey;
|
private Boolean goblinKey;
|
||||||
private Boolean skeletonKey;
|
private Boolean skeletonKey;
|
||||||
private Boolean vampireKey;
|
private Boolean vampireKey;
|
||||||
private int coin;// write it in constructor with right amount
|
private int coin;
|
||||||
|
|
||||||
private int maxDefense;
|
private int maxDefense;
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public int getMaxDefense() {
|
|
||||||
return maxDefense;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMaxDefense(int maxDefense) {
|
|
||||||
this.maxDefense = maxDefense;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Player(String name, int hp, int mp, Weapon weapon, Armor armor, int maxDefense) {
|
public Player(String name, int hp, int mp, Weapon weapon, Armor armor, int maxDefense) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.hp = hp;
|
this.hp = hp;
|
||||||
@@ -68,6 +55,64 @@ public abstract class Player implements Entity, ICombatActions {
|
|||||||
target.takeDamage(damage);
|
target.takeDamage(damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean heavyAttack(Entity target) {
|
||||||
|
if(mp >= weapon.getManaCost()) {
|
||||||
|
System.out.printf("%s (%s) uses heavy attack\n", name, this.getClass().getSimpleName());
|
||||||
|
target.takeDamage(weapon.getDamage());
|
||||||
|
mp -= weapon.getManaCost();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
System.out.println("You don't have enough " + Colors.BLUE + "Mana" + Colors.RESET + " for heavy attack.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean defend(int damage) {
|
||||||
|
if(mp > 40)
|
||||||
|
{
|
||||||
|
mp -= 40;
|
||||||
|
if (damage > maxDefense) {
|
||||||
|
int defense = (80 * damage) / 100;
|
||||||
|
this.takeDamage(damage - defense);
|
||||||
|
System.out.printf("You took " + Colors.BLUE + "%d" + Colors.RESET + "damage!" + Colors.YELLO + "(%d damage was defended)\n" + Colors.RESET, damage, damage - defense);
|
||||||
|
} else {
|
||||||
|
System.out.println("The enemy hit defended!");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
System.out.println("You don't have enough " + Colors.BLUE + "Mana" + Colors.RESET + " to defend.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void takeDamage(int damage) {
|
||||||
|
hp -= (damage - armor.getDefense(damage));
|
||||||
|
System.out.printf("%s (%s) took " + Colors.RED + "%d" + Colors.RESET + " damage!\n",name, this.getClass().getSimpleName(), damage - armor.getDefense(damage) );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void takeDamage(Dragon dragon)
|
||||||
|
{
|
||||||
|
hp -= dragon.getDamage();
|
||||||
|
System.out.println("you can't defeat dragon " + Colors.FIRE + "Fire" + Colors.RESET + "!");
|
||||||
|
System.out.printf("%s (%s) took " + Colors.RED + "%d" + Colors.RESET + " damage!\n",name, this.getClass().getSimpleName(), dragon.getDamage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean heal(int health) {
|
||||||
|
if(mp > 45)
|
||||||
|
{
|
||||||
|
mp -= 45;
|
||||||
|
System.out.printf("%s (%s) healed for " +Colors.HEAL +"%d" +Colors.RESET+ " HP.\n", name, this.getClass().getSimpleName(), health);
|
||||||
|
hp += health;
|
||||||
|
if (hp > maxHP) {
|
||||||
|
hp = maxHP;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
System.out.println("You don't have enough " + Colors.BLUE + "Mana" + Colors.RESET + " to heal.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public void addItem(Consumable c)
|
public void addItem(Consumable c)
|
||||||
{
|
{
|
||||||
@@ -113,161 +158,10 @@ public abstract class Player implements Entity, ICombatActions {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setCoin(int coin) {
|
|
||||||
this.coin = coin;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public boolean heavyAttack(Entity target) {
|
|
||||||
if(mp >= weapon.getManaCost()) {
|
|
||||||
System.out.printf("%s (%s) uses heavy attack\n", name, this.getClass().getSimpleName());
|
|
||||||
target.takeDamage(weapon.getDamage());
|
|
||||||
mp -= weapon.getManaCost();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
System.out.println("You don't have enough " + Colors.BLUE + "Mana" + Colors.RESET + " for heavy attack.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void setMp(int mp) {
|
|
||||||
this.mp = mp;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean defend(int damage) {
|
|
||||||
if(mp > 40)
|
|
||||||
{
|
|
||||||
mp -= 40;
|
|
||||||
if (damage > maxDefense) {
|
|
||||||
int defense = (80 * damage) / 100;
|
|
||||||
this.takeDamage(damage - defense);
|
|
||||||
System.out.printf("You took " + Colors.BLUE + "%d" + Colors.RESET + "damage!" + Colors.YELLO + "(%d damage was defended)\n" + Colors.RESET, damage, damage - defense);
|
|
||||||
} else {
|
|
||||||
System.out.println("The enemy hit defended!");
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
System.out.println("You don't have enough " + Colors.BLUE + "Mana" + Colors.RESET + " to defend.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void takeDamage(int damage) {
|
|
||||||
|
|
||||||
//
|
|
||||||
//max(0 ,damage - armor.getDefense(damage))
|
|
||||||
hp -= (damage - armor.getDefense(damage));
|
|
||||||
System.out.printf("%s (%s) took " + Colors.RED + "%d" + Colors.RESET + " damage!\n",name, this.getClass().getSimpleName(), damage - armor.getDefense(damage) );
|
|
||||||
}
|
|
||||||
public void takeDamage(Dragon dragon)
|
|
||||||
{
|
|
||||||
hp -= dragon.getDamage();
|
|
||||||
System.out.println("you can't defeat dragon " + Colors.FIRE + "Fire" + Colors.RESET + "!");
|
|
||||||
System.out.printf("%s (%s) took " + Colors.RED + "%d" + Colors.RESET + " damage!\n",name, this.getClass().getSimpleName(), dragon.getDamage());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean heal(int health) {
|
|
||||||
if(mp > 45)
|
|
||||||
{
|
|
||||||
mp -= 45;
|
|
||||||
System.out.printf("%s (%s) healed for " +Colors.HEAL +"%d" +Colors.RESET+ " HP.\n", name, this.getClass().getSimpleName(), health);
|
|
||||||
hp += health;
|
|
||||||
if (hp > maxHP) {
|
|
||||||
hp = maxHP;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
System.out.println("You don't have enough " + Colors.BLUE + "Mana" + Colors.RESET + " to heal.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAlive() {
|
|
||||||
return hp > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void fillMana(int mana) {
|
|
||||||
mp += mana;
|
|
||||||
if (mp > maxMP) {
|
|
||||||
mp = maxMP;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract void levelUp();
|
public abstract void levelUp();
|
||||||
/*
|
|
||||||
(maximum level of every character must be 5)
|
|
||||||
maxDefense++
|
|
||||||
damage++
|
|
||||||
hp++
|
|
||||||
mp++
|
|
||||||
level++
|
|
||||||
(mabe open new items in shop)
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
public void showInf()
|
|
||||||
{
|
|
||||||
System.out.printf("""
|
|
||||||
level: %d
|
|
||||||
HP: %d
|
|
||||||
MP: %d
|
|
||||||
Maximum defence: %d
|
|
||||||
|
|
||||||
armor:
|
|
||||||
durability: %d
|
|
||||||
defensePercentage: %d
|
|
||||||
|
|
||||||
weapon:
|
|
||||||
damage: %d
|
|
||||||
mana cost: %d
|
|
||||||
|
|
||||||
""", getLevel(), getHp(), getMp(), getMaxDefense(), armor.getDurability(), armor.getDefensePercentage(), weapon.getDamage(), weapon.getManaCost());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMaxMP(int maxMP) {
|
|
||||||
this.maxMP = maxMP;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMaxHP(int maxHP) {
|
|
||||||
this.maxHP = maxHP;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addLevel(){level++;}
|
public void addLevel(){level++;}
|
||||||
|
|
||||||
public void addXp(int XP)
|
|
||||||
{
|
|
||||||
if(xp < 600)
|
|
||||||
{
|
|
||||||
this.xp += XP;
|
|
||||||
System.out.printf("You received %d Xp " + Colors.ORANGE +
|
|
||||||
"[" + Colors.RESET + "Your Xp: %d" + Colors.ORANGE + "]\n", XP, this.xp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void addXp(Enemy e)
|
|
||||||
{
|
|
||||||
if(xp < 600)
|
|
||||||
{
|
|
||||||
int amount = 0;
|
|
||||||
if (e instanceof Goblin) {
|
|
||||||
amount = 50;
|
|
||||||
} else if (e instanceof Skeleton) {
|
|
||||||
amount = 70;
|
|
||||||
} else if (e instanceof Vampire) {
|
|
||||||
amount = 90;
|
|
||||||
|
|
||||||
}
|
|
||||||
this.xp += amount;
|
|
||||||
System.out.printf("You received %d Xp " + Colors.ORANGE +
|
|
||||||
"[" + Colors.RESET + "Your Xp: %d" + Colors.ORANGE + "]\n" + Colors.RESET, amount, this.xp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Boolean needLevelUp()
|
public Boolean needLevelUp()
|
||||||
{
|
{
|
||||||
switch (this.level)
|
switch (this.level)
|
||||||
@@ -306,6 +200,66 @@ public abstract class Player implements Entity, ICombatActions {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void showInf()
|
||||||
|
{
|
||||||
|
System.out.printf("""
|
||||||
|
level: %d
|
||||||
|
HP: %d
|
||||||
|
MP: %d
|
||||||
|
Maximum defence: %d
|
||||||
|
|
||||||
|
armor:
|
||||||
|
durability: %d
|
||||||
|
defensePercentage: %d
|
||||||
|
|
||||||
|
weapon:
|
||||||
|
damage: %d
|
||||||
|
mana cost: %d
|
||||||
|
|
||||||
|
""", getLevel(), getHp(), getMp(), getMaxDefense(), armor.getDurability(), armor.getDefensePercentage(), weapon.getDamage(), weapon.getManaCost());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAlive() {
|
||||||
|
return hp > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void fillMana(int mana) {
|
||||||
|
mp += mana;
|
||||||
|
if (mp > maxMP) {
|
||||||
|
mp = maxMP;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addXp(int XP)
|
||||||
|
{
|
||||||
|
if(xp < 600)
|
||||||
|
{
|
||||||
|
this.xp += XP;
|
||||||
|
System.out.printf("You received %d Xp " + Colors.ORANGE +
|
||||||
|
"[" + Colors.RESET + "Your Xp: %d" + Colors.ORANGE + "]\n", XP, this.xp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addXp(Enemy e)
|
||||||
|
{
|
||||||
|
if(xp < 600)
|
||||||
|
{
|
||||||
|
int amount = 0;
|
||||||
|
if (e instanceof Goblin) {
|
||||||
|
amount = 50;
|
||||||
|
} else if (e instanceof Skeleton) {
|
||||||
|
amount = 70;
|
||||||
|
} else if (e instanceof Vampire) {
|
||||||
|
amount = 90;
|
||||||
|
|
||||||
|
}
|
||||||
|
this.xp += amount;
|
||||||
|
System.out.printf("You received %d Xp " + Colors.ORANGE +
|
||||||
|
"[" + Colors.RESET + "Your Xp: %d" + Colors.ORANGE + "]\n" + Colors.RESET, amount, this.xp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void addCoin(int amount)
|
public void addCoin(int amount)
|
||||||
{
|
{
|
||||||
@@ -331,6 +285,10 @@ public abstract class Player implements Entity, ICombatActions {
|
|||||||
return coin;
|
return coin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setCoin(int coin) {
|
||||||
|
this.coin = coin;
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
@@ -339,18 +297,34 @@ public abstract class Player implements Entity, ICombatActions {
|
|||||||
return hp;
|
return hp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setHp(int hp) {
|
||||||
|
this.hp = hp;
|
||||||
|
}
|
||||||
|
|
||||||
public int getMaxHP() {
|
public int getMaxHP() {
|
||||||
return maxHP;
|
return maxHP;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMp() {
|
public void setMaxHP(int maxHP) {
|
||||||
return mp;
|
this.maxHP = maxHP;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxMP() {
|
public int getMaxMP() {
|
||||||
return maxMP;
|
return maxMP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setMp(int mp) {
|
||||||
|
this.mp = mp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxMP(int maxMP) {
|
||||||
|
this.maxMP = maxMP;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMp() {
|
||||||
|
return mp;
|
||||||
|
}
|
||||||
|
|
||||||
public Weapon getWeapon() {
|
public Weapon getWeapon() {
|
||||||
return weapon;
|
return weapon;
|
||||||
}
|
}
|
||||||
@@ -363,16 +337,20 @@ public abstract class Player implements Entity, ICombatActions {
|
|||||||
return damage;
|
return damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setDamage(int baseDamage){this.damage = baseDamage;}
|
||||||
|
|
||||||
public int getXp(){return xp;}
|
public int getXp(){return xp;}
|
||||||
|
|
||||||
public int getLevel(){return level;}
|
public int getLevel(){return level;}
|
||||||
|
|
||||||
public void setDamage(int baseDamage){this.damage = baseDamage;}
|
|
||||||
|
|
||||||
public void setHp(int hp) {
|
public int getMaxDefense() {
|
||||||
this.hp = hp;
|
return maxDefense;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setMaxDefense(int maxDefense) {
|
||||||
|
this.maxDefense = maxDefense;
|
||||||
|
}
|
||||||
|
|
||||||
public Boolean getSkeletonKey() {
|
public Boolean getSkeletonKey() {
|
||||||
return skeletonKey;
|
return skeletonKey;
|
||||||
|
|||||||
@@ -15,6 +15,40 @@ public class Wizard extends Player{
|
|||||||
super.setMaxMP(super.getMp() + armor.getBonus(this));
|
super.setMaxMP(super.getMp() + armor.getBonus(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean heavyAttack(Entity target) {
|
||||||
|
if(super.getMp() > super.getWeapon().getManaCost()) {
|
||||||
|
super.setMp(super.getMp() - super.getWeapon().getManaCost());
|
||||||
|
System.out.printf("%s (Wizard) performed a triple attack!\n", super.name);
|
||||||
|
WizardWeapon wp = (WizardWeapon) super.getWeapon();
|
||||||
|
target.takeDamage(wp.tripleAttack());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
System.out.println("You don't have enough " + Colors.BLUE + "Mana" + Colors.RESET + " for heavy attack.");
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean specialAbility(Entity target) {
|
||||||
|
if(super.getMp() > 75) {
|
||||||
|
super.setMp(super.getMp() - 75);
|
||||||
|
System.out.printf("%s (Wizard) uses special ability.\n", super.name);
|
||||||
|
WizardWeapon w = (WizardWeapon) super.getWeapon();
|
||||||
|
target.takeDamage(4*w.getDamage());
|
||||||
|
super.setHp(super.getHp() + ((6 * super.getMaxHP()) / 10));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
System.out.println("You don't have enough " + Colors.BLUE + "Mana" + Colors.RESET + " for your special ability.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void takeDamage(Entity attacker ,int damage) {
|
||||||
|
super.takeDamage(damage);
|
||||||
|
WizardArmor w = (WizardArmor) super.getArmor();
|
||||||
|
w.reflect(attacker, damage);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void levelUp() {
|
public void levelUp() {
|
||||||
if(super.getLevel() < 5) {
|
if(super.getLevel() < 5) {
|
||||||
@@ -62,47 +96,11 @@ public class Wizard extends Player{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super.setHp(super.getMaxHP());
|
super.setHp(super.getMaxHP());
|
||||||
super.fillMana(super.getMaxMP());
|
super.fillMana(super.getMaxMP());
|
||||||
super.getArmor().repair();
|
super.getArmor().repair();
|
||||||
System.out.println();
|
System.out.println();
|
||||||
showInf();
|
showInf();
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void takeDamage(Entity attacker ,int damage) {
|
|
||||||
super.takeDamage(damage);
|
|
||||||
WizardArmor w = (WizardArmor) super.getArmor();
|
|
||||||
w.reflect(attacker, damage);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean heavyAttack(Entity target) {
|
|
||||||
if(super.getMp() > super.getWeapon().getManaCost()) {
|
|
||||||
super.setMp(super.getMp() - super.getWeapon().getManaCost());
|
|
||||||
System.out.printf("%s (Wizard) performed a triple attack!\n", super.name);
|
|
||||||
WizardWeapon wp = (WizardWeapon) super.getWeapon();
|
|
||||||
target.takeDamage(wp.tripleAttack());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
System.out.println("You don't have enough " + Colors.BLUE + "Mana" + Colors.RESET + " for heavy attack.");
|
|
||||||
return false;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean specialAbility(Entity target) {
|
|
||||||
if(super.getMp() > 75) {
|
|
||||||
super.setMp(super.getMp() - 75);
|
|
||||||
System.out.printf("%s (Wizard) uses special ability.\n", super.name);
|
|
||||||
WizardWeapon w = (WizardWeapon) super.getWeapon();
|
|
||||||
target.takeDamage(4*w.getDamage());
|
|
||||||
super.setHp(super.getHp() + ((6 * super.getMaxHP()) / 10));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
System.out.println("You don't have enough " + Colors.BLUE + "Mana" + Colors.RESET + " for your special ability.");
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -2,37 +2,19 @@ package org.project.item.armors;
|
|||||||
|
|
||||||
// TODO: UPDATE IMPLEMENTATION
|
// TODO: UPDATE IMPLEMENTATION
|
||||||
public abstract class Armor{
|
public abstract class Armor{
|
||||||
// private int defense;
|
|
||||||
// private final int maxDefense;
|
|
||||||
private int defensePercentage;
|
private int defensePercentage;
|
||||||
private int maxPercentage;
|
private int maxPercentage;
|
||||||
private int durability;
|
private int durability;
|
||||||
private int maxDurability;
|
private int maxDurability;
|
||||||
|
|
||||||
|
|
||||||
private boolean isBroke;
|
private boolean isBroke;
|
||||||
|
|
||||||
public Armor(int maxPercentage, int maxDurability) {
|
public Armor(int maxPercentage, int maxDurability) {
|
||||||
// this.maxDefense = maxDefense;
|
|
||||||
// this.defense = maxDefense;
|
|
||||||
this.maxPercentage = maxPercentage;
|
this.maxPercentage = maxPercentage;
|
||||||
this.defensePercentage = maxPercentage;
|
this.defensePercentage = maxPercentage;
|
||||||
this.maxDurability = maxDurability;
|
this.maxDurability = maxDurability;
|
||||||
this.durability = maxDurability;
|
this.durability = maxDurability;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setMaxDurability(int maxDurability)
|
|
||||||
{
|
|
||||||
this.maxDurability = maxDurability;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMaxDurability() {
|
|
||||||
return maxDurability;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void checkBreak() {
|
public void checkBreak() {
|
||||||
if (durability <= 0) {
|
if (durability <= 0) {
|
||||||
isBroke = true;
|
isBroke = true;
|
||||||
@@ -60,14 +42,6 @@ public abstract class Armor{
|
|||||||
return durability;
|
return durability;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBroke() {
|
|
||||||
return isBroke;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBroke(boolean broke) {
|
|
||||||
isBroke = broke;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDurability(int durability) {
|
public void setDurability(int durability) {
|
||||||
this.durability = durability;
|
this.durability = durability;
|
||||||
}
|
}
|
||||||
@@ -83,6 +57,15 @@ public abstract class Armor{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setMaxDurability(int maxDurability)
|
||||||
|
{
|
||||||
|
this.maxDurability = maxDurability;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaxDurability() {
|
||||||
|
return maxDurability;
|
||||||
|
}
|
||||||
|
|
||||||
public void setMaxPercentage(int maxPercentage) {
|
public void setMaxPercentage(int maxPercentage) {
|
||||||
this.maxPercentage = maxPercentage;
|
this.maxPercentage = maxPercentage;
|
||||||
}
|
}
|
||||||
@@ -94,4 +77,12 @@ public abstract class Armor{
|
|||||||
public int getDefensePercentage() {
|
public int getDefensePercentage() {
|
||||||
return defensePercentage;
|
return defensePercentage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isBroke() {
|
||||||
|
return isBroke;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBroke(boolean broke) {
|
||||||
|
isBroke = broke;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,12 +3,8 @@ package org.project.item.armors;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class AssassineArmor extends Armor{
|
public class AssassineArmor extends Armor{
|
||||||
|
|
||||||
private int dodgeChance;
|
private int dodgeChance;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public AssassineArmor() {
|
public AssassineArmor() {
|
||||||
super(12, 100);
|
super(12, 100);
|
||||||
this.dodgeChance = 10;
|
this.dodgeChance = 10;
|
||||||
|
|||||||
@@ -8,12 +8,5 @@ public class KnightArmor extends Armor {
|
|||||||
public KnightArmor() {
|
public KnightArmor() {
|
||||||
super(80, 100);
|
super(80, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
// public void useAsWeapon(Entity target) {
|
|
||||||
// //it will useAsWeapon the Knight armor as weapon
|
|
||||||
// target.takeDamage(super.getDurability());
|
|
||||||
// super.setBroke(true);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// TODO: DESIGN ARMOR'S ATTRIBUTES IMPLEMENT THE CONSTRUCTOR
|
// TODO: DESIGN ARMOR'S ATTRIBUTES IMPLEMENT THE CONSTRUCTOR
|
||||||
}
|
}
|
||||||
@@ -7,7 +7,6 @@ import org.project.entity.players.Wizard;
|
|||||||
public class WizardArmor extends Armor{
|
public class WizardArmor extends Armor{
|
||||||
//Reflects enemy attacks back to itself.
|
//Reflects enemy attacks back to itself.
|
||||||
//you get mana bonus
|
//you get mana bonus
|
||||||
|
|
||||||
private int bonusPercent;
|
private int bonusPercent;
|
||||||
private int reflectPercent;
|
private int reflectPercent;
|
||||||
|
|
||||||
@@ -17,6 +16,19 @@ public class WizardArmor extends Armor{
|
|||||||
this.reflectPercent = 20;
|
this.reflectPercent = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void reflect(Entity attacker, int damage)
|
||||||
|
{
|
||||||
|
|
||||||
|
System.out.printf( Colors.ORANGE + "%d" + Colors.RESET + " of damage reflected.\n", (reflectPercent*damage) / 100);
|
||||||
|
attacker.takeDamage((reflectPercent*damage) / 100);
|
||||||
|
super.reduceDurability(12);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getBonus(Wizard w)
|
||||||
|
{
|
||||||
|
return (bonusPercent*w.getMaxMP()) / 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public int getBonusPercent() {
|
public int getBonusPercent() {
|
||||||
return bonusPercent;
|
return bonusPercent;
|
||||||
@@ -33,17 +45,4 @@ public class WizardArmor extends Armor{
|
|||||||
public void setReflectPercent(int reflectPercent) {
|
public void setReflectPercent(int reflectPercent) {
|
||||||
this.reflectPercent = reflectPercent;
|
this.reflectPercent = reflectPercent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getBonus(Wizard w)
|
|
||||||
{
|
|
||||||
return (bonusPercent*w.getMaxMP()) / 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void reflect(Entity attacker, int damage)
|
|
||||||
{
|
|
||||||
|
|
||||||
System.out.printf( Colors.ORANGE + "%d" + Colors.RESET + " of damage reflected.\n", (reflectPercent*damage) / 100);
|
|
||||||
attacker.takeDamage((reflectPercent*damage) / 100);
|
|
||||||
super.reduceDurability(12);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ public abstract class Consumable {
|
|||||||
private int value;
|
private int value;
|
||||||
int numberOf;
|
int numberOf;
|
||||||
private final String targetType;
|
private final String targetType;
|
||||||
|
|
||||||
public Consumable(String name, int value, String targetType) {
|
public Consumable(String name, int value, String targetType) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
@@ -25,7 +26,6 @@ public abstract class Consumable {
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getTargetType() {
|
public String getTargetType() {
|
||||||
return targetType;
|
return targetType;
|
||||||
}
|
}
|
||||||
@@ -34,6 +34,7 @@ public abstract class Consumable {
|
|||||||
{
|
{
|
||||||
numberOf++;
|
numberOf++;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reduceOne(){numberOf--;}
|
public void reduceOne(){numberOf--;}
|
||||||
|
|
||||||
public int getNumberOf() {
|
public int getNumberOf() {
|
||||||
|
|||||||
@@ -7,9 +7,6 @@ import org.project.entity.enemies.Enemy;
|
|||||||
public class GoblinGland extends Consumable{
|
public class GoblinGland extends Consumable{
|
||||||
public GoblinGland() {
|
public GoblinGland() {
|
||||||
super("Goblin Gland", 15, "Enemy");
|
super("Goblin Gland", 15, "Enemy");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ public class HolyWater extends Consumable{
|
|||||||
|
|
||||||
public HolyWater() {
|
public HolyWater() {
|
||||||
super("Holy Water", 40, "Enemy");
|
super("Holy Water", 40, "Enemy");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -12,10 +12,8 @@ public class AssassineWeapon extends Weapon{
|
|||||||
private int bleedDamage;
|
private int bleedDamage;
|
||||||
private int bleedingRound;
|
private int bleedingRound;
|
||||||
|
|
||||||
|
|
||||||
public AssassineWeapon() {
|
public AssassineWeapon() {
|
||||||
super(45, 55);
|
super(45, 55);
|
||||||
// this.silenceChance = 14;
|
|
||||||
this.bleedChance = 30;
|
this.bleedChance = 30;
|
||||||
this.bleedDamage = 10;
|
this.bleedDamage = 10;
|
||||||
this.bleedingRound = 1;
|
this.bleedingRound = 1;
|
||||||
@@ -28,14 +26,14 @@ public class AssassineWeapon extends Weapon{
|
|||||||
|
|
||||||
public int criticalHit()
|
public int criticalHit()
|
||||||
{
|
{
|
||||||
|
|
||||||
return 3*super.getDamage();
|
return 3*super.getDamage();
|
||||||
}
|
}
|
||||||
|
|
||||||
// public Boolean silence()
|
public void manaGain(Assassin assassin, int amount)
|
||||||
// {
|
{
|
||||||
// return new Random().nextInt(100) < silenceChance;
|
System.out.printf("%d of damage gained as " + Colors.BLUE + "Mana.\n" + Colors.RESET, amount);
|
||||||
// }
|
assassin.fillMana(amount);
|
||||||
|
}
|
||||||
|
|
||||||
public int getBleedingRound() {
|
public int getBleedingRound() {
|
||||||
return bleedingRound;
|
return bleedingRound;
|
||||||
@@ -60,20 +58,4 @@ public class AssassineWeapon extends Weapon{
|
|||||||
public void setBleedDamage(int bleedDamage) {
|
public void setBleedDamage(int bleedDamage) {
|
||||||
this.bleedDamage = bleedDamage;
|
this.bleedDamage = bleedDamage;
|
||||||
}
|
}
|
||||||
//
|
|
||||||
// public int getSilenceChance() {
|
|
||||||
// return silenceChance;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public void setSilenceChance(int silenceChance) {
|
|
||||||
// this.silenceChance = silenceChance;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void manaGain(Assassin assassin, int amount)
|
|
||||||
{
|
|
||||||
System.out.printf("%d of damage gained as " + Colors.BLUE + "Mana.\n" + Colors.RESET, amount);
|
|
||||||
assassin.fillMana(amount);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ public class Sword extends Weapon {
|
|||||||
/*
|
/*
|
||||||
THIS IS AN EXAMPLE OF A WEAPON DESIGN.
|
THIS IS AN EXAMPLE OF A WEAPON DESIGN.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int abilityCharge;
|
int abilityCharge;
|
||||||
private int specialDamage;
|
private int specialDamage;
|
||||||
|
|
||||||
public Sword() {
|
public Sword() {
|
||||||
|
|
||||||
super(65, 50);
|
super(65, 50);
|
||||||
@@ -19,6 +19,14 @@ public class Sword extends Weapon {
|
|||||||
// TODO: DESIGN SWORD'S ATTRIBUTES IMPLEMENT THE CONSTRUCTOR
|
// TODO: DESIGN SWORD'S ATTRIBUTES IMPLEMENT THE CONSTRUCTOR
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: (BONUS) UPDATE THE UNIQUE ABILITY
|
||||||
|
|
||||||
|
public void uniqueAbility(ArrayList<Entity> targets) {
|
||||||
|
abilityCharge += 2;
|
||||||
|
for (Entity target : targets) {
|
||||||
|
target.takeDamage(getDamage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public int getSpecialDamage() {
|
public int getSpecialDamage() {
|
||||||
return specialDamage;
|
return specialDamage;
|
||||||
@@ -27,12 +35,4 @@ public class Sword extends Weapon {
|
|||||||
public void setSpecialDamage(int specialDamage) {
|
public void setSpecialDamage(int specialDamage) {
|
||||||
this.specialDamage = specialDamage;
|
this.specialDamage = specialDamage;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: (BONUS) UPDATE THE UNIQUE ABILITY
|
|
||||||
public void uniqueAbility(ArrayList<Entity> targets) {
|
|
||||||
abilityCharge += 2;
|
|
||||||
for (Entity target : targets) {
|
|
||||||
target.takeDamage(getDamage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,9 +14,6 @@ public abstract class Weapon{
|
|||||||
this.manaCost = manaCost;
|
this.manaCost = manaCost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public int getDamage() {
|
public int getDamage() {
|
||||||
return damage;
|
return damage;
|
||||||
}
|
}
|
||||||
@@ -25,7 +22,6 @@ public abstract class Weapon{
|
|||||||
this.damage = damage;
|
this.damage = damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setManaCost(int manaCost) {
|
public void setManaCost(int manaCost) {
|
||||||
this.manaCost = manaCost;
|
this.manaCost = manaCost;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,53 +13,14 @@ public class Location {
|
|||||||
private int skeleton = 0;
|
private int skeleton = 0;
|
||||||
private int vampire = 0;
|
private int vampire = 0;
|
||||||
private int goblin = 0;
|
private int goblin = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private ArrayList<Enemy> enemies;
|
private ArrayList<Enemy> enemies;
|
||||||
// private ArrayList<Location> locations;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ArrayList<Location> locations
|
|
||||||
public Location(String name) {
|
public Location(String name) {
|
||||||
// this.locations = locations;
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.enemies = new ArrayList<>();
|
this.enemies = new ArrayList<>();
|
||||||
// this.isDiscovered = false;
|
// this.isDiscovered = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public int getGoblin() {
|
|
||||||
return goblin;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getVampire() {
|
|
||||||
return vampire;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSkeleton() {
|
|
||||||
return skeleton;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addEnemy(Enemy enemy)
|
|
||||||
{
|
|
||||||
enemies.add(enemy);
|
|
||||||
if(enemy instanceof Skeleton)
|
|
||||||
{
|
|
||||||
skeleton++;
|
|
||||||
} else if (enemy instanceof Vampire)
|
|
||||||
{
|
|
||||||
vampire++;
|
|
||||||
}
|
|
||||||
else if(enemy instanceof Goblin)
|
|
||||||
{
|
|
||||||
goblin++;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void defeatEnemy(Enemy enemy)
|
public void defeatEnemy(Enemy enemy)
|
||||||
{
|
{
|
||||||
enemies.remove(enemy);
|
enemies.remove(enemy);
|
||||||
@@ -103,14 +64,38 @@ public class Location {
|
|||||||
enemy.setBleedingRound(0);
|
enemy.setBleedingRound(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public ArrayList<Location> getLocations() {
|
public int getGoblin() {
|
||||||
// return locations;
|
return goblin;
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
public int getVampire() {
|
||||||
|
return vampire;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSkeleton() {
|
||||||
|
return skeleton;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addEnemy(Enemy enemy)
|
||||||
|
{
|
||||||
|
enemies.add(enemy);
|
||||||
|
if(enemy instanceof Skeleton)
|
||||||
|
{
|
||||||
|
skeleton++;
|
||||||
|
} else if (enemy instanceof Vampire)
|
||||||
|
{
|
||||||
|
vampire++;
|
||||||
|
}
|
||||||
|
else if(enemy instanceof Goblin)
|
||||||
|
{
|
||||||
|
goblin++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// public Boolean isDiscovered() {
|
// public Boolean isDiscovered() {
|
||||||
// return isDiscovered;
|
// return isDiscovered;
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ For centuries, the land of Javanest lived in peace, until a magical Dragon attac
|
|||||||
### 🔮 Wizard
|
### 🔮 Wizard
|
||||||
- **Highest HP**, average mana.
|
- **Highest HP**, average mana.
|
||||||
- **Weapon (Wooden Staff):** Allows a **triple attack** (three strikes in one turn).
|
- **Weapon (Wooden Staff):** Allows a **triple attack** (three strikes in one turn).
|
||||||
- **Armor (Robe):** Low defence, but **reflects some attacks** back to the enemy.
|
- **Armor (Robe):** Low defence, but **reflects some attacks** back to the enemy, give you some **mana bunos**
|
||||||
- **Special attack (Destructive Spell):** Massive damage to one enemy **and heals the Wizard** for a portion of that damage.
|
- **Special attack (Destructive Spell):** Massive damage to one enemy **and heals the Wizard** for a portion of that damage.
|
||||||
- **Low base damage** – relies on special and triple attack.
|
- **Low base damage** – relies on special and triple attack.
|
||||||
- **Passive:** Worst damage reduction – you feel every hit.
|
- **Passive:** Worst damage reduction – you feel every hit.
|
||||||
|
|||||||
Reference in New Issue
Block a user