package dungeonmania.entities.collectables;
import dungeonmania.Game;
import dungeonmania.battles.BattleStatistics;
Copyright By Assignmentchef assignmentchef
import dungeonmania.entities.BattleItem;
import dungeonmania.entities.Entity;
import dungeonmania.entities.Player;
import dungeonmania.entities.inventory.InventoryItem;
import dungeonmania.map.GameMap;
import dungeonmania.util.Position;
public class Sword extends Entity implements InventoryItem, BattleItem {
public static final double DEFAULT_ATTACK = 1;
public static final double DEFAULT_ATTACK_SCALE_FACTOR = 1;
public static final int DEFAULT_DURABILITY = 5;
public static final double DEFAULT_DEFENCE = 0;
public static final double DEFAULT_DEFENCE_SCALE_FACTOR = 1;
private int durability;
private double attack;
public Sword(Position position, double attack, int durability) {
super(position);
this.attack = attack;
this.durability = durability;
public boolean canMoveOnto(GameMap map, Entity entity) {
return true;
public void onOverlap(GameMap map, Entity entity) {
if (entity instanceof Player) {
if (!((Player) entity).pickUp(this)) return;
map.destroyEntity(this);
public void onMovedAway(GameMap map, Entity entity) {
public void onDestroy(GameMap gameMap) {
public void use(Game game) {
durability;
if (durability <= 0) {game.getPlayer().remove(this);public BattleStatistics applyBuff(BattleStatistics origin) {return BattleStatistics.applyBuff(origin, new BattleStatistics(public int getDurability() {return durability; CS: assignmentchef QQ: 1823890830 Email: [email protected]
Reviews
There are no reviews yet.