add README
This commit is contained in:
@@ -1,26 +0,0 @@
|
||||
package org.project.item.consumables;
|
||||
|
||||
import org.project.item.Item;
|
||||
|
||||
public abstract class Consumable implements Item {
|
||||
|
||||
protected int id;
|
||||
protected String name;
|
||||
protected int amount;
|
||||
|
||||
public Consumable(String name, int id, int amount) {
|
||||
this.name = name;
|
||||
this.id = id;
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package org.project.item.consumables;
|
||||
|
||||
import org.project.entity.Entity;
|
||||
import org.project.entity.players.Player;
|
||||
|
||||
public class Flask extends Consumable{
|
||||
|
||||
private static final int HEAL_AMOUNT = 20;
|
||||
private static final String YELLOW = "\033[33m";
|
||||
public static final String RESET = "\u001B[0m";
|
||||
|
||||
public Flask(String name, int id)
|
||||
{
|
||||
super(name, id, HEAL_AMOUNT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void use(Entity target) {
|
||||
if (target != null && target.isAlive()) {
|
||||
target.heal(HEAL_AMOUNT);
|
||||
Player player = (Player) target;
|
||||
System.out.println("🧪 " + player.getName() + " used Flask! Healed " + HEAL_AMOUNT + " HP.");
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println(YELLOW+"❌ Cannot use Flask on a dead or null target."+RESET);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user