mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-05-20 08:26:59 -04:00
Merging
This commit is contained in:
@@ -39,15 +39,11 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
|
||||
{
|
||||
if (!HasHateForTarget(target))
|
||||
hateList.Add(target, new HateEntry(target, 1, 0, true));
|
||||
else
|
||||
Program.Log.Error($"{target.actorName} is already on [{owner.actorId}]{owner.actorName}'s hate list!");
|
||||
}
|
||||
|
||||
public void UpdateHate(Character target, int damage)
|
||||
{
|
||||
if (!HasHateForTarget(target))
|
||||
AddBaseHate(target);
|
||||
|
||||
AddBaseHate(target);
|
||||
//hateList[target].volatileEnmity += (uint)damage;
|
||||
hateList[target].cumulativeEnmity += (uint)damage;
|
||||
}
|
||||
@@ -55,13 +51,9 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai
|
||||
public void ClearHate(Character target = null)
|
||||
{
|
||||
if (target != null)
|
||||
{
|
||||
hateList.Remove(target);
|
||||
}
|
||||
else
|
||||
{
|
||||
hateList.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateHate(HateEntry entry)
|
||||
|
@@ -48,7 +48,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.controllers
|
||||
|
||||
if(owner.aiContainer.IsEngaged())
|
||||
{
|
||||
DoCombatTick(tick);
|
||||
//DoCombatTick(tick);
|
||||
}
|
||||
|
||||
//Only move if owner isn't dead and is either too far away from their spawn point or is meant to roam
|
||||
@@ -143,8 +143,6 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.controllers
|
||||
owner.aiContainer.pathFind.PreparePath(owner.spawnX, owner.spawnY, owner.spawnZ, 1.5f, 10);
|
||||
neutralTime = lastActionTime;
|
||||
owner.hateContainer.ClearHate();
|
||||
owner.ResetMoveSpeeds();
|
||||
owner.moveState = 1;
|
||||
lua.LuaEngine.CallLuaBattleFunction(owner, "onDisengage", owner, target, Utils.UnixTimeStampUTC(lastUpdate));
|
||||
}
|
||||
|
||||
@@ -215,6 +213,12 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.controllers
|
||||
|
||||
|
||||
Move();
|
||||
|
||||
if ((tick - lastCombatTickScript).TotalSeconds > 2)
|
||||
{
|
||||
lua.LuaEngine.CallLuaBattleFunction(owner, "onCombatTick", owner, owner.target, Utils.UnixTimeStampUTC(tick), contentGroupCharas);
|
||||
lastCombatTickScript = tick;
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void Move()
|
||||
|
@@ -11,6 +11,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.controllers
|
||||
{
|
||||
protected Character owner;
|
||||
|
||||
protected DateTime lastCombatTickScript;
|
||||
protected DateTime lastUpdate;
|
||||
public bool canUpdate = true;
|
||||
protected bool autoAttackEnabled = true;
|
||||
|
@@ -38,7 +38,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
|
||||
|
||||
if (target == null || target.IsDead())
|
||||
{
|
||||
if (owner is BattleNpc)
|
||||
if (owner.IsMonster() || owner.IsAlly())
|
||||
target = ((BattleNpc)owner).hateContainer.GetMostHatedTarget();
|
||||
}
|
||||
else
|
||||
@@ -129,6 +129,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
|
||||
|
||||
private bool CanAttack()
|
||||
{
|
||||
return false;
|
||||
if (!owner.isAutoAttackEnabled)
|
||||
{
|
||||
return false;
|
||||
@@ -141,7 +142,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
|
||||
// todo: shouldnt need to check if owner is dead since all states would be cleared
|
||||
if (owner.IsDead() || target.IsDead())
|
||||
{
|
||||
if (owner is BattleNpc)
|
||||
if (owner.IsMonster() || owner.IsAlly())
|
||||
((BattleNpc)owner).hateContainer.ClearHate(target);
|
||||
|
||||
owner.aiContainer.ChangeTarget(null);
|
||||
|
@@ -104,7 +104,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.state
|
||||
|
||||
// todo: this is fuckin stupid, probably only need *one* error packet, not an error for each action
|
||||
var errors = (BattleAction[])actions.Clone();
|
||||
owner.OnWeaponSkill(this, actions, ref errors);
|
||||
owner.OnWeaponSkill(this, actions, ref errors);
|
||||
owner.DoBattleAction(skill.id, skill.battleAnimation, actions);
|
||||
}
|
||||
|
||||
|
@@ -76,20 +76,23 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.utils
|
||||
return damage;
|
||||
}
|
||||
|
||||
public static void DamageTarget(Character attacker, Character defender, BattleAction action)
|
||||
public static void DamageTarget(Character attacker, Character defender, BattleAction action, DamageTakenType type)
|
||||
{
|
||||
if (defender != null)
|
||||
{
|
||||
// todo: other stuff too
|
||||
if (defender is BattleNpc)
|
||||
{
|
||||
if (!((BattleNpc)defender).hateContainer.HasHateForTarget(attacker))
|
||||
var bnpc = defender as BattleNpc;
|
||||
if (!bnpc.hateContainer.HasHateForTarget(attacker))
|
||||
{
|
||||
((BattleNpc)defender).hateContainer.AddBaseHate(attacker);
|
||||
bnpc.hateContainer.AddBaseHate(attacker);
|
||||
}
|
||||
((BattleNpc)defender).hateContainer.UpdateHate(attacker, action.amount);
|
||||
bnpc.hateContainer.UpdateHate(attacker, action.amount);
|
||||
bnpc.lastAttacker = attacker;
|
||||
}
|
||||
defender.DelHP((short)action.amount);
|
||||
defender.OnDamageTaken(attacker, action, type);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user