diff --git a/Config/DefaultGameplayTags.ini b/Config/DefaultGameplayTags.ini index 40069f9..5189dd3 100644 --- a/Config/DefaultGameplayTags.ini +++ b/Config/DefaultGameplayTags.ini @@ -11,4 +11,5 @@ NetIndexFirstBitSegment=16 +GameplayTagList=(Tag="GameplayCue.Ability.Hero1.Poison",DevComment="") +GameplayTagList=(Tag="GameplayCue.Ability.Hero1.PuhBack",DevComment="") +GameplayTagList=(Tag="GameplayCue.Ability.Hero1.Shield",DevComment="") ++GameplayTagList=(Tag="GameplayCue.DamageReceived.Effect",DevComment="Gameplay cue of a damage received when the damage is trigerred by an effect on the target (such as a dot effect)") diff --git a/Content/Characters/Hero1/Abilities/Poison/GA_Hero1_Poison.uasset b/Content/Characters/Hero1/Abilities/Poison/GA_Hero1_Poison.uasset index 2751904..43f0d93 100644 Binary files a/Content/Characters/Hero1/Abilities/Poison/GA_Hero1_Poison.uasset and b/Content/Characters/Hero1/Abilities/Poison/GA_Hero1_Poison.uasset differ diff --git a/Content/Characters/Hero1/Abilities/Poison/GE_Hero1_Poison_Target.uasset b/Content/Characters/Hero1/Abilities/Poison/GE_Hero1_Poison_Target.uasset index e307caf..0f83203 100644 Binary files a/Content/Characters/Hero1/Abilities/Poison/GE_Hero1_Poison_Target.uasset and b/Content/Characters/Hero1/Abilities/Poison/GE_Hero1_Poison_Target.uasset differ diff --git a/Content/Core/GameplayCues/Damage/CG_DamageReceived.uasset b/Content/Core/GameplayCues/Damage/CG_DamageReceived.uasset index b43a0b8..78c650c 100644 Binary files a/Content/Core/GameplayCues/Damage/CG_DamageReceived.uasset and b/Content/Core/GameplayCues/Damage/CG_DamageReceived.uasset differ diff --git a/Content/Core/GameplayCues/Damage/CG_DamageReceived_Effect.uasset b/Content/Core/GameplayCues/Damage/CG_DamageReceived_Effect.uasset new file mode 100644 index 0000000..7486aab Binary files /dev/null and b/Content/Core/GameplayCues/Damage/CG_DamageReceived_Effect.uasset differ diff --git a/Source/CogSample/CogSampleExecCalculation_Damage.cpp b/Source/CogSample/CogSampleExecCalculation_Damage.cpp index 0b13197..5e5eca0 100644 --- a/Source/CogSample/CogSampleExecCalculation_Damage.cpp +++ b/Source/CogSample/CogSampleExecCalculation_Damage.cpp @@ -122,17 +122,26 @@ void UCogSampleExecCalculation_Damage::Execute_Implementation(const FGameplayEff } } - UCogSampleFunctionLibrary_Damage::ExecuteDamageGameplayCue(TargetAbilitySystem, HitResult, MitigatedDamage, EffectContext, false); + UCogSampleFunctionLibrary_Damage::ExecuteDamageGameplayCue(TargetAbilitySystem, EffectSpec, HitResult, MitigatedDamage, EffectContext, false); } //-------------------------------------------------------------------------------------------------------------------------- void UCogSampleFunctionLibrary_Damage::ExecuteDamageGameplayCue( UCogSampleAbilitySystemComponent* TargetAbilitySystem, + const FGameplayEffectSpec& EffectSpec, const FHitResult& HitResult, float Damage, const FGameplayEffectContextHandle& EffectContext, bool IsPredicted) { + //----------------------------------------------------------------------------------------------------- + // We check for >= 1 instead of >= 0 because we can use damage values between 0 and 1. + //----------------------------------------------------------------------------------------------------- + if (Damage == 0.0f) + { + return; + } + ensure(TargetAbilitySystem); if (TargetAbilitySystem == nullptr) { @@ -154,27 +163,27 @@ void UCogSampleFunctionLibrary_Damage::ExecuteDamageGameplayCue( TypedContext->bGameplayCueIsPredicted = IsPredicted; - //----------------------------------------------------------------------------------------------------- - // We check for >= 1 instead of >= 0 because we can use damage values between 0 and 1. - //----------------------------------------------------------------------------------------------------- - if (Damage > 0.0f) - { - FGameplayCueParameters GameplayCueParameters; - GameplayCueParameters.RawMagnitude = Damage; - GameplayCueParameters.EffectContext = EffectContext; - GameplayCueParameters.Instigator = TypedContext->GetInstigator(); - GameplayCueParameters.EffectCauser = TypedContext->GetEffectCauser(); - GameplayCueParameters.PhysicalMaterial = HitResult.PhysMaterial; - GameplayCueParameters.Location = HitResult.Location; - GameplayCueParameters.Normal = HitResult.ImpactNormal; + FGameplayCueParameters GameplayCueParameters; + GameplayCueParameters.RawMagnitude = Damage; + GameplayCueParameters.EffectContext = EffectContext; + GameplayCueParameters.Instigator = TypedContext->GetInstigator(); + GameplayCueParameters.EffectCauser = TypedContext->GetEffectCauser(); + GameplayCueParameters.PhysicalMaterial = HitResult.PhysMaterial; + GameplayCueParameters.Location = HitResult.Location; + GameplayCueParameters.Normal = HitResult.ImpactNormal; - if (IsPredicted) - { - TargetAbilitySystem->ExecuteGameplayCueLocal(Tag_GameplayCue_DamageReceived, GameplayCueParameters); - } - else - { - TargetAbilitySystem->ExecuteGameplayCue(Tag_GameplayCue_DamageReceived, GameplayCueParameters); - } + TArray Tags; + SpecAssetTags.GetGameplayTagArray(Tags); + + FGameplayTag* FoundTag = Tags.FindByPredicate([](const FGameplayTag& Tag) { return Tag.MatchesTag(Tag_GameplayCue_DamageReceived); }); + FGameplayTag DamageTag = FoundTag != nullptr ? *FoundTag : Tag_GameplayCue_DamageReceived; + + if (IsPredicted) + { + TargetAbilitySystem->ExecuteGameplayCueLocal(DamageTag, GameplayCueParameters); + } + else + { + TargetAbilitySystem->ExecuteGameplayCue(DamageTag, GameplayCueParameters); } } \ No newline at end of file diff --git a/Source/CogSample/CogSampleExecCalculation_Damage.h b/Source/CogSample/CogSampleExecCalculation_Damage.h index 08fbc0b..c3026a2 100644 --- a/Source/CogSample/CogSampleExecCalculation_Damage.h +++ b/Source/CogSample/CogSampleExecCalculation_Damage.h @@ -30,6 +30,7 @@ public: UFUNCTION(BlueprintCallable) static void ExecuteDamageGameplayCue( UCogSampleAbilitySystemComponent* TargetAbilitySystem, + const FGameplayEffectSpec& EffectSpec, const FHitResult& HitResult, float HealthDamage, const FGameplayEffectContextHandle& EffectContext,