Added basement variant

Fixed knight ghost to sprint when you ain't looking
Fixed Gohei to detect enemies
This commit is contained in:
LadyAliceMargatroid 2025-01-11 03:45:12 -08:00
parent 83d0d8a737
commit e28f3ca2db
21 changed files with 466 additions and 96 deletions

View File

@ -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

View File

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{6224A905-0B6F-4435-9BCF-5428E5D05717}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DungeonBasement</RootNamespace>
<AssemblyName>DungeonBasement</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="0Harmony">
<HintPath>..\..\..\Libraries\0Harmony.dll</HintPath>
</Reference>
<Reference Include="BepInEx">
<HintPath>..\..\..\Libraries\BepInEx.dll</HintPath>
</Reference>
<Reference Include="BepInEx.Harmony">
<HintPath>..\..\..\Libraries\BepInEx.Harmony.dll</HintPath>
</Reference>
<Reference Include="LethalConfig">
<HintPath>..\..\..\Libraries\LethalConfig.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="UnityEngine">
<HintPath>..\..\..\Libraries\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>..\..\..\Libraries\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.ImageConversionModule">
<HintPath>..\..\..\Libraries\UnityEngine.ImageConversionModule.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Plugin.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -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;
}
}
}

View File

@ -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")]

View File

@ -208,8 +208,12 @@ namespace ScarletMansion {
} }
Plugin.ConfigFoyer.dungeon = Load<DungeonFlow>("SDMLevel"); Plugin.ConfigFoyer.dungeon = Load<DungeonFlow>("sdmFoyer");
Plugin.ConfigFoyer.dunGenExtender = Load<DunGenExtender>("DunGenExtender"); Plugin.ConfigFoyer.dunGenExtender = Load<DunGenExtender>("foyerExtender");
Plugin.ConfigBasement.dungeon = Load<DungeonFlow>("sdmBasement");
Plugin.ConfigBasement.dunGenExtender = Load<DunGenExtender>("basementExtender");
networkObjectList = Load<NetworkObjectListScriptableObject>("SDMList"); networkObjectList = Load<NetworkObjectListScriptableObject>("SDMList");
entranceAudioClip = Load<AudioClip>("entrance_ogg"); entranceAudioClip = Load<AudioClip>("entrance_ogg");

View File

