develop #1
@@ -8,7 +8,6 @@ import org.project.entity.players.Assassin;
|
|||||||
import org.project.entity.players.Knight;
|
import org.project.entity.players.Knight;
|
||||||
import org.project.entity.players.Player;
|
import org.project.entity.players.Player;
|
||||||
import org.project.entity.players.Wizard;
|
import org.project.entity.players.Wizard;
|
||||||
import org.project.item.armors.KnightArmor;
|
|
||||||
import org.project.item.weapons.Sword;
|
import org.project.item.weapons.Sword;
|
||||||
import org.project.item.weapons.Weapon;
|
import org.project.item.weapons.Weapon;
|
||||||
import org.project.location.Location;
|
import org.project.location.Location;
|
||||||
@@ -26,9 +25,9 @@ public class Main {
|
|||||||
players.add(new Knight());
|
players.add(new Knight());
|
||||||
players.add(new Wizard());
|
players.add(new Wizard());
|
||||||
ArrayList<Enemy> enemies = new ArrayList<>();
|
ArrayList<Enemy> enemies = new ArrayList<>();
|
||||||
enemies.add(new Goblin(80, 100, wp));
|
enemies.add(new Goblin());
|
||||||
enemies.add(new Skeleton(70, 100, wp));
|
enemies.add(new Skeleton());
|
||||||
enemies.add(new Vampire(90, 90, wp));
|
enemies.add(new Vampire());
|
||||||
ArrayList<Location> locations = new ArrayList<>();
|
ArrayList<Location> locations = new ArrayList<>();
|
||||||
locations.add(new Location("Jungle", enemies));
|
locations.add(new Location("Jungle", enemies));
|
||||||
locations.add(new Location("China", new ArrayList<>(enemies.subList(0, 2))));
|
locations.add(new Location("China", new ArrayList<>(enemies.subList(0, 2))));
|
||||||
@@ -117,20 +116,20 @@ public class Main {
|
|||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
player.heavyAttack(enemy);
|
player.heavyAttack(enemy);
|
||||||
if (player.isSuccessful()) break;
|
if (player.isSuccessfulAction()) break;
|
||||||
else {turn = 0; continue;}
|
else {turn = 0; continue;}
|
||||||
case 3:
|
case 3:
|
||||||
player.defend();
|
player.defend();
|
||||||
if (player.isSuccessful()) break;
|
if (player.isSuccessfulAction()) break;
|
||||||
else {turn = 0; continue;}
|
else {turn = 0; continue;}
|
||||||
case 4:
|
case 4:
|
||||||
player.heal(10);
|
player.heal(10);
|
||||||
if (player.isSuccessful()) break;
|
if (player.isSuccessfulAction()) break;
|
||||||
else {turn = 0; continue;}
|
else {turn = 0; continue;}
|
||||||
|
|
||||||
case 5:
|
case 5:
|
||||||
player.specialAbility(enemy);
|
player.specialAbility(enemy);
|
||||||
if (player.isSuccessful()) break;
|
if (player.isSuccessfulAction()) break;
|
||||||
else {turn = 0; continue;}
|
else {turn = 0; continue;}
|
||||||
default:
|
default:
|
||||||
System.out.println("invalid choice");
|
System.out.println("invalid choice");
|
||||||
@@ -157,15 +156,15 @@ public class Main {
|
|||||||
switch (choice) {
|
switch (choice) {
|
||||||
case 0:
|
case 0:
|
||||||
enemy.attack(player);
|
enemy.attack(player);
|
||||||
if (enemy.isSuccessful()) break;
|
if (enemy.isSuccessfulAction()) break;
|
||||||
else {turn = 1; continue;}
|
else {turn = 1; continue;}
|
||||||
case 1:
|
case 1:
|
||||||
enemy.defend();
|
enemy.defend();
|
||||||
if (enemy.isSuccessful()) break;
|
if (enemy.isSuccessfulAction()) break;
|
||||||
else {turn = 1; continue;}
|
else {turn = 1; continue;}
|
||||||
case 2:
|
case 2:
|
||||||
enemy.heal(10);
|
enemy.heal(10);
|
||||||
if (enemy.isSuccessful()) break;
|
if (enemy.isSuccessfulAction()) break;
|
||||||
else {turn = 1; continue;}
|
else {turn = 1; continue;}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
package org.project.entity.enemies;
|
package org.project.entity.enemies;
|
||||||
|
|
||||||
import org.project.entity.Entity;
|
import org.project.entity.Entity;
|
||||||
import org.project.entity.players.Knight;
|
import org.project.item.weapons.Sword;
|
||||||
import org.project.entity.players.Player;
|
|
||||||
import org.project.item.weapons.Weapon;
|
import org.project.item.weapons.Weapon;
|
||||||
|
|
||||||
|
|
||||||
@@ -17,7 +16,7 @@ public abstract class Enemy implements Entity {
|
|||||||
private double attackMultiplier = 1;
|
private double attackMultiplier = 1;
|
||||||
private boolean hasKey = false;
|
private boolean hasKey = false;
|
||||||
private static boolean keyFound = false;
|
private static boolean keyFound = false;
|
||||||
private boolean successful = true;
|
private boolean successfulAction = true;
|
||||||
|
|
||||||
public Enemy(int hp, int mp, Weapon weapon) {
|
public Enemy(int hp, int mp, Weapon weapon) {
|
||||||
this.hp = hp;
|
this.hp = hp;
|
||||||
@@ -33,17 +32,18 @@ public abstract class Enemy implements Entity {
|
|||||||
if (getMP() >= weapon.getManaCost()) {
|
if (getMP() >= weapon.getManaCost()) {
|
||||||
System.out.println(this.getClass().getSimpleName() + ": attacking " + target.getClass().getSimpleName());
|
System.out.println(this.getClass().getSimpleName() + ": attacking " + target.getClass().getSimpleName());
|
||||||
double damage = getAttackMultiplier() * weapon.getDamage();
|
double damage = getAttackMultiplier() * weapon.getDamage();
|
||||||
|
if(((Sword)(weapon)).charge()) damage *= 1.4;
|
||||||
if (target.isDefending()) {
|
if (target.isDefending()) {
|
||||||
target.takeDamage((int) (damage * (1 - target.getDefendRate())),this);
|
target.takeDamage((int) (damage * (1 - target.getDefendRate())),this);
|
||||||
target.setDefending(false);
|
target.setDefending(false);
|
||||||
} else {
|
} else {
|
||||||
target.takeDamage((int) damage);
|
target.takeDamage((int) damage,this);
|
||||||
}
|
}
|
||||||
setMP(getMP() - weapon.getManaCost());
|
setMP(getMP() - weapon.getManaCost());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
System.out.println("not enough mana");
|
System.out.println("not enough mana");
|
||||||
setSuccessful(false);
|
setSuccessfulAction(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,12 +167,12 @@ public abstract class Enemy implements Entity {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSuccessful (boolean successful) {
|
public void setSuccessfulAction(boolean successfulAction) {
|
||||||
this.successful = successful;
|
this.successfulAction = successfulAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSuccessful() {
|
public boolean isSuccessfulAction() {
|
||||||
return successful;
|
return successfulAction;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package org.project.entity.enemies;
|
package org.project.entity.enemies;
|
||||||
|
|
||||||
import org.project.entity.Entity;
|
import org.project.entity.Entity;
|
||||||
import org.project.item.weapons.Weapon;
|
import org.project.item.weapons.Sword;
|
||||||
|
|
||||||
public class Goblin extends Enemy{
|
public class Goblin extends Enemy{
|
||||||
public Goblin(int hp, int mp, Weapon weapon) {
|
public Goblin() {
|
||||||
super(hp,mp,weapon);
|
super(80,100,new Sword());
|
||||||
setDefendRate(.5);
|
setDefendRate(.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ public class Goblin extends Enemy{
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
System.out.println("Not enough MP");
|
System.out.println("Not enough MP");
|
||||||
setSuccessful(false);
|
setSuccessfulAction(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ public class Goblin extends Enemy{
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
System.out.println("Not enough MP");
|
System.out.println("Not enough MP");
|
||||||
setSuccessful(false);
|
setSuccessfulAction(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,13 +2,13 @@ package org.project.entity.enemies;
|
|||||||
|
|
||||||
|
|
||||||
import org.project.entity.Entity;
|
import org.project.entity.Entity;
|
||||||
import org.project.item.weapons.Weapon;
|
import org.project.item.weapons.Sword;
|
||||||
|
|
||||||
public class Skeleton extends Enemy{
|
public class Skeleton extends Enemy{
|
||||||
|
|
||||||
private boolean incarnation = false;
|
private boolean incarnation = false;
|
||||||
public Skeleton(int hp, int mp, Weapon weapon) {
|
public Skeleton() {
|
||||||
super(hp,mp,weapon);
|
super(70,100,new Sword());
|
||||||
setDefendRate(.3);
|
setDefendRate(.3);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -26,7 +26,7 @@ public class Skeleton extends Enemy{
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
System.out.println("Not enough MP");
|
System.out.println("Not enough MP");
|
||||||
setSuccessful(false);
|
setSuccessfulAction(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ public class Skeleton extends Enemy{
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
System.out.println("Not enough MP");
|
System.out.println("Not enough MP");
|
||||||
setSuccessful(false);
|
setSuccessfulAction(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
package org.project.entity.enemies;
|
package org.project.entity.enemies;
|
||||||
|
|
||||||
import org.project.entity.Entity;
|
import org.project.entity.Entity;
|
||||||
import org.project.item.weapons.Weapon;
|
import org.project.item.weapons.Sword;
|
||||||
|
|
||||||
public class Vampire extends Enemy{
|
public class Vampire extends Enemy{
|
||||||
|
|
||||||
public Vampire(int hp, int mp, Weapon weapon) {
|
public Vampire() {
|
||||||
super(hp,mp,weapon);
|
super(90,90,new Sword());
|
||||||
setDefendRate(.7);
|
setDefendRate(.7);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -18,9 +18,11 @@ public class Vampire extends Enemy{
|
|||||||
setAttackMultiplier(1);
|
setAttackMultiplier(1);
|
||||||
if (target.isDefending()) {
|
if (target.isDefending()) {
|
||||||
heal( (int) (.3 * (damage * (1 - target.getDefendRate()))));
|
heal( (int) (.3 * (damage * (1 - target.getDefendRate()))));
|
||||||
|
setMP(getMP() + 12);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
heal( (int) (.3 * damage));
|
heal( (int) (.3 * damage));
|
||||||
|
setMP(getMP() + 12);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,7 +34,7 @@ public class Vampire extends Enemy{
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
System.out.println("Not enough MP");
|
System.out.println("Not enough MP");
|
||||||
setSuccessful(false);
|
setSuccessfulAction(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,7 +46,7 @@ public class Vampire extends Enemy{
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
System.out.println("Not enough MP");
|
System.out.println("Not enough MP");
|
||||||
setSuccessful(false);
|
setSuccessfulAction(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,8 @@ package org.project.entity.players;
|
|||||||
|
|
||||||
|
|
||||||
import org.project.entity.Entity;
|
import org.project.entity.Entity;
|
||||||
import org.project.item.armors.Armor;
|
|
||||||
import org.project.item.armors.AssassinArmor;
|
import org.project.item.armors.AssassinArmor;
|
||||||
import org.project.item.weapons.Dagger;
|
import org.project.item.weapons.Dagger;
|
||||||
import org.project.item.weapons.Sword;
|
|
||||||
import org.project.item.weapons.Weapon;
|
|
||||||
|
|
||||||
public class Assassin extends Player {
|
public class Assassin extends Player {
|
||||||
|
|
||||||
@@ -44,7 +41,7 @@ public class Assassin extends Player {
|
|||||||
setMP(getMP() - weapon.getManaCost());
|
setMP(getMP() - weapon.getManaCost());
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Not enough MP");
|
System.out.println("Not enough MP");
|
||||||
setSuccessful(false);
|
setSuccessfulAction(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -57,7 +54,7 @@ public class Assassin extends Player {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
System.out.println("Not enough MP");
|
System.out.println("Not enough MP");
|
||||||
setSuccessful(false);
|
setSuccessfulAction(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,7 +67,7 @@ public class Assassin extends Player {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
System.out.println("Not enough MP");
|
System.out.println("Not enough MP");
|
||||||
setSuccessful(false);
|
setSuccessfulAction(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,7 +79,7 @@ public class Assassin extends Player {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
System.out.println("Not enough MP");
|
System.out.println("Not enough MP");
|
||||||
setSuccessful(false);
|
setSuccessfulAction(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,8 @@ package org.project.entity.players;
|
|||||||
|
|
||||||
|
|
||||||
import org.project.entity.Entity;
|
import org.project.entity.Entity;
|
||||||
import org.project.item.armors.Armor;
|
|
||||||
import org.project.item.armors.KnightArmor;
|
import org.project.item.armors.KnightArmor;
|
||||||
import org.project.item.weapons.Dagger;
|
|
||||||
import org.project.item.weapons.Sword;
|
import org.project.item.weapons.Sword;
|
||||||
import org.project.item.weapons.Weapon;
|
|
||||||
|
|
||||||
public class Knight extends Player {
|
public class Knight extends Player {
|
||||||
|
|
||||||
@@ -38,7 +35,7 @@ public class Knight extends Player {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
System.out.println("Not enough MP");
|
System.out.println("Not enough MP");
|
||||||
setSuccessful(false);
|
setSuccessfulAction(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,7 +47,7 @@ public class Knight extends Player {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
System.out.println("Not enough MP");
|
System.out.println("Not enough MP");
|
||||||
setSuccessful(false);
|
setSuccessfulAction(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,7 +74,7 @@ public class Knight extends Player {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
System.out.println("Not enough MP");
|
System.out.println("Not enough MP");
|
||||||
setSuccessful(false);
|
setSuccessfulAction(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public abstract class Player implements Entity, combatOptions {
|
|||||||
private boolean hasGoblinKey = false;
|
private boolean hasGoblinKey = false;
|
||||||
private boolean hasSkeletonKey = false;
|
private boolean hasSkeletonKey = false;
|
||||||
private boolean hasVampireKey = false;
|
private boolean hasVampireKey = false;
|
||||||
private boolean successful = true;
|
private boolean successfulAction = true;
|
||||||
|
|
||||||
public Player(String name, int hp, int mp, Weapon weapon, Armor armor) {
|
public Player(String name, int hp, int mp, Weapon weapon, Armor armor) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@@ -194,12 +194,12 @@ public abstract class Player implements Entity, combatOptions {
|
|||||||
else { hasVampireKey = true; }
|
else { hasVampireKey = true; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSuccessful (boolean successful) {
|
public void setSuccessfulAction(boolean successfulAction) {
|
||||||
this.successful = successful;
|
this.successfulAction = successfulAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSuccessful() {
|
public boolean isSuccessfulAction() {
|
||||||
return successful;
|
return successfulAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,8 @@
|
|||||||
package org.project.entity.players;
|
package org.project.entity.players;
|
||||||
|
|
||||||
import org.project.entity.Entity;
|
import org.project.entity.Entity;
|
||||||
import org.project.item.armors.Armor;
|
|
||||||
import org.project.item.armors.KnightArmor;
|
|
||||||
import org.project.item.armors.WizardArmor;
|
import org.project.item.armors.WizardArmor;
|
||||||
import org.project.item.weapons.Bow;
|
import org.project.item.weapons.Bow;
|
||||||
import org.project.item.weapons.Sword;
|
|
||||||
import org.project.item.weapons.Weapon;
|
|
||||||
|
|
||||||
public class Wizard extends Player{
|
public class Wizard extends Player{
|
||||||
|
|
||||||
@@ -39,7 +35,7 @@ public class Wizard extends Player{
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
System.out.println("Not enough MP");
|
System.out.println("Not enough MP");
|
||||||
setSuccessful(false);
|
setSuccessfulAction(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,7 +47,7 @@ public class Wizard extends Player{
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
System.out.println("Not enough MP");
|
System.out.println("Not enough MP");
|
||||||
setSuccessful(false);
|
setSuccessfulAction(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,7 +62,7 @@ public class Wizard extends Player{
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
System.out.println("Not enough MP");
|
System.out.println("Not enough MP");
|
||||||
setSuccessful(false);
|
setSuccessfulAction(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,7 +74,7 @@ public class Wizard extends Player{
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
System.out.println("Not enough MP");
|
System.out.println("Not enough MP");
|
||||||
setSuccessful(false);
|
setSuccessfulAction(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user