Ejemplo 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);
        }
Ejemplo n.º 2
0
 public abstract bool Process(GSkillCalculation sCalculation, GTargetInfo sTarInfo, SkillAValueData sSkillAValue);
Ejemplo n.º 3
0
        public void ProcessSkillEffect(DRSkillData pSkillData, GTargetInfo sTarInfo, SkillAValueData AValue, GSkillExcludeList vExcludeList)
        {
            if (pSkillData == null)
            {
                return;
            }

            Avatar pCaster = Owner;

            if (!pCaster)
            {
                return;
            }

            int             nAreaLogic = pSkillData.MSV_AreaLogic;
            GSkillAreaLogic pAreaLogic = GSkillLogicManager.Instance.GetAreaLogic(nAreaLogic);

            if (pAreaLogic == null)
            {
                return;
            }

            if (nAreaLogic != (int)eSkillAreaLogic.SkillArea_Singleton && !pSkillData.IsAreaIncludeSelf())
            {
                vExcludeList.Add(pCaster.Id);
            }

            List <Avatar> vTargetList = pAreaLogic.GetTargetList(pSkillData, pCaster, sTarInfo, vExcludeList);

            if (vTargetList == null || vTargetList.Count == 0)
            {
                return;
            }

            ////合并攻击方属性 todo合并技能属性集和模板属性集
            //RoleAValue sSkillAValue;
            //sSkillAValue.Copy(sRoleValue);
            //sSkillAValue.Combine(pSkillData->m_RoleValue);

            //RoleAValue sCasterRoleValue;
            //sCasterRoleValue.Copy(sSkillAValue);
            //sCasterRoleValue.Combine(pCaster->GetRoleAValue());

            //属性合并节点 todo 等技能数据包裹修复后
            //if(pSkillData->IsCombineEffectNotify())
            //{
            //	PushTriggerNotifyAValue(pSkillData->m_nDataID, 0, NotifyType_CombineEffect, pSkillData->GetIntValue(MSV_EffectType), &sCasterRoleValue);
            //}

            int          nEffectLogic = pSkillData.MSV_EffectLogic;
            GSkillEffect pEffectLogic = GSkillLogicManager.Instance.GetEffectLogic(nEffectLogic);

            if (pEffectLogic == null)
            {
                return;
            }

            GTargetInfo tempTarInfo;

            foreach (var pTarget in vTargetList)
            {
                if (pTarget == null)
                {
                    continue;
                }

                if (vExcludeList.Contains(pTarget.Id))
                {
                    continue;
                }

                PlayerAValueData sCasterRoleValue = pCaster.GetRoleAValue();
                PlayerAValueData sTargetRoleValue = pTarget.GetRoleAValue();
                if (sCasterRoleValue == null || sCasterRoleValue == null)
                {
                    continue;
                }

                GSkillCalculation sCaluation = new GSkillCalculation();

                sCaluation.m_pSkillData   = pSkillData;
                sCaluation.m_pCaster      = pCaster;
                sCaluation.m_pTarget      = pTarget;
                sCaluation.m_CasterAValue = sCasterRoleValue.CloneData();
                sCaluation.m_TargetAValue = sTargetRoleValue.CloneData();
                sCaluation.m_SkillAValue  = AValue;
                sCaluation.TransfromEffectTarget();

                tempTarInfo             = sTarInfo;
                tempTarInfo.m_nTargetID = pTarget.Id;
                tempTarInfo.m_vTarPos   = pTarget.GetPos();

                if (pEffectLogic.Process(sCaluation, tempTarInfo, AValue))
                {
                    //todo 添加log范围
                    //pAreaLogic.Draw(pSkillData, pCaster, pTarget, sTarInfo);
                }
                //填充重复列表
                if (pSkillData.IsAreaAddExclude())
                {
                    vExcludeList.Add(pTarget.Id);
                }
                //减少效果次数
                if (vExcludeList.m_nCount > 0)
                {
                    --vExcludeList.m_nCount;
                }
            }
        }