2017-09-12 01:24:02 +01:00
|
|
|
|
using System;
|
|
|
|
|
using FFXIVClassic_Map_Server.Actors;
|
|
|
|
|
|
|
|
|
|
namespace FFXIVClassic_Map_Server.actors.chara.ai.state
|
|
|
|
|
{
|
|
|
|
|
class InactiveState : State
|
|
|
|
|
{
|
|
|
|
|
private DateTime endTime;
|
|
|
|
|
private uint durationMs;
|
|
|
|
|
public InactiveState(Character owner, uint durationMs, bool canChangeState) :
|
|
|
|
|
base(owner, null)
|
|
|
|
|
{
|
|
|
|
|
if (!canChangeState)
|
|
|
|
|
owner.aiContainer.InterruptStates();
|
|
|
|
|
this.durationMs = durationMs;
|
|
|
|
|
endTime = DateTime.Now.AddMilliseconds(durationMs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override bool Update(DateTime tick)
|
|
|
|
|
{
|
|
|
|
|
if (durationMs == 0)
|
|
|
|
|
{
|
|
|
|
|
if (owner.IsDead())
|
|
|
|
|
return true;
|
|
|
|
|
|
2018-02-15 13:20:46 -06:00
|
|
|
|
if (!owner.statusEffects.HasStatusEffectsByFlag(StatusEffectFlags.PreventMovement))
|
2017-09-12 01:24:02 +01:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (durationMs != 0 && tick > endTime)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|