A boss will drop all its items A girl will choose a name from a list (not finalized) Carrots will no longer spawn randomly Lets a message overflow to the next line Added a new method for dropping an item at any location (for Boss.java) Improves backpacks Improves symbols for existing items Added an interact-message to all containers, and removed it from IStatic Makes it possible to get any of the 1-10 items in a chest Makes an item dropped on the same tile as a static container enter the container Code improvements Game end screen
59 lines
1.0 KiB
Java
59 lines
1.0 KiB
Java
package inf101.v18.rogue101.items;
|
|
|
|
import inf101.v18.rogue101.game.IGame;
|
|
import inf101.v18.rogue101.objects.IItem;
|
|
|
|
import java.util.Random;
|
|
|
|
public class Sword implements IMeleeWeapon {
|
|
private static final Random random = new Random();
|
|
private final int damage = 5 + random.nextInt(25);
|
|
private int hp = getMaxHealth();
|
|
|
|
@Override
|
|
public int getWeaponDamage() {
|
|
return damage;
|
|
}
|
|
|
|
@Override
|
|
public int getCurrentHealth() {
|
|
return hp;
|
|
}
|
|
|
|
@Override
|
|
public int getDefence() {
|
|
return 0;
|
|
}
|
|
|
|
@Override
|
|
public int getMaxHealth() {
|
|
return 100;
|
|
}
|
|
|
|
@Override
|
|
public String getName() {
|
|
return "Unknown sword";
|
|
}
|
|
|
|
@Override
|
|
public int getSize() {
|
|
return 2;
|
|
}
|
|
|
|
@Override
|
|
public String getPrintSymbol() {
|
|
return "⚔";
|
|
}
|
|
|
|
@Override
|
|
public String getSymbol() {
|
|
return "S";
|
|
}
|
|
|
|
@Override
|
|
public int handleDamage(IGame game, IItem source, int amount) {
|
|
hp -= amount;
|
|
return amount;
|
|
}
|
|
}
|