/// <summary> /// Process the monster's fight. /// </summary> /// <param name="monster"></param> private void Fight(IMonsterEntity monster) { if (!monster.Battle.IsFighting || !monster.Battle.Target.Object.Spawned) { return; } if (monster.Timers.NextAttackTime <= Time.TimeInMilliseconds()) { monster.Timers.NextAttackTime = (long)(Time.TimeInMilliseconds() + monster.Data.ReAttackDelay); var meleeAttack = new MeleeAttackEventArgs(ObjectMessageType.OBJMSG_ATK1, monster.Battle.Target, monster.Data.AttackSpeed); monster.NotifySystem <BattleSystem>(meleeAttack); } }
/// <summary> /// Process the monster's fight. /// </summary> /// <param name="monster"></param> private void ProcessMonsterFight(IMonsterEntity monster) { if (monster.Battle.Target.Health.IsDead) { monster.Follow.Target = null; monster.Battle.Target = null; monster.Battle.Targets.Clear(); return; } if (monster.Follow.IsFollowing) { monster.Moves.DestinationPosition = monster.Follow.Target.Object.Position.Clone(); if (monster.Moves.SpeedFactor != 2f) { monster.Moves.SpeedFactor = 2; WorldPacketFactory.SendSpeedFactor(monster, monster.Moves.SpeedFactor); } if (!monster.Object.Position.IsInCircle(monster.Moves.DestinationPosition, 1f)) { monster.Object.MovingFlags = ObjectState.OBJSTA_FMOVE; WorldPacketFactory.SendFollowTarget(monster, monster.Follow.Target, 1f); } else { if (monster.Timers.NextAttackTime <= Time.TimeInMilliseconds()) { monster.Timers.NextAttackTime = (long)(Time.TimeInMilliseconds() + monster.Data.ReAttackDelay); var meleeAttack = new MeleeAttackEventArgs(ObjectMessageType.OBJMSG_ATK1, monster.Battle.Target, monster.Data.AttackSpeed); monster.NotifySystem <BattleSystem>(meleeAttack); } } } }