fix accessory's bugs
This commit is contained in:
@@ -3,6 +3,6 @@ package org.project.Interface;
|
||||
import org.project.entity.Entity;
|
||||
|
||||
public interface IAttachable {
|
||||
public void AttachTo(Entity entity);
|
||||
public void DeattachFrom(Entity entity);
|
||||
public void AttachTo(Entity entity, boolean fromInventory);
|
||||
public void DeattachFrom(Entity entity, boolean toInventory);
|
||||
}
|
||||
|
||||
@@ -45,13 +45,13 @@ public abstract class Accessory extends SellableItem implements IDamageable, IAt
|
||||
|
||||
@Override
|
||||
public void HandleZeroHealth() {
|
||||
this.DeattachFrom(this.Owner);
|
||||
this.DeattachFrom(this.Owner, false);
|
||||
this.Owner.Inventory.remove(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract void AttachTo(Entity entity);
|
||||
public abstract void AttachTo(Entity entity, boolean fromInventory);
|
||||
|
||||
@Override
|
||||
public abstract void DeattachFrom(Entity entity);
|
||||
public abstract void DeattachFrom(Entity entity, boolean toInventory);
|
||||
}
|
||||
|
||||
@@ -35,14 +35,14 @@ public class Costume extends Accessory implements IDefender {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void AttachTo(Entity entity) {
|
||||
entity.RemoveFromInventory(this);
|
||||
public void AttachTo(Entity entity, boolean fromInventory) {
|
||||
if (fromInventory) entity.RemoveFromInventory(this);
|
||||
entity.Costume = this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void DeattachFrom(Entity entity) {
|
||||
public void DeattachFrom(Entity entity, boolean toInventory) {
|
||||
entity.Costume = null;
|
||||
entity.AddToInventory(this);
|
||||
if (toInventory) entity.AddToInventory(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,14 +35,14 @@ public class Shield extends Accessory implements IDefender {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void AttachTo(Entity entity) {
|
||||
entity.RemoveFromInventory(this);
|
||||
public void AttachTo(Entity entity, boolean fromInventory) {
|
||||
if (fromInventory) entity.RemoveFromInventory(this);
|
||||
entity.Shield = this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void DeattachFrom(Entity entity) {
|
||||
public void DeattachFrom(Entity entity, boolean toInventory) {
|
||||
entity.Shield = null;
|
||||
entity.AddToInventory(this);
|
||||
if (toInventory) entity.AddToInventory(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,14 +17,14 @@ public class Weapon extends Accessory implements IDamageUtil {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void AttachTo(Entity entity) {
|
||||
entity.RemoveFromInventory(this);
|
||||
public void AttachTo(Entity entity, boolean fromInventory) {
|
||||
if (fromInventory) entity.RemoveFromInventory(this);
|
||||
entity.Weapon = this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void DeattachFrom(Entity entity) {
|
||||
public void DeattachFrom(Entity entity, boolean toInventory) {
|
||||
entity.Weapon = null;
|
||||
entity.AddToInventory(this);
|
||||
if (toInventory) entity.AddToInventory(this);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user