示例#1
0
        public static void NewGameInit()
        {
            var memory = Randomizer.Memory;

            if (!memory.IsLoadingGame())
            {
                Randomizer.Log("New Game Init", false);
                SaveController.SetAbility(AbilityType.SpiritEdge);
                foreach (UberState s in DefaultUberStates)
                {
                    memory.WriteUberState(s);
                }
                foreach (UberState s in Kuberstates)
                {
                    memory.WriteUberState(s);
                }
                foreach (UberState s in DialogAndRumors)
                {
                    memory.WriteUberState(s);
                }

                if (SeedController.KSDoorsOpen)
                {
                    foreach (UberState s in KeystoneDoors)
                    {
                        memory.WriteUberState(s);
                    }
                }

                if (!AHK.IniFlag("ShowShortCutscenes"))
                {
                    foreach (UberState s in ShortCutscenes)
                    {
                        memory.WriteUberState(s);
                    }
                }

                if (!AHK.IniFlag("ShowLongCutscenes"))
                {
                    foreach (UberState s in LongCutscenes)
                    {
                        memory.WriteUberState(s);
                    }
                }

                if (PsuedoLocs.GAME_START.Pickup().NonEmpty)
                {
                    Randomizer.InputUnlockCallback = () => {
                        PsuedoLocs.GAME_START.Pickup().Grant();
                        InterOp.magic_function();
                        InterOp.save();
                    };
                }

                InterOp.discover_everything();
                InterOp.bind_sword();
                InterOp.save();
                NeedsNewGameInit = false;
            }
        }
 private static void HandleSpecial(UberState state)
 {
     if (state.Name == "arenaBByteStateSerialized" && state.Value.Byte == 4)
     {
         // lumaPoolsStateGroup.arenaByteStateSerialized
         new UberId(5377, 1373).State().Write(state.Value);
     }
     else if (state.Name == "craftCutsceneState" && 0 < state.Value.Byte && state.Value.Byte < 3)
     {
         state.Write(new UberValue((byte)3));
         // Give diamond in the rough pickup.
         new UberId(23987, 14832).State().Write(new UberValue(true));
     }
     // the below is a fix for a vanilla bug where you can just miss getting voice if you
     else if (state.Name == "findToadQuestUberState" && state.Value.Int == 2 ||       // (a) skip the kwolok cutscene too fast
              state.Name == "cleanseWellspringQuestUberState" && state.Value.Int == 4 // (b) come to kwolok after wellspring and get the cutscenes stacked awkwardly
              )
     {
         Randomizer.InputUnlockCallback = () => {
             // this is really questionable!!
             var voiceState = new UberId(46462, 59806).State();
             if (!voiceState.Value.Bool)
             {
                 voiceState.Write(new UberValue(true));
                 InterOp.set_max_health(InterOp.get_max_health() + 10);
                 InterOp.set_max_energy(InterOp.get_max_energy() + 1);
                 InterOp.fill_health();
                 InterOp.fill_energy();
                 InterOp.save();
             }
             // should happen in both branches
             if (SeedController.Flags.Contains(Flag.ALLWISPS))
             {
                 HintsController.ProgressWithHints();
             }
         }
     }
     ;
 }
        public static void NewGameInit()
        {
            if (!InterOp.is_loading_game())
            {
                InterOp.clear_quest_messages();
                Randomizer.Log($"New Game Init - {SeedController.SeedName}", false);
                ShopController.SetCostsAfterInit();

                foreach (UberState s in DefaultUberStates)
                {
                    s.Write();
                }
                foreach (UberState s in Kuberstates)
                {
                    s.Write();
                }
                foreach (UberState s in DialogAndRumors)
                {
                    s.Write();
                }

                if (SeedController.KSDoorsOpen)
                {
                    foreach (UberState s in KeystoneDoors)
                    {
                        s.Write();
                    }
                }

                if (!AHK.IniFlag("ShowShortCutscenes"))
                {
                    foreach (UberState s in ShortCutscenes)
                    {
                        s.Write();
                    }
                }

                if (!AHK.IniFlag("ShowLongCutscenes"))
                {
                    foreach (UberState s in LongCutscenes)
                    {
                        s.Write();
                    }
                }

                InterOp.discover_everything();
                if (SeedController.Settings.LegacySeedgen && !SeedController.Flags.Contains(Flag.NOSWORD))
                {
                    SaveController.SetAbility(AbilityType.SpiritEdge);
                    var slotRaw = AHK.IniString("Misc", "SpawnSlot");
                    var slot    = 0;
                    if (slotRaw != string.Empty)
                    {
                        slot = slotRaw.ParseToInt("Spawn Slot Ini") - 1;
                        if (slot > 2 || slot < 0)
                        {
                            AHK.Print($"Ignoring invalid slot specifier {slotRaw}", toMessageLog: false);
                            slot = 0;
                        }
                    }
                    InterOp.bind(slot, 1002);
                }
                if (PsuedoLocs.GAME_START.Pickup().NonEmpty)
                {
                    Randomizer.InputUnlockCallback = () => {
                        MapController.UpdateReachable(2000);
                        PsuedoLocs.GAME_START.OnCollect();
                        InterOp.save();
                    };
                }
                else
                {
                    MapController.UpdateReachable();
                }
                InterOp.set_shard_slots(3);
                InterOp.save();

                NeedsNewGameInit = false;
            }
        }