Section 13 complete, Damage numbers, added Block chance and Critical Hit chance
This commit is contained in:
@@ -9,6 +9,9 @@
|
||||
#include "GameFramework/Character.h"
|
||||
#include "Net/UnrealNetwork.h"
|
||||
#include "AuraGameplayTags.h"
|
||||
#include "Interact/CombatInterface.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
#include "Player/AuraPlayerController.h"
|
||||
|
||||
UAuraAttributeSet::UAuraAttributeSet()
|
||||
{
|
||||
@@ -104,7 +107,7 @@ void UAuraAttributeSet::SetEffectProperties(const FGameplayEffectModCallbackData
|
||||
}
|
||||
if (Props.SourceController)
|
||||
{
|
||||
ACharacter* SourceCharacter = Cast<ACharacter>(Props.SourceController->GetPawn());
|
||||
Props.SourceCharacter = Cast<ACharacter>(Props.SourceController->GetPawn());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,6 +123,17 @@ void UAuraAttributeSet::SetEffectProperties(const FGameplayEffectModCallbackData
|
||||
}
|
||||
}
|
||||
|
||||
void UAuraAttributeSet::ShowFloatingText(const FEffectProperties& Props, float Damage, bool bCritical, bool bBlocked)
|
||||
{
|
||||
if (Props.SourceCharacter != Props.TargetCharacter)
|
||||
{
|
||||
if (AAuraPlayerController* APC = Cast<AAuraPlayerController>(UGameplayStatics::GetPlayerController(Props.SourceCharacter, 0)))
|
||||
{
|
||||
APC->ShowDamageNumber(Damage, Props.TargetCharacter, bCritical, bBlocked);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UAuraAttributeSet::PostGameplayEffectExecute(const FGameplayEffectModCallbackData& Data)
|
||||
{
|
||||
Super::PostGameplayEffectExecute(Data);
|
||||
@@ -148,8 +162,20 @@ void UAuraAttributeSet::PostGameplayEffectExecute(const FGameplayEffectModCallba
|
||||
|
||||
if (bFatal)
|
||||
{
|
||||
ICombatInterface* CombatInterface = Cast<ICombatInterface>(Props.TargetAvatarActor);
|
||||
if (CombatInterface)
|
||||
{
|
||||
CombatInterface->Die();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FGameplayTagContainer TagContainer;
|
||||
TagContainer.AddTag(FAuraGameplayTags::Get().Combat_HitReact);
|
||||
Props.TargetASC->TryActivateAbilitiesByTag(TagContainer);
|
||||
|
||||
}
|
||||
ShowFloatingText(Props, LocalIncomingDamage, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user