mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-05-20 08:26:59 -04:00
stubbed some more functions from kj's ai stuff
- fixed some typos - cleaned some debug code
This commit is contained in:
@@ -47,6 +47,15 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
|
||||
controller.Update(tick);
|
||||
}
|
||||
|
||||
public void CheckCompletedStates()
|
||||
{
|
||||
while (states.Count > 0 && states.Peek().IsCompleted())
|
||||
{
|
||||
states.Peek().Cleanup();
|
||||
states.Pop();
|
||||
}
|
||||
}
|
||||
|
||||
public void InterruptStates()
|
||||
{
|
||||
while (states.Count > 0 && states.Peek().CanInterrupt())
|
||||
@@ -73,21 +82,51 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
|
||||
|
||||
public bool CanChangeState()
|
||||
{
|
||||
return states.Count == 0 || states.First().CanInterrupt();
|
||||
return states.Count == 0 || states.Peek().CanInterrupt();
|
||||
}
|
||||
|
||||
public void ChangeTarget(Character target)
|
||||
{
|
||||
if (controller != null)
|
||||
{
|
||||
controller.ChangeTarget(target);
|
||||
}
|
||||
}
|
||||
|
||||
public void ChangeState(State state)
|
||||
{
|
||||
if (states.Count < 10)
|
||||
if (GetCurrentState() != null)
|
||||
{
|
||||
if (states.Count <= 10)
|
||||
{
|
||||
CheckCompletedStates();
|
||||
states.Push(state);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("shit");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ForceChangeState(State state)
|
||||
{
|
||||
if (states.Count <= 10)
|
||||
{
|
||||
CheckCompletedStates();
|
||||
states.Push(state);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("shit");
|
||||
throw new Exception("force shit");
|
||||
}
|
||||
}
|
||||
|
||||
public State GetCurrentState()
|
||||
{
|
||||
return states.Peek() ?? null;
|
||||
}
|
||||
|
||||
public DateTime GetLatestUpdate()
|
||||
{
|
||||
return latestUpdate;
|
||||
@@ -157,11 +196,31 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
|
||||
InternalMobSkill(target, mobSkillId);
|
||||
}
|
||||
|
||||
public void InternalEngage(Character target)
|
||||
public void InternalChangeTarget(Character target)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public bool InternalEngage(Character target)
|
||||
{
|
||||
if (IsEngaged())
|
||||
{
|
||||
if (this.owner.target != target)
|
||||
{
|
||||
ChangeTarget(target);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (CanChangeState() || (GetCurrentState() != null && GetCurrentState().IsCompleted()))
|
||||
{
|
||||
ForceChangeState(new AttackState(this.owner, target));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void InternalDisengage()
|
||||
{
|
||||
|
||||
|
Reference in New Issue
Block a user