implement Flask.java (renamed to HealFlask.java)
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
package org.project.item.consumables;
|
||||
|
||||
import org.project.entity.Entity;
|
||||
|
||||
// TODO: UPDATE IMPLEMENTATION
|
||||
public class Flask {
|
||||
/*
|
||||
THIS IS AN EXAMPLE OF A CONSUMABLE DESIGN.
|
||||
*/
|
||||
|
||||
// TODO: UPDATE USE METHOD
|
||||
@Override
|
||||
public void use(Entity target) {
|
||||
target.heal(target.getMaxHP() / 10);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.project.item.consumables;
|
||||
|
||||
import org.project.entity.Entity;
|
||||
import org.project.entity.players.Player;
|
||||
import org.project.item.Item;
|
||||
|
||||
public class HealFlask extends Consumable {
|
||||
|
||||
private int healAmount;
|
||||
|
||||
public HealFlask(String name, int healAmount, int charges) {
|
||||
super(name, healAmount, charges);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void use(Player target) {
|
||||
|
||||
super.use(target);
|
||||
System.out.println(target.getName() + " healed for " + healAmount);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user