コード例 #1
0
    public Hero(int heroIndex, PhotonPlayer player)
        : base(DarkestDungeonManager.Data.HeroClasses[(string)player.CustomProperties["HC" + heroIndex]])
    {
        RandomSolver.SetRandomSeed((int)player.CustomProperties["HS" + heroIndex]);

        InitializeHeroInfo(0, (string)player.CustomProperties["HN" + heroIndex],
                           (string)player.CustomProperties["HC" + heroIndex], 0, 30);

        InitializeEquipment(1, 1);
        InitializeQuirks();

        CurrentCombatSkills = new CombatSkill[HeroClass.CombatSkills.Count];
        for (int i = 0; i < CurrentCombatSkills.Length; i++)
        {
            CurrentCombatSkills[i] = HeroClass.CombatSkills[i];
        }

        var playerSkillFlags = (PlayerSkillFlags)player.CustomProperties["HF" + heroIndex];

        SelectedCombatSkills = new List <CombatSkill>();
        for (int i = 0; i < CurrentCombatSkills.Length; i++)
        {
            if ((playerSkillFlags & (PlayerSkillFlags)Mathf.Pow(2, i + 1)) != PlayerSkillFlags.Empty)
            {
                SelectedCombatSkills.Add(CurrentCombatSkills[i]);
            }
        }

        CurrentCampingSkills  = new CampingSkill[HeroClass.CampingSkills.Count];
        SelectedCampingSkills = new List <CampingSkill>();
    }
コード例 #2
0
    public void RefreshQuirks()
    {
        var currentHero  = DarkestPhotonLauncher.CharacterWindow.CurrentHero;
        var currentSlot  = PartySlots.Find(slot => slot.SelectedHero == currentHero);
        int currentIndex = DarkestPhotonLauncher.Instanse.HeroPool.IndexOf(currentHero);

        int heroSeed = GetInstanceID() + System.DateTime.Now.Millisecond + (int)System.DateTime.Now.Ticks;

        RandomSolver.SetRandomSeed(heroSeed);

        DarkestPhotonLauncher.Instanse.HeroSeeds[currentIndex] = heroSeed;
        DarkestPhotonLauncher.Instanse.HeroPool[currentIndex]  = new Hero(currentHero.ClassStringId, currentHero.Name);

        DarkestPhotonLauncher.CharacterWindow.UpdateCharacterInfo(DarkestPhotonLauncher.Instanse.HeroPool[currentIndex], true, true);
        currentSlot.UpdateHero(DarkestPhotonLauncher.Instanse.HeroPool[currentIndex]);
    }
コード例 #3
0
    private void Start()
    {
        HeroPool  = new List <Hero>();
        HeroSeeds = new List <int>();

        foreach (var heroClass in DarkestDungeonManager.Data.HeroClasses.Values.ToList())
        {
            for (int i = 0; i < 4; i++)
            {
                string generatedName = LocalizationManager.GetString("hero_name_" + RandomSolver.Next(0, 556).ToString());
                int    heroSeed      = GetInstanceID() + System.DateTime.Now.Millisecond + (int)System.DateTime.Now.Ticks + i + HeroPool.Count;
                RandomSolver.SetRandomSeed(heroSeed);
                HeroSeeds.Add(heroSeed);
                HeroPool.Add(new Hero(heroClass.StringId, generatedName));
            }
        }

        var initialParty = new List <Hero>(HeroPool).OrderBy(x => RandomSolver.NextDouble()).Take(4).ToList();

        multiplayerPartyPanel.LoadInitialComposition(initialParty);

        launcherPanel.ProgressLabel.text = "Disconnected!";
        CampaignSelectionManager.Instanse.RoomSelector.RegionLabel.text = "Region: " + RegionToString(selectedRegion);
    }
コード例 #4
0
 public void HeroActionSelected(HeroTurnAction actionType, FormationUnit selectedTarget, int rngSeed)
 {
     HeroAction     = actionType;
     SelectedTarget = selectedTarget;
     RandomSolver.SetRandomSeed(rngSeed);
 }