Beispiel #1
0
 public SwitchDetourStep(int sealedTile, int switchTile, RandRange entranceCount, bool timeLimit) : this()
 {
     SealedTile    = sealedTile;
     SwitchTile    = switchTile;
     EntranceCount = entranceCount;
     TimeLimit     = timeLimit;
 }
Beispiel #2
0
 public AddLargeRoomStep(RandRange roomAmount, List <BaseRoomFilter> filters)
     : this()
 {
     RoomAmount     = roomAmount;
     RoomComponents = new ComponentCollection();
     Filters        = filters;
 }
Beispiel #3
0
 public RoomGenWaterRing(ITile waterTerrain, RandRange padWidth, RandRange padHeight, int itemAmount)
 {
     WaterTerrain = waterTerrain;
     PadWidth     = padWidth;
     PadHeight    = padHeight;
     ItemAmount   = itemAmount;
     Treasures    = new SpawnList <MapItem>();
 }
Beispiel #4
0
 /// <summary>
 /// 初始化权值
 /// </summary>
 public virtual void Randomize()
 {
     for (int i = 0; i < InputsCount; i++)
     {
         // 创建在 RandRange.Max 和 RandRange.Min 范围内的随机数
         Weights[i] = RandRange.GetRan();
     }
 }
        protected MoneySpawnZoneStep(MoneySpawnZoneStep other, ulong seed) : this()
        {
            StartAmount = other.StartAmount;
            AddAmount   = other.AddAmount;
            Priority    = other.Priority;

            ReRandom rand = new ReRandom(seed);

            chosenStart = StartAmount.Pick(rand);
            chosenAdd   = AddAmount.Pick(rand);
        }
Beispiel #6
0
 protected RoomGenWaterRing(RoomGenWaterRing <T> other)
 {
     PadWidth   = other.PadWidth;
     PadHeight  = other.PadHeight;
     ItemAmount = other.ItemAmount;
     Treasures  = new SpawnList <MapItem>();
     for (int ii = 0; ii < other.Treasures.Count; ii++)
     {
         Treasures.Add(new MapItem(other.Treasures.GetSpawn(ii)), other.Treasures.GetSpawnRate(ii));
     }
     WaterTerrain = other.WaterTerrain.Copy();
 }
Beispiel #7
0
 protected MobSpawn(MobSpawn other) : this()
 {
     BaseForm = other.BaseForm;
     Tactic   = other.Tactic;
     Level    = other.Level;
     SpecifiedSkills.AddRange(other.SpecifiedSkills);
     Intrinsic = other.Intrinsic;
     foreach (MobSpawnExtra extra in other.SpawnFeatures)
     {
         SpawnFeatures.Add(extra.Copy());
     }
 }
        private string getRangeString(RandRange obj)
        {
            int addMin = 0;
            int addMax = -1;

            if (obj.Min + addMin + 1 >= obj.Max + addMax)
            {
                return(obj.Min.ToString());
            }
            else
            {
                return(string.Format("{0}-{1}", obj.Min + addMin, obj.Max + addMax));
            }
        }
        protected SpreadPlanSpaced(SpreadPlanSpaced other, ulong seed) : base(other, seed)
        {
            FloorSpacing = other.FloorSpacing;
            FloorRange   = other.FloorRange;

            ReRandom rand = new ReRandom(seed);

            dropPoints = new HashSet <int>();

            int currentFloor = FloorRange.Min;

            currentFloor += rand.Next(FloorSpacing.Max);

            while (currentFloor < FloorRange.Max)
            {
                dropPoints.Add(currentFloor);
                currentFloor += FloorSpacing.Pick(rand);
            }
        }
Beispiel #10
0
        public void LoopedRand()
        {
            var            amountRange = new RandRange(3, 6);
            var            valueRange  = new RandRange(0, 4);
            Mock <IRandom> testRand    = new Mock <IRandom>(MockBehavior.Strict);

            testRand.SetupSequence(p => p.Next(3, 6)).Returns(4);
            Moq.Language.ISetupSequentialResult <int> seq = testRand.SetupSequence(p => p.Next(0, 4));
            seq = seq.Returns(0);
            seq = seq.Returns(1);
            seq = seq.Returns(2);
            seq = seq.Returns(3);
            LoopedRand <int> looped  = new LoopedRand <int>(valueRange, amountRange);
            List <int>       result  = looped.Roll(testRand.Object);
            List <int>       compare = new List <int> {
                0, 1, 2, 3
            };

            Assert.That(result, Is.EquivalentTo(compare));
            testRand.Verify(p => p.Next(It.IsAny <int>(), It.IsAny <int>()), Times.Exactly(5));
        }
Beispiel #11
0
 public ReachableBlobWaterStep(RandRange blobs, ITile terrain, int minScale, RandRange startScale) : base(blobs, terrain, minScale, startScale)
 {
 }
Beispiel #12
0
 public MoneySpawnStep(RandRange moneyAmount)
 {
     MoneyRange = new MoneySpawnRange(moneyAmount);
 }
Beispiel #13
0
 public PatternTrapsStep(RandRange trapAmount)
 {
     Amount        = trapAmount;
     Spawns        = new SpawnList <EffectTile>();
     PatternSpawns = new SpawnList <TrapPattern>();
 }
Beispiel #14
0
 public MoneyDivSpawner(RandRange divAmount)
 {
     DivAmount = divAmount;
 }
Beispiel #15
0
 public ItemThemeNone(int specialRatio, RandRange amount) : base(amount)
 {
     SpecialRatio = specialRatio;
 }
