diff --git a/.idea/misc.xml b/.idea/misc.xml index be3fc8d..f5d9dff 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -8,7 +8,7 @@ - + \ No newline at end of file diff --git a/Java-Knight/src/main/java/org/project/Main.java b/Java-Knight/src/main/java/org/project/Main.java index 6bde20e..8506c92 100644 --- a/Java-Knight/src/main/java/org/project/Main.java +++ b/Java-Knight/src/main/java/org/project/Main.java @@ -1,15 +1,132 @@ package org.project; -import org.project.location.Location; +import org.project.entity.enemies.*; +import org.project.entity.players.*; -import java.util.ArrayList; -import java.util.List; +import java.util.Random; +import java.util.Scanner; public class Main { public static void main(String[] args) { - // TODO: ADD LOCATIONS TO YOUR GAME - List locations = new ArrayList<>(); + Scanner scanner = new Scanner(System.in); + Random random = new Random(); - // TODO: IMPLEMENT GAMEPLAY + System.out.println("\u001B[33m=== The Legend of Javanest ===\u001B[0m"); + System.out.println("Choose your Hero Class:"); + System.out.println("1. Knight (High Damage)"); + System.out.println("2. Wizard (High Health)"); + System.out.println("3. Assassin (High Mana)"); + + int classChoice = scanner.nextInt(); + Player player; + if (classChoice == 2) { + player = new Wizard("Merlin"); + } else if (classChoice == 3) { + player = new Assassin("Ezio"); + } else { + player = new Knight("Ser Duncan"); + } + + boolean hasGoblinKey = false; + boolean hasSkeletonKey = false; + boolean hasVampireKey = false; + boolean gameRunning = true; + + while (gameRunning && player.isAlive()) { + boolean hasAllKeys = hasGoblinKey && hasSkeletonKey && hasVampireKey; + + System.out.println("\n\u001B[35mYou arrived at a new location.\u001B[0m"); + Enemy currentEnemy = spawnRandomEnemy(random); + System.out.println("A wild " + currentEnemy.getName() + " appears!"); + + boolean inLocation = true; + while (inLocation && player.isAlive()) { + System.out.println("\nWhat would you like to do?"); + System.out.println("1. Fight the enemy"); + System.out.println("2. Move to another location"); + if (hasAllKeys) { + System.out.println("\u001B[31m3. Go to the Castle to fight the Dragon\u001B[0m"); + } + + int choice = scanner.nextInt(); + + if (choice == 1) { + fight(player, currentEnemy, scanner); + inLocation = false; + + if (player.isAlive() && !currentEnemy.isAlive()) { + System.out.println("\u001B[32mVictory! " + currentEnemy.getName() + " was defeated.\u001B[0m"); + player.gainXP(50); + player.heal(player.getMaxHP()); + player.fillMana(player.getMaxMP()); + + if (currentEnemy instanceof Goblin && !hasGoblinKey && random.nextInt(100) < 20) { + System.out.println("\u001B[33m🗝️ You found the Goblin Key!\u001B[0m"); + hasGoblinKey = true; + } else if (currentEnemy instanceof Skeleton && !hasSkeletonKey && random.nextInt(100) < 20) { + System.out.println("\u001B[33m🗝️ You found the Skeleton Key!\u001B[0m"); + hasSkeletonKey = true; + } else if (currentEnemy instanceof Vampire && !hasVampireKey && random.nextInt(100) < 20) { + System.out.println("\u001B[33m🗝️ You found the Vampire Key!\u001B[0m"); + hasVampireKey = true; + } + } + } else if (choice == 2) { + System.out.println("You moved to a new location."); + inLocation = false; + } else if (choice == 3 && hasAllKeys) { + System.out.println("\n\u001B[31m=== You entered the Castle! ===\u001B[0m"); + Enemy dragon = new Dragon(); + fight(player, dragon, scanner); + if (player.isAlive()) { + System.out.println("\u001B[33m🎉 You defeated the Dragon and saved Javanest! You Win!\u001B[0m"); + } + gameRunning = false; + inLocation = false; + } + } + } + + if (!player.isAlive()) { + System.out.println("\u001B[31m💀 Game Over. You died.\u001B[0m"); + } + scanner.close(); + } + + private static Enemy spawnRandomEnemy(Random random) { + int r = random.nextInt(3); + if (r == 0) return new Goblin(); + if (r == 1) return new Skeleton(); + return new Vampire(); + } + + private static void fight(Player player, Enemy enemy, Scanner scanner) { + System.out.println("\u001B[31mYou chose to FIGHT!\u001B[0m"); + while (player.isAlive() && enemy.isAlive()) { + System.out.println("\n[" + player.getName() + " - " + player.getHp() + "/" + player.getMaxHP() + " HP | " + player.getMp() + "/" + player.getMaxMP() + " Mana]"); + System.out.println("[" + enemy.getName() + " - " + enemy.getHp() + "/" + enemy.getMaxHP() + " HP]"); + + System.out.println("\nYour Turn:"); + System.out.println("1. Light Attack | 2. Heavy Attack (-8 Mana) | 3. Defend (-6 Mana) | 4. Heal (-12 Mana) | 5. Special Ability (-15 Mana)"); + int action = scanner.nextInt(); + + if (player.isStunned()) { + System.out.println("\u001B[33mYou are stunned and cannot move!\u001B[0m"); + player.setStunned(false); + } else { + switch (action) { + case 1: player.lightAttack(enemy); break; + case 2: player.heavyAttack(enemy); break; + case 3: player.defendAction(); break; + case 4: player.healAction(); break; + case 5: player.specialAbility(enemy); break; + default: player.lightAttack(enemy); break; + } + } + + if (enemy.isAlive()) { + enemy.attackAction(player); + } + } } } \ No newline at end of file diff --git a/Java-Knight/src/main/java/org/project/entity/Entity.java b/Java-Knight/src/main/java/org/project/entity/Entity.java index 2a060f9..3249fa2 100644 --- a/Java-Knight/src/main/java/org/project/entity/Entity.java +++ b/Java-Knight/src/main/java/org/project/entity/Entity.java @@ -1,21 +1,15 @@ package org.project.entity; public interface Entity { - void attack(Entity target); - - void defend(); - - void heal(int health); - - void fillMana(int mana); - void takeDamage(int damage); - + void heal(int health); + void fillMana(int mana); + int getHp(); int getMaxHP(); - + int getMp(); int getMaxMP(); - - /* - TODO: ADD OTHER REQUIRED AND BONUS METHODS - */ -} + boolean isAlive(); + String getName(); + void setStunned(boolean stunned); + boolean isStunned(); +} \ No newline at end of file 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 new file mode 100644 index 0000000..e2a663b --- /dev/null +++ b/Java-Knight/src/main/java/org/project/entity/enemies/Dragon.java @@ -0,0 +1,21 @@ +package org.project.entity.enemies; + +import org.project.entity.Entity; + +public class Dragon extends Enemy { + + public Dragon() { + super("Dragon", 250, 30); + } + + @Override + public void attackAction(Entity target) { + if (!isStunned()) { + System.out.println("\u001B[31m🐉 Dragon breathes massive FIRE! (Bypasses shields)\u001B[0m"); + target.takeDamage(baseDamage); + } else { + System.out.println("🐉 Dragon is stunned, but recovers quickly!"); + setStunned(false); + } + } +} \ No newline at end of file diff --git a/Java-Knight/src/main/java/org/project/entity/enemies/Enemy.java b/Java-Knight/src/main/java/org/project/entity/enemies/Enemy.java index e019acb..0239f4d 100644 --- a/Java-Knight/src/main/java/org/project/entity/enemies/Enemy.java +++ b/Java-Knight/src/main/java/org/project/entity/enemies/Enemy.java @@ -1,34 +1,61 @@ package org.project.entity.enemies; -import org.project.item.weapons.Weapon; +import org.project.entity.Entity; -// TODO: UPDATE IMPLEMENTATION -public abstract class Enemy { - Weapon weapon; - private int hp; - private int mp; +public abstract class Enemy implements Entity { + protected String name; + protected int hp; + protected int maxHP; + protected int baseDamage; + protected boolean stunned; - public Enemy(int hp, int mp, Weapon weapon) { + public Enemy(String name, int hp, int baseDamage) { + this.name = name; this.hp = hp; - this.mp = mp; - - this.weapon = weapon; + this.maxHP = hp; + this.baseDamage = baseDamage; + this.stunned = false; } + public abstract void attackAction(Entity target); + @Override public void takeDamage(int damage) { hp -= damage; + if (hp < 0) hp = 0; + System.out.println("\u001B[31m" + name + " took " + damage + " damage!\u001B[0m"); } - public int getHp() { - return hp; + @Override + public void heal(int health) { + hp += health; + if (hp > maxHP) hp = maxHP; } - public int getMp() { - return mp; - } + @Override + public void fillMana(int mana) {} - public Weapon getWeapon() { - return weapon; - } -} + @Override + public int getHp() { return hp; } + + @Override + public int getMaxHP() { return maxHP; } + + @Override + public int getMp() { return 0; } + + @Override + public int getMaxMP() { return 0; } + + @Override + public boolean isAlive() { return hp > 0; } + + @Override + public String getName() { return name; } + + @Override + public void setStunned(boolean stunned) { this.stunned = stunned; } + + @Override + public boolean isStunned() { return stunned; } +} \ No newline at end of file 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 new file mode 100644 index 0000000..93fac7e --- /dev/null +++ b/Java-Knight/src/main/java/org/project/entity/enemies/Goblin.java @@ -0,0 +1,29 @@ +package org.project.entity.enemies; + +import org.project.entity.Entity; +import java.util.Random; + +public class Goblin extends Enemy { + private Random random; + + public Goblin() { + super("Goblin", 30, 10); + this.random = new Random(); + } + + @Override + public void attackAction(Entity target) { + if (!isStunned()) { + if (random.nextInt(100) < 40) { + System.out.println("\u001B[31m👹 Goblin used Critical Strike!\u001B[0m"); + target.takeDamage(baseDamage * 2); + } else { + System.out.println("👹 Goblin attacks normally!"); + target.takeDamage(baseDamage); + } + } else { + System.out.println("👹 Goblin is stunned and skips the turn!"); + setStunned(false); + } + } +} \ No newline at end of file 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 8a6a555..3f2f2ab 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 @@ -1,6 +1,33 @@ package org.project.entity.enemies; -// TODO: UPDATE IMPLEMENTATION -public class Skeleton { - // TODO: DESIGN ENEMY AND IMPLEMENT THE CONSTRUCTOR -} +import org.project.entity.Entity; + +public class Skeleton extends Enemy { + private boolean hasResurrected; + + public Skeleton() { + super("Skeleton", 40, 8); + this.hasResurrected = false; + } + + @Override + public void takeDamage(int damage) { + super.takeDamage(damage); + if (hp == 0 && !hasResurrected) { + System.out.println("\u001B[33m☠️ Skeleton resurrected with 50% HP!\u001B[0m"); + hasResurrected = true; + hp = maxHP / 2; + } + } + + @Override + public void attackAction(Entity target) { + if (!isStunned()) { + System.out.println("☠️ Skeleton uses Bone Strike!"); + target.takeDamage(baseDamage); + } else { + System.out.println("☠️ Skeleton is stunned and skips the turn!"); + setStunned(false); + } + } +} \ No newline at end of file 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 new file mode 100644 index 0000000..e534537 --- /dev/null +++ b/Java-Knight/src/main/java/org/project/entity/enemies/Vampire.java @@ -0,0 +1,25 @@ +package org.project.entity.enemies; + +import org.project.entity.Entity; + +public class Vampire extends Enemy { + + public Vampire() { + super("Vampire", 50, 12); + } + + @Override + public void attackAction(Entity target) { + if (!isStunned()) { + System.out.println("\u001B[31m🦇 Vampire uses Life Steal!\u001B[0m"); + target.takeDamage(baseDamage); + + int healAmount = baseDamage / 2; + heal(healAmount); + System.out.println("\u001B[32m🦇 Vampire healed for " + healAmount + " HP!\u001B[0m"); + } else { + System.out.println("🦇 Vampire is stunned and skips the turn!"); + setStunned(false); + } + } +} \ No newline at end of file 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 new file mode 100644 index 0000000..c08cbf5 --- /dev/null +++ b/Java-Knight/src/main/java/org/project/entity/players/Assassin.java @@ -0,0 +1,65 @@ +package org.project.entity.players; + +import org.project.entity.Entity; + +public class Assassin extends Player { + private boolean isInvisible = false; + private boolean nextAttackCrit = false; + + public Assassin(String name) { + super(name, 80, 120, 15); + } + + @Override + public void takeDamage(int damage) { + if (isInvisible) { + System.out.println("\u001B[35m💨 " + name + " dodged the attack completely by being invisible!\u001B[0m"); + isInvisible = false; + } else { + super.takeDamage(damage); + } + } + + @Override + public void lightAttack(Entity target) { + int dmg = baseDamage; + if (nextAttackCrit) { + System.out.println("\u001B[31m💥 Critical Hit!\u001B[0m"); + dmg *= 2; + nextAttackCrit = false; + } + target.takeDamage(dmg); + } + + @Override + public void heavyAttack(Entity target) { + int cost = 8; + if (mp >= cost) { + mp -= cost; + int dmg = baseDamage * 2; + if (nextAttackCrit) { + System.out.println("\u001B[31m💥 Critical Hit!\u001B[0m"); + dmg *= 2; + nextAttackCrit = false; + } + target.takeDamage(dmg); + } else { + lightAttack(target); + } + } + + @Override + public void specialAbility(Entity target) { + int cost = 15; + if (mp >= cost) { + mp -= cost; + System.out.println("\u001B[36m🗡️ " + name + " (Assassin) used Shadow Step! (-15 Mana)\u001B[0m"); + isInvisible = true; + nextAttackCrit = true; + System.out.println("\u001B[35m" + name + " turned invisible! Next attack will dodge and crit.\u001B[0m"); + } else { + System.out.println("\u001B[34mNot enough mana! Defaulting to Light Attack.\u001B[0m"); + lightAttack(target); + } + } +} \ No newline at end of file diff --git a/Java-Knight/src/main/java/org/project/entity/players/ICombatActions.java b/Java-Knight/src/main/java/org/project/entity/players/ICombatActions.java new file mode 100644 index 0000000..5363408 --- /dev/null +++ b/Java-Knight/src/main/java/org/project/entity/players/ICombatActions.java @@ -0,0 +1,11 @@ +package org.project.entity.players; + +import org.project.entity.Entity; + +public interface ICombatActions { + void lightAttack(Entity target); + void heavyAttack(Entity target); + void defendAction(); + void healAction(); + void specialAbility(Entity target); +} \ No newline at end of file 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 14d8fa2..4489228 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,6 +1,25 @@ package org.project.entity.players; -// TODO: UPDATE IMPLEMENTATION -public class Knight { - // TODO: DESIGN KNIGHT'S WEAPON AND ARMOR AND IMPLEMENT THE CONSTRUCTOR -} +import org.project.entity.Entity; + +public class Knight extends Player { + + public Knight(String name) { + super(name, 100, 50, 20); + } + + @Override + public void specialAbility(Entity target) { + int cost = 15; + if (mp >= cost) { + mp -= cost; + System.out.println("\u001B[36m⚔️ " + name + " (Knight) used Shield Bash! (-15 Mana)\u001B[0m"); + target.takeDamage(baseDamage * 2); + target.setStunned(true); + System.out.println("\u001B[33m" + target.getName() + " is stunned for the next turn!\u001B[0m"); + } else { + System.out.println("\u001B[34mNot enough mana! Defaulting to Light Attack.\u001B[0m"); + lightAttack(target); + } + } +} \ No newline at end of file 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 ff5385c..9656a0c 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,65 +1,123 @@ package org.project.entity.players; import org.project.entity.Entity; -import org.project.item.armors.Armor; -import org.project.item.weapons.Weapon; -// TODO: UPDATE IMPLEMENTATION -public abstract class Player { +public abstract class Player implements Entity, ICombatActions { protected String name; - Weapon weapon; - Armor armor; - private int hp; - private int maxHP; - private int mp; - private int maxMP; + protected int hp; + protected int maxHP; + protected int mp; + protected int maxMP; + protected int baseDamage; + protected boolean isDefending; + protected boolean stunned; + protected int level = 1; + protected int xp = 0; - public Player(String name, int hp, int mp, Weapon weapon, Armor armor) { + public Player(String name, int maxHP, int maxMP, int baseDamage) { this.name = name; - this.hp = hp; - this.mp = mp; - - this.weapon = weapon; - this.armor = armor; + this.maxHP = maxHP; + this.hp = maxHP; + this.maxMP = maxMP; + this.mp = maxMP; + this.baseDamage = baseDamage; + this.isDefending = false; + this.stunned = false; } - @Override - public void attack(Entity target) { - target.takeDamage(weapon.getDamage()); - } - - @Override - public void defend() { - // TODO - } - - @Override public void takeDamage(int damage) { - hp -= damage - armor.getDefense(); + if (isDefending) { + damage /= 2; + isDefending = false; + } + hp -= damage; + if (hp < 0) hp = 0; } @Override public void heal(int health) { hp += health; - if (hp > maxHP) { - hp = maxHP; - } + if (hp > maxHP) hp = maxHP; } @Override public void fillMana(int mana) { mp += mana; - if (mp > maxMP) { - mp = maxMP; + if (mp > maxMP) mp = maxMP; + } + + @Override + public boolean isAlive() { + return hp > 0; + } + + @Override + public void setStunned(boolean stunned) { + this.stunned = stunned; + } + + @Override + public boolean isStunned() { + return stunned; + } + + public void gainXP(int amount) { + xp += amount; + if (xp >= level * 100) { + levelUp(); } } + protected void levelUp() { + level++; + maxHP += 20; + maxMP += 10; + baseDamage += 5; + hp = maxHP; + mp = maxMP; + } + @Override + public void lightAttack(Entity target) { + target.takeDamage(baseDamage); + } + + @Override + public void heavyAttack(Entity target) { + int cost = 8; + if (mp >= cost) { + mp -= cost; + target.takeDamage(baseDamage * 2); + } else { + lightAttack(target); + } + } + + @Override + public void defendAction() { + int cost = 6; + if (mp >= cost) { + mp -= cost; + isDefending = true; + } + } + + @Override + public void healAction() { + int cost = 12; + if (mp >= cost) { + mp -= cost; + heal(maxHP / 3); + } + } + + @Override public String getName() { return name; } + @Override public int getHp() { return hp; } @@ -69,6 +127,7 @@ public abstract class Player { return maxHP; } + @Override public int getMp() { return mp; } @@ -77,13 +136,4 @@ public abstract class Player { public int getMaxMP() { return maxMP; } - - public Weapon getWeapon() { - return weapon; - } - - public Armor getArmor() { - return armor; - } - -} +} \ No newline at end of file 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 new file mode 100644 index 0000000..c208788 --- /dev/null +++ b/Java-Knight/src/main/java/org/project/entity/players/Wizard.java @@ -0,0 +1,25 @@ +package org.project.entity.players; + +import org.project.entity.Entity; + +public class Wizard extends Player { + + public Wizard(String name) { + super(name, 150, 80, 12); + } + + @Override + public void specialAbility(Entity target) { + int cost = 15; + if (mp >= cost) { + mp -= cost; + System.out.println("\u001B[36m🧙‍♂️ " + name + " (Wizard) cast Life Drain! (-15 Mana)\u001B[0m"); + target.takeDamage(baseDamage * 2); + heal(maxHP / 4); + System.out.println("\u001B[32m" + name + " healed for " + (maxHP / 4) + " HP!\u001B[0m"); + } else { + System.out.println("\u001B[34mNot enough mana! Defaulting to Light Attack.\u001B[0m"); + lightAttack(target); + } + } +} \ No newline at end of file diff --git a/Java-Knight/src/main/java/org/project/item/Item.java b/Java-Knight/src/main/java/org/project/item/Item.java index 6d6b5ad..6f0684d 100644 --- a/Java-Knight/src/main/java/org/project/item/Item.java +++ b/Java-Knight/src/main/java/org/project/item/Item.java @@ -4,8 +4,4 @@ import org.project.entity.Entity; public interface Item { void use(Entity target); - - /* - TODO: ADD OTHER REQUIRED AND BONUS METHODS - */ -} +} \ No newline at end of file diff --git a/Java-Knight/src/main/java/org/project/item/armors/Armor.java b/Java-Knight/src/main/java/org/project/item/armors/Armor.java index 7ca8774..1c77ac3 100644 --- a/Java-Knight/src/main/java/org/project/item/armors/Armor.java +++ b/Java-Knight/src/main/java/org/project/item/armors/Armor.java @@ -1,17 +1,25 @@ package org.project.item.armors; -// TODO: UPDATE IMPLEMENTATION -public abstract class Armor { +import org.project.item.Item; +import org.project.entity.Entity; + +public abstract class Armor implements Item { private int defense; private int maxDefense; private int durability; private int maxDurability; - private boolean isBroke; public Armor(int defense, int durability) { this.defense = defense; + this.maxDefense = defense; this.durability = durability; + this.maxDurability = durability; + this.isBroke = false; + } + + @Override + public void use(Entity target) { } public void checkBreak() { @@ -21,7 +29,6 @@ public abstract class Armor { } } - // TODO: (BONUS) UPDATE THE REPAIR METHOD public void repair() { isBroke = false; defense = maxDefense; @@ -39,4 +46,9 @@ public abstract class Armor { public boolean isBroke() { return isBroke; } -} + + public void reduceDurability(int amount) { + durability -= amount; + checkBreak(); + } +} \ No newline at end of file diff --git a/Java-Knight/src/main/java/org/project/item/armors/KnightArmor.java b/Java-Knight/src/main/java/org/project/item/armors/KnightArmor.java index eb59a46..f6e11cd 100644 --- a/Java-Knight/src/main/java/org/project/item/armors/KnightArmor.java +++ b/Java-Knight/src/main/java/org/project/item/armors/KnightArmor.java @@ -1,6 +1,7 @@ package org.project.item.armors; -// TODO: UPDATE IMPLEMENTATION -public class KnightArmor { - // TODO: DESIGN ARMOR'S ATTRIBUTES IMPLEMENT THE CONSTRUCTOR +public class KnightArmor extends Armor { + public KnightArmor() { + super(10, 100); + } } \ No newline at end of file diff --git a/Java-Knight/src/main/java/org/project/item/consumables/Consumable.java b/Java-Knight/src/main/java/org/project/item/consumables/Consumable.java index 028e13d..0972a7d 100644 --- a/Java-Knight/src/main/java/org/project/item/consumables/Consumable.java +++ b/Java-Knight/src/main/java/org/project/item/consumables/Consumable.java @@ -1,8 +1,6 @@ package org.project.item.consumables; -// TODO: UPDATE IMPLEMENTATION -public abstract class Consumable { - /* - TODO: ADD OTHER REQUIRED AND BONUS METHODS - */ -} +import org.project.item.Item; + +public abstract class Consumable implements Item { +} \ No newline at end of file diff --git a/Java-Knight/src/main/java/org/project/item/consumables/Flask.java b/Java-Knight/src/main/java/org/project/item/consumables/Flask.java index c0e7a6d..f72e91c 100644 --- a/Java-Knight/src/main/java/org/project/item/consumables/Flask.java +++ b/Java-Knight/src/main/java/org/project/item/consumables/Flask.java @@ -2,15 +2,9 @@ package org.project.item.consumables; import org.project.entity.Entity; -// TODO: UPDATE IMPLEMENTATION -public class Flask { - /* - THIS IS AN EXAMPLE OF A CONSUMABLE DESIGN. - */ - - // TODO: UPDATE USE METHOD +public class Flask extends Consumable { @Override public void use(Entity target) { target.heal(target.getMaxHP() / 10); } -} +} \ No newline at end of file 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 96226ee..913f6eb 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 @@ -1,26 +1,20 @@ package org.project.item.weapons; import org.project.entity.Entity; - import java.util.ArrayList; -// TODO: UPDATE IMPLEMENTATION -public class Sword { - /* - THIS IS AN EXAMPLE OF A WEAPON DESIGN. - */ - - int abilityCharge; +public class Sword extends Weapon { + private int abilityCharge; public Sword() { - // TODO: DESIGN SWORD'S ATTRIBUTES IMPLEMENT THE CONSTRUCTOR + super(15, 5); + this.abilityCharge = 0; } - // TODO: (BONUS) UPDATE THE UNIQUE ABILITY public void uniqueAbility(ArrayList targets) { abilityCharge += 2; for (Entity target : targets) { target.takeDamage(getDamage()); } } -} +} \ No newline at end of file diff --git a/Java-Knight/src/main/java/org/project/item/weapons/Weapon.java b/Java-Knight/src/main/java/org/project/item/weapons/Weapon.java index cb9fcf2..67e7d02 100644 --- a/Java-Knight/src/main/java/org/project/item/weapons/Weapon.java +++ b/Java-Knight/src/main/java/org/project/item/weapons/Weapon.java @@ -1,16 +1,12 @@ package org.project.item.weapons; import org.project.entity.Entity; +import org.project.item.Item; -// TODO: UPDATE IMPLEMENTATION -public abstract class Weapon { +public abstract class Weapon implements Item { private int damage; private int manaCost; - /* - TODO: ADD OTHER REQUIRED AND BONUS ATTRIBUTES - */ - public Weapon(int damage, int manaCost) { this.damage = damage; this.manaCost = manaCost; @@ -28,8 +24,4 @@ public abstract class Weapon { public int getManaCost() { return manaCost; } - - /* - TODO: ADD OTHER REQUIRED AND BONUS METHODS - */ -} +} \ No newline at end of file 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 b0b4b98..2461c34 100644 --- a/Java-Knight/src/main/java/org/project/location/Location.java +++ b/Java-Knight/src/main/java/org/project/location/Location.java @@ -1,17 +1,17 @@ package org.project.location; import org.project.entity.enemies.Enemy; - import java.util.ArrayList; public class Location { private String name; - + private ArrayList locations; private ArrayList enemies; - public Location(ArrayList locations, ArrayList enemies) { - this.locations = locations; - this.enemies = enemies; + public Location(String name, ArrayList locations, ArrayList enemies) { + this.name = name; + this.locations = locations != null ? locations : new ArrayList<>(); + this.enemies = enemies != null ? enemies : new ArrayList<>(); } public String getName() { @@ -25,4 +25,4 @@ public class Location { public ArrayList getEnemies() { return enemies; } -} +} \ No newline at end of file diff --git a/Java-Knight/target/classes/org/project/Main.class b/Java-Knight/target/classes/org/project/Main.class new file mode 100644 index 0000000..de26ad3 Binary files /dev/null and b/Java-Knight/target/classes/org/project/Main.class differ diff --git a/Java-Knight/target/classes/org/project/entity/Entity.class b/Java-Knight/target/classes/org/project/entity/Entity.class new file mode 100644 index 0000000..876032a Binary files /dev/null and b/Java-Knight/target/classes/org/project/entity/Entity.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..d14e272 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/Enemy.class b/Java-Knight/target/classes/org/project/entity/enemies/Enemy.class new file mode 100644 index 0000000..a996422 Binary files /dev/null and b/Java-Knight/target/classes/org/project/entity/enemies/Enemy.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..875ba3c 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/Skeleton.class b/Java-Knight/target/classes/org/project/entity/enemies/Skeleton.class new file mode 100644 index 0000000..5d175c4 Binary files /dev/null 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..496c28f 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..ca9f976 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/ICombatActions.class b/Java-Knight/target/classes/org/project/entity/players/ICombatActions.class new file mode 100644 index 0000000..8f1cdee Binary files /dev/null and b/Java-Knight/target/classes/org/project/entity/players/ICombatActions.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 new file mode 100644 index 0000000..75ef90c Binary files /dev/null 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 new file mode 100644 index 0000000..66d72f8 Binary files /dev/null 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..0d5bca3 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/Item.class b/Java-Knight/target/classes/org/project/item/Item.class new file mode 100644 index 0000000..3db1242 Binary files /dev/null and b/Java-Knight/target/classes/org/project/item/Item.class differ diff --git a/Java-Knight/target/classes/org/project/item/armors/Armor.class b/Java-Knight/target/classes/org/project/item/armors/Armor.class new file mode 100644 index 0000000..3519cca Binary files /dev/null and b/Java-Knight/target/classes/org/project/item/armors/Armor.class differ diff --git a/Java-Knight/target/classes/org/project/item/armors/KnightArmor.class b/Java-Knight/target/classes/org/project/item/armors/KnightArmor.class new file mode 100644 index 0000000..a259520 Binary files /dev/null and b/Java-Knight/target/classes/org/project/item/armors/KnightArmor.class differ diff --git a/Java-Knight/target/classes/org/project/item/consumables/Consumable.class b/Java-Knight/target/classes/org/project/item/consumables/Consumable.class new file mode 100644 index 0000000..ddc37ed Binary files /dev/null and b/Java-Knight/target/classes/org/project/item/consumables/Consumable.class differ diff --git a/Java-Knight/target/classes/org/project/item/consumables/Flask.class b/Java-Knight/target/classes/org/project/item/consumables/Flask.class new file mode 100644 index 0000000..0415c3e Binary files /dev/null and b/Java-Knight/target/classes/org/project/item/consumables/Flask.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 new file mode 100644 index 0000000..39a2a91 Binary files /dev/null and b/Java-Knight/target/classes/org/project/item/weapons/Sword.class differ diff --git a/Java-Knight/target/classes/org/project/item/weapons/Weapon.class b/Java-Knight/target/classes/org/project/item/weapons/Weapon.class new file mode 100644 index 0000000..8aea05a Binary files /dev/null and b/Java-Knight/target/classes/org/project/item/weapons/Weapon.class differ diff --git a/Java-Knight/target/classes/org/project/location/Location.class b/Java-Knight/target/classes/org/project/location/Location.class new file mode 100644 index 0000000..a0a5d1b Binary files /dev/null and b/Java-Knight/target/classes/org/project/location/Location.class differ