implement Goblin and Skeleton and Vampire
This commit is contained in:
@@ -1,4 +1,33 @@
|
||||
package org.project.entity.enemies;
|
||||
|
||||
public class Goblin {
|
||||
import org.project.entity.players.Player;
|
||||
|
||||
public class Goblin extends Enemy {
|
||||
|
||||
private final static EnemyStats stats = new EnemyStats(60, 12, 20);
|
||||
private final double critChance;
|
||||
private final double critMultiplier;
|
||||
|
||||
public Goblin() {
|
||||
super(stats);
|
||||
critChance = 0.25;
|
||||
critMultiplier = 1.8;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attack(Player target) {
|
||||
|
||||
if(Math.random()<critChance && !isStunned()) {
|
||||
target.takeDamage((int) (stats.damage * critMultiplier));
|
||||
System.out.println("The goblin landed a critical hit!");
|
||||
}
|
||||
else
|
||||
super.attack(target);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return "Goblin";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,30 @@
|
||||
package org.project.entity.enemies;
|
||||
|
||||
// TODO: UPDATE IMPLEMENTATION
|
||||
public class Skeleton {
|
||||
// TODO: DESIGN ENEMY AND IMPLEMENT THE CONSTRUCTOR
|
||||
|
||||
public class Skeleton extends Enemy{
|
||||
|
||||
private final static EnemyStats stats = new EnemyStats(110, 16, 35);
|
||||
private boolean reviveEnabled;
|
||||
|
||||
public Skeleton() {
|
||||
super(stats);
|
||||
reviveEnabled = true;
|
||||
}
|
||||
|
||||
|
||||
public void revive() {
|
||||
if(!isAlive() && reviveEnabled) {
|
||||
heal(getMaxHP() / 2);
|
||||
reviveEnabled = false;
|
||||
System.out.println("the skeleton comes back to life!");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return "Skeleton";
|
||||
}
|
||||
|
||||
public boolean getReviveEnabled() { return reviveEnabled;}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,25 @@
|
||||
package org.project.entity.enemies;
|
||||
|
||||
public class Vampire {
|
||||
import org.project.entity.players.Player;
|
||||
|
||||
public class Vampire extends Enemy{
|
||||
|
||||
private final static EnemyStats stats = new EnemyStats(95, 18, 45);
|
||||
private final int damageDivisor;
|
||||
|
||||
public Vampire() {
|
||||
super(stats);
|
||||
damageDivisor = 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attack(Player target) {
|
||||
super.attack(target);
|
||||
heal(stats.damage/damageDivisor); //a percentage of the damage is added to HP
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return "Vampire";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user