Skip to content
This repository has been archived by the owner on Nov 21, 2023. It is now read-only.

Commit

Permalink
Fix meat ne veux pas se supprimer
Browse files Browse the repository at this point in the history
  • Loading branch information
naulan-chrzaszcz committed Jun 17, 2022
1 parent 395e471 commit 1c5cc1b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ public enum Item implements StowableObjectType
SILEX,
STONE,
WOOD,
STICK;
STICK,
MEAT;


public static boolean isCoal(StowableObjectType obj) { return obj == Item.COAL; }
Expand All @@ -21,4 +22,5 @@ public enum Item implements StowableObjectType
public static boolean isSilex(StowableObjectType obj) { return obj == Item.SILEX; }
public static boolean isWood(StowableObjectType obj) { return obj == Item.WOOD; }
public static boolean isStick(StowableObjectType obj) { return obj == Item.STICK; }
public static boolean isMeat(StowableObjectType obj) { return obj == Item.MEAT; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import fr.sae.terraria.modele.entities.entity.ConsumableObjectType;
import fr.sae.terraria.modele.entities.entity.StowableObjectType;
import fr.sae.terraria.modele.entities.player.Player;
import fr.sae.terraria.modele.entities.player.inventory.Inventory;
import fr.sae.terraria.modele.entities.player.inventory.Stack;


public class Meat implements ConsumableObjectType, StowableObjectType
Expand All @@ -21,8 +23,11 @@ public Meat(final Environment environment)
{
Environment.playSound("sound/eat.wav", false);

Player player = environment.getPlayer();
Player player = this.environment.getPlayer();
if (player.getPv() < player.getPvMax())
player.setPv(player.getPv() + 1);

Inventory inventory = player.getInventory();
inventory.get().get(inventory.getPosCursor()).remove();
}
}

0 comments on commit 1c5cc1b

Please sign in to comment.