-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBasicMovement.cs
More file actions
64 lines (57 loc) · 2.27 KB
/
Copy pathBasicMovement.cs
File metadata and controls
64 lines (57 loc) · 2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
using FlipwitchAP.Archipelago;
using HarmonyLib;
using UnityEngine;
namespace FlipwitchAP;
public class BasicMovement
{
// No roll unless ghost.
[HarmonyPatch(typeof(PlayerMovement), "updateRollInput")]
[HarmonyPrefix]
private static bool UpdateRollInput_DontRollIfNoItem(PlayerMovement __instance, ref bool ___HasDemonDashed, ref float ___HealingTimer, ref float ___RollTimer,
ref bool ___IsAttacking, ref bool ___EnemyStruck, ref bool ___allowMovement, ref float ___rollCoolDown, ref bool ___IsRangeAttacking,
ref bool ___IsCrouching)
{
if (!ArchipelagoClient.ServerData.ShuffleRoll)
{
return true;
}
if (___HasDemonDashed || ___HealingTimer > 0f)
{
return false;
}
if (___RollTimer > 0f)
{
___RollTimer -= Time.deltaTime;
}
if (NewInputManager.instance.Roll.pressedThisFrame &&
(!___IsAttacking || (___IsAttacking && ___EnemyStruck)) && !__instance.IsRolling && !__instance.climbing && ___allowMovement && ___rollCoolDown <= 0f &&
(!___IsRangeAttacking || !___IsCrouching) && !SwitchDatabase.instance.dialogueManager.dialogueOrCutsceneOrIngameCutsceneInProgress() &&
__instance.controller.isGrounded())
{
var canRoll = SwitchDatabase.instance.getBool("APCanRoll");
if (canRoll) __instance.GetType().GetMethod("_StartRoll", GenericMethods.Flags).Invoke(__instance, [true]);
}
if (__instance.IsRolling && ___RollTimer <= 0f)
{
__instance.GetType().GetMethod("endRoll", GenericMethods.Flags).Invoke(__instance, null);
}
return false;
}
[HarmonyPatch(typeof(PlayerController), "Move")]
[HarmonyPostfix]
private static void Move_ClaimUsedDoubleIfNoDouble(PlayerController __instance, float move, bool crouch, bool jump,
bool climbing, float moveY, bool isSlime, ref bool ___singleJump, ref bool ___doubleJump)
{
if (!ArchipelagoClient.ServerData.ShuffleDoubleJump)
{
return;
}
if (!SwitchDatabase.instance.getBool("APCanDouble"))
{
if (___singleJump)
{
___doubleJump = true;
}
}
}
}