/// <see cref="InfestationAlgorithmBase._runAlgorithm(IAlgorithmContext)"/> protected override void _runAlgorithm(IAlgorithmContext context) { Library _l = context.L; Dungeon _d = context.D; Random _r = context.R; // Add one thing to each group in the dungeon foreach (TileGroupInfo group in _d.Groups.Where(grp => context.Mask.ContainsAny(grp.Tiles))) { InfestationInfo randomItem = _l.AllInfestations.Where(info => info.Category == InfestationType.Item) .Random(_r); _d.Infestations.Associate(group, randomItem); } }
public void SafeAdd(Tile k, InfestationInfo newElement) { if (k == null) { return; } if (newElement == null) { return; } InfestationInfoList valueCollection = null; if (!TryGetValue(k, out valueCollection)) { Add(k, new InfestationInfoList()); } this[k].Add(newElement); }
public void Associate(Tile k, InfestationInfo newElement) { TileInfestations.SafeAdd(k, newElement); }
public void Associate(TileGroupInfo k, InfestationInfo newElement) { GroupInfestations.SafeAdd(k, newElement); }
public void Associate(InfestationInfo newElement) { OverallInfestations.Add(newElement); }