+ (fix): fixed major bugs :
1. Skeleton now resurrects 2. Armor doesn't heal the player + (buff) buffed players
This commit is contained in:
@@ -104,7 +104,7 @@ public class Main {
|
||||
|
||||
|
||||
while (gameRunning && !player.isDead()){
|
||||
int choice = miniMenu(locations.get(randNum1),player);
|
||||
int choice = miniMenu(currentLocation,player);
|
||||
|
||||
switch (choice){
|
||||
case 1:
|
||||
@@ -159,7 +159,7 @@ public class Main {
|
||||
System.out.println(BLUE + " 1." + RESET + " Stay at " + loc.getName() + " and fight with " + loc.getEnemy().getName());
|
||||
System.out.println(BLUE + " 2." + RESET + " Move to another place");
|
||||
if (castleUnLocked){
|
||||
System.out.println(BLUE + " 3." + RESET + PURPLE + " Go to castle and fight with the dragon" + RESET);
|
||||
System.out.println(BLUE + " 3." + PURPLE + " Go to castle and fight with the dragon" + RESET);
|
||||
}
|
||||
else {
|
||||
System.out.println(" \uD83D\uDD12" + LIGHT_GRAY + "3. Go to castle and fight with the dragon" + RESET);
|
||||
@@ -267,7 +267,6 @@ public class Main {
|
||||
} else {
|
||||
System.out.println(RED + "Not enough MP!, light attacking." + RESET);
|
||||
player.lightAttack(enemy);
|
||||
System.out.println(RED + "Enemy HP : " + RESET + enemy.getHp());
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
@@ -291,6 +290,7 @@ public class Main {
|
||||
|
||||
System.out.println(RED + "HP : " + RESET + player.getHp() + "/" + player.getMaxHP() +
|
||||
GREEN + " | MP: " + RESET + player.getMp() + "/" + player.getMaxMP());
|
||||
System.out.println(RED + "Enemy's HP : " + RESET + enemy.getHp());
|
||||
}
|
||||
|
||||
private static void enemyTurn(Player player,Enemy enemy) {
|
||||
|
||||
@@ -36,7 +36,8 @@ public abstract class Enemy extends Entity {
|
||||
public void takeDamage(int damage) {
|
||||
hp -= damage;
|
||||
if (hp <= 0){
|
||||
dead = true;
|
||||
hp = 0;
|
||||
makeDie();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ public class Skeleton extends Enemy {
|
||||
if (deathCounter == 0){
|
||||
this.setHp(HP / 2);
|
||||
deathCounter++;
|
||||
System.out.println("Skeleton resurrected!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ public class Knight extends Player {
|
||||
|
||||
target.stun(true);
|
||||
target.takeDamage(50);
|
||||
this.mp -= SPECIAL_ABILITY_MANA_COST;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,7 +25,7 @@ public abstract class Player extends Entity {
|
||||
private int xpToNextLevel = 100;
|
||||
|
||||
private static final double DAMAGE_MODIFIER = 1.5; // Used for critical hits
|
||||
private static final int LIGHT_ATTACK_DAMAGE = 10;
|
||||
private static final int LIGHT_ATTACK_DAMAGE = 30;
|
||||
protected static final int DEFEND_MP_COST = 5;
|
||||
protected static final int HEAL_MP_COST = 10;
|
||||
|
||||
@@ -70,6 +70,7 @@ public abstract class Player extends Entity {
|
||||
public void breakShield(){ // used for dragon ability
|
||||
if (isDefending){
|
||||
isDefending = false;
|
||||
System.out.println("Shield broken.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,15 +78,22 @@ public abstract class Player extends Entity {
|
||||
@Override
|
||||
public void takeDamage(int damage) {
|
||||
if (!isDefending) {
|
||||
if (armor.getDefense() - damage > 0){
|
||||
armor.use();
|
||||
} else if (armor.isBroke()) {
|
||||
hp -= damage;
|
||||
} else {
|
||||
hp -= damage - armor.getDefense();
|
||||
armor.use();
|
||||
}
|
||||
}
|
||||
else {
|
||||
System.out.println("Defended the attack.");
|
||||
isDefending = false;
|
||||
}
|
||||
|
||||
if (hp <= 0){
|
||||
hp = 0;
|
||||
this.dead = true;
|
||||
}
|
||||
|
||||
@@ -102,7 +110,7 @@ public abstract class Player extends Entity {
|
||||
|
||||
public void gainXP(int amount){
|
||||
this.experiencePoint += amount;
|
||||
|
||||
System.out.println("Gained " + amount + " XP.");
|
||||
while (experiencePoint >= xpToNextLevel){
|
||||
levelUp();
|
||||
}
|
||||
@@ -131,13 +139,6 @@ public abstract class Player extends Entity {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void fillMana(int mana) {
|
||||
mp += mana;
|
||||
if (mp > maxMP) {
|
||||
mp = maxMP;
|
||||
}
|
||||
}
|
||||
|
||||
public void fullRestore(){
|
||||
this.setHp(getMaxHP());
|
||||
this.setMp(getMaxMP());
|
||||
|
||||
@@ -15,6 +15,7 @@ public abstract class Armor {
|
||||
|
||||
public void use(){
|
||||
durability -= durabilityCost;
|
||||
System.out.println("Used Armor.");
|
||||
checkBreak();
|
||||
}
|
||||
|
||||
@@ -23,6 +24,7 @@ public abstract class Armor {
|
||||
isBroke = true;
|
||||
durability = 0;
|
||||
defense = 0;
|
||||
System.out.println("Armor broke.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package org.project.item.weapons;
|
||||
|
||||
public class Bite extends Weapon{
|
||||
private static final int DAMAGE = 25;
|
||||
private static final int DAMAGE = 30;
|
||||
|
||||
public Bite(){
|
||||
super(DAMAGE, 0); // the dagger is only meant to get used by skeleton and goblin, hence it doesen't use mana.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package org.project.item.weapons;
|
||||
|
||||
public class Dagger extends Weapon{
|
||||
private static final int DAMAGE = 25;
|
||||
private static final int DAMAGE = 30;
|
||||
|
||||
public Dagger(){
|
||||
super(DAMAGE, 0); // the dagger is only meant to get used by skeleton and goblin, hence it doesen't use mana.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package org.project.item.weapons;
|
||||
|
||||
public class FireBall extends Weapon{
|
||||
private static final int DAMAGE = 35;
|
||||
private static final int DAMAGE = 50;
|
||||
private static final int MANA_COST = 8;
|
||||
|
||||
public FireBall() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package org.project.item.weapons;
|
||||
|
||||
public class LightSaber extends Weapon{ // xD
|
||||
private static final int DAMAGE = 60;
|
||||
private static final int DAMAGE = 70;
|
||||
private static final int MANA_COST = 9;
|
||||
private String color; // color has no purpose at all, i just made it for fun.
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import java.util.ArrayList;
|
||||
|
||||
public class Sword extends Weapon {
|
||||
|
||||
private static final int DAMAGE = 50;
|
||||
private static final int DAMAGE = 60;
|
||||
private static final int MANA_COST = 8;
|
||||
|
||||
public Sword() {
|
||||
|
||||
Reference in New Issue
Block a user