From 618a9509cabf01f97be0b9108653ef5b9bab86d8 Mon Sep 17 00:00:00 2001 From: MH261677 Date: Sun, 19 Feb 2023 15:29:16 +0000 Subject: [PATCH] Updated EatableItems to add ammo {UNSTABLE} Added functionality to the ammo count currently unstable as need to wait for other programmer to understand why it crashes. --- Content/Blueprints/Player/BP_MyTempCharacter.uasset | 4 ++-- Content/Levels/Top_layer_level.umap | 4 ++-- .../the_twilight_abyss/BaseItems/Items/EatableItems.cpp | 9 ++++++++- Source/the_twilight_abyss/BaseItems/Items/EatableItems.h | 6 ++++++ 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Content/Blueprints/Player/BP_MyTempCharacter.uasset b/Content/Blueprints/Player/BP_MyTempCharacter.uasset index 26ace7f..b161173 100644 --- a/Content/Blueprints/Player/BP_MyTempCharacter.uasset +++ b/Content/Blueprints/Player/BP_MyTempCharacter.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8cbb4fe454e40e00845b7b268c15000891cfc86bf0afba299b127f6634fc5edc -size 55495 +oid sha256:8e348a27c5a931226dba531ec739fec1e28b9f912e91b46078ed811fe50f06bd +size 54956 diff --git a/Content/Levels/Top_layer_level.umap b/Content/Levels/Top_layer_level.umap index a836a5f..dbb4467 100644 --- a/Content/Levels/Top_layer_level.umap +++ b/Content/Levels/Top_layer_level.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:483069f41683db60a67e1b2417c5f3cd17005922d2a67500997ebbc20cb3cbba -size 247199 +oid sha256:3ddfcf9a4f7c3b3ab626893a0d6d13cac4483f9a471bbdba97d0d00efc563dd7 +size 248803 diff --git a/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp b/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp index dab88bc..94a308e 100644 --- a/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp +++ b/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp @@ -39,7 +39,14 @@ void UEatableItems::Use(ATempCharacter* Character) if (isAmmoItemType) { - UE_LOG(LogTemp, Display, TEXT("ADD AMMO FUNCTIONALITY HERE")); + if (TurnBaseCombat->IronResource > 10) + { + TurnBaseCombat->IronResource += 5; + } + if (TurnBaseCombat->SulfurResource > 10) + { + TurnBaseCombat->SulfurResource += 5; + } Character->Inventory->RemoveItem(this); } } diff --git a/Source/the_twilight_abyss/BaseItems/Items/EatableItems.h b/Source/the_twilight_abyss/BaseItems/Items/EatableItems.h index d636bcd..dadfc27 100644 --- a/Source/the_twilight_abyss/BaseItems/Items/EatableItems.h +++ b/Source/the_twilight_abyss/BaseItems/Items/EatableItems.h @@ -4,6 +4,7 @@ #include "CoreMinimal.h" #include "BaseItem.h" +#include "the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h" #include "EatableItems.generated.h" /** @@ -19,4 +20,9 @@ class THE_TWILIGHT_ABYSS_API UEatableItems : public UBaseItem protected: virtual void Use(class ATempCharacter* Character) override; + + +private: + + ATurnBaseCombatV2* TurnBaseCombat; };