diff --git a/core/src/xyz/magicjourney/nebulaquest/entity/Buyable.java b/core/src/xyz/magicjourney/nebulaquest/entity/Buyable.java index 625660e..2aab1d7 100644 --- a/core/src/xyz/magicjourney/nebulaquest/entity/Buyable.java +++ b/core/src/xyz/magicjourney/nebulaquest/entity/Buyable.java @@ -43,8 +43,12 @@ default boolean isDecisionRequired(Player player) { default void sell() { if (this.getOwner().isPresent()) { - this.getOwner().get().giveMoney(this.getValue()); + this.getOwner().get().giveMoney((int) (this.getValue() * 0.7f)); this.setOwner(null); } } + + default int getSellValue() { + return (int) (this.getValue() * 0.7f); + } } diff --git a/core/src/xyz/magicjourney/nebulaquest/ui/panel/views/interactive/DescriptionInteractiveView.java b/core/src/xyz/magicjourney/nebulaquest/ui/panel/views/interactive/DescriptionInteractiveView.java index 938ced6..00f9558 100644 --- a/core/src/xyz/magicjourney/nebulaquest/ui/panel/views/interactive/DescriptionInteractiveView.java +++ b/core/src/xyz/magicjourney/nebulaquest/ui/panel/views/interactive/DescriptionInteractiveView.java @@ -27,6 +27,7 @@ public class DescriptionInteractiveView extends AbstractInteractiveView { protected Label description; protected Label price; protected Label fee; + protected Label sell; protected Label owner; protected Label region; @@ -48,6 +49,7 @@ public DescriptionInteractiveView(AssetManager assets, InteractivePanel parent, this.price = new Label("", this.skin, "small"); this.fee = new Label("", this.skin, "small"); this.owner = new Label("", this.skin, "small"); + this.sell = new Label("", this.skin, "small"); this.sellButton = new ActionButton("Sell", true, assets); this.sellButton.onClick().subscribe(handleSellClick); @@ -87,6 +89,7 @@ public void display(Describable entity) { this.price.setText("Value: " + buyable.getValue()); this.fee.setText("Residence fee: " + buyable.getFee()); this.owner.setText("Owner: " + buyable.getOwner().map((p) -> p.getName()).orElse("Free")); + this.sell.setText("Sell value: " + buyable.getSellValue()); } if (this.icon instanceof Field field) { @@ -139,6 +142,7 @@ protected void createLayout(Describable entity, boolean displayDescription) { this.add(price).row(); this.add(fee).row(); this.add(owner).row(); + this.add(sell).row(); if (buyable.isOwner(this.player)) { this.addSpacer();