コード例 #1
0
        public virtual bool Init(DRSkillData pSkillData, GTargetInfo sTarInfo, SkillAValueData sSkillAValue, Avatar pCaster)
        {
            if (pSkillData == null)
            {
                return(false);
            }

            m_fCurTime              = 0;
            m_pSkillData            = pSkillData;
            m_TargetInfo            = sTarInfo;
            m_fSpeed                = m_pSkillData.MSV_ProjectileSpeed;
            m_fLifeTime             = m_pSkillData.MSV_ProjectileTime;
            m_fFirstEffectTime      = m_pSkillData.MSV_ProjectileFirstEffectTime;
            m_fEffectTime           = m_pSkillData.MSV_EffectTime;
            m_fCurEffectTime        = m_fFirstEffectTime;
            m_vExcludeList          = new GSkillExcludeList();
            m_vExcludeList.m_nCount = m_pSkillData.MSV_ProjectileEffectCount;
            m_vExcludeList.m_bCount = (m_vExcludeList.m_nCount > 0);

            //int nProjectileOffset = m_pSkillData.MSV_ProjectileOffset;
            //Vector3 vOffset = GSkillProjectileOffsetManager.Instance.GetProjectileOffset(nProjectileOffset);
            //m_TargetInfo.m_vSrcPos += vOffset;
            m_TargetInfo.m_vSrcPos += new Vector3(0, 1, 0);

            m_SkillAValue = sSkillAValue.CloneData();

            m_vPreCheckPos = m_TargetInfo.m_vSrcPos;
            return(true);
        }
コード例 #2
0
        protected bool TryAddTarget(DRSkillData pSkillData, Avatar pCaster,
                                    Avatar pTarget, HashSet <int> vExcludeList)
        {
            if (pSkillData == null || !pCaster || !pTarget)
            {
                return(false);
            }

            if (vExcludeList.Contains(pTarget.Id))
            {
                return(false);
            }

            //int nTarCheck = pSkillData->GetValue(MSV_AreaTarCheck);
            //if (nTarCheck > 0)
            //{
            //	SDConditionParamAvatar sParam;
            //	sParam.ParamAvatar = pCaster;
            //	if (!GSKillConditionCheckManager::Instance().Check(nTarCheck, pTarget, &sParam))
            //		return false;
            //}

            //if (pSkillData->IsAreaAddExclude())
            //{
            //	vExcludeList.insert(pTarget.GetAvatarID());
            //}
            return(true);
        }
コード例 #3
0
        public override List <Avatar> GetTargetList(DRSkillData pSkillData,
                                                    Avatar pCaster, GTargetInfo sTarInfo, HashSet <int> vExcludeList)
        {
            List <Avatar> vTargetList = new List <Avatar>();

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

            Avatar pTarget = GameEntry.Entity.GetGameEntity(sTarInfo.m_nTargetID) as Avatar;

            if (!pTarget)
            {
                return(vTargetList);
            }

            if (!GCollider.SingletonCollideCheck())
            {
                return(vTargetList);
            }

            TryAddTarget(pSkillData, pCaster, pTarget, vExcludeList);
            vTargetList.Add(pTarget);
            return(vTargetList);
        }
