Updated Combat System for Minor Cosmetic Changes

This commit is contained in:
Philip W 2023-05-12 21:45:51 +01:00
parent 2f582cb507
commit b9985228d2
3 changed files with 12 additions and 3 deletions

View File

@ -33,6 +33,11 @@ bool UQuest::WorldStateMatch(UWorldState* A, UWorldState* B)
if (A->Items.IsEmpty() && !B->Items.IsEmpty()) return false;
for (UBaseItem* Item : B->Items)
{
if (A->Items.IndexOfByPredicate([Item](const UBaseItem* AItem) { return AItem->ItemID == Item->ItemID; }) == -1)
{
UE_LOG(LogTemp, Warning, TEXT("WorldState Predicate Failed"));
return false;
}
if (!A->Items.Contains(Item) && Item->StackCount > A->Items[A->Items.IndexOfByPredicate([Item](const UBaseItem* AItem) { return AItem->ItemID == Item->ItemID; })]->StackCount)
{
return false;

View File

@ -48,7 +48,7 @@ public:
UPROPERTY()
UWrapBox* StatusIconsBox;
UPROPERTY()
UPROPERTY(VisibleAnywhere)
TArray<FActiveStatusEffect> ActiveStatusEffects;
protected:

View File

@ -316,6 +316,7 @@ void ATurnBaseCombatV2::ExecuteCast(FString Combo)
StatusSystem->AddStatusEffect(TempThornsStatusEffect, 1, false);
StatusEffects.Add(TempThornsStatusEffect);
AddBattleLogMessage("Player Casted Thorns");
StatusTextBlock->SetColorAndOpacity(FSlateColor(FLinearColor(1.0f, 1.0f, 1.0f, 1.0f)));
StatusTextBlock->SetText(FText::FromString("Casted Thorns"));
const FString Command3 = FString::Printf(TEXT("PlayStatusAnimation"));
HUD->CallFunctionByNameWithArguments(*Command3, AR, nullptr, true);
@ -326,6 +327,7 @@ void ATurnBaseCombatV2::ExecuteCast(FString Combo)
StatusSystem->AddStatusEffect(TempDOTStatusEffect, 1, false);
StatusEffects.Add(TempDOTStatusEffect);
AddBattleLogMessage("Player Casted DOT");
StatusTextBlock->SetColorAndOpacity(FSlateColor(FLinearColor(1.0f, 1.0f, 1.0f, 1.0f)));
StatusTextBlock->SetText(FText::FromString("Casted DOT"));
const FString Command3 = FString::Printf(TEXT("PlayStatusAnimation"));
HUD->CallFunctionByNameWithArguments(*Command3, AR, nullptr, true);
@ -336,6 +338,7 @@ void ATurnBaseCombatV2::ExecuteCast(FString Combo)
StatusSystem->AddStatusEffect(TempDamageDownStatusEffect, 1);
StatusEffects.Add(TempDamageDownStatusEffect);
AddBattleLogMessage("Player Casted DamageDown");
StatusTextBlock->SetColorAndOpacity(FSlateColor(FLinearColor(1.0f, 1.0f, 1.0f, 1.0f)));
StatusTextBlock->SetText(FText::FromString("Enemy Damage Down"));
const FString Command3 = FString::Printf(TEXT("PlayStatusAnimation"));
HUD->CallFunctionByNameWithArguments(*Command3, AR, nullptr, true);
@ -653,7 +656,7 @@ void ATurnBaseCombatV2::RunButtonOnClick()
{
if (FMath::RandRange(0.0f, 1.0f) >= EscapePercentage)
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Escape Failed"));
StatusTextBlock->SetColorAndOpacity(FSlateColor(FLinearColor(1.0f, 0.0f, 0.0f, 1.0f)));
StatusTextBlock->SetText(FText::FromString("Escape Failed"));
FOutputDeviceNull AR;
const FString Command3 = FString::Printf(TEXT("PlayStatusAnimation"));
@ -781,6 +784,7 @@ void ATurnBaseCombatV2::EnemyTurn()
}
else
{
StatusTextBlock->SetColorAndOpacity(FSlateColor(FLinearColor(1.0f, 1.0f, 1.0f, 1.0f)));
StatusTextBlock->SetText(FText::FromString("Missed"));
FOutputDeviceNull AR;
const FString Command3 = FString::Printf(TEXT("PlayStatusAnimation"));
@ -804,6 +808,6 @@ void ATurnBaseCombatV2::ToggleButtonIfResourceAvailable() const
else AButton->SetIsEnabled(false);
if (IroquoidResource >= 1) IButton->SetIsEnabled(true);
else IButton->SetIsEnabled(false);
if (Cast<ATempCharacter>(PlayerActor)->Inventory->GetItemAmount(0) >= 1) HealButton->SetIsEnabled(true);
if (Cast<ATempCharacter>(PlayerActor)->Inventory->GetItemAmount(0) >= 1 && *PlayerHealth < 100.0f) HealButton->SetIsEnabled(true);
else HealButton->SetIsEnabled(false);
}