From 22d31386b7a18454bceb968416d7cb96b97e502b Mon Sep 17 00:00:00 2001 From: Nifyr Date: Sun, 14 Apr 2024 23:20:57 +0200 Subject: [PATCH] Add Preserve boss skills option to character settings --- .../DefaultDistributionSetup.cs | 2 +- .../Forms/IndividualForm.Designer.cs | 17 ++++- .../Forms/IndividualForm.resx | 62 ++++++++++++++++++- ALittleSecretIngredient/Forms/MainForm.cs | 3 +- ALittleSecretIngredient/GameData.cs | 18 ++++-- ALittleSecretIngredient/Randomizer.cs | 28 ++++++--- 6 files changed, 112 insertions(+), 18 deletions(-) diff --git a/ALittleSecretIngredient/DefaultDistributionSetup.cs b/ALittleSecretIngredient/DefaultDistributionSetup.cs index e8a0677..35e26c9 100644 --- a/ALittleSecretIngredient/DefaultDistributionSetup.cs +++ b/ALittleSecretIngredient/DefaultDistributionSetup.cs @@ -1019,7 +1019,7 @@ internal SelectionDistributionSetup GetSelectionDistributionSetup(RandomizerDist GD.Attributes); case RandomizerDistribution.CommonSids: return GetSelectionDistributionSetup(npcCharacters.SelectMany(i => - i.CommonSids.Where(generalSkillIDs1.Contains)), i => i, GD.GeneralSkills); + i.CommonSids.Concat(i.NormalSids).Concat(i.HardSids).Concat(i.LunaticSids).Distinct().Where(generalSkillIDs1.Contains)), i => i, GD.GeneralSkills); default: throw new ArgumentException("Unsupported data field: " + dfe); } diff --git a/ALittleSecretIngredient/Forms/IndividualForm.Designer.cs b/ALittleSecretIngredient/Forms/IndividualForm.Designer.cs index 78f61a0..66ae050 100644 --- a/ALittleSecretIngredient/Forms/IndividualForm.Designer.cs +++ b/ALittleSecretIngredient/Forms/IndividualForm.Designer.cs @@ -187,6 +187,7 @@ private void InitializeComponent() button93 = new Button(); checkBox42 = new CheckBox(); toolTip1 = new ToolTip(components); + checkBox45 = new CheckBox(); flowLayoutPanel1.SuspendLayout(); groupBox14.SuspendLayout(); groupBox7.SuspendLayout(); @@ -1938,6 +1939,7 @@ private void InitializeComponent() // groupBox18.AutoSize = true; groupBox18.AutoSizeMode = AutoSizeMode.GrowAndShrink; + groupBox18.Controls.Add(checkBox45); groupBox18.Controls.Add(checkBox43); groupBox18.Controls.Add(button92); groupBox18.Controls.Add(checkBox41); @@ -1946,7 +1948,7 @@ private void InitializeComponent() groupBox18.Location = new Point(2063, 315); groupBox18.MinimumSize = new Size(200, 0); groupBox18.Name = "groupBox18"; - groupBox18.Size = new Size(200, 206); + groupBox18.Size = new Size(200, 236); groupBox18.TabIndex = 30; groupBox18.TabStop = false; groupBox18.Text = "Personal Skills"; @@ -2010,6 +2012,18 @@ private void InitializeComponent() toolTip1.InitialDelay = 0; toolTip1.ReshowDelay = 0; // + // checkBox45 + // + checkBox45.AutoSize = true; + checkBox45.Location = new Point(21, 186); + checkBox45.Margin = new Padding(18, 3, 3, 3); + checkBox45.Name = "checkBox45"; + checkBox45.Size = new Size(155, 24); + checkBox45.TabIndex = 9; + checkBox45.Text = "Preserve boss skills"; + toolTip1.SetToolTip(checkBox45, "This ensures that boss skills like Anchor and Bond Breaker remain *unchanged.*"); + checkBox45.UseVisualStyleBackColor = true; + // // IndividualForm // AutoScaleDimensions = new SizeF(8F, 20F); @@ -2219,5 +2233,6 @@ private void InitializeComponent() private Button button93; public CheckBox checkBox42; public CheckBox checkBox44; + public CheckBox checkBox45; } } \ No newline at end of file diff --git a/ALittleSecretIngredient/Forms/IndividualForm.resx b/ALittleSecretIngredient/Forms/IndividualForm.resx index e73f515..56e10be 100644 --- a/ALittleSecretIngredient/Forms/IndividualForm.resx +++ b/ALittleSecretIngredient/Forms/IndividualForm.resx @@ -1,4 +1,64 @@ - + + + diff --git a/ALittleSecretIngredient/Forms/MainForm.cs b/ALittleSecretIngredient/Forms/MainForm.cs index 624dd67..a174a04 100644 --- a/ALittleSecretIngredient/Forms/MainForm.cs +++ b/ALittleSecretIngredient/Forms/MainForm.cs @@ -470,7 +470,7 @@ private RandomizerSettings RandomizerSettings rs.Individual.AttrsEnemy = new(Individual.checkBox40.Checked, Individual.AttrsEnemy.Get(), Array.Empty()); rs.Individual.AttrsEnemyCount = new(Individual.checkBox39.Checked, Individual.AttrsEnemyCount.Get(), Array.Empty()); rs.Individual.CommonSids = new(Individual.checkBox42.Checked, Individual.CommonSids.Get(), - new object[] { Individual.checkBox43.Checked }); + new object[] { Individual.checkBox43.Checked, Individual.checkBox45.Checked }); rs.Individual.CommonSidsCount = new(Individual.checkBox41.Checked, Individual.CommonSidsCount.Get(), Array.Empty()); return rs; @@ -894,6 +894,7 @@ private RandomizerSettings RandomizerSettings Individual.checkBox41.Checked = value.Individual.CommonSidsCount.Enabled; Individual.CommonSidsCount.Set(value.Individual.CommonSidsCount.Distribution); Individual.checkBox43.Checked = value.Individual.CommonSids.GetArg(0); + Individual.checkBox45.Checked = value.Individual.CommonSids.GetArg(1); } } diff --git a/ALittleSecretIngredient/GameData.cs b/ALittleSecretIngredient/GameData.cs index cdd5d03..a5871ec 100644 --- a/ALittleSecretIngredient/GameData.cs +++ b/ALittleSecretIngredient/GameData.cs @@ -1971,7 +1971,15 @@ internal enum ProficiencyLevel ("SID_クロムエンゲージ技+_飛行", "Giga Levin Sword+ [Flying]"), ("SID_クロムエンゲージ技+_魔法", "Giga Levin Sword+ [Mystical]") }; - internal List<(string id, string name)> GeneralSkills { get; } = new() // TriggerAttackSkills + + internal List<(string id, string name)> BossSkills { get; } = new() + { + ("SID_ブレイク無効", "Unbreakable"), ("SID_特効耐性", "Stalwart"), ("SID_特効無効", "Unwavering"), + ("SID_不動", "Anchor"), ("SID_熟練者", "Veteran"), ("SID_熟練者+", "Veteran+"), + ("SID_チェインアタック威力軽減", "Bond Breaker"), + ("SID_チェインアタック威力軽減+", "Bond Breaker+"), + }; + + internal List<(string id, string name)> GeneralSkills { get; } = new() // TriggerAttackSkills + BossSkills + { ("SID_HP+5_継承用", "HP +5"), ("SID_HP+7_継承用", "HP +7"), ("SID_HP+10_継承用", "HP +10"), ("SID_HP+12_継承用", "HP +12"), ("SID_HP+15_継承用", "HP +15"), ("SID_力+1_継承用", "Strength +1"), ("SID_力+2_継承用", "Strength +2"), ("SID_力+3_継承用", "Strength +3"), @@ -1991,9 +1999,8 @@ internal enum ProficiencyLevel ("SID_飛燕の構え", "Darting Stance"), ("SID_明鏡の構え", "Warding Stance"), ("SID_死線", "Life and Death"), ("SID_相性激化", "Triangle Adept"), ("SID_噛描", "Cornered Beast"), ("SID_自壊", "Self-Destruct"), ("SID_清流の一撃", "Duelist's Blow"), ("SID_飛燕の一撃", "Darting Blow"), ("SID_鬼神の一撃", "Death Blow"), ("SID_凶鳥の一撃", "Certain Blow"), ("SID_金剛の一撃", "Armored Blow"), ("SID_明鏡の一撃", "Warding Blow"), - ("SID_狂乱の一撃", "Spirit Strike"), ("SID_ブレイク無効", "Unbreakable"), ("SID_特効耐性", "Stalwart"), ("SID_特効無効", "Unwavering"), - ("SID_不動", "Anchor"), ("SID_熟練者", "Veteran"), ("SID_熟練者+", "Veteran+"), ("SID_虚無の呪い", "Void Curse"), - ("SID_チェインアタック威力軽減", "Bond Breaker"), + ("SID_狂乱の一撃", "Spirit Strike"), + ("SID_虚無の呪い", "Void Curse"), ("SID_回避+10", "Avoid +10"), ("SID_回避+15", "Avoid +15"), ("SID_回避+20", "Avoid +20"), ("SID_回避+25", "Avoid +25"), ("SID_回避+30", "Avoid +30"), ("SID_命中+10", "Hit +10"), ("SID_命中+15", "Hit +15"), ("SID_命中+20", "Hit +20"), ("SID_命中+25", "Hit +25"), ("SID_命中+30", "Hit +30"), ("SID_必殺回避+10", "Dodge +10"), ("SID_必殺回避+15", "Dodge +15"), @@ -2109,7 +2116,7 @@ internal enum ProficiencyLevel ("SID_保身", "Self-Defense"), ("SID_戦場の花", "Fierce Bloom"), ("SID_促す決着", "This Ends Here"), ("SID_能力誇示", "Show-Off"), ("SID_傷をつけたわね", "Final Say"), ("SID_密かな支援", "Stealth Assist"), ("SID_王の尊厳", "Dignity of Solm"), ("SID_殺戮者", "Wear Down"), ("SID_輸送隊", "Convoy"), ("SID_瘴気の領域", "Miasma Domain "), ("SID_氷の領域", "Frost Domain"), ("SID_裏邪竜ノ娘_兵種スキル", "Resist Emblems"), ("SID_裏邪竜ノ子_兵種スキル", "Spur Emblems"), ("SID_受けるダメージ-50", "Sigil Protection"), - ("SID_チェインアタック威力軽減+", "Bond Breaker+"), ("SID_異形狼連携", "Pack Hunter (Corrupted)"), + ("SID_異形狼連携", "Pack Hunter (Corrupted)"), ("SID_幻影狼連携", "Pack Hunter (Phantom)"), }; @@ -2876,6 +2883,7 @@ internal GameData(XmlParser xp, FileManager fm) AllItems.AddRange(EngageWeapons); CompatibleAsEngageAttacks.AddRange(TriggerAttackSkills); GeneralSkills.AddRange(TriggerAttackSkills); + GeneralSkills.AddRange(BossSkills); VisibleSkills.AddRange(GeneralSkills); VisibleSkills.AddRange(RestrictedSkills); SyncStatSkills.AddRange(SyncHPSkills); diff --git a/ALittleSecretIngredient/Randomizer.cs b/ALittleSecretIngredient/Randomizer.cs index 1015619..c0bfbc0 100644 --- a/ALittleSecretIngredient/Randomizer.cs +++ b/ALittleSecretIngredient/Randomizer.cs @@ -1730,19 +1730,29 @@ private void RandomizePersonalSkills(RandomizerSettings.IndividualSettings setti List generalSkillIDs = GD.GeneralSkills.GetIDs(); if (settings.CommonSids.GetArg(0)) { - targets.ForEach(i => i.CommonSids = i.CommonSids. - Concat(i.NormalSids.Where(generalSkillIDs.Contains)). - Concat(i.HardSids.Where(generalSkillIDs.Contains)). - Concat(i.LunaticSids.Where(generalSkillIDs.Contains)).Distinct().ToArray()); - targets.ForEach(i => i.NormalSids = i.NormalSids.Where(s => !generalSkillIDs.Contains(s)).ToArray()); - targets.ForEach(i => i.HardSids = i.HardSids.Where(s => !generalSkillIDs.Contains(s)).ToArray()); - targets.ForEach(i => i.LunaticSids = i.LunaticSids.Where(s => !generalSkillIDs.Contains(s)).ToArray()); + List selectedSkillIDs = new(); + selectedSkillIDs.AddRange(generalSkillIDs); + if (settings.CommonSids.GetArg(1)) + { + List bossSkillIDs = GD.BossSkills.GetIDs(); + selectedSkillIDs = selectedSkillIDs.Where(s => !bossSkillIDs.Contains(s)).ToList(); + } + targets.ForEach(i => i.CommonSids = i.CommonSids.Concat(i.NormalSids).Concat(i.HardSids).Concat(i.LunaticSids).Distinct() + .Where(selectedSkillIDs.Contains).ToArray()); + targets.ForEach(i => i.NormalSids = i.NormalSids.Where(s => !selectedSkillIDs.Contains(s)).ToArray()); + targets.ForEach(i => i.HardSids = i.HardSids.Where(s => !selectedSkillIDs.Contains(s)).ToArray()); + targets.ForEach(i => i.LunaticSids = i.LunaticSids.Where(s => !selectedSkillIDs.Contains(s)).ToArray()); } if (settings.CommonSidsCount.Enabled) - RandomizeArraySizes(targets, i => i.CommonSids, (i, a) => i.CommonSids = a, settings.CommonSidsCount.Distribution, - generalSkillIDs); + RandomizeArraySizes(targets, i => i.CommonSids, (i, a) => i.CommonSids = a, settings.CommonSidsCount.Distribution, generalSkillIDs); RandomizeArrayContents(targets, i => i.CommonSids, (i, a) => i.CommonSids = a, settings.CommonSids.Distribution, generalSkillIDs); WriteToChangelog(entries, targets, i => i.CommonSids.Where(generalSkillIDs.Contains), "Personal Skills", GD.GeneralSkills, true); + if (settings.CommonSids.GetArg(0)) + { + WriteToChangelog(entries, targets, i => i.NormalSids.Where(generalSkillIDs.Contains), "Normal Skills", GD.GeneralSkills, false); + WriteToChangelog(entries, targets, i => i.HardSids.Where(generalSkillIDs.Contains), "Hard Skills", GD.GeneralSkills, false); + WriteToChangelog(entries, targets, i => i.LunaticSids.Where(generalSkillIDs.Contains), "Maddening Skills", GD.GeneralSkills, false); + } GD.SetDirty(DataSetEnum.Individual); }