Moved dungen code to DunGenPlus

Added critical damage as a mechanic
Maid knife feed deals critical damage, then kills on second time
Added concept of treasure room with kitchen
Frames now only start at the player when not being looked
New attempt at snowglobe animations, it broke though
Added concept of indoor weathers
LethalConfig compability now changes the color of configs that my presets touch
Added jukebox
Changed modGUID
Removed AC compability
Falling into void deals critical damage and teleports, then kills on second time
Maid spawns revenant ghost on death
This commit is contained in:
LadyAliceMargatroid 2024-08-02 08:56:09 -07:00
parent faa391c309
commit 056cac8df1
63 changed files with 976 additions and 2061 deletions

View file

@ -12,6 +12,7 @@ using UnityEngine;
using System.Collections;
using DunGen;
using LethalLevelLoader;
using DunGen.Graph;
namespace ScarletMansion.DunGenPatch {
@ -20,10 +21,8 @@ namespace ScarletMansion.DunGenPatch {
[HarmonyPatch(typeof(RoundManager), "GenerateNewFloor")]
[HarmonyPrefix]
public static void DungeonGeneratorGenerate_PrefixPrefix(){
// safety check
Plugin.logger.LogInfo("Disabling SDM logic");
Patch.Deactivate();
//Patch.ActivateAnalysis();
}
public static void GeneratePatch(RoundManager roundManager){
@ -31,91 +30,6 @@ namespace ScarletMansion.DunGenPatch {
Patch.Activate(roundManager.dungeonGenerator.Generator);
}
[HarmonyPostfix]
[HarmonyPatch(typeof(DungeonGenerator), "GenerateMainPath")]
public static void GenerateMainPathPatch(ref DungeonGenerator __instance, ref IEnumerator __result){
if (Patch.active && Patch.callAlternative) {
GeneratePath.RandomizeLineArchetypes(__instance, true);
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(DungeonGenerator), "GenerateBranchPaths")]
public static void GenerateBranchPathsPatch(ref DungeonGenerator __instance, ref IEnumerator __result){
if (Patch.active && Patch.callAlternative) {
__result = GeneratePath.GenerateAlternativeMainPaths(__instance);
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(RoundManager), "FinishGeneratingLevel")]
public static void GenerateBranchPathsPatch(){
if (Patch.active) {
Plugin.logger.LogInfo("Alt. InnerGenerate() function complete");
}
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(DungeonGenerator), "GenerateMainPath", MethodType.Enumerator)]
public static IEnumerable<CodeInstruction> GenerateMainPathPatch(IEnumerable<CodeInstruction> instructions){
var addFunction = typeof(List<DungeonArchetype>).GetMethod("Add", BindingFlags.Instance | BindingFlags.Public);
var sequence = new InstructionSequence("archetype node");
sequence.AddOperandTypeCheck(OpCodes.Ldfld, typeof(List<DungeonArchetype>));
sequence.AddBasic(OpCodes.Ldnull);
sequence.AddBasic(OpCodes.Callvirt, addFunction);
foreach(var instruction in instructions){
if (sequence.VerifyStage(instruction)){
var method = typeof(GeneratePath).GetMethod("ModifyMainBranchNodeArchetype", BindingFlags.Public | BindingFlags.Static);
yield return new CodeInstruction(OpCodes.Ldloc_S, 8);
yield return new CodeInstruction(OpCodes.Call, method);
yield return instruction;
continue;
}
yield return instruction;
}
sequence.ReportComplete();
}
/*
[HarmonyPatch(typeof(DungeonGenerator), "AddTile")]
[HarmonyPostfix]
public static void AddTilePatch(TileProxy attachTo, IEnumerable<TileSet> useableTileSets, DungeonArchetype archetype, ref TileProxy __result){
var atString = attachTo != null ? attachTo.Prefab.ToString() : "NULL";
var aString = archetype ? archetype.ToString() : "NULL";
var rString = __result != null ? __result.Prefab.ToString() : "NULL";
Plugin.logger.LogInfo($"");
Plugin.logger.LogInfo($"Attach: {atString}");
Plugin.logger.LogInfo($"ValidCount: {useableTileSets.Sum(u => u.TileWeights.Weights.Count).ToString()}");
Plugin.logger.LogInfo($"Entry: {aString}");
Plugin.logger.LogInfo($"Result: {rString}");
}
[HarmonyPatch(typeof(DungeonGenerator), "TryPlaceTile")]
[HarmonyPostfix]
public static void TryPlaceTilePatch(ref TilePlacementResult __result){
Plugin.logger.LogInfo(__result.ToString());
}
[HarmonyPatch(typeof(DoorwayPairFinder), "GetDoorwayPairs")]
[HarmonyPostfix]
public static void GetDoorwayPairsPatch(ref Queue<DoorwayPair> __result){
Plugin.logger.LogInfo(__result.Count().ToString());
}
*/
}