Esempio n. 1
0
    private void SwithResourceType(int Type, int ID, int Num, ObjectCreature value)
    {
        switch (Type)
        {
        case (int)EM_EXTRAITEM_TYPE.EM_EXTRAITEM_TYPE_INVALID:
            break;

        case (int)EM_EXTRAITEM_TYPE.EM_EXTRAITEM_MP:
            if (!ObjectSelf.GetInstance().isSkillShow)
            {
                FightControler.Inst.OnUpdatePowerValue(value.GetGroupType(), -Num);
            }
            break;

        case (int)EM_EXTRAITEM_TYPE.EM_EXTRAITEM_MP_PERCENT:
            FightControler.Inst.OnUpdatePowerValue(value.GetGroupType(), -(FightControler.Inst.GetPowerValue(value.GetGroupType()) * Num / 100));
            break;

        case (int)EM_EXTRAITEM_TYPE.EM_EXTRAITEM_HP:
            value.SetHP((value.GetHP() - Num));
            break;

        case (int)EM_EXTRAITEM_TYPE.EM_EXTRAITEM_CURRENTHP_PERCENT:
            value.SetHP((value.GetHP() - (value.GetHP() * (Num / 100))));
            break;

        case (int)EM_EXTRAITEM_TYPE.EM_EXTRAITEM_MAXHP_PERCENT:
            value.SetHP((value.GetHP() - (value.GetMaxHP() * (Num / 100))));
            break;

        case (int)EM_EXTRAITEM_TYPE.EM_EXTRAITEM_COMMON:
            break;

        case (int)EM_EXTRAITEM_TYPE.EM_EXTRAITEM_GOLD:
            break;

        case (int)EM_EXTRAITEM_TYPE.EM_EXTRAITEM_RONGHUN:
            break;

        case (int)EM_EXTRAITEM_TYPE.EM_EXTRAITEM_RUNEPOINT:
            break;

        case (int)EM_EXTRAITEM_TYPE.EM_EXTRAITEM_PARTNER:
            break;

        case (int)EM_EXTRAITEM_TYPE.EM_EXTRAITEM_ITEM:
            break;

        case (int)EM_EXTRAITEM_TYPE.EM_EXTRAITEM_EQUIP:
            break;
        }
    }
Esempio n. 2
0
        /// <summary>
        /// 血量变化
        /// </summary>
        private void onHpChangeCall(GameEvent e)
        {
            UI_HurtInfo info = (UI_HurtInfo)e.data;

            if (info != null)
            {
                ObjectCreature obj = info.pTarget;
                mBloodControl.UpdateBloodValue(obj.GetGuid(), (float)obj.GetHP() / obj.GetMaxHP());
                if (obj.GetHP() < 0)
                {
                    return;
                }
                if (obj.GetGroupType() == EM_OBJECT_TYPE.EM_OBJECT_TYPE_HERO)
                {
                    // hero
                    Transform trans = ((ObjectHero)obj).GetAnimation().EventControl.Pre_Head_T_EffectPoint;
                    if (info.nHurt > 0)
                    {
                        // 英雄加血
                        mNumberMgr.showNumber(System.Math.Abs(info.nHurt), HPNumberType.HP_HEAL, trans.position);
                    }
                    else
                    {
                        // 英雄掉血
                        mNumberMgr.showNumber(System.Math.Abs(info.nHurt), HPNumberType.HP_SELF_HURT, trans.position);
                    }
                }
                else if (obj.GetGroupType() == EM_OBJECT_TYPE.EM_OBJECT_TYPE_MONSTER)
                {
                    // monster
                    Transform trans = ((ObjectMonster)obj).GetAnimation().EventControl.Pre_Head_T_EffectPoint;
                    if (info.nHurt < 0)
                    {
                        //敌人掉血
                        if (info.bCritical)
                        {
                            // 暴击
                            mNumberMgr.showNumber(System.Math.Abs(info.nHurt), HPNumberType.HP_HEAVY, trans.position);
                        }
                        else
                        {
                            mNumberMgr.showNumber(System.Math.Abs(info.nHurt), HPNumberType.HP_ENEMY_HURT, trans.position);
                        }
                    }
                    else
                    {
                        // 敌人加血
                        mNumberMgr.showNumber(System.Math.Abs(info.nHurt), HPNumberType.HP_HEAL, trans.position);
                    }
                }
            }
        }
