public override void Apply(ZoneGenContext zoneContext, IGenContext context, StablePriorityQueue <Priority, IGenStep> queue)
        {
            ItemSpawnStep <BaseMapGenContext> spawnStep = new ItemSpawnStep <BaseMapGenContext>();

            spawnStep.Spawns = Spawns.GetSpawnList(zoneContext.CurrentID);
            queue.Enqueue(Priority, spawnStep);
        }
示例#2
0
        public override void Apply(ZoneGenContext zoneContext, IGenContext context, StablePriorityQueue <Priority, IGenStep> queue)
        {
            //find the first postproc that is a GridRoom postproc and add this to its special rooms
            //NOTE: if a room-based generator is not found as the generation step, it will just skip this floor but treat it as though it was placed.
            if (SpreadPlan.CheckIfDistributed(zoneContext, context))
            {
                //TODO: allow arbitrary components to be added
                RoomGenOption genDuo = Spawns.Pick(context.Rand);
                SetGridSpecialRoomStep <MapGenContext> specialStep     = new SetGridSpecialRoomStep <MapGenContext>();
                SetSpecialRoomStep <ListMapGenContext> listSpecialStep = new SetSpecialRoomStep <ListMapGenContext>();

                specialStep.Filters = genDuo.Filters;
                if (specialStep.CanApply(context))
                {
                    specialStep.Rooms = new PresetPicker <RoomGen <MapGenContext> >(genDuo.GridOption);
                    specialStep.RoomComponents.Set(new ImmutableRoom());
                    queue.Enqueue(PriorityGrid, specialStep);
                }
                else if (listSpecialStep.CanApply(context))
                {
                    listSpecialStep.Rooms = new PresetPicker <RoomGen <ListMapGenContext> >(genDuo.ListOption);
                    listSpecialStep.RoomComponents.Set(new ImmutableRoom());
                    PresetPicker <PermissiveRoomGen <ListMapGenContext> > picker = new PresetPicker <PermissiveRoomGen <ListMapGenContext> >();
                    picker.ToSpawn        = new RoomGenAngledHall <ListMapGenContext>(0);
                    listSpecialStep.Halls = picker;
                    queue.Enqueue(PriorityList, listSpecialStep);
                }
            }
        }
示例#3
0
 public override void Apply(ZoneGenContext zoneContext, IGenContext context, StablePriorityQueue <Priority, IGenStep> queue)
 {
     if (SpreadPlan.CheckIfDistributed(zoneContext, context))
     {
         IGenPriority genStep = Spawns.Pick(context.Rand);
         queue.Enqueue(genStep.Priority, genStep.GetItem());
     }
 }
示例#4
0
 public override IGenContext GetMap(ZoneGenContext zoneContext)
 {
     if (zoneContext.CurrentID < Floors.Count)
     {
         return(Floors[zoneContext.CurrentID].GenMap(zoneContext));
     }
     else
     {
         throw new Exception("Requested a map id out of range.");
     }
 }
        public override void Apply(ZoneGenContext zoneContext, IGenContext context, StablePriorityQueue <Priority, IGenStep> queue)
        {
            TileSpawnStep <BaseMapGenContext> spawnStep = new TileSpawnStep <BaseMapGenContext>();

            SpawnList <EffectTile> spawner = Spawns.GetSpawnList(zoneContext.CurrentID);

            for (int ii = 0; ii < spawner.Count; ii++)
            {
                spawnStep.Spawns.Add(spawner.GetSpawn(ii), spawner.GetSpawnRate(ii));
            }

            queue.Enqueue(Priority, spawnStep);
        }
