Fix RCS1061

This commit is contained in:
RoosterDragon
2023-03-18 12:16:52 +00:00
committed by Gustas
parent 5d91b678bb
commit 4dd787be13
32 changed files with 167 additions and 210 deletions

View File

@@ -75,11 +75,13 @@ namespace OpenRA.Mods.Common.Traits
// Timed tokens do not count towards the source cap: the condition with the shortest
// remaining duration can always be revoked to make room.
if (Info.SourceCap > 0)
if (permanentTokens.TryGetValue(source, out var permanentTokensForSource) && permanentTokensForSource.Count >= Info.SourceCap)
return false;
if (Info.SourceCap > 0 &&
permanentTokens.TryGetValue(source, out var permanentTokensForSource) &&
permanentTokensForSource.Count >= Info.SourceCap)
return false;
if (Info.TotalCap > 0 && permanentTokens.Values.Sum(t => t.Count) >= Info.TotalCap)
if (Info.TotalCap > 0 &&
permanentTokens.Values.Sum(t => t.Count) >= Info.TotalCap)
return false;
return true;