Esempio n. 3
0
        private void SelectFireSigh()
        {
            if (m_CurTouchState == TouchState.SelectSkillTarget_state)
            {
                return;
            }

            if (Input.GetMouseButtonDown(0))
            {
                // TODO... GUIDE
                Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                RaycastHit hit;
                if (Physics.Raycast(ray, out hit))
                {
                    GameObject obj = hit.transform.gameObject;
                    if (obj)
                    {
                        ObjectCreature objC = SceneObjectManager.GetInstance().GetSceneObjectByGameObject(obj);
                        if (objC != null && objC.GetGroupType() == EM_OBJECT_TYPE.EM_OBJECT_TYPE_MONSTER && objC.IsAlive())
                        {
                            SceneObjectManager.GetInstance().UpdateFireSignCreature(objC);
                        }
                    }
                }
            }
        }
Esempio n. 4
0
        public EM_SPELL_RESULT __HitLogic(ObjectCreature pTarget)
        {
            LogManager.LogAssert(m_pHolder);
            LogManager.LogAssert(m_pSpellInfo);
            // 目标是友方 直接命中 [3/9/2015 Zmy]
            if (pTarget.GetGroupType() == m_pHolder.GetGroupType())
            {
                return(EM_SPELL_RESULT.EM_SPELL_RESULT_NORMAL);
            }

            /*if ((pTarget.IsInFightState(EM_CARD_FIGHT_STATE_IDLE))||(pTarget.IsInFightState(EM_CARD_FIGHT_STATE_IMM)))
             * {
             *      return EM_SPELL_RESULT_MISS;
             * }*/
            /*一次攻击行为的命中判定率P的计算公式为:
             *     P = p - b / (〖a((A + X) / (B + X))〗^k + c) + A^'-B'
             *     其中A为攻击方命中最终值,B为防御方最终闪避值,A’为攻击方命中最终率,B’为防御方闪避最终率。
             *     X、a、b、c、k、p 分别为命中率计算系数,配置在10_config表中。*/
            float nParamX = DataTemplate.GetInstance().m_GameConfig.getDodge_X();
            float nParama = DataTemplate.GetInstance().m_GameConfig.getDodge_a();
            float nParamb = DataTemplate.GetInstance().m_GameConfig.getDodge_b();
            float nParamc = DataTemplate.GetInstance().m_GameConfig.getDodge_c();
            float nParamk = DataTemplate.GetInstance().m_GameConfig.getDodge_k();
            float nParamp = DataTemplate.GetInstance().m_GameConfig.getDodge_p();

            double fParam = (m_pHolder.GetHit() + nParamX) / (pTarget.GetDodge() + nParamX);

            fParam = Math.Pow(fParam, nParamk);
            int fHit = (int)((nParamp - nParamb / (nParama * fParam + nParamc) + m_pHolder.GetHitRate() - pTarget.GetDodgeRate()) * 10000L);

            fHit = Math.Max((int)(DataTemplate.GetInstance().m_GameConfig.getDodge_min() * 10000f), fHit);

//          System.Random ran = new System.Random();
//          int nRand = ran.Next(1, 10000);
            //取系统时间的毫秒数为随机种子!规避伪随机导致的结果相同[9/22/2015 Zmy]
            int iRnd = System.DateTime.Now.Millisecond;

            System.Random randomCoor = new System.Random(iRnd);
            int           nRand      = randomCoor.Next(1, 10000);

            if (nRand <= fHit)
            {
                return(EM_SPELL_RESULT.EM_SPELL_RESULT_NORMAL);
            }

            return(EM_SPELL_RESULT.EM_SPELL_RESULT_MISS);
        }
