Skip to content

Commit

Permalink
[#60] Update Code References to Gameplay Tags for New Tag Names
Browse files Browse the repository at this point in the history
  • Loading branch information
GuyPaddock committed Jul 16, 2024
1 parent 4f2bc67 commit b189594
Show file tree
Hide file tree
Showing 49 changed files with 537 additions and 1,185 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@

#include "CharacterStats/PF2TargetCharacterAttributeStatics.h"

#include "GameplayTags/GameplayEffects/SetByCallerParameters.h"

#include "Libraries/PF2AbilitySystemLibrary.h"

#include "Utilities/PF2GameplayAbilityUtilities.h"

UPF2SimpleDamageExecution::UPF2SimpleDamageExecution() :
DamageParameterTag(FGameplayTag::RequestGameplayTag(this->DamageParameterTagName)),
ResistanceParameterTag(FGameplayTag::RequestGameplayTag(this->ResistanceParameterTagName))
UPF2SimpleDamageExecution::UPF2SimpleDamageExecution()
{
#if WITH_EDITORONLY_DATA
// Expose the damage parameter tag and resistance parameter tag for use in calculations in the editor.
// The ValidTransientAggregatorIdentifiers property only exists for use in the editor. It does NOT exist at run-time
// nor in Shipping builds.
this->ValidTransientAggregatorIdentifiers.AddTag(this->DamageParameterTag);
this->ValidTransientAggregatorIdentifiers.AddTag(this->ResistanceParameterTag);
this->ValidTransientAggregatorIdentifiers.AddTag(Pf2TagGameplayEffectParameterDamage);
this->ValidTransientAggregatorIdentifiers.AddTag(Pf2TagGameplayEffectParameterResistance);
#endif
}

Expand All @@ -46,13 +46,13 @@ void UPF2SimpleDamageExecution::Execute_Implementation(
UPF2AbilitySystemLibrary::BuildEvaluationParameters(Spec);

ExecutionParams.AttemptCalculateTransientAggregatorMagnitude(
this->DamageParameterTag,
Pf2TagGameplayEffectParameterDamage,
EvaluationParameters,
IncomingDamage
);

ExecutionParams.AttemptCalculateTransientAggregatorMagnitude(
this->ResistanceParameterTag,
Pf2TagGameplayEffectParameterResistance,
EvaluationParameters,
Resistance
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
#include "Abilities/Attacks/PF2SpellAttackRollCalculation.h"

UPF2SpellAttackRollCalculation::UPF2SpellAttackRollCalculation() :
UPF2KeyAbilityTemlCalculationBase(TEXT("SpellAttack"), TEXT("SpellcastingAbility"))
UPF2KeyAbilityTemlCalculationBase(TEXT("PF2.Proficiency.SpellAttack"), TEXT("PF2.SpellcastingAbility"))
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,15 @@

#include "Abilities/PF2InteractableAbilityBase.h"

#include "OpenPF2GameFramework.h"

#include "Abilities/PF2EffectCauseWrapper.h"

#include "GameplayTags/Traits/Abilities.h"

UPF2InteractableAbilityBase::UPF2InteractableAbilityBase(): Icon(nullptr)
{
if (!CommonAbilityTag.IsValid())
{
// Rather than crashing the game/engine, we soften this to a log error so that a game designer can still
// correct the error by possibly loading/defining tags.
const FGameplayTag Tag = FGameplayTag::RequestGameplayTag(CommonAbilityTagName, false);

if (Tag.IsValid())
{
CommonAbilityTag = Tag;
}
else
{
UE_LOG(
LogPf2Abilities,
Error,
TEXT("The common ability tag '%s' is missing."),
*(CommonAbilityTagName.ToString())
);
}
}

// Default to "Trait.Ability.Common" on interactable abilities. Game designers can remove this tag on abilities that
// have a pre-req and/or are rare.
this->AbilityTags.AddTag(CommonAbilityTag);
// Default to "PF2.Trait.Ability.Common" on interactable abilities. Game designers can remove this tag on abilities
// that have a pre-req and/or are rare.
this->AbilityTags.AddTag(Pf2TagTraitAbilityCommon);
}

FString UPF2InteractableAbilityBase::GetIdForLogs() const
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@

#include "Abilities/PF2InteractableAbilityInterface.h"

#include "GameplayTags/GameplayAbilities/AbilityTypes.h"

#include "Utilities/PF2ArrayUtilities.h"
#include "Utilities/PF2EnumUtilities.h"
#include "Utilities/PF2InterfaceUtilities.h"
#include "Utilities/PF2LogUtilities.h"

const FName UPF2AbilitySystemComponent::DefaultMovementAbilityTagName = FName(TEXT("GameplayAbility.Type.DefaultMovement"));
const FName UPF2AbilitySystemComponent::DefaultFaceTargetAbilityTagName = FName(TEXT("GameplayAbility.Type.DefaultFaceTarget"));

UPF2AbilitySystemComponent::UPF2AbilitySystemComponent() : Events(nullptr), bAreAbilitiesAvailable(false)
{
const FString DynamicTagsGeFilename =
Expand Down Expand Up @@ -624,7 +623,7 @@ TArray<TScriptInterface<IPF2AbilityBoostInterface>> UPF2AbilitySystemComponent::
TArray<FGameplayAbilitySpec*> MatchingGameplayAbilitySpecs;

this->GetActivatableGameplayAbilitySpecsByAllMatchingTags(
FGameplayTagContainer(PF2GameplayAbilityUtilities::GetTag(FName("GameplayAbility.Type.AbilityBoost"))),
FGameplayTagContainer(Pf2TagGameplayAbilityTypeAbilityBoost),
MatchingGameplayAbilitySpecs,
false
);
Expand Down Expand Up @@ -683,8 +682,7 @@ bool UPF2AbilitySystemComponent::HasDefaultMovementAbility() const

FGameplayAbilitySpecHandle UPF2AbilitySystemComponent::FindDefaultMovementAbilityHandle(bool& bOutMatchFound) const
{
const FGameplayTag MovementTag = PF2GameplayAbilityUtilities::GetTag(DefaultMovementAbilityTagName);
const FGameplayTagContainer SearchTags = FGameplayTagContainer(MovementTag);
const FGameplayTagContainer SearchTags = FGameplayTagContainer(Pf2TagGameplayAbilityTypeDefaultMovement);

return this->FindAbilityHandleByTags(SearchTags, bOutMatchFound, false);
}
Expand All @@ -700,8 +698,7 @@ bool UPF2AbilitySystemComponent::HasDefaultFaceTargetAbility() const

FGameplayAbilitySpecHandle UPF2AbilitySystemComponent::FindDefaultFaceTargetAbilityHandle(bool& bOutMatchFound) const
{
const FGameplayTag FacingTag = PF2GameplayAbilityUtilities::GetTag(DefaultFaceTargetAbilityTagName);
const FGameplayTagContainer SearchTags = FGameplayTagContainer(FacingTag);
const FGameplayTagContainer SearchTags = FGameplayTagContainer(Pf2TagGameplayAbilityTypeDefaultFaceTarget);

return this->FindAbilityHandleByTags(SearchTags, bOutMatchFound, false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,21 @@
#include "CharacterStats/AbilityBoosts/PF2AbilityBoostRuleOptionValidator.h"
#include "CharacterStats/AbilityBoosts/PF2GameplayAbilityTargetData_BoostAbility.h"

#include "GameplayTags/GameplayAbilities/AbilityTypes.h"

UPF2AbilityBoostBase::UPF2AbilityBoostBase()
{
FAbilityTriggerData TriggerData;

TriggerData.TriggerSource = EGameplayAbilityTriggerSource::GameplayEvent;
TriggerData.TriggerTag = GetTriggerTag();
TriggerData.TriggerTag = Pf2TagGameplayAbilityTypeAbilityBoost;

this->AbilityTriggers.Add(TriggerData);

// We don't maintain any local state.
this->InstancingPolicy = EGameplayAbilityInstancingPolicy::NonInstanced;

this->AbilityTags.AddTag(PF2GameplayAbilityUtilities::GetTag(FName("GameplayAbility.Type.AbilityBoost")));
this->AbilityTags.AddTag(Pf2TagGameplayAbilityTypeAbilityBoost);
}

bool UPF2AbilityBoostBase::CheckCost(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

#include "CharacterStats/PF2TargetCharacterAttributeStatics.h"

#include "GameplayTags/GameplayCues.h"

#include "Libraries/PF2AbilitySystemLibrary.h"

#include "Utilities/PF2GameplayAbilityUtilities.h"
Expand All @@ -33,11 +35,6 @@ UPF2ApplyDamageFromSourceExecution::UPF2ApplyDamageFromSourceExecution()
{
this->RelevantAttributesToCapture.Add(*Capture);
}

// Cache the tag to avoid lookup overhead.
this->InflictDamageCueTag = PF2GameplayAbilityUtilities::GetTag(
FName("GameplayCue.Character.InflictDamage")
);
}

void UPF2ApplyDamageFromSourceExecution::Execute_Implementation(
Expand Down Expand Up @@ -139,10 +136,7 @@ void UPF2ApplyDamageFromSourceExecution::Execute_Implementation(

CueParams.RawMagnitude = EffectiveDamage;

TargetAsc->ExecuteGameplayCue(
this->InflictDamageCueTag,
CueParams
);
TargetAsc->ExecuteGameplayCue(Pf2TagGameplayCueCharacterInflictDamage, CueParams);
}
}

Expand All @@ -153,9 +147,6 @@ void UPF2ApplyDamageFromSourceExecution::Execute_Implementation(

CueParams.RawMagnitude = 0;

TargetAsc->ExecuteGameplayCue(
this->InflictDamageCueTag,
CueParams
);
TargetAsc->ExecuteGameplayCue(Pf2TagGameplayCueCharacterInflictDamage, CueParams);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#include "CharacterStats/PF2TargetCharacterAttributeStatics.h"
#include "CharacterStats/PF2TemlCalculation.h"

#include "GameplayTags/Stats/Equipment.h"

#include "Libraries/PF2AbilitySystemLibrary.h"

#include "Utilities/PF2GameplayAbilityUtilities.h"
Expand Down Expand Up @@ -74,7 +76,7 @@ float UPF2ArmorClassCalculation::CalculateArmorTypeProficiencyBonus(const FGamep
{
const FGameplayTagContainer* SourceTags = Spec.CapturedSourceTags.GetAggregatedTags();
const FString ArmorType = DetermineArmorType(SourceTags),
ArmorTypeProficiencyPrefix = "Armor.Category." + ArmorType;
ArmorTypeProficiencyPrefix = TEXT("PF2.Proficiency.Armor.Category.") + ArmorType;

const float ProficiencyBonus = FPF2TemlCalculation(ArmorTypeProficiencyPrefix, Spec).GetValue();

Expand All @@ -92,22 +94,22 @@ float UPF2ArmorClassCalculation::CalculateArmorTypeProficiencyBonus(const FGamep
FString UPF2ArmorClassCalculation::DetermineArmorType(const FGameplayTagContainer* SourceTags) const
{
// Default to no armor.
FString ArmorType = "Unarmored";
FString ArmorType = TEXT("Unarmored");

// Bypass additional checks if the character has no armor equipped, to avoid checking every armor type.
if (PF2GameplayAbilityUtilities::HasTag(SourceTags, FName("Armor.Equipped")))
if (SourceTags->HasTag(Pf2TagEquippedArmor))
{
if (PF2GameplayAbilityUtilities::HasTag(SourceTags, FName("Armor.Equipped.Heavy")))
if (SourceTags->HasTag(Pf2TagEquippedArmorHeavy))
{
ArmorType = "Heavy";
ArmorType = TEXT("Heavy");
}
else if (PF2GameplayAbilityUtilities::HasTag(SourceTags, FName("Armor.Equipped.Medium")))
else if (SourceTags->HasTag(Pf2TagEquippedArmorMedium))
{
ArmorType = "Medium";
ArmorType = TEXT("Medium");
}
else if (PF2GameplayAbilityUtilities::HasTag(SourceTags, FName("Armor.Equipped.Light")))
else if (SourceTags->HasTag(Pf2TagEquippedArmorLight))
{
ArmorType = "Light";
ArmorType = TEXT("Light");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include "OpenPF2GameFramework.h"
#include "PF2CharacterInterface.h"

#include "GameplayTags/GameplayAbilities/WaitForEvents.h"

#include "Libraries/PF2AbilitySystemLibrary.h"

#include "Utilities/PF2InterfaceUtilities.h"
Expand Down Expand Up @@ -100,9 +102,6 @@ UPF2CharacterAttributeSet::UPF2CharacterAttributeSet() :
EncMaxReactionPoints(0.0f),
TmpDamageIncoming(0.0f)
{
// Cache the tags to avoid lookup overhead.
this->DamageReceivedEventTag = PF2GameplayAbilityUtilities::GetTag(DamageReceivedEventTagName);
this->HitPointsChangedEventTag = PF2GameplayAbilityUtilities::GetTag(HitPointsChangedEventTagName);
}

void UPF2CharacterAttributeSet::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
Expand Down Expand Up @@ -671,7 +670,7 @@ void UPF2CharacterAttributeSet::Native_OnDamageIncomingChanged(const FGameplayEf

// Enable condition check GAs to react to incoming damage.
this->EmitGameplayEvent(
DamageReceivedEventTag,
Pf2TagGameplayAbilityWaitForEventDamageReceived,
LocalDamage,
TargetCharacter,
SourceEffectSpec
Expand Down Expand Up @@ -726,7 +725,7 @@ void UPF2CharacterAttributeSet::Native_OnHitPointsChanged(const FGameplayEffectS
}

this->EmitGameplayEvent(
HitPointsChangedEventTag,
Pf2TagGameplayAbilityWaitForEventHitPointsChanged,
ValueDelta,
TargetCharacter,
SourceEffectSpec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
#include "CharacterStats/PF2ClassDifficultyClassCalculation.h"

UPF2ClassDifficultyClassCalculation::UPF2ClassDifficultyClassCalculation() :
UPF2KeyAbilityTemlCalculationBase(TEXT("ClassDc"), TEXT("KeyAbility"), 10.0f)
UPF2KeyAbilityTemlCalculationBase(TEXT("PF2.Proficiency.ClassDc"), TEXT("PF2.KeyAbility"), 10.0f)
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
UPF2KeyAbilityTemlCalculationBase::UPF2KeyAbilityTemlCalculationBase() :
UPF2KeyAbilityTemlCalculationBase(
TEXT(""),
TEXT("KeyAbility")
TEXT("PF2.KeyAbility")
)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
#include "CharacterStats/PF2SpellDifficultyClassCalculation.h"

UPF2SpellDifficultyClassCalculation::UPF2SpellDifficultyClassCalculation() :
UPF2KeyAbilityTemlCalculationBase(TEXT("SpellDc"), TEXT("SpellcastingAbility"), 10.0f)
UPF2KeyAbilityTemlCalculationBase(TEXT("PF2.Proficiency.SpellDc"), TEXT("PF2.SpellcastingAbility"), 10.0f)
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#include "OpenPF2GameFramework.h"

#include "Utilities/PF2GameplayAbilityUtilities.h"

FGameplayTag UPF2TagLibrary::FindChildTag(const FGameplayTagContainer& AllTags,
const FGameplayTag& ParentTag,
bool& bMatchFound)
Expand Down Expand Up @@ -58,8 +60,8 @@ uint8 UPF2TagLibrary::ParseConditionLevel(const FGameplayTag& Tag, const FGamepl

if (Tag.RequestDirectParent().MatchesTagExact(ParentTag))
{
// If ParentTag is "Condition.Dying" and the tag is "Condition.Dying.3", then starting at ParentTag.Len() + 1
// in the tag should give us "3".
// If ParentTag is "PF2.Trait.Condition.Dying" and the tag is "PF2.Trait.Condition.Dying.3", then starting at
// ParentTag.Len() + 1 in the tag should give us "3".
const FString ParentTagString = ParentTag.ToString(),
SuffixString = Tag.ToString().Mid(ParentTagString.Len() + 1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,13 @@
#include "Commands/PF2CharacterCommandInterface.h"
#include "Commands/PF2CommandQueueInterface.h"

#include "GameplayTags/Traits/Conditions.h"

#include "Libraries/PF2CharacterCommandLibrary.h"
#include "Libraries/PF2CharacterLibrary.h"

#include "Utilities/PF2InterfaceUtilities.h"

APF2ModeOfPlayRuleSetBase::APF2ModeOfPlayRuleSetBase()
{
this->DyingConditionTag = PF2GameplayAbilityUtilities::GetTag(DyingConditionTagName);
this->DeadConditionTag = PF2GameplayAbilityUtilities::GetTag(DeadConditionTagName);
this->UnconsciousConditionTag = PF2GameplayAbilityUtilities::GetTag(UnconsciousConditionTagName);
}

void APF2ModeOfPlayRuleSetBase::OnModeOfPlayStart(const EPF2ModeOfPlayType ModeOfPlay)
{
this->BP_OnModeOfPlayStart(ModeOfPlay);
Expand All @@ -52,23 +47,28 @@ void APF2ModeOfPlayRuleSetBase::OnCharacterAddedToEncounter(const TScriptInterfa
}
else
{
// The MoPRS listens for a tag of this type to be added to or removed from a character in order to fire the
// OnCharacterUnconscious() and OnCharacterConscious(), respectively.
this->RegisterTagCallback(
CharacterPtr,
this->UnconsciousConditionTag,
Pf2TagTraitConditionUnconscious,
&APF2ModeOfPlayRuleSetBase::Native_OnCharacterUnconscious,
&APF2ModeOfPlayRuleSetBase::Native_OnCharacterConscious
);

// The MoPRS listens for a tag of this type to be added to or removed from a character in order to fire the
// Native_OnCharacterDying() and Native_OnCharacterRecoveredFromDying(), respectively.
this->RegisterTagCallback(
CharacterPtr,
this->DyingConditionTag,
Pf2TagTraitConditionDying,
&APF2ModeOfPlayRuleSetBase::Native_OnCharacterDying,
&APF2ModeOfPlayRuleSetBase::Native_OnCharacterRecoveredFromDying
);

// The MoPRS listens for a tag of this type to be added to a character in order to fire OnCharacterDead().
this->RegisterTagCallback(
CharacterPtr,
this->DeadConditionTag,
Pf2TagTraitConditionDead,
&APF2ModeOfPlayRuleSetBase::Native_OnCharacterDead,
nullptr
);
Expand Down
Loading

0 comments on commit b189594

Please sign in to comment.