示例#6
0
        public override void Apply(ZoneGenContext zoneContext, IGenContext context, StablePriorityQueue <Priority, IGenStep> queue)
        {
            MobSpawnStep <BaseMapGenContext> spawnStep = new MobSpawnStep <BaseMapGenContext>();

            PoolTeamSpawner spawner = new PoolTeamSpawner();

            spawner.Spawns    = Spawns.GetSpawnList(zoneContext.CurrentID);
            spawner.TeamSizes = TeamSizes.GetSpawnList(zoneContext.CurrentID);
            spawnStep.Spawns.Add(spawner, spawner.Spawns.SpawnTotal);

            SpawnList <SpecificTeamSpawner> specificSpawner = SpecificSpawns.GetSpawnList(zoneContext.CurrentID);

            for (int ii = 0; ii < specificSpawner.Count; ii++)
            {
                spawnStep.Spawns.Add(specificSpawner.GetSpawn(ii), specificSpawner.GetSpawnRate(ii));
            }

            queue.Enqueue(Priority, spawnStep);
        }
示例#7
0
        public override void Apply(ZoneGenContext zoneContext, IGenContext context, StablePriorityQueue <Priority, IGenStep> queue)
        {
            SpawnDict <string, SpawnList <InvItem> > spawns = new SpawnDict <string, SpawnList <InvItem> >();

            //contains all LISTS that intersect the current ID
            foreach (string key in Spawns.Keys)
            {
                //get all items within the spawnrangelist that intersect the current ID
                SpawnList <InvItem> slicedList = Spawns[key].Spawns.GetSpawnList(zoneContext.CurrentID);

                // add the spawnlist under the current key, with the key having the spawnrate for this id
                if (slicedList.CanPick && Spawns[key].SpawnRates.ContainsItem(zoneContext.CurrentID) && Spawns[key].SpawnRates[zoneContext.CurrentID] > 0)
                {
                    spawns.Add(key, slicedList, Spawns[key].SpawnRates[zoneContext.CurrentID]);
                }
            }

            ItemSpawnStep <BaseMapGenContext> spawnStep = new ItemSpawnStep <BaseMapGenContext>();

            spawnStep.Spawns = spawns;
            queue.Enqueue(Priority, spawnStep);
        }
示例#8
0
        public IGenContext GenMap(ZoneGenContext zoneContext)
        {
            //it will first create the instance of the context,
            //and set up a local List<GenPriority<IGenStep>> variable
            //the zonecontext members include runtime zonepostprocs
            //that will appreciate a IGenContext + List<GenPriority<IGenStep>> being passed into them
            //then, gensteps will continue on as per usual

            T map = (T)Activator.CreateInstance(typeof(T));

            map.InitSeed(zoneContext.Seed);

            GenContextDebug.DebugInit(map);

            //postprocessing steps:
            StablePriorityQueue <Priority, IGenStep> queue = new StablePriorityQueue <Priority, IGenStep>();

            foreach (Priority priority in GenSteps.GetPriorities())
            {
                foreach (IGenStep genStep in GenSteps.GetItems(priority))
                {
                    queue.Enqueue(priority, genStep);
                }
            }

            foreach (ZonePostProc zoneStep in zoneContext.ZoneSteps)
            {
                zoneStep.Apply(zoneContext, map, queue);
            }

            ApplyGenSteps(map, queue);

            map.FinishGen();

            return(map);
        }
示例#9
0
 public override void Apply(ZoneGenContext zoneContext, IGenContext context, StablePriorityQueue <Priority, IGenStep> queue)
 {
     queue.Enqueue(Priority, new MapNameIDStep <BaseMapGenContext>(zoneContext.CurrentID, LocalText.FormatLocalText(Name, (zoneContext.CurrentID + 1).ToString())));
 }
示例#10
0
 public abstract void Apply(ZoneGenContext zoneContext, IGenContext context, StablePriorityQueue <Priority, IGenStep> queue);
示例#11
0
 public abstract IGenContext GetMap(ZoneGenContext zoneContext);
        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));
        }
示例#13
0
 public override bool CheckIfDistributed(ZoneGenContext zoneContext, IGenContext context)
 {
     return(FloorRange.Contains(zoneContext.CurrentID) && context.Rand.Next(100) < Chance);
 }
示例#14
0
 public abstract bool CheckIfDistributed(ZoneGenContext zoneContext, IGenContext context);
示例#15
0
 public override bool CheckIfDistributed(ZoneGenContext zoneContext, IGenContext context)
 {
     return(dropPoints.Contains(zoneContext.CurrentID));
 }