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.
/* Determine if Reflect shield is active Params : receiverCharacter - character that is being inspected tagName - tag on the receiverCharacter that indicates the reflect shield is active */ bool UAttributeSetBase::IsReflectShieldActive(ACharacterBase* receiverCharacter, FName tagName) { FGameplayTag ReflectShieldTag = UGameplayTagsManager::Get().RequestGameplayTag(tagName, false); // If we get nothing back from the UGameplayTagsManager indicates the shield is not 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; }
// Display list of currently owned tags for this actor void ACharacterBase::LogOwnedTags() { TArray