add Wizard and Assassin class
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
package org.project.entity.players;
|
||||
|
||||
|
||||
import org.project.entity.Entity;
|
||||
import org.project.item.armors.Armor;
|
||||
import org.project.item.weapons.Weapon;
|
||||
|
||||
public class Assassin extends Player {
|
||||
|
||||
public Assassin(String name, int hp, int mp, Weapon weapon, Armor armor) {
|
||||
super(name, hp, mp, weapon, armor);
|
||||
setDefendRate(.7);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void lightAttack(Entity target) {
|
||||
attack(target, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void heavyAttack(Entity target) {
|
||||
if (getMp() >= 8) {
|
||||
attack(target, 2.5);
|
||||
setMp(getMp() - 8);
|
||||
}
|
||||
else {
|
||||
System.out.println("Not enough MP");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void defend() {
|
||||
if (getMp() >= 4) {
|
||||
super.defend();
|
||||
setMp(getMp() - 4);
|
||||
}
|
||||
else {
|
||||
System.out.println("Not enough MP");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void specialAbility(Entity target) {
|
||||
if (getMp() >= 20) {
|
||||
setDefendRate(1);
|
||||
defend();
|
||||
setMp(getMp() - 20);
|
||||
//incomplete
|
||||
}
|
||||
else {
|
||||
System.out.println("Not enough MP");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void heal(int health) {
|
||||
if (getMp() >= 5) {
|
||||
super.heal(health);
|
||||
setMp(getMp() - 5);
|
||||
}
|
||||
else {
|
||||
System.out.println("Not enough MP");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -82,6 +82,13 @@ public abstract class Player implements Entity, combatOptions {
|
||||
return hp;
|
||||
}
|
||||
|
||||
public void fillHp(int hp) {
|
||||
this.hp += hp;
|
||||
if (this.hp > maxHP) {
|
||||
this.hp = maxHP;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxHP() {
|
||||
return maxHP;
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
package org.project.entity.players;
|
||||
|
||||
import org.project.entity.Entity;
|
||||
import org.project.item.armors.Armor;
|
||||
import org.project.item.weapons.Weapon;
|
||||
|
||||
public class Wizard extends Player{
|
||||
|
||||
public Wizard(String name, int hp, int mp, Weapon weapon, Armor armor) {
|
||||
super(name,hp,mp,weapon,armor);
|
||||
setDefendRate(.6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void lightAttack(Entity target) {
|
||||
attack(target, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void heavyAttack(Entity target) {
|
||||
if (getMp() >= 5) {
|
||||
attack(target, 1.6);
|
||||
setMp(getMp() - 5);
|
||||
}
|
||||
else {
|
||||
System.out.println("Not enough MP");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void defend() {
|
||||
if (getMp() >= 4) {
|
||||
super.defend();
|
||||
setMp(getMp() - 4);
|
||||
}
|
||||
else {
|
||||
System.out.println("Not enough MP");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void specialAbility(Entity target) {
|
||||
if (getMp() >= 20) {
|
||||
attack(target, 2);
|
||||
setMp(getMp() - 20);
|
||||
fillHp(10);
|
||||
}
|
||||
else {
|
||||
System.out.println("Not enough MP");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void heal(int health) {
|
||||
if (getMp() >= 5) {
|
||||
super.heal(health);
|
||||
setMp(getMp() - 5);
|
||||
}
|
||||
else {
|
||||
System.out.println("Not enough MP");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user