Added configs for items and enemies

Critical damage renamed to marked for death and all share the same mechanic now
Revelant now slows down to speed over a fixed short amount instead the nonworking jank before
Moved item/enemy injection to DunGenPlus
This commit is contained in:
LadyAliceMargatroid 2024-12-15 09:23:53 -08:00
parent e38be14578
commit fd731baf2f
33 changed files with 551 additions and 470 deletions

View file

@ -0,0 +1,118 @@

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using BepInEx;
using HarmonyLib;
using Mimics;
using Mimics.API;
using System.Reflection;
using System.Reflection.Emit;
using DunGen;
using ScarletMansion.GamePatch.FixValues;
using UnityEngine.Events;
using GameNetcodeStuff;
using ScarletMansion;
using ScarletMansion.GamePatch.Components;
using ScarletMansion.DunGenPatch;
namespace ScarletMansionMimicsPatch {
public class Patch {
public static void Activate() {
MimicsAPI.GetAPI().RegisterMimicEventHandler(new Patch.SDMMimicEventHandler());
Plugin.Instance.harmony.PatchAll(typeof(Patch));
}
public class SDMMimicEventHandler : MimicEventHandler
{
public override string ModGUID => Plugin.modGUID;
public override bool IsMyInteriorLoaded => ScarletMansion.DunGenPatch.Patch.active;
public override void OnMimicCreated(MimicDoor mimicDoor, Doorway doorway) {
var c = doorway.transform.parent.GetComponentInChildren<DunGenPlus.Components.DoorwayCleanup>();
if (c != null) {
c.overrideConnector = true;
c.overrideNoDoorway = true;
}
var fixfireexit = doorway.GetComponentInChildren<FixFireExit>(true);
fixfireexit.ForcefullyEnableDoorway();
var mimicDoorMesh = ScarletMansion.Utility.FindChildRecurvisely(mimicDoor.transform, "DoorMesh");
var mimicFrame = ScarletMansion.Utility.FindChildRecurvisely(mimicDoor.transform, "Frame");
var mimicLight = ScarletMansion.Utility.FindChildRecurvisely(mimicDoor.transform, "Light");
if (fixfireexit.EnableVanillaFireExit){
FixDoorwayForVanillaFireExit(fixfireexit, mimicDoorMesh, mimicFrame, mimicLight);
} else {
FixDoorwayForSDMFireExit(fixfireexit, mimicDoorMesh, mimicFrame, mimicLight);
}
Plugin.logger.LogDebug("Fixed a doorway for a mimic");
}
public override void OnMimicAttackStart(MimicDoor mimicDoor, PlayerControllerB playerToAttack) {
var doorway = mimicDoor.GetComponentInParent<Doorway>();
var fireexit = doorway.GetComponentInChildren<ScarletFireExit>();
fireexit?.DisableEnablePortal();
}
}
private static bool colorBlindModeLastValue;
[HarmonyPrefix]
[HarmonyPatch("Mimics.Mimics+RoundManagerPatch, Mimics", "SetExitIDsPatch")]
public static void SetExitIDsPatchPrefix(){
colorBlindModeLastValue = Mimics.Mimics.ColorBlindMode;
}
[HarmonyPostfix]
[HarmonyPatch("Mimics.Mimics+RoundManagerPatch, Mimics", "SetExitIDsPatch")]
public static void SetExitIDsPatchPostfix(){
Mimics.Mimics.ColorBlindMode = colorBlindModeLastValue;
}
private static void FixDoorwayForVanillaFireExit(FixFireExit fixFireExit, Transform mimicDoorMesh, Transform mimicFrame, Transform mimicLight){
if (mimicDoorMesh != null) {
mimicDoorMesh.localPosition = new Vector3(-0.07f, 0f, 0.06f);
var sc = mimicDoorMesh.localScale;
sc.y = -0.0002f;
sc.z = -0.000161f;
mimicDoorMesh.localScale = sc;
} else {
Plugin.logger.LogWarning("Could not find DoorMesh in mimic gameobject. It will look weird but nothing should break");
}
if (mimicFrame != null) {
mimicFrame.localPosition = new Vector3(0f, -0.02f, 0.07f);
mimicFrame.localScale = new Vector3(1.08f, 1.008f, 1.02f);
} else {
Plugin.logger.LogWarning("Could not find Frame in mimic gameobject. It will look weird but nothing should break");
}
}
private static void FixDoorwayForSDMFireExit(FixFireExit fixFireExit, Transform mimicDoorMesh, Transform mimicFrame, Transform mimicLight){
Mimics.Mimics.ColorBlindMode = true;
fixFireExit.ForcefullyEnableSDMRender();
fixFireExit.sdmFireExit.enablePortalAnimation = true;
if (mimicDoorMesh != null) mimicDoorMesh.gameObject.SetActive(false);
else Plugin.logger.LogWarning("Could not find DoorMesh in mimic gameobject. It will look weird but nothing should break");
if (mimicFrame != null) mimicFrame.gameObject.SetActive(false);
else Plugin.logger.LogWarning("Could not find Frame in mimic gameobject. It will look weird but nothing should break");
if (mimicLight != null) mimicLight.gameObject.SetActive(false);
else Plugin.logger.LogWarning("Could not find Light in mimic gameobject. It will look weird but nothing should break");
}
}
}

