Fixed knight ghost to sprint when you ain't looking Fixed Gohei to detect enemies
54 lines
2.3 KiB
C#
54 lines
2.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using HarmonyLib;
|
|
using GameNetcodeStuff;
|
|
using System.Reflection;
|
|
using System.Reflection.Emit;
|
|
using BepInEx.Logging;
|
|
using UnityEngine;
|
|
using ScarletMansion.GamePatch.Managers;
|
|
|
|
namespace ScarletMansion.GamePatch {
|
|
public class RoundManagerPatch {
|
|
|
|
public static InjectionDictionary scrapInjection = new InjectionDictionary(
|
|
"Scrap",
|
|
typeof(RoundManagerPatch).GetMethod("ModifyScrapCount", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public),
|
|
new CodeInstruction(OpCodes.Ldfld, typeof(RoundManager).GetField("scrapAmountMultiplier"))
|
|
);
|
|
|
|
public static InjectionDictionary mapHazardInjection = new InjectionDictionary(
|
|
"Map Hazard",
|
|
typeof(RoundManagerPatch).GetMethod("ModifyMapCount", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public),
|
|
new CodeInstruction(OpCodes.Callvirt, typeof(AnimationCurve).GetMethod("Evaluate", BindingFlags.Instance | BindingFlags.Public))
|
|
);
|
|
|
|
[HarmonyTranspiler]
|
|
[HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")]
|
|
public static IEnumerable<CodeInstruction> SpawnScrapInLevelPatch(IEnumerable<CodeInstruction> instructions){
|
|
return TranspilerUtilities.InjectMethod(instructions, scrapInjection, "SpawnScrapInLevel", 1);
|
|
}
|
|
|
|
[HarmonyTranspiler]
|
|
[HarmonyPatch(typeof(RoundManager), "SpawnMapObjects")]
|
|
public static IEnumerable<CodeInstruction> SpawnMapObjectsPatch(IEnumerable<CodeInstruction> instructions){
|
|
return TranspilerUtilities.InjectMethod(instructions, mapHazardInjection, "SpawnMapObjects", 1);
|
|
}
|
|
|
|
public static float ModifyScrapCount(float count){
|
|
if (DunGenPatch.Patch.active == false) return count;
|
|
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.CurrentConfigDungeon.GetMapHazardsMultiplier}");
|
|
return count * Plugin.CurrentConfigDungeon.GetMapHazardsMultiplier;
|
|
}
|
|
|
|
}
|
|
}
|