Esempio n. 5
0
        /// <summary>
        /// buff更新
        /// </summary>
        private void onBufferUpdateCall(GameEvent e)
        {
            BuffUpdatePackage buffEvent = (BuffUpdatePackage)e.data;
            ObjectCreature    creature  = buffEvent.creature;
            Impact            pImpact   = buffEvent.pImpact;
            bool isAdd = buffEvent.isAdd;

            //pImpact.GetImpactRow().m_conduce == 0
            if (!string.IsNullOrEmpty(pImpact.GetImpactRow().getBuffIconBig()))
            {
                // 光环
                // 更新到怒气条下
                EM_OBJECT_TYPE groupType = creature.GetGroupType();
                switch (groupType)
                {
                case EM_OBJECT_TYPE.EM_OBJECT_TYPE_HERO:
                {
                    if (isAdd)
                    {
                        mMenuPanel.onSelfAllBuffAdd(pImpact.GetImpactRow());
                    }
                    else
                    {
                        mMenuPanel.onSelfAllBuffRemove(pImpact.GetImpactRow());
                    }
                }
                break;

                case EM_OBJECT_TYPE.EM_OBJECT_TYPE_MONSTER:
                {
                    if (isAdd)
                    {
                        mMenuPanel.onEnemyAllBuffAdd(pImpact.GetImpactRow());
                    }
                    else
                    {
                        mMenuPanel.onEnemyAllBuffRemove(pImpact.GetImpactRow());
                    }
                }
                break;
                }
            }

            if (!string.IsNullOrEmpty(pImpact.GetImpactRow().getBuffIconSmall()))
            {
                // buff 单体
                // 更新到角色血条下
                if (isAdd)
                {
                    mBloodPanel.onSingleBuffAdd(creature.GetGuid(), pImpact.GetImpactRow());
                }
                else
                {
                    mBloodPanel.onSingleBuffRemove(creature.GetGuid(), pImpact.GetImpactRow());
                }
            }
        }
Esempio n. 6
0
    private bool IsEnoughRp(ObjectCreature value)
    {
        switch (m_pTableRowSpell.getRpConditionType())
        {
        case (int)EM_SPELL_CONDITION_TYPE.EM_SPELL_CONDITION_TYPE_INVALID:
            return(true);

        case (int)EM_SPELL_CONDITION_TYPE.EM_SPELL_CONDITION_TYPE_LESSVALUE:
            if (FightControler.Inst.GetPowerValue(value.GetGroupType()) <= m_pTableRowSpell.getRpConditionNum())
            {
                return(true);
            }
            break;

        case (int)EM_SPELL_CONDITION_TYPE.EM_SPELL_CONDITION_TYPE_MOREVALUE:
            if (ObjectSelf.GetInstance().isSkillShow)
            {
                return(true);
            }
            else if (FightControler.Inst.GetPowerValue(value.GetGroupType()) >= m_pTableRowSpell.getRpConditionNum())
            {
                return(true);
            }
            break;

        case (int)EM_SPELL_CONDITION_TYPE.EM_SPELL_CONDITION_TYPE_LESSPERCENT:
            if ((FightControler.Inst.GetPowerValue(value.GetGroupType()) / ObjectSelf.GetInstance().GetMaxPowerValue()) <= (m_pTableRowSpell.getRpConditionNum() / 100))
            {
                return(true);
            }
            break;

        case (int)EM_SPELL_CONDITION_TYPE.EM_SPELL_CONDITION_TYPE_MOREPERCENT:
            if ((FightControler.Inst.GetPowerValue(value.GetGroupType()) / ObjectSelf.GetInstance().GetMaxPowerValue()) >= (m_pTableRowSpell.getRpConditionNum() / 100))
            {
                return(true);
            }
            break;
        }
        return(false);
    }
Esempio n. 7
0
    /// <summary>
    /// 查找是否有该目标
    /// </summary>
    /// <param name="obj"></param>
    public void onSingleTargetFind(ObjectCreature obj)
    {
        EM_OBJECT_TYPE type = obj.GetGroupType();

        if ((mSkillTargetStruct.isForSelf && type == EM_OBJECT_TYPE.EM_OBJECT_TYPE_HERO) ||
            (!mSkillTargetStruct.isForSelf && type != EM_OBJECT_TYPE.EM_OBJECT_TYPE_HERO))
        {
            onRequestReleaseSkill(obj);
            // 找到目标
            mTouchControl.ChangeTouchState(TouchState.FireSign_state);
        }
    }