View file

@ -0,0 +1,65 @@
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using ScarletMansion;
using ScarletMansion.DunGenPatch;
using ScarletMansion.GamePatch.Managers;
using ScarletMansion.GamePatch;
using ScarletMansion.ModPatch;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using Mimics.API;
using BepInEx.Bootstrap;
namespace ScarletMansionMimicsPatch {
[BepInPlugin(modGUID, modName, modVersion)]
[BepInDependency("dev.ladyalice.scarletmansion", "1.3.22")]
[BepInDependency(targetModGUID, BepInDependency.DependencyFlags.SoftDependency)]
public class Plugin : BaseUnityPlugin {
public const string modGUID = "dev.ladyalice.scarletmansion.mimicspatch";
private const string modName = "Scarlet Mansion Mimics Patch";
private const string modVersion = "1.0.0";
public const string targetModGUID = "x753.Mimics";
public const string targetModVersion = "2.6.0";
public readonly Harmony harmony = new Harmony(modGUID);
public static Plugin Instance {get; private set;}
public static ManualLogSource logger { get; internal set; }
void Awake(){
if (Instance == null) Instance = this;
logger = BepInEx.Logging.Logger.CreateLogSource(modGUID);
var modLoaded = Chainloader.PluginInfos.ContainsKey(targetModGUID);
if (!modLoaded) return;
bool validVersion;
var pluginInfo = Chainloader.PluginInfos[targetModGUID];
var loadedVersion = pluginInfo.Metadata.Version;
if (string.IsNullOrWhiteSpace(targetModVersion)){
validVersion = true;
} else {
var requiredVersion = new Version(targetModVersion);
validVersion = loadedVersion >= requiredVersion;
}
if (validVersion){
logger.LogInfo($"Plugin {modName} has been added!");
Patch.Activate();
}
}
}
}

View file

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// アセンブリに関する一般情報は以下を通して制御されます
// 制御されます。アセンブリに関連付けられている情報を変更するには、
// これらの属性値を変更してください。
[assembly: AssemblyTitle("ScarletMansionMimicsPatch")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ScarletMansionMimicsPatch")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// ComVisible を false に設定すると、このアセンブリ内の型は COM コンポーネントから
// 参照できなくなります。COM からこのアセンブリ内の型にアクセスする必要がある場合は、
// その型の ComVisible 属性を true に設定してください。
[assembly: ComVisible(false)]
// このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります
[assembly: Guid("6aab73ec-489e-4baa-8bd1-7ca944359cec")]
// アセンブリのバージョン情報は、以下の 4 つの値で構成されています:
//
// メジャー バージョン
// マイナー バージョン
// ビルド番号
// リビジョン
//
// すべての値を指定するか、次を使用してビルド番号とリビジョン番号を既定に設定できます
// 既定値にすることができます:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View file

@ -0,0 +1,73 @@
<?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>{6AAB73EC-489E-4BAA-8BD1-7CA944359CEC}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ScarletMansionMimicsPatch</RootNamespace>
<AssemblyName>ScarletMansionMimicsPatch</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="Assembly-CSharp-publicized">
<HintPath>..\..\..\Libraries\Assembly-CSharp-publicized.dll</HintPath>
</Reference>
<Reference Include="BepInEx">
<HintPath>..\..\..\Libraries\BepInEx.dll</HintPath>
</Reference>
<Reference Include="DunGenPlus">
<HintPath>..\..\..\Libraries\DunGenPlus.dll</HintPath>
</Reference>
<Reference Include="Mimics">
<HintPath>..\..\..\Libraries\Mimics.dll</HintPath>
</Reference>
<Reference Include="ScarletMansion">
<HintPath>..\..\..\Libraries\ScarletMansion.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>
</ItemGroup>
<ItemGroup>
<Compile Include="Patch.cs" />
<Compile Include="Plugin.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>