bool FGameplayTagRequirements::RequirementsMet(const FGameplayTagContainer& Container) const
{
	bool HasRequired = Container.MatchesAll(RequireTags, true);
	bool HasIgnored = Container.MatchesAny(IgnoreTags, false);

	return HasRequired && !HasIgnored;
}
示例#2
0
float FGAEffectModifiersContainer::GatherMods(const FGameplayTagContainer& TagsIn, const TMap<FGAGameEffectHandle, TArray<FGAGameEffectModifier>>& Data)
{
	//possible optimization when needed - create separate thread.

	float ModifierVal = 0;
	float Add = 0;
	float Multiply = 1;
	float Subtract = 0;
	float Divide = 1;
	float PercentageAdd = 0;
	float PercentageSubtract = 0;
	for (auto It = Data.CreateConstIterator(); It; ++It)
	{
		for (const FGAGameEffectModifier& Test : It->Value)
		{
			if (TagsIn.MatchesAll(Test.RequiredTags, false))
			{
				switch (Test.ModType)
				{
				case EGAAttributeMod::Add:
					Add += Test.Value;
					break;
				case EGAAttributeMod::Multiply:
					Multiply += Test.Value;
					break;
				case EGAAttributeMod::Subtract:
					Subtract += Test.Value;
					break;
				case EGAAttributeMod::Divide:
					Divide += Test.Value;
					break;
				case EGAAttributeMod::PercentageAdd:
					PercentageAdd += Test.Value;
					break;
				case EGAAttributeMod::PercentageSubtract:
					PercentageSubtract += Test.Value;
					break;
				default:
					break;
				}
			}
		}
	}
	ModifierVal = ((Add - Subtract) * Multiply) / Divide;
	ModifierVal = ModifierVal + (ModifierVal * PercentageAdd);
	ModifierVal = ModifierVal - (ModifierVal * PercentageSubtract);
	SCOPE_CYCLE_COUNTER(STAT_GatherModifiers);
	return ModifierVal;
}