Skip to content

Commit ffd78d5

Browse files
committed
add random balloons
1 parent 4390b56 commit ffd78d5

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

ShadowRando/Core/Settings.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ public class SettingsLayoutMisc
178178
{
179179
[IniAlwaysInclude]
180180
public bool RandomItemCapsules;
181+
[IniAlwaysInclude]
182+
public bool RandomItemBalloons;
181183
}
182184

183185
public class SettingsSubtitles

ShadowRando/Views/MainView.axaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,7 @@
685685
<TabItem Header="Misc">
686686
<StackPanel>
687687
<CheckBox x:Name="Layout_Misc_CheckBox_RandomItemCapsules">Random Item Capsules</CheckBox>
688+
<CheckBox x:Name="Layout_Misc_CheckBox_RandomItemBalloons">Random Item Balloons</CheckBox>
688689
</StackPanel>
689690
</TabItem>
690691
</TabControl>

ShadowRando/Views/MainView.axaml.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,7 @@ private void UserControl_Loaded(object? sender, RoutedEventArgs e)
514514

515515
// Layout Misc
516516
Layout_Misc_CheckBox_RandomItemCapsules.IsChecked = settings.Layout.Misc.RandomItemCapsules;
517+
Layout_Misc_CheckBox_RandomItemBalloons.IsChecked = settings.Layout.Misc.RandomItemBalloons;
517518

518519
// Subtitles
519520
Subtitles_CheckBox_RandomizeSubtitlesVoicelines.IsChecked = settings.Subtitles.Randomize;
@@ -613,6 +614,7 @@ private void UpdateSettings()
613614

614615
// Misc
615616
settings.Layout.Misc.RandomItemCapsules = Layout_Misc_CheckBox_RandomItemCapsules.IsChecked.Value;
617+
settings.Layout.Misc.RandomItemBalloons = Layout_Misc_CheckBox_RandomItemBalloons.IsChecked.Value;
616618

617619
// Subtitles
618620
settings.Subtitles.Randomize = Subtitles_CheckBox_RandomizeSubtitlesVoicelines.IsChecked.Value;
@@ -2166,6 +2168,15 @@ private int RandomizeLayouts(Random r)
21662168
RandomizeItemCapsules(ref hrdLayoutData, r);
21672169
}
21682170

2171+
if (settings.Layout.Misc.RandomItemBalloons)
2172+
{
2173+
RandomizeItemBalloons(ref cmnLayoutData, r);
2174+
if (nrmLayoutData != null)
2175+
RandomizeItemBalloons(ref nrmLayoutData, r);
2176+
if (hrdLayoutData != null)
2177+
RandomizeItemBalloons(ref hrdLayoutData, r);
2178+
}
2179+
21692180
if (settings.Layout.Partner.Mode == LayoutPartnerMode.Wild)
21702181
{
21712182
MakeAllPartnersRandom(ref cmnLayoutData, settings.Layout.Partner.KeepAffiliationsAtSameLocation, darkPartners, heroPartners, r);
@@ -2737,6 +2748,21 @@ private static void RandomizeItemCapsules(ref List<SetObjectShadow> setData, Ran
27372748
}
27382749
}
27392750

2751+
private static void RandomizeItemBalloons(ref List<SetObjectShadow> setData, Random r)
2752+
{
2753+
List<(Object0013_Balloon item, int index)> itemBalloonItems = setData
2754+
.Select((item, index) => new { Item = item, Index = index })
2755+
.Where(pair => pair.Item is Object0013_Balloon)
2756+
.Select(pair => (Item: (Object0013_Balloon)pair.Item, Index: pair.Index))
2757+
.ToList();
2758+
2759+
foreach (var balloon in itemBalloonItems)
2760+
{
2761+
balloon.item.Item = (EItemShadow)r.Next(11);
2762+
setData[balloon.index] = balloon.item;
2763+
}
2764+
}
2765+
27402766
private static void DelinkVehicleObjects(ref List<SetObjectShadow> setData)
27412767
{
27422768
List<(Object004F_Vehicle item, int index)> vehicleItems = setData
@@ -4027,6 +4053,7 @@ private void UpdateUIEnabledState()
40274053
PartnerCheckBoxes[i].IsEnabled = Layout_Partner_CheckBox_OnlySelectedPartners.IsChecked.Value && Layout_CheckBox_RandomizeLayouts.IsChecked.Value && (LayoutPartnerMode)Layout_Partner_ComboBox_Mode.SelectedIndex == LayoutPartnerMode.Wild;
40284054
// Misc
40294055
Layout_Misc_CheckBox_RandomItemCapsules.IsEnabled = Layout_CheckBox_RandomizeLayouts.IsChecked.Value;
4056+
Layout_Misc_CheckBox_RandomItemBalloons.IsEnabled = Layout_CheckBox_RandomizeLayouts.IsChecked.Value;
40304057
// --End Layout--
40314058
// Subtitles
40324059
Subtitles_CheckBox_OnlyWithLinkedAudio.IsEnabled = Subtitles_CheckBox_RandomizeSubtitlesVoicelines.IsChecked.Value;

0 commit comments

Comments
 (0)