Esempio n. 1
0
        public override bool Process(GSkillCalculation sCalculation, GTargetInfo sTarInfo, SkillAValueData sSkillAValue)
        {
            Avatar      pCaster    = sCalculation.m_pCaster;
            Avatar      pTarget    = sCalculation.m_pTarget;
            DRSkillData pSkillData = sCalculation.m_pSkillData;

            if (pSkillData == null || !pCaster || !pTarget)
            {
                return(false);
            }

            if (pTarget.IsDead)
            {
                return(false);
            }
            SkillEffectEvent gameEvent = ReferencePool.Acquire <SkillEffectEvent>();

            gameEvent.SkillID     = pSkillData.Id;
            gameEvent.CasterID    = pCaster.Id;
            gameEvent.TargetID    = pTarget.Id;
            gameEvent.NotifyType  = (int)eTriggerNotifyType.NotifyType_Damage;
            gameEvent.EffectType  = pSkillData.MSV_EffectType;
            gameEvent.EffectValue = 0;
            sCalculation.CalculationDamage(ref gameEvent.EffectType, ref gameEvent.EffectValue);

            //////////////////////////////////////////////////////////////////////////
            //产生效果事件
            if (pCaster.SkillCom)
            {
                pCaster.SkillCom.PushTriggerNotify(pSkillData.Id, pTarget.Id,
                                                   (int)eTriggerNotifyType.NotifyType_Damage, gameEvent.EffectType,
                                                   (int)gameEvent.EffectValue, sTarInfo.m_vSrcPos,
                                                   sTarInfo.m_vTarPos, sTarInfo.m_vAimDir);
            }

            if (pTarget.SkillCom)
            {
                pTarget.SkillCom.PushTriggerNotify(pSkillData.Id, pCaster.Id,
                                                   (int)eTriggerNotifyType.NotifyType_OnDamage, gameEvent.EffectType,
                                                   (int)gameEvent.EffectValue, sTarInfo.m_vSrcPos,
                                                   sTarInfo.m_vTarPos, sTarInfo.m_vAimDir);
            }
            //产生效果事件
            //////////////////////////////////////////////////////////////////////////

            bool bHit = ((gameEvent.EffectType & (int)eTriggerNotify.TriggerNotify_Hit) > 0);

            //产生仇恨
            ProcessHurtThreat(sCalculation.m_CasterAValue, pCaster, pTarget, gameEvent.EffectValue, bHit);

            GameEntry.Event.Fire(this, gameEvent);
            return(bHit);
        }
Esempio n. 2
0
        protected void OnShowHUDText(object sender, GameEventArgs e)
        {
            SkillEffectEvent ne = (SkillEffectEvent)e;

            if (ne == null)
            {
                return;
            }
            Entity pCaster = GameEntry.Entity.GetGameEntity(ne.CasterID);

            if (pCaster == null)
            {
                return;
            }
            Entity pTarget = GameEntry.Entity.GetGameEntity(ne.TargetID);

            if (pTarget == null)
            {
                return;
            }

            if ((ne.EffectType & (int)eTriggerNotify.TriggerNotify_Damage) != 0)
            {
                Vector3 vOffset = pTarget.GetPos() - pCaster.GetPos();
                vOffset.y = 0;

                Camera pCamera = GameEntry.CameraMgr.GetCurEngineCamera();
                if (pCamera == null || pCamera.transform == null)
                {
                    return;
                }
                Vector3 vRight = pCamera.transform.right;
                vRight.y = 0;

                float       dot = Vector3.Dot(vOffset, vRight);
                bl_Guidance dir = dot <= 0 ? bl_Guidance.LeftDown : bl_Guidance.RightDown;

                HUDRoot.NewText(Utility.Text.Format("- {0:N1}", ne.EffectValue), pTarget.CachedTransform, Color.red,
                                8, 20f, -1f, 2.2f, dir);
            }
            else if ((ne.EffectType & (int)eTriggerNotify.TriggerNotify_Heal) != 0)
            {
                HUDRoot.NewText(Utility.Text.Format("+ {0:N1}", ne.EffectValue), pTarget.CachedTransform, Color.green,
                                8, 20f, 0, 0, bl_Guidance.Up);
            }
        }
Esempio n. 3
0
        protected void OnRefreshInfo(object sender, GameEventArgs e)
        {
            SkillEffectEvent ne = (SkillEffectEvent)e;

            if (ne == null)
            {
                return;
            }
            Entity pTarget = GameEntry.Entity.GetGameEntity(ne.TargetID);

            if (pTarget == null)
            {
                return;
            }
            if (pTarget.Id == m_LocalPlayer.Id)
            {
                SetPlayerValue();
            }
            else if (pTarget.Id == m_Target.Id)
            {
                SetTargetValue();
            }
        }