add BurnEffect.java FreezeEffect.java PoisonEffect.java StatusEffect.java
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package org.project.weaponEffects;
|
||||
|
||||
import org.project.entity.Entity;
|
||||
|
||||
public class BurnEffect extends StatusEffect{
|
||||
|
||||
|
||||
public BurnEffect() {
|
||||
super("Burn", 10,5 , 3, StackType.damage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onApply(Entity target) {
|
||||
System.out.println(target.getName() + " is burned!");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package org.project.weaponEffects;
|
||||
|
||||
import org.project.entity.Entity;
|
||||
|
||||
public class FreezeEffect extends StatusEffect{
|
||||
|
||||
public FreezeEffect() {
|
||||
super("Freeze",1,5 , 1, StatusEffect.StackType.damage);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onTick(Entity target) {
|
||||
target.freeze();
|
||||
super.onTick(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExpire(Entity target) {
|
||||
System.out.println(target.getName() + " is Frozen!");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.project.weaponEffects;
|
||||
|
||||
import org.project.entity.Entity;
|
||||
|
||||
public class PoisonEffect extends StatusEffect{
|
||||
|
||||
|
||||
public PoisonEffect() {
|
||||
super("Poison",10,5 , 3, StackType.damage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onApply(Entity target) {
|
||||
System.out.println(target.getName() + " is poisoned!");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package org.project.weaponEffects;
|
||||
|
||||
import org.project.entity.Entity;
|
||||
|
||||
public abstract class StatusEffect {
|
||||
|
||||
public enum StackType {
|
||||
|
||||
none, // this effect is not stackable
|
||||
duration, // in duplication, just duration increases
|
||||
damage,// in duplication, just damage increases
|
||||
both // increases duration and damage
|
||||
}
|
||||
|
||||
protected String name;
|
||||
private int duration;
|
||||
private int equipManaCost;
|
||||
protected int damage;
|
||||
protected StackType stackType;
|
||||
|
||||
|
||||
public StatusEffect(String name, int damage, int equipManaCost, int duration, StackType stackType) {
|
||||
this.name = name;
|
||||
this.damage = damage;
|
||||
this.equipManaCost = equipManaCost;
|
||||
this.duration = duration;
|
||||
this.stackType = stackType;
|
||||
}
|
||||
|
||||
public String getName() { return name; }
|
||||
|
||||
public int getDamage() {
|
||||
return damage;
|
||||
}
|
||||
|
||||
public void setDamage(int damage) {
|
||||
this.damage = damage;
|
||||
}
|
||||
|
||||
public int getDuration() { return duration; }
|
||||
|
||||
public void setDuration(int duration) {
|
||||
this.duration = duration;
|
||||
}
|
||||
|
||||
public StackType getStackType() { return stackType; }
|
||||
|
||||
public int getEquipManaCost() {
|
||||
return equipManaCost;
|
||||
}
|
||||
|
||||
public void reduceDuration() {
|
||||
duration--;
|
||||
}
|
||||
|
||||
public void onApply(Entity target) {}
|
||||
|
||||
public void onTick(Entity target) {
|
||||
target.takeDamage(damage);
|
||||
System.out.println(target.getName() + " suffers " + damage + " damage form " + name);
|
||||
reduceDuration();
|
||||
}
|
||||
|
||||
public void onExpire(Entity target) {System.out.println(target.getName() + " is no longer suffering form " + name);}
|
||||
}
|
||||
Reference in New Issue
Block a user