mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-23 05:07:47 +00:00
fixed auto attacking self/npcs
This commit is contained in:
parent
5e2487c8cc
commit
88abd59ec3
4 changed files with 20 additions and 8 deletions
|
@ -186,7 +186,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
|
|||
public bool IsEngaged()
|
||||
{
|
||||
// todo: check this is legit
|
||||
return owner.currentMainState == SetActorStatePacket.MAIN_STATE_ACTIVE;
|
||||
return owner.currentMainState == SetActorStatePacket.MAIN_STATE_ACTIVE && owner.target != null;
|
||||
}
|
||||
|
||||
public bool IsDead()
|
||||
|
|
|
@ -89,7 +89,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
|
|||
{
|
||||
this.target = null;
|
||||
this.findType = TargetFindCharacterType.None;
|
||||
this.validTarget = ValidTarget.None;
|
||||
this.validTarget = ValidTarget.Enemy;
|
||||
this.aoeType = TargetFindAOEType.None;
|
||||
this.targetPosition = null;
|
||||
this.extents = 0.0f;
|
||||
|
@ -325,13 +325,23 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
|
|||
if ((validTarget & ValidTarget.Corpse) == 0 && target.IsDead())
|
||||
return false;
|
||||
|
||||
bool targetingPlayer = target is Player;
|
||||
bool targetingPlayer = target.currentSubState == SetActorStatePacket.SUB_STATE_PLAYER;
|
||||
|
||||
if ((validTarget & ValidTarget.Ally) != 0 && target.currentSubState != owner.currentSubState)
|
||||
return false;
|
||||
|
||||
if ((validTarget & ValidTarget.Enemy) != 0 && target.currentSubState != (owner.currentSubState == SetActorStatePacket.SUB_STATE_MONSTER ?
|
||||
SetActorStatePacket.SUB_STATE_PLAYER : SetActorStatePacket.SUB_STATE_MONSTER))
|
||||
return false;
|
||||
|
||||
if ((validTarget & ValidTarget.NPC) != 0 && target.currentSubState != SetActorStatePacket.SUB_STATE_NONE)
|
||||
return false;
|
||||
|
||||
// todo: why is player always zoning?
|
||||
// cant target if zoning
|
||||
if (targetingPlayer && ((Player)target).playerSession.isUpdatesLocked)
|
||||
{
|
||||
owner.Disengage();
|
||||
owner.aiContainer.ChangeTarget(null);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -57,6 +57,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.controllers
|
|||
public override void Disengage()
|
||||
{
|
||||
// todo:
|
||||
base.Disengage();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,15 +44,16 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
|
|||
return true;
|
||||
}
|
||||
*/
|
||||
if (owner.target != target || owner.target?.actorId != owner.currentLockedTarget)
|
||||
owner.aiContainer.ChangeTarget(target = Server.GetWorldManager().GetActorInWorld(owner.currentLockedTarget) as Character);
|
||||
|
||||
if (target == null || target.IsDead())
|
||||
{
|
||||
|
||||
//if (owner.currentSubState == SetActorStatePacket.SUB_STATE_MONSTER)
|
||||
// target = ((BattleNpc)owner).hateContainer.GetMostHatedTarget();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (owner.target != target || owner.target.actorId != owner.currentLockedTarget)
|
||||
owner.aiContainer.ChangeTarget(target = Server.GetWorldManager().GetActorInWorld(owner.currentLockedTarget) as Character);
|
||||
|
||||
if (IsAttackReady())
|
||||
{
|
||||
if (CanAttack())
|
||||
|
|
Loading…
Add table
Reference in a new issue