diff --git a/Java-Knight/src/main/java/org/project/Help.java b/Java-Knight/src/main/java/org/project/Help.java index 104447a..f8b5f81 100644 --- a/Java-Knight/src/main/java/org/project/Help.java +++ b/Java-Knight/src/main/java/org/project/Help.java @@ -1,4 +1,89 @@ package org.project; +import java.util.Scanner; + public class Help { + private Scanner scanner; + public Help(){ + this.scanner = new Scanner(System.in); + } + + public void showHelp() { + + while(true) { + System.out.println("\n"+"===== Help Menu ====="); + System.out.println("What do you need help with, sir?"); + System.out.println("1-What is Java-Knight?"); + System.out.println("2-How to play"); + System.out.println("0-Back"); + System.out.println("======================="); + int choice = getValidIntInput(); + switch (choice) { + case 1: javaKnight(); break; + case 2: howTo(); break; + case 0: return; + default: + System.out.println("Invalid choice. Please choose a number between 0-2."); + } + } + } + + private void javaKnight() { + System.out.println(""" + Prologue: The Legend of Javanest + For centuries, the land of Javanest lived in peace, until a magical Dragon attacked, + plunging the realm into absolute darkness. With a wicked curse, + the Dragon transformed the innocent people into horrific monsters: + Goblins, Skeletons, and Vampires. Retreating to its impenetrable Castle, + the Dragon divided the three keys to its lair and hid them among these cursed creatures. + Now, it is your duty to step up and save the land. You must battle these monsters, + recover the unique key from each monster type, and finally slay the Dragon to + break the curse and restore peace to Javanest! + """); + + System.out.println("\nPress ENTER to go back..."); + scanner.nextLine(); + + } + private void howTo() { + System.out.println("=== HOW TO PLAY ==="); + System.out.println(); + System.out.println("Goal – Defeat enemies to collect three unique keys (Goblin, Skeleton, Vampire), then storm the castle and slay the Dragon."); + System.out.println(); + System.out.println("Choose Your Class – Start as one of three heroes:"); + System.out.println(" - Knight – High damage."); + System.out.println(" - Assassin – High stamina."); + System.out.println(" - Wizard – High health."); + System.out.println(); + System.out.println("Combat (Turn-Based) – On your turn, choose one action:"); + System.out.println(" 1. Light Attack – Moderate damage, costs no mana (your fallback when out of mana)."); + System.out.println(" 2. Heavy Attack – High damage, costs mana."); + System.out.println(" 3. Special Ability – Unique class move (highest mana cost)."); + System.out.println(" 4. Defend – Reduces or blocks the next enemy attack."); + System.out.println(" 5. Heal – Restores HP, costs mana."); + System.out.println(); + System.out.println("Progression"); + System.out.println(" - After each victory, your HP and mana fully recover."); + System.out.println(" - Defeating enemies grants XP → leveling up increases max HP/mana."); + System.out.println(" - Each enemy has a chance (~20%) to drop its unique key. You only need one key per enemy type."); + System.out.println(); + System.out.println("Locked Path – The castle option is hidden until you collect all three keys. Only then can you face the final Dragon."); + System.out.println(); + System.out.println("Game Over – If your HP reaches zero, the game ends."); + System.out.println(); + System.out.println("> \"Collect the keys. Break the curse. Save Javanest.\""); + + System.out.println("\nPress ENTER to go back..."); + scanner.nextLine(); + } + + private int getValidIntInput() { + while (!scanner.hasNextInt()) { + System.out.print("Please enter a valid number: "); + scanner.next(); + } + int input = scanner.nextInt(); + scanner.nextLine(); // Clear buffer + return input; + } } diff --git a/Java-Knight/src/main/java/org/project/Menu.java b/Java-Knight/src/main/java/org/project/Menu.java index 7cfaa0e..221e978 100644 --- a/Java-Knight/src/main/java/org/project/Menu.java +++ b/Java-Knight/src/main/java/org/project/Menu.java @@ -1,7 +1,9 @@ package org.project; +import org.project.entity.players.Assassin; import org.project.entity.players.Knight; import org.project.entity.players.Player; +import org.project.entity.players.Wizard; import org.project.item.weapons.Sword; import java.util.Scanner; @@ -9,6 +11,7 @@ import java.util.Scanner; public class Menu { private Scanner scanner = new Scanner(System.in); private MenuActions actions = new MenuActions(); + private Help helpMenu = new Help(); public void start() { while (true) { @@ -24,7 +27,7 @@ public class Menu { switch(choice) { case 0: return; case 1: startMenu(); break; - case 2: showHelp(); break; + case 2: helpMenu.showHelp(); break; default: System.out.println("Invalid choice, please choose a number between 0-2"); } @@ -55,13 +58,13 @@ public class Menu { while (keepAsking) { int choice = getValidIntInput(); switch (choice) { - case 1: character = new Knight(name, 1000, 1000, new Sword(), 5, 5); + case 1: character = new Knight(name); System.out.println("You are a knight!"); keepAsking = false; break; - case 2: character = new Knight(name); + case 2: character = new Wizard(name); System.out.println("You are a wizard!"); keepAsking = false; break; - case 3: character = new Knight(name); + case 3: character = new Assassin(name); System.out.println("You are an assassin!"); keepAsking = false; break; case 0: keepAsking = false; break; @@ -71,17 +74,7 @@ public class Menu { return character; } - private void showHelp() { - System.out.println("\n"+"===== Java Knight ====="); - System.out.println("Help menu"); - System.out.println("What do you need help with, sir?"); - System.out.println("1-What is Java-Knight?"); - System.out.println("2-How to play"); - System.out.println("3-About characters"); - System.out.println("4-General tips"); - System.out.println("0-Back"); - System.out.println("======================="); - } + private int getValidIntInput() { while (!scanner.hasNextInt()) { System.out.print("Please enter a valid number: "); diff --git a/Java-Knight/src/main/java/org/project/MenuActions.java b/Java-Knight/src/main/java/org/project/MenuActions.java index fb760a6..967ed9d 100644 --- a/Java-Knight/src/main/java/org/project/MenuActions.java +++ b/Java-Knight/src/main/java/org/project/MenuActions.java @@ -1,8 +1,7 @@ package org.project; import org.project.entity.Entity; -import org.project.entity.enemies.Enemy; -import org.project.entity.enemies.Skeleton; +import org.project.entity.enemies.*; import org.project.entity.players.Player; import org.project.location.Location; @@ -11,12 +10,21 @@ import java.util.Random; import java.util.Scanner; public class MenuActions { - private ArrayList locations = new ArrayList<>(); - Scanner scanner = new Scanner(System.in); + private ArrayList locations; + Scanner scanner; + + public MenuActions() { + this.scanner = new Scanner(System.in); + this.locations = new ArrayList<>(); + } public void startGame(Player player) { - while (player.getKeysCollected() < 3) { - System.out.println("Keys collected: " + player.getKeysCollected()); + while (player.getKeysCollectedCount() < 3) { +// System.out.println("Keys collected: " + player.getStringKeysCollected()); +// if (askInventory(player)) { +// +// }; + askInventory(player); Enemy enemy = chooseEnemy(); Entity winner = fight(player, enemy); @@ -25,7 +33,21 @@ public class MenuActions { break; } } + if (player.getKeysCollectedCount() == 3) { askInventory(player); + System.out.println("Congratulations! You have successfully collected all 3 keys\n" + + "You may now fight the Dragon"); + System.out.println("Make sure to upgrade before entering the castle!"); + askInventory(player); + System.out.println("Entering the castle..."); + Entity winner = fight(player, new Dragon()); + if (winner != player) { + System.out.println("You were killed by the dragon. Game over!\nreturning to main menu..."); + } else { + System.out.println("Congratulations! You killed the dragon and saved Javanest!"); + } + } + } private Enemy chooseEnemy() { @@ -60,23 +82,43 @@ public class MenuActions { public Entity fight(Player player, Enemy enemy) { player.heal(player.getMaxHP()); player.fillMana(player.getMaxMP()); - Entity winner = null; + Entity winner; while (true) { playerTurn(player, enemy); if (enemy.getHp() == 0) { winner = player; System.out.println(player.getName() + " won the fight!"); - player.setXp(player.getXp()+5); - System.out.println(player.getName() + " got 5 XP for winning the fight!"); - System.out.println("Keys collected: " + player.getKeysCollected()); + if (!(enemy instanceof Dragon)) { + player.setXp(player.getXp()+5); + System.out.println(player.getName() + " got 5 XP for winning the fight!"); + } + if (enemy instanceof Skeleton) { boolean hasKey = ((Skeleton) enemy).generateKey(); if (hasKey) { - player.collectKey(); + player.collectKey((Skeleton) enemy); player.setXp(player.getXp()+20); - System.out.println(player.getName() + " got a key and 20 XP!"); + System.out.println(player.getName() + " got a Skeleton key and 20 XP!"); } } + if (enemy instanceof Goblin) { + boolean hasKey = ((Goblin) enemy).generateKey(); + if (hasKey) { + player.collectKey((Goblin) enemy); + player.setXp(player.getXp()+10); + System.out.println(player.getName() + " got a Goblin key and 10 XP!"); + } + } + if (enemy instanceof Vampire) { + boolean hasKey = ((Vampire) enemy).generateKey(); + if (hasKey) { + player.collectKey((Vampire) enemy); + player.setXp(player.getXp()+30); + System.out.println(player.getName() + " got a Vampire key and 30 XP!"); + } + } + System.out.println("Keys collected: " + player.getStringKeysCollected()); + return winner; } enemyTurn(player, enemy); @@ -96,25 +138,28 @@ public class MenuActions { // System.out.println("1-Light attack, mana cost: 0"); // System.out.println("2-Heavy attack, mana cost: "); // System.out.println("3-Special Ability, mana cost: "); -// System.out.println("4-Defend, mana cost: 10"); -// System.out.println("5-Heal, mana cost: 20"); +// System.out.println("4-Defend, mana cost: 10"); disabled +// System.out.println("5-Heal, mana cost: 20"); disabled while (true) { Random random = new Random(); - int choice = random.nextInt(5) + 1; + int choice = random.nextInt(3) + 1; switch (choice) { - case 1: enemy.getWeapon().lightAttack(player); return; + case 1: enemy.getWeapon().lightAttack(player); + System.out.println(enemy.getType() + "attacked(light)!"); return; case 2: if(enemy.getMp() >= enemy.getWeapon().getManaCost()) { - enemy.getWeapon().heavyAttack(enemy, player); return; + enemy.getWeapon().heavyAttack(enemy, player); + System.out.println(enemy.getType() + "attacked(Heavy)!"); return; } break; case 3: if (enemy.getMp() >= enemy.getWeapon().getSpecialMana()){ - enemy.getWeapon().useSpecialAbility(enemy, player); return; - } break; - case 4: if (enemy.getMp() >= enemy.getDefendManaCost()) { - enemy.defend(); return; - } break; - case 5: if (enemy.getMp() >= enemy.getHealManaCost()) { - enemy.heal(20); return; + enemy.getWeapon().useSpecialAbility(enemy, player); + System.out.println(enemy.getType() + "used special ability!"); return; } break; +// case 4: if (enemy.getMp() >= enemy.getDefendManaCost()) { +// enemy.defend(); return; +// } break; +// case 5: if (enemy.getMp() >= enemy.getHealManaCost()) { +// enemy.heal(20); return; +// } break; default: System.out.println("Invalid choice"); } @@ -168,20 +213,21 @@ public class MenuActions { } private void askInventory(Player player) { - System.out.println("Choose an option: "); - System.out.println("1- Go to the inventory"); - System.out.println("2- Continue to next fight"); + + whileLoop: while (true) { + System.out.println("Choose an option: "); + System.out.println("1- Go to the inventory"); + System.out.println("2- Continue to next fight"); int choice = getValidIntInput(); switch (choice) { - case 1: shop(player); + case 1: shop(player); break; case 2: return; default: System.out.println("Invalid choice, please choose a number (1 or 2)."); break; } } - } private void shop(Player player) { diff --git a/Java-Knight/src/main/java/org/project/entity/enemies/Dragon.java b/Java-Knight/src/main/java/org/project/entity/enemies/Dragon.java index a4ca0b9..7c073e1 100644 --- a/Java-Knight/src/main/java/org/project/entity/enemies/Dragon.java +++ b/Java-Knight/src/main/java/org/project/entity/enemies/Dragon.java @@ -1,4 +1,28 @@ package org.project.entity.enemies; -public class Dragon { +import org.project.item.weapons.BoneHarpoon; +import org.project.item.weapons.TailScythe; +import org.project.item.weapons.Weapon; + +public class Dragon extends Enemy{ + private static int DEFAULT_HP = 200; + private static int DEFAULT_MP = 200; + private static TailScythe DEFAULT_WEAPON = new TailScythe(); + private static int DEFAULT_HEAL_MANA_COST = 20; + private static int DEFAULT_DEFEND_MANA_COST = 20; + + public Dragon() { + super(DEFAULT_HP, DEFAULT_MP, DEFAULT_WEAPON, + DEFAULT_HEAL_MANA_COST, DEFAULT_DEFEND_MANA_COST); + } + + public Dragon(String name, int hp, int mp, Weapon weapon, + int healManaCost, int defendManaCost) { + super(hp, mp, weapon, healManaCost, defendManaCost); + } + + @Override + public String getType() { + return "Dragon"; + } } diff --git a/Java-Knight/src/main/java/org/project/entity/enemies/Goblin.java b/Java-Knight/src/main/java/org/project/entity/enemies/Goblin.java index a11e517..7f01929 100644 --- a/Java-Knight/src/main/java/org/project/entity/enemies/Goblin.java +++ b/Java-Knight/src/main/java/org/project/entity/enemies/Goblin.java @@ -1,4 +1,59 @@ package org.project.entity.enemies; -public class Goblin { +import org.project.item.weapons.BoneHarpoon; +import org.project.item.weapons.GoblinSickle; +import org.project.item.weapons.Weapon; + +import java.util.Random; + +public class Goblin extends Enemy implements Key{ + private static int DEFAULT_HP = 80; + private static int DEFAULT_MP = 120; + private static GoblinSickle DEFAULT_WEAPON = new GoblinSickle(); + private static int DEFAULT_HEAL_MANA_COST = 30; + private static int DEFAULT_DEFEND_MANA_COST = 20; + private static int keysRemaining = 1; + + public Goblin() { + super(DEFAULT_HP, DEFAULT_MP, DEFAULT_WEAPON, + DEFAULT_HEAL_MANA_COST, DEFAULT_DEFEND_MANA_COST); + } + + public Goblin(String name, int hp, int mp, Weapon weapon, + int healManaCost, int defendManaCost) { + super(hp, mp, weapon, healManaCost, defendManaCost); + } + + @Override + public String getType() { + return "Goblin" ; + } + + @Override + public boolean generateKey() { + if (keysRemaining > 0) { + Random random = new Random(); + int dice = random.nextInt(1); + if (dice == 0) { + decreaseKey(); + return true; + } + } + return false; + } + + @Override + public void decreaseKey() { + keysRemaining -= 1; + } + + @Override + public int getKeysRemaining() { + return keysRemaining; + } + + @Override + public String getKeyType() { + return "Goblin"; + } } diff --git a/Java-Knight/src/main/java/org/project/entity/enemies/Key.java b/Java-Knight/src/main/java/org/project/entity/enemies/Key.java index e358147..eeeb890 100644 --- a/Java-Knight/src/main/java/org/project/entity/enemies/Key.java +++ b/Java-Knight/src/main/java/org/project/entity/enemies/Key.java @@ -4,4 +4,5 @@ public interface Key { boolean generateKey(); void decreaseKey(); int getKeysRemaining(); + String getKeyType(); } diff --git a/Java-Knight/src/main/java/org/project/entity/enemies/Skeleton.java b/Java-Knight/src/main/java/org/project/entity/enemies/Skeleton.java index 9378ab0..ab6acf5 100644 --- a/Java-Knight/src/main/java/org/project/entity/enemies/Skeleton.java +++ b/Java-Knight/src/main/java/org/project/entity/enemies/Skeleton.java @@ -13,7 +13,6 @@ public class Skeleton extends Enemy implements Key { private static int DEFAULT_HEAL_MANA_COST = 30; private static int DEFAULT_DEFEND_MANA_COST = 20; private static int keysRemaining = 1; - private boolean hasKey = false; public Skeleton() { super(DEFAULT_HP, DEFAULT_MP, DEFAULT_WEAPON, @@ -34,8 +33,8 @@ public class Skeleton extends Enemy implements Key { public boolean generateKey() { if (keysRemaining > 0) { Random random = new Random(); - int dice = random.nextInt(5); - if (dice == 1) { + int dice = random.nextInt(1); + if (dice == 0) { decreaseKey(); return true; } @@ -52,5 +51,10 @@ public class Skeleton extends Enemy implements Key { public int getKeysRemaining() { return keysRemaining; } + + @Override + public String getKeyType() { + return "Skeleton"; + } // TODO: DESIGN ENEMY AND IMPLEMENT THE CONSTRUCTOR } diff --git a/Java-Knight/src/main/java/org/project/entity/enemies/Vampire.java b/Java-Knight/src/main/java/org/project/entity/enemies/Vampire.java index 966c4b5..c2618ce 100644 --- a/Java-Knight/src/main/java/org/project/entity/enemies/Vampire.java +++ b/Java-Knight/src/main/java/org/project/entity/enemies/Vampire.java @@ -1,4 +1,59 @@ package org.project.entity.enemies; -public class Vampire { +import org.project.item.weapons.GoblinSickle; +import org.project.item.weapons.MirrorClaws; +import org.project.item.weapons.Weapon; + +import java.util.Random; + +public class Vampire extends Enemy implements Key{ + private static int DEFAULT_HP = 150; + private static int DEFAULT_MP = 150; + private static MirrorClaws DEFAULT_WEAPON = new MirrorClaws(); + private static int DEFAULT_HEAL_MANA_COST = 30; + private static int DEFAULT_DEFEND_MANA_COST = 20; + private static int keysRemaining = 1; + + public Vampire() { + super(DEFAULT_HP, DEFAULT_MP, DEFAULT_WEAPON, + DEFAULT_HEAL_MANA_COST, DEFAULT_DEFEND_MANA_COST); + } + + public Vampire(String name, int hp, int mp, Weapon weapon, + int healManaCost, int defendManaCost) { + super(hp, mp, weapon, healManaCost, defendManaCost); + } + + @Override + public String getType() { + return "Vampire" ; + } + + @Override + public boolean generateKey() { + if (keysRemaining > 0) { + Random random = new Random(); + int dice = random.nextInt(1); + if (dice == 0) { + decreaseKey(); + return true; + } + } + return false; + } + + @Override + public void decreaseKey() { + keysRemaining -= 1; + } + + @Override + public int getKeysRemaining() { + return keysRemaining; + } + + @Override + public String getKeyType() { + return "Vampire"; + } } diff --git a/Java-Knight/src/main/java/org/project/entity/players/Assassin.java b/Java-Knight/src/main/java/org/project/entity/players/Assassin.java index 2fb2ede..2a1840e 100644 --- a/Java-Knight/src/main/java/org/project/entity/players/Assassin.java +++ b/Java-Knight/src/main/java/org/project/entity/players/Assassin.java @@ -1,4 +1,36 @@ package org.project.entity.players; -public class Assassin { +import org.project.item.weapons.Sword; +import org.project.item.weapons.Weapon; + +public class Assassin extends Player { + private static int DEFAULT_HP = 80; + private static int DEFAULT_MP = 100; + private static Sword DEFAULT_WEAPON = new Sword(); + private static String DEFAULT_NAME = "Hasan"; + private static int DEFAULT_HEAL_MANA_COST = 20; + private static int DEFAULT_DEFEND_MANA_COST = 15; + + public Assassin() { + super(DEFAULT_NAME, DEFAULT_HP, DEFAULT_MP, DEFAULT_WEAPON, + DEFAULT_HEAL_MANA_COST, DEFAULT_DEFEND_MANA_COST); + } + public Assassin(String name) { + super(name, DEFAULT_HP, DEFAULT_MP, DEFAULT_WEAPON, + DEFAULT_HEAL_MANA_COST, DEFAULT_DEFEND_MANA_COST); + } + + public Assassin(String name, int hp, int mp, Weapon weapon, + int healManaCost, int defendManaCost) { + super(name, hp, mp, weapon, healManaCost, defendManaCost); + } + + + + @Override + public String getType() { + return "Assassin" ; + } + + } diff --git a/Java-Knight/src/main/java/org/project/entity/players/Knight.java b/Java-Knight/src/main/java/org/project/entity/players/Knight.java index 2f7c093..5305209 100644 --- a/Java-Knight/src/main/java/org/project/entity/players/Knight.java +++ b/Java-Knight/src/main/java/org/project/entity/players/Knight.java @@ -1,13 +1,12 @@ package org.project.entity.players; -import org.project.item.armors.Armor; import org.project.item.weapons.Sword; import org.project.item.weapons.Weapon; // TODO: UPDATE IMPLEMENTATION public class Knight extends Player { private static int DEFAULT_HP = 100; - private static int DEFAULT_MP = 100; + private static int DEFAULT_MP = 80; private static Sword DEFAULT_WEAPON = new Sword(); private static String DEFAULT_NAME = "Ser Duncan"; private static int DEFAULT_HEAL_MANA_COST = 30; diff --git a/Java-Knight/src/main/java/org/project/entity/players/Player.java b/Java-Knight/src/main/java/org/project/entity/players/Player.java index 11db2d3..89d4bad 100644 --- a/Java-Knight/src/main/java/org/project/entity/players/Player.java +++ b/Java-Knight/src/main/java/org/project/entity/players/Player.java @@ -1,9 +1,11 @@ package org.project.entity.players; import org.project.entity.Entity; -import org.project.item.armors.Armor; +import org.project.entity.enemies.Key; import org.project.item.weapons.Weapon; +import java.util.ArrayList; + // TODO: UPDATE IMPLEMENTATION public abstract class Player implements Entity{ protected String name; @@ -16,8 +18,9 @@ public abstract class Player implements Entity{ private boolean isDefendingThisTurn = false; private int healManaCost; private int defendManaCost; - private int keysCollected; + private int keysCollectedCount; private int xp = 0; + private ArrayList keysByType = new ArrayList<>(); public Player(String name, int hp, int mp, Weapon weapon, int healManaCost, int defendManaCost) { @@ -27,18 +30,20 @@ public abstract class Player implements Entity{ this.maxHP = hp; this.maxMP = mp; this.weapon = weapon; - this.keysCollected = 0; + this.keysCollectedCount = 0; this.healManaCost = healManaCost; this.defendManaCost = defendManaCost; } - public void collectKey() { - keysCollected += 1; + public void collectKey(Key enemy) { + addKey(enemy.getKeyType()); + keysCollectedCount += 1; } @Override public void defend() { isDefendingThisTurn = true; + this.reduceMana(this.getDefendManaCost()); } @@ -121,8 +126,8 @@ public abstract class Player implements Entity{ return weapon; } - public int getKeysCollected() { - return keysCollected; + public int getKeysCollectedCount() { + return keysCollectedCount; } @Override @@ -154,9 +159,17 @@ public abstract class Player implements Entity{ this.setMaxMP(this.getMaxMP() + amount); } } - public int getDefendManaCost() { return defendManaCost; } - + public void addKey(String type) { + keysByType.add(type); + } + public String getStringKeysCollected() { + String result = "Count: " + keysCollectedCount + " "; + for (String key: keysByType) { + result += " " + key + " key"; + } + return result; + } } diff --git a/Java-Knight/src/main/java/org/project/entity/players/Wizard.java b/Java-Knight/src/main/java/org/project/entity/players/Wizard.java index db87a41..ba2965a 100644 --- a/Java-Knight/src/main/java/org/project/entity/players/Wizard.java +++ b/Java-Knight/src/main/java/org/project/entity/players/Wizard.java @@ -1,4 +1,36 @@ package org.project.entity.players; -public class Wizard { +import org.project.item.weapons.Fireball; +import org.project.item.weapons.Weapon; + +public class Wizard extends Player{ + private static int DEFAULT_HP = 90; + private static int DEFAULT_MP = 90; + private static Fireball DEFAULT_WEAPON = new Fireball(); + private static String DEFAULT_NAME = "Merlin"; + private static int DEFAULT_HEAL_MANA_COST = 25; + private static int DEFAULT_DEFEND_MANA_COST = 25; + + public Wizard() { + super(DEFAULT_NAME, DEFAULT_HP, DEFAULT_MP, DEFAULT_WEAPON, + DEFAULT_HEAL_MANA_COST, DEFAULT_DEFEND_MANA_COST); + } + public Wizard(String name) { + super(name, DEFAULT_HP, DEFAULT_MP, DEFAULT_WEAPON, + DEFAULT_HEAL_MANA_COST, DEFAULT_DEFEND_MANA_COST); + } + + public Wizard(String name, int hp, int mp, Weapon weapon, + int healManaCost, int defendManaCost) { + super(name, hp, mp, weapon, healManaCost, defendManaCost); + } + + + + @Override + public String getType() { + return "Wizard" ; + } + + } diff --git a/Java-Knight/src/main/java/org/project/item/weapons/BoneHarpoon.java b/Java-Knight/src/main/java/org/project/item/weapons/BoneHarpoon.java index b08a364..6a8cfe2 100644 --- a/Java-Knight/src/main/java/org/project/item/weapons/BoneHarpoon.java +++ b/Java-Knight/src/main/java/org/project/item/weapons/BoneHarpoon.java @@ -3,7 +3,7 @@ package org.project.item.weapons; import org.project.entity.Entity; public class BoneHarpoon extends Weapon{ - private static int DEFAULT_DAMAGE = 10; + private static int DEFAULT_DAMAGE = 15; private static int DEFAULT_MANACOST = 10; private static int DEFAULT_SPECIAL_MANA = 20; diff --git a/Java-Knight/src/main/java/org/project/item/weapons/Dagger.java b/Java-Knight/src/main/java/org/project/item/weapons/Dagger.java index 7ae48e1..4565fea 100644 --- a/Java-Knight/src/main/java/org/project/item/weapons/Dagger.java +++ b/Java-Knight/src/main/java/org/project/item/weapons/Dagger.java @@ -3,9 +3,9 @@ package org.project.item.weapons; import org.project.entity.Entity; public class Dagger extends Weapon{ - private static int DEFAULT_DAMAGE = 20; - private static int DEFAULT_MANACOST = 20; - private static int DEFAULT_SPECIAL_MANA = 20; + private static int DEFAULT_DAMAGE = 15; + private static int DEFAULT_MANACOST = 15; + private static int DEFAULT_SPECIAL_MANA = 30; public Dagger() { @@ -15,7 +15,7 @@ public class Dagger extends Weapon{ @Override public void useSpecialAbility(Entity attacker, Entity target) { target.takeDamage(50); - attacker.reduceMana(this.getManaCost() + 10); + attacker.reduceMana(this.getSpecialMana()); } @Override public String getType() { diff --git a/Java-Knight/src/main/java/org/project/item/weapons/Fireball.java b/Java-Knight/src/main/java/org/project/item/weapons/Fireball.java index fb3344f..580dc7a 100644 --- a/Java-Knight/src/main/java/org/project/item/weapons/Fireball.java +++ b/Java-Knight/src/main/java/org/project/item/weapons/Fireball.java @@ -3,9 +3,9 @@ package org.project.item.weapons; import org.project.entity.Entity; public class Fireball extends Weapon{ - private static int DEFAULT_DAMAGE = 20; + private static int DEFAULT_DAMAGE = 15; private static int DEFAULT_MANACOST = 20; - private static int DEFAULT_SPECIAL_MANA = 20; + private static int DEFAULT_SPECIAL_MANA = 25; public Fireball() { @@ -14,7 +14,7 @@ public class Fireball extends Weapon{ @Override public void useSpecialAbility(Entity attacker, Entity target) { target.takeDamage(this.getDamage() * 3); - attacker.reduceMana(this.getManaCost() + 10); + attacker.reduceMana(this.getSpecialMana()); } @Override public String getType() { diff --git a/Java-Knight/src/main/java/org/project/item/weapons/GoblinSickle.java b/Java-Knight/src/main/java/org/project/item/weapons/GoblinSickle.java index 7171593..072bec3 100644 --- a/Java-Knight/src/main/java/org/project/item/weapons/GoblinSickle.java +++ b/Java-Knight/src/main/java/org/project/item/weapons/GoblinSickle.java @@ -4,7 +4,7 @@ import org.project.entity.Entity; public class GoblinSickle extends Weapon { private static int DEFAULT_DAMAGE = 10; - private static int DEFAULT_MANACOST = 15; + private static int DEFAULT_MANACOST = 10; private static int DEFAULT_SPECIAL_MANA = 20; @@ -15,6 +15,7 @@ public class GoblinSickle extends Weapon { @Override public void useSpecialAbility(Entity attacker, Entity target) { target.takeDamage(this.getDamage()*2); + attacker.reduceMana(this.getSpecialMana()); } @Override public String getType() { diff --git a/Java-Knight/src/main/java/org/project/item/weapons/MirrorClaws.java b/Java-Knight/src/main/java/org/project/item/weapons/MirrorClaws.java index 8fbb673..a9f497b 100644 --- a/Java-Knight/src/main/java/org/project/item/weapons/MirrorClaws.java +++ b/Java-Knight/src/main/java/org/project/item/weapons/MirrorClaws.java @@ -16,7 +16,7 @@ public class MirrorClaws extends Weapon{ public void useSpecialAbility(Entity attacker, Entity target) { target.takeDamage(this.getDamage()); target.reduceMana(30); - attacker.reduceMana(this.getManaCost() + 10); + attacker.reduceMana(this.getSpecialMana()); } @Override public String getType() { diff --git a/Java-Knight/src/main/java/org/project/item/weapons/Sword.java b/Java-Knight/src/main/java/org/project/item/weapons/Sword.java index ee337ad..a42018e 100644 --- a/Java-Knight/src/main/java/org/project/item/weapons/Sword.java +++ b/Java-Knight/src/main/java/org/project/item/weapons/Sword.java @@ -18,7 +18,7 @@ public class Sword extends Weapon { @Override public void useSpecialAbility(Entity attacker, Entity target) { target.takeDamage(this.getDamage()* 2 + 5); - attacker.reduceMana(this.getManaCost()); + attacker.reduceMana(this.getSpecialMana()); } @Override public String getType() { diff --git a/Java-Knight/src/main/java/org/project/location/Location.java b/Java-Knight/src/main/java/org/project/location/Location.java index d45323e..cdff602 100644 --- a/Java-Knight/src/main/java/org/project/location/Location.java +++ b/Java-Knight/src/main/java/org/project/location/Location.java @@ -1,7 +1,9 @@ package org.project.location; import org.project.entity.enemies.Enemy; +import org.project.entity.enemies.Goblin; import org.project.entity.enemies.Skeleton; +import org.project.entity.enemies.Vampire; import org.project.item.weapons.BoneHarpoon; import org.project.item.weapons.Sword; import org.project.item.weapons.Weapon; @@ -37,8 +39,8 @@ public class Location { Enemy e = null; switch (enemyId) { case 0: e = new Skeleton(); break; - case 1: e = new Skeleton(); break; - case 2: e = new Skeleton(); break; + case 1: e = new Goblin(); break; + case 2: e = new Vampire(); break; } this.enemies.add(e); } @@ -47,11 +49,11 @@ public class Location { this.enemies.add(e); } private void addGoblin() { - Enemy e = null; + Enemy e = new Goblin(); this.enemies.add(e); } private void addVampire() { - Enemy e = null; + Enemy e = new Vampire(); this.enemies.add(e); } public static String pickName() { diff --git a/Java-Knight/target/classes/org/project/Help.class b/Java-Knight/target/classes/org/project/Help.class new file mode 100644 index 0000000..9ed86be Binary files /dev/null and b/Java-Knight/target/classes/org/project/Help.class differ diff --git a/Java-Knight/target/classes/org/project/Menu.class b/Java-Knight/target/classes/org/project/Menu.class index 13cbd39..1e501c1 100644 Binary files a/Java-Knight/target/classes/org/project/Menu.class and b/Java-Knight/target/classes/org/project/Menu.class differ diff --git a/Java-Knight/target/classes/org/project/MenuActions.class b/Java-Knight/target/classes/org/project/MenuActions.class index 4c587d0..d1e7a29 100644 Binary files a/Java-Knight/target/classes/org/project/MenuActions.class and b/Java-Knight/target/classes/org/project/MenuActions.class differ diff --git a/Java-Knight/target/classes/org/project/entity/enemies/Dragon.class b/Java-Knight/target/classes/org/project/entity/enemies/Dragon.class new file mode 100644 index 0000000..2ed8ed9 Binary files /dev/null and b/Java-Knight/target/classes/org/project/entity/enemies/Dragon.class differ diff --git a/Java-Knight/target/classes/org/project/entity/enemies/Goblin.class b/Java-Knight/target/classes/org/project/entity/enemies/Goblin.class new file mode 100644 index 0000000..dbd000d Binary files /dev/null and b/Java-Knight/target/classes/org/project/entity/enemies/Goblin.class differ diff --git a/Java-Knight/target/classes/org/project/entity/enemies/Key.class b/Java-Knight/target/classes/org/project/entity/enemies/Key.class index 22f13b7..1cf95c9 100644 Binary files a/Java-Knight/target/classes/org/project/entity/enemies/Key.class and b/Java-Knight/target/classes/org/project/entity/enemies/Key.class differ diff --git a/Java-Knight/target/classes/org/project/entity/enemies/Skeleton.class b/Java-Knight/target/classes/org/project/entity/enemies/Skeleton.class index 8e511ea..fb68edd 100644 Binary files a/Java-Knight/target/classes/org/project/entity/enemies/Skeleton.class and b/Java-Knight/target/classes/org/project/entity/enemies/Skeleton.class differ diff --git a/Java-Knight/target/classes/org/project/entity/enemies/Vampire.class b/Java-Knight/target/classes/org/project/entity/enemies/Vampire.class new file mode 100644 index 0000000..13ef878 Binary files /dev/null and b/Java-Knight/target/classes/org/project/entity/enemies/Vampire.class differ diff --git a/Java-Knight/target/classes/org/project/entity/players/Assassin.class b/Java-Knight/target/classes/org/project/entity/players/Assassin.class new file mode 100644 index 0000000..d83977c Binary files /dev/null and b/Java-Knight/target/classes/org/project/entity/players/Assassin.class differ diff --git a/Java-Knight/target/classes/org/project/entity/players/Knight.class b/Java-Knight/target/classes/org/project/entity/players/Knight.class index d0d7e57..11a2579 100644 Binary files a/Java-Knight/target/classes/org/project/entity/players/Knight.class and b/Java-Knight/target/classes/org/project/entity/players/Knight.class differ diff --git a/Java-Knight/target/classes/org/project/entity/players/Player.class b/Java-Knight/target/classes/org/project/entity/players/Player.class index cb1a083..f3f3028 100644 Binary files a/Java-Knight/target/classes/org/project/entity/players/Player.class and b/Java-Knight/target/classes/org/project/entity/players/Player.class differ diff --git a/Java-Knight/target/classes/org/project/entity/players/Wizard.class b/Java-Knight/target/classes/org/project/entity/players/Wizard.class new file mode 100644 index 0000000..3f5c1c6 Binary files /dev/null and b/Java-Knight/target/classes/org/project/entity/players/Wizard.class differ diff --git a/Java-Knight/target/classes/org/project/item/weapons/BoneHarpoon.class b/Java-Knight/target/classes/org/project/item/weapons/BoneHarpoon.class index 56f95e0..9393230 100644 Binary files a/Java-Knight/target/classes/org/project/item/weapons/BoneHarpoon.class and b/Java-Knight/target/classes/org/project/item/weapons/BoneHarpoon.class differ diff --git a/Java-Knight/target/classes/org/project/item/weapons/Dagger.class b/Java-Knight/target/classes/org/project/item/weapons/Dagger.class index 2c5cbba..01db477 100644 Binary files a/Java-Knight/target/classes/org/project/item/weapons/Dagger.class and b/Java-Knight/target/classes/org/project/item/weapons/Dagger.class differ diff --git a/Java-Knight/target/classes/org/project/item/weapons/Fireball.class b/Java-Knight/target/classes/org/project/item/weapons/Fireball.class index 63f5504..3510c00 100644 Binary files a/Java-Knight/target/classes/org/project/item/weapons/Fireball.class and b/Java-Knight/target/classes/org/project/item/weapons/Fireball.class differ diff --git a/Java-Knight/target/classes/org/project/item/weapons/GoblinSickle.class b/Java-Knight/target/classes/org/project/item/weapons/GoblinSickle.class index 6963635..3c14399 100644 Binary files a/Java-Knight/target/classes/org/project/item/weapons/GoblinSickle.class and b/Java-Knight/target/classes/org/project/item/weapons/GoblinSickle.class differ diff --git a/Java-Knight/target/classes/org/project/item/weapons/MirrorClaws.class b/Java-Knight/target/classes/org/project/item/weapons/MirrorClaws.class index f3ade90..3059d75 100644 Binary files a/Java-Knight/target/classes/org/project/item/weapons/MirrorClaws.class and b/Java-Knight/target/classes/org/project/item/weapons/MirrorClaws.class differ diff --git a/Java-Knight/target/classes/org/project/item/weapons/Sword.class b/Java-Knight/target/classes/org/project/item/weapons/Sword.class index b5cb7ce..60595d3 100644 Binary files a/Java-Knight/target/classes/org/project/item/weapons/Sword.class and b/Java-Knight/target/classes/org/project/item/weapons/Sword.class differ diff --git a/Java-Knight/target/classes/org/project/location/Location.class b/Java-Knight/target/classes/org/project/location/Location.class index 732351e..4b93091 100644 Binary files a/Java-Knight/target/classes/org/project/location/Location.class and b/Java-Knight/target/classes/org/project/location/Location.class differ