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