finish
This commit is contained in:
@@ -295,15 +295,15 @@ public class Main {
|
||||
// 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" + RESET);
|
||||
System.out.println(YELLOW + "Congratulation \n You are the kingdom of Gogorio" +
|
||||
" 1000 Hp | 1000 Mp" + RESET);
|
||||
((Player) player).setKing(); // king senario;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int n = (int) (Math.random()*2); // 50% present enemy have key
|
||||
if(n== 0){
|
||||
else if(n== 0){
|
||||
if(enemy instanceof Goblin){
|
||||
if(keys.get(0) == true){
|
||||
System.out.println("You have got this key befor");
|
||||
|
||||
@@ -28,7 +28,10 @@ public abstract class Enemy implements Entity {
|
||||
|
||||
}
|
||||
|
||||
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());
|
||||
@@ -36,13 +39,15 @@ public abstract class Enemy implements Entity {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void heavyattack(Entity target){
|
||||
System.out.println(toString() + " do a heavy attaked with " + weapon.getDamage() * 2 + " damages");
|
||||
target.takeDamage(2 * weapon.getDamage());
|
||||
target.takeDamage((2 * weapon.getDamage()) - 10);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void takeDamage(int damage) {
|
||||
|
||||
if(!armor.checkBreak()){
|
||||
@@ -57,39 +62,37 @@ public abstract class Enemy implements Entity {
|
||||
};
|
||||
}
|
||||
|
||||
@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;}
|
||||
ispossible=true;
|
||||
}
|
||||
|
||||
public boolean getpossible(){
|
||||
return ispossible;
|
||||
}
|
||||
|
||||
public abstract void specialAbility(Entity target);
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isalive(){
|
||||
@@ -99,9 +102,6 @@ public abstract class Enemy implements Entity {
|
||||
@Override
|
||||
public abstract String toString();
|
||||
public String getName(){return "";}
|
||||
|
||||
@Override
|
||||
|
||||
public void repair(){}
|
||||
public void defend() {}
|
||||
public void healHp(int health){}
|
||||
|
||||
@@ -13,7 +13,7 @@ public class Goblin extends Enemy {
|
||||
|
||||
public void specialAbility(Entity target){
|
||||
System.out.println("\uD83D\uDC79 use critical hit");
|
||||
target.takeDamage(2 * weapon.getDamage());
|
||||
target.takeDamage(2 * weapon.getDamage() - 5);
|
||||
this.mp -=10;
|
||||
|
||||
}
|
||||
|
||||
@@ -11,11 +11,13 @@ public class Assassin extends Player{
|
||||
}
|
||||
|
||||
public void specialAbility(Entity target){
|
||||
System.out.println(this.getName() + "use special ability, (you are invisible now");
|
||||
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);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -18,6 +18,9 @@ public abstract class Player implements Entity {
|
||||
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;
|
||||
@@ -33,6 +36,8 @@ public abstract class Player implements Entity {
|
||||
|
||||
}
|
||||
|
||||
public abstract void specialAbility(Entity target);
|
||||
|
||||
|
||||
@Override
|
||||
public void lightattack(Entity target){
|
||||
@@ -99,12 +104,13 @@ public abstract class Player implements Entity {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
return name+ " |Hp: " + hp +"/" + maxHP + " | Mp: " +mp +"/" + maxMP + "| Xp:" +this.Xp ;
|
||||
}
|
||||
|
||||
public abstract void specialAbility(Entity target);
|
||||
|
||||
@Override
|
||||
public void repair(){
|
||||
this.Xp +=1;
|
||||
this.maxHP +=5;
|
||||
@@ -121,14 +127,14 @@ public abstract class Player implements Entity {
|
||||
this.maxMP = 1000;
|
||||
this.mp = maxMP;
|
||||
armor.repair();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getHp() {
|
||||
return hp;
|
||||
}
|
||||
@@ -138,9 +144,12 @@ public abstract class Player implements Entity {
|
||||
return maxHP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMp() {
|
||||
return mp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getpossible(){ return true;}
|
||||
|
||||
@Override
|
||||
@@ -148,11 +157,12 @@ public abstract class Player implements Entity {
|
||||
return maxMP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Weapon getWeapon() {
|
||||
return weapon;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Armor getArmor() {
|
||||
return armor;
|
||||
}
|
||||
@@ -162,7 +172,7 @@ public abstract class Player implements Entity {
|
||||
return hp > 0;
|
||||
}
|
||||
|
||||
|
||||
// we should override this function but they are for enemies
|
||||
public void falsepossible(){}
|
||||
public void truepossible(){}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,11 @@ public class Wizard extends Player{
|
||||
System.out.println(this.getName() + "use special ability");
|
||||
mp -= 30;
|
||||
target.takeDamage(weapon.getDamage() + fistDamage);
|
||||
this.healHp(30);
|
||||
this.hp += 30;
|
||||
System.out.println(toString()+ "have got 30 Hp");
|
||||
if(hp > maxHP){
|
||||
hp = maxHP;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ public abstract class Armor implements Item {
|
||||
|
||||
|
||||
public boolean checkBreak() {
|
||||
if(isBroke){
|
||||
if(isBroke){ // if armor broke by dragon return true
|
||||
return true;
|
||||
}
|
||||
if (durability <= 0) {
|
||||
@@ -70,5 +70,5 @@ public abstract class Armor implements Item {
|
||||
|
||||
public void brokeArmor(){
|
||||
isBroke =true;
|
||||
}
|
||||
} // for dragon attak
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ public class Flask extends Consumable {
|
||||
|
||||
@Override
|
||||
public void use(Entity target) {
|
||||
target.healHp(target.getMaxHP() / 4);
|
||||
target.healHp(target.getMaxHP() / 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,6 @@ package org.project.item.weapons;
|
||||
|
||||
public class knife extends Weapon{
|
||||
public knife(){
|
||||
super(20 , 8);
|
||||
super(15 , 8);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,6 @@ package org.project.item.weapons;
|
||||
public class wood extends Weapon{
|
||||
|
||||
public wood(){
|
||||
super(15, 8);
|
||||
super(16, 8);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user