// Fill out your copyright notice in the Description page of Project Settings. #include "EatableItems.h" #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) { if(Character) { if(isHealingItem) { if (Character->Health < 100) { /*Character->Health += 10; UE_LOG(LogTemp, Display, TEXT("Healed")); Character->Inventory->RemoveItem(this);*/ UStatusSystem* StatusSystem = Cast(Character); StatusSystem->AddStatusEffect(NewObject(this, HealOverTimeStatusEffect)); } else if (Character->Health >= 100) { UE_LOG(LogTemp, Display, TEXT("Health is full")); } } if(isDamageBuffItem) { // need to add the damage buff functionality here UE_LOG(LogTemp, Display, TEXT("Damage Buffed")); Character->Inventory->RemoveItem(this); } if (isAmmoItemType) { TurnBaseCombat = GetWorld()->GetGameState(); if (TurnBaseCombat->IronResource > 10) { TurnBaseCombat->IronResource += 5; } if (TurnBaseCombat->SulfurResource > 10) { TurnBaseCombat->SulfurResource += 5; } Character->Inventory->RemoveItem(this); } } }