diff --git a/Java-Knight/src/main/java/org/project/Main.class b/Java-Knight/src/main/java/org/project/Main.class new file mode 100644 index 0000000..2be909e Binary files /dev/null and b/Java-Knight/src/main/java/org/project/Main.class differ diff --git a/Java-Knight/src/main/java/org/project/Main.java b/Java-Knight/src/main/java/org/project/Main.java index 6bde20e..bd07ebc 100644 --- a/Java-Knight/src/main/java/org/project/Main.java +++ b/Java-Knight/src/main/java/org/project/Main.java @@ -1,15 +1,523 @@ package org.project; +import org.project.entity.Entity; +import org.project.entity.enemies.*; +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.consumables.Flask; +import org.project.item.consumables.Teriak; import org.project.location.Location; - +import java.util.Scanner; import java.util.ArrayList; import java.util.List; public class Main { - public static void main(String[] args) { - // TODO: ADD LOCATIONS TO YOUR GAME - List locations = new ArrayList<>(); - // TODO: IMPLEMENT GAMEPLAY + public static final String RESET = "\u001B[0m"; + public static final String RED = "\u001B[31m"; + public static final String GREEN = "\u001B[32m"; + public static final String YELLOW = "\u001B[33m"; + public static final String BLUE = "\u001B[34m"; + + + public static Entity player; + public static Entity enemy; + public static Scanner input = new Scanner(System.in); + public static ArrayList keys = new ArrayList(); + public static boolean running = true; + + + public static void main(String[] args) { + + + startMenu(); + + while (running){ // when exit ruuning will be false + + do{ + + try { // if we have null location we handle with this try/catch + System.out.println("==============================="); + Location fightLoc = fightMenu(); // make location with random enemy + enemy = fightLoc.getEnemie(); + System.out.println(enemy.toString() + "| HP:" + enemy.getHp()); + System.out.println("Do you want fight?"); + System.out.println("1.Yes"); + System.out.println("2.No(Go to another location)"); + int n = input.nextInt(); + if(n==1){ + gameplay(); // if you want play go to gameplay() + if(!player.isalive()){ // result of match + System.out.println("==============================="); + System.out.println( YELLOW + "Goodby!"); + return; + } + else { + System.out.println(BLUE); + player.repair(); + System.out.println(RESET); + } + } + else if(n >= 3){ + System.out.println("Invalid input"); + } + }catch (NullPointerException exception){ + System.out.println( YELLOW + "Goodby!"); + return; + } + + + }while (running); + + + + } } -} \ No newline at end of file + + //make keys array + public static void setKeys(){ // set key array for enemies + boolean goblinkey=false; + boolean skeletonkey = false; + boolean vampirekey = false; + keys.add(goblinkey); + keys.add(skeletonkey); + keys.add(vampirekey); + } + + /** + this method choose for player in game + */ + public static void startMenu(){ + System.out.println("----------Welcome to Java-Knight----------"); + setKeys(); + System.out.print("Please enter your name:"); + String name = input.next(); + System.out.println("Choose tor player:"); + System.out.println("1. ⚔\uFE0F Knight (High Damage)"); + System.out.println("2. \uD83E\uDDD9\u200D♂\uFE0F Wizard (High HP)"); + System.out.println("3. \uD83D\uDDE1\uFE0F️ Assassin (High Mana)"); + + boolean validInput = false; // check for vaild input + while (!validInput){ + System.out.print("chose:"); + int choose =input.nextInt(); + switch (choose){ + case 1: + { + player = new Knight(name); + validInput= true; + break; + } + case 2: + { + player = new Wizard(name); + validInput = true; + break; + } + case 3: + { + player = new Assassin(name); + validInput = true; + break; + } + default: + { + System.out.println("Invalid input"); + validInput = false; + } + } + + + } + } + + + /** + * make a location + * @return location with random enemy + */ + public static Location fightMenu(){ + boolean dragonOpen = true; // check drangon is open + for (Boolean b : keys){ + if(b == false){ + dragonOpen = false; + break; + } + } + + + System.out.println("Where do you want to go?"); + System.out.println("1.Desert"); + System.out.println("2.Sea"); + System.out.println("3.Jungle"); + + for(boolean b : keys){ // for every key chek and write lock or tik + if(b){ + System.out.print("✔\uFE0F"); + + } + else{ + System.out.print("🔒"); + } + } + + + + + if(dragonOpen) { + System.out.println("4.Dranon"); + } + else { + System.out.println("Dragon"); + } + + System.out.println("0.EXIT (CLOSE GAME)"); + + + + + int n = (int) ((Math.random()) *3); // a random number for random enemy + Entity enemy = null; + if(n == 0){ + enemy = new Goblin(); + } + if(n==1){ + enemy = new Skeleton(); + } + if(n==2){ + enemy = new Vampire(); + } + + Location location = null; + + + boolean validInput = false; + while (!validInput){ + System.out.print("chose:"); + int choose =input.nextInt(); + switch (choose){ + case 0: + { + running = false; + return null; + } + case 1: + { + location = new Location("Desert" , enemy); + validInput = true; + break; + } + case 2: + { + location = new Location("Sea" , enemy); + validInput=true; + break; + } + case 3: + { + location = new Location("Jungle" , enemy); + validInput =true; + break; + } + case 4: + { + if(dragonOpen){ + enemy = new Dragon(); + location = new Location("The end of line" , enemy); + validInput = true; + + } + else { + System.out.println("It's locked!!!!!!"); + validInput = false; + } + break; + } + default: + { + System.out.println("Invalid input"); + validInput = false; + break; + } + + } + + + + + + + + + + } + System.out.println("==============================="); + return location; + + } + + + /** + * main loop of game + */ + public static void gameplay(){ + boolean playerTurn = true; // flag for check for turn + + while (player.isalive() && enemy.isalive()){ + + + System.out.println("========================================="); + + if(playerTurn){ + System.out.println(player.toString()); + System.out.println(enemy.toString() + "| HP:" + enemy.getHp()); + + System.out.println("\n"+GREEN + "It's your Turn" +RESET); + while (true){ + + if(playerAttakMenu()){ // maybe not enough mp and should choose again + break; + } + + } + playerTurn = !playerTurn; + + + // for skeleton relive + if(enemy instanceof Skeleton && !enemy.isalive() && !((Skeleton) enemy).getResurrect()){ + System.out.println("\n"+ RED); + enemy.specialAbility(player); + System.out.println(RESET); + playerTurn = !playerTurn; + } + // for win senario + if(!enemy.isalive()){ + System.out.println("you WIN"); + int n = (int) (Math.random()*2); // 50% present enemy have key + if(enemy instanceof Dragon){ + System.out.println(YELLOW + "Congratulation \n You are the kingdom of Gogorio" + + " 1000 Hp | 1000 Mp" + RESET); + ((Player) player).setKing(); // king senario; + } + + + else if(n== 0){ + if(enemy instanceof Goblin){ + if(keys.get(0) == true){ + System.out.println("You have got this key befor"); + return; + } + keys.set(0, true); + } + else if (enemy instanceof Skeleton){ + if(keys.get(1) == true){ + System.out.println("You have got this key befor"); + return; + } + keys.set(1 , true); + } + else if (enemy instanceof Vampire) { + if(keys.get(2) == true){ + System.out.println("You have got this key befor"); + return; + } + keys.set(2 , true); + } + System.out.println( YELLOW +"You chatck the" + enemy.toString() +"keys"+ RESET); + } + else { + System.out.println("There is no keys here"); + } + return; + } + } + + + if(!enemy.getpossible()){ // enemy is possible act? + System.out.println(enemy.toString() + " Can't do any act"); + enemy.truepossible(); + playerTurn = !playerTurn; + continue; + } + + if(enemy.getpossible() && !playerTurn){ + + System.out.println("\n" + RED +"It's enemy Turn" + RESET); + enemyAttakMenu(); // randoum act from enemy; + playerTurn = !playerTurn; + + + } + + if(!player.isalive()){ // result + System.out.println("you lose"); + return; + } + + + + + + } + + + + } + + + /** + * selet a random act for each enemy + */ + public static void enemyAttakMenu(){ + if(enemy instanceof Goblin || enemy instanceof Vampire){ + int n = (int) (Math.random()*3); + if(n ==0 && enemy.getMp() >=10){ + enemy.specialAbility(player); + } + else if(n == 1){ + + enemy.lightattack(player); + } + else { + enemy.heavyattack(player); + } + + } + + else if(enemy instanceof Skeleton){ // skeleton use special ability when he dead + if(enemy.getHp() <= 0){ + enemy.heavyattack(player); + } + else { + enemy.lightattack(player); + } + } + + else if( enemy instanceof Dragon){ + int n = (int)(Math.random()*3); + if(n==0){ + enemy.specialAbility(player); + } + else { + enemy.lightattack(player); + } + + + } + + + } + + + /** + * choose a act for player + * @return was the act successful or no + */ + public static boolean playerAttakMenu() { + + System.out.print("1.Light attak| "); + System.out.print("2.Heavy attak("+player.getWeapon().getManaCost()+ " mana)| "); + System.out.print("3.Defend(12 mana)| "); + System.out.print("4.Heal(14 mana)| "); + System.out.println("5.Special action (30 mana)"); + + int n ; + + while (true){ + System.out.print("choose:"); + n = input.nextInt(); + if(n > 0 && n < 6){ + break; + } + else { + System.out.println("Invalid input"); + } + } + + switch (n){ + case 1: + { + player.lightattack(enemy); + return true; + } + case 2: + { + if(player.getMp() >= player.getWeapon().getManaCost()){ + player.heavyattack(enemy); + return true; + } + else { + System.out.println("Not enough Mp"); + return false; + } + } + case 3: + { + if(player.getMp() >= 12){ + player.defend(); + return true; + } + else { + System.out.println("Not enough Mp"); + return false; + } + } + + case 4: + { + if(player.getMp() >= 14){ + System.out.println("1.Flask | 2. Teriak"); + int k ; + while (true){ + k = input.nextInt(); + System.out.print("choose:"); + if(k == 1){ + Flask flask = new Flask(); + flask.use(player); + break; + } + else if(k==2){ + Teriak teriak = new Teriak(); + teriak.use(player); + break; + } + else { + System.out.print("Invalid input"); + + + } + } + return true; + } + else { + System.out.println("Not enough Mp"); + return false; + } + + } + + case 5: + { + if(player.getMp() >= 30){ + player.specialAbility(enemy); + return true; + } + else { + System.out.println("Not enough Mp"); + return false; + } + + } + default: + { + return false; + } + + } + + } + +} + diff --git a/Java-Knight/src/main/java/org/project/entity/Entity.class b/Java-Knight/src/main/java/org/project/entity/Entity.class new file mode 100644 index 0000000..95425d7 Binary files /dev/null and b/Java-Knight/src/main/java/org/project/entity/Entity.class differ 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..651003e 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,32 @@ package org.project.entity; +import org.project.item.armors.Armor; +import org.project.item.weapons.Weapon; + public interface Entity { - void attack(Entity target); + void lightattack(Entity target); + void heavyattack(Entity target); void defend(); - - void heal(int health); - - void fillMana(int mana); - + void healHp(int health); + void healMp(int mp); void takeDamage(int damage); - int getMaxHP(); - + int getHp(); int getMaxMP(); + int getMp(); + Armor getArmor(); + Weapon getWeapon(); + void falsepossible(); + void truepossible(); + boolean getpossible(); + boolean isalive(); + void repair(); + void specialAbility(Entity target); + String toString(); + String getName(); + + + - /* - TODO: ADD OTHER REQUIRED AND BONUS METHODS - */ } diff --git a/Java-Knight/src/main/java/org/project/entity/enemies/Dragon.class b/Java-Knight/src/main/java/org/project/entity/enemies/Dragon.class new file mode 100644 index 0000000..3d6d7d0 Binary files /dev/null and b/Java-Knight/src/main/java/org/project/entity/enemies/Dragon.class differ 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..95bf668 --- /dev/null +++ b/Java-Knight/src/main/java/org/project/entity/enemies/Dragon.java @@ -0,0 +1,27 @@ +package org.project.entity.enemies; + +import org.project.entity.Entity; +import org.project.item.armors.EnemyArmor; +import org.project.item.weapons.DragonWepon; +import org.project.item.weapons.Weapon; + +public class Dragon extends Enemy{ + + + public Dragon(){ + super(200 , 50 , new DragonWepon() , new EnemyArmor()); + } + + + public void specialAbility(Entity target){ + target.getArmor().brokeArmor(); + System.out.println(toString()+"\uD83D\uDD25 FIRE!! special ability" ); + target.takeDamage(2 * weapon.getDamage()); + + + } + + public String toString(){ + return "\uD83D\uDC09 Dragon"; + } +} diff --git a/Java-Knight/src/main/java/org/project/entity/enemies/Enemy.class b/Java-Knight/src/main/java/org/project/entity/enemies/Enemy.class new file mode 100644 index 0000000..dd44e13 Binary files /dev/null and b/Java-Knight/src/main/java/org/project/entity/enemies/Enemy.class differ 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..da46654 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,111 @@ package org.project.entity.enemies; +import org.project.entity.Entity; +import org.project.item.armors.Armor; import org.project.item.weapons.Weapon; -// TODO: UPDATE IMPLEMENTATION -public abstract class Enemy { - Weapon weapon; - private int hp; - private int mp; - public Enemy(int hp, int mp, Weapon weapon) { + + +public abstract class Enemy implements Entity { + protected Weapon weapon; + protected Armor armor; + protected int hp; + protected int mp; + protected int maxHp; + protected int maxMp; + protected boolean ispossible; + + + public Enemy(int hp, int mp, Weapon weapon , Armor armor) { this.hp = hp; + this.maxHp=hp; this.mp = mp; - + this.maxMp=mp; this.weapon = weapon; + this.armor = armor; + this.ispossible = true; + } + public abstract void specialAbility(Entity target); + + + @Override + public void lightattack(Entity target){ + System.out.println(toString() + " do a light attaked with " + weapon.getDamage() + " damages"); + target.takeDamage(weapon.getDamage()); + + } + + + @Override + public void heavyattack(Entity target){ + System.out.println(toString() + " do a heavy attaked with " + weapon.getDamage() * 2 + " damages"); + target.takeDamage((2 * weapon.getDamage()) - 10); + } + + + @Override public void takeDamage(int damage) { - hp -= damage; + + if(!armor.checkBreak()){ + hp -= damage - armor.getDefense(); + armor.use(this); + System.out.println(toString() + " take " + (damage -armor.getDefense()) + + " Damage. " + armor.getDefense() +" Defens by armor" ); + } + else { + hp -=damage; + System.out.println(toString() + "take " + (damage)); + }; } + @Override public int getHp() { return hp; } - public int getMp() { return mp; } - + public int getMaxHP(){ + return maxHp; + } + public int getMaxMP(){ + return maxMp; + } + @Override public Weapon getWeapon() { return weapon; } + public Armor getArmor(){return armor;} + + @Override + public void falsepossible(){ + ispossible = false; + } + public void truepossible(){ + ispossible=true; + } + + public boolean getpossible(){ + return ispossible; + } + + + @Override + public boolean isalive(){ + return hp>0; + } + + @Override + public abstract String toString(); + public String getName(){return "";} + public void repair(){} + public void defend() {} + public void healHp(int health){} + public void healMp(int mp){} } + + diff --git a/Java-Knight/src/main/java/org/project/entity/enemies/Goblin.class b/Java-Knight/src/main/java/org/project/entity/enemies/Goblin.class new file mode 100644 index 0000000..5e5cd65 Binary files /dev/null and b/Java-Knight/src/main/java/org/project/entity/enemies/Goblin.class differ 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..19f763e --- /dev/null +++ b/Java-Knight/src/main/java/org/project/entity/enemies/Goblin.java @@ -0,0 +1,25 @@ +package org.project.entity.enemies; + +import org.project.entity.Entity; +import org.project.item.armors.EnemyArmor; +import org.project.item.weapons.knife; + +public class Goblin extends Enemy { + + public Goblin(){ + super(35 , 30 , new knife() , new EnemyArmor()); + + } + + public void specialAbility(Entity target){ + System.out.println("\uD83D\uDC79 use critical hit"); + target.takeDamage(2 * weapon.getDamage() - 5); + this.mp -=10; + + } + + public String toString(){ + return "\uD83D\uDC79 Goblin"; + } + +} diff --git a/Java-Knight/src/main/java/org/project/entity/enemies/Skeleton.class b/Java-Knight/src/main/java/org/project/entity/enemies/Skeleton.class new file mode 100644 index 0000000..481d70c Binary files /dev/null and b/Java-Knight/src/main/java/org/project/entity/enemies/Skeleton.class differ 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..4bf4bee 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,40 @@ package org.project.entity.enemies; -// TODO: UPDATE IMPLEMENTATION -public class Skeleton { - // TODO: DESIGN ENEMY AND IMPLEMENT THE CONSTRUCTOR + +import org.project.entity.Entity; +import org.project.item.armors.EnemyArmor; +import org.project.item.weapons.wood; + +public class Skeleton extends Enemy { + + private boolean resurrect; + + public Skeleton(){ + super(50 , 30 , new wood() , new EnemyArmor()); + this.resurrect =false; + } + + public void specialAbility(Entity target){ + System.out.println(this.toString() +"use Special ability"); + if(this.isalive() == false && this.resurrect == false){ + this.hp=25; + this.mp=15; + System.out.println("☠\uFE0F resurrect himself"); + } + + this.resurrect = true; + + + + } + + public boolean getResurrect(){ + return resurrect; + } + + + public String toString(){ + return "☠\uFE0F Skeleton "; + } + } diff --git a/Java-Knight/src/main/java/org/project/entity/enemies/Vampire.class b/Java-Knight/src/main/java/org/project/entity/enemies/Vampire.class new file mode 100644 index 0000000..8764c6e Binary files /dev/null and b/Java-Knight/src/main/java/org/project/entity/enemies/Vampire.class differ 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..76809d9 --- /dev/null +++ b/Java-Knight/src/main/java/org/project/entity/enemies/Vampire.java @@ -0,0 +1,28 @@ +package org.project.entity.enemies; + +import org.project.entity.Entity; +import org.project.item.armors.EnemyArmor; +import org.project.item.weapons.wood; + +public class Vampire extends Enemy{ + + public Vampire(){ + super(60 , 30, new wood() , new EnemyArmor()); + } + + + @Override + public void specialAbility(Entity target){ + System.out.println(this.toString() +"use Special ability"); + System.out.println(); + this.mp -=10; + target.takeDamage(this.weapon.getDamage()); + this.hp += this.weapon.getDamage() /2; + System.out.println(" \uD83E\uDD87 rob your Hp :)" + "(" + this.weapon.getDamage() /2 + " Hp)"); + } + + public String toString(){ + return "\uD83E\uDD87 Vampire "; + } + +} diff --git a/Java-Knight/src/main/java/org/project/entity/players/Assassin.class b/Java-Knight/src/main/java/org/project/entity/players/Assassin.class new file mode 100644 index 0000000..d6f7399 Binary files /dev/null and b/Java-Knight/src/main/java/org/project/entity/players/Assassin.class differ 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..00f1d99 --- /dev/null +++ b/Java-Knight/src/main/java/org/project/entity/players/Assassin.java @@ -0,0 +1,24 @@ +package org.project.entity.players; + +import org.project.entity.Entity; +import org.project.item.armors.woodenArmor; +import org.project.item.weapons.knife; + +public class Assassin extends Player{ + + public Assassin(String name){ + super("🗡️ "+name +"(Assassin)" , 60 , 80 ,new knife(), new woodenArmor() , 8); + } + + public void specialAbility(Entity target){ + System.out.println(this.getName() + "use special ability, (you are invisible now) " + + "+ Damge:" +weapon.getDamage() + fistDamage ); + mp -= 30; + target.falsepossible(); + target.takeDamage(weapon.getDamage() + fistDamage); + + + } + + +} diff --git a/Java-Knight/src/main/java/org/project/entity/players/Knight.class b/Java-Knight/src/main/java/org/project/entity/players/Knight.class new file mode 100644 index 0000000..30b1828 Binary files /dev/null and b/Java-Knight/src/main/java/org/project/entity/players/Knight.class differ 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..a1aedc9 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,24 @@ 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; +import org.project.item.armors.KnightArmor; +import org.project.item.weapons.Sword; + +public class Knight extends Player { + + public Knight(String name){ + super("⚔\uFE0F " + name + "(Knight)" , 50 , 50 , new Sword() , new KnightArmor() ,10); + } + + + @Override + public void specialAbility(Entity target){ + System.out.println(this.getName() + "use special ability"); + mp -=30; + target.takeDamage(weapon.getDamage() + fistDamage); + target.falsepossible(); + } + + } diff --git a/Java-Knight/src/main/java/org/project/entity/players/Player.class b/Java-Knight/src/main/java/org/project/entity/players/Player.class new file mode 100644 index 0000000..35b35bb Binary files /dev/null and b/Java-Knight/src/main/java/org/project/entity/players/Player.class differ 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..4f943b3 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 @@ -4,43 +4,89 @@ import org.project.entity.Entity; import org.project.item.armors.Armor; import org.project.item.weapons.Weapon; -// TODO: UPDATE IMPLEMENTATION -public abstract class Player { - protected String name; - Weapon weapon; - Armor armor; - private int hp; - private int maxHP; - private int mp; - private int maxMP; - public Player(String name, int hp, int mp, Weapon weapon, Armor armor) { +public abstract class Player implements Entity { + protected String name; + protected Weapon weapon; + protected Armor armor; + protected int hp; + protected int maxHP; + protected int mp; + protected int maxMP; + protected int fistDamage; + protected boolean isDefending; + protected boolean isalive; + protected int Xp; + + + + + public Player(String name, int hp, int mp, Weapon weapon, Armor armor , int fistDamage) { this.name = name; this.hp = hp; + this.maxHP=hp; this.mp = mp; - + this.maxMP = mp; this.weapon = weapon; this.armor = armor; + this.isDefending=false; + this.fistDamage = fistDamage; + this.isalive=true; + this.Xp=0; + + } + + public abstract void specialAbility(Entity target); + + + @Override + public void lightattack(Entity target){ + System.out.println(name + " use light attak " + "| Damge: " + fistDamage); + target.takeDamage(fistDamage); + } @Override - public void attack(Entity target) { + public void heavyattack(Entity target){ + System.out.println(name + " use Heavy attak | Damage " + weapon.getDamage()); target.takeDamage(weapon.getDamage()); + mp -= weapon.getManaCost(); + } @Override public void defend() { - // TODO + System.out.println("Defend mode is active now"); + mp -=12; + isDefending =true; } @Override public void takeDamage(int damage) { - hp -= damage - armor.getDefense(); + + if(isDefending){ + System.out.println("you have Defend this attak (half damage)" ); + damage /= 2; + isDefending = false; + } + if(!armor.checkBreak()){ + System.out.println("you take " + (damage - armor.getDefense()) + + " Damage. armor defend: " + armor.getDefense()); + hp -= damage - armor.getDefense(); + armor.use(this); + } + else { + System.out.println("you take " + (damage - armor.getDefense()) + " Damage"); + hp -=damage; + } + } @Override - public void heal(int health) { + public void healHp(int health) { + System.out.println("you have got " + health + " Hp"); + mp -=14; hp += health; if (hp > maxHP) { hp = maxHP; @@ -48,18 +94,47 @@ public abstract class Player { } @Override - public void fillMana(int mana) { - mp += mana; - if (mp > maxMP) { - mp = maxMP; + public void healMp(int mp) { + System.out.println("you have got " + mp + " Mp"); + mp -=14; + this.mp+= mp; + if (this.mp > maxMP) { + this.mp = maxMP; } } + @Override + public String toString(){ + return name+ " |Hp: " + hp +"/" + maxHP + " | Mp: " +mp +"/" + maxMP + "| Xp:" +this.Xp ; + } + + + @Override + public void repair(){ + this.Xp +=1; + this.maxHP +=5; + this.maxMP +=5; + this.hp = maxHP; + this.mp += (maxMP / 4); + armor.repair(); + System.out.println( "Repair: we full your Hp , repair your armor and give you some Mp"); + } + + public void setKing(){ + this.maxHP =1000; + this.hp=maxHP; + this.maxMP = 1000; + this.mp = maxMP; + armor.repair(); + } + + @Override public String getName() { return name; } + @Override public int getHp() { return hp; } @@ -69,21 +144,35 @@ public abstract class Player { return maxHP; } + @Override public int getMp() { return mp; } + @Override + public boolean getpossible(){ return true;} + @Override public int getMaxMP() { return maxMP; } + @Override public Weapon getWeapon() { return weapon; } + @Override public Armor getArmor() { return armor; } + @Override + public boolean isalive(){ + return hp > 0; + } + + // we should override this function but they are for enemies + public void falsepossible(){} + public void truepossible(){} } diff --git a/Java-Knight/src/main/java/org/project/entity/players/Wizard.class b/Java-Knight/src/main/java/org/project/entity/players/Wizard.class new file mode 100644 index 0000000..b544c87 Binary files /dev/null and b/Java-Knight/src/main/java/org/project/entity/players/Wizard.class differ 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..02e5320 --- /dev/null +++ b/Java-Knight/src/main/java/org/project/entity/players/Wizard.java @@ -0,0 +1,24 @@ +package org.project.entity.players; + +import org.project.entity.Entity; +import org.project.item.armors.leatherArmor; +import org.project.item.weapons.wood; + +public class Wizard extends Player{ + public Wizard(String name){ + super("\uD83E\uDDD9\u200D♂\uFE0F " +name+"(Wizard)" , 90 , 60 , new wood() , new leatherArmor() , 7 ); + } + + public void specialAbility(Entity target){ + System.out.println(this.getName() + "use special ability"); + mp -= 30; + target.takeDamage(weapon.getDamage() + fistDamage); + this.hp += 30; + System.out.println(toString()+ "have got 30 Hp"); + if(hp > maxHP){ + hp = maxHP; + } + } + + +} diff --git a/Java-Knight/src/main/java/org/project/item/Item.class b/Java-Knight/src/main/java/org/project/item/Item.class new file mode 100644 index 0000000..3db1242 Binary files /dev/null and b/Java-Knight/src/main/java/org/project/item/Item.class differ 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..e2bec96 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 - */ } diff --git a/Java-Knight/src/main/java/org/project/item/armors/Armor.class b/Java-Knight/src/main/java/org/project/item/armors/Armor.class new file mode 100644 index 0000000..1bcb03f Binary files /dev/null and b/Java-Knight/src/main/java/org/project/item/armors/Armor.class differ 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..507497a 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,7 +1,10 @@ package org.project.item.armors; +import org.project.entity.Entity; +import org.project.item.Item; + // TODO: UPDATE IMPLEMENTATION -public abstract class Armor { +public abstract class Armor implements Item { private int defense; private int maxDefense; private int durability; @@ -12,16 +15,33 @@ public abstract class Armor { public Armor(int defense, int durability) { this.defense = defense; this.durability = durability; + this.maxDurability = durability; + this.maxDefense = defense; } - public void checkBreak() { + public void use(Entity target){ + durability -= defense; + } + + + public boolean checkBreak() { + if(isBroke){ // if armor broke by dragon return true + return true; + } if (durability <= 0) { isBroke = true; defense = 0; + return true; + } + else { + isBroke= false; + return false; + + } + } - // TODO: (BONUS) UPDATE THE REPAIR METHOD public void repair() { isBroke = false; defense = maxDefense; @@ -36,7 +56,19 @@ public abstract class Armor { return durability; } + public void setMaxDefense(int maxDefense) { + this.maxDefense = maxDefense; + } + + public void setMaxDurability(int maxDurability) { + this.maxDurability = maxDurability; + } + public boolean isBroke() { return isBroke; } + + public void brokeArmor(){ + isBroke =true; + } // for dragon attak } diff --git a/Java-Knight/src/main/java/org/project/item/armors/EnemyArmor.class b/Java-Knight/src/main/java/org/project/item/armors/EnemyArmor.class new file mode 100644 index 0000000..38ddf55 Binary files /dev/null and b/Java-Knight/src/main/java/org/project/item/armors/EnemyArmor.class differ diff --git a/Java-Knight/src/main/java/org/project/item/armors/EnemyArmor.java b/Java-Knight/src/main/java/org/project/item/armors/EnemyArmor.java new file mode 100644 index 0000000..f6449da --- /dev/null +++ b/Java-Knight/src/main/java/org/project/item/armors/EnemyArmor.java @@ -0,0 +1,7 @@ +package org.project.item.armors; + +public class EnemyArmor extends Armor{ + public EnemyArmor(){ + super(2 , 10); + } +} diff --git a/Java-Knight/src/main/java/org/project/item/armors/KnightArmor.class b/Java-Knight/src/main/java/org/project/item/armors/KnightArmor.class new file mode 100644 index 0000000..4bb0f6f Binary files /dev/null and b/Java-Knight/src/main/java/org/project/item/armors/KnightArmor.class differ 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..cd23aca 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,9 @@ 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(5 , 20); + } } \ No newline at end of file diff --git a/Java-Knight/src/main/java/org/project/item/armors/leatherArmor.class b/Java-Knight/src/main/java/org/project/item/armors/leatherArmor.class new file mode 100644 index 0000000..2722c70 Binary files /dev/null and b/Java-Knight/src/main/java/org/project/item/armors/leatherArmor.class differ diff --git a/Java-Knight/src/main/java/org/project/item/armors/leatherArmor.java b/Java-Knight/src/main/java/org/project/item/armors/leatherArmor.java new file mode 100644 index 0000000..0e55961 --- /dev/null +++ b/Java-Knight/src/main/java/org/project/item/armors/leatherArmor.java @@ -0,0 +1,7 @@ +package org.project.item.armors; + +public class leatherArmor extends Armor { + public leatherArmor(){ + super(4 , 20); + } +} diff --git a/Java-Knight/src/main/java/org/project/item/armors/woodenArmor.class b/Java-Knight/src/main/java/org/project/item/armors/woodenArmor.class new file mode 100644 index 0000000..96ede18 Binary files /dev/null and b/Java-Knight/src/main/java/org/project/item/armors/woodenArmor.class differ diff --git a/Java-Knight/src/main/java/org/project/item/armors/woodenArmor.java b/Java-Knight/src/main/java/org/project/item/armors/woodenArmor.java new file mode 100644 index 0000000..da9f5b1 --- /dev/null +++ b/Java-Knight/src/main/java/org/project/item/armors/woodenArmor.java @@ -0,0 +1,7 @@ +package org.project.item.armors; + +public class woodenArmor extends Armor{ + public woodenArmor(){ + super(4 , 16); + } +} diff --git a/Java-Knight/src/main/java/org/project/item/consumables/Consumable.class b/Java-Knight/src/main/java/org/project/item/consumables/Consumable.class new file mode 100644 index 0000000..ebd23ad Binary files /dev/null and b/Java-Knight/src/main/java/org/project/item/consumables/Consumable.class differ 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..417155e 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,11 @@ package org.project.item.consumables; -// TODO: UPDATE IMPLEMENTATION -public abstract class Consumable { - /* - TODO: ADD OTHER REQUIRED AND BONUS METHODS - */ +import org.project.entity.Entity; +import org.project.item.Item; + + +public abstract class Consumable implements Item { + + public abstract void use(Entity target); + } diff --git a/Java-Knight/src/main/java/org/project/item/consumables/Flask.class b/Java-Knight/src/main/java/org/project/item/consumables/Flask.class new file mode 100644 index 0000000..1e49293 Binary files /dev/null and b/Java-Knight/src/main/java/org/project/item/consumables/Flask.class differ 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..5f2bf40 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,11 @@ package org.project.item.consumables; import org.project.entity.Entity; -// TODO: UPDATE IMPLEMENTATION -public class Flask { - /* - THIS IS AN EXAMPLE OF A CONSUMABLE DESIGN. - */ +public class Flask extends Consumable { - // TODO: UPDATE USE METHOD @Override public void use(Entity target) { - target.heal(target.getMaxHP() / 10); + target.healHp(target.getMaxHP() / 2); } + } diff --git a/Java-Knight/src/main/java/org/project/item/consumables/Teriak.class b/Java-Knight/src/main/java/org/project/item/consumables/Teriak.class new file mode 100644 index 0000000..091a4b2 Binary files /dev/null and b/Java-Knight/src/main/java/org/project/item/consumables/Teriak.class differ diff --git a/Java-Knight/src/main/java/org/project/item/consumables/Teriak.java b/Java-Knight/src/main/java/org/project/item/consumables/Teriak.java new file mode 100644 index 0000000..b94bd97 --- /dev/null +++ b/Java-Knight/src/main/java/org/project/item/consumables/Teriak.java @@ -0,0 +1,12 @@ +package org.project.item.consumables; + +import org.project.entity.Entity; + +public class Teriak extends Consumable{ + + @Override + public void use(Entity target) { + target.healMp(target.getMaxMP() / 2); + } + +} diff --git a/Java-Knight/src/main/java/org/project/item/weapons/DragonWepon.class b/Java-Knight/src/main/java/org/project/item/weapons/DragonWepon.class new file mode 100644 index 0000000..6e35018 Binary files /dev/null and b/Java-Knight/src/main/java/org/project/item/weapons/DragonWepon.class differ diff --git a/Java-Knight/src/main/java/org/project/item/weapons/DragonWepon.java b/Java-Knight/src/main/java/org/project/item/weapons/DragonWepon.java new file mode 100644 index 0000000..080ea52 --- /dev/null +++ b/Java-Knight/src/main/java/org/project/item/weapons/DragonWepon.java @@ -0,0 +1,16 @@ +package org.project.item.weapons; + +import org.project.entity.Entity; + +public class DragonWepon extends Weapon{ + + public DragonWepon(){ + super(25 , 10); + } + + public void use(Entity target){ + target.takeDamage(this.getDamage()+ target.getArmor().getDefense()); + } + + +} diff --git a/Java-Knight/src/main/java/org/project/item/weapons/Sword.class b/Java-Knight/src/main/java/org/project/item/weapons/Sword.class new file mode 100644 index 0000000..ffc8751 Binary files /dev/null and b/Java-Knight/src/main/java/org/project/item/weapons/Sword.class differ 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..1ee3f71 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 @@ -4,23 +4,8 @@ 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 { public Sword() { - // TODO: DESIGN SWORD'S ATTRIBUTES IMPLEMENT THE CONSTRUCTOR - } - - // TODO: (BONUS) UPDATE THE UNIQUE ABILITY - public void uniqueAbility(ArrayList targets) { - abilityCharge += 2; - for (Entity target : targets) { - target.takeDamage(getDamage()); - } + super( 23 , 8); } } diff --git a/Java-Knight/src/main/java/org/project/item/weapons/Weapon.class b/Java-Knight/src/main/java/org/project/item/weapons/Weapon.class new file mode 100644 index 0000000..bd9ac08 Binary files /dev/null and b/Java-Knight/src/main/java/org/project/item/weapons/Weapon.class differ 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..676d086 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,15 +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 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; @@ -29,7 +26,4 @@ public abstract class Weapon { return manaCost; } - /* - TODO: ADD OTHER REQUIRED AND BONUS METHODS - */ } diff --git a/Java-Knight/src/main/java/org/project/item/weapons/knife.class b/Java-Knight/src/main/java/org/project/item/weapons/knife.class new file mode 100644 index 0000000..eecd190 Binary files /dev/null and b/Java-Knight/src/main/java/org/project/item/weapons/knife.class differ diff --git a/Java-Knight/src/main/java/org/project/item/weapons/knife.java b/Java-Knight/src/main/java/org/project/item/weapons/knife.java new file mode 100644 index 0000000..8a67796 --- /dev/null +++ b/Java-Knight/src/main/java/org/project/item/weapons/knife.java @@ -0,0 +1,7 @@ +package org.project.item.weapons; + +public class knife extends Weapon{ + public knife(){ + super(18 , 8); + } +} diff --git a/Java-Knight/src/main/java/org/project/item/weapons/wood.class b/Java-Knight/src/main/java/org/project/item/weapons/wood.class new file mode 100644 index 0000000..7f01656 Binary files /dev/null and b/Java-Knight/src/main/java/org/project/item/weapons/wood.class differ diff --git a/Java-Knight/src/main/java/org/project/item/weapons/wood.java b/Java-Knight/src/main/java/org/project/item/weapons/wood.java new file mode 100644 index 0000000..67851cc --- /dev/null +++ b/Java-Knight/src/main/java/org/project/item/weapons/wood.java @@ -0,0 +1,8 @@ +package org.project.item.weapons; + +public class wood extends Weapon{ + + public wood(){ + super(16, 8); + } +} diff --git a/Java-Knight/src/main/java/org/project/location/Location.class b/Java-Knight/src/main/java/org/project/location/Location.class new file mode 100644 index 0000000..ccf5ab4 Binary files /dev/null and b/Java-Knight/src/main/java/org/project/location/Location.class differ 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..0c59ec8 100644 --- a/Java-Knight/src/main/java/org/project/location/Location.java +++ b/Java-Knight/src/main/java/org/project/location/Location.java @@ -1,28 +1,28 @@ package org.project.location; +import org.project.entity.Entity; 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 java.util.ArrayList; public class Location { private String name; + private Entity enemie; - private ArrayList enemies; - - public Location(ArrayList locations, ArrayList enemies) { - this.locations = locations; - this.enemies = enemies; + public Location(String name, Entity enemie) { + this.name = name; + this.enemie = enemie; } public String getName() { return name; } - public ArrayList getLocations() { - return locations; + public Entity getEnemie() { + return enemie; } - public ArrayList getEnemies() { - return enemies; - } } 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..cfbf971 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..95425d7 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..8624c15 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..ca29172 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..7a56216 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..b9a3f5c 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..9f048a9 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..44185f6 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 new file mode 100644 index 0000000..391fb6b 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..75e643b 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..06c1506 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..bef4b72 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/EnemyArmor.class b/Java-Knight/target/classes/org/project/item/armors/EnemyArmor.class new file mode 100644 index 0000000..f1fb0de Binary files /dev/null and b/Java-Knight/target/classes/org/project/item/armors/EnemyArmor.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..598fe2c 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/armors/leatherArmor.class b/Java-Knight/target/classes/org/project/item/armors/leatherArmor.class new file mode 100644 index 0000000..5088285 Binary files /dev/null and b/Java-Knight/target/classes/org/project/item/armors/leatherArmor.class differ diff --git a/Java-Knight/target/classes/org/project/item/armors/woodenArmor.class b/Java-Knight/target/classes/org/project/item/armors/woodenArmor.class new file mode 100644 index 0000000..0b01a8b Binary files /dev/null and b/Java-Knight/target/classes/org/project/item/armors/woodenArmor.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..2b9e334 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..0d6a6f8 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/consumables/Teriak.class b/Java-Knight/target/classes/org/project/item/consumables/Teriak.class new file mode 100644 index 0000000..1769811 Binary files /dev/null and b/Java-Knight/target/classes/org/project/item/consumables/Teriak.class differ diff --git a/Java-Knight/target/classes/org/project/item/weapons/DragonWepon.class b/Java-Knight/target/classes/org/project/item/weapons/DragonWepon.class new file mode 100644 index 0000000..6947e93 Binary files /dev/null and b/Java-Knight/target/classes/org/project/item/weapons/DragonWepon.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..59df483 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..aba5e91 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/item/weapons/knife.class b/Java-Knight/target/classes/org/project/item/weapons/knife.class new file mode 100644 index 0000000..d5c8755 Binary files /dev/null and b/Java-Knight/target/classes/org/project/item/weapons/knife.class differ diff --git a/Java-Knight/target/classes/org/project/item/weapons/wood.class b/Java-Knight/target/classes/org/project/item/weapons/wood.class new file mode 100644 index 0000000..61f2fc7 Binary files /dev/null and b/Java-Knight/target/classes/org/project/item/weapons/wood.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..47e5cfb Binary files /dev/null and b/Java-Knight/target/classes/org/project/location/Location.class differ diff --git a/README.md b/README.md index 1e2c975..b9dbf7e 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Fourth Assignment - Java Knight ⚔️ A turn-based RPG with Roguelike elements which can be run in the terminal. -### **Prologue: The Legend of Javanest** +## **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!* ### **Introduction** diff --git a/README1.MD b/README1.MD new file mode 100644 index 0000000..2bdfd27 --- /dev/null +++ b/README1.MD @@ -0,0 +1,86 @@ +# HELLO and Welcom to Java-knight⚔️ + +--- + +## Introduction + + +Goguryeo has been conquered by the dragon mercenary of Emperor Tso. As the savior of Goguryeo, you must conquer it. To do this, you must first obtain 3 keys.Each enemy army has 1 key, but we do not know which member of that army has it. Fight them to obtain the keys. Then go fight the dragon and become the ruler of Goguryeo. Dont forget java knight is a turn-based game and enemy can attak you. + +--- + +## HOW TO RUN GAME + + first you should go to project file and open src\main\java folder then open terminal and use this promote to compile project + + +```bash +javac org/project/Main.java +``` + +then use this promte to run the game + +``` +java org.project.Main +``` + +Now you can play! + +## About game + +--- +Hp: is your heart + +Mp : is your mana + +Xp : is your experiences + +**After any fight if you win . we will full your Hp and give you some Mp and you got 1 Xp and we add 5 Mp&Hp to MaxHP&Hp** + +At first you shout choose your player (Knight - Wizard - Assassin) + +- **⚔️Knight**: Hp:50 Mp:50 Weapon:sword(23 Damage) + +- **🗡️Assassin**: HP:60 Mp:80 Weapon: knife(18 damage) + +- **🧙‍♂️WIZARS**: HP:90 Mp:60 Weapon: wood(16 damage) + +After that you should choose your location. in each location exist one enemy such as: + +- **Goblin** 👹: Hp:35 Weapon: knife(18 Damage) Special : critical attack +- **Skeleton** ☠️: Hp:50 Weapon: wood(16 Damage) Special: relive after dead +- **Vampire** 🦇: Hp: 60 Weapon : wood(16 Damage) Special : rob Hp +- **Dragon (Final Boss)** 🐉: Hp: 200 Weapon:fire(25 Damage) Special : Fire + break Armor + +In each turn enemy can use 1.light attack 2.heavy attack 3 special abilities + +Player in each turn can use : +1. **Light Attack:** Deals moderate damage and costs **NO Mana**. (Note: If the player runs out of Mana/Stamina, this is the ONLY action they can perform.) +2. **Heavy Attack:** Deals high damage, medium Mana cost. +3. **Defend:** Completely blocks or significantly reduces the damage of the enemy's *next* strike. Medium Mana cost. +4. **Heal:** Restores a portion of the player's HP. Medium-high Mana cost. +- 4.1 Flask : Give you Hp +- 4.2 Teriak : Give you Mp +5. **Special Ability:** A unique class-based ultimate move (Highest Mana cost): + - **Wizard** 🧙‍♂️: Casts a devastating spell that damages the enemy while simultaneously replenishing some HP. + - **Assassin** 🗡️: Turns invisible, dodging the next incoming attack completely and guaranteeing a *Critical Hit* on their next turn. + - **Knight** ⚔️: Performs a shield bash that stuns the enemy, forcing them to skip their next turn while dealing heavy damage. + +--- +## About oop +In this project we use oop. we have 2 interface + +1. Entity +- **Player**(Knight - Wizard - Assassin) +- **Enemy**(Goblin - Skeleton - vampire - Dragon) + +2. Item +- **Armors**(Enemy armor - Knight armor - leather armor - wooden armor) +- **Consumable**(Flask - Teriak) +- **Weapon** (Sword - Weapon - Wood - DragonWeapon) + + + +--- +### **For control game you should input number . if you input invalid number you should input again** +![cover](Readme_Pictures/image.png) \ No newline at end of file