Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
die() {
let level = this._level;
let xy = this._xy;
this.moveTo(null);
actors.remove(this);
let items = this.inventory.getItems();
if (items.length > 0 && level.getEntity(xy) instanceof cells.Floor) {
let item = items.random();
this.inventory.removeItem(item);
level.setItem(xy, item);
}
}