diff --git a/Content/CombatSystem/Blueprints/Actor/BP_HealthPotion.uasset b/Content/CombatSystem/Blueprints/Actor/BP_HealthPotion.uasset new file mode 100644 index 00000000..acf89d3a Binary files /dev/null and b/Content/CombatSystem/Blueprints/Actor/BP_HealthPotion.uasset differ diff --git a/Content/CombatSystem/Blueprints/Animnotifies/ModifyCurrentStatValue_AN.uasset b/Content/CombatSystem/Blueprints/Animnotifies/ModifyCurrentStatValue_AN.uasset new file mode 100644 index 00000000..667b7509 Binary files /dev/null and b/Content/CombatSystem/Blueprints/Animnotifies/ModifyCurrentStatValue_AN.uasset differ diff --git a/Content/CombatSystem/Blueprints/BP_CombatCharacter.uasset b/Content/CombatSystem/Blueprints/BP_CombatCharacter.uasset index 53788569..4cd5a62f 100644 Binary files a/Content/CombatSystem/Blueprints/BP_CombatCharacter.uasset and b/Content/CombatSystem/Blueprints/BP_CombatCharacter.uasset differ diff --git a/Content/CombatSystem/CourseFiles/SoundFX/Character_Heal01_Cue.uasset b/Content/CombatSystem/CourseFiles/SoundFX/Character_Heal01_Cue.uasset new file mode 100644 index 00000000..75acd7ed Binary files /dev/null and b/Content/CombatSystem/CourseFiles/SoundFX/Character_Heal01_Cue.uasset differ diff --git a/Content/ParagonKwang/Animations/Potion/DrinkingPotion_Anim1.uasset b/Content/ParagonKwang/Animations/Potion/DrinkingPotion_Anim1.uasset new file mode 100644 index 00000000..928d3aee Binary files /dev/null and b/Content/ParagonKwang/Animations/Potion/DrinkingPotion_Anim1.uasset differ diff --git a/Content/ParagonKwang/Animations/Potion/DrinkingPotion_Anim1_Montage.uasset b/Content/ParagonKwang/Animations/Potion/DrinkingPotion_Anim1_Montage.uasset new file mode 100644 index 00000000..b9bc3b1b Binary files /dev/null and b/Content/ParagonKwang/Animations/Potion/DrinkingPotion_Anim1_Montage.uasset differ diff --git a/Source/D1/Actor/BaseConsumable.cpp b/Source/D1/Actor/BaseConsumable.cpp index d4150710..08621069 100644 --- a/Source/D1/Actor/BaseConsumable.cpp +++ b/Source/D1/Actor/BaseConsumable.cpp @@ -3,3 +3,19 @@ #include "Actor/BaseConsumable.h" +#include "Interface/CombatInterface.h" + +ABaseConsumable::ABaseConsumable() +{ + //Settings OwnedGameplayTags + OwnedGameplayTags.AddTag(FCombatGameplayTags::Get().Item_Consumable_Potion); +} + +void ABaseConsumable::UseItem() +{ + ICombatInterface* ActionObjects = Cast(GetOwner()); + if(!ActionObjects) + return; + + ActionObjects->PerformCustomAction(FCombatGameplayTags::Get().Character_Action_Attack_UseItem, FCombatGameplayTags::Get().Character_State_GeneralActionState, UseItemMontage); +} diff --git a/Source/D1/Actor/BaseConsumable.h b/Source/D1/Actor/BaseConsumable.h index bc97e057..8dc11936 100644 --- a/Source/D1/Actor/BaseConsumable.h +++ b/Source/D1/Actor/BaseConsumable.h @@ -13,5 +13,12 @@ UCLASS() class D1_API ABaseConsumable : public ABaseEquippable { GENERATED_BODY() - +public: + ABaseConsumable(); +public: + virtual void UseItem() override; + +private: + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Montage", meta = (AllowPrivateAccess = "true")) + TObjectPtr UseItemMontage; }; diff --git a/Source/D1/Actor/BaseEquippable.h b/Source/D1/Actor/BaseEquippable.h index d2a23240..67fd15a8 100644 --- a/Source/D1/Actor/BaseEquippable.h +++ b/Source/D1/Actor/BaseEquippable.h @@ -44,7 +44,7 @@ protected: UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Initialization") FName AttachSocketName; -private: + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "GameplayTags", meta = (AllowPrivateAccess = "true")) FGameplayTagContainer OwnedGameplayTags; }; diff --git a/Source/D1/CombatPlayerCharacter.cpp b/Source/D1/CombatPlayerCharacter.cpp index 7784d55c..30413115 100644 --- a/Source/D1/CombatPlayerCharacter.cpp +++ b/Source/D1/CombatPlayerCharacter.cpp @@ -128,7 +128,10 @@ void ACombatPlayerCharacter::BeginPlay() { ABaseEquippable* SpawnItem = Cast(GetWorld()->SpawnActor(Equipment, &GetActorTransform(), spawnParam)); if (SpawnItem) + { SpawnItem->OnEquipped(); + EquippedItems.Add(SpawnItem); + } } //Setting Timeline - if you set on Constructor, Can not get Curve @@ -365,6 +368,27 @@ float ACombatPlayerCharacter::PerformAttack(FGameplayTag AttackType, int32 Attac return attackDuration; } +bool ACombatPlayerCharacter::PerformCustomAction(FGameplayTag ActionTag, FGameplayTag StateTag, UAnimMontage* InMontage, float fMontagePlayRate, bool bAutoReset) +{ + + UAnimMontage* actionMontage = InMontage; + if (IsValid(actionMontage)) + { + StateManagerComponent->SetCurrentState(StateTag); + StateManagerComponent->SetCurrentAction(ActionTag); + if(!IsValid(GetMesh()->GetAnimInstance())) + return false; + GetMesh()->GetAnimInstance()->Montage_Play(actionMontage, fMontagePlayRate); + } + else + { + FString str = FString::Printf(TEXT("PerformCustomAction is NOT VALID!!")); + GEngine->AddOnScreenDebugMessage(-1, 3.f, FColor::Red, str); + return false; + } + return true; +} + bool ACombatPlayerCharacter::UseItemByTag(FGameplayTag ItemTag) { for (auto Item : EquippedItems) @@ -581,7 +605,7 @@ void ACombatPlayerCharacter::StopBlocking(const FInputActionValue& Value) void ACombatPlayerCharacter::UseItem(const FInputActionValue& Value) { - + UseItemByTag(FCombatGameplayTags::Get().Item_Consumable); } void ACombatPlayerCharacter::CharacterStateBegin(FGameplayTag CharState) diff --git a/Source/D1/CombatPlayerCharacter.h b/Source/D1/CombatPlayerCharacter.h index 19c9ad87..cc0b134d 100644 --- a/Source/D1/CombatPlayerCharacter.h +++ b/Source/D1/CombatPlayerCharacter.h @@ -131,6 +131,7 @@ public: virtual EMovementSpeedMode GetCombatMovementSpeedMode() override { return GetMovementSpeedMode(); } virtual float PerformAction(FGameplayTag ActionTag, FGameplayTag StateTag, int32 MontageIndex, bool bRandomIndex = false); virtual float PerformAttack(FGameplayTag AttackType, int32 AttackIndex, bool bRandomIndex = false); + virtual bool PerformCustomAction(FGameplayTag ActionTag, FGameplayTag StateTag, UAnimMontage* InMontage, float fMontagePlayRate, bool bAutoReset) override; virtual bool UseItemByTag(FGameplayTag ItemTag) override; // Inherited via IGameplayTagAssetInterface diff --git a/Source/D1/Components/StatsComponent.h b/Source/D1/Components/StatsComponent.h index d8cc31f9..d1acf95b 100644 --- a/Source/D1/Components/StatsComponent.h +++ b/Source/D1/Components/StatsComponent.h @@ -53,7 +53,10 @@ public: void InitializeStats(); void SetCurrentStatValue(EStats stat, float value); float GetCurrentStatValue(EStats stat); + + UFUNCTION(BlueprintCallable) void ModifyCurrentStatValue(EStats stat, float value, bool bShouldRegenerate = true); + void TakeDamageOnStat(float inDamage); void StartRegen(EStats statType); void AfterDelayExecuteRegenStamina(); diff --git a/Source/D1/Definitions/CombatGameplayTags.cpp b/Source/D1/Definitions/CombatGameplayTags.cpp index 65ed7175..320455dd 100644 --- a/Source/D1/Definitions/CombatGameplayTags.cpp +++ b/Source/D1/Definitions/CombatGameplayTags.cpp @@ -129,4 +129,24 @@ void FCombatGameplayTags::InitializeNativeGameplayTags() FName("Character.Action.Attack.Blocking"), FString("Action Attack Blocking") ); + + GameplayTags.Character_Action_Attack_UseItem = UGameplayTagsManager::Get().AddNativeGameplayTag( + FName("Character.Action.Attack.UseItem"), + FString("Action Attack UseItem") + ); + + + /** + * Item + */ + + GameplayTags.Item_Consumable = UGameplayTagsManager::Get().AddNativeGameplayTag( + FName("Item.Consumable"), + FString("Item Consumable") + ); + + GameplayTags.Item_Consumable_Potion = UGameplayTagsManager::Get().AddNativeGameplayTag( + FName("Item.Consumable.Potion"), + FString("Item Consumable Potion") + ); } diff --git a/Source/D1/Definitions/CombatGameplayTags.h b/Source/D1/Definitions/CombatGameplayTags.h index ecdbe86d..437b485f 100644 --- a/Source/D1/Definitions/CombatGameplayTags.h +++ b/Source/D1/Definitions/CombatGameplayTags.h @@ -39,6 +39,11 @@ public: FGameplayTag Character_Action_Attack_MediumRange; FGameplayTag Character_Action_Attack_RareAttack; FGameplayTag Character_Action_Attack_Blocking; + FGameplayTag Character_Action_Attack_UseItem; + + //Item + FGameplayTag Item_Consumable; + FGameplayTag Item_Consumable_Potion; private: static FCombatGameplayTags GameplayTags; diff --git a/Source/D1/Interface/CombatInterface.cpp b/Source/D1/Interface/CombatInterface.cpp index 486649de..8bb20014 100644 --- a/Source/D1/Interface/CombatInterface.cpp +++ b/Source/D1/Interface/CombatInterface.cpp @@ -15,6 +15,12 @@ float ICombatInterface::PerformAttack(FGameplayTag AttackType, int32 AttackIndex return 0.f; } +bool ICombatInterface::PerformCustomAction(FGameplayTag ActionTag, FGameplayTag StateTag, UAnimMontage* InMontage, + float fMontagePlayRate, bool bAutoReset) +{ + return false; +} + bool ICombatInterface::UseItemByTag(FGameplayTag ItemTag) { return false; diff --git a/Source/D1/Interface/CombatInterface.h b/Source/D1/Interface/CombatInterface.h index 97205534..fad25936 100644 --- a/Source/D1/Interface/CombatInterface.h +++ b/Source/D1/Interface/CombatInterface.h @@ -53,6 +53,8 @@ public: UFUNCTION(Category="CombatActions") virtual float PerformAttack(FGameplayTag AttackType, int32 AttackIndex, bool bRandomIndex = false); UFUNCTION(Category="CombatActions") + virtual bool PerformCustomAction(FGameplayTag ActionTag, FGameplayTag StateTag, UAnimMontage* InMontage, float fMontagePlayRate = 1.f, bool bAutoReset = false); + UFUNCTION(Category="CombatActions") virtual bool UseItemByTag(FGameplayTag ItemTag); };