コード例 #4
0
        //检查目标
        public bool CheckTarget(DRSkillData pSkillData, Avatar pCaster, GTargetInfo sTarInfo)
        {
            if (pSkillData == null || !pCaster)
            {
                return(false);
            }

            //检查目标条件
            if (pSkillData.IsTargetAvatar())
            {
                if (!CheckTarget(pSkillData, pCaster, sTarInfo.m_nTargetID))
                {
                    return(false);
                }
            }
            else if (pSkillData.IsTargetPos())
            {
                float fRange = pSkillData.MSV_Range;
                if (fRange > 0)
                {
                    float fDistance = pCaster.GetPos().Distance2D(sTarInfo.m_vTarPos);
                    if (fDistance > fRange + 0.5f)
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
コード例 #5
0
        public bool CheckTarget(DRSkillData pSkillData, Avatar pCaster, int nTargetID)
        {
            Avatar pTarget = GameEntry.Entity.GetGameEntity(nTargetID) as Avatar;

            if (!pTarget)
            {
                return(false);
            }

            int nTarCheck = pSkillData.MSV_TarCheck;

            if (nTarCheck > 0)
            {
                //todo 条件检查组
                //SDConditionParamAvatar sParam;
                //sParam.ParamAvatar = pCaster;
                //if(!GSKillConditionCheckManager::Instance().Check(nTarCheck, pTarget, &sParam))
                //	return false;
            }

            float fRange = pSkillData.MSV_Range;

            if (fRange > 0)
            {
                float fDistance = pCaster.GetPos().Distance2D(pTarget.GetPos());
                if (fDistance > fRange + 0.5f)
                {
                    return(false);
                }
            }

            return(true);
        }
コード例 #6
0
        protected override void OnEnterState(IFsm <Avatar> pAvatar, StateParam nextParam)
        {
            StateSkillParam param = nextParam as StateSkillParam;

            if (param == null)
            {
                Log.Error("Current State '{0}': the Variable's(the initParam) type isn't right! '{1}'", typeof(StateIdle), typeof(Variable));
                return;
            }
            m_nSkillID   = param.m_nSkillID;
            m_fCurTime   = 0;
            m_fTotalTime = param.m_fTotalTime;
            m_fBreakTime = param.m_fBreakTime;

            pAvatar.Owner.SetState(StateDefine.State_LockActiveSkill);
            pAvatar.Owner.SetState(StateDefine.State_LockMove);

            DRSkillData pSkillData = GameEntry.DataTable.GetDataTable <DRSkillData>().GetDataRow(m_nSkillID);

            if (pSkillData == null)
            {
                Log.Error("pSkillData '{0}': pSkillData is null!", m_nSkillID);
                return;
            }
            pAvatar.Owner.PlayAnimation(pSkillData.MSV_AnimID);
        }
コード例 #7
0
 public override bool Enter(DRSkillData pSkillData)
 {
     if (!base.Enter(pSkillData))
     {
         return(false);
     }
     return(true);
 }
コード例 #8
0
        //扣除技能消耗
        public void DoCost(DRSkillData pSkillData)
        {
            if (Owner == null || pSkillData == null)
            {
                return;
            }

            DoCost(pSkillData.MSV_CostType1, pSkillData.MSV_CostValue1, pSkillData.IsActiveSkill());
            DoCost(pSkillData.MSV_CostType2, pSkillData.MSV_CostValue2, pSkillData.IsActiveSkill());
        }
コード例 #9
0
        public bool CanSpellSkill(DRSkillData pSkillData, GTargetInfo sTarInfo)
        {
            Avatar pCaster = Owner;

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

            if (!pSkillData.IsActiveSkill())
            {
                return(false);
            }

            //检查当前施放技能
            if (m_pSpellLogic != null && m_pSpellLogic.IsLock())
            {
                return(false);
            }

            //检查消耗
            if (!CheckCost(pSkillData))
            {
                return(false);
            }
            //检查CD
            if (!CheckCD(pSkillData))
            {
                return(false);
            }

            //检查施法者位置
            if (pCaster.GetPos().Distance2D(sTarInfo.m_vSrcPos) > 64.0f)
            {
                return(false);
            }

            //自身检查
            int nSrvCheck = pSkillData.MSV_SrcCheck;

            if (nSrvCheck > 0)
            {
                //todo 添加条件检查组后修复
                //if(!GSKillConditionCheckManager::Instance().Check(nSrvCheck, pCaster))
                //	return false;
            }

            //目标检查
            if (!GSkillLogicManager.Instance.CheckTarget(pSkillData, pCaster, sTarInfo))
            {
                return(false);
            }

            return(true);
        }
コード例 #10
0
ファイル: AIComponent.cs プロジェクト: GeorgeLiuXin/RPGdemo
        public float GetNextSkillRange()
        {
            float       fSkillRange = Constant.AI.AISkillDefaultCommonRange;
            DRSkillData pSkillData  = pMonster.SkillCom.GetSkillData(m_nNextSkill);

            if (pSkillData != null)
            {
                fSkillRange = pSkillData.MSV_Range / 2f;
            }

            return(fSkillRange);
        }
コード例 #11
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);
        }
コード例 #12
0
        //开始技能CD
        public void StartCD(DRSkillData pSkillData, bool bStart)
        {
            if (Owner == null || pSkillData == null)
            {
                return;
            }

            if (Owner.CDCom == null)
            {
                return;
            }
            Owner.CDCom.StartCD(pSkillData.MSV_CDGroup, pSkillData.MSV_CDTime);
        }
コード例 #13
0
        protected int GetTargetCount(DRSkillData pSkillData /*, GSkillExcludeList& vExcludeList*/)
        {
            if (pSkillData == null)
            {
                return(0);
            }

            //int nCount = pSkillData.MSV_AreaTarCnt;
            //if(vExcludeList.m_bCount)
            //	nCount = MIN(vExcludeList.m_nCount, nCount);
            //return nCount;
            return(pSkillData.MSV_AreaTarCnt);
        }
コード例 #14
0
        public void Clear()
        {
            m_fCurTime              = 0;
            m_pSkillData            = null;
            m_TargetInfo            = null;
            m_fSpeed                = 0;
            m_fLifeTime             = 0;
            m_fFirstEffectTime      = 0;
            m_fEffectTime           = 0;
            m_fCurEffectTime        = 0;
            m_vExcludeList          = null;
            m_vExcludeList.m_nCount = 0;
            m_vExcludeList.m_bCount = false;

            m_SkillAValue  = null;
            m_vPreCheckPos = default(Vector3);
        }
コード例 #15
0
        //获取技能,如果不是实例技能,返回模版技能
        public DRSkillData GetSkillData(int nSkillID)
        {
            GSkillSpellLogic pSpellLogic = GetSkill(nSkillID);

            if (pSpellLogic != null)
            {
                return(pSpellLogic.m_pSkillData);
            }

            DRSkillData pSkillData = GameEntry.DataTable.GetDataTable <DRSkillData>().GetDataRow(nSkillID);

            if (pSkillData != null && pSkillData.IsTemplateSkill())
            {
                return(pSkillData);
            }

            return(null);
        }
コード例 #16
0
        //检查技能消耗
        public bool CheckCost(DRSkillData pSkillData)
        {
            if (Owner == null || pSkillData == null)
            {
                return(false);
            }

            if (!CheckCost(pSkillData.MSV_CostType1, pSkillData.MSV_CostValue1))
            {
                return(false);
            }
            if (!CheckCost(pSkillData.MSV_CostType2, pSkillData.MSV_CostValue2))
            {
                return(false);
            }

            return(true);
        }
コード例 #17
0
        //创建技能子弹 todo技能子弹修复后添加
        public void CreateSkillProjectile(DRSkillData pSkillData, GTargetInfo sTarInfo, SkillAValueData m_SkillValue)
        {
            //if(Owner == null)
            //	return;

            //if(pSkillData == null)
            //	return;

            //int nType = pSkillData.MSV_ProjectileLogic;
            //GSkillProjectile pProjectile = GSkillLogicManager::Instance().CreateProjectile(nType);
            //if(!pProjectile)
            //	return;

            //if(!pProjectile->Init(pSkillData, sTarInfo, sRoleValue, (GNodeAvatar*)m_pOwner))
            //{
            //	FACTORY_DELOBJ(pProjectile);
            //	return;
            //}

            //if(m_pOwner->GetScene())
            //{
            //	((GNodeScene*)m_pOwner->GetScene())->ChangeProjsCount(+1);
            //}

            //pProjectile->SetID(++m_nProjectileID);
            ////子弹坐标使用当前角色坐标
            //if(pSkillData->IsBulletBornTarPos())
            //{
            //	pProjectile->m_TargetInfo.m_vSrcPos = pProjectile->m_TargetInfo.m_vTarPos;
            //	pProjectile->m_TargetInfo.m_vSrcPos.z = m_pOwner->GetSceneHeight(pProjectile->m_TargetInfo.m_vTarPos);
            //}

            //pProjectile->Tick(0, Owner);     //MSV_ProjectileFirstEffectTime 为0的情况
            //if(m_ProjectileDict.ContainsKey(pSkillData.Id))
            //{
            //	m_ProjectileDict[pSkillData.Id].Add(pProjectile);
            //}
            //else
            //{
            //	List<GSkillProjectile> list = new List<GSkillProjectile>();
            //	list.Add(pProjectile);
            //	m_ProjectileDict[pSkillData.Id].Add(list);
            //}
        }
コード例 #18
0
        //增加技能
        public bool AddSkill(int nSkillID /*, int nSlots = 0*/)
        {
            if (!Owner)
            {
                return(false);
            }
            DRSkillData pSkillData = GameEntry.DataTable.GetDataTable <DRSkillData>().GetDataRow(nSkillID);

            if (pSkillData == null)
            {
                return(false);
            }

            if (HasSkill(nSkillID))
            {
                return(false);
            }

            GTargetInfo sTarInfo = new GTargetInfo();

            sTarInfo.m_nTargetID = Owner.Id;
            sTarInfo.m_vSrcPos   = Owner.GetPos();
            sTarInfo.m_vAimDir   = Owner.GetDir();
            sTarInfo.m_vTarPos   = Owner.GetPos();

            GSkillInitParam  param       = new GSkillInitParam(Owner, sTarInfo, pSkillData);
            GSkillSpellLogic pSpellLogic = CreateSkill(param);

            if (pSpellLogic == null)
            {
                return(false);
            }

            m_SkillLogicDict.Add(nSkillID, pSpellLogic);
            if (pSkillData.IsPassiveSkill() && !pSkillData.IsBuffSkill())
            {
                AddPassiveSkill(pSpellLogic);
                TryCalculateAttribute(pSpellLogic);
            }

            AddSubSkill(pSpellLogic);
            return(true);
        }
コード例 #19
0
        // todo 添加 技能属性集与玩家合并接口及数据类型
        //protected XXX m_pXXXX;

        public virtual bool Init(GSkillInitParam param)
        {
            if (param.m_pOwner == null ||
                param.m_pSkillData == null ||
                param.m_TargetInfo == null)
            {
                return(false);
            }

            m_pOwner     = param.m_pOwner;
            m_TargetInfo = param.m_TargetInfo;
            m_pSkillData = param.m_pSkillData;

            m_nCasterID = m_pOwner.Id;

            ////属性转换
            //int nTransfromID = MSV_EffectTransform;
            //m_pXXXX = data.get(MSV_EffectTransform)
            return(true);
        }
コード例 #20
0
        //检查技能CD
        public bool CheckCD(DRSkillData pSkillData)
        {
            if (Owner == null || pSkillData == null)
            {
                return(false);
            }

            //检查CD
            int nCDGroup = pSkillData.MSV_CDGroup;

            if (nCDGroup < 0)           //-1 no cd
            {
                return(true);
            }

            if (Owner.CDCom == null || Owner.CDCom.CheckCD(nCDGroup))
            {
                return(false);
            }
            return(true);
        }
コード例 #21
0
        public bool PreSkill(int nSkillID)
        {
            if (m_bInPreSkill)
            {
                ResetSkill();
            }

            DRSkillData skillData = GameEntry.DataTable.GetDataTable <DRSkillData>().GetDataRow(nSkillID);

            if (skillData == null)
            {
                return(false);
            }
            m_nCurMode = skillData.MSV_PreSkillMode;
            if (m_nCurMode <= (int)ePreSkillMode.PreSkillMode_None ||
                m_nCurMode >= (int)ePreSkillMode.PreSkillMode_Size)
            {
                return(false);
            }
            m_bInPreSkill = m_PreSkillModes[m_nCurMode].Enter(skillData);
            return(m_bInPreSkill);
        }
コード例 #22
0
 public virtual bool Enter(DRSkillData pSkillData)
 {
     m_pSkillData = pSkillData;
     return(true);
 }
コード例 #23
0
        public virtual bool CheckTrigger(Avatar pCaster, DRSkillData pSkillData)
        {
            if (!pCaster || pSkillData == null)
            {
                return(false);
            }

            int nType = pSkillData.MSV_TriggerType;

            if (m_nType != nType)
            {
                return(false);
            }

            int nCheck = pSkillData.MSV_TriggerCheck;

            //检查消息DataID
            if ((nCheck & (int)eSkillTriggerCheck.TriggerCheck_Data_UnChecked) <= 0)
            {
                int nDataID = pSkillData.MSV_TriggerDataID;
                if ((nCheck & (int)eSkillTriggerCheck.TriggerCheck_Data_ID) > 0)
                {
                    if (m_nDataID != nDataID)
                    {
                        return(false);
                    }
                }
            }
            //检查消息参数
            if ((nCheck & (int)eSkillTriggerCheck.TriggerCheck_Flag_UnChecked) <= 0)
            {
                int nFlag = pSkillData.MSV_TriggerNotify;
                if ((nCheck & (int)eSkillTriggerCheck.TriggerCheck_Flag_Equal) > 0)
                {
                    if (m_nFlag != nFlag)
                    {
                        return(false);
                    }
                }
                else if ((nCheck & (int)eSkillTriggerCheck.TriggerCheck_Flag_And) > 0)
                {
                    if ((m_nFlag & nFlag) != nFlag)
                    {
                        return(false);
                    }
                }
                else if ((nCheck & (int)eSkillTriggerCheck.TriggerCheck_Flag_Or) > 0)
                {
                    if ((m_nFlag & nFlag) <= 0)
                    {
                        return(false);
                    }
                }
            }
            //检查消息数值
            if ((nCheck & (int)eSkillTriggerCheck.TriggerCheck_Value_UnChecked) <= 0)
            {
                int nValue = pSkillData.MSV_TriggerValue;
                if ((nCheck & (int)eSkillTriggerCheck.TriggerCheck_Value_Greater) > 0)
                {
                    if (m_nValue <= nValue)
                    {
                        return(false);
                    }
                }
                else if ((nCheck & (int)eSkillTriggerCheck.TriggerCheck_Value_GreaterAndEqual) > 0)
                {
                    if (m_nValue < nValue)
                    {
                        return(false);
                    }
                }
                else if ((nCheck & (int)eSkillTriggerCheck.TriggerCheck_Value_Less) > 0)
                {
                    if (m_nValue >= nValue)
                    {
                        return(false);
                    }
                }
                else if ((nCheck & (int)eSkillTriggerCheck.TriggerCheck_Value_LessAndEqual) > 0)
                {
                    if (m_nValue > nValue)
                    {
                        return(false);
                    }
                }
                else if ((nCheck & (int)eSkillTriggerCheck.TriggerCheck_Value_Equal) > 0)
                {
                    if (m_nValue != nValue)
                    {
                        return(false);
                    }
                }
                else if ((nCheck & (int)eSkillTriggerCheck.TriggerCheck_Value_NotEqual) > 0)
                {
                    if (m_nValue == nValue)
                    {
                        return(false);
                    }
                }
                else if ((nCheck & (int)eSkillTriggerCheck.TriggerCheck_Value_And) > 0)
                {
                    if ((m_nValue & nValue) != nValue)
                    {
                        return(false);
                    }
                }
                else if ((nCheck & (int)eSkillTriggerCheck.TriggerCheck_Value_Or) > 0)
                {
                    if ((m_nValue & nValue) <= 0)
                    {
                        return(false);
                    }
                }
            }

            //检查概率
            float nProbalitity = pSkillData.MSV_TriggerProbability;
            float nRand        = Random.Range(0.0f, 1.0f);

            return(nProbalitity >= nRand);
        }
コード例 #24
0
        //处理技能效果
        public void ProcessSkillEffect(DRSkillData pSkillData, GTargetInfo sTarInfo, SkillAValueData AValue)
        {
            GSkillExcludeList vExcludeList = new GSkillExcludeList();

            ProcessSkillEffect(pSkillData, sTarInfo, AValue, vExcludeList);
        }
コード例 #25
0
        public override List <Avatar> GetTargetList(DRSkillData pSkillData,
                                                    Avatar pCaster, GTargetInfo sTarInfo, HashSet <int> vExcludeList)
        {
            List <Avatar> vTargetList = new List <Avatar>();

            if (pSkillData == null || !pCaster)
            {
                return(vTargetList);
            }
            Avatar pTarget = GameEntry.Entity.GetGameEntity(sTarInfo.m_nTargetID) as Avatar;

            if (!pTarget)
            {
                pTarget = pCaster;
            }

            int   cnt    = GetTargetCount(pSkillData /*, vExcludeList*/);
            int   filter = pSkillData.MSV_AreaFilter;
            float minDis = pSkillData.MSV_AreaParam1;
            float maxDis = pSkillData.MSV_AreaParam2;
            float w      = pSkillData.MSV_AreaParam3;

            List <UnityGameFramework.Runtime.Entity> pList = new List <UnityGameFramework.Runtime.Entity>();

            GameEntry.Entity.GetAllLoadedEntities(pList);
            if (pList == null || pList.Count == 0)
            {
                return(vTargetList);
            }
            Vector3 pos    = /*pSkillData.IsAreaUseTarPos() ? sTarInfo.m_vTarPos :*/ sTarInfo.m_vSrcPos;
            Vector3 dir    = sTarInfo.m_vAimDir;
            Vector3 center = pos + dir * ((minDis + maxDis) / 2);

            SRect sRect = new SRect(center, maxDis - minDis, w);

            foreach (var item in pList)
            {
                Avatar actor = item.Logic as Avatar;
                if (actor == null || actor == pCaster)
                {
                    continue;
                }
                SSphere sTarSphere = new SSphere(actor.GetPos(), actor.ModelRadius);
                if (GCollider.RectCollideCheck(sRect, sTarSphere, dir))
                {
                    TryAddTarget(pSkillData, pCaster, actor, vExcludeList);
                    if (vTargetList.Count >= cnt)
                    {
                        if (filter > 0)
                        {
                            UpdateAreaFilter(filter, cnt, vTargetList);
                        }
                        else
                        {
                            return(vTargetList);
                        }
                    }
                    break;
                }
            }
            return(vTargetList);
        }
コード例 #26
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;
                }
            }
        }