Beispiel #16
0
 public PlaceDisconnectedMobsStep(ITeamStepSpawner <T> spawn, RandRange amount) : base(spawn)
 {
     Amount        = amount;
     AcceptedTiles = new List <ITile>();
 }
Beispiel #17
0
 public MobThemeTypingSeeded(EvoFlag allowance, RandRange amount) : base(allowance, amount)
 {
 }
 public SpreadPlanSpaced(RandRange spacing, IntRange floorRange) : base(floorRange)
 {
     FloorSpacing = spacing;
 }
 public MoneySpawnRange(RandRange other)
 {
     Min = other.Min;
     Max = other.Max;
 }
 public MoneySpawnZoneStep(Priority priority, RandRange start, RandRange add)
 {
     Priority    = priority;
     StartAmount = start;
     AddAmount   = add;
 }
 public SpeciesItemListSpawner(IntRange rarity, RandRange amount, params int[] species) : base(rarity, amount)
 {
     this.Species.AddRange(species);
 }
Beispiel #22
0
 public SpeciesItemContextSpawner(IntRange rarity, RandRange amount) : base(rarity, amount)
 {
 }
        public override void Apply(ZoneGenContext zoneContext, IGenContext context, StablePriorityQueue <Priority, IGenStep> queue)
        {
            RandRange amount = new RandRange(chosenStart + chosenAdd * zoneContext.CurrentID);

            queue.Enqueue(Priority, new MoneySpawnStep <BaseMapGenContext>(amount));
        }
Beispiel #24
0
        public override void Apply(T map)
        {
            //TODO: move magic numbers out of here
            EffectTile spawnedChest = new EffectTile(44, true);

            List <Loc> freeTiles = ((IPlaceableGenContext <EffectTile>)map).GetAllFreeTiles();

            int randIndex = map.Rand.Next(freeTiles.Count);
            Loc chosenLoc = freeTiles[randIndex];

            ((IPlaceableGenContext <EffectTile>)map).PlaceItem(chosenLoc, spawnedChest);

            //also put a monster house here
            RandRange       amount     = new RandRange(7, 13);
            int             mobCount   = amount.Pick(map.Rand);
            List <MobSpawn> chosenMobs = new List <MobSpawn>();

            if (map.TeamSpawns.Count > 0)
            {
                for (int ii = 0; ii < mobCount; ii++)
                {
                    List <MobSpawn> exampleList = map.TeamSpawns.Pick(map.Rand).ChooseSpawns(map.Rand);
                    if (exampleList.Count > 0)
                    {
                        chosenMobs.AddRange(exampleList);
                    }
                    if (chosenMobs.Count >= mobCount)
                    {
                        break;
                    }
                }
            }

            if (chosenMobs.Count > 0)
            {
                Rect bounds = new Rect(chosenLoc - new Loc(4), new Loc(9));
                bounds = Rect.Intersect(bounds, new Rect(0, 0, map.Width, map.Height));

                for (int xx = bounds.X; xx < bounds.End.X; xx++)
                {
                    for (int yy = bounds.Y; yy < bounds.End.Y; yy++)
                    {
                        if ((xx == bounds.X || xx == bounds.End.X - 1) && (yy == bounds.Y || yy == bounds.End.Y - 1))
                        {
                            continue;
                        }

                        if (map.GetTile(new Loc(xx, yy)).TileEquivalent(map.WallTerrain))
                        {
                            map.SetTile(new Loc(xx, yy), map.RoomTerrain.Copy());
                        }
                    }
                }

                //cover the room in a check that holds all of the monsters, and covers the room's bounds
                CheckIntrudeBoundsEvent check = new CheckIntrudeBoundsEvent();
                check.Bounds = bounds;
                {
                    MonsterHouseMapEvent house = new MonsterHouseMapEvent();
                    house.Bounds = check.Bounds;
                    foreach (MobSpawn mob in chosenMobs)
                    {
                        house.Mobs.Add(mob.Copy());
                    }
                    check.Effects.Add(house);
                }

                int       intrudeStatus = 33;
                MapStatus status        = new MapStatus(intrudeStatus);
                status.LoadFromData();
                MapCheckState checkState = status.StatusStates.GetWithDefault <MapCheckState>();
                checkState.CheckEvents.Add(check);
                map.Map.Status.Add(intrudeStatus, status);
            }
        }
Beispiel #25
0
 public RoomGenEdgeIn(RandRange width, RandRange height)
 {
     Width  = width;
     Height = height;
 }
Beispiel #26
0
 protected RoomGenEdgeIn(RoomGenEdgeIn <T> other)
 {
     Width  = other.Width;
     Height = other.Height;
 }
Beispiel #27
0
 public SpeciesItemSpawner(IntRange rarity, RandRange amount)
 {
     this.Rarity = rarity;
     this.Amount = amount;
 }
Beispiel #28
0
 /// <summary>
 /// 初始化权值阈值
 /// </summary>
 public override void Randomize()
 {
     base.Randomize();
     Threshold = RandRange.GetRan();
 }
Beispiel #29
0
 public PlaceRandomMobsStep(ITeamStepSpawner <T> spawn, RandRange amount, int clumpFactor) : base(spawn)
 {
     Filters     = new List <BaseRoomFilter>();
     Amount      = amount;
     ClumpFactor = clumpFactor;
 }
Beispiel #30
0
 public MobThemeTypingChosen(EvoFlag allowance, RandRange amount, params int[] types) : base(allowance, amount)
 {
     Types = types;
 }