public void SpawnLootAsNeeded(GameContext context, GameObjectBase source, Rarity rarity) { if (rarity >= Rarity.Rare || context.Randomizer.GetInt(1, 6) >= 5) { // Okay, loot is coming. Let's see how good it's gunna be if (context.Randomizer.GetInt(1, 6) >= 5) { // Sweet! Loot upgrade! SpawnLoot(context, source, rarity.Upgrade()); } else { // Cool. You've earned some loot. SpawnLoot(context, source, rarity); } } }