debug Consumable.java
This commit is contained in:
@@ -1,8 +1,40 @@
|
||||
package org.project.item.consumables;
|
||||
|
||||
import org.project.entity.players.Player;
|
||||
|
||||
// TODO: UPDATE IMPLEMENTATION
|
||||
public abstract class Consumable {
|
||||
/*
|
||||
TODO: ADD OTHER REQUIRED AND BONUS METHODS
|
||||
*/
|
||||
|
||||
private String name;
|
||||
private int healAmount;
|
||||
private int charges;
|
||||
|
||||
public Consumable(String name, int healAmount, int charges) {
|
||||
this.name = name;
|
||||
this.healAmount = healAmount;
|
||||
this.charges = charges;
|
||||
}
|
||||
|
||||
public void use(Player target) {
|
||||
|
||||
if (charges <= 0) {
|
||||
System.out.println("The flask is empty!");
|
||||
return;
|
||||
}
|
||||
|
||||
target.heal(healAmount);
|
||||
charges--;
|
||||
|
||||
}
|
||||
|
||||
public int getCharges() {
|
||||
return charges;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user