diff --git a/DungeonBasement/DungeonBasement.sln b/DungeonBasement/DungeonBasement.sln
new file mode 100644
index 0000000..bf95a13
--- /dev/null
+++ b/DungeonBasement/DungeonBasement.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.10.35122.118
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DungeonBasement", "DungeonBasement\DungeonBasement.csproj", "{6224A905-0B6F-4435-9BCF-5428E5D05717}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {6224A905-0B6F-4435-9BCF-5428E5D05717}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {6224A905-0B6F-4435-9BCF-5428E5D05717}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {6224A905-0B6F-4435-9BCF-5428E5D05717}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {6224A905-0B6F-4435-9BCF-5428E5D05717}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {48F726B6-3806-4BD2-9F89-21B2B3ACFFC5}
+ EndGlobalSection
+EndGlobal
diff --git a/DungeonBasement/DungeonBasement/DungeonBasement.csproj b/DungeonBasement/DungeonBasement/DungeonBasement.csproj
new file mode 100644
index 0000000..cb23502
--- /dev/null
+++ b/DungeonBasement/DungeonBasement/DungeonBasement.csproj
@@ -0,0 +1,69 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {6224A905-0B6F-4435-9BCF-5428E5D05717}
+ Library
+ Properties
+ DungeonBasement
+ DungeonBasement
+ v4.8
+ 512
+ true
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ ..\..\..\Libraries\0Harmony.dll
+
+
+ ..\..\..\Libraries\BepInEx.dll
+
+
+ ..\..\..\Libraries\BepInEx.Harmony.dll
+
+
+ ..\..\..\Libraries\LethalConfig.dll
+
+
+
+
+
+
+
+
+
+
+ ..\..\..\Libraries\UnityEngine.dll
+
+
+ ..\..\..\Libraries\UnityEngine.CoreModule.dll
+
+
+ ..\..\..\Libraries\UnityEngine.ImageConversionModule.dll
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/DungeonBasement/DungeonBasement/Plugin.cs b/DungeonBasement/DungeonBasement/Plugin.cs
new file mode 100644
index 0000000..6f2c4bc
--- /dev/null
+++ b/DungeonBasement/DungeonBasement/Plugin.cs
@@ -0,0 +1,54 @@
+using BepInEx;
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.IO;
+using UnityEngine;
+using System.Reflection;
+using BepInEx.Logging;
+using HarmonyLib.Tools;
+
+namespace DungeonBasement {
+ [BepInDependency("ainavt.lc.lethalconfig", "1.4.2")]
+ [BepInPlugin(modGUID, modName, modVersion)]
+ public class Plugin : BaseUnityPlugin {
+
+ public const string modGUID = "dev.ladyalice.scarletmansion.basement";
+ private const string modName = "Scarlet Basement";
+ private const string modVersion = "1.0.0";
+
+ public static ManualLogSource logger { get; internal set; }
+
+ void Awake(){
+
+ logger = BepInEx.Logging.Logger.CreateLogSource(modGUID);
+ logger.LogInfo($"Plugin {modName} has been added!");
+
+ // the entire purpose this plugin is so I have a unique assembly for Lethal Config
+ var assemblyPath = Assembly.GetExecutingAssembly().Location;
+ var path = Path.Combine(Path.GetDirectoryName(assemblyPath), "basement.png");
+ var texture2D = LoadTexture(path);
+ var icon = Sprite.Create(texture2D, new Rect(0, 0, texture2D.width, texture2D.height), Vector2.zero);
+
+ LethalConfig.LethalConfigManager.SetModIcon(icon);
+ LethalConfig.LethalConfigManager.SetModDescription("This is the config for the Scarlet Devil Mansion's Basement dungeon variant.");
+ }
+
+ Texture2D LoadTexture(string FilePath) {
+ Texture2D Tex2D;
+ byte[] FileData;
+
+ if (File.Exists(FilePath)){
+ FileData = File.ReadAllBytes(FilePath);
+ Tex2D = new Texture2D(2, 2);
+ Tex2D.LoadImage(FileData);
+ return Tex2D;
+ }
+ return null;
+ }
+
+ }
+}
diff --git a/DungeonBasement/DungeonBasement/Properties/AssemblyInfo.cs b/DungeonBasement/DungeonBasement/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..ab82401
--- /dev/null
+++ b/DungeonBasement/DungeonBasement/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// アセンブリに関する一般情報は以下を通して制御されます
+// 制御されます。アセンブリに関連付けられている情報を変更するには、
+// これらの属性値を変更してください。
+[assembly: AssemblyTitle("DungeonBasement")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("DungeonBasement")]
+[assembly: AssemblyCopyright("Copyright © 2025")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// ComVisible を false に設定すると、このアセンブリ内の型は COM コンポーネントから
+// 参照できなくなります。COM からこのアセンブリ内の型にアクセスする必要がある場合は、
+// その型の ComVisible 属性を true に設定してください。
+[assembly: ComVisible(false)]
+
+// このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります
+[assembly: Guid("6224a905-0b6f-4435-9bcf-5428e5d05717")]
+
+// アセンブリのバージョン情報は、以下の 4 つの値で構成されています:
+//
+// メジャー バージョン
+// マイナー バージョン
+// ビルド番号
+// リビジョン
+//
+// すべての値を指定するか、次を使用してビルド番号とリビジョン番号を既定に設定できます
+// 既定値にすることができます:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/ScarletMansion/ScarletMansion/Assets.cs b/ScarletMansion/ScarletMansion/Assets.cs
index 6602bcd..daca1ca 100644
--- a/ScarletMansion/ScarletMansion/Assets.cs
+++ b/ScarletMansion/ScarletMansion/Assets.cs
@@ -208,8 +208,12 @@ namespace ScarletMansion {
}
- Plugin.ConfigFoyer.dungeon = Load("SDMLevel");
- Plugin.ConfigFoyer.dunGenExtender = Load("DunGenExtender");
+ Plugin.ConfigFoyer.dungeon = Load("sdmFoyer");
+ Plugin.ConfigFoyer.dunGenExtender = Load("foyerExtender");
+
+ Plugin.ConfigBasement.dungeon = Load("sdmBasement");
+ Plugin.ConfigBasement.dunGenExtender = Load("basementExtender");
+
networkObjectList = Load("SDMList");
entranceAudioClip = Load("entrance_ogg");
diff --git a/ScarletMansion/ScarletMansion/Configs/ConfigDungeon.cs b/ScarletMansion/ScarletMansion/Configs/ConfigDungeon.cs
index a01d743..57d6e67 100644
--- a/ScarletMansion/ScarletMansion/Configs/ConfigDungeon.cs
+++ b/ScarletMansion/ScarletMansion/Configs/ConfigDungeon.cs
@@ -236,7 +236,7 @@ namespace ScarletMansion.Configs {
);
public static ConfigEntryBundle mapHazardsMultiplier = new ConfigEntryBundle(
- dungeonEnemiesPrefix,
+ dungeonBalancePrefix,
"Map Hazards Multiplier",
1.6f,
"Multiplies the total amount of map hazards (landmines, turrets) for the dungeon.",
@@ -245,7 +245,7 @@ namespace ScarletMansion.Configs {
);
public static ConfigEntryBundle minIndoorEnemySpawnCount = new ConfigEntryBundle(
- dungeonEnemiesPrefix,
+ dungeonBalancePrefix,
"Minimum Indoor Enemy Spawn Count",
1,
"Increases the minimum amount of indoor enemies that spawn with each spawn wave. For reference, Eclipse is +3.",
@@ -254,7 +254,7 @@ namespace ScarletMansion.Configs {
);
public static ConfigEntryBundle paintingCount = new ConfigEntryBundle(
- dungeonPaintingEventPrefix,
+ dungeonBalancePrefix,
"Painting Count",
2,
"The maximum amount of demonic paintings that spawn in the dungeon.",
@@ -263,7 +263,7 @@ namespace ScarletMansion.Configs {
);
public static ConfigEntryBundleMinMax paintingExtraLoot = new ConfigEntryBundleMinMax(
- dungeonPaintingEventPrefix,
+ dungeonBalancePrefix,
"Painting Extra Loot Min",
"Painting Extra Loot Max",
0,
@@ -338,6 +338,22 @@ namespace ScarletMansion.Configs {
public static List dungeonGenerationChangeList = new List();
public static List dungeonLightingChangeList = new List();
+ public static List CreateDungeonGenerationPresetDescriptions(){
+ var list = new List();
+ foreach(var c in dungeonGenerationChangeList) {
+ list.Add($"{c.name}\n{c.description}");
+ }
+ return list;
+ }
+
+ public static List CreateDungeonLightingPresetDescriptions(){
+ var list = new List();
+ foreach(var c in dungeonLightingChangeList) {
+ list.Add($"{c.name}\n{c.description}");
+ }
+ return list;
+ }
+
public static string GetEnumNames() where T: Enum {
var str = string.Empty;
var enums = Enum.GetNames(typeof(T)).Select(e => $"\"{e}\"");
diff --git a/ScarletMansion/ScarletMansion/Configs/ConfigDungeonBasement.cs b/ScarletMansion/ScarletMansion/Configs/ConfigDungeonBasement.cs
new file mode 100644
index 0000000..adc84c9
--- /dev/null
+++ b/ScarletMansion/ScarletMansion/Configs/ConfigDungeonBasement.cs
@@ -0,0 +1,171 @@
+using BepInEx.Configuration;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ScarletMansion.Configs
+{
+ public class ConfigDungeonBasement : ConfigDungeon {
+
+ public ConfigDungeonBasement(ConfigFile cfg) : base(cfg) {
+
+ AutoGenerateOnChangeConfig(cfg, dungeonGenerationPreset, dungeonLightingPreset);
+
+ CreateDungeonGenerationChangeList();
+ CreateDungeonLightingChangeList();
+
+ dungeonGenerationPreset.Bind(cfg, this);
+ dungeonLightingPreset.Bind(cfg, this);
+ }
+
+ public static void CreateDungeonGenerationChangeList(){
+ var customChangeList = new ChangeList("Custom", "Disables auto loading of preset config values.");
+
+ var defaultGeneration = new ChangeList(
+ "Default",
+ "The default generation values. Intended for lobbies with 3+ players.",
+
+ new ChangeInt ( dunGenWidthBase, 120 ),
+ new ChangeInt ( dunGenLengthBase, 80 ),
+ new ChangeFloat ( dunGenWidthMultiFactor, 0.5f ),
+ new ChangeFloat ( dunGenLengthMultiFactor, 0.3333333f ),
+
+ new ChangeInt ( mainPathCount, 3 ),
+ new ChangeMinMaxInt ( mainPathLength, 4, 5 ),
+
+ new ChangeBranchingPath( branchPathSectionOne, 2, 4, 1, 2 ),
+ new ChangeBranchingPath( branchPathSectionTwo, 1, 2, 1, 2 ),
+ new ChangeBranchingPath( branchPathSectionThree, 0, 1, 0, 1 ),
+
+ new ChangeFloat ( lootMultiplier, 1.2f ),
+ new ChangeFloat( mapHazardsMultiplier, 1.6f ),
+ new ChangeInt( minIndoorEnemySpawnCount, 1 ),
+ new ChangeInt ( paintingCount, 2 ),
+ new ChangeMinMaxInt( paintingExtraLoot, 0, 2 ),
+
+ new ChangeInt( treasureRoomCount, 2 ),
+ new ChangeMinMaxInt( treasureRoomLoot, 2, 3 )
+
+ );
+
+ var smallGeneration = new ChangeList(
+ "Small",
+ "A smaller variation of the default generation values. Intended for lobbies with 1-3 players.",
+ defaultGeneration,
+
+ new ChangeInt ( mainPathCount, 2 ),
+
+ new ChangeFloat ( lootMultiplier, 1.1f ),
+ new ChangeFloat ( mapHazardsMultiplier, 1.3f )
+
+ );
+
+ var moreLootGeneration = new ChangeList(
+ "More Loot, More Danger",
+ "Increases the amount of loot, map hazards, and starting enemies in the mansion. Intended for lobbies with 3+ players.",
+ defaultGeneration,
+
+ new ChangeFloat ( lootMultiplier, 1.4f ),
+ new ChangeFloat ( mapHazardsMultiplier, 2.2f ),
+ new ChangeInt ( minIndoorEnemySpawnCount, 2 ),
+ new ChangeInt ( paintingCount, 3 ),
+ new ChangeMinMaxInt( paintingExtraLoot, 1 , 3 ),
+
+ new ChangeInt( treasureRoomCount, 3 ),
+ new ChangeMinMaxInt( treasureRoomLoot, 3, 4 )
+
+ );
+
+ var bitMoreLootGeneration = new ChangeList(
+ "Bit More Loot, Bit More Danger",
+ "Increases the amount of loot, map hazards, and starting enemies in the mansion a bit. Intended for lobbies with 1-3 players.",
+ smallGeneration,
+
+ new ChangeFloat ( lootMultiplier, 1.3f ),
+ new ChangeFloat ( mapHazardsMultiplier, 1.9f ),
+ new ChangeInt ( minIndoorEnemySpawnCount, 2 ),
+ new ChangeInt ( paintingCount, 3 ),
+
+ new ChangeInt( treasureRoomCount, 3 )
+
+ );
+
+ var vanillaGeneration = new ChangeList(
+ "Vanilla",
+ "Changes the dungeon generation to match closer to a vanilla dungeon.",
+ defaultGeneration,
+
+ //new ChangeMinMaxFloat ( PluginConfig.dunGenMultiplier, float.MaxValue, 10f ),
+ new ChangeInt ( dunGenWidthBase, 200 ),
+ new ChangeInt ( dunGenLengthBase, 200 ),
+ new ChangeFloat ( dunGenWidthMultiFactor, 4f ),
+ new ChangeFloat ( dunGenLengthMultiFactor, 4f ),
+
+ new ChangeInt ( mainPathCount, 1 ),
+ new ChangeMinMaxInt ( mainPathLength, 6, 8 ),
+
+ new ChangeBranchingPath( branchPathSectionOne, 3, 5, 2, 3 ),
+ new ChangeBranchingPath( branchPathSectionTwo, 2, 3, 1, 2 ),
+ new ChangeBranchingPath( branchPathSectionThree, 1, 2, 0, 1 ),
+
+ new ChangeFloat ( lootMultiplier, 1f ),
+ new ChangeFloat ( mapHazardsMultiplier, 1f ),
+ new ChangeInt ( minIndoorEnemySpawnCount, 0 )
+
+ );
+
+ dungeonGenerationChangeList = new List() {
+ customChangeList,
+ defaultGeneration,
+ smallGeneration,
+ moreLootGeneration,
+ bitMoreLootGeneration,
+ vanillaGeneration
+ };
+ }
+
+ public static void CreateDungeonLightingChangeList(){
+ var customChangeList = new ChangeList("Custom", "Disables auto loading of preset config values.");
+
+ var defaultLighting = new ChangeList(
+ "Default",
+ "The default lighting values.",
+ new ChangeInt ( hallwayLightsWeight, 150 ),
+ new ChangeInt ( ceilingLightsWeight, 150 ),
+ new ChangeInt ( lightsSpawnZeroWeight, 1 ),
+ new ChangeInt ( lightsSpawnOneWeight, 8 ),
+ new ChangeInt ( lightsSpawnTwoWeight, 2 )
+ );
+
+ var brightLighting = new ChangeList(
+ "Bright",
+ "Makes light sources much more common.",
+ new ChangeInt ( hallwayLightsWeight, 450 ),
+ new ChangeInt ( ceilingLightsWeight, 450 ),
+ new ChangeInt ( lightsSpawnZeroWeight, 0 ),
+ new ChangeInt ( lightsSpawnOneWeight, 7 ),
+ new ChangeInt ( lightsSpawnTwoWeight, 3 )
+ );
+
+ var darkLighting = new ChangeList(
+ "Dark",
+ "Makes light sources much less common.",
+ new ChangeInt ( hallwayLightsWeight, 50 ),
+ new ChangeInt ( ceilingLightsWeight, 50 ),
+ new ChangeInt ( lightsSpawnZeroWeight, 2 ),
+ new ChangeInt ( lightsSpawnOneWeight, 8 ),
+ new ChangeInt ( lightsSpawnTwoWeight, 0 )
+ );
+
+ dungeonLightingChangeList = new List() {
+ customChangeList,
+ defaultLighting,
+ brightLighting,
+ darkLighting
+ };
+ }
+
+ }
+}
diff --git a/ScarletMansion/ScarletMansion/DunGenPatch/Patch.cs b/ScarletMansion/ScarletMansion/DunGenPatch/Patch.cs
index f2b1cad..89aa508 100644
--- a/ScarletMansion/ScarletMansion/DunGenPatch/Patch.cs
+++ b/ScarletMansion/ScarletMansion/DunGenPatch/Patch.cs
@@ -20,7 +20,6 @@ namespace ScarletMansion.DunGenPatch {
public static class Patch {
public static bool active;
- public static bool callAlternative;
public static DungeonGenerator generatorInstance;
public static RandomStream GetRandomStream(){
@@ -37,13 +36,7 @@ namespace ScarletMansion.DunGenPatch {
public static void Activate(DungeonGenerator generator){
active = true;
- callAlternative = true;
generatorInstance = generator;
-
- var scale = generator.LengthMultiplier;
-
- var mainPathLength = generator.DungeonFlow.Length;
- Plugin.logger.LogDebug($"Length of main path be: {GetLength(mainPathLength, scale)}");
}
public static string GetLength(IntRange range, float multi){
@@ -52,7 +45,6 @@ namespace ScarletMansion.DunGenPatch {
public static void Deactivate(bool ignoreScarletPlayer = false){
active = false;
- callAlternative = false;
generatorInstance = null;
GamePatch.JesterAIPatch.active = false;
@@ -68,6 +60,8 @@ namespace ScarletMansion.DunGenPatch {
}
public static void UpdateDunGenExtenderProperties(ConfigDungeon dungeonConfig, DunGenExtenderProperties props, EventCallbackScenario callback) where T: ConfigDungeon {
+ Plugin.CurrentConfigDungeon = dungeonConfig;
+
if (callback.IsDevDebug) return;
props.MainPathProperties.MainPathCount = dungeonConfig.mainPathCountValue;
diff --git a/ScarletMansion/ScarletMansion/GamePatch/Components/ScarletBedroom.cs b/ScarletMansion/ScarletMansion/GamePatch/Components/ScarletBedroom.cs
index f67f1fe..2711a2e 100644
--- a/ScarletMansion/ScarletMansion/GamePatch/Components/ScarletBedroom.cs
+++ b/ScarletMansion/ScarletMansion/GamePatch/Components/ScarletBedroom.cs
@@ -223,7 +223,7 @@ namespace ScarletMansion.GamePatch.Components {
var sysRandom = DunGenPatch.Patch.CreateSystemRandom();
Utility.Shuffle(sysRandom, itemSpawns);
- var count = sysRandom.Next(Plugin.GetConfigDungeon.GetPaintingExtraLoot.min, Plugin.GetConfigDungeon.GetPaintingExtraLoot.max + 1);
+ var count = sysRandom.Next(Plugin.CurrentConfigDungeon.GetPaintingExtraLoot.min, Plugin.CurrentConfigDungeon.GetPaintingExtraLoot.max + 1);
bonusItems = AngerManager.CreateAngerLoot(count, sysRandom);
bonusEnemy = GetRandomEnemy(sysRandom);
diff --git a/ScarletMansion/ScarletMansion/GamePatch/Enemies/KnightGhostVariant.cs b/ScarletMansion/ScarletMansion/GamePatch/Enemies/KnightGhostVariant.cs
index 83131d4..d83f43e 100644
--- a/ScarletMansion/ScarletMansion/GamePatch/Enemies/KnightGhostVariant.cs
+++ b/ScarletMansion/ScarletMansion/GamePatch/Enemies/KnightGhostVariant.cs
@@ -51,7 +51,8 @@ namespace ScarletMansion {
return;
}
- var targetLookingAtMe = !Physics.Linecast(transform.position + Vector3.up * 0.5f, targetPlayer.gameplayCamera.transform.position, StartOfRound.Instance.collidersAndRoomMaskAndDefault) && Vector3.Distance(base.transform.position, targetPlayer.transform.position) < 30f;
+ // whoops i didn't copy from knight code properly lmaoz
+ var targetLookingAtMe = targetPlayer.HasLineOfSightToPosition(transform.position + Vector3.up * 1.6f, 68f, 60);
var newBehaviourState = targetLookingAtMe ? 1 : 0;
if (targetLookingAtMe) {
targetPlayer.JumpToFearLevel(0.75f, true);
diff --git a/ScarletMansion/ScarletMansion/GamePatch/FixValues/FixCeilingLightValue.cs b/ScarletMansion/ScarletMansion/GamePatch/FixValues/FixCeilingLightValue.cs
index df1dbb7..03b64b7 100644
--- a/ScarletMansion/ScarletMansion/GamePatch/FixValues/FixCeilingLightValue.cs
+++ b/ScarletMansion/ScarletMansion/GamePatch/FixValues/FixCeilingLightValue.cs
@@ -11,7 +11,7 @@ namespace ScarletMansion.GamePatch.FixValues {
public void Awake(){
var weight = target.Props.Weights[1];
- var value = Plugin.GetConfigDungeon.GetCeilingLightsWeight;
+ var value = Plugin.CurrentConfigDungeon.GetCeilingLightsWeight;
weight.MainPathWeight = value;
weight.BranchPathWeight = value;
}
diff --git a/ScarletMansion/ScarletMansion/GamePatch/FixValues/FixHallwayLightValue.cs b/ScarletMansion/ScarletMansion/GamePatch/FixValues/FixHallwayLightValue.cs
index 7652e54..c56371b 100644
--- a/ScarletMansion/ScarletMansion/GamePatch/FixValues/FixHallwayLightValue.cs
+++ b/ScarletMansion/ScarletMansion/GamePatch/FixValues/FixHallwayLightValue.cs
@@ -11,7 +11,7 @@ namespace ScarletMansion.GamePatch.FixValues {
public void Awake(){
var weight = target.Props.Weights[1];
- var value = Plugin.GetConfigDungeon.GetHallwayLightsWeight;
+ var value = Plugin.CurrentConfigDungeon.GetHallwayLightsWeight;
weight.MainPathWeight = value;
weight.BranchPathWeight = value;
}
diff --git a/ScarletMansion/ScarletMansion/GamePatch/FixValues/FixTreasureRoom.cs b/ScarletMansion/ScarletMansion/GamePatch/FixValues/FixTreasureRoom.cs
index 117dffb..da711c5 100644
--- a/ScarletMansion/ScarletMansion/GamePatch/FixValues/FixTreasureRoom.cs
+++ b/ScarletMansion/ScarletMansion/GamePatch/FixValues/FixTreasureRoom.cs
@@ -10,7 +10,7 @@ namespace ScarletMansion.GamePatch.FixValues
{
public class FixTreasureRoom : FixBaseClass {
public void Awake(){
- var loot = Plugin.GetConfigDungeon.GetTreasureRoomLoot;
+ var loot = Plugin.CurrentConfigDungeon.GetTreasureRoomLoot;
target.propCount = new IntRange(loot.min, loot.max);
}
diff --git a/ScarletMansion/ScarletMansion/GamePatch/Items/ScarletGohei.cs b/ScarletMansion/ScarletMansion/GamePatch/Items/ScarletGohei.cs
index 5089e95..506503b 100644
--- a/ScarletMansion/ScarletMansion/GamePatch/Items/ScarletGohei.cs
+++ b/ScarletMansion/ScarletMansion/GamePatch/Items/ScarletGohei.cs
@@ -31,7 +31,15 @@ namespace ScarletMansion.GamePatch.Items {
// check enemies
//var enemies = RoundManager.Instance.SpawnedEnemies;
var enemies = Physics.OverlapSphere(transform.position, enemyCheckRange, enemyLayerMask);
- var foundEnemy = enemies.Select(e => e.GetComponent()).Any(e => e && !e.isEnemyDead);
+ var enemyScripts = enemies.Select(e => {
+ var script = e.GetComponent();
+ if (script != null) return script;
+
+ var collisionScript = e.GetComponent();
+ if (collisionScript != null) return collisionScript.mainScript;
+ return null;
+ });
+ var foundEnemy = enemyScripts.Any(e => e && !e.isEnemyDead);
// found enemy
if (foundEnemy){
diff --git a/ScarletMansion/ScarletMansion/GamePatch/Managers/AngerManager.cs b/ScarletMansion/ScarletMansion/GamePatch/Managers/AngerManager.cs
index da45ba0..8cc4514 100644
--- a/ScarletMansion/ScarletMansion/GamePatch/Managers/AngerManager.cs
+++ b/ScarletMansion/ScarletMansion/GamePatch/Managers/AngerManager.cs
@@ -73,7 +73,7 @@ namespace ScarletMansion.GamePatch.Managers {
}
public void OnDungeonComplete(Dungeon dungeon) {
- Anger(Plugin.GetConfigDungeon.GetMinIndoorEnemySpawnCount);
+ Anger(Plugin.CurrentConfigDungeon.GetMinIndoorEnemySpawnCount);
}
public void TriggerAngerLightBrief(float duration){
diff --git a/ScarletMansion/ScarletMansion/GamePatch/RoundManagerPatch.cs b/ScarletMansion/ScarletMansion/GamePatch/RoundManagerPatch.cs
index dfd38fa..aa2caab 100644
--- a/ScarletMansion/ScarletMansion/GamePatch/RoundManagerPatch.cs
+++ b/ScarletMansion/ScarletMansion/GamePatch/RoundManagerPatch.cs
@@ -40,14 +40,14 @@ namespace ScarletMansion.GamePatch {
public static float ModifyScrapCount(float count){
if (DunGenPatch.Patch.active == false) return count;
- Plugin.logger.LogDebug($"Scrap: {count} -> {count * Plugin.GetConfigDungeon.GetLootMultiplier}");
- return count * Plugin.GetConfigDungeon.GetLootMultiplier;
+ Plugin.logger.LogDebug($"Scrap: {count} -> {count * Plugin.CurrentConfigDungeon.GetLootMultiplier}");
+ return count * Plugin.CurrentConfigDungeon.GetLootMultiplier;
}
public static float ModifyMapCount(float count){
if (DunGenPatch.Patch.active == false) return count;
- Plugin.logger.LogDebug($"Map Hazards: {count} -> {count * Plugin.GetConfigDungeon.GetMapHazardsMultiplier}");
- return count * Plugin.GetConfigDungeon.GetMapHazardsMultiplier;
+ Plugin.logger.LogDebug($"Map Hazards: {count} -> {count * Plugin.CurrentConfigDungeon.GetMapHazardsMultiplier}");
+ return count * Plugin.CurrentConfigDungeon.GetMapHazardsMultiplier;
}
}
diff --git a/ScarletMansion/ScarletMansion/LoadingPatch/NetworkObjectListScriptableObject.cs b/ScarletMansion/ScarletMansion/LoadingPatch/NetworkObjectListScriptableObject.cs
index cb081a6..e2e5db9 100644
--- a/ScarletMansion/ScarletMansion/LoadingPatch/NetworkObjectListScriptableObject.cs
+++ b/ScarletMansion/ScarletMansion/LoadingPatch/NetworkObjectListScriptableObject.cs
@@ -25,11 +25,6 @@ namespace ScarletMansion {
public List- scrapItems;
public List enemies;
- [Header("DunGen")]
- public TileSet mayorRegularTileset;
- public TileSet mayorVanillaTileset;
- public GraphNode gardenEntranceGraphNode;
-
[Header("Main Prefabs")]
public GameObject scarletNetworkManager;
diff --git a/ScarletMansion/ScarletMansion/ModPatch/LethalConfigPatch.cs b/ScarletMansion/ScarletMansion/ModPatch/LethalConfigPatch.cs
index 02db3f1..562e386 100644
--- a/ScarletMansion/ScarletMansion/ModPatch/LethalConfigPatch.cs
+++ b/ScarletMansion/ScarletMansion/ModPatch/LethalConfigPatch.cs
@@ -19,7 +19,7 @@ using Microsoft.CSharp;
using System.CodeDom.Compiler;
namespace ScarletMansion.ModPatch {
- public class LethalConfigPatch : ModPatch where T: ConfigDungeon {
+ public class LethalConfigPatch : ModPatch where T: ConfigManager {
public const string section = "_Presets";
public const string descriptionPrefix = "These are a set of preset config values for your convience. Your config values will automatically update to these preset values every time SDM is loaded. These config values are a brighter shade of red. To disable this feature, set this value to Custom.";
@@ -109,12 +109,12 @@ namespace ScarletMansion.ModPatch {
LethalConfigManager.AddConfigItem(entry, assembly);
}
- public static void CreatePresetConfig(Assembly assembly, ConfigEntry configEntry, List.ChangeList> changeList) where U: Enum {
+ public static void CreatePresetConfig(Assembly assembly, ConfigEntry configEntry, List changeDescriptions) where U: Enum {
configEntry.SettingChanged += (obj, args) => ForceUIUpdate();
var description = $"{requiresNewLobby}\n\n{descriptionPrefix}\n\n";
- foreach(var c in changeList) {
- description += $"{c.name}\n{c.description}\n\n";
+ foreach(var c in changeDescriptions) {
+ description += $"{c}\n\n";
}
var options = new LethalConfig.ConfigItems.Options.EnumDropDownOptions{
@@ -145,19 +145,26 @@ namespace ScarletMansion.ModPatch {
}
public override void AddPatch() {
- LethalConfigManager.SkipAutoGen();
+ var genericType = typeof(T);
+ if (genericType == typeof(ConfigMain)) {
+ LethalConfigManager.SkipAutoGen();
+ LethalConfigManager.SetModDescription("Adds the Scarlet Devil Mansion from Touhou as a possible dungeon to the snow maps.\n\nThis is the master config for the entire mod.");
- LethalConfigManager.SetModDescription("Adds the Scarlet Devil Mansion from Touhou as a possible dungeon to the snow maps.\n\nThis is the master config for the entire mod.");
+ var mainAssembly = typeof(Plugin).Assembly;
+ AutoGenerateConfigs(mainAssembly);
+ } else if (genericType == typeof(ConfigDungeonFoyer)) {
+ var foyerAssembly = typeof(DungeonFoyer.Plugin).Assembly;
- var mainAssembly = typeof(Plugin).Assembly;
- var dungeonAssembly = typeof(DungeonFoyer.Plugin).Assembly;
-
- CreatePresetConfig(dungeonAssembly, ConfigDungeon.dungeonGenerationPreset.config, ConfigDungeon.dungeonGenerationChangeList);
- CreatePresetConfig(dungeonAssembly, ConfigDungeon.dungeonLightingPreset.config, ConfigDungeon.dungeonLightingChangeList);
-
- AutoGenerateConfigs(mainAssembly);
- AutoGenerateConfigs(dungeonAssembly, ConfigDungeon.dungeonGenerationPreset, ConfigDungeon.dungeonLightingPreset);
+ CreatePresetConfig(foyerAssembly, ConfigDungeon.dungeonGenerationPreset.config, ConfigDungeon.CreateDungeonGenerationPresetDescriptions());
+ CreatePresetConfig(foyerAssembly, ConfigDungeon.dungeonLightingPreset.config, ConfigDungeon.CreateDungeonLightingPresetDescriptions());
+ AutoGenerateConfigs(foyerAssembly, ConfigDungeon.dungeonGenerationPreset, ConfigDungeon.dungeonLightingPreset);
+ } else if (genericType == typeof(ConfigDungeonBasement)){
+ var basementAssembly = typeof(DungeonBasement.Plugin).Assembly;
+ CreatePresetConfig(basementAssembly, ConfigDungeon.dungeonGenerationPreset.config, ConfigDungeon.CreateDungeonGenerationPresetDescriptions());
+ CreatePresetConfig(basementAssembly, ConfigDungeon.dungeonLightingPreset.config, ConfigDungeon.CreateDungeonLightingPresetDescriptions());
+ AutoGenerateConfigs(basementAssembly, ConfigDungeon.dungeonGenerationPreset, ConfigDungeon.dungeonLightingPreset);
+ }
try {
//Plugin.Instance.harmony.PatchAll(typeof(LethalConfigPatch));
} catch (Exception e) {
diff --git a/ScarletMansion/ScarletMansion/ModPatch/ModCompability.cs b/ScarletMansion/ScarletMansion/ModPatch/ModCompability.cs
index cfb02fa..f8ea1ed 100644
--- a/ScarletMansion/ScarletMansion/ModPatch/ModCompability.cs
+++ b/ScarletMansion/ScarletMansion/ModPatch/ModCompability.cs
@@ -18,7 +18,10 @@ namespace ScarletMansion.ModPatch {
public static readonly ModPatch[] modPatches = new ModPatch[] {
//new AdvancedCompanyPatch(advancedCompanyGuid),
+ new LethalConfigPatch(lethalConfigGuid),
new LethalConfigPatch(lethalConfigGuid),
+ new LethalConfigPatch(lethalConfigGuid),
+
new FacilityMeltdownPatch(facilityMeldownGuid),
new ReservedFlashlightPatch(reserveFlashlightGuid),
new ReservedKeyPatch(reserveKeyGuid)
diff --git a/ScarletMansion/ScarletMansion/Plugin.cs b/ScarletMansion/ScarletMansion/Plugin.cs
index e00babb..bb7c61b 100644
--- a/ScarletMansion/ScarletMansion/Plugin.cs
+++ b/ScarletMansion/ScarletMansion/Plugin.cs
@@ -17,6 +17,7 @@ using ScarletMansion.ModPatch;
using ScarletMansion.DunGenPatch;
using ScarletMansion.GamePatch.Managers;
using ScarletMansion.Configs;
+using DunGen.Graph;
namespace ScarletMansion {
@@ -26,7 +27,7 @@ namespace ScarletMansion {
[BepInDependency("evaisa.lethallib", "0.13.2")]
[BepInDependency("dev.ladyalice.dungenplus", "1.3.3")]
[BepInDependency("dev.ladyalice.scarletmansion.foyer")]
-
+ [BepInDependency("dev.ladyalice.scarletmansion.basement")]
//[BepInDependency(ModCompability.advancedCompanyGuid, BepInDependency.DependencyFlags.SoftDependency)]
[BepInDependency(ModCompability.lethalConfigGuid, BepInDependency.DependencyFlags.SoftDependency)]
[BepInDependency(ModCompability.facilityMeldownGuid, BepInDependency.DependencyFlags.SoftDependency)]
@@ -44,12 +45,9 @@ namespace ScarletMansion {
public static ConfigMain ConfigMain { get; internal set; }
public static ConfigDungeonFoyer ConfigFoyer { get; internal set; }
+ public static ConfigDungeonBasement ConfigBasement { get; internal set; }
- public static IConfigDungeon GetConfigDungeon {
- get {
- return ConfigFoyer;
- }
- }
+ public static IConfigDungeon CurrentConfigDungeon { get; internal set; }
public static ManualLogSource logger { get; internal set; }
@@ -64,7 +62,8 @@ namespace ScarletMansion {
var foyerFile = new ConfigFile(Path.Combine(Paths.ConfigPath, $"{modGUID}.foyer.cfg"), true);
ConfigFoyer = new ConfigDungeonFoyer(foyerFile);
- //MyConfig.SerializerTest();
+ var basementFile = new ConfigFile(Path.Combine(Paths.ConfigPath, $"{modGUID}.basement.cfg"), true);
+ ConfigBasement = new ConfigDungeonBasement(basementFile);
ModCompability.GetActiveMods();
ModCompability.ActivateActiveMods();
@@ -85,6 +84,7 @@ namespace ScarletMansion {
harmony.PatchAll(typeof(ConfigMain));
harmony.PatchAll(typeof(ConfigDungeonFoyer));
+ harmony.PatchAll(typeof(ConfigDungeonBasement));
SetupForNetcodePatcher();
@@ -93,67 +93,50 @@ namespace ScarletMansion {
var dungeonMatchPropeties = ScriptableObject.CreateInstance();
dungeonMatchPropeties.authorNames.Add(new StringWithRarity("Alice", 10));
- /*
- var itemLevelMatchProperties = ScriptableObject.CreateInstance();
- foreach(var item in Assets.items){
- item.stringWithRarity = new StringWithRarity("Alice", 0);
- itemLevelMatchProperties.authorNames.Add(item.stringWithRarity);
- }
- */
-
- var sdmLevelMatchProperties = ScriptableObject.CreateInstance();
- sdmLevelMatchProperties.planetNames.Add(new StringWithRarity("Dine", 300));
- sdmLevelMatchProperties.planetNames.Add(new StringWithRarity("Rend", 300));
- sdmLevelMatchProperties.planetNames.Add(new StringWithRarity("Titan", 69));
- sdmLevelMatchProperties.planetNames.Add(new StringWithRarity("Sanguine", 900));
- sdmLevelMatchProperties.planetNames.Add(new StringWithRarity("Scarlet Devil Mansion", 900));
-
var extendedContent = new List();
- var extendedDungeon = ScriptableObject.CreateInstance();
- extendedDungeon.name = "Scarlet Devil Mansion";
- extendedDungeon.DungeonName = "Scarlet Devil Mansion";
- extendedDungeon.DungeonFlow = ConfigFoyer.dungeon;
- extendedDungeon.FirstTimeDungeonAudio = Assets.entranceAudioClip;
- extendedDungeon.LevelMatchingProperties = sdmLevelMatchProperties;
+ ExtendedDungeonFlow CreateExtendedDungeonFlow(T configDungeon, string dungeonName, int dineWeight, int rendWeight, int titanWeight) where T: ConfigDungeon {
+ var extendedDungeon = ScriptableObject.CreateInstance();
+ extendedDungeon.name = dungeonName;
+ extendedDungeon.DungeonName = dungeonName;
+ extendedDungeon.DungeonFlow = configDungeon.dungeon;
+ extendedDungeon.FirstTimeDungeonAudio = Assets.entranceAudioClip;
- extendedDungeon.DynamicDungeonSizeMinMax = new Vector2(1f, 2f);
- extendedDungeon.DynamicDungeonSizeLerpRate = 0f;
+ var sdmLevelMatchProperties = ScriptableObject.CreateInstance();
+ sdmLevelMatchProperties.planetNames.Add(new StringWithRarity("Dine", dineWeight));
+ sdmLevelMatchProperties.planetNames.Add(new StringWithRarity("Rend", rendWeight));
+ sdmLevelMatchProperties.planetNames.Add(new StringWithRarity("Titan", titanWeight));
+ sdmLevelMatchProperties.planetNames.Add(new StringWithRarity("Sanguine", 900));
+ sdmLevelMatchProperties.planetNames.Add(new StringWithRarity("Scarlet Devil Mansion", 900));
+ extendedDungeon.LevelMatchingProperties = sdmLevelMatchProperties;
- extendedDungeon.GenerateAutomaticConfigurationOptions = true;
+ extendedDungeon.DynamicDungeonSizeMinMax = new Vector2(1f, 2f);
+ extendedDungeon.DynamicDungeonSizeLerpRate = 0f;
- extendedContent.Add(extendedDungeon);
+ extendedDungeon.GenerateAutomaticConfigurationOptions = true;
- // items
- /*
- foreach(var item in Assets.items){
- var extendedItem = ScriptableObject.CreateInstance();
- extendedItem.Item = item.item;
- extendedItem.DungeonMatchingProperties = dungeonMatchPropeties;
- //extendedItem.LevelMatchingProperties = itemLevelMatchProperties;
+ configDungeon.dungeonExtended = extendedDungeon;
- extendedContent.Add(extendedItem);
+ extendedDungeon.DungeonEvents.onBeforeDungeonGenerate.AddListener(GeneratePathPatch.GeneratePatch);
+ extendedDungeon.DungeonEvents.onBeforeDungeonGenerate.AddListener(LoadAssetsIntoLevelPatch.AddItemsLocal);
+ extendedDungeon.DungeonEvents.onBeforeDungeonGenerate.AddListener(LoadAssetsIntoLevelPatch.AddEnemiesLocal);
+
+ DunGenPlus.API.AddDunGenExtender(configDungeon.dungeon, configDungeon.dunGenExtender);
+ configDungeon.dunGenExtender.Events.OnModifyDunGenExtenderProperties.AddListener((props, callback) => DunGenPatch.Patch.UpdateDunGenExtenderProperties(configDungeon, props, callback));
+
+ return extendedDungeon;
}
- */
+
+ extendedContent.Add(CreateExtendedDungeonFlow(ConfigFoyer, "Scarlet Foyer", 200, 100, 30));
+ extendedContent.Add(CreateExtendedDungeonFlow(ConfigBasement, "Scarlet Basement", 100, 200, 30));
var extendedMod = ExtendedMod.Create("Scarlet Devil Mansion", "Alice", extendedContent.ToArray());
PatchedContent.RegisterExtendedMod(extendedMod);
Assets.extendedMod = extendedMod;
- ConfigFoyer.dungeonExtended = extendedDungeon;
- extendedDungeon.DungeonEvents.onBeforeDungeonGenerate.AddListener(GeneratePathPatch.GeneratePatch);
-
- extendedDungeon.DungeonEvents.onBeforeDungeonGenerate.AddListener(LoadAssetsIntoLevelPatch.AddItemsLocal);
DungeonManager.GlobalDungeonEvents.onBeforeDungeonGenerate.AddListener(LoadAssetsIntoLevelPatch.AddItemsGlobal);
-
- extendedDungeon.DungeonEvents.onBeforeDungeonGenerate.AddListener(LoadAssetsIntoLevelPatch.AddEnemiesLocal);
-
- //DoorwayManager.onMainEntranceTeleportSpawnedEvent.AddEvent("DoorwayCleanup", DoorwayManager.onMainEntranceTeleportSpawnedFunction);
-
- DunGenPlus.API.AddDunGenExtender(ConfigFoyer.dungeon, ConfigFoyer.dunGenExtender);
- ConfigFoyer.dunGenExtender.Events.OnModifyDunGenExtenderProperties.AddListener((props, callback) => DunGenPatch.Patch.UpdateDunGenExtenderProperties(ConfigFoyer, props, callback));
}
void SetupForNetcodePatcher(){
diff --git a/ScarletMansion/ScarletMansion/ScarletMansion.csproj b/ScarletMansion/ScarletMansion/ScarletMansion.csproj
index c63a744..dccfdf1 100644
--- a/ScarletMansion/ScarletMansion/ScarletMansion.csproj
+++ b/ScarletMansion/ScarletMansion/ScarletMansion.csproj
@@ -49,6 +49,9 @@
..\..\..\Libraries\DunGenPlus.dll
+
+ ..\..\..\Libraries\DungeonBasement.dll
+
..\..\..\Libraries\DungeonFoyer.dll
@@ -154,6 +157,7 @@
+