112 lines
3.4 KiB
C#
112 lines
3.4 KiB
C#
using System;
|
|
using UnityEngine;
|
|
using UnityEngine.Scripting;
|
|
|
|
[Preserve]
|
|
public class EAIWanderCompanion : EAIWander
|
|
{
|
|
public bool NPCEAICanProceed(bool skipTargetVerification = false)
|
|
{
|
|
if (this.theEntity.Buffs.GetCustomVar("$Leader") > 0f)
|
|
{
|
|
//Log.Out("EAIWanderCompanion-NPCEAICanProceed 1");
|
|
return false;
|
|
}
|
|
|
|
if (((EntityAliveV2)(this.theEntity)).currentOrder > 0)
|
|
{
|
|
//Log.Out("EAIWanderCompanion-NPCEAICanProceed 1a");
|
|
return false;
|
|
}
|
|
|
|
if (this.theEntity.Buffs.GetCustomVar("onMission") == 1f ||
|
|
this.theEntity.Buffs.GetCustomVar("$FR_NPC_Respawn") == 1f ||
|
|
this.theEntity.Buffs.GetCustomVar("$FR_NPC_Hidden") == 1f
|
|
)
|
|
{
|
|
//Log.Out("EAIWanderCompanion-NPCEAICanProceed 1b");
|
|
return false;
|
|
}
|
|
|
|
if (this.theEntity.GetAttackTarget() != null)
|
|
{
|
|
//Log.Out("EAIWanderCompanion-NPCEAICanProceed 2");
|
|
return false;
|
|
}
|
|
|
|
if (this.theEntity.Buffs.HasBuff("buffTalkingTo"))
|
|
{
|
|
//Log.Out("EAIWanderCompanion-NPCEAICanProceed 3");
|
|
return false;
|
|
}
|
|
|
|
if (this.theEntity.sleepingOrWakingUp)
|
|
{
|
|
//Log.Out("EAIWanderCompanion-NPCEAICanProceed 4");
|
|
return false;
|
|
}
|
|
if (this.theEntity.GetTicksNoPlayerAdjacent() >= 120)
|
|
{
|
|
//Log.Out("EAIWanderCompanion-NPCEAICanProceed 5");
|
|
return false;
|
|
}
|
|
if (this.theEntity.bodyDamage.CurrentStun != EnumEntityStunType.None)
|
|
{
|
|
//Log.Out("EAIWanderCompanion-NPCEAICanProceed 6");
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
public override bool CanExecute()
|
|
{
|
|
if (!NPCEAICanProceed())
|
|
{
|
|
return false;
|
|
}
|
|
|
|
if (this.theEntity.sleepingOrWakingUp)
|
|
{
|
|
return false;
|
|
}
|
|
if (this.theEntity.GetTicksNoPlayerAdjacent() >= 120)
|
|
{
|
|
return false;
|
|
}
|
|
if (this.theEntity.bodyDamage.CurrentStun != EnumEntityStunType.None)
|
|
{
|
|
return false;
|
|
}
|
|
int num = (int)(200f * this.executeWaitTime);
|
|
if (base.GetRandom(1000) >= num)
|
|
{
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public override void Start()
|
|
{
|
|
int num = 10;
|
|
this.theEntity.FindPath(RandomPositionGenerator.Calc(this.theEntity, num, num), this.theEntity.GetMoveSpeed(), false, this);
|
|
}
|
|
|
|
public override bool Continue()
|
|
{
|
|
if (!NPCEAICanProceed())
|
|
{
|
|
return false;
|
|
}
|
|
|
|
//Log.Out("EAIWanderCompanion-Continue this.theEntity.bodyDamage.CurrentStun == EnumEntityStunType.None: " + (this.theEntity.bodyDamage.CurrentStun == EnumEntityStunType.None));
|
|
//Log.Out("EAIWanderCompanion-Continue this.theEntity.moveHelper.BlockedTime <= 0.3f: " + (this.theEntity.moveHelper.BlockedTime <= 0.3f));
|
|
//Log.Out("EAIWanderCompanion-Continue !this.theEntity.navigator.noPathAndNotPlanningOne(): " + !this.theEntity.navigator.noPathAndNotPlanningOne());
|
|
|
|
bool result = this.theEntity.bodyDamage.CurrentStun == EnumEntityStunType.None && this.theEntity.moveHelper.BlockedTime <= 0.3f && !this.theEntity.navigator.noPathAndNotPlanningOne();
|
|
|
|
//Log.Out("EAIWanderCompanion-Continue result: " + result);
|
|
return result;
|
|
}
|
|
}
|