Ejemplo n.º 1
0
    /// <summary>
    /// 攻击
    /// 防御
    /// 生命
    /// 命中率
    /// 闪避率
    /// 暴击率
    /// 韧性率
    /// 格挡率
    /// 破甲率
    /// 伤害加成率
    /// 伤害减免率
    /// 暴击伤害率
    /// </summary>
    /// <param name="heroData"></param>
    public void SetData(ObjectCreature creature)
    {
        m_AText1.text  = GameUtils.getString("attribute1name");
        m_AText2.text  = GameUtils.getString("attribute2name");
        m_AText3.text  = GameUtils.getString("attribute3name");
        m_AText4.text  = GameUtils.getString("attribute4name");
        m_AText5.text  = GameUtils.getString("attribute5name");
        m_AText6.text  = GameUtils.getString("attribute6name");
        m_AText7.text  = GameUtils.getString("attribute7name");
        m_AText8.text  = GameUtils.getString("attribute8name");
        m_AText9.text  = GameUtils.getString("attribute9name");
        m_AText10.text = GameUtils.getString("attribute10name");
        m_AText11.text = GameUtils.getString("attribute11name");
        m_AText12.text = GameUtils.getString("attribute12name");

        m_BText1.text  = GameUtils.getString("attribute1name");
        m_BText2.text  = GameUtils.getString("attribute2name");
        m_BText3.text  = GameUtils.getString("attribute3name");
        m_BText4.text  = GameUtils.getString("attribute4name");
        m_BText5.text  = GameUtils.getString("attribute5name");
        m_BText6.text  = GameUtils.getString("attribute6name");
        m_BText7.text  = GameUtils.getString("attribute7name");
        m_BText8.text  = GameUtils.getString("attribute8name");
        m_BText9.text  = GameUtils.getString("attribute9name");
        m_BText10.text = GameUtils.getString("attribute10name");
        m_BText11.text = GameUtils.getString("attribute11name");
        m_BText12.text = GameUtils.getString("attribute12name");

        m_AValue1.text  = creature.GetPhysicalAttack().ToString();
        m_AValue2.text  = creature.GetPhysicalDefence().ToString();
        m_AValue3.text  = creature.GetMaxHP().ToString();
        m_AValue4.text  = creature.GetHit().ToString();
        m_AValue5.text  = creature.GetDodge().ToString();
        m_AValue6.text  = creature.GetCritical().ToString();
        m_AValue7.text  = creature.GetTenacity().ToString();
        m_AValue8.text  = creature.GetBlockRate().ToString();
        m_AValue9.text  = creature.GetPierceRate().ToString();
        m_AValue10.text = creature.GetHurtAddRate().ToString();
        m_AValue11.text = creature.GetHurtReduceRate().ToString();
        m_AValue12.text = creature.GetCriticalHurtRate().ToString();

        m_BValue1.text  = GameUtils.getString("attribute1des");
        m_BValue2.text  = GameUtils.getString("attribute2des");
        m_BValue3.text  = GameUtils.getString("attribute3des");
        m_BValue4.text  = GameUtils.getString("attribute4des");
        m_BValue5.text  = GameUtils.getString("attribute5des");
        m_BValue6.text  = GameUtils.getString("attribute6des");
        m_BValue7.text  = GameUtils.getString("attribute7des");
        m_BValue8.text  = GameUtils.getString("attribute8des");
        m_BValue9.text  = GameUtils.getString("attribute9des");
        m_BValue10.text = GameUtils.getString("attribute10des");
        m_BValue11.text = GameUtils.getString("attribute11des");
        m_BValue12.text = GameUtils.getString("attribute12des");
    }
Ejemplo n.º 2
0
        public bool __CriticalAttack(ObjectCreature pTarget)
        {
            LogManager.LogAssert(m_pHolder);
            LogManager.LogAssert(m_pSpellInfo);

            /*一次攻击行为的暴击判定率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.getCritical_X();
            float nParama = DataTemplate.GetInstance().m_GameConfig.getCritical_a();
            float nParamb = DataTemplate.GetInstance().m_GameConfig.getCritical_b();
            float nParamc = DataTemplate.GetInstance().m_GameConfig.getCritical_c();
            float nParamk = DataTemplate.GetInstance().m_GameConfig.getCritical_k();
            float nParamp = DataTemplate.GetInstance().m_GameConfig.getCritical_p();

            double fParam = (m_pHolder.GetCritical() + nParamX) / (pTarget.GetTenacity() + nParamX);

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

            fHit = Math.Min((int)(DataTemplate.GetInstance().m_GameConfig.getCritical_max() * 10000f), fHit);
            //System.Random ran = new System.Random();
            //int nRand = ran.Next(1, 10000);

            int iRnd = System.DateTime.Now.Millisecond;

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

            if (nRand <= fHit)
            {
                return(true);
            }
            return(false);
        }