@ -236,7 +236,7 @@ namespace ScarletMansion.Configs {
); );
public static ConfigEntryBundle<float> mapHazardsMultiplier = new ConfigEntryBundle<float>( public static ConfigEntryBundle<float> mapHazardsMultiplier = new ConfigEntryBundle<float>(
dungeonEnemiesPrefix, dungeonBalancePrefix,
"Map Hazards Multiplier", "Map Hazards Multiplier",
1.6f, 1.6f,
"Multiplies the total amount of map hazards (landmines, turrets) for the dungeon.", "Multiplies the total amount of map hazards (landmines, turrets) for the dungeon.",
@ -245,7 +245,7 @@ namespace ScarletMansion.Configs {
); );
public static ConfigEntryBundle<int> minIndoorEnemySpawnCount = new ConfigEntryBundle<int>( public static ConfigEntryBundle<int> minIndoorEnemySpawnCount = new ConfigEntryBundle<int>(
dungeonEnemiesPrefix, dungeonBalancePrefix,
"Minimum Indoor Enemy Spawn Count", "Minimum Indoor Enemy Spawn Count",
1, 1,
"Increases the minimum amount of indoor enemies that spawn with each spawn wave. For reference, Eclipse is +3.", "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<int> paintingCount = new ConfigEntryBundle<int>( public static ConfigEntryBundle<int> paintingCount = new ConfigEntryBundle<int>(
dungeonPaintingEventPrefix, dungeonBalancePrefix,
"Painting Count", "Painting Count",
2, 2,
"The maximum amount of demonic paintings that spawn in the dungeon.", "The maximum amount of demonic paintings that spawn in the dungeon.",
@ -263,7 +263,7 @@ namespace ScarletMansion.Configs {
); );
public static ConfigEntryBundleMinMax<int> paintingExtraLoot = new ConfigEntryBundleMinMax<int>( public static ConfigEntryBundleMinMax<int> paintingExtraLoot = new ConfigEntryBundleMinMax<int>(
dungeonPaintingEventPrefix, dungeonBalancePrefix,
"Painting Extra Loot Min", "Painting Extra Loot Min",
"Painting Extra Loot Max", "Painting Extra Loot Max",
0, 0,
@ -338,6 +338,22 @@ namespace ScarletMansion.Configs {
public static List<ChangeList> dungeonGenerationChangeList = new List<ChangeList>(); public static List<ChangeList> dungeonGenerationChangeList = new List<ChangeList>();
public static List<ChangeList> dungeonLightingChangeList = new List<ChangeList>(); public static List<ChangeList> dungeonLightingChangeList = new List<ChangeList>();
public static List<string> CreateDungeonGenerationPresetDescriptions(){
var list = new List<string>();
foreach(var c in dungeonGenerationChangeList) {
list.Add($"<b>{c.name}</b>\n{c.description}");
}
return list;
}
public static List<string> CreateDungeonLightingPresetDescriptions(){
var list = new List<string>();
foreach(var c in dungeonLightingChangeList) {
list.Add($"<b>{c.name}</b>\n{c.description}");
}
return list;
}
public static string GetEnumNames<T>() where T: Enum { public static string GetEnumNames<T>() where T: Enum {
var str = string.Empty; var str = string.Empty;
var enums = Enum.GetNames(typeof(T)).Select(e => $"\"{e}\""); var enums = Enum.GetNames(typeof(T)).Select(e => $"\"{e}\"");

View File

@ -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<ConfigDungeonBasement> {
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<ChangeList>() {
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<ChangeList>() {
customChangeList,
defaultLighting,
brightLighting,
darkLighting
};
}
}
}

View File

@ -20,7 +20,6 @@ namespace ScarletMansion.DunGenPatch {
public static class Patch { public static class Patch {
public static bool active; public static bool active;
public static bool callAlternative;
public static DungeonGenerator generatorInstance; public static DungeonGenerator generatorInstance;
public static RandomStream GetRandomStream(){ public static RandomStream GetRandomStream(){
@ -37,13 +36,7 @@ namespace ScarletMansion.DunGenPatch {
public static void Activate(DungeonGenerator generator){ public static void Activate(DungeonGenerator generator){
active = true; active = true;
callAlternative = true;
generatorInstance = generator; 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){ public static string GetLength(IntRange range, float multi){
@ -52,7 +45,6 @@ namespace ScarletMansion.DunGenPatch {
public static void Deactivate(bool ignoreScarletPlayer = false){ public static void Deactivate(bool ignoreScarletPlayer = false){
active = false; active = false;
callAlternative = false;
generatorInstance = null; generatorInstance = null;
GamePatch.JesterAIPatch.active = false; GamePatch.JesterAIPatch.active = false;
@ -68,6 +60,8 @@ namespace ScarletMansion.DunGenPatch {
} }
public static void UpdateDunGenExtenderProperties<T>(ConfigDungeon<T> dungeonConfig, DunGenExtenderProperties props, EventCallbackScenario callback) where T: ConfigDungeon<T> { public static void UpdateDunGenExtenderProperties<T>(ConfigDungeon<T> dungeonConfig, DunGenExtenderProperties props, EventCallbackScenario callback) where T: ConfigDungeon<T> {
Plugin.CurrentConfigDungeon = dungeonConfig;
if (callback.IsDevDebug) return; if (callback.IsDevDebug) return;
props.MainPathProperties.MainPathCount = dungeonConfig.mainPathCountValue; props.MainPathProperties.MainPathCount = dungeonConfig.mainPathCountValue;

View File

@ -223,7 +223,7 @@ namespace ScarletMansion.GamePatch.Components {
var sysRandom = DunGenPatch.Patch.CreateSystemRandom(); var sysRandom = DunGenPatch.Patch.CreateSystemRandom();
Utility.Shuffle(sysRandom, itemSpawns); 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); bonusItems = AngerManager.CreateAngerLoot(count, sysRandom);
bonusEnemy = GetRandomEnemy(sysRandom); bonusEnemy = GetRandomEnemy(sysRandom);

View File

@ -51,7 +51,8 @@ namespace ScarletMansion {
return; 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; var newBehaviourState = targetLookingAtMe ? 1 : 0;
if (targetLookingAtMe) { if (targetLookingAtMe) {
targetPlayer.JumpToFearLevel(0.75f, true); targetPlayer.JumpToFearLevel(0.75f, true);

View File

@ -11,7 +11,7 @@ namespace ScarletMansion.GamePatch.FixValues {
public void Awake(){ public void Awake(){
var weight = target.Props.Weights[1]; var weight = target.Props.Weights[1];
var value = Plugin.GetConfigDungeon.GetCeilingLightsWeight; var value = Plugin.CurrentConfigDungeon.GetCeilingLightsWeight;
weight.MainPathWeight = value; weight.MainPathWeight = value;
weight.BranchPathWeight = value; weight.BranchPathWeight = value;
} }

View File

@ -11,7 +11,7 @@ namespace ScarletMansion.GamePatch.FixValues {
public void Awake(){ public void Awake(){
var weight = target.Props.Weights[1]; var weight = target.Props.Weights[1];
var value = Plugin.GetConfigDungeon.GetHallwayLightsWeight; var value = Plugin.CurrentConfigDungeon.GetHallwayLightsWeight;
weight.MainPathWeight = value; weight.MainPathWeight = value;
weight.BranchPathWeight = value; weight.BranchPathWeight = value;
} }

View File

@ -10,7 +10,7 @@ namespace ScarletMansion.GamePatch.FixValues
{ {
public class FixTreasureRoom : FixBaseClass<LocalPropSetBasic> { public class FixTreasureRoom : FixBaseClass<LocalPropSetBasic> {
public void Awake(){ public void Awake(){
var loot = Plugin.GetConfigDungeon.GetTreasureRoomLoot; var loot = Plugin.CurrentConfigDungeon.GetTreasureRoomLoot;
target.propCount = new IntRange(loot.min, loot.max); target.propCount = new IntRange(loot.min, loot.max);
} }

View File

@ -31,7 +31,15 @@ namespace ScarletMansion.GamePatch.Items {
// check enemies // check enemies
//var enemies = RoundManager.Instance.SpawnedEnemies; //var enemies = RoundManager.Instance.SpawnedEnemies;
var enemies = Physics.OverlapSphere(transform.position, enemyCheckRange, enemyLayerMask); var enemies = Physics.OverlapSphere(transform.position, enemyCheckRange, enemyLayerMask);
var foundEnemy = enemies.Select(e => e.GetComponent<EnemyAI>()).Any(e => e && !e.isEnemyDead); var enemyScripts = enemies.Select(e => {
var script = e.GetComponent<EnemyAI>();
if (script != null) return script;
var collisionScript = e.GetComponent<EnemyAICollisionDetect>();
if (collisionScript != null) return collisionScript.mainScript;
return null;
});
var foundEnemy = enemyScripts.Any(e => e && !e.isEnemyDead);
// found enemy // found enemy
if (foundEnemy){ if (foundEnemy){

View File

@ -73,7 +73,7 @@ namespace ScarletMansion.GamePatch.Managers {
} }
public void OnDungeonComplete(Dungeon dungeon) { public void OnDungeonComplete(Dungeon dungeon) {
Anger(Plugin.GetConfigDungeon.GetMinIndoorEnemySpawnCount); Anger(Plugin.CurrentConfigDungeon.GetMinIndoorEnemySpawnCount);
} }
public void TriggerAngerLightBrief(float duration){ public void TriggerAngerLightBrief(float duration){

View File

@ -40,14 +40,14 @@ namespace ScarletMansion.GamePatch {
public static float ModifyScrapCount(float count){ public static float ModifyScrapCount(float count){
if (DunGenPatch.Patch.active == false) return count; if (DunGenPatch.Patch.active == false) return count;
Plugin.logger.LogDebug($"Scrap: {count} -> {count * Plugin.GetConfigDungeon.GetLootMultiplier}"); Plugin.logger.LogDebug($"Scrap: {count} -> {count * Plugin.CurrentConfigDungeon.GetLootMultiplier}");
return count * Plugin.GetConfigDungeon.GetLootMultiplier; return count * Plugin.CurrentConfigDungeon.GetLootMultiplier;
} }
public static float ModifyMapCount(float count){ public static float ModifyMapCount(float count){
if (DunGenPatch.Patch.active == false) return count; if (DunGenPatch.Patch.active == false) return count;
Plugin.logger.LogDebug($"Map Hazards: {count} -> {count * Plugin.GetConfigDungeon.GetMapHazardsMultiplier}"); Plugin.logger.LogDebug($"Map Hazards: {count} -> {count * Plugin.CurrentConfigDungeon.GetMapHazardsMultiplier}");
return count * Plugin.GetConfigDungeon.GetMapHazardsMultiplier; return count * Plugin.CurrentConfigDungeon.GetMapHazardsMultiplier;
} }
} }

View File

@ -25,11 +25,6 @@ namespace ScarletMansion {
public List<Item> scrapItems; public List<Item> scrapItems;
public List<EnemyType> enemies; public List<EnemyType> enemies;
[Header("DunGen")]
public TileSet mayorRegularTileset;
public TileSet mayorVanillaTileset;
public GraphNode gardenEntranceGraphNode;
[Header("Main Prefabs")] [Header("Main Prefabs")]
public GameObject scarletNetworkManager; public GameObject scarletNetworkManager;

View File

@ -19,7 +19,7 @@ using Microsoft.CSharp;
using System.CodeDom.Compiler; using System.CodeDom.Compiler;
namespace ScarletMansion.ModPatch { namespace ScarletMansion.ModPatch {
public class LethalConfigPatch<T> : ModPatch where T: ConfigDungeon<T> { public class LethalConfigPatch<T> : ModPatch where T: ConfigManager<T> {
public const string section = "_Presets"; 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."; 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); LethalConfigManager.AddConfigItem(entry, assembly);
} }
public static void CreatePresetConfig<U>(Assembly assembly, ConfigEntry<U> configEntry, List<ConfigManager<T>.ChangeList> changeList) where U: Enum { public static void CreatePresetConfig<U>(Assembly assembly, ConfigEntry<U> configEntry, List<string> changeDescriptions) where U: Enum {
configEntry.SettingChanged += (obj, args) => ForceUIUpdate(); configEntry.SettingChanged += (obj, args) => ForceUIUpdate();
var description = $"{requiresNewLobby}\n\n{descriptionPrefix}\n\n"; var description = $"{requiresNewLobby}\n\n{descriptionPrefix}\n\n";
foreach(var c in changeList) { foreach(var c in changeDescriptions) {
description += $"<b>{c.name}</b>\n{c.description}\n\n"; description += $"{c}\n\n";
} }
var options = new LethalConfig.ConfigItems.Options.EnumDropDownOptions{ var options = new LethalConfig.ConfigItems.Options.EnumDropDownOptions{
@ -145,19 +145,26 @@ namespace ScarletMansion.ModPatch {
} }
public override void AddPatch() { public override void AddPatch() {
var genericType = typeof(T);
if (genericType == typeof(ConfigMain)) {
LethalConfigManager.SkipAutoGen(); 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; var mainAssembly = typeof(Plugin).Assembly;
var dungeonAssembly = typeof(DungeonFoyer.Plugin).Assembly;
CreatePresetConfig(dungeonAssembly, ConfigDungeon<T>.dungeonGenerationPreset.config, ConfigDungeon<T>.dungeonGenerationChangeList);
CreatePresetConfig(dungeonAssembly, ConfigDungeon<T>.dungeonLightingPreset.config, ConfigDungeon<T>.dungeonLightingChangeList);
AutoGenerateConfigs<ConfigMain>(mainAssembly); AutoGenerateConfigs<ConfigMain>(mainAssembly);
AutoGenerateConfigs<T>(dungeonAssembly, ConfigDungeon<T>.dungeonGenerationPreset, ConfigDungeon<T>.dungeonLightingPreset); } else if (genericType == typeof(ConfigDungeonFoyer)) {
var foyerAssembly = typeof(DungeonFoyer.Plugin).Assembly;
CreatePresetConfig(foyerAssembly, ConfigDungeon<ConfigDungeonFoyer>.dungeonGenerationPreset.config, ConfigDungeon<ConfigDungeonFoyer>.CreateDungeonGenerationPresetDescriptions());
CreatePresetConfig(foyerAssembly, ConfigDungeon<ConfigDungeonFoyer>.dungeonLightingPreset.config, ConfigDungeon<ConfigDungeonFoyer>.CreateDungeonLightingPresetDescriptions());
AutoGenerateConfigs<T>(foyerAssembly, ConfigDungeon<ConfigDungeonFoyer>.dungeonGenerationPreset, ConfigDungeon<ConfigDungeonFoyer>.dungeonLightingPreset);
} else if (genericType == typeof(ConfigDungeonBasement)){
var basementAssembly = typeof(DungeonBasement.Plugin).Assembly;
CreatePresetConfig(basementAssembly, ConfigDungeon<ConfigDungeonBasement>.dungeonGenerationPreset.config, ConfigDungeon<ConfigDungeonBasement>.CreateDungeonGenerationPresetDescriptions());
CreatePresetConfig(basementAssembly, ConfigDungeon<ConfigDungeonBasement>.dungeonLightingPreset.config, ConfigDungeon<ConfigDungeonBasement>.CreateDungeonLightingPresetDescriptions());
AutoGenerateConfigs<T>(basementAssembly, ConfigDungeon<ConfigDungeonBasement>.dungeonGenerationPreset, ConfigDungeon<ConfigDungeonBasement>.dungeonLightingPreset);
}
try { try {
//Plugin.Instance.harmony.PatchAll(typeof(LethalConfigPatch)); //Plugin.Instance.harmony.PatchAll(typeof(LethalConfigPatch));
} catch (Exception e) { } catch (Exception e) {

View File

@ -18,7 +18,10 @@ namespace ScarletMansion.ModPatch {
public static readonly ModPatch[] modPatches = new ModPatch[] { public static readonly ModPatch[] modPatches = new ModPatch[] {
//new AdvancedCompanyPatch(advancedCompanyGuid), //new AdvancedCompanyPatch(advancedCompanyGuid),
new LethalConfigPatch<ConfigMain>(lethalConfigGuid),
new LethalConfigPatch<ConfigDungeonFoyer>(lethalConfigGuid), new LethalConfigPatch<ConfigDungeonFoyer>(lethalConfigGuid),
new LethalConfigPatch<ConfigDungeonBasement>(lethalConfigGuid),
new FacilityMeltdownPatch(facilityMeldownGuid), new FacilityMeltdownPatch(facilityMeldownGuid),
new ReservedFlashlightPatch(reserveFlashlightGuid), new ReservedFlashlightPatch(reserveFlashlightGuid),
new ReservedKeyPatch(reserveKeyGuid) new ReservedKeyPatch(reserveKeyGuid)

View File

@ -17,6 +17,7 @@ using ScarletMansion.ModPatch;
using ScarletMansion.DunGenPatch; using ScarletMansion.DunGenPatch;
using ScarletMansion.GamePatch.Managers; using ScarletMansion.GamePatch.Managers;
using ScarletMansion.Configs; using ScarletMansion.Configs;
using DunGen.Graph;
namespace ScarletMansion { namespace ScarletMansion {
@ -26,7 +27,7 @@ namespace ScarletMansion {
[BepInDependency("evaisa.lethallib", "0.13.2")] [BepInDependency("evaisa.lethallib", "0.13.2")]
[BepInDependency("dev.ladyalice.dungenplus", "1.3.3")] [BepInDependency("dev.ladyalice.dungenplus", "1.3.3")]
[BepInDependency("dev.ladyalice.scarletmansion.foyer")] [BepInDependency("dev.ladyalice.scarletmansion.foyer")]
[BepInDependency("dev.ladyalice.scarletmansion.basement")]
//[BepInDependency(ModCompability.advancedCompanyGuid, BepInDependency.DependencyFlags.SoftDependency)] //[BepInDependency(ModCompability.advancedCompanyGuid, BepInDependency.DependencyFlags.SoftDependency)]
[BepInDependency(ModCompability.lethalConfigGuid, BepInDependency.DependencyFlags.SoftDependency)] [BepInDependency(ModCompability.lethalConfigGuid, BepInDependency.DependencyFlags.SoftDependency)]
[BepInDependency(ModCompability.facilityMeldownGuid, BepInDependency.DependencyFlags.SoftDependency)] [BepInDependency(ModCompability.facilityMeldownGuid, BepInDependency.DependencyFlags.SoftDependency)]
@ -44,12 +45,9 @@ namespace ScarletMansion {
public static ConfigMain ConfigMain { get; internal set; } public static ConfigMain ConfigMain { get; internal set; }
public static ConfigDungeonFoyer ConfigFoyer { get; internal set; } public static ConfigDungeonFoyer ConfigFoyer { get; internal set; }
public static ConfigDungeonBasement ConfigBasement { get; internal set; }
public static IConfigDungeon GetConfigDungeon { public static IConfigDungeon CurrentConfigDungeon { get; internal set; }
get {
return ConfigFoyer;
}
}
public static ManualLogSource logger { 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); var foyerFile = new ConfigFile(Path.Combine(Paths.ConfigPath, $"{modGUID}.foyer.cfg"), true);
ConfigFoyer = new ConfigDungeonFoyer(foyerFile); 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.GetActiveMods();
ModCompability.ActivateActiveMods(); ModCompability.ActivateActiveMods();
@ -85,6 +84,7 @@ namespace ScarletMansion {
harmony.PatchAll(typeof(ConfigMain)); harmony.PatchAll(typeof(ConfigMain));
harmony.PatchAll(typeof(ConfigDungeonFoyer)); harmony.PatchAll(typeof(ConfigDungeonFoyer));
harmony.PatchAll(typeof(ConfigDungeonBasement));
SetupForNetcodePatcher(); SetupForNetcodePatcher();
@ -93,28 +93,21 @@ namespace ScarletMansion {
var dungeonMatchPropeties = ScriptableObject.CreateInstance<DungeonMatchingProperties>(); var dungeonMatchPropeties = ScriptableObject.CreateInstance<DungeonMatchingProperties>();
dungeonMatchPropeties.authorNames.Add(new StringWithRarity("Alice", 10)); dungeonMatchPropeties.authorNames.Add(new StringWithRarity("Alice", 10));
/*
var itemLevelMatchProperties = ScriptableObject.CreateInstance<LevelMatchingProperties>();
foreach(var item in Assets.items){
item.stringWithRarity = new StringWithRarity("Alice", 0);
itemLevelMatchProperties.authorNames.Add(item.stringWithRarity);
}
*/
var sdmLevelMatchProperties = ScriptableObject.CreateInstance<LevelMatchingProperties>();
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<ExtendedContent>(); var extendedContent = new List<ExtendedContent>();
ExtendedDungeonFlow CreateExtendedDungeonFlow<T>(T configDungeon, string dungeonName, int dineWeight, int rendWeight, int titanWeight) where T: ConfigDungeon<T> {
var extendedDungeon = ScriptableObject.CreateInstance<ExtendedDungeonFlow>(); var extendedDungeon = ScriptableObject.CreateInstance<ExtendedDungeonFlow>();
extendedDungeon.name = "Scarlet Devil Mansion"; extendedDungeon.name = dungeonName;
extendedDungeon.DungeonName = "Scarlet Devil Mansion"; extendedDungeon.DungeonName = dungeonName;
extendedDungeon.DungeonFlow = ConfigFoyer.dungeon; extendedDungeon.DungeonFlow = configDungeon.dungeon;
extendedDungeon.FirstTimeDungeonAudio = Assets.entranceAudioClip; extendedDungeon.FirstTimeDungeonAudio = Assets.entranceAudioClip;
var sdmLevelMatchProperties = ScriptableObject.CreateInstance<LevelMatchingProperties>();
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.LevelMatchingProperties = sdmLevelMatchProperties;
extendedDungeon.DynamicDungeonSizeMinMax = new Vector2(1f, 2f); extendedDungeon.DynamicDungeonSizeMinMax = new Vector2(1f, 2f);
@ -122,38 +115,28 @@ namespace ScarletMansion {
extendedDungeon.GenerateAutomaticConfigurationOptions = true; extendedDungeon.GenerateAutomaticConfigurationOptions = true;
extendedContent.Add(extendedDungeon); configDungeon.dungeonExtended = extendedDungeon;
// items extendedDungeon.DungeonEvents.onBeforeDungeonGenerate.AddListener(GeneratePathPatch.GeneratePatch);
/* extendedDungeon.DungeonEvents.onBeforeDungeonGenerate.AddListener(LoadAssetsIntoLevelPatch.AddItemsLocal);
foreach(var item in Assets.items){ extendedDungeon.DungeonEvents.onBeforeDungeonGenerate.AddListener(LoadAssetsIntoLevelPatch.AddEnemiesLocal);
var extendedItem = ScriptableObject.CreateInstance<ExtendedItem>();
extendedItem.Item = item.item;
extendedItem.DungeonMatchingProperties = dungeonMatchPropeties;
//extendedItem.LevelMatchingProperties = itemLevelMatchProperties;
extendedContent.Add(extendedItem); 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()); var extendedMod = ExtendedMod.Create("Scarlet Devil Mansion", "Alice", extendedContent.ToArray());
PatchedContent.RegisterExtendedMod(extendedMod); PatchedContent.RegisterExtendedMod(extendedMod);
Assets.extendedMod = 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); 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(){ void SetupForNetcodePatcher(){

View File

@ -49,6 +49,9 @@
<Reference Include="DunGenPlus"> <Reference Include="DunGenPlus">
<HintPath>..\..\..\Libraries\DunGenPlus.dll</HintPath> <HintPath>..\..\..\Libraries\DunGenPlus.dll</HintPath>
</Reference> </Reference>
<Reference Include="DungeonBasement">
<HintPath>..\..\..\Libraries\DungeonBasement.dll</HintPath>
</Reference>
<Reference Include="DungeonFoyer"> <Reference Include="DungeonFoyer">
<HintPath>..\..\..\Libraries\DungeonFoyer.dll</HintPath> <HintPath>..\..\..\Libraries\DungeonFoyer.dll</HintPath>
</Reference> </Reference>
@ -154,6 +157,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Assets.cs" /> <Compile Include="Assets.cs" />
<Compile Include="Configs\ConfigDungeonBasement.cs" />
<Compile Include="Configs\ConfigMain.cs" /> <Compile Include="Configs\ConfigMain.cs" />
<Compile Include="Configs\ConfigManager.cs" /> <Compile Include="Configs\ConfigManager.cs" />
<Compile Include="Configs\ConfigDungeonFoyer.cs" /> <Compile Include="Configs\ConfigDungeonFoyer.cs" />