Skip to content

Commit

Permalink
Add Preserve boss skills option to character settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Nifyr committed Apr 14, 2024
1 parent 374fa6d commit 22d3138
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 18 deletions.
2 changes: 1 addition & 1 deletion ALittleSecretIngredient/DefaultDistributionSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
17 changes: 16 additions & 1 deletion ALittleSecretIngredient/Forms/IndividualForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 61 additions & 1 deletion ALittleSecretIngredient/Forms/IndividualForm.resx
Original file line number Diff line number Diff line change
@@ -1,4 +1,64 @@
<root>
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
Expand Down
3 changes: 2 additions & 1 deletion ALittleSecretIngredient/Forms/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ private RandomizerSettings RandomizerSettings
rs.Individual.AttrsEnemy = new(Individual.checkBox40.Checked, Individual.AttrsEnemy.Get(), Array.Empty<object>());
rs.Individual.AttrsEnemyCount = new(Individual.checkBox39.Checked, Individual.AttrsEnemyCount.Get(), Array.Empty<object>());
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<object>());

return rs;
Expand Down Expand Up @@ -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<bool>(0);
Individual.checkBox45.Checked = value.Individual.CommonSids.GetArg<bool>(1);
}
}

Expand Down
18 changes: 13 additions & 5 deletions ALittleSecretIngredient/GameData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand All @@ -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"),
Expand Down Expand Up @@ -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)"),
};

Expand Down Expand Up @@ -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);
Expand Down
28 changes: 19 additions & 9 deletions ALittleSecretIngredient/Randomizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1730,19 +1730,29 @@ private void RandomizePersonalSkills(RandomizerSettings.IndividualSettings setti
List<string> generalSkillIDs = GD.GeneralSkills.GetIDs();
if (settings.CommonSids.GetArg<bool>(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<string> selectedSkillIDs = new();
selectedSkillIDs.AddRange(generalSkillIDs);
if (settings.CommonSids.GetArg<bool>(1))
{
List<string> 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<bool>(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);
}

Expand Down

0 comments on commit 22d3138

Please sign in to comment.