/// <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"); }
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); }