됨? => 안됨

vpe 호환 => 메서드를 찾지를 못함 타입 한번 봐야할듯
바닐라 => 망가짐 위와 비슷한 이유일듯
This commit is contained in:
2025-05-28 14:09:32 +09:00
parent 7ce3eb956a
commit cce9f99cde
5 changed files with 416 additions and 24 deletions

View File

@@ -11,32 +11,64 @@ namespace psycastDontNeedPsyfocus
static HarmonyPatches()
{
var harmony = new Harmony("com.a4plane.psycastDontNeedPsyfocus");
harmony.PatchAll(Assembly.GetExecutingAssembly());
//harmony.PatchAll(Assembly.GetExecutingAssembly());
var VPEMod = AccessTools.TypeByName("VanillaPsycastsExpanded.AbilityExtension");
if (VPEMod != null)
{
Log.Message("find VPE");
var method = AccessTools.Method(VPEMod, "GetPsyfocusUsedByPawn");
if (method != null)
{
harmony.Patch(method, postfix: new HarmonyMethod(typeof(HarmonyPatches), nameof(Postfix_VPE)));
}
}
else
{
Log.Message("Cant find vpe");
}
var Vmethod = typeof(AbilityDef).GetProperty(nameof(AbilityDef.PsyfocusCost)).GetGetMethod();
harmony.Patch(Vmethod, postfix: new HarmonyMethod(typeof(HarmonyPatch), nameof(Postfix_V)));
if (Vmethod != null)
{
Log.Message("find v method");
}
}
public static void Postfix_VPE(ref float __result)
{
Log.Message("qweqwwqe");
__result = 0;
}
public static void Postfix_V(ref float __result)
{
Log.Message("eweqw");
__result = 0;
}
}
//def에서 초집중 값 읽어오는 부분 패치해서 됨
//todo ui에서 초집중 요소 날리기
[HarmonyPatch]
class Patcher
{
public static MethodBase TargetMethod()
{
return typeof(AbilityDef).GetProperty(nameof(AbilityDef.PsyfocusCost)).GetGetMethod();
}
public static void Postfix(ref float __result)
{
//Log.Message("qewqwe");
__result = 0f;
}
//public static class ValidateTarget_ValidateTarget_Patch
//{
// static void postfix(ref bool __result/*,ref Ability ability*/)
// {
// Log.Message("aaa");
// __result = true;
// }
//}
}
//[HarmonyPatch]
//class Patcher
//{
// public static MethodBase TargetMethod()
// {
// return typeof(AbilityDef).GetProperty(nameof(AbilityDef.PsyfocusCost)).GetGetMethod();
// }
// public static void Postfix(ref float __result)
// {
// //Log.Message("qewqwe");
// __result = 0f;
// }
// //public static class ValidateTarget_ValidateTarget_Patch
// //{
// // static void postfix(ref bool __result/*,ref Ability ability*/)
// // {
// // Log.Message("aaa");
// // __result = true;
// // }
// //}
//}
}