implement Knight and Wizard and Assassin classes

This commit is contained in:
2026-05-10 16:19:45 +03:30
parent 8decc4d7d8
commit 021a147dcf
3 changed files with 82 additions and 6 deletions
@@ -1,4 +1,27 @@
package org.project.entity.players;
public class Assassin {
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 maxHP, int mp, int maxMP, Weapon weapon, Armor armor) {
super(name, hp, maxHP, mp, maxMP, weapon, armor);
}
@Override
public void attack(Entity target) {
if(reduceMana(getWeapon().getManaCost())){ //checking if the player has enough Mana
setDefensing(true); //dodging the next incoming attack
target.takeDamage(getWeapon().getDamage() * 2); // causing more damage than normal
System.out.println(getName() + " (Assassin \uD83D\uDDE1\uFE0F) turned invisible.");
}
else{
System.out.println(getName() + " (Assassin \uD83D\uDDE1\uFE0F) dose not have enough Mana\n" +
"Choose another action...");
}
}
}
@@ -1,6 +1,33 @@
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.entity.enemies.Enemy;
import org.project.item.armors.Armor;
import org.project.item.weapons.Weapon;
public class Knight extends Player {
public Knight(String name, int hp, int maxHP, int mp, int maxMP, Weapon weapon, Armor armor) {
super(name, hp, maxHP, mp, maxMP, weapon, armor);
}
@Override
public void attack(Entity target) {//heavy attack
if(reduceMana(getWeapon().getManaCost())) { //checking if the player has enough Mana
target.takeDamage(getWeapon().getDamage()); //causing damage
if (target instanceof Enemy) {
Enemy enemy = (Enemy) target;
enemy.setStunned(true); //stun the enemy
}
System.out.println(getName() + " (Knight ⚔️) performed a shield bash that stunned the enemy.");
}
else{
System.out.println(getName() + " (Knight ⚔️) dose not have enough Mana\n" +
"Choose another action...");
}
}
}
@@ -1,4 +1,30 @@
package org.project.entity.players;
public class Wizard {
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 maxHP, int mp, int maxMP, Weapon weapon, Armor armor) {
super(name, hp, maxHP, mp, maxMP, weapon, armor);
}
@Override
public void attack(Entity target) { //heavy attack
Weapon weapon = super.getWeapon();
if(reduceMana(weapon.getManaCost())){ //checking if the player has enough Mana
target.takeDamage(weapon.getDamage()); //causing damage
heal(20); //replenishing HP
System.out.println(getName() + " (Wizard \uD83E\uDDD9\u200D♂\uFE0F) cast a devastating spell");
}
else{
System.out.println(getName() + " (Wizard \uD83E\uDDD9\u200D♂\uFE0F) dose not have enough Mana\n" +
"Choose another action...");
}
}
}