diff --git a/Content/Blueprints/StatusEffects/BP_HealOverTime.uasset b/Content/Blueprints/StatusEffects/BP_HealOverTime.uasset new file mode 100644 index 0000000..2ff1b6c --- /dev/null +++ b/Content/Blueprints/StatusEffects/BP_HealOverTime.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0aee695b01ab530144e7df203ac7f9f7d4d26683312d3c87a227fdeb924ae856 +size 6057 diff --git a/Content/BungeeMan/Mat_BungeeMan_Rubber.uasset b/Content/BungeeMan/Mat_BungeeMan_Rubber.uasset index d95d86c..3f7a968 100644 --- a/Content/BungeeMan/Mat_BungeeMan_Rubber.uasset +++ b/Content/BungeeMan/Mat_BungeeMan_Rubber.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:603e36c891890c2d263fbb621b4e95eacec250a0744a704fea5f3b1664ad542b -size 7502 +oid sha256:4f30c85ba6aaa8070a5ccb4ab047b6e15e6ac2e0e688d48f1878e3e2a2e4fe06 +size 6590 diff --git a/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp b/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp index c481d7b..c1779aa 100644 --- a/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp +++ b/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp @@ -5,11 +5,13 @@ #include "the_twilight_abyss/BaseItems/InventoryComponent.h" #include "the_twilight_abyss/PlayerTemp/TempCharacter.h" +#include "the_twilight_abyss/TurnBasedCombatV2/StatusSystem.h" UEatableItems::UEatableItems() { - + static ConstructorHelpers::FClassFinder StatusEffectClassFinder(TEXT("/Game/Blueprints/StatusEffects/BP_HealOverTime")); + HealOverTimeStatusEffect = StatusEffectClassFinder.Class; } void UEatableItems::Use(ATempCharacter* Character) @@ -20,9 +22,12 @@ void UEatableItems::Use(ATempCharacter* Character) { if (Character->Health < 100) { - Character->Health += 10; + /*Character->Health += 10; UE_LOG(LogTemp, Display, TEXT("Healed")); - Character->Inventory->RemoveItem(this); + Character->Inventory->RemoveItem(this);*/ + + UStatusSystem* StatusSystem = Cast(Character); + StatusSystem->AddStatusEffect(NewObject(this, HealOverTimeStatusEffect)); } else if (Character->Health >= 100) { diff --git a/Source/the_twilight_abyss/BaseItems/Items/EatableItems.h b/Source/the_twilight_abyss/BaseItems/Items/EatableItems.h index dadfc27..7bb6ddc 100644 --- a/Source/the_twilight_abyss/BaseItems/Items/EatableItems.h +++ b/Source/the_twilight_abyss/BaseItems/Items/EatableItems.h @@ -5,6 +5,7 @@ #include "CoreMinimal.h" #include "BaseItem.h" #include "the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h" +#include "the_twilight_abyss/TurnBasedCombatV2/StatusEffect.h" #include "EatableItems.generated.h" /** @@ -20,7 +21,8 @@ class THE_TWILIGHT_ABYSS_API UEatableItems : public UBaseItem protected: virtual void Use(class ATempCharacter* Character) override; - + UPROPERTY() + TSubclassOf HealOverTimeStatusEffect; private: diff --git a/Source/the_twilight_abyss/TurnBasedCombatV2/StatusSystem.cpp b/Source/the_twilight_abyss/TurnBasedCombatV2/StatusSystem.cpp index 97a4cec..26aa16b 100644 --- a/Source/the_twilight_abyss/TurnBasedCombatV2/StatusSystem.cpp +++ b/Source/the_twilight_abyss/TurnBasedCombatV2/StatusSystem.cpp @@ -53,7 +53,7 @@ void UStatusSystem::TickComponent(float DeltaTime, ELevelTick TickType, FActorCo void UStatusSystem::AddStatusEffect(UStatusEffect* StatusEffect, const float DurationMultiplier) { - FActiveStatusEffect NewStatusEffect; + FActiveStatusEffect NewStatusEffect{}; NewStatusEffect.StatusEffect = StatusEffect; NewStatusEffect.TimeInitiated = UGameplayStatics::GetRealTimeSeconds(GetWorld()); NewStatusEffect.TimeTillExpiry = UGameplayStatics::GetRealTimeSeconds(GetWorld()) + StatusEffect->BaseDuration * DurationMultiplier;