add abilities
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package org.project.abilities;
|
||||
|
||||
import org.project.entity.Entity;
|
||||
|
||||
public class ArcaneStorm extends SpecialAbility{
|
||||
|
||||
/*
|
||||
Wizard use this special ability
|
||||
it Becomes invisible
|
||||
no longer gets damage
|
||||
*/
|
||||
|
||||
public ArcaneStorm() {
|
||||
super("ArcaneStorm",25, 3, AbilityTarget.TARGET);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onApply(Entity target) {
|
||||
super.onApply(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(Entity target) {
|
||||
target.freeze();
|
||||
System.out.println(target.getName() + " is steel Frozen!");
|
||||
reduceDuration();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExpire(Entity self) {
|
||||
System.out.println(self.getName() + "'s special ability onExpired");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package org.project.abilities;
|
||||
|
||||
import org.project.entity.Entity;
|
||||
|
||||
public class BoneStrike extends SpecialAbility{
|
||||
|
||||
/*
|
||||
Skeleton use this special ability
|
||||
its throws bones and damage enemies
|
||||
*/
|
||||
|
||||
private final int damage = 5;
|
||||
|
||||
public BoneStrike() {
|
||||
super("BoneThrow",10, 3, AbilityTarget.TARGET);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onApply(Entity target) {
|
||||
super.onApply(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(Entity target) {
|
||||
target.takeDamage(damage);
|
||||
System.out.println(target.getName() + " suffers from " + getName());
|
||||
reduceDuration();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExpire(Entity self) {
|
||||
System.out.println(self.getName() + "'s special ability onExpired");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package org.project.abilities;
|
||||
|
||||
import org.project.entity.Entity;
|
||||
|
||||
public class GuardianOath extends SpecialAbility{
|
||||
|
||||
/*
|
||||
|
||||
Knight use this special ability
|
||||
The first damage and the knight is completely restrained
|
||||
its gains some health
|
||||
|
||||
*/
|
||||
|
||||
public GuardianOath() {
|
||||
super("GuardianOath",15, 1, AbilityTarget.SELF);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onApply(Entity target) {
|
||||
super.onApply(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(Entity self) {
|
||||
|
||||
self.heal(5);
|
||||
self.defend();
|
||||
System.out.println("Guardian Oath empowers Sir Duncan: +5 HP and 50% Decreased damage.\n ");
|
||||
reduceDuration();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExpire(Entity self) {
|
||||
System.out.println(self.getName() + "'s special ability onExpired");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package org.project.abilities;
|
||||
|
||||
import org.project.entity.Entity;
|
||||
|
||||
public class InfernoBreath extends SpecialAbility{
|
||||
|
||||
/*
|
||||
|
||||
Dragon use this special ability
|
||||
its fiery breath deals huge damage to the enemy
|
||||
|
||||
*/
|
||||
|
||||
private final int breathDamage = 20;
|
||||
|
||||
public InfernoBreath() {
|
||||
super("InfernoBreath",25, 1,AbilityTarget.TARGET);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onApply(Entity target) {
|
||||
super.onApply(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(Entity target) {
|
||||
target.takeDamage(breathDamage);
|
||||
System.out.println("ooooh! " + getName() + " impacted with " + target.getName());
|
||||
reduceDuration();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExpire(Entity self) {
|
||||
super.onExpire(self);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package org.project.abilities;
|
||||
|
||||
import org.project.entity.Entity;
|
||||
|
||||
public class LifeSteal extends SpecialAbility{
|
||||
|
||||
/*
|
||||
|
||||
vampire use this special ability
|
||||
its bite's the enemy's nek
|
||||
|
||||
|
||||
*/
|
||||
|
||||
private final int healAmount = 15;
|
||||
|
||||
public LifeSteal() {
|
||||
|
||||
super("SuckingBlood",15, 1,AbilityTarget.SELF);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onApply(Entity target) {
|
||||
super.onApply(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(Entity self) {
|
||||
self.heal(healAmount);
|
||||
System.out.println(self.getName() + " healed for " + healAmount + " (LifeSteal)");
|
||||
reduceDuration();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExpire(Entity self) {
|
||||
System.out.println(self.getName() + "'s special ability onExpired");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package org.project.abilities;
|
||||
|
||||
import org.project.entity.Entity;
|
||||
import org.project.item.weapons.Dagger;
|
||||
import org.project.weaponEffects.PoisonEffect;
|
||||
import org.w3c.dom.ls.LSOutput;
|
||||
|
||||
public class PoisonDagger extends SpecialAbility{
|
||||
|
||||
/*
|
||||
|
||||
Goblin use this special ability
|
||||
applies poison effect on goblin's weapon
|
||||
|
||||
*/
|
||||
|
||||
private final int poisonDamage = 5;
|
||||
|
||||
public PoisonDagger() {
|
||||
|
||||
super("poisonDagger",15,3,AbilityTarget.SELF);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onApply(Entity target) {
|
||||
super.onApply(target);
|
||||
target.setWeapon(new Dagger(new PoisonEffect()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(Entity self) {
|
||||
|
||||
System.out.println(self.getName() + " used Poisonous Dagger ");
|
||||
reduceDuration();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExpire(Entity target) {
|
||||
target.setWeapon(new Dagger());
|
||||
System.out.println(target.getName() + " no longer has poisonous Dagger");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package org.project.abilities;
|
||||
|
||||
import org.project.entity.Entity;
|
||||
|
||||
public abstract class SpecialAbility {
|
||||
|
||||
public enum AbilityTarget {
|
||||
SELF,
|
||||
TARGET
|
||||
}
|
||||
|
||||
protected String name;
|
||||
protected int manaCost;
|
||||
protected int duration;
|
||||
private final AbilityTarget target;
|
||||
|
||||
public SpecialAbility(String name,int manaCost, int duration, AbilityTarget target) {
|
||||
|
||||
this.name = name;
|
||||
this.manaCost = manaCost;
|
||||
this.duration = duration;
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
public AbilityTarget getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public int getManaCost() {return manaCost;}
|
||||
|
||||
public int getDuration() {
|
||||
return duration;
|
||||
}
|
||||
|
||||
public void reduceDuration() {duration--;}
|
||||
|
||||
public void onApply(Entity target) {System.out.println(target.getName() + " activated " + name);}
|
||||
|
||||
public abstract void onTick(Entity target);
|
||||
|
||||
public void onExpire(Entity target) {}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user