123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216 |
- using CommonAI.Zone.Instance;
- using CommonAI.Zone.Formula;
- using XmdsCommon.Message;
- using XmdsCommon.Plugin;
- using XmdsCommonServer.Message;
- using XmdsCommon.EditorData;
- using XmdsCommonServer.Plugin.Units;
- using CommonAI.Zone;
- namespace XmdsCommonServer.Plugin
- {
- /// <summary>
- /// FileName: XmdsVirtual.cs
- /// Author: Alex.Yu
- /// Corporation:...
- /// Description: 用于伤害数值计算.
- /// DateTime: 2015/5/13 14:17:23
- /// </summary>
- partial class XmdsVirtual
- {
- #region PickUnit复活.
- protected void mUnit_OnPickUnit(InstanceUnit obj, InstanceUnit pickable, int time)
- {
- //点击已方阵营死亡玩家//
- if (pickable is InstancePlayer && pickable.Force == mUnit.Force && pickable.IsDead())
- {
- XmdsUnitProperties prop = (XmdsUnitProperties)(pickable.Info.Properties);
- XmdsVirtual zv = (XmdsVirtual)obj.Virtual;
- //开始读条复活死亡单位//
- CommonAI.Zone.Instance.InstanceUnit.StatePickObject spo = mUnit.startPickProgressObject(pickable, time, (s, p) =>
- {
- //如果单位已经处于活状态,则中断.
- if (pickable.IsDead() == true)
- {
- SendSaveMessage(obj, pickable);
- }
- });
- if (spo != null)
- {
- spo.SetCheckTargetAcvite(OnCheckPickable);
- }
- }
- }
- private bool OnCheckPickable(InstanceUnit unit, InstanceZoneObject pickable, ref string reason)
- {
- bool ret = false;
- if (pickable is InstanceUnit)
- {
- InstanceUnit iu = (InstanceUnit)pickable;
- if (iu.IsDead() == false)//如果单位复活则立即中断.
- {
- ret = true;
- }
- }
- return ret;
- }
- private void SendSaveMessage(InstanceUnit obj, InstanceUnit pickable)
- {
- }
- /// <summary>
- /// 发送施救信息.
- /// </summary>
- /// <param name="evt"></param>
- public void SendSaveMessage(ShowRebirthDialogueB2R evt)
- {
- if (evt != null)
- {
- this.mUnit.queueEvent(evt);
- }
- }
- #endregion
- #region 上下坐骑.
- /// <summary>
- /// 开始召唤坐骑.
- /// </summary>
- /// <param name="timeMS"></param>
- /// <param name="isSummonMount"></param>
- /// <param name="status"></param>
- public void StartSummonMount(int timeMS, bool isSummonMount, string status)
- {
- if (isSummonMount == false)
- {
- TakeOffMount();
- }
- else
- {
- //时间为0.不做动作,直接上坐骑.
- if (timeMS == 0)
- {
- SyncMountStatus(isSummonMount);
- }
- else
- {
- this.mUnit.startPickProgressSelf(timeMS, (s, p) =>
- {
- SyncMountStatus(isSummonMount);
- }, status);
- }
- }
- }
- /// <summary>
- /// 通知游戏服单位坐骑状态变更.
- /// </summary>
- /// <param name="isSummonMount"></param>
- private void SendSummonMountNotify(bool isSummonMount)
- {
- if (this.mUnit is InstancePlayer)
- {
- SummonMountEventB2R evt = new SummonMountEventB2R();
- evt.playerId = (this.mUnit as InstancePlayer).PlayerUUID;
- evt.IsSummonMount = isSummonMount;
- this.mUnit.queueEvent(evt);
- var teamVirtual = (this.mUnit as XmdsInstancePlayer).TeamVirtual;
- //XmdsTeamInfo TeamInfo = (this.mUnit as XmdsInstancePlayer).TeamInfo;
- if (teamVirtual != null && isSummonMount && teamVirtual.TeamLeader == this.mUnit)
- {
- teamVirtual.notifyTeamerRide();
- }
- }
- }
- /// <summary>
- /// 同步坐骑状态.
- /// </summary>
- /// <param name="isSummonMount"></param>
- private void SyncMountStatus(bool isSummonMount)
- {
- IsMounted = isSummonMount;
- //通知游戏服.
- SendSummonMountNotify(isSummonMount);
- }
-
- /// <summary>
- /// 检查坐骑状态.
- /// </summary>
- /// <param name="attacker"></param>
- private void MountOnHitCheck(XmdsVirtual attacker)
- {
- if (!IsMounted) { return; }
- //被玩家单位或BOSS攻击时下马.
- //bool IsBoss = false;
- //if (attacker is XmdsVirtual_Monster)
- //{
- // MonsterVisibleDataB2C edata = attacker.mUnit.GenSyncInfo(false).ExtData as MonsterVisibleDataB2C;
- // if (edata != null && edata.MType == MonsterVisibleDataB2C.MonsterType.MType4)
- // {
- // IsBoss = true;
- // }
- //}
- // if (attacker.IsPlayerUnit() || IsBoss)
- {
- SendMsgToClient(CommonAI.XmdsConstConfig.TIPS_UNDER_ATTACK);
- this.TakeOffMount();
- }
- }
- /// <summary>
- /// 放技能时检查影响坐骑状态.
- /// </summary>
- private void MountOnLaunchSkillCheck()
- {
- if (!IsMounted) { return; }
- this.TakeOffMount();
- }
- /// <summary>
- /// 中BUFF时检查是否影响坐骑状态.
- /// </summary>
- /// <param name="node"></param>
- private void MountOnBuffBegin(BuffTemplate buff)
- {
- if (!IsMounted) { return; }
- //控制类BUFF,会强制取消坐骑状态.
- if (XmdsInstanceUtils.IsControlBuff(buff))
- {
- this.TakeOffMount();
- }
- }
- /// <summary>
- /// 被攻击时检查是否影响坐骑状态.
- /// </summary>
- /// <param name="source"></param>
- private void MountOnHit(AttackSource source)
- {
- if (!IsMounted) { return; }
- if (source.OutIsDamage == true)
- {
- this.TakeOffMount();
- }
- }
- #endregion
- }
- }
|