|
@@ -11,13 +11,14 @@ using System.Linq;
|
|
|
using System.Text;
|
|
|
using XmdsCommon.Message;
|
|
|
using XmdsCommon.Plugin;
|
|
|
+using XmdsCommonServer.Plugin.XmdsSkillTemplate.DamageCalculator;
|
|
|
using static CommonAI.Zone.SkillTemplate;
|
|
|
|
|
|
namespace XmdsCommonServer.Plugin.Units
|
|
|
{
|
|
|
public class XmdsInstancePet : InstancePet
|
|
|
{
|
|
|
- private XmdsCommon.Plugin.XmdsPetConifg.XmdsPetFollowMode mCurFollowMode = XmdsCommon.Plugin.XmdsPetConifg.XmdsPetFollowMode.ActiveAtk;
|
|
|
+ private XmdsCommon.Plugin.XmdsPetConifg.XmdsPetFollowMode mCurFollowMode = XmdsCommon.Plugin.XmdsPetConifg.XmdsPetFollowMode.ActiveAtk;
|
|
|
|
|
|
//主人当前战斗状态.
|
|
|
private BattleStatus mMasterCombatStatus;
|
|
@@ -99,8 +100,8 @@ namespace XmdsCommonServer.Plugin.Units
|
|
|
|
|
|
//主人脱战了,并且没有伤害,宠物强行脱战
|
|
|
//2020.9.22修改,宠物可以和怪物撕逼
|
|
|
- if (CurrentState is StateIdle/* || (this.Master.mLastHitOtherTime + XmdsVirtual.Coefficient_OutOfCombatTime < CommonLang.CUtils.localTimeMS
|
|
|
- && this.Master.mLastDamageTime + XmdsVirtual.Coefficient_OutOfCombatTime < CommonLang.CUtils.localTimeMS)*/)
|
|
|
+ if (CurrentState is StateIdle || (this.Master.mLastHitOtherTime + XmdsConfig.Instance.OUTOF_BATTLE_PLAYER < CommonLang.CUtils.localTimeMS
|
|
|
+ && this.Master.mLastDamageTime + XmdsConfig.Instance.OUTOF_BATTLE_PLAYER < CommonLang.CUtils.localTimeMS))
|
|
|
{
|
|
|
mCurAtkUnit = null;
|
|
|
|
|
@@ -393,49 +394,49 @@ namespace XmdsCommonServer.Plugin.Units
|
|
|
{
|
|
|
bool ret = false;
|
|
|
|
|
|
- using (var list = ListObjectPool<InstanceUnit>.AllocAutoRelease())
|
|
|
- {
|
|
|
- //找到离自己最近的单位攻击.
|
|
|
- Parent.getObjectsRoundRange<InstanceUnit>(Collider.Object_BlockBody_TouchRound, X, Y, Info.GuardRange, list , AoiStatus);
|
|
|
- DoAndRemoveCollection.UpdateAndRemove<InstanceUnit>(list, (InstanceUnit u) =>
|
|
|
- {
|
|
|
- return !u.IsActive;
|
|
|
- });
|
|
|
-
|
|
|
- if (list != null && list.Count > 0)
|
|
|
- {
|
|
|
- list.Sort((a, b) =>
|
|
|
- {
|
|
|
- //选距离最近的单位.
|
|
|
- float da = CMath.getDistanceSquare(a.X, a.Y, this.X, this.Y);
|
|
|
- float db = CMath.getDistanceSquare(b.X, b.Y, this.X, this.Y);
|
|
|
- return (int)(da - db);
|
|
|
- });
|
|
|
-
|
|
|
- foreach (SkillState skill in SkillStatus)
|
|
|
- {
|
|
|
- if (skill.LaunchSkill.AutoLaunch && skill.TryLaunch())
|
|
|
- {
|
|
|
- foreach (InstanceUnit u in list)
|
|
|
- {
|
|
|
- if (this.IsCanAttack(u) && Parent.IsAttackable(this, u, skill.Data.ExpectTarget, AttackReason.Attack, skill.Data))
|
|
|
- {
|
|
|
- //是否在守卫范围内.
|
|
|
- if (CheckInAtkRange(u, this.Info.GuardRange + skill.Data.AttackRange))
|
|
|
- {
|
|
|
- //检测是否有可释放技能//
|
|
|
- if (tryAutoLaunch(skill, u))
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
+ //using (var list = ListObjectPool<InstanceUnit>.AllocAutoRelease())
|
|
|
+ //{
|
|
|
+ // //找到离自己最近的单位攻击.
|
|
|
+ // Parent.getObjectsRoundRange<InstanceUnit>(Collider.Object_BlockBody_TouchRound, X, Y, Info.GuardRange, list , AoiStatus);
|
|
|
+ // DoAndRemoveCollection.UpdateAndRemove<InstanceUnit>(list, (InstanceUnit u) =>
|
|
|
+ // {
|
|
|
+ // return !u.IsActive;
|
|
|
+ // });
|
|
|
+
|
|
|
+ // if (list != null && list.Count > 0)
|
|
|
+ // {
|
|
|
+ // list.Sort((a, b) =>
|
|
|
+ // {
|
|
|
+ // //选距离最近的单位.
|
|
|
+ // float da = CMath.getDistanceSquare(a.X, a.Y, this.X, this.Y);
|
|
|
+ // float db = CMath.getDistanceSquare(b.X, b.Y, this.X, this.Y);
|
|
|
+ // return (int)(da - db);
|
|
|
+ // });
|
|
|
+
|
|
|
+ // foreach (SkillState skill in SkillStatus)
|
|
|
+ // {
|
|
|
+ // if (skill.LaunchSkill.AutoLaunch && skill.TryLaunch())
|
|
|
+ // {
|
|
|
+ // foreach (InstanceUnit u in list)
|
|
|
+ // {
|
|
|
+ // if (this.IsCanAttack(u) && Parent.IsAttackable(this, u, skill.Data.ExpectTarget, AttackReason.Attack, skill.Data))
|
|
|
+ // {
|
|
|
+ // //是否在守卫范围内.
|
|
|
+ // if (CheckInAtkRange(u, this.Info.GuardRange + skill.Data.AttackRange))
|
|
|
+ // {
|
|
|
+ // //检测是否有可释放技能//
|
|
|
+ // if (tryAutoLaunch(skill, u))
|
|
|
+ // {
|
|
|
+ // return true;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+
|
|
|
+ // }
|
|
|
+ //}
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
@@ -495,7 +496,19 @@ namespace XmdsCommonServer.Plugin.Units
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- public override void doSomething()
|
|
|
+ /** 计算并获得伤害 */
|
|
|
+ public override void PetShareDamage(int baseDmgValue, InstanceUnit sender)
|
|
|
+ {
|
|
|
+ XmdsVirtual petVirtual = this.Virtual as XmdsVirtual;
|
|
|
+ int finalDmg = XmdsDamageCalculator.GetPetDamage(baseDmgValue, petVirtual);
|
|
|
+
|
|
|
+ //分发事件
|
|
|
+ finalDmg = petVirtual.DispatchShareMasterDmgEvent(finalDmg, sender);
|
|
|
+
|
|
|
+ this.AddHP(-finalDmg, sender);
|
|
|
+ }
|
|
|
+
|
|
|
+ public override void doSomething()
|
|
|
{
|
|
|
if (CurrentState is StateSkill)
|
|
|
{
|