From 81d926ffb37e3c78055e730378565144c11e416b Mon Sep 17 00:00:00 2001 From: MH261677 <mh261677@falmouth.ac.uk> Date: Sat, 4 Feb 2023 17:56:25 +0000 Subject: [PATCH] Updated EatableItems.cpp Made it so when the players health is above 100 they cant heal anymore. (Removed healing stacking) --- .../BaseItems/Items/EatableItems.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp b/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp index cc2c535..ceae474 100644 --- a/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp +++ b/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp @@ -18,11 +18,17 @@ void UEatableItems::Use(ATempCharacter* Character) { if(isHealingItem == true) { - Character->Health += 10; - UE_LOG(LogTemp, Display, TEXT("Healed")); - //delete itself - Character->Inventory->RemoveItem(this); - + if (Character->Health < 100) + { + Character->Health += 10; + UE_LOG(LogTemp, Display, TEXT("Healed")); + //delete itself + Character->Inventory->RemoveItem(this); + } + else if (Character->Health >= 100) + { + UE_LOG(LogTemp, Display, TEXT("Health is full")); + } } if(isDamageBuffItem == true) {