Ejemplo n.º 1
0
        private void AddLockChain(Map <Template, Room> map, ref int tick, Template current, Skid keys)
        {
            if (Roll() <= 10)
            {
                // () - R - L - key
                //        \-(k)- L - ()
                var r       = map.CreateTemplate(TemplateType.RoomChooser);
                var keyL    = map.CreateTemplate(TemplateType.LayoutChooser);
                var lockedL = map.CreateTemplate(TemplateType.LayoutChooser);

                int key = keys.Next();
                current.SwapLeft(r);
                r.ConnectTo(keyL);
                r.ConnectTo(lockedL).Lock = new Key(key);
                keyL.ConnectTo(map.CreateRoom(RoomType.Key, key));
                current.SwapRight(lockedL);
            }
            else
            {
                tick++;
                // () - r - K - ()
                //       \ - K - GB
                var r    = map.CreateTemplate(TemplateType.RoomChooser);
                var newK = map.CreateTemplate(TemplateType.LockChain);
                var gb   = map.CreateTemplate(TemplateType.BonusGoal);

                current.SwapLeft(r);
                r.ConnectTo(current);
                r.ConnectTo(newK);
                newK.ConnectTo(gb);

                map.Track(current); // Reuse key sequence
            }
        }
Ejemplo n.º 2
0
        private void AddSwitchedSection(Map <Template, Room> map, Template current, Skid switches)
        {
            int state = switches.Next();

            var r = current.ReplaceWith(map.CreateTemplate(TemplateType.RoomChooser));

            foreach (var hall in r.Exit)
            {
                hall.Lock = new Switch(state);                          // seal the normal exits
            }
            r.ConnectTo(map.CreateTemplate(TemplateType.SwitchSeq, state));

            if (Roll() > 10)
            {
                // Add switch-lock
                var sl = map.CreateTemplate(TemplateType.SwitchLockSeq, state);
                var gb = map.CreateTemplate(TemplateType.BonusGoal);

                r.ConnectTo(sl);
                sl.ConnectTo(gb);
            }
        }