コード例 #27
0
        //使用技能
        public bool SpellSkill(int nSkillID, GTargetInfo sTarInfo)
        {
            if (Owner == null)
            {
                return(false);
            }

            GSkillSpellLogic pSpellLogic = GetSkill(nSkillID);

            if (pSpellLogic == null)
            {
                DRSkillData skillData = GameEntry.DataTable.GetDataTable <DRSkillData>().GetDataRow(nSkillID);
                if (skillData != null && skillData.IsTemplateSkill())
                {
                    if (AddSkill(nSkillID))
                    {
                        pSpellLogic = GetSkill(nSkillID);
                    }
                }
            }
            if (pSpellLogic == null)
            {
                return(false);
            }

            DRSkillData pSkillData = pSpellLogic.m_pSkillData;

            if (pSkillData == null)
            {
                return(false);
            }

            if (!CanSpellSkill(pSkillData, sTarInfo))
            {
                return(false);
            }

            if (m_pSpellLogic != null)
            {
                FinishSkill();
            }

            if (!pSpellLogic.SetFSMState())
            {
                return(false);
            }

            //初始化施法逻辑
            m_pSpellLogic = pSpellLogic;

            m_pSpellLogic.Reset();
            if (sTarInfo.m_vAimDir == default(Vector3))
            {
                sTarInfo.m_vAimDir = Owner.GetDir();
            }

            m_pSpellLogic.m_TargetInfo = sTarInfo;

            m_pSpellLogic.ResetSkillAValue();

            if (!pSkillData.IsEffectStateCost())
            {
                DoCost(pSkillData);
                StartCD(pSkillData, true);
                //todo 允许部分技能在生效时产生消耗
                //m_pSpellLogic.SetCosted();
            }

            m_pSpellLogic.ReInit();
            sTarInfo = m_pSpellLogic.m_TargetInfo;

            Log.Debug("Avatar'{0}' Skill'{1}' Spell", Owner.Id, nSkillID);

            //产生技能事件
            if (pSkillData.IsTriggerSkillNotify())
            {
                PushTriggerNotify(nSkillID, sTarInfo.m_nTargetID,
                                  (int)eTriggerNotifyType.NotifyType_Skill,
                                  (int)eTriggerNotify.TriggerNotify_SkillStart, 0,
                                  sTarInfo.m_vSrcPos, sTarInfo.m_vTarPos, sTarInfo.m_vAimDir);
            }

            //执行瞬发效果
            m_pSpellLogic.Tick(0);
            return(true);
        }
