コード例 #1
0
        private void PopulateControls()
        {
            UnbindEvents();

            switch (_unit.UnitBlock)
            {
            case Enums.UnitBlock.Living:
                rdoLiving.Checked = true; break;

            case Enums.UnitBlock.Deployed:
                rdoDeployed.Checked = true; break;

            case Enums.UnitBlock.Absent:
                rdoAbsent.Checked = true; break;

            case Enums.UnitBlock.DeadByGameplay:
                rdoDeadByGameplay.Checked = true; break;

            case Enums.UnitBlock.DeadByPlot:
                rdoDeadByPlot.Checked = true; break;
            }

            chkChallenge.Checked = _unit.DiedOnChallengeMission;

            cmbDeathChapter.Text = _unit.DeathChapter.ToString();

            // Disallow killing Corrin
            if (Enum.IsDefined(typeof(Enums.Character), _unit.CharacterID) && Data.Database.Characters.GetByID(_unit.CharacterID).IsCorrin&& !_unit.IsEinherjar)
            {
                DisableAll();
            }
            // Don't mess with this stuff while a battle is in progress
            else if (_chapterSave.GetSaveFileType() == Enums.SaveFileType.Map)
            {
                DisableAll();
            }
            else
            {
                EnableAll();
                if (!IsDead())
                {
                    DisableDeathChapter();
                }
            }

            BindEvents();
        }
コード例 #2
0
        public void UnplayChapter(Enums.Chapter chapterId)
        {
            // Set the newly unplayed chapter to available
            _chapterSave.UserRegion.ChapterHistory.RemoveAll((x) => x.ChapterID == chapterId);

            var battlefields = _chapterSave.BattlefieldRegion.Battlefields.Where((x) => x.ChapterID == chapterId);

            foreach (var battlefield in battlefields)
            {
                battlefield.BattlefieldStatus = Enums.BattlefieldStatus.Available;
            }

            // Set any chapters beating this chapter would unlock to unavailable
            var chapterData = Data.Database.Chapters.GetByID(chapterId);

            foreach (var unlockedChapterId in chapterData.UnlocksChapters)
            {
                var dependentBattlefield = _chapterSave.BattlefieldRegion.Battlefields.Where(x => x.ChapterID == unlockedChapterId).FirstOrDefault();
                if (dependentBattlefield != null)
                {
                    dependentBattlefield.BattlefieldStatus = Enums.BattlefieldStatus.Unavailable;
                }
            }

            // Update the header if we just unplayed a story chapter AND if we're not in battle or in a map save
            if (_chapterSave.GetSaveFileType() == Enums.SaveFileType.Chapter &&
                _chapterSave.Header.IsBattlePrepSave == false &&
                chapterData.Type == "Story")
            {
                UpdateHeaderChapter(chapterId);
            }

            // If we just unplayed chapter 6, do some special stuff to properly reset the branch of fate
            if (chapterId == Enums.Chapter.Birthright_Chapter6 ||
                chapterId == Enums.Chapter.Conquest_Chapter6 ||
                chapterId == Enums.Chapter.Revelation_Chapter6)
            {
                _chapterSave.UserRegion.Unknown_Block2_0xE6  = 0x00;
                _chapterSave.UserRegion.Unknown_Block2_0xE7  = 0x00;
                _chapterSave.UserRegion.Unknown_Block2_0xE8  = 0x00;
                _chapterSave.UserRegion.Unknown_Block2_0xEC  = 0x04;
                _chapterSave.UserRegion.Unknown_Block2_0x10A = 0x00;

                // This flag is also used to denote whether a path has been chosen
                _chapterSave.Header.UnitsGoAbsentWhenKilled     = true;
                _chapterSave.UserRegion.UnitsGoAbsentWhenKilled = true;

                // Set the game to the default (Birthright)
                _chapterSave.Header.Game     = Enums.Game.Birthright;
                _chapterSave.UserRegion.Game = Enums.Game.Birthright;

                // Set the branch of fate header
                UpdateHeaderChapter(Enums.Chapter.Chapter6);

                // Set the gameplay chapter
                _chapterSave.UserRegion.CurrentChapter = Enums.Chapter.Chapter6;

                // Kill the story battlefields
                RemoveRouteSpecificStoryBattlefields();
                AddBirthrightSpecificStoryBattlefields();
            }
        }