Esempio n. 8
0
        public bool onSingleTargetFind(ObjectCreature obj)
        {
            EM_OBJECT_TYPE type = obj.GetGroupType();

            if ((mSkillTargetStruct.isForSelf && type == EM_OBJECT_TYPE.EM_OBJECT_TYPE_HERO) ||
                (!mSkillTargetStruct.isForSelf && type != EM_OBJECT_TYPE.EM_OBJECT_TYPE_HERO))
            {
                //不能选择自己 &&  选择的目标是自己
                if (!mSkillTargetStruct.isMyEff && obj.GetGuid().GUID_value == mSkillTargetStruct.mSelctRoleUID.GUID_value)
                {
                    return(false);
                }

                onRequestReleaseSkill(obj);
                return(true);
            }

            return(false);
        }
Esempio n. 9
0
        private void onMissCall(GameEvent e)
        {
            ObjectCreature obj   = (ObjectCreature)e.data;
            Transform      trans = null;

            if (obj != null)
            {
                if (obj.GetGroupType() == EM_OBJECT_TYPE.EM_OBJECT_TYPE_HERO)
                {
                    // hero
                    trans = ((ObjectHero)obj).GetAnimation().EventControl.Pre_Head_T_EffectPoint;
                }
                else
                {
                    trans = ((ObjectMonster)obj).GetAnimation().EventControl.Pre_Head_T_EffectPoint;
                }
                if (trans != null)
                {
                    mNumberMgr.showNumber(0, HPNumberType.HP_MISS, trans.position);
                }
            }
        }
Esempio n. 10
0
        //判断AI逻辑是否满足
        public bool IsAILogicReady()
        {
            if (m_ReleaseObj.GetGroupType() == EM_OBJECT_TYPE.EM_OBJECT_TYPE_HERO)
            {
                m_Oneself.Clear();
                m_Enemy.Clear();
                int count = SceneObjectManager.GetInstance().GetObjectHeroCount();
                for (int i = 0; i < count; ++i)
                {
                    m_Oneself.Add(SceneObjectManager.GetInstance().GetSceneHeroList()[i]);
                }
                int count2 = SceneObjectManager.GetInstance().GetObjectMonsterCount();
                for (int i = 0; i < count2; ++i)
                {
                    m_Enemy.Add(SceneObjectManager.GetInstance().GetSceneMonsterList()[i]);
                }
            }
            else if (m_ReleaseObj.GetGroupType() == EM_OBJECT_TYPE.EM_OBJECT_TYPE_MONSTER)
            {
                m_Oneself.Clear();
                m_Enemy.Clear();
                int count = SceneObjectManager.GetInstance().GetObjectHeroCount();
                for (int i = 0; i < count; ++i)
                {
                    m_Enemy.Add(SceneObjectManager.GetInstance().GetSceneHeroList()[i]);
                }
                int count2 = SceneObjectManager.GetInstance().GetObjectMonsterCount();
                for (int i = 0; i < count2; ++i)
                {
                    m_Oneself.Add(SceneObjectManager.GetInstance().GetSceneMonsterList()[i]);
                }
            }

            if (IsLogicReady(m_Tempai.getCondition1(), m_Tempai.getParam1()) && IsLogicReady(m_Tempai.getCondition2(), m_Tempai.getParam2()) && IsLogicReady(m_Tempai.getCondition3(), m_Tempai.getParam3()) &&
                IsLogicReady(m_Tempai.getCondition4(), m_Tempai.getParam4()) && IsLogicReady(m_Tempai.getCondition5(), m_Tempai.getParam5()))
            {
                // Debug.Log(m_ReleaseObj.GetGameObject().name+"条件满足~~~~~~~~~~~~~~~~~~~~~~~~");
                OnChooseSkillTarget();
                return(true);
            }
            return(false);
        }