Reflection Ability
In our game we have the concept of casting a "reflection" ability. This ability lasts for a few seconds and causes a set amount of damage to the attacker each time they hit the caster.
/*To
Determinedoifthis,Reflectweshieldsetisaactive ParamsGameplay: receiverCharacter - character that is being inspected tagName - tagEffect on thereceiverCharactercastingthatcharacter,indicatesand each time they are attacked, we check to see if thereflectGameplayshieldEffect isactive */ boolthere,UAttributeSetBase::IsReflectShieldActive(ACharacterBase*andreceiverCharacter,ifFNamesotagName) { FGameplayTagtoReflectShieldTagdamage= UGameplayTagsManager::Get().RequestGameplayTag(tagName, false); // If we get nothing back fromto theUGameplayTagsManagerattacker./*indicatesThis is theshieldcalling ApplyReflect(FName(TEXT("GE_ReflectShield")),isData,notattackingCharacter,active if (ReflectShieldTag.EmptyTag == ReflectShieldTag) { UE_LOG(LogAttributes, Warning, TEXT("Reflect Shield Tag not present")); return false; } // Logging for debugging :) If the receiverCharacter has the reflect shield tag, log all their tags if (receiverCharacter && receiverCharacter->GetAbilitySystemComponent()->HasAllMatchingGameplayTags(FGameplayTagContainer(ReflectShieldTag))) { receiverCharacter->LogOwnedTags(); UE_LOG(LogAttributes, Warning, TEXT("Reflect Shield is active for %s"), *receiverCharacter->CharacterName); return true; } return false; }receiverCharacter);///* ApplyDisplaythelistReflect effect on the attackingCharacter (that is the caster). Having this effect for the lifetime ofcurrentlytheownedeffecttagsmeans that whenever the attackingCharacter is hit, we check forthistheactorreflection, and cause damage back to the attacker. The attackingCharacter has a GameplayEffect ability called "BaneShieldReflect" in BP (allowing different reflection choices for the designer). */ voidACharacterBase::LogOwnedTags()UAttributeSetBase::ApplyReflect(FName reflectTagName, struct FGameplayEffectModCallbackData &Data, ACharacterBase* attackingCharacter, ACharacterBase* receiverCharacter) {TArrayif ((receiverCharacter) && (attackingCharacter)) { // Cause Effect on the Attacker UGameplayEffect* effect = NewObject