Example #1
0
        public List <MoneySpawn> GetSpawns(T map)
        {
            MoneySpawn        total        = map.Spawner.Pick(map.Rand);
            int               chosenDiv    = Math.Min(total.Amount, Math.Max(1, DivAmount.Pick(map.Rand)));
            int               avgAmount    = total.Amount / chosenDiv;
            int               currentTotal = 0;
            List <MoneySpawn> results      = new List <MoneySpawn>();

            for (int ii = 0; ii < chosenDiv; ii++)
            {
                int nextTotal = total.Amount;
                if (ii + 1 < chosenDiv)
                {
                    int expectedCurrentTotal = total.Amount * (ii + 1) / chosenDiv;
                    int amount = avgAmount * (/*map.Rand.Next(DIV_DIFF * 2)*/ ((ii % 2 == 0) ? 0 : 99) - DIV_DIFF) / 200;
                    nextTotal = expectedCurrentTotal + amount;
                }
                if (nextTotal > currentTotal)
                {
                    results.Add(new MoneySpawn(nextTotal - currentTotal));
                }
                currentTotal = nextTotal;
            }
            return(results);
        }
Example #2
0
        void IPlaceableGenContext <MoneySpawn> .PlaceItem(Loc loc, MoneySpawn item)
        {
            MapItem newItem = new MapItem(true, item.Amount);

            newItem.TileLoc = loc;
            Items.Add(newItem);
        }
Example #3
0
 public MoneySpawn(MoneySpawn other)
 {
     Amount = other.Amount;
 }