Ejemplo n.º 1
0
        public bool CalcPassivitySpellTarget(ref FIGHTOBJECT_LIST targetlist)
        {
            SkillTemplate pRow = m_pSpellInfo.GetSpellRow();

            switch (m_pSpellInfo.GetTargetType())
            {
            case (int)EM_TARGET_TYPE.EM_TARGET_FRIEND:
            {
                int nID = -1;
                if (ObjectSelf.GetInstance().Teams.IsHeroInTeam(m_pHolder.GetGuid(), ref nID))
                {
                    for (int i = 0; i < GlobalMembers.MAX_TEAM_CELL_COUNT; ++i)
                    {
                        X_GUID     _guid = ObjectSelf.GetInstance().Teams.m_Matrix[nID, i];
                        ObjectCard obj   = ObjectSelf.GetInstance().HeroContainerBag.FindHero(_guid);
                        if (obj != null)
                        {
                            targetlist.Add((ObjectCreature)obj);
                        }
                    }
                }
            }
            break;

            case (int)EM_TARGET_TYPE.EM_TARGET_SELF:
            {
                targetlist.Add((ObjectCreature)m_pHolder);
            }
            break;

            default:
                break;
            }
            return(true);
        }
Ejemplo n.º 2
0
        public bool __CalculateSpellTarget(ref FIGHTOBJECT_LIST targetlist)
        {
            targetlist.m_pObjectList.Clear();
            LogManager.LogAssert(m_pHolder);
            LogManager.LogAssert(m_pSpellInfo);
            SkillTemplate pRow = m_pSpellInfo.GetSpellRow();

            LogManager.LogAssert(pRow);
            switch (m_pSpellInfo.GetTargetType())
            {
            case (int)EM_TARGET_TYPE.EM_TARGET_FRIEND:
            {
                if (m_pSpellInfo.IsNeedTarget())
                {
                    if (m_SpellTarget.IsValid())
                    {
                        SceneObjectManager pScene = SceneObjectManager.GetInstance();
                        LogManager.LogAssert(pScene);
                        ObjectCreature pTarget = pScene.GetObjectHeroByGUID(m_SpellTarget);
                        if (pTarget != null)
                        {
                            targetlist.Add((ObjectCreature)pTarget);
                        }
                    }
                }
                else if (pRow.getCoverage() < 0.0f)
                {
                    SceneObjectManager pScene = SceneObjectManager.GetInstance();
                    LogManager.LogAssert(pScene);
                    SCANOPERATOR_INIT init = new SCANOPERATOR_INIT();
                    init.m_Type = m_pSpellInfo.GetTargetType();
                    pScene.ScanByObject(m_pHolder, ref init);
                    for (int j = 0; j < init.m_ObjectList.Count; j++)
                    {
                        targetlist.Add((ObjectCreature)init.m_ObjectList[j]);
                    }
                }
            }
            break;

            case (int)EM_TARGET_TYPE.EM_TARGET_ENEMY:
            {
                if (m_pSpellInfo.IsNeedTarget())
                {
                    if (m_SpellTarget.IsValid())
                    {
                        SceneObjectManager pScene = SceneObjectManager.GetInstance();
                        LogManager.LogAssert(pScene);
                        ObjectCreature pTarget = pScene.GetSceneObjectByGUID(m_SpellTarget);
                        if (pTarget != null)
                        {
                            targetlist.Add((ObjectCreature)pTarget);
                        }
                    }
                }
                else if (pRow.getCoverage() < 0.0f)
                {
                    SceneObjectManager pScene = SceneObjectManager.GetInstance();
                    LogManager.LogAssert(pScene);
                    SCANOPERATOR_INIT init = new SCANOPERATOR_INIT();
                    init.m_Type = m_pSpellInfo.GetTargetType();
                    pScene.ScanByObject(m_pHolder, ref init);
                    for (int j = 0; j < init.m_ObjectList.Count; j++)
                    {
                        targetlist.Add((ObjectCreature)init.m_ObjectList[j]);
                    }
                }
            }
            break;

            case (int)EM_TARGET_TYPE.EM_TARGET_SELF:
            {
                targetlist.Add((ObjectCreature)m_pHolder);
            }
            break;

            case (int)EM_TARGET_TYPE.EM_TARGET_ALL:
            {
                SceneObjectManager pScene = SceneObjectManager.GetInstance();
                LogManager.LogAssert(pScene);
                SCANOPERATOR_INIT init = new SCANOPERATOR_INIT();
                init.m_Type = m_pSpellInfo.GetTargetType();
                pScene.ScanByObject(m_pHolder, ref init);
                for (int j = 0; j < init.m_ObjectList.Count; j++)
                {
                    targetlist.Add((ObjectCreature)init.m_ObjectList[j]);
                }
            }
            break;

            case (int)EM_TARGET_TYPE.EM_TARGET_FRIEND_NO_SELF:
            {
                SceneObjectManager pScene = SceneObjectManager.GetInstance();
                LogManager.LogAssert(pScene);
                SCANOPERATOR_INIT init = new SCANOPERATOR_INIT();
                init.m_Type = m_pSpellInfo.GetTargetType();
                pScene.ScanByObject(m_pHolder, ref init);
                for (int j = 0; j < init.m_ObjectList.Count; j++)
                {
                    targetlist.Add((ObjectCreature)init.m_ObjectList[j]);
                }
            }
            break;

            case (int)EM_TARGET_TYPE.EM_TARGET_FRIEND_MIN_HPPERCENT:
            {
                SceneObjectManager pScene = SceneObjectManager.GetInstance();
                LogManager.LogAssert(pScene);
                SCANOPERATOR_INIT init = new SCANOPERATOR_INIT();
                init.m_Type = m_pSpellInfo.GetTargetType();
                pScene.ScanByObject(m_pHolder, ref init);
                for (int j = 0; j < init.m_ObjectList.Count; j++)
                {
                    targetlist.Add((ObjectCreature)init.m_ObjectList[j]);
                }
            }
            break;

            case (int)EM_TARGET_TYPE.EM_TARGET_ALL_NO_SELF:
            {
                SceneObjectManager pScene = SceneObjectManager.GetInstance();
                LogManager.LogAssert(pScene);
                SCANOPERATOR_INIT init = new SCANOPERATOR_INIT();
                init.m_Type = m_pSpellInfo.GetTargetType();
                pScene.ScanByObject(m_pHolder, ref init);
                for (int j = 0; j < init.m_ObjectList.Count; j++)
                {
                    targetlist.Add((ObjectCreature)init.m_ObjectList[j]);
                }
            }
            break;

            case (int)EM_TARGET_TYPE.EM_TARGET_ENEMY_MIN_HPPERCENT:
            {
                SceneObjectManager pScene = SceneObjectManager.GetInstance();
                LogManager.LogAssert(pScene);
                SCANOPERATOR_INIT init = new SCANOPERATOR_INIT();
                init.m_Type = m_pSpellInfo.GetTargetType();
                pScene.ScanByObject(m_pHolder, ref init);
                for (int j = 0; j < init.m_ObjectList.Count; j++)
                {
                    targetlist.Add((ObjectCreature)init.m_ObjectList[j]);
                }
            }
            break;

            case (int)EM_TARGET_TYPE.EM_TARGET_ATTACK_ME:
            {
                SceneObjectManager pScene = SceneObjectManager.GetInstance();
                LogManager.LogAssert(pScene);
                ObjectCreature pTarget = pScene.GetObjectHeroByGUID(m_SpellTarget);
                if (pTarget != null)
                {
                    targetlist.Add((ObjectCreature)pTarget);
                }
            }
            break;

            case (int)EM_TARGET_TYPE.EM_TARGET_ENEMY_RAND:
            {
                SceneObjectManager pScene = SceneObjectManager.GetInstance();
                LogManager.LogAssert(pScene);
                SCANOPERATOR_INIT init = new SCANOPERATOR_INIT();
                init.m_Type = m_pSpellInfo.GetTargetType();
                pScene.ScanByObject(m_pHolder, ref init);
                for (int j = 0; j < init.m_ObjectList.Count; j++)
                {
                    targetlist.Add((ObjectCreature)init.m_ObjectList[j]);
                }
            }
            break;

            case (int)EM_TARGET_TYPE.EM_TARGET_IMPACT_CASTER:
            {
                SceneObjectManager pScene = SceneObjectManager.GetInstance();
                LogManager.LogAssert(pScene);
                ObjectCreature pTarget = pScene.GetObjectHeroByGUID(m_SpellTarget);
                if (pTarget != null)
                {
                    targetlist.Add((ObjectCreature)pTarget);
                }
            }
            break;

            case (int)EM_TARGET_TYPE.EM_TARGET_FRIEND_RAND:
            {
                SceneObjectManager pScene = SceneObjectManager.GetInstance();
                LogManager.LogAssert(pScene);
                SCANOPERATOR_INIT init = new SCANOPERATOR_INIT();
                init.m_Type = m_pSpellInfo.GetTargetType();
                int m_Tagnum = m_pSpellInfo.GetBaseSpellTargetNumber();
                pScene.ScanByObject(m_pHolder, ref init, m_Tagnum);
                for (int j = 0; j < init.m_ObjectList.Count; j++)
                {
                    targetlist.Add((ObjectCreature)init.m_ObjectList[j]);
                }
            }
            break;

            case (int)EM_TARGET_TYPE.EM_TARGET_ENEMY_RANDOM:
            {
                if (m_pSpellInfo.IsNeedTarget())
                {
                    if (m_SpellTarget.IsValid())
                    {
                        SceneObjectManager pScene = SceneObjectManager.GetInstance();
                        LogManager.LogAssert(pScene);
                        ObjectCreature pTarget = pScene.GetObjectHeroByGUID(m_SpellTarget);
                        if (pTarget != null)
                        {
                            targetlist.Add((ObjectCreature)pTarget);
                        }
                        SCANOPERATOR_INIT init = new SCANOPERATOR_INIT();
                        init.m_Type = m_pSpellInfo.GetTargetType();
                        pScene.ScanByObject(m_pHolder, ref init, m_pSpellInfo.GetBaseSpellTargetNumber(), pTarget);
/*                                targetlist.m_pObjectList.Clear();*/

                        for (int j = 0; j < init.m_ObjectList.Count; j++)
                        {
                            targetlist.Add((ObjectCreature)init.m_ObjectList[j]);
                        }
                    }
                }
                else
                {
                    LogManager.Log("F**K");
                }
            }
            break;

            case (int)EM_TARGET_TYPE.EM_TARGET_FRIEND_RANDOM:
            {
                if (m_pSpellInfo.IsNeedTarget())
                {
                    if (m_SpellTarget.IsValid())
                    {
                        SceneObjectManager pScene = SceneObjectManager.GetInstance();
                        LogManager.LogAssert(pScene);
                        ObjectCreature pTarget = pScene.GetObjectHeroByGUID(m_SpellTarget);
                        if (pTarget != null)
                        {
                            targetlist.Add((ObjectCreature)pTarget);
                        }
                        SCANOPERATOR_INIT init = new SCANOPERATOR_INIT();
                        init.m_Type = m_pSpellInfo.GetTargetType();
                        pScene.ScanByObject(m_pHolder, ref init, m_pSpellInfo.GetBaseSpellTargetNumber(), pTarget);
                        for (int j = 0; j < init.m_ObjectList.Count; j++)
                        {
                            targetlist.Add((ObjectCreature)init.m_ObjectList[j]);
                        }
                    }
                }
                else
                {
                    LogManager.Log("F**K");
                }
            }
            break;

            case (int)EM_TARGET_TYPE.EM_TARGET_SELF_RANDOM:
            {
                if (m_pSpellInfo.IsNeedTarget())
                {
                    if (m_SpellTarget.IsValid())
                    {
                        SceneObjectManager pScene = SceneObjectManager.GetInstance();
                        LogManager.LogAssert(pScene);
                        ObjectCreature pTarget = pScene.GetSceneObjectByGUID(m_SpellTarget);
                        if (pTarget != null)
                        {
                            targetlist.Add((ObjectCreature)pTarget);
                            int m_Tagnum = m_pSpellInfo.GetBaseSpellTargetNumber();
                            if (pTarget.GetGameObject().GetHashCode() != m_pHolder.GetGameObject().GetHashCode())
                            {
                                targetlist.Add((ObjectCreature)m_pHolder);
                            }
                            else
                            {
                                m_Tagnum = m_Tagnum + 1;
                            }

                            SCANOPERATOR_INIT init = new SCANOPERATOR_INIT();
                            init.m_Type = m_pSpellInfo.GetTargetType();
                            pScene.ScanByObject(m_pHolder, ref init, m_Tagnum, pTarget);
                            for (int j = 0; j < init.m_ObjectList.Count; j++)
                            {
                                targetlist.Add((ObjectCreature)init.m_ObjectList[j]);
                            }
                        }
                    }
                }
                else
                {
                    LogManager.Log("F**K");
                }
            }
            break;

            default:
                break;
            }
            return(true);
        }