Пример #1
0
        public void get_list_of_goodies()
        {
            var romData            = Utilities.LoadRom("rando.sfc");
            var spriteRequirements = new SpriteRequirementCollection();

            SpriteGroupCollection sgc = new SpriteGroupCollection(romData, new Random(), spriteRequirements);

            sgc.LoadSpriteGroups();

            RoomCollection rc = new RoomCollection(romData, new Random(), sgc, spriteRequirements);

            rc.LoadRooms();

            OverworldAreaCollection areas = new OverworldAreaCollection(romData, new Random(), new SpriteGroupCollection(romData, new Random(), new SpriteRequirementCollection()), new SpriteRequirementCollection());


            var spriteGroupsJson = JsonConvert.SerializeObject(sgc.SpriteGroups.Select(x => new { x.GroupId, x.DungeonGroupId, x.SubGroup0, x.SubGroup1, x.SubGroup2, x.SubGroup3 }), Formatting.Indented);
            var roomJson         = JsonConvert.SerializeObject(rc.Rooms.Select(x => new { x.RoomId, x.RoomName, x.GraphicsBlockId }), Formatting.Indented);
            var roomSpritesJson  = JsonConvert.SerializeObject(rc.Rooms.Select(x => new { x.RoomId, Sprites = new { Sprites = x.Sprites.Select(y => new { y.SpriteId, y.SpriteName, y.Address, y.HasAKey, y.IsOverlord }) } }), Formatting.Indented);

            var areaJson        = JsonConvert.SerializeObject(areas.OverworldAreas.Select(x => new { x.AreaId, x.AreaName, x.GraphicsBlockId }), Formatting.Indented);
            var areaSpritesJson = JsonConvert.SerializeObject(areas.OverworldAreas.Select(x => new { x.AreaId, Sprites = new { Sprites = x.Sprites.Select(y => new { y.SpriteId, y.SpriteName }) } }), Formatting.Indented);

            output.WriteLine(spriteGroupsJson);
            output.WriteLine(roomJson);
            output.WriteLine(roomSpritesJson);
            output.WriteLine(areaJson);
            output.WriteLine(areaSpritesJson);
        }
Пример #2
0
        public void default_settings_randomizes_enemies_in_dungeons()
        {
            RomData romData = Utilities.LoadRom("rando.sfc");

            Random rand         = new Random(0);
            var    requirements = new SpriteRequirementCollection();

            var spriteGroups = new SpriteGroupCollection(romData, rand, requirements);

            spriteGroups.LoadSpriteGroups();

            DungeonEnemyRandomizer der = new DungeonEnemyRandomizer(romData, rand, spriteGroups, requirements);

            der.RandomizeDungeonEnemies(new OptionFlags()
            {
                RandomizeEnemies = true, EnemiesAbsorbable = true
            });

            foreach (var sg in der.spriteGroupCollection.SpriteGroups)
            {
                output.WriteLine($"GroupID: {sg.GroupId} (Dungeon GroupId: {sg.DungeonGroupId}) - SG0: {sg.SubGroup0} - SG1: {sg.SubGroup1} - SG2: {sg.SubGroup2} - SG3: {sg.SubGroup3}");
            }

            foreach (var r in der.roomCollection.Rooms)
            {
                output.WriteLine($"RoomID: {r.RoomId} - GroupID: {r.GraphicsBlockId}");
                foreach (var s in r.Sprites)
                {
                    output.WriteLine($"\tSpriteID: {s.SpriteId} - Address: {s.Address}");
                }
            }
        }
Пример #3
0
        public void should_load_all_sprites_groups()
        {
            Random rand = new Random(0);

            RomData romData            = Utilities.LoadRom("rando.sfc");
            var     spriteRequirements = new SpriteRequirementCollection();

            SpriteGroupCollection sgc = new SpriteGroupCollection(romData, rand, spriteRequirements);

            sgc.LoadSpriteGroups();
            sgc.RandomizeDungeonGroups();
            sgc.UpdateRom();

            foreach (var sg in sgc.SpriteGroups)
            {
                output.WriteLine($"SpriteGroupID: {sg.GroupId} (Dungeon GroupId: {sg.DungeonGroupId}), Sub0: {sg.SubGroup0} Sub1: {sg.SubGroup1} Sub2: {sg.SubGroup2} Sub3: {sg.SubGroup3} ");
                if (sg.GroupId == 77)
                {
                    Assert.Equal(81, sg.SubGroup0);
                }
            }
        }
Пример #4
0
        private void loadRomButton_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            if (ofd.ShowDialog() == true)
            {
                RomData romData            = LoadRom(ofd.FileName);
                var     spriteRequirements = new SpriteRequirementCollection();

                SpriteGroupCollection sgc = new SpriteGroupCollection(romData, new Random(), spriteRequirements);
                sgc.LoadSpriteGroups();

                RoomCollection rc = new RoomCollection(romData, new Random(), spriteRequirements);
                rc.LoadRooms();

                var vm = new VM();
                vm.spriteGroupCollection = sgc;
                vm.roomCollection        = rc;

                this.DataContext = vm;
            }
        }