コード例 #28
0
        //public GBuff buff;		//通过buff挂载的技能
        //public int nSlots;		//技能修正槽位

        public GSkillInitParam(Avatar pOwner, GTargetInfo targetInfo, DRSkillData pSkillData)
        {
            m_pOwner     = pOwner;
            m_TargetInfo = targetInfo;
            m_pSkillData = pSkillData;
        }
コード例 #29
0
ファイル: IAimHelper.cs プロジェクト: GeorgeLiuXin/RPGdemo
        public override int AimAssist(DRSkillData pSkillData, Avatar pOwner)
        {
            if (pOwner == null)
            {
                return(0);
            }
            Vector3 vPos = pOwner.GetPos();
            Vector3 vDir = GameEntry.CameraMgr.GetCamDir().normalized2d();

            float fMinActorWeight = 3600000;
            int   nAvatarID       = 0;

            IEntity[] list = GetEnemyGroup(pOwner.Camp);
            if (list == null || list.Length == 0)
            {
                return(0);
            }

            foreach (IEntity item in list)
            {
                Avatar actor = GameEntry.Entity.GetGameEntity(item.Id) as Avatar;
                if (actor == null || actor.IsDead)
                {
                    continue;
                }

                if (AIUtility.GetRelation(pOwner.Camp, actor.Camp) != RelationType.Hostile)
                {
                    continue;
                }

                Vector3 vOffestPos = actor.GetPos() - vPos;
                vOffestPos.y = 0;
                float fMagnitude = vOffestPos.magnitude + 0.5f;

                // 排除最远距离外的目标
                if (fMagnitude > GetMaxRange(pSkillData))
                {
                    continue;
                }

                //计算各个角度的权重  以距离为权重
                float fCurActorWeight;
                float angle = Vector3.Angle(vDir, vOffestPos);
                if (angle <= 45f)
                {
                    fCurActorWeight = 9000 + fMagnitude;
                }
                else if (angle > 45f && angle < 90f)
                {
                    fCurActorWeight = 18000 + fMagnitude;
                }
                else
                {
                    fCurActorWeight = 36000 + fMagnitude;
                }

                if (fCurActorWeight < fMinActorWeight)
                {
                    fMinActorWeight = fCurActorWeight;
                    nAvatarID       = actor.Id;
                }
            }
            return(nAvatarID != 0 ? nAvatarID : 0);
        }
コード例 #30
0
 public abstract List <Avatar> GetTargetList(DRSkillData pSkillData,
                                             Avatar pCaster, GTargetInfo sTarInfo, HashSet <int> vExcludeList);