Updated knight for v62 coilhead
Knight enters a brief cooldown after attacking Fixed knight LOS not working for 5+ players (I'm going to strangle zeekers)
This commit is contained in:
parent
523e7ed898
commit
a2531e246f
|
@ -41,6 +41,10 @@ namespace ScarletMansion.GamePatch.Enemies {
|
|||
private bool setOnCooldown;
|
||||
public float timeAtLastCooldown;
|
||||
|
||||
private Vector3 previousPosition;
|
||||
private float checkPositionInterval;
|
||||
private bool isMakingDistance;
|
||||
|
||||
// Token: 0x04000F2A RID: 3882
|
||||
private bool inCooldownAnimation;
|
||||
|
||||
|
@ -56,16 +60,16 @@ namespace ScarletMansion.GamePatch.Enemies {
|
|||
}
|
||||
|
||||
[ServerRpc(RequireOwnership = false)]
|
||||
public void SetCoilheadOnCooldownServerRpc(bool setTrue) {
|
||||
SetCoilheadOnCooldownClientRpc(setTrue);
|
||||
public void SetCoilheadOnCooldownServerRpc(float cooldown) {
|
||||
SetCoilheadOnCooldownClientRpc(cooldown);
|
||||
}
|
||||
|
||||
// Token: 0x06000F6F RID: 3951 RVA: 0x000942FC File Offset: 0x000924FC
|
||||
[ClientRpc]
|
||||
public void SetCoilheadOnCooldownClientRpc(bool setTrue) {
|
||||
public void SetCoilheadOnCooldownClientRpc(float cooldown) {
|
||||
timeSpentMoving = 0f;
|
||||
if (setTrue) {
|
||||
onCooldownPhase = 20f;
|
||||
if (cooldown > 0f) {
|
||||
onCooldownPhase = cooldown;
|
||||
setOnCooldown = true;
|
||||
inCooldownAnimation = true;
|
||||
SwitchToBehaviourStateOnLocalClient(0);
|
||||
|
@ -77,6 +81,7 @@ namespace ScarletMansion.GamePatch.Enemies {
|
|||
|
||||
return;
|
||||
}
|
||||
|
||||
onCooldownPhase = 0f;
|
||||
setOnCooldown = false;
|
||||
timeAtLastCooldown = Time.realtimeSinceStartup;
|
||||
|
@ -143,7 +148,7 @@ namespace ScarletMansion.GamePatch.Enemies {
|
|||
|
||||
if (setOnCooldown) {
|
||||
setOnCooldown = false;
|
||||
SetCoilheadOnCooldownClientRpc(false);
|
||||
SetCoilheadOnCooldownClientRpc(0f);
|
||||
}
|
||||
|
||||
loseAggroTimer = 0f;
|
||||
|
@ -198,6 +203,7 @@ namespace ScarletMansion.GamePatch.Enemies {
|
|||
offMeshLinkCoroutine = null;
|
||||
var currentOffMeshLinkData = agent.currentOffMeshLinkData;
|
||||
agent.CompleteOffMeshLink();
|
||||
|
||||
if (currentOffMeshLinkData.valid) {
|
||||
if (Vector3.SqrMagnitude(transform.position - currentOffMeshLinkData.startPos) < Vector3.SqrMagnitude(transform.position - currentOffMeshLinkData.endPos)) {
|
||||
agent.Warp(currentOffMeshLinkData.startPos);
|
||||
|
@ -286,7 +292,7 @@ namespace ScarletMansion.GamePatch.Enemies {
|
|||
}
|
||||
|
||||
var flag = false;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++) {
|
||||
if (PlayerIsTargetable(StartOfRound.Instance.allPlayerScripts[i], false, false) && (StartOfRound.Instance.allPlayerScripts[i].HasLineOfSightToPosition(transform.position + Vector3.up * 0.25f, 68f, 60, -1f) || StartOfRound.Instance.allPlayerScripts[i].HasLineOfSightToPosition(transform.position + Vector3.up * 1.6f, 68f, 60, -1f)) && Vector3.Distance(StartOfRound.Instance.allPlayerScripts[i].gameplayCamera.transform.position, eye.position) > 0.3f) {
|
||||
flag = true;
|
||||
}
|
||||
|
@ -301,12 +307,9 @@ namespace ScarletMansion.GamePatch.Enemies {
|
|||
}
|
||||
}
|
||||
|
||||
var num = 0f;
|
||||
if (stoppingMovement) {
|
||||
if (!animStopPoints.canAnimationStop && stopMovementTimer <= 0.27f) {
|
||||
stopMovementTimer += Time.deltaTime;
|
||||
return;
|
||||
}
|
||||
|
||||
if (animStopPoints.canAnimationStop || stopMovementTimer > 0.27f) {
|
||||
if (!hasStopped) {
|
||||
hasStopped = true;
|
||||
DoSpringAnimation(false);
|
||||
|
@ -315,6 +318,10 @@ namespace ScarletMansion.GamePatch.Enemies {
|
|||
DoSpringAnimation(true);
|
||||
}
|
||||
|
||||
if (RoundManager.Instance.currentMineshaftElevator != null && Vector3.Distance(transform.position, RoundManager.Instance.currentMineshaftElevator.elevatorInsidePoint.position) < 1f) {
|
||||
num = 0.5f;
|
||||
}
|
||||
|
||||
if (mainCollider.isTrigger && Vector3.Distance(GameNetworkManager.Instance.localPlayerController.transform.position, transform.position) > 0.3f) {
|
||||
mainCollider.isTrigger = false;
|
||||
}
|
||||
|
@ -325,35 +332,57 @@ namespace ScarletMansion.GamePatch.Enemies {
|
|||
agent.speed = 0f;
|
||||
movingTowardsTargetPlayer = false;
|
||||
SetDestinationToPosition(transform.position, false);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
stopMovementTimer += Time.deltaTime;
|
||||
}
|
||||
} else {
|
||||
stopMovementTimer = 0f;
|
||||
if (hasStopped) {
|
||||
hasStopped = false;
|
||||
mainCollider.isTrigger = true;
|
||||
isMakingDistance = true;
|
||||
}
|
||||
|
||||
currentAnimSpeed = Mathf.Lerp(currentAnimSpeed, currentChaseSpeed * 0.4597f, 5f * Time.deltaTime);
|
||||
creatureAnimator.SetFloat("walkSpeed", currentAnimSpeed);
|
||||
inCooldownAnimation = false;
|
||||
|
||||
if (IsServer) {
|
||||
timeSpentMoving += Time.deltaTime;
|
||||
if (timeSpentMoving > 20f)
|
||||
{
|
||||
onCooldownPhase = 20f;
|
||||
setOnCooldown = true;
|
||||
inCooldownAnimation = true;
|
||||
SetCoilheadOnCooldownClientRpc(true);
|
||||
SwitchToBehaviourStateOnLocalClient(0);
|
||||
}
|
||||
if (checkPositionInterval <= 0f) {
|
||||
checkPositionInterval = 0.65f;
|
||||
isMakingDistance = (Vector3.Distance(transform.position, previousPosition) > 0.5f);
|
||||
previousPosition = transform.position;
|
||||
} else {
|
||||
checkPositionInterval -= Time.deltaTime;
|
||||
}
|
||||
|
||||
if (isMakingDistance) {
|
||||
num = 1f;
|
||||
} else {
|
||||
num = 0.2f;
|
||||
}
|
||||
}
|
||||
if (IsOwner) {
|
||||
agent.speed = Mathf.Lerp(agent.speed, currentChaseSpeed, 4.5f * Time.deltaTime);
|
||||
movingTowardsTargetPlayer = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (IsServer) {
|
||||
if (num > 0f) {
|
||||
timeSpentMoving += Time.deltaTime * num;
|
||||
}
|
||||
|
||||
if (timeSpentMoving > 9f) {
|
||||
onCooldownPhase = 11f;
|
||||
setOnCooldown = true;
|
||||
inCooldownAnimation = true;
|
||||
SetCoilheadOnCooldownClientRpc(25f);
|
||||
SwitchToBehaviourStateOnLocalClient(0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Token: 0x06000F75 RID: 3957 RVA: 0x00094F98 File Offset: 0x00093198
|
||||
|
@ -393,6 +422,8 @@ namespace ScarletMansion.GamePatch.Enemies {
|
|||
playerControllerB.DamagePlayer(90, true, true, CauseOfDeath.Mauling, 0);
|
||||
playerControllerB.JumpToFearLevel(1f, true);
|
||||
timeSinceHittingPlayer = Time.realtimeSinceStartup;
|
||||
|
||||
SetCoilheadOnCooldownServerRpc(5f);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace ScarletMansion {
|
|||
public class Plugin : BaseUnityPlugin {
|
||||
public const string modGUID = "dev.ladyalice.scarletmansion";
|
||||
private const string modName = "Scarlet Mansion";
|
||||
private const string modVersion = "1.3.24";
|
||||
private const string modVersion = "1.3.25";
|
||||
|
||||
public readonly Harmony harmony = new Harmony(modGUID);
|
||||
|
||||
|
|
Loading…
Reference in New Issue