/// <summary> /// 技能行为圆桌算法 /// </summary> /// <param name="pTarget">技能目标</param> /// <param name="nResult">返回结果</param> private void OnRoundTableOperation(ObjectCreature pTarget, ref EM_SPELL_RESULT nResult) { int nAttackAttributeCritical = m_pHolder.GetBaseCritical() + m_pHolder.GetDevelopAttributeSub((int)EM_EXTEND_ATTRIBUTE.EM_EXTEND_ATTRIBUTE_PERMIL_CRITICALRATE); //攻击者暴击率 [10/15/2015 Zmy] int nTargetAttributeTenacity = pTarget.GetBaseTenacity() + pTarget.GetDevelopAttributeSub((int)EM_EXTEND_ATTRIBUTE.EM_EXTEND_ATTRIBUTE_PERMIL_TENACITYRATE); //目标韧性率 [10/15/2015 Zmy] int nAttributeCritical = Math.Min((int)DataTemplate.GetInstance().m_GameConfig.getMax_crit_limit(), nAttackAttributeCritical - nTargetAttributeTenacity); //属性暴击率 // 最终暴击率 = 攻击者属性暴击率+攻击者(技能附带)暴击率+攻击者暴击率buff-目标韧性率buff [10/15/2015 Zmy] int nFinalCritical = nAttributeCritical + m_pSpellInfo.GetSpellRow().getSkillCrit() + m_pHolder.GetSpellAttibute((int)EM_EXTEND_ATTRIBUTE.EM_EXTEND_ATTRIBUTE_PERMIL_CRITICALRATE) - pTarget.GetSpellAttibute((int)EM_EXTEND_ATTRIBUTE.EM_EXTEND_ATTRIBUTE_PERMIL_TENACITYRATE); //修正最终暴击率 if (nFinalCritical <= 0) { nFinalCritical = 0; } else { nFinalCritical *= 10; } if (nFinalCritical >= 10000) //暴击达到上限,直接得出结果 [10/16/2015 Zmy] { nResult = EM_SPELL_RESULT.EM_SPELL_RESULT_CRITICAL; return; } int nAttackAttriHit = m_pHolder.GetBaseHit() + m_pHolder.GetDevelopAttributeSub((int)EM_EXTEND_ATTRIBUTE.EM_EXTEND_ATTRIBUTE_PERMIL_HITRATE); //攻击者命中率 [10/15/2015 Zmy] int nTargetAttriDodge = pTarget.GetBaseDodge() + pTarget.GetDevelopAttributeSub((int)EM_EXTEND_ATTRIBUTE.EM_EXTEND_ATTRIBUTE_PERMIL_DODGERATE); //目标闪避率 [10/15/2015 Zmy] int nAttributeDodge = Math.Min((int)DataTemplate.GetInstance().m_GameConfig.getMax_hiding_limit(), nTargetAttriDodge - nAttackAttriHit); //目标属性闪避率 // 目标最终闪避率=目标属性闪避率-攻击方(技能附带)命中率+目标闪避率buff-攻击方命中率buff+固定未命中几率 [10/15/2015 Zmy] int nFinalDodge = nAttributeDodge - m_pSpellInfo.GetSpellRow().getSkillHit() + pTarget.GetSpellAttibute((int)EM_EXTEND_ATTRIBUTE.EM_EXTEND_ATTRIBUTE_PERMIL_DODGERATE) - m_pHolder.GetSpellAttibute((int)EM_EXTEND_ATTRIBUTE.EM_EXTEND_ATTRIBUTE_PERMIL_HITRATE) + (int)DataTemplate.GetInstance().m_GameConfig.getFix_nothit_value(); if (nFinalDodge <= 0) { nFinalDodge = 0; } else { nFinalDodge = (nFinalDodge * 10) > (10000 - nFinalCritical) ? (10000 - nFinalCritical) : (nFinalDodge * 10); //修正剩余闪避概率区间 [10/16/2015 Zmy] } //生成随机种子 [10/15/2015 Zmy] int iRnd = System.DateTime.Now.Millisecond; System.Random randomCoor = new System.Random(iRnd); int nRand = randomCoor.Next(1, 10000); if (nRand > 0 && nRand <= nFinalCritical)//暴击区间 { nResult = EM_SPELL_RESULT.EM_SPELL_RESULT_CRITICAL; } else if (nRand <= nFinalDodge + nFinalCritical)//闪避区间 { nResult = EM_SPELL_RESULT.EM_SPELL_RESULT_MISS; } else//普通命中 { nResult = EM_SPELL_RESULT.EM_SPELL_RESULT_NORMAL; } }