Advertisement
MOVZX

Mobius FF Damage Calculation

Oct 1st, 2018
496
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 71.05 KB | None | 0 0
  1.         public static void CalcDamage(ref BattleDamage.DamageInfo damageInfo, BattleActor owner, BattleActor target, C9834a30e5f3368ef11b898eb90b12c5b.C03df96e967d7177ede70d5c100f08e3c damageSourceElem, bool isRandMinTest, bool isNoCriticalCalc, bool isCritical, int powerPercent)
  2.         {
  3.             if (damageSourceElem == null)
  4.             {
  5.                 return;
  6.             }
  7.             if (Mevius.App.Api.IsPartyMode() && (int)damageSourceElem.m99d4196c8ddc2c84aa2a035182a3e754() == 0 && damageSourceElem.m2a2088e5423c9ed60aaf8024bb799763() == 0)
  8.             {
  9.                 Ceaf68fb2356fb8b84facc86d2fe79f0e.Cca912973d2eb55c3b74a5c95a6475670 cca912973d2eb55c3b74a5c95a = Ceaf68fb2356fb8b84facc86d2fe79f0e.Find(owner.AbilityId);
  10.                 if (cca912973d2eb55c3b74a5c95a != null && ((int)cca912973d2eb55c3b74a5c95a.m84e50dafe5698576f43e0b3aeaf1b9f3() == 3 || (int)cca912973d2eb55c3b74a5c95a.m5aa5f8aa3146e23239a6f9658f17b054() == 3))
  11.                 {
  12.                     return;
  13.                 }
  14.             }
  15.             damageInfo = new BattleDamage.DamageInfo();
  16.             bool flag = owner.AbilityId == owner.JobAbilityId;
  17.             int num = 0;
  18.             int num2 = 0;
  19.             int num3 = 0;
  20.             float num4 = 1f;
  21.             bool flag2 = false;
  22.             bool flag3 = false;
  23.             BattleActor battleActor = owner;
  24.             BattleActor battleActor2 = target;
  25.             if (BattleManager._i.IsSubAction())
  26.             {
  27.                 if (BattleManager._i.GetPlayerActorSub() == owner)
  28.                 {
  29.                     battleActor = BattleManager._i.GetPlayerActor();
  30.                 }
  31.                 if (BattleManager._i.GetPlayerActorSub() == target)
  32.                 {
  33.                     battleActor2 = BattleManager._i.GetPlayerActor();
  34.                 }
  35.             }
  36.             int num5 = damageSourceElem.m2a2088e5423c9ed60aaf8024bb799763();
  37.             if ((int)damageSourceElem.ma32fcd1fe2598c2edcfa5cdbeb0eb64f() != 23)
  38.             {
  39.                 if ((int)damageSourceElem.m99d4196c8ddc2c84aa2a035182a3e754() == 1 && num5 > 0)
  40.                 {
  41.                     int useCardAbilitySkillNum = owner.GetUseCardAbilitySkillNum(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5401);
  42.                     if (useCardAbilitySkillNum > 0)
  43.                     {
  44.                         num5 += Mevius.DataSheet.Api.GetResidentInteger("abilitySkill14", 50) * useCardAbilitySkillNum;
  45.                     }
  46.                 }
  47.                 num5 = (int)((float)(num5 * powerPercent) * 0.01f + 0.5f);
  48.             }
  49.             if ((int)damageSourceElem.m99d4196c8ddc2c84aa2a035182a3e754() == 71 || (int)damageSourceElem.m99d4196c8ddc2c84aa2a035182a3e754() == 72)
  50.             {
  51.                 if ((int)damageSourceElem.ma32fcd1fe2598c2edcfa5cdbeb0eb64f() == 29)
  52.                 {
  53.                     num3 = (int)((float)owner.BpMax / 100f * (float)num5 + 0.5f);
  54.                 }
  55.                 else if ((int)damageSourceElem.ma32fcd1fe2598c2edcfa5cdbeb0eb64f() == 30)
  56.                 {
  57.                     num3 = (int)((float)target.BpMax / 100f * (float)num5 + 0.5f);
  58.                 }
  59.                 else if ((int)damageSourceElem.ma32fcd1fe2598c2edcfa5cdbeb0eb64f() == 31)
  60.                 {
  61.                     num3 = (int)((float)target.Bp / 100f * (float)num5 + 0.5f);
  62.                 }
  63.                 flag2 = true;
  64.             }
  65.             else if (owner.IsPlayer() && (int)damageSourceElem.m99d4196c8ddc2c84aa2a035182a3e754() == 50)
  66.             {
  67.                 num = BattleUtility.GetPadAttackDamage(owner);
  68.                 flag2 = true;
  69.             }
  70.             else if ((int)damageSourceElem.ma32fcd1fe2598c2edcfa5cdbeb0eb64f() == 3)
  71.             {
  72.                 num = num5;
  73.                 num3 = (int)damageSourceElem.med3b109a0c7b9aaffc8f700ad530010f();
  74.                 flag2 = true;
  75.                 flag3 = true;
  76.             }
  77.             else if ((int)damageSourceElem.ma32fcd1fe2598c2edcfa5cdbeb0eb64f() == 7)
  78.             {
  79.                 num = target.Hp;
  80.                 flag2 = true;
  81.                 flag3 = true;
  82.             }
  83.             else if ((int)damageSourceElem.ma32fcd1fe2598c2edcfa5cdbeb0eb64f() == 28)
  84.             {
  85.                 num = target.Hp;
  86.                 flag2 = true;
  87.                 flag3 = true;
  88.                 damageInfo.ignorePerfectDefence = true;
  89.             }
  90.             else if ((int)damageSourceElem.ma32fcd1fe2598c2edcfa5cdbeb0eb64f() == 23)
  91.             {
  92.                 if ((int)damageSourceElem.m99d4196c8ddc2c84aa2a035182a3e754() == 1)
  93.                 {
  94.                     num = num5 - target.Hp;
  95.                 }
  96.                 else
  97.                 {
  98.                     num = target.Hp - num5;
  99.                 }
  100.                 if (num < 0)
  101.                 {
  102.                     num = 0;
  103.                 }
  104.                 flag2 = true;
  105.                 flag3 = true;
  106.             }
  107.             else if (owner.IsPlayer() && (int)damageSourceElem.ma32fcd1fe2598c2edcfa5cdbeb0eb64f() == 1)
  108.             {
  109.                 int num6 = 0;
  110.                 if (Mevius.App.Api.IsPartyMode())
  111.                 {
  112.                     int[] partyParameterType = Mevius.Party.Api.GetPartyParameterType();
  113.                     num6 = partyParameterType[owner.PartySlot];
  114.                 }
  115.                 else if (owner.IsPlayerSub())
  116.                 {
  117.                     num6 = 1000;
  118.                 }
  119.                 int abilityAttackUpValue = owner.GetAbilityAttackUpValue();
  120.                 float num7 = 1f;
  121.                 if (abilityAttackUpValue != 0)
  122.                 {
  123.                     num7 += (float)abilityAttackUpValue / 100f;
  124.                 }
  125.                 bool flag4 = false;
  126.                 if (!flag && owner.NormalAttackNum == 0 && !owner.AbilityJobMatch)
  127.                 {
  128.                     flag4 = true;
  129.                 }
  130.                 int num8;
  131.                 if (flag4)
  132.                 {
  133.                     num8 = 100;
  134.                     num8 += BattleUtility.GetFF7IndependenceAbilityValue(IndependenceAbility.PowerUp);
  135.                 }
  136.                 else
  137.                 {
  138.                     num8 = Mevius.Db.Api.GetParameter(DbManager.ParameterType.Power + num6);
  139.                 }
  140.                 int num9;
  141.                 if (BattleUtility.GetOptimaAbilityValue(2, out num9))
  142.                 {
  143.                     num8 += num9;
  144.                 }
  145.                 if (owner.IsUseCardAbilitySkill(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5506))
  146.                 {
  147.                     num8 = (int)((float)(num8 * Mevius.DataSheet.Api.GetResidentInteger("abilitySkill5506_0", 50)) * 0.01f + 0.5f);
  148.                 }
  149.                 num = (int)((float)num8 * num7 * ((float)num5 / 100f) + 0.5f);
  150.                 num2 = Mevius.Db.Api.GetParameter(DbManager.ParameterType.CriticalValue + num6) + (int)damageSourceElem.m31a2bc12a6fb70b72bfab3e85b658b3e();
  151.                 int num10;
  152.                 if (flag4)
  153.                 {
  154.                     num10 = 100;
  155.                     num10 += BattleUtility.GetFF7IndependenceAbilityValue(IndependenceAbility.PierceUp);
  156.                 }
  157.                 else
  158.                 {
  159.                     num10 = Mevius.Db.Api.GetParameter(DbManager.ParameterType.Pierce + num6);
  160.                 }
  161.                 if (BattleUtility.GetOptimaAbilityValue(3, out num9))
  162.                 {
  163.                     num10 += num9;
  164.                 }
  165.                 if (owner.IsUseCardAbilitySkill(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5506))
  166.                 {
  167.                     num10 = (int)((float)(num10 * Mevius.DataSheet.Api.GetResidentInteger("abilitySkill5506_0", 50)) * 0.01f + 0.5f);
  168.                 }
  169.                 int num11;
  170.                 if (owner.GetAutoAbilityParam(DbManager.AutoAbilityType.AUTOABILITYTYPE_CS1461, out num11))
  171.                 {
  172.                     int residentInteger = Mevius.DataSheet.Api.GetResidentInteger("autoAbility1461_1", 0);
  173.                     int num12 = owner.ActionNum + BattleManager._i.GetZoneActionNum();
  174.                     if (residentInteger <= num12)
  175.                     {
  176.                         int residentInteger2 = Mevius.DataSheet.Api.GetResidentInteger("autoAbility1461_2", 15);
  177.                         num12 = Math.Min(num12, residentInteger2);
  178.                         int num13 = residentInteger - num12;
  179.                         int num14 = residentInteger2 - residentInteger;
  180.                         int residentInteger3 = Mevius.DataSheet.Api.GetResidentInteger("autoAbility1461_0", 100);
  181.                         if (residentInteger3 < num11)
  182.                         {
  183.                             num11 = residentInteger3;
  184.                         }
  185.                         num10 += (int)((float)(num10 * num11) / 100f * (float)num13 * (float)num13 / (float)num14 / (float)num14 + 0.5f);
  186.                     }
  187.                 }
  188.                 num3 = (int)((float)num10 * num7 * ((float)damageSourceElem.med3b109a0c7b9aaffc8f700ad530010f() / 100f) + 0.5f);
  189.                 if (Mevius.App.Api.IsPartyMode() && owner.IsPlayer() && !flag4)
  190.                 {
  191.                     ElementAttributeType useCardAbilityAttribute = owner.GetUseCardAbilityAttribute();
  192.                     if (useCardAbilityAttribute != ElementAttributeType.None)
  193.                     {
  194.                         int chainCommand = (int)Mevius.Party.Api.GetChainCommand(2, (int)useCardAbilityAttribute);
  195.                         float[] chainBonus = Mevius.Party.Api.GetChainBonus();
  196.                         num = (int)((float)num * chainBonus[chainCommand - 1] + 0.5f);
  197.                         num3 = (int)((float)num3 * chainBonus[chainCommand - 1] + 0.5f);
  198.                     }
  199.                 }
  200.             }
  201.             else if ((int)damageSourceElem.ma32fcd1fe2598c2edcfa5cdbeb0eb64f() == 8)
  202.             {
  203.                 num = (int)((float)target.HpMax / 100f * (float)num5 + 0.5f);
  204.                 num3 = (int)damageSourceElem.med3b109a0c7b9aaffc8f700ad530010f();
  205.                 flag2 = true;
  206.                 flag3 = owner.IsEnemy();
  207.             }
  208.             else if ((int)damageSourceElem.ma32fcd1fe2598c2edcfa5cdbeb0eb64f() == 9)
  209.             {
  210.                 num = (int)((float)target.Hp / 100f * (float)num5 + 0.5f);
  211.                 num3 = (int)damageSourceElem.med3b109a0c7b9aaffc8f700ad530010f();
  212.                 flag2 = true;
  213.                 flag3 = owner.IsEnemy();
  214.             }
  215.             else if ((int)damageSourceElem.ma32fcd1fe2598c2edcfa5cdbeb0eb64f() == 25)
  216.             {
  217.                 num = (int)((float)owner.HpMax / 100f * (float)num5 + 0.5f);
  218.                 num3 = (int)damageSourceElem.med3b109a0c7b9aaffc8f700ad530010f();
  219.                 flag2 = true;
  220.                 flag3 = owner.IsEnemy();
  221.             }
  222.             else if ((int)damageSourceElem.ma32fcd1fe2598c2edcfa5cdbeb0eb64f() == 26)
  223.             {
  224.                 num = (int)((float)owner.Hp / 100f * (float)num5 + 0.5f);
  225.                 num3 = (int)damageSourceElem.med3b109a0c7b9aaffc8f700ad530010f();
  226.                 flag2 = true;
  227.                 flag3 = owner.IsEnemy();
  228.             }
  229.             else
  230.             {
  231.                 if ((int)damageSourceElem.ma32fcd1fe2598c2edcfa5cdbeb0eb64f() == 2)
  232.                 {
  233.                     num = (int)((float)target.HpMax / 100f * (float)num5 + 0.5f);
  234.                     flag3 = owner.IsEnemy();
  235.                 }
  236.                 else if ((int)damageSourceElem.ma32fcd1fe2598c2edcfa5cdbeb0eb64f() == 4)
  237.                 {
  238.                     num = (int)((float)owner.HpMax / 100f * (float)num5 + 0.5f);
  239.                     flag3 = owner.IsEnemy();
  240.                 }
  241.                 else if ((int)damageSourceElem.ma32fcd1fe2598c2edcfa5cdbeb0eb64f() == 5)
  242.                 {
  243.                     num = (int)((float)target.Hp / 100f * (float)num5 + 0.5f);
  244.                     flag3 = owner.IsEnemy();
  245.                 }
  246.                 else if ((int)damageSourceElem.ma32fcd1fe2598c2edcfa5cdbeb0eb64f() == 6)
  247.                 {
  248.                     num = (int)((float)owner.Hp / 100f * (float)num5 + 0.5f);
  249.                     flag3 = owner.IsEnemy();
  250.                 }
  251.                 else
  252.                 {
  253.                     if ((int)damageSourceElem.m99d4196c8ddc2c84aa2a035182a3e754() == 25)
  254.                     {
  255.                         num5 *= battleActor2.GetManaElementNum();
  256.                     }
  257.                     else if (26 <= (int)damageSourceElem.m99d4196c8ddc2c84aa2a035182a3e754() && (int)damageSourceElem.m99d4196c8ddc2c84aa2a035182a3e754() <= 31)
  258.                     {
  259.                         num5 *= battleActor2.GetManaElementNums()[(int)damageSourceElem.m99d4196c8ddc2c84aa2a035182a3e754() - 26];
  260.                     }
  261.                     if (owner.IsPlayer())
  262.                     {
  263.                         num = num5;
  264.                         num3 = (int)damageSourceElem.med3b109a0c7b9aaffc8f700ad530010f();
  265.                         if (owner.AbilityJobMatch)
  266.                         {
  267.                             int num15 = 0;
  268.                             if (Mevius.App.Api.IsPartyMode())
  269.                             {
  270.                                 int[] partyParameterType2 = Mevius.Party.Api.GetPartyParameterType();
  271.                                 num15 = partyParameterType2[owner.PartySlot];
  272.                             }
  273.                             else if (owner.IsPlayerSub())
  274.                             {
  275.                                 num15 = 1000;
  276.                             }
  277.                             num2 += Mevius.Db.Api.GetParameter(DbManager.ParameterType.CriticalValue + num15);
  278.                             int num16 = Mevius.Db.Api.GetParameter(DbManager.ParameterType.Link + num15);
  279.                             int num17;
  280.                             if (BattleUtility.GetOptimaAbilityValue(4, out num17))
  281.                             {
  282.                                 num16 += num17;
  283.                             }
  284.                             if (owner.IsUseCardAbilitySkill(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5179))
  285.                             {
  286.                                 float num18 = (float)Mevius.DataSheet.Api.GetResidentInteger("abilitySkill5179_0", 50) / 100f;
  287.                                 if (Mevius.App.Api.IsPartyMode() || BattleManager._i.GetPlayerActorSub() == null)
  288.                                 {
  289.                                     num16 += (int)((float)num16 * num18 + 0.5f);
  290.                                 }
  291.                                 else
  292.                                 {
  293.                                     int num19 = 0;
  294.                                     if (BattleManager._i.GetPlayerActorSub().IsPlayerSub())
  295.                                     {
  296.                                         num19 += 1000;
  297.                                     }
  298.                                     int parameter = Mevius.Db.Api.GetParameter(DbManager.ParameterType.Link + num19);
  299.                                     num16 += (int)((float)parameter * num18 + 0.5f);
  300.                                 }
  301.                             }
  302.                             num4 = 1f + (float)num16 * 0.01f;
  303.                             int abilityAttackUpValue2 = owner.GetAbilityAttackUpValue();
  304.                             if (abilityAttackUpValue2 != 0)
  305.                             {
  306.                                 num4 *= 1f + (float)abilityAttackUpValue2 / 100f;
  307.                             }
  308.                             num4 *= 1f + (float)owner.GetStatusEffectValue(BattleStatusEffect.ProcType.Synchro) * 0.01f;
  309.                             if (num4 < 1f)
  310.                             {
  311.                                 num4 = 1f;
  312.                             }
  313.                             int val = 0;
  314.                             owner.GetAutoAbilityParam(DbManager.AutoAbilityType.AUTOABILITYTYPE_CS1258, out val);
  315.                             int val2 = 0;
  316.                             if (owner.IsUseCardAbilitySkill(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5166))
  317.                             {
  318.                                 val2 = 100;
  319.                             }
  320.                             int num20 = Math.Max(val, val2);
  321.                             if (num20 != 0)
  322.                             {
  323.                                 float num21 = (float)Mevius.DataSheet.Api.GetResidentInteger("abilitySkill5166_0", 3);
  324.                                 float num22 = (float)Mevius.DataSheet.Api.GetResidentInteger("abilitySkill5166_1", 3);
  325.                                 float residentFloat = Mevius.DataSheet.Api.GetResidentFloat("abilitySkill5166_2", 1f);
  326.                                 float num23 = 0f;
  327.                                 int num24 = Mevius.DataSheet.Api.GetResidentInteger("abilitySkill5166_3", 3);
  328.                                 if (num24 < 0)
  329.                                 {
  330.                                     num24 = 0;
  331.                                 }
  332.                                 else if (num24 > 3)
  333.                                 {
  334.                                     num24 = 3;
  335.                                 }
  336.                                 for (int i = 0; i < num24; i++)
  337.                                 {
  338.                                     num23 += (float)owner.RevengeDamages[i];
  339.                                 }
  340.                                 if (num23 > num21)
  341.                                 {
  342.                                     num23 = num21;
  343.                                 }
  344.                                 float num25 = (num22 - num21 * residentFloat) * 0.5f;
  345.                                 float f = 3.14159274f * ((num23 - num21) / num21);
  346.                                 float num26 = Mathf.Cos(f) + 1f;
  347.                                 float num27 = Mathf.Sqrt(num23 / num21);
  348.                                 float num28 = num23 * residentFloat;
  349.                                 int num29 = (int)((num25 * num26 * num27 + num28) * ((float)num20 * 0.01f) + 0.5f);
  350.                                 num4 += (float)num29 * 0.01f;
  351.                             }
  352.                             if (owner.IsUseCardAbilitySkill(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5184))
  353.                             {
  354.                                 int num30 = Mevius.Db.Api.GetParameter(DbManager.ParameterType.Power + num15);
  355.                                 int num31 = owner.GetAbilityAttackUpValue();
  356.                                 num31 += owner.GetStatusEffectValue(BattleStatusEffect.ProcType.BraveDamage);
  357.                                 num30 = (int)((float)num30 * (1f + (float)num31 / 100f) + 0.5f);
  358.                                 num4 += (float)((int)((float)(num30 * Mevius.DataSheet.Api.GetResidentInteger("abilitySkill5184_0", 50)) / 100f / 100f + 0.5f));
  359.                             }
  360.                         }
  361.                         if (Mevius.App.Api.IsPartyMode() && owner.IsPlayer())
  362.                         {
  363.                             ElementAttributeType useCardAbilityAttribute2 = owner.GetUseCardAbilityAttribute();
  364.                             if (useCardAbilityAttribute2 != ElementAttributeType.None)
  365.                             {
  366.                                 int chainCommand2 = (int)Mevius.Party.Api.GetChainCommand(2, (int)useCardAbilityAttribute2);
  367.                                 float[] chainBonus2 = Mevius.Party.Api.GetChainBonus();
  368.                                 num = (int)((float)num * chainBonus2[chainCommand2 - 1] + 0.5f);
  369.                                 num3 = (int)((float)num3 * chainBonus2[chainCommand2 - 1] + 0.5f);
  370.                             }
  371.                         }
  372.                     }
  373.                     else
  374.                     {
  375.                         num = (int)((float)owner.Power * ((float)num5 / 100f) + 0.5f);
  376.                     }
  377.                 }
  378.                 num2 += (int)damageSourceElem.m31a2bc12a6fb70b72bfab3e85b658b3e();
  379.             }
  380.             if (target.IsStatusEffectEntry(BattleStatusEffect.ProcType.BreakDisable))
  381.             {
  382.                 num3 = 0;
  383.             }
  384.             bool flag5 = false;
  385.             bool flag6 = false;
  386.             bool flag7 = false;
  387.             bool flag8 = false;
  388.             bool isEnhance = false;
  389.             bool isReduce = false;
  390.             int num32;
  391.             if (flag2)
  392.             {
  393.                 num32 = num;
  394.                 ElementAttributeBitType absorbAttributeBit = (ElementAttributeBitType)target.AbsorbAttributeBit;
  395.                 if ((absorbAttributeBit & ElementAttributeBitType.Normal) != ElementAttributeBitType.None)
  396.                 {
  397.                     flag8 = true;
  398.                     num3 = 0;
  399.                 }
  400.                 isCritical = false;
  401.             }
  402.             else
  403.             {
  404.                 float num33 = 1f;
  405.                 float num34 = 1f;
  406.                 float num35 = 1f;
  407.                 float num36 = 1f;
  408.                 float num37 = 1f;
  409.                 float num38 = 1f;
  410.                 int num39 = 0;
  411.                 int num40 = 0;
  412.                 int num41 = 0;
  413.                 int num42 = 0;
  414.                 int num43 = 0;
  415.                 int num44 = 0;
  416.                 int num45 = 0;
  417.                 int num46 = 0;
  418.                 float num47 = 1f;
  419.                 int num48 = 0;
  420.                 int num49 = 0;
  421.                 int num50 = 0;
  422.                 ElementAttributeBitType elementAttributeBit = (ElementAttributeBitType)target.GetElementAttributeBit();
  423.                 ElementAttributeBitType absorbAttributeBit2 = (ElementAttributeBitType)target.AbsorbAttributeBit;
  424.                 ElementAttributeBitType weakAttributeBit = (ElementAttributeBitType)target.WeakAttributeBit;
  425.                 int num51 = 0;
  426.                 ElementAttributeBitType elementAttributeBitType = ElementAttributeBitType.None;
  427.                 if ((int)damageSourceElem.mcdcc634daaa800ae30b0d9aa90d524cc() != 0)
  428.                 {
  429.                     elementAttributeBitType |= ElementAttributeBitType.Fire;
  430.                     num51++;
  431.                 }
  432.                 if ((int)damageSourceElem.m6374ec9bd9c83aa1592cd25bdd68315e() != 0)
  433.                 {
  434.                     if ((elementAttributeBitType & ElementAttributeBitType.Fire) == ElementAttributeBitType.None)
  435.                     {
  436.                         elementAttributeBitType |= ElementAttributeBitType.Water;
  437.                     }
  438.                     else
  439.                     {
  440.                         elementAttributeBitType &= (ElementAttributeBitType)(-2);
  441.                     }
  442.                     num51++;
  443.                 }
  444.                 if ((int)damageSourceElem.m1ff35aae1a721dffe2c7ec2dfb4c573e() != 0)
  445.                 {
  446.                     elementAttributeBitType |= ElementAttributeBitType.Wind;
  447.                     num51++;
  448.                 }
  449.                 if ((int)damageSourceElem.m957592ac75221a66cc4d1fa3831c59b8() != 0)
  450.                 {
  451.                     if ((elementAttributeBitType & ElementAttributeBitType.Wind) == ElementAttributeBitType.None)
  452.                     {
  453.                         elementAttributeBitType |= ElementAttributeBitType.Earth;
  454.                     }
  455.                     else
  456.                     {
  457.                         elementAttributeBitType &= (ElementAttributeBitType)(-5);
  458.                     }
  459.                     num51++;
  460.                 }
  461.                 if ((int)damageSourceElem.m4a78ffda98410f820411120ffcbc8045() != 0)
  462.                 {
  463.                     elementAttributeBitType |= ElementAttributeBitType.Light;
  464.                     num51++;
  465.                 }
  466.                 if ((int)damageSourceElem.m7b9ab26a81a7c308786cde1f6d7a628e() != 0)
  467.                 {
  468.                     if ((elementAttributeBitType & ElementAttributeBitType.Light) == ElementAttributeBitType.None)
  469.                     {
  470.                         elementAttributeBitType |= ElementAttributeBitType.Dark;
  471.                     }
  472.                     else
  473.                     {
  474.                         elementAttributeBitType &= (ElementAttributeBitType)(-17);
  475.                     }
  476.                     num51++;
  477.                 }
  478.                 if (num51 >= 3)
  479.                 {
  480.                     elementAttributeBitType = ElementAttributeBitType.None;
  481.                 }
  482.                 bool flag9 = false;
  483.                 if ((elementAttributeBitType == ElementAttributeBitType.None && owner.NormalAttackNum > 0) || (flag && owner.IsAutoAbility(DbManager.AutoAbilityType.AUTOABILITYTYPE_CS1455)))
  484.                 {
  485.                     if (owner.IsStatusEffectEntry(BattleStatusEffect.ProcType.EnchantFire))
  486.                     {
  487.                         elementAttributeBitType++;
  488.                         flag9 = true;
  489.                     }
  490.                     if (owner.IsStatusEffectEntry(BattleStatusEffect.ProcType.EnchantWater))
  491.                     {
  492.                         elementAttributeBitType += 2;
  493.                         flag9 = true;
  494.                     }
  495.                     if (owner.IsStatusEffectEntry(BattleStatusEffect.ProcType.EnchantWind))
  496.                     {
  497.                         elementAttributeBitType += 4;
  498.                         flag9 = true;
  499.                     }
  500.                     if (owner.IsStatusEffectEntry(BattleStatusEffect.ProcType.EnchantEarth))
  501.                     {
  502.                         elementAttributeBitType += 8;
  503.                         flag9 = true;
  504.                     }
  505.                     if (owner.IsStatusEffectEntry(BattleStatusEffect.ProcType.EnchantLight))
  506.                     {
  507.                         elementAttributeBitType += 16;
  508.                         flag9 = true;
  509.                     }
  510.                     if (owner.IsStatusEffectEntry(BattleStatusEffect.ProcType.EnchantDark))
  511.                     {
  512.                         elementAttributeBitType += 32;
  513.                         flag9 = true;
  514.                     }
  515.                 }
  516.                 damageInfo.elementAttributeBit = (int)elementAttributeBitType;
  517.                 if ((int)damageSourceElem.m056cb6b23e1a1553df9a90eb3f5f804b() != 0)
  518.                 {
  519.                     int num52 = owner.GetStatusEffectValue(BattleStatusEffect.ProcType.BraveDamage);
  520.                     int num53;
  521.                     if (flag9 && owner.GetAutoAbilityParam(DbManager.AutoAbilityType.AUTOABILITYTYPE_CS1456, out num53))
  522.                     {
  523.                         num52 += num53;
  524.                     }
  525.                     num33 *= 1f + (float)num52 * 0.01f;
  526.                     if (owner.IsEnemy())
  527.                     {
  528.                         if (num52 > 0)
  529.                         {
  530.                             isEnhance = true;
  531.                         }
  532.                         else if (num52 < 0)
  533.                         {
  534.                             isReduce = true;
  535.                         }
  536.                     }
  537.                 }
  538.                 else if (owner.IsEnemy() && (int)damageSourceElem.m99d4196c8ddc2c84aa2a035182a3e754() != 1)
  539.                 {
  540.                     int statusEffectValue = owner.GetStatusEffectValue(BattleStatusEffect.ProcType.Synchro);
  541.                     num33 *= 1f + (float)statusEffectValue * 0.01f;
  542.                     if (statusEffectValue > 0)
  543.                     {
  544.                         isEnhance = true;
  545.                     }
  546.                     else if (statusEffectValue < 0)
  547.                     {
  548.                         isReduce = true;
  549.                     }
  550.                 }
  551.                 if (target.IsBreakDamage() && (int)damageSourceElem.m99d4196c8ddc2c84aa2a035182a3e754() != 50)
  552.                 {
  553.                     flag5 = true;
  554.                     num34 *= Mevius.DataSheet.Api.GetResidentFloat("damageBreakRate", 2f);
  555.                 }
  556.                 float residentFloat2 = Mevius.DataSheet.Api.GetResidentFloat("damageSameAttributeRate", 0.5f);
  557.                 float residentFloat3 = Mevius.DataSheet.Api.GetResidentFloat("damageReverseAttributeRate", 2f);
  558.                 float residentFloat4 = Mevius.DataSheet.Api.GetResidentFloat("damageBreakReverseAttributeRate", 2f);
  559.                 bool flag10 = owner.IsUseCardAbilitySkill(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5176);
  560.                 bool flag11 = owner.IsUseCardAbilitySkill(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5177);
  561.                 if ((elementAttributeBitType & ElementAttributeBitType.Fire) != ElementAttributeBitType.None)
  562.                 {
  563.                     if ((absorbAttributeBit2 & ElementAttributeBitType.Fire) != ElementAttributeBitType.None)
  564.                     {
  565.                         flag8 = true;
  566.                         if (flag9)
  567.                         {
  568.                             damageInfo.removeEnchantAttributeBit++;
  569.                         }
  570.                         num3 = 0;
  571.                     }
  572.                     else if ((elementAttributeBit & ElementAttributeBitType.Fire) != ElementAttributeBitType.None && !flag10)
  573.                     {
  574.                         if (!flag8)
  575.                         {
  576.                             num36 *= residentFloat2;
  577.                             int useCardAbilitySkillNum2 = owner.GetUseCardAbilitySkillNum(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5003);
  578.                             if (useCardAbilitySkillNum2 > 0)
  579.                             {
  580.                                 num49 -= 100 - Mevius.DataSheet.Api.GetResidentInteger("abilitySkill1", 50) * useCardAbilitySkillNum2;
  581.                             }
  582.                             else
  583.                             {
  584.                                 num3 = 0;
  585.                             }
  586.                             flag6 = true;
  587.                             if (flag9)
  588.                             {
  589.                                 damageInfo.removeEnchantAttributeBit++;
  590.                             }
  591.                         }
  592.                     }
  593.                     else if ((weakAttributeBit & ElementAttributeBitType.Fire) != ElementAttributeBitType.None)
  594.                     {
  595.                         if (flag5)
  596.                         {
  597.                             num36 *= residentFloat4;
  598.                         }
  599.                         else
  600.                         {
  601.                             num36 *= residentFloat3;
  602.                             num37 *= residentFloat3;
  603.                         }
  604.                         flag7 = true;
  605.                     }
  606.                 }
  607.                 if ((elementAttributeBitType & ElementAttributeBitType.Water) != ElementAttributeBitType.None)
  608.                 {
  609.                     if ((absorbAttributeBit2 & ElementAttributeBitType.Water) != ElementAttributeBitType.None)
  610.                     {
  611.                         flag8 = true;
  612.                         if (flag9)
  613.                         {
  614.                             damageInfo.removeEnchantAttributeBit += 2;
  615.                         }
  616.                         num3 = 0;
  617.                     }
  618.                     else if ((elementAttributeBit & ElementAttributeBitType.Water) != ElementAttributeBitType.None && !flag10)
  619.                     {
  620.                         if (!flag8)
  621.                         {
  622.                             num36 *= residentFloat2;
  623.                             int useCardAbilitySkillNum3 = owner.GetUseCardAbilitySkillNum(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5003);
  624.                             if (useCardAbilitySkillNum3 > 0)
  625.                             {
  626.                                 num49 -= 100 - Mevius.DataSheet.Api.GetResidentInteger("abilitySkill1", 50) * useCardAbilitySkillNum3;
  627.                             }
  628.                             else
  629.                             {
  630.                                 num3 = 0;
  631.                             }
  632.                             flag6 = true;
  633.                             if (flag9)
  634.                             {
  635.                                 damageInfo.removeEnchantAttributeBit += 2;
  636.                             }
  637.                         }
  638.                     }
  639.                     else if ((weakAttributeBit & ElementAttributeBitType.Water) != ElementAttributeBitType.None)
  640.                     {
  641.                         if (flag5)
  642.                         {
  643.                             num36 *= residentFloat4;
  644.                         }
  645.                         else
  646.                         {
  647.                             num36 *= residentFloat3;
  648.                             num37 *= residentFloat3;
  649.                         }
  650.                         flag7 = true;
  651.                     }
  652.                 }
  653.                 if ((elementAttributeBitType & ElementAttributeBitType.Wind) != ElementAttributeBitType.None)
  654.                 {
  655.                     if ((absorbAttributeBit2 & ElementAttributeBitType.Wind) != ElementAttributeBitType.None)
  656.                     {
  657.                         flag8 = true;
  658.                         if (flag9)
  659.                         {
  660.                             damageInfo.removeEnchantAttributeBit += 4;
  661.                         }
  662.                         num3 = 0;
  663.                     }
  664.                     else if ((elementAttributeBit & ElementAttributeBitType.Wind) != ElementAttributeBitType.None && !flag10)
  665.                     {
  666.                         if (!flag8)
  667.                         {
  668.                             num36 *= residentFloat2;
  669.                             int useCardAbilitySkillNum4 = owner.GetUseCardAbilitySkillNum(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5003);
  670.                             if (useCardAbilitySkillNum4 > 0)
  671.                             {
  672.                                 num49 -= 100 - Mevius.DataSheet.Api.GetResidentInteger("abilitySkill1", 50) * useCardAbilitySkillNum4;
  673.                             }
  674.                             else
  675.                             {
  676.                                 num3 = 0;
  677.                             }
  678.                             flag6 = true;
  679.                             if (flag9)
  680.                             {
  681.                                 damageInfo.removeEnchantAttributeBit += 4;
  682.                             }
  683.                         }
  684.                     }
  685.                     else if ((weakAttributeBit & ElementAttributeBitType.Wind) != ElementAttributeBitType.None)
  686.                     {
  687.                         if (flag5)
  688.                         {
  689.                             num36 *= residentFloat4;
  690.                         }
  691.                         else
  692.                         {
  693.                             num36 *= residentFloat3;
  694.                             num37 *= residentFloat3;
  695.                         }
  696.                         flag7 = true;
  697.                     }
  698.                 }
  699.                 if ((elementAttributeBitType & ElementAttributeBitType.Earth) != ElementAttributeBitType.None)
  700.                 {
  701.                     if ((absorbAttributeBit2 & ElementAttributeBitType.Earth) != ElementAttributeBitType.None)
  702.                     {
  703.                         flag8 = true;
  704.                         if (flag9)
  705.                         {
  706.                             damageInfo.removeEnchantAttributeBit += 8;
  707.                         }
  708.                         num3 = 0;
  709.                     }
  710.                     else if ((elementAttributeBit & ElementAttributeBitType.Earth) != ElementAttributeBitType.None && !flag10)
  711.                     {
  712.                         if (!flag8)
  713.                         {
  714.                             num36 *= residentFloat2;
  715.                             int useCardAbilitySkillNum5 = owner.GetUseCardAbilitySkillNum(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5003);
  716.                             if (useCardAbilitySkillNum5 > 0)
  717.                             {
  718.                                 num49 -= 100 - Mevius.DataSheet.Api.GetResidentInteger("abilitySkill1", 50) * useCardAbilitySkillNum5;
  719.                             }
  720.                             else
  721.                             {
  722.                                 num3 = 0;
  723.                             }
  724.                             flag6 = true;
  725.                             if (flag9)
  726.                             {
  727.                                 damageInfo.removeEnchantAttributeBit += 8;
  728.                             }
  729.                         }
  730.                     }
  731.                     else if ((weakAttributeBit & ElementAttributeBitType.Earth) != ElementAttributeBitType.None)
  732.                     {
  733.                         if (flag5)
  734.                         {
  735.                             num36 *= residentFloat4;
  736.                         }
  737.                         else
  738.                         {
  739.                             num36 *= residentFloat3;
  740.                             num37 *= residentFloat3;
  741.                         }
  742.                         flag7 = true;
  743.                     }
  744.                 }
  745.                 if ((elementAttributeBitType & ElementAttributeBitType.Light) != ElementAttributeBitType.None)
  746.                 {
  747.                     if ((absorbAttributeBit2 & ElementAttributeBitType.Light) != ElementAttributeBitType.None)
  748.                     {
  749.                         flag8 = true;
  750.                         if (flag9)
  751.                         {
  752.                             damageInfo.removeEnchantAttributeBit += 16;
  753.                         }
  754.                         num3 = 0;
  755.                     }
  756.                     else if ((elementAttributeBit & ElementAttributeBitType.Light) != ElementAttributeBitType.None && !flag10)
  757.                     {
  758.                         if (!flag8)
  759.                         {
  760.                             num36 *= residentFloat2;
  761.                             int useCardAbilitySkillNum6 = owner.GetUseCardAbilitySkillNum(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5003);
  762.                             if (useCardAbilitySkillNum6 > 0)
  763.                             {
  764.                                 num49 -= 100 - Mevius.DataSheet.Api.GetResidentInteger("abilitySkill1", 50) * useCardAbilitySkillNum6;
  765.                             }
  766.                             else
  767.                             {
  768.                                 num3 = 0;
  769.                             }
  770.                             flag6 = true;
  771.                             if (flag9)
  772.                             {
  773.                                 damageInfo.removeEnchantAttributeBit += 16;
  774.                             }
  775.                         }
  776.                     }
  777.                     else if ((weakAttributeBit & ElementAttributeBitType.Light) != ElementAttributeBitType.None)
  778.                     {
  779.                         if (flag5)
  780.                         {
  781.                             num36 *= residentFloat4;
  782.                         }
  783.                         else
  784.                         {
  785.                             num36 *= residentFloat3;
  786.                             num37 *= residentFloat3;
  787.                         }
  788.                         flag7 = true;
  789.                     }
  790.                 }
  791.                 if ((elementAttributeBitType & ElementAttributeBitType.Dark) != ElementAttributeBitType.None)
  792.                 {
  793.                     if ((absorbAttributeBit2 & ElementAttributeBitType.Dark) != ElementAttributeBitType.None)
  794.                     {
  795.                         flag8 = true;
  796.                         if (flag9)
  797.                         {
  798.                             damageInfo.removeEnchantAttributeBit += 32;
  799.                         }
  800.                         num3 = 0;
  801.                     }
  802.                     else if ((elementAttributeBit & ElementAttributeBitType.Dark) != ElementAttributeBitType.None && !flag10)
  803.                     {
  804.                         if (!flag8)
  805.                         {
  806.                             num36 *= residentFloat2;
  807.                             int useCardAbilitySkillNum7 = owner.GetUseCardAbilitySkillNum(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5003);
  808.                             if (useCardAbilitySkillNum7 > 0)
  809.                             {
  810.                                 num49 -= 100 - Mevius.DataSheet.Api.GetResidentInteger("abilitySkill1", 50) * useCardAbilitySkillNum7;
  811.                             }
  812.                             else
  813.                             {
  814.                                 num3 = 0;
  815.                             }
  816.                             flag6 = true;
  817.                             if (flag9)
  818.                             {
  819.                                 damageInfo.removeEnchantAttributeBit += 32;
  820.                             }
  821.                         }
  822.                     }
  823.                     else if ((weakAttributeBit & ElementAttributeBitType.Dark) != ElementAttributeBitType.None)
  824.                     {
  825.                         if (flag5)
  826.                         {
  827.                             num36 *= residentFloat4;
  828.                         }
  829.                         else
  830.                         {
  831.                             num36 *= residentFloat3;
  832.                             num37 *= residentFloat3;
  833.                         }
  834.                         flag7 = true;
  835.                     }
  836.                 }
  837.                 if (elementAttributeBitType == ElementAttributeBitType.None)
  838.                 {
  839.                     if ((absorbAttributeBit2 & ElementAttributeBitType.Normal) != ElementAttributeBitType.None)
  840.                     {
  841.                         flag8 = true;
  842.                         num3 = 0;
  843.                     }
  844.                     if ((elementAttributeBit & ElementAttributeBitType.Normal) != ElementAttributeBitType.None && !flag10 && !flag8)
  845.                     {
  846.                         num36 *= residentFloat2;
  847.                         int useCardAbilitySkillNum8 = owner.GetUseCardAbilitySkillNum(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5003);
  848.                         if (useCardAbilitySkillNum8 > 0)
  849.                         {
  850.                             num49 -= 100 - Mevius.DataSheet.Api.GetResidentInteger("abilitySkill1", 50) * useCardAbilitySkillNum8;
  851.                         }
  852.                         else
  853.                         {
  854.                             num3 = 0;
  855.                         }
  856.                         flag6 = true;
  857.                     }
  858.                     if ((weakAttributeBit & ElementAttributeBitType.Normal) != ElementAttributeBitType.None)
  859.                     {
  860.                         if (flag5)
  861.                         {
  862.                             num36 *= residentFloat4;
  863.                         }
  864.                         else
  865.                         {
  866.                             num36 *= residentFloat3;
  867.                             num37 *= residentFloat3;
  868.                         }
  869.                         flag7 = true;
  870.                     }
  871.                 }
  872.                 if ((elementAttributeBitType & ElementAttributeBitType.Fire) != ElementAttributeBitType.None)
  873.                 {
  874.                     num39 += owner.GetStatusEffectValue(BattleStatusEffect.ProcType.EnhanceDamageFire);
  875.                     num39 += owner.GetStatusEffectValue(BattleStatusEffect.ProcType.EnhanceDamageAll);
  876.                     int elementInfluenceType = BattleUtility.GetElementInfluenceType();
  877.                     if (elementInfluenceType != 0)
  878.                     {
  879.                         DbManager.BattleData battleData = Mevius.Db.Api.GetBattleData();
  880.                         if ((int)battleData.elementInfluenceAttribute == 0)
  881.                         {
  882.                             damageInfo.elementInfluenceRate *= battleData.elementInfluenceRate;
  883.                             num36 *= battleData.elementInfluenceRate;
  884.                         }
  885.                     }
  886.                 }
  887.                 if ((elementAttributeBitType & ElementAttributeBitType.Water) != ElementAttributeBitType.None)
  888.                 {
  889.                     num39 += owner.GetStatusEffectValue(BattleStatusEffect.ProcType.EnhanceDamageWater);
  890.                     num39 += owner.GetStatusEffectValue(BattleStatusEffect.ProcType.EnhanceDamageAll);
  891.                     int elementInfluenceType2 = BattleUtility.GetElementInfluenceType();
  892.                     if (elementInfluenceType2 != 0)
  893.                     {
  894.                         DbManager.BattleData battleData2 = Mevius.Db.Api.GetBattleData();
  895.                         if ((int)battleData2.elementInfluenceAttribute == 1)
  896.                         {
  897.                             damageInfo.elementInfluenceRate *= battleData2.elementInfluenceRate;
  898.                             num36 *= battleData2.elementInfluenceRate;
  899.                         }
  900.                     }
  901.                 }
  902.                 if ((elementAttributeBitType & ElementAttributeBitType.Wind) != ElementAttributeBitType.None)
  903.                 {
  904.                     num39 += owner.GetStatusEffectValue(BattleStatusEffect.ProcType.EnhanceDamageWind);
  905.                     num39 += owner.GetStatusEffectValue(BattleStatusEffect.ProcType.EnhanceDamageAll);
  906.                     int elementInfluenceType3 = BattleUtility.GetElementInfluenceType();
  907.                     if (elementInfluenceType3 != 0)
  908.                     {
  909.                         DbManager.BattleData battleData3 = Mevius.Db.Api.GetBattleData();
  910.                         if ((int)battleData3.elementInfluenceAttribute == 2)
  911.                         {
  912.                             damageInfo.elementInfluenceRate *= battleData3.elementInfluenceRate;
  913.                             num36 *= battleData3.elementInfluenceRate;
  914.                         }
  915.                     }
  916.                 }
  917.                 if ((elementAttributeBitType & ElementAttributeBitType.Earth) != ElementAttributeBitType.None)
  918.                 {
  919.                     num39 += owner.GetStatusEffectValue(BattleStatusEffect.ProcType.EnhanceDamageEarth);
  920.                     num39 += owner.GetStatusEffectValue(BattleStatusEffect.ProcType.EnhanceDamageAll);
  921.                     int elementInfluenceType4 = BattleUtility.GetElementInfluenceType();
  922.                     if (elementInfluenceType4 != 0)
  923.                     {
  924.                         DbManager.BattleData battleData4 = Mevius.Db.Api.GetBattleData();
  925.                         if ((int)battleData4.elementInfluenceAttribute == 3)
  926.                         {
  927.                             damageInfo.elementInfluenceRate *= battleData4.elementInfluenceRate;
  928.                             num36 *= battleData4.elementInfluenceRate;
  929.                         }
  930.                     }
  931.                 }
  932.                 if ((elementAttributeBitType & ElementAttributeBitType.Light) != ElementAttributeBitType.None)
  933.                 {
  934.                     num39 += owner.GetStatusEffectValue(BattleStatusEffect.ProcType.EnhanceDamageLight);
  935.                     num39 += owner.GetStatusEffectValue(BattleStatusEffect.ProcType.EnhanceDamageAll);
  936.                     int elementInfluenceType5 = BattleUtility.GetElementInfluenceType();
  937.                     if (elementInfluenceType5 != 0)
  938.                     {
  939.                         DbManager.BattleData battleData5 = Mevius.Db.Api.GetBattleData();
  940.                         if ((int)battleData5.elementInfluenceAttribute == 4)
  941.                         {
  942.                             damageInfo.elementInfluenceRate *= battleData5.elementInfluenceRate;
  943.                             num36 *= battleData5.elementInfluenceRate;
  944.                         }
  945.                     }
  946.                 }
  947.                 if ((elementAttributeBitType & ElementAttributeBitType.Dark) != ElementAttributeBitType.None)
  948.                 {
  949.                     num39 += owner.GetStatusEffectValue(BattleStatusEffect.ProcType.EnhanceDamageDark);
  950.                     num39 += owner.GetStatusEffectValue(BattleStatusEffect.ProcType.EnhanceDamageAll);
  951.                     int elementInfluenceType6 = BattleUtility.GetElementInfluenceType();
  952.                     if (elementInfluenceType6 != 0)
  953.                     {
  954.                         DbManager.BattleData battleData6 = Mevius.Db.Api.GetBattleData();
  955.                         if ((int)battleData6.elementInfluenceAttribute == 5)
  956.                         {
  957.                             damageInfo.elementInfluenceRate *= battleData6.elementInfluenceRate;
  958.                             num36 *= battleData6.elementInfluenceRate;
  959.                         }
  960.                     }
  961.                 }
  962.                 if (owner.IsPlayer())
  963.                 {
  964.                     int num54;
  965.                     if ((elementAttributeBitType & ElementAttributeBitType.Fire) != ElementAttributeBitType.None && owner.GetAutoAbilityParam(DbManager.AutoAbilityType.AUTOABILITYTYPE_FIRE_STRENGTHEN, out num54))
  966.                     {
  967.                         num39 += num54;
  968.                     }
  969.                     int num55;
  970.                     if ((elementAttributeBitType & ElementAttributeBitType.Water) != ElementAttributeBitType.None && owner.GetAutoAbilityParam(DbManager.AutoAbilityType.AUTOABILITYTYPE_ICE_STRENGTHEN, out num55))
  971.                     {
  972.                         num39 += num55;
  973.                     }
  974.                     int num56;
  975.                     if ((elementAttributeBitType & ElementAttributeBitType.Wind) != ElementAttributeBitType.None && owner.GetAutoAbilityParam(DbManager.AutoAbilityType.AUTOABILITYTYPE_WIND_STRENGTHEN, out num56))
  976.                     {
  977.                         num39 += num56;
  978.                     }
  979.                     int num57;
  980.                     if ((elementAttributeBitType & ElementAttributeBitType.Earth) != ElementAttributeBitType.None && owner.GetAutoAbilityParam(DbManager.AutoAbilityType.AUTOABILITYTYPE_SOIL_STRENGTHEN, out num57))
  981.                     {
  982.                         num39 += num57;
  983.                     }
  984.                     int num58;
  985.                     if ((elementAttributeBitType & ElementAttributeBitType.Light) != ElementAttributeBitType.None && owner.GetAutoAbilityParam(DbManager.AutoAbilityType.AUTOABILITYTYPE_LIGHT_STRENGTHEN, out num58))
  986.                     {
  987.                         num39 += num58;
  988.                     }
  989.                     int num59;
  990.                     if ((elementAttributeBitType & ElementAttributeBitType.Dark) != ElementAttributeBitType.None && owner.GetAutoAbilityParam(DbManager.AutoAbilityType.AUTOABILITYTYPE_DARK_STRENGTHEN, out num59))
  991.                     {
  992.                         num39 += num59;
  993.                     }
  994.                 }
  995.                 if ((int)damageSourceElem.ma32fcd1fe2598c2edcfa5cdbeb0eb64f() == 1)
  996.                 {
  997.                     int num60 = owner.GetStatusEffectValue(BattleStatusEffect.ProcType.Break);
  998.                     int num61;
  999.                     if (flag9 && !flag && owner.GetAutoAbilityParam(DbManager.AutoAbilityType.AUTOABILITYTYPE_CS1457, out num61))
  1000.                     {
  1001.                         num60 += num61;
  1002.                     }
  1003.                     num3 = (int)((float)num3 * (1f + (float)num60 / 100f));
  1004.                 }
  1005.                 if ((int)damageSourceElem.m99d4196c8ddc2c84aa2a035182a3e754() != 1)
  1006.                 {
  1007.                     num39 += owner.GetStatusEffectValue(BattleStatusEffect.ProcType.GiveDamage);
  1008.                     num41 -= target.GetStatusEffectValue(BattleStatusEffect.ProcType.TakeDamage);
  1009.                     num42 -= target.GetStatusEffectValue(BattleStatusEffect.ProcType.TakeDamageEnemy);
  1010.                     if (target.IsPlayer())
  1011.                     {
  1012.                         int num62;
  1013.                         if ((elementAttributeBitType & ElementAttributeBitType.Fire) != ElementAttributeBitType.None && target.GetAutoAbilityParam(DbManager.AutoAbilityType.AUTOABILITYTYPE_FIRE_TOLERANCE, out num62))
  1014.                         {
  1015.                             num43 += num62;
  1016.                         }
  1017.                         int num63;
  1018.                         if ((elementAttributeBitType & ElementAttributeBitType.Water) != ElementAttributeBitType.None && target.GetAutoAbilityParam(DbManager.AutoAbilityType.AUTOABILITYTYPE_ICE_TOLERANCE, out num63))
  1019.                         {
  1020.                             num43 += num63;
  1021.                         }
  1022.                         int num64;
  1023.                         if ((elementAttributeBitType & ElementAttributeBitType.Wind) != ElementAttributeBitType.None && target.GetAutoAbilityParam(DbManager.AutoAbilityType.AUTOABILITYTYPE_WIND_TOLERANCE, out num64))
  1024.                         {
  1025.                             num43 += num64;
  1026.                         }
  1027.                         int num65;
  1028.                         if ((elementAttributeBitType & ElementAttributeBitType.Earth) != ElementAttributeBitType.None && target.GetAutoAbilityParam(DbManager.AutoAbilityType.AUTOABILITYTYPE_SOIL_TOLERANCE, out num65))
  1029.                         {
  1030.                             num43 += num65;
  1031.                         }
  1032.                         int num66;
  1033.                         if ((elementAttributeBitType & ElementAttributeBitType.Light) != ElementAttributeBitType.None && target.GetAutoAbilityParam(DbManager.AutoAbilityType.AUTOABILITYTYPE_LIGHT_TOLERANCE, out num66))
  1034.                         {
  1035.                             num43 += num66;
  1036.                         }
  1037.                         int num67;
  1038.                         if ((elementAttributeBitType & ElementAttributeBitType.Dark) != ElementAttributeBitType.None && target.GetAutoAbilityParam(DbManager.AutoAbilityType.AUTOABILITYTYPE_DARK_TOLERANCE, out num67))
  1039.                         {
  1040.                             num43 += num67;
  1041.                         }
  1042.                     }
  1043.                     if (!flag8 && !flag10)
  1044.                     {
  1045.                         for (int j = 0; j < 7; j++)
  1046.                         {
  1047.                             if ((elementAttributeBitType & (ElementAttributeBitType)(1 << j)) != ElementAttributeBitType.None)
  1048.                             {
  1049.                                 int num68 = target.GetStatusEffectValue(BattleStatusEffect.ProcType.ReductionDamageFire + j);
  1050.                                 int num69;
  1051.                                 if (owner.GetAutoAbilityParam(DbManager.AutoAbilityType.AUTOABILITYTYPE_CS1317, out num69))
  1052.                                 {
  1053.                                     num68 += num69;
  1054.                                 }
  1055.                                 if (num68 > 0)
  1056.                                 {
  1057.                                     flag6 = true;
  1058.                                 }
  1059.                                 num38 *= (float)(100 - num68) * 0.01f;
  1060.                             }
  1061.                         }
  1062.                     }
  1063.                     if (flag7)
  1064.                     {
  1065.                         num46 += target.GetStatusEffectValue(BattleStatusEffect.ProcType.SufferDamageWeak);
  1066.                         num49 += target.GetStatusEffectValue(BattleStatusEffect.ProcType.SufferDamageWeak);
  1067.                         int useCardAbilitySkillNum9 = owner.GetUseCardAbilitySkillNum(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5103);
  1068.                         if (useCardAbilitySkillNum9 > 0)
  1069.                         {
  1070.                             num48 += Mevius.DataSheet.Api.GetResidentInteger("abilitySkill8", 50) * useCardAbilitySkillNum9;
  1071.                         }
  1072.                         int num70;
  1073.                         if (owner.GetAutoAbilityParam(DbManager.AutoAbilityType.AUTOABILITYTYPE_CS1310, out num70))
  1074.                         {
  1075.                             num46 += num70;
  1076.                             num49 += num70;
  1077.                         }
  1078.                         int useAbilitySkillValue = owner.GetUseAbilitySkillValue(EnemyAbilitySkillType.Id1310);
  1079.                         num46 += useAbilitySkillValue;
  1080.                         num49 += useAbilitySkillValue;
  1081.                     }
  1082.                     if (owner.IsPlayer())
  1083.                     {
  1084.                         int useCardAbilitySkillNum10 = owner.GetUseCardAbilitySkillNum(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5152);
  1085.                         if (useCardAbilitySkillNum10 > 0)
  1086.                         {
  1087.                             num39 += Mevius.DataSheet.Api.GetResidentInteger("abilitySkill16", 50) * useCardAbilitySkillNum10;
  1088.                         }
  1089.                         int num71;
  1090.                         if (owner.PrevUseCardAbilityAttribute != ElementAttributeType.None && !flag && owner.NormalAttackNum == 0 && owner.GetAutoAbilityParam(DbManager.AutoAbilityType.AUTOABILITYTYPE_CS1314, out num71))
  1091.                         {
  1092.                             num39 += num71;
  1093.                         }
  1094.                         ElementAttributeType prevUseCardAbilityAttribute = owner.PrevUseCardAbilityAttribute;
  1095.                         if (prevUseCardAbilityAttribute != ElementAttributeType.None)
  1096.                         {
  1097.                             ElementAttributeType useCardAbilityAttribute3 = owner.GetUseCardAbilityAttribute();
  1098.                             if (useCardAbilityAttribute3 != ElementAttributeType.None)
  1099.                             {
  1100.                                 int num73;
  1101.                                 if (prevUseCardAbilityAttribute == useCardAbilityAttribute3)
  1102.                                 {
  1103.                                     int num72;
  1104.                                     if (owner.GetAutoAbilityParam(DbManager.AutoAbilityType.AUTOABILITYTYPE_CS1315, out num72))
  1105.                                     {
  1106.                                         num39 += num72;
  1107.                                     }
  1108.                                     num39 += owner.GetUseAbilitySkillValue(EnemyAbilitySkillType.Id1315);
  1109.                                     int useCardAbilitySkillNum11 = owner.GetUseCardAbilitySkillNum(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5164);
  1110.                                     if (useCardAbilitySkillNum11 > 0)
  1111.                                     {
  1112.                                         num39 += Mevius.DataSheet.Api.GetResidentInteger("abilitySkill5164", 10) * useCardAbilitySkillNum11;
  1113.                                     }
  1114.                                 }
  1115.                                 else if (owner.GetAutoAbilityParam(DbManager.AutoAbilityType.AUTOABILITYTYPE_CS1316, out num73))
  1116.                                 {
  1117.                                     num39 += num73;
  1118.                                 }
  1119.                             }
  1120.                         }
  1121.                         int useCardAbilitySkillNum12 = owner.GetUseCardAbilitySkillNum(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5154);
  1122.                         if (useCardAbilitySkillNum12 > 0 && BattleManager._i.GetEnemyNum(false) == 1)
  1123.                         {
  1124.                             num39 += Mevius.DataSheet.Api.GetResidentInteger("abilitySkill5154", 10) * useCardAbilitySkillNum12;
  1125.                         }
  1126.                         int useCardAbilitySkillNum13 = owner.GetUseCardAbilitySkillNum(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5155);
  1127.                         if (useCardAbilitySkillNum13 > 0)
  1128.                         {
  1129.                             DiffLevel diffLevel = Mevius.Battle.Api.GetDiffLevel(Mevius.Field.Api.GadgetRouteApi.GetTargetGadgetName(), Mevius.Db.Api.GetCurrentCardDeck(), Mevius.App.Api.GetMainJobTypeCurrentDeck());
  1130.                             if (diffLevel == DiffLevel.VeryTough)
  1131.                             {
  1132.                                 num39 += Mevius.DataSheet.Api.GetResidentInteger("abilitySkill5155_0", 10) * useCardAbilitySkillNum13;
  1133.                             }
  1134.                             else if (diffLevel == DiffLevel.IncrediblyTough)
  1135.                             {
  1136.                                 num39 += Mevius.DataSheet.Api.GetResidentInteger("abilitySkill5155_1", 10) * useCardAbilitySkillNum13;
  1137.                             }
  1138.                         }
  1139.                         int useCardAbilitySkillNum14 = owner.GetUseCardAbilitySkillNum(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5156);
  1140.                         if (useCardAbilitySkillNum14 > 0 && BattleManager._i.TurnNum == 1)
  1141.                         {
  1142.                             num39 += Mevius.DataSheet.Api.GetResidentInteger("abilitySkill5156", 10) * useCardAbilitySkillNum14;
  1143.                         }
  1144.                         int useCardAbilitySkillNum15 = owner.GetUseCardAbilitySkillNum(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5157);
  1145.                         if (useCardAbilitySkillNum15 > 0)
  1146.                         {
  1147.                             int statusEffectDebuffNum = target.GetStatusEffectDebuffNum();
  1148.                             if (statusEffectDebuffNum > 0)
  1149.                             {
  1150.                                 num39 += Mevius.DataSheet.Api.GetResidentInteger("abilitySkill5157", 10) * useCardAbilitySkillNum15 * statusEffectDebuffNum;
  1151.                             }
  1152.                         }
  1153.                         int useCardAbilitySkillNum16 = owner.GetUseCardAbilitySkillNum(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5159);
  1154.                         if (useCardAbilitySkillNum16 > 0 && target.Bp == target.BpMax && target.BpArmorDamage == 0)
  1155.                         {
  1156.                             num48 += Mevius.DataSheet.Api.GetResidentInteger("abilitySkill5159", 10) * useCardAbilitySkillNum16;
  1157.                         }
  1158.                         int useCardAbilitySkillNum17 = owner.GetUseCardAbilitySkillNum(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5160);
  1159.                         if (useCardAbilitySkillNum17 > 0)
  1160.                         {
  1161.                             float hpRate = target.GetHpRate();
  1162.                             if (hpRate <= 0.25f)
  1163.                             {
  1164.                                 num39 += Mevius.DataSheet.Api.GetResidentInteger("abilitySkill5160_1", 10) * useCardAbilitySkillNum17;
  1165.                             }
  1166.                             else if (hpRate <= 0.5f)
  1167.                             {
  1168.                                 num39 += Mevius.DataSheet.Api.GetResidentInteger("abilitySkill5160_0", 10) * useCardAbilitySkillNum17;
  1169.                             }
  1170.                         }
  1171.                         if ((owner.ActionFlagBit & BattleActor.ActionFlagBitType.AbilitySkill5162) != (BattleActor.ActionFlagBitType)0)
  1172.                         {
  1173.                             int useCardAbilitySkillNum18 = owner.GetUseCardAbilitySkillNum(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5162);
  1174.                             if (useCardAbilitySkillNum18 > 0)
  1175.                             {
  1176.                                 num39 += Mevius.DataSheet.Api.GetResidentInteger("abilitySkill5162", 10) * useCardAbilitySkillNum18;
  1177.                             }
  1178.                         }
  1179.                         if ((owner.ActionFlagBit & BattleActor.ActionFlagBitType.AbilitySkill5163) != (BattleActor.ActionFlagBitType)0)
  1180.                         {
  1181.                             int useCardAbilitySkillNum19 = owner.GetUseCardAbilitySkillNum(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5163);
  1182.                             if (useCardAbilitySkillNum19 > 0)
  1183.                             {
  1184.                                 num39 += Mevius.DataSheet.Api.GetResidentInteger("abilitySkill5163", 10) * useCardAbilitySkillNum19;
  1185.                             }
  1186.                         }
  1187.                         int useCardAbilitySkillNum20 = owner.GetUseCardAbilitySkillNum(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5616);
  1188.                         if (useCardAbilitySkillNum20 > 0 && target.IsStatusEffectEntry(BattleStatusEffect.GroupType.Brave))
  1189.                         {
  1190.                             num39 += Mevius.DataSheet.Api.GetResidentInteger("abilitySkill5616", 10) * useCardAbilitySkillNum20;
  1191.                         }
  1192.                         int useCardAbilitySkillNum21 = owner.GetUseCardAbilitySkillNum(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5617);
  1193.                         if (useCardAbilitySkillNum21 > 0 && target.IsStatusEffectEntry(BattleStatusEffect.GroupType.Syncle))
  1194.                         {
  1195.                             num39 += Mevius.DataSheet.Api.GetResidentInteger("abilitySkill5617", 10) * useCardAbilitySkillNum21;
  1196.                         }
  1197.                         int useCardAbilitySkillNum22 = owner.GetUseCardAbilitySkillNum(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5618);
  1198.                         if (useCardAbilitySkillNum22 > 0 && target.IsStatusEffectEntry(BattleStatusEffect.GroupType.BuffStart))
  1199.                         {
  1200.                             num39 += Mevius.DataSheet.Api.GetResidentInteger("abilitySkill5618", 10) * useCardAbilitySkillNum22;
  1201.                         }
  1202.                         int useCardAbilitySkillNum23 = owner.GetUseCardAbilitySkillNum(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5619);
  1203.                         if (useCardAbilitySkillNum23 > 0 && target.IsStatusEffectEntry(BattleStatusEffect.GroupType.Clit))
  1204.                         {
  1205.                             num39 += Mevius.DataSheet.Api.GetResidentInteger("abilitySkill5619", 10) * useCardAbilitySkillNum23;
  1206.                         }
  1207.                         int abilitySkillEnemySlayer = BattleUtility.GetAbilitySkillEnemySlayer(owner, target);
  1208.                         num39 += abilitySkillEnemySlayer;
  1209.                         num48 += abilitySkillEnemySlayer;
  1210.                         if (owner.NormalAttackNum > 0)
  1211.                         {
  1212.                             if (owner.IsStatusEffectEntry(BattleStatusEffect.ProcType.JobAbilityRatioDamageUp))
  1213.                             {
  1214.                                 float jobAbilityUseManaUseNumRate = owner.GetJobAbilityUseManaUseNumRate();
  1215.                                 float num74 = (float)Mevius.DataSheet.Api.GetResidentInteger("abilitySkill5502_0", 50) * 0.01f;
  1216.                                 if (num74 <= jobAbilityUseManaUseNumRate)
  1217.                                 {
  1218.                                     float num75 = (float)Mevius.DataSheet.Api.GetResidentInteger("abilitySkill5502_1", 100) * 0.01f;
  1219.                                     float num76 = 1f - num74;
  1220.                                     float num77 = jobAbilityUseManaUseNumRate - num74;
  1221.                                     num39 += (int)(num75 / (num76 * num76) * num77 * num77 * 100f + 0.5f);
  1222.                                 }
  1223.                             }
  1224.                             if (owner.IsStatusEffectEntry(BattleStatusEffect.ProcType.JobAbilityRatioBreakDamageUp))
  1225.                             {
  1226.                                 float jobAbilityUseManaUseNumRate2 = owner.GetJobAbilityUseManaUseNumRate();
  1227.                                 float num78 = (float)Mevius.DataSheet.Api.GetResidentInteger("abilitySkill5503_0", 50) * 0.01f;
  1228.                                 if (num78 >= jobAbilityUseManaUseNumRate2)
  1229.                                 {
  1230.                                     float num79 = (float)Mevius.DataSheet.Api.GetResidentInteger("abilitySkill5503_1", 100) * 0.01f;
  1231.                                     float num80 = num78;
  1232.                                     float num81 = jobAbilityUseManaUseNumRate2 - num78;
  1233.                                     num48 += (int)(num79 / (num80 * num80) * num81 * num81 * 100f + 0.5f);
  1234.                                 }
  1235.                             }
  1236.                         }
  1237.                         int useCardAbilitySkillNum24 = owner.GetUseCardAbilitySkillNum(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5167);
  1238.                         if (useCardAbilitySkillNum24 > 0)
  1239.                         {
  1240.                             int num82 = target.GetStatusEffectDebuffNum();
  1241.                             if (num82 > 0)
  1242.                             {
  1243.                                 int residentInteger4 = Mevius.DataSheet.Api.GetResidentInteger("abilitySkill5167_1", 10);
  1244.                                 if (num82 > residentInteger4)
  1245.                                 {
  1246.                                     num82 = residentInteger4;
  1247.                                 }
  1248.                                 num39 += Mevius.DataSheet.Api.GetResidentInteger("abilitySkill5167", 2) * num82 * useCardAbilitySkillNum24;
  1249.                             }
  1250.                         }
  1251.                         int useCardAbilitySkillNum25 = owner.GetUseCardAbilitySkillNum(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5178);
  1252.                         if (useCardAbilitySkillNum25 > 0)
  1253.                         {
  1254.                             int num83 = owner.GetStatusEffectBuffNum();
  1255.                             if (num83 > 0)
  1256.                             {
  1257.                                 int residentInteger5 = Mevius.DataSheet.Api.GetResidentInteger("abilitySkill5178_1", 10);
  1258.                                 if (num83 > residentInteger5)
  1259.                                 {
  1260.                                     num83 = residentInteger5;
  1261.                                 }
  1262.                                 num39 += Mevius.DataSheet.Api.GetResidentInteger("abilitySkill5178_0", 50) * num83 * useCardAbilitySkillNum25;
  1263.                             }
  1264.                         }
  1265.                         int num84;
  1266.                         if ((flag || owner.NormalAttackNum != 0 || (int)damageSourceElem.ma32fcd1fe2598c2edcfa5cdbeb0eb64f() == 1) && owner.GetAutoAbilityParam(DbManager.AutoAbilityType.AUTOABILITYTYPE_CS1257, out num84) && target.BpArmorDamage != 0)
  1267.                         {
  1268.                             num48 += num84;
  1269.                         }
  1270.                         if (owner.IsUseCardAbilitySkill(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5182))
  1271.                         {
  1272.                             num39 += Mevius.DataSheet.Api.GetResidentInteger("abilitySkill5182_0", 25) * owner.GetStatusEffectElementDriveTurnAll();
  1273.                         }
  1274.                     }
  1275.                     num39 += owner.ActionDamageGroupParam;
  1276.                     if (owner.NormalAttackNum == 3)
  1277.                     {
  1278.                         int residentInteger6 = Mevius.DataSheet.Api.GetResidentInteger("damageFinishAddRate", 20);
  1279.                         num39 += residentInteger6;
  1280.                         num48 += residentInteger6;
  1281.                     }
  1282.                     if (!flag6 && !isRandMinTest && !owner.IsStatusEffectEntry(BattleStatusEffect.ProcType.CriticalZero) && (num != 0 || num3 != 0))
  1283.                     {
  1284.                         if (target.IsStatusEffectEntry(BattleStatusEffect.GroupType.CriticalDefenseUp) && !flag11)
  1285.                         {
  1286.                             isCritical = false;
  1287.                         }
  1288.                         else if ((!flag && owner.NormalAttackNum <= 0) || !isNoCriticalCalc)
  1289.                         {
  1290.                             num2 += owner.GetStatusEffectValue(BattleStatusEffect.ProcType.Critical);
  1291.                             num2 += target.GetStatusEffectValue(BattleStatusEffect.ProcType.TakeCritical);
  1292.                             if (owner.IsPlayer())
  1293.                             {
  1294.                                 if (flag5)
  1295.                                 {
  1296.                                     int useCardAbilitySkillNum26 = owner.GetUseCardAbilitySkillNum(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5052);
  1297.                                     if (useCardAbilitySkillNum26 > 0)
  1298.                                     {
  1299.                                         num2 += Mevius.DataSheet.Api.GetResidentInteger("abilitySkill3", 50) * useCardAbilitySkillNum26;
  1300.                                     }
  1301.                                 }
  1302.                                 if (flag7)
  1303.                                 {
  1304.                                     int useCardAbilitySkillNum27 = owner.GetUseCardAbilitySkillNum(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5104);
  1305.                                     if (useCardAbilitySkillNum27 > 0)
  1306.                                     {
  1307.                                         num2 += Mevius.DataSheet.Api.GetResidentInteger("abilitySkill9", 50) * useCardAbilitySkillNum27;
  1308.                                     }
  1309.                                 }
  1310.                             }
  1311.                             if (!flag11)
  1312.                             {
  1313.                                 C4d4f3a800432e94568175cb31ad3c78d.C51747b7e0e19ad065084a2c5a6d8421b battleCharaSpecElem = target.GetBattleCharaSpecElem();
  1314.                                 if (battleCharaSpecElem != null)
  1315.                                 {
  1316.                                     num2 -= (int)battleCharaSpecElem.m55cf0f9e548ca3ba7c5b283f670f1dec();
  1317.                                 }
  1318.                             }
  1319.                             if (num2 > 0)
  1320.                             {
  1321.                                 uint num85 = Mevius.Battle.Api.GetRandomUnsignedInteger() % 100u;
  1322.                                 isCritical = ((ulong)num85 < (ulong)((long)num2));
  1323.                             }
  1324.                             else
  1325.                             {
  1326.                                 isCritical = false;
  1327.                             }
  1328.                             damageInfo.isCriticalCalc = true;
  1329.                         }
  1330.                     }
  1331.                     else
  1332.                     {
  1333.                         isCritical = false;
  1334.                     }
  1335.                     if (isCritical)
  1336.                     {
  1337.                         num35 = Mevius.DataSheet.Api.GetResidentFloat("damageCriticalRate", 1.5f);
  1338.                         if (owner.IsPlayer())
  1339.                         {
  1340.                             int useCardAbilitySkillNum28 = owner.GetUseCardAbilitySkillNum(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5053);
  1341.                             if (useCardAbilitySkillNum28 > 0)
  1342.                             {
  1343.                                 num48 += Mevius.DataSheet.Api.GetResidentInteger("abilitySkill4", 50) * useCardAbilitySkillNum28;
  1344.                             }
  1345.                             int useCardAbilitySkillNum29 = owner.GetUseCardAbilitySkillNum(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5054);
  1346.                             if (useCardAbilitySkillNum29 > 0)
  1347.                             {
  1348.                                 num45 += Mevius.DataSheet.Api.GetResidentInteger("abilitySkill5", 50) * useCardAbilitySkillNum29;
  1349.                             }
  1350.                             int num86;
  1351.                             if (owner.GetAutoAbilityParam(DbManager.AutoAbilityType.AUTOABILITYTYPE_CS1311, out num86))
  1352.                             {
  1353.                                 num45 += num86;
  1354.                             }
  1355.                             int useCardAbilitySkillNum30 = owner.GetUseCardAbilitySkillNum(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5171);
  1356.                             if (useCardAbilitySkillNum30 > 0)
  1357.                             {
  1358.                                 num45 += Mevius.DataSheet.Api.GetResidentInteger("abilitySkill5171_0", 100) * useCardAbilitySkillNum30;
  1359.                             }
  1360.                         }
  1361.                         num45 += owner.GetUseAbilitySkillValue(EnemyAbilitySkillType.Id1311);
  1362.                     }
  1363.                     if (flag5 && owner.IsPlayer())
  1364.                     {
  1365.                         int useCardAbilitySkillNum31 = owner.GetUseCardAbilitySkillNum(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5002);
  1366.                         if (useCardAbilitySkillNum31 > 0)
  1367.                         {
  1368.                             num44 += Mevius.DataSheet.Api.GetResidentInteger("abilitySkill0", 50) * useCardAbilitySkillNum31;
  1369.                         }
  1370.                         if (flag7)
  1371.                         {
  1372.                             int useCardAbilitySkillNum32 = owner.GetUseCardAbilitySkillNum(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5102);
  1373.                             if (useCardAbilitySkillNum32 > 0)
  1374.                             {
  1375.                                 num46 += Mevius.DataSheet.Api.GetResidentInteger("abilitySkill7", 50) * useCardAbilitySkillNum32;
  1376.                             }
  1377.                         }
  1378.                         int num87;
  1379.                         if (owner.GetAutoAbilityParam(DbManager.AutoAbilityType.AUTOABILITYTYPE_CS1309, out num87))
  1380.                         {
  1381.                             num44 += num87;
  1382.                         }
  1383.                         num44 += owner.GetUseAbilitySkillValue(EnemyAbilitySkillType.Id1309);
  1384.                         int useCardAbilitySkillNum33 = owner.GetUseCardAbilitySkillNum(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5168);
  1385.                         if (useCardAbilitySkillNum33 > 0)
  1386.                         {
  1387.                             num44 += Mevius.DataSheet.Api.GetResidentInteger("abilitySkill5168_0", 100) * useCardAbilitySkillNum33;
  1388.                         }
  1389.                     }
  1390.                     if (target.IsStatusEffectEntry(BattleStatusEffect.ProcType.TakeBreakDamage) && (flag || owner.NormalAttackNum > 0))
  1391.                     {
  1392.                         num50 -= target.GetStatusEffectValue(BattleStatusEffect.ProcType.TakeBreakDamage);
  1393.                     }
  1394.                     if (target.IsStatusEffectEntry(BattleStatusEffect.ProcType.TakeAbilityBreakDamage) && !flag && owner.NormalAttackNum == 0)
  1395.                     {
  1396.                         num50 -= target.GetStatusEffectValue(BattleStatusEffect.ProcType.TakeAbilityBreakDamage);
  1397.                     }
  1398.                     if (!target.IsStatusEffectEntry(BattleStatusEffect.ProcType.DefenceZero) && !flag11)
  1399.                     {
  1400.                         if (owner.IsPlayer())
  1401.                         {
  1402.                             if (!flag5)
  1403.                             {
  1404.                                 num40 += target.Defense;
  1405.                             }
  1406.                         }
  1407.                         else if (target.IsPlayer())
  1408.                         {
  1409.                             int num88 = 0;
  1410.                             if (Mevius.App.Api.IsPartyMode())
  1411.                             {
  1412.                                 int[] partyParameterType3 = Mevius.Party.Api.GetPartyParameterType();
  1413.                                 num88 = partyParameterType3[target.PartySlot];
  1414.                             }
  1415.                             else if (target.IsPlayerSub())
  1416.                             {
  1417.                                 num88 = 1000;
  1418.                             }
  1419.                             num40 += Mevius.Db.Api.GetParameter(DbManager.ParameterType.GuardValue + num88);
  1420.                             int num89;
  1421.                             if (BattleUtility.GetOptimaAbilityValue(61, out num89))
  1422.                             {
  1423.                                 num40 += num89;
  1424.                             }
  1425.                         }
  1426.                         else
  1427.                         {
  1428.                             num40 += target.Defense;
  1429.                         }
  1430.                         if (isCritical)
  1431.                         {
  1432.                             int useCardAbilitySkillNum34 = owner.GetUseCardAbilitySkillNum(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5054);
  1433.                             if (useCardAbilitySkillNum34 > 0)
  1434.                             {
  1435.                                 num40 -= Mevius.DataSheet.Api.GetResidentInteger("abilitySkill6", 20) * useCardAbilitySkillNum34;
  1436.                             }
  1437.                         }
  1438.                         if (num40 < 0)
  1439.                         {
  1440.                             num40 = 0;
  1441.                         }
  1442.                     }
  1443.                 }
  1444.                 else
  1445.                 {
  1446.                     int num90;
  1447.                     if (num5 > 0 && Mevius.App.Api.IsPartyMode() && owner.GetAutoAbilityParam(DbManager.AutoAbilityType.AUTOABILITYTYPE_CS1508, out num90))
  1448.                     {
  1449.                         num39 += num90;
  1450.                     }
  1451.                     isCritical = false;
  1452.                 }
  1453.                 if ((elementAttributeBitType & ElementAttributeBitType.Fire) != ElementAttributeBitType.None && (int)damageSourceElem.m056cb6b23e1a1553df9a90eb3f5f804b() == 0 && target.IsStatusEffectEntry(BattleStatusEffect.ProcType.MagicDamageFire))
  1454.                 {
  1455.                     num = (int)((float)(num * target.GetStatusEffectValue(BattleStatusEffect.ProcType.MagicDamageFire)) * 0.01f + 0.5f);
  1456.                 }
  1457.                 float num91 = 1f + (float)num39 * 0.01f;
  1458.                 num34 += (float)num44 * 0.01f;
  1459.                 num36 += (float)num46 * 0.01f;
  1460.                 num35 += (float)num45 * 0.01f;
  1461.                 num47 += (float)num48 * 0.01f;
  1462.                 num37 += (float)num49 * 0.01f;
  1463.                 if (num4 < 0f)
  1464.                 {
  1465.                     num4 = 0f;
  1466.                 }
  1467.                 if (num91 < 0f)
  1468.                 {
  1469.                     num91 = 0f;
  1470.                 }
  1471.                 if (num34 < 0f)
  1472.                 {
  1473.                     num34 = 0f;
  1474.                 }
  1475.                 if (num36 < 0f)
  1476.                 {
  1477.                     num36 = 0f;
  1478.                 }
  1479.                 if (num35 < 0f)
  1480.                 {
  1481.                     num35 = 0f;
  1482.                 }
  1483.                 if (num47 < 0f)
  1484.                 {
  1485.                     num47 = 0f;
  1486.                 }
  1487.                 if (num37 < 0f)
  1488.                 {
  1489.                     num37 = 0f;
  1490.                 }
  1491.                 if ((int)damageSourceElem.m99d4196c8ddc2c84aa2a035182a3e754() == 1)
  1492.                 {
  1493.                     num34 = 1f;
  1494.                 }
  1495.                 if (target.BpSpecialCalc && !flag7 && (int)damageSourceElem.ma32fcd1fe2598c2edcfa5cdbeb0eb64f() != 1)
  1496.                 {
  1497.                     num47 *= Mevius.DataSheet.Api.GetResidentFloat("breakDamageUnWeaknessAbilityAttackRate", 0.25f);
  1498.                 }
  1499.                 float num92 = 1f;
  1500.                 float num93 = 1f;
  1501.                 if (BattleManager._i.IsCountTimeBattle())
  1502.                 {
  1503.                     if (owner.IsEnemy())
  1504.                     {
  1505.                         if (target.IsPlayer())
  1506.                         {
  1507.                             num92 = (float)Mevius.DataSheet.Api.GetResidentInteger("ctbEnemyToPlayerDamageRate", 100) / 100f;
  1508.                         }
  1509.                         else if ((int)damageSourceElem.m99d4196c8ddc2c84aa2a035182a3e754() == 1)
  1510.                         {
  1511.                             num92 = (float)Mevius.DataSheet.Api.GetResidentInteger("ctbEnemyToEnemyRecoverRate", 100) / 100f;
  1512.                         }
  1513.                         else
  1514.                         {
  1515.                             num92 = (float)Mevius.DataSheet.Api.GetResidentInteger("ctbEnemyToEnemyDamageRate", 100) / 100f;
  1516.                         }
  1517.                     }
  1518.                     else if (target.IsEnemy())
  1519.                     {
  1520.                         int enemyLevel = BattleManager._i.EnemyLevel;
  1521.                         num92 = BattleDamage.GetCTBCalcRate(enemyLevel, (float)Mevius.DataSheet.Api.GetResidentInteger("ctbPlayerToEnemyDamageRate_Y1", 100), (float)Mevius.DataSheet.Api.GetResidentInteger("ctbPlayerToEnemyDamageRate_X1", 1), (float)Mevius.DataSheet.Api.GetResidentInteger("ctbPlayerToEnemyDamageRate_Y2", 10), (float)Mevius.DataSheet.Api.GetResidentInteger("ctbPlayerToEnemyDamageRate_X2", 100));
  1522.                         if ((int)damageSourceElem.ma32fcd1fe2598c2edcfa5cdbeb0eb64f() == 1)
  1523.                         {
  1524.                             num93 = BattleDamage.GetCTBCalcRate(enemyLevel, (float)Mevius.DataSheet.Api.GetResidentInteger("ctbPlayerToEnemyParamRefBreakDamageRate_Y1", 100), (float)Mevius.DataSheet.Api.GetResidentInteger("ctbPlayerToEnemyParamRefBreakDamageRate_X1", 1), (float)Mevius.DataSheet.Api.GetResidentInteger("ctbPlayerToEnemyParamRefBreakDamageRate_Y2", 10), (float)Mevius.DataSheet.Api.GetResidentInteger("ctbPlayerToEnemyParamRefBreakDamageRate_X2", 100));
  1525.                         }
  1526.                         else
  1527.                         {
  1528.                             num93 = BattleDamage.GetCTBCalcRate(enemyLevel, (float)Mevius.DataSheet.Api.GetResidentInteger("ctbPlayerToEnemyAbilityBreakDamageRate_Y1", 100), (float)Mevius.DataSheet.Api.GetResidentInteger("ctbPlayerToEnemyAbilityBreakDamageRate_X1", 1), (float)Mevius.DataSheet.Api.GetResidentInteger("ctbPlayerToEnemyAbilityBreakDamageRate_Y2", 10), (float)Mevius.DataSheet.Api.GetResidentInteger("ctbPlayerToEnemyAbilityBreakDamageRate_X2", 100));
  1529.                         }
  1530.                     }
  1531.                     else if ((int)damageSourceElem.m99d4196c8ddc2c84aa2a035182a3e754() == 1)
  1532.                     {
  1533.                         num92 = (float)Mevius.DataSheet.Api.GetResidentInteger("ctbPlayerToPlayerRecoverRate", 100) / 100f;
  1534.                     }
  1535.                     else
  1536.                     {
  1537.                         num92 = (float)Mevius.DataSheet.Api.GetResidentInteger("ctbPlayerToPlayerDamageRate", 100) / 100f;
  1538.                     }
  1539.                 }
  1540.                 if (flag8)
  1541.                 {
  1542.                     num = (int)(num92 * (float)num * owner.AbilityDamageCoef * num4 * num33 * num91 * num35 + 0.5f);
  1543.                 }
  1544.                 else
  1545.                 {
  1546.                     num = (int)(num92 * (float)num * owner.AbilityDamageCoef * num4 * num36 * num33 * num91 * num34 * num35 + 0.5f);
  1547.                 }
  1548.                 float residentFloat5 = Mevius.DataSheet.Api.GetResidentFloat("bpDamageDefenderRateMin", 0.3f);
  1549.                 float residentFloat6 = Mevius.DataSheet.Api.GetResidentFloat("bpDamageDefenderRateMax", 3f);
  1550.                 float num94 = (float)(100 - num50) * 0.01f;
  1551.                 if (num94 < residentFloat5)
  1552.                 {
  1553.                     num94 = residentFloat5;
  1554.                 }
  1555.                 else if (num94 > residentFloat6)
  1556.                 {
  1557.                     num94 = residentFloat6;
  1558.                 }
  1559.                 num3 = (int)(num93 * (float)num3 * owner.AbilityDamageCoef * num4 * num37 * num47 * num94 + 0.5f);
  1560.                 if (owner.IsPlayer())
  1561.                 {
  1562.                     if (num != 0)
  1563.                     {
  1564.                         int num96;
  1565.                         if (target.IsBreak())
  1566.                         {
  1567.                             int num95 = 0;
  1568.                             if (BattleUtility.GetOptimaAbilityValue(23, out num96))
  1569.                             {
  1570.                                 num95 += num96;
  1571.                             }
  1572.                             int num97;
  1573.                             if (owner.NormalAttackNum > 0 && owner.GetAutoAbilityParam(DbManager.AutoAbilityType.AUTOABILITYTYPE_CS1341, out num97))
  1574.                             {
  1575.                                 num95 += num97;
  1576.                             }
  1577.                             if (num95 > 0)
  1578.                             {
  1579.                                 num = (int)((float)num * (1f + (float)num95 / 100f) + 0.5f);
  1580.                             }
  1581.                         }
  1582.                         int num98 = 0;
  1583.                         Ceaf68fb2356fb8b84facc86d2fe79f0e.Cca912973d2eb55c3b74a5c95a6475670 cca912973d2eb55c3b74a5c95a2 = Ceaf68fb2356fb8b84facc86d2fe79f0e.Find(owner.AbilityId);
  1584.                         if (cca912973d2eb55c3b74a5c95a2 != null && (int)cca912973d2eb55c3b74a5c95a2.m02be48e0485474e5cf059777a462cc3d() != 0)
  1585.                         {
  1586.                             if (BattleUtility.GetOptimaAbilityValue(24, out num96))
  1587.                             {
  1588.                                 num98 += num96;
  1589.                             }
  1590.                             int num99;
  1591.                             if (owner.GetAutoAbilityParam(DbManager.AutoAbilityType.AUTOABILITYTYPE_CS1342, out num99))
  1592.                             {
  1593.                                 num98 += num99;
  1594.                             }
  1595.                         }
  1596.                         int useCardAbilitySkillNum35 = owner.GetUseCardAbilitySkillNum(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5173);
  1597.                         if (useCardAbilitySkillNum35 > 0)
  1598.                         {
  1599.                             int num100 = Mevius.DataSheet.Api.GetResidentInteger("abilitySkill5173_0", 10) * useCardAbilitySkillNum35 * owner.GetUseCardAbilityTurnCount();
  1600.                             int residentInteger7 = Mevius.DataSheet.Api.GetResidentInteger("abilitySkill5173_1", 50);
  1601.                             if (num100 > residentInteger7)
  1602.                             {
  1603.                                 num100 = residentInteger7;
  1604.                             }
  1605.                             num98 += num100;
  1606.                         }
  1607.                         int useCardAbilitySkillNum36 = owner.GetUseCardAbilitySkillNum(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5175);
  1608.                         if (useCardAbilitySkillNum36 > 0 && BattleManager._i.GetEnemyNum(false) == 1)
  1609.                         {
  1610.                             num98 += Mevius.DataSheet.Api.GetResidentInteger("abilitySkill5175_0", 100) * useCardAbilitySkillNum36;
  1611.                         }
  1612.                         if (num98 > 0)
  1613.                         {
  1614.                             num = (int)((float)num * (1f + (float)num98 / 100f) + 0.5f);
  1615.                         }
  1616.                         if (owner.NormalAttackNum > 0)
  1617.                         {
  1618.                             if (BattleUtility.GetOptimaAbilityValue(20, out num96))
  1619.                             {
  1620.                                 num = (int)((float)num * (1f + (float)num96 / 100f) + 0.5f);
  1621.                             }
  1622.                             else if (BattleUtility.GetOptimaAbilityValue(40, out num96))
  1623.                             {
  1624.                                 num3 = (int)((float)num3 * (1f + (float)num96 / 100f) + 0.5f);
  1625.                             }
  1626.                         }
  1627.                         else if (!flag)
  1628.                         {
  1629.                             if (BattleUtility.GetOptimaAbilityValue(21, out num96))
  1630.                             {
  1631.                                 num = (int)((float)num * (1f + (float)num96 / 100f) + 0.5f);
  1632.                             }
  1633.                             else if (BattleUtility.GetOptimaAbilityValue(41, out num96))
  1634.                             {
  1635.                                 num3 = (int)((float)num3 * (1f + (float)num96 / 100f) + 0.5f);
  1636.                             }
  1637.                         }
  1638.                         else if (BattleUtility.GetOptimaAbilityValue(22, out num96))
  1639.                         {
  1640.                             num = (int)((float)num * (1f + (float)num96 / 100f) + 0.5f);
  1641.                         }
  1642.                         else if (BattleUtility.GetOptimaAbilityValue(42, out num96))
  1643.                         {
  1644.                             num3 = (int)((float)num3 * (1f + (float)num96 / 100f) + 0.5f);
  1645.                         }
  1646.                         if (owner.IsUseCardAbilitySkill(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5170))
  1647.                         {
  1648.                             num += (int)((float)num * owner.GetHpRate() * (float)Mevius.DataSheet.Api.GetResidentInteger("abilitySkill5170_0", 10) * 0.01f + 0.5f);
  1649.                         }
  1650.                         if (owner.IsUseCardAbilitySkill(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5180))
  1651.                         {
  1652.                             ElementAttributeType useCardAbilityAttribute4 = owner.GetUseCardAbilityAttribute();
  1653.                             if (useCardAbilityAttribute4 != ElementAttributeType.None)
  1654.                             {
  1655.                                 ElementAttributeType[] jobUseAttributeArray = BattleUtility.GetJobUseAttributeArray(battleActor.Deck, true);
  1656.                                 for (int k = 0; k < jobUseAttributeArray.Length; k++)
  1657.                                 {
  1658.                                     if (jobUseAttributeArray[k] == useCardAbilityAttribute4)
  1659.                                     {
  1660.                                         int[] values = battleActor.ElementalGauge.GetValues(owner.GetStatusEffectElementalGaugeEntry());
  1661.                                         float residentFloat7 = Mevius.DataSheet.Api.GetResidentFloat("abilitySkill5180_0", 1f);
  1662.                                         num += (int)((float)(num * values[(int)useCardAbilityAttribute4]) * 0.01f * residentFloat7 + 0.5f);
  1663.                                         break;
  1664.                                     }
  1665.                                 }
  1666.                             }
  1667.                         }
  1668.                         if (owner.IsUseCardAbilitySkill(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5181))
  1669.                         {
  1670.                             ElementAttributeType useCardAbilityAttribute5 = owner.GetUseCardAbilityAttribute();
  1671.                             if (useCardAbilityAttribute5 != ElementAttributeType.None)
  1672.                             {
  1673.                                 int num101 = 0;
  1674.                                 ElementAttributeType[] jobUseAttributeArray2 = BattleUtility.GetJobUseAttributeArray(battleActor.Deck, true);
  1675.                                 for (int l = 0; l < jobUseAttributeArray2.Length; l++)
  1676.                                 {
  1677.                                     if (jobUseAttributeArray2[l] == useCardAbilityAttribute5)
  1678.                                     {
  1679.                                         int[] values2 = battleActor.ElementalGauge.GetValues(owner.GetStatusEffectElementalGaugeEntry());
  1680.                                         num101 = values2[(int)useCardAbilityAttribute5];
  1681.                                         break;
  1682.                                     }
  1683.                                 }
  1684.                                 float residentFloat8 = Mevius.DataSheet.Api.GetResidentFloat("abilitySkill5181_0", 1f);
  1685.                                 num += (int)((float)(num * (300 - num101)) * 0.01f * residentFloat8 + 0.5f);
  1686.                             }
  1687.                         }
  1688.                     }
  1689.                     if (target.Bp == target.BpMax)
  1690.                     {
  1691.                         int num102 = 0;
  1692.                         int num96;
  1693.                         if (BattleUtility.GetOptimaAbilityValue(43, out num96))
  1694.                         {
  1695.                             num102 += num96;
  1696.                         }
  1697.                         int num103;
  1698.                         if (owner.GetAutoAbilityParam(DbManager.AutoAbilityType.AUTOABILITYTYPE_CS1343, out num103))
  1699.                         {
  1700.                             num102 += num103;
  1701.                         }
  1702.                         if (num102 > 0)
  1703.                         {
  1704.                             num3 = (int)((float)num3 * (1f + (float)num102 / 100f) + 0.5f);
  1705.                         }
  1706.                     }
  1707.                 }
  1708.                 if (num > 0)
  1709.                 {
  1710.                     float num104 = (float)damageSourceElem.m0a3adefa2ef034c2e9556ec82f7fa3c6() / 100f;
  1711.                     if (num104 != 0f)
  1712.                     {
  1713.                         float num105 = 0f;
  1714.                         if (!isRandMinTest)
  1715.                         {
  1716.                             num105 = BattleDamage.GetRandomSingleFloat(owner.IsPlayer());
  1717.                         }
  1718.                         float num106 = num105 * 2f * num104 - num104;
  1719.                         int num107 = (int)((float)num * num106);
  1720.                         if (num107 == 0 && (num105 <= 0.3f || 0.7f <= num105))
  1721.                         {
  1722.                             if (num105 >= 0.5f)
  1723.                             {
  1724.                                 num107 = 1;
  1725.                             }
  1726.                             else
  1727.                             {
  1728.                                 num107 = -1;
  1729.                             }
  1730.                         }
  1731.                         num += num107;
  1732.                         if (num <= 0)
  1733.                         {
  1734.                             num = 1;
  1735.                         }
  1736.                     }
  1737.                 }
  1738.                 num32 = num;
  1739.                 if (!flag8)
  1740.                 {
  1741.                     float num108 = (float)(100 - num40) * 0.01f;
  1742.                     float num109 = (float)(100 - num41) * 0.01f;
  1743.                     float num110 = (float)(100 - num42) * 0.01f;
  1744.                     float num111 = (float)(100 - num43) * 0.01f;
  1745.                     if (num108 > 1f)
  1746.                     {
  1747.                         num108 = 1f;
  1748.                     }
  1749.                     else if (target.IsPlayer())
  1750.                     {
  1751.                         if (num108 < 0.2f)
  1752.                         {
  1753.                             num108 = 0.2f;
  1754.                         }
  1755.                     }
  1756.                     else if (num108 < 0f)
  1757.                     {
  1758.                         num108 = 0f;
  1759.                     }
  1760.                     float residentFloat9 = Mevius.DataSheet.Api.GetResidentFloat("damageDefenderRateMin", 0.3f);
  1761.                     float residentFloat10 = Mevius.DataSheet.Api.GetResidentFloat("damageDefenderRateMax", 3f);
  1762.                     if (num109 < residentFloat9)
  1763.                     {
  1764.                         num109 = residentFloat9;
  1765.                     }
  1766.                     else if (num109 > residentFloat10)
  1767.                     {
  1768.                         num109 = residentFloat10;
  1769.                     }
  1770.                     float residentFloat11 = Mevius.DataSheet.Api.GetResidentFloat("damageDefenderEnemyRateMin", 0f);
  1771.                     float residentFloat12 = Mevius.DataSheet.Api.GetResidentFloat("damageDefenderEnemyRateMax", 3f);
  1772.                     if (num110 < residentFloat11)
  1773.                     {
  1774.                         num110 = residentFloat11;
  1775.                     }
  1776.                     else if (num110 > residentFloat12)
  1777.                     {
  1778.                         num110 = residentFloat12;
  1779.                     }
  1780.                     float residentFloat13 = Mevius.DataSheet.Api.GetResidentFloat("damageDefenderElementRateMin", 0.3f);
  1781.                     float residentFloat14 = Mevius.DataSheet.Api.GetResidentFloat("damageDefenderElementRateMax", 2f);
  1782.                     if (num111 < residentFloat13)
  1783.                     {
  1784.                         num111 = residentFloat13;
  1785.                     }
  1786.                     else if (num111 > residentFloat14)
  1787.                     {
  1788.                         num111 = residentFloat14;
  1789.                     }
  1790.                     if (num38 < 0.3f)
  1791.                     {
  1792.                         num38 = 0.3f;
  1793.                     }
  1794.                     else if (num38 > 2f)
  1795.                     {
  1796.                         num38 = 2f;
  1797.                     }
  1798.                     float num112 = (float)(100 - BattleUtility.GetAutoAbilityEnemyResist(owner, target)) * 0.01f;
  1799.                     float residentFloat15 = Mevius.DataSheet.Api.GetResidentFloat("damageDefenderEnemyTypeRateMin", 0.3f);
  1800.                     float residentFloat16 = Mevius.DataSheet.Api.GetResidentFloat("damageDefenderEnemyTypeRateMax", 2f);
  1801.                     if (num38 < residentFloat15)
  1802.                     {
  1803.                         num112 = residentFloat15;
  1804.                     }
  1805.                     else if (num38 > residentFloat16)
  1806.                     {
  1807.                         num112 = residentFloat16;
  1808.                     }
  1809.                     float num113 = 1f;
  1810.                     if (target.IsPlayer())
  1811.                     {
  1812.                         int num114 = 0;
  1813.                         int num115;
  1814.                         if (BattleUtility.GetOptimaAbilityValue(64, out num115))
  1815.                         {
  1816.                             num114 += num115;
  1817.                         }
  1818.                         int num116;
  1819.                         if (target.GetAutoAbilityParam(DbManager.AutoAbilityType.AUTOABILITYTYPE_CS1346, out num116))
  1820.                         {
  1821.                             num114 += num116;
  1822.                         }
  1823.                         if (num114 > 0)
  1824.                         {
  1825.                             int num117 = (1 + target.DamageCount) * num114;
  1826.                             int residentInteger8 = Mevius.DataSheet.Api.GetResidentInteger("ff13RiseGuardMax", 50);
  1827.                             if (num117 > residentInteger8)
  1828.                             {
  1829.                                 num117 = residentInteger8;
  1830.                             }
  1831.                             num113 -= (float)num117 / 100f;
  1832.                         }
  1833.                     }
  1834.                     num = (int)((float)num * num108 * num112 * num109 * num110 * num111 * num38 * num113 + 0.5f);
  1835.                 }
  1836.             }
  1837.             if (num <= 0)
  1838.             {
  1839.                 if (num32 != 0)
  1840.                 {
  1841.                     num = 1;
  1842.                 }
  1843.                 else
  1844.                 {
  1845.                     num = 0;
  1846.                 }
  1847.             }
  1848.             if (owner.IsPlayer() && target.IsEnemy())
  1849.             {
  1850.                 if (flag7)
  1851.                 {
  1852.                     damageInfo.scoreRate += Mevius.DataSheet.Api.GetResidentFloat("scoreWeaknessRate", 1.3f);
  1853.                 }
  1854.                 if (isCritical)
  1855.                 {
  1856.                     damageInfo.scoreRate += Mevius.DataSheet.Api.GetResidentFloat("scoreCriticalRate", 1.2f);
  1857.                 }
  1858.                 if (flag5)
  1859.                 {
  1860.                     damageInfo.scoreRate += Mevius.DataSheet.Api.GetResidentFloat("scoreBreakRate", 1.5f);
  1861.                 }
  1862.                 DbManager.JobCardInfo jobCardInfo = Mevius.Db.Api.GetJobCardInfoSlot(owner.Deck);
  1863.                 if (jobCardInfo != null)
  1864.                 {
  1865.                     jobCardInfo = jobCardInfo.getAvatarJobCard(owner.Deck, null);
  1866.                     uint num118 = jobCardInfo.CompleteSheetCount();
  1867.                     if (num118 > 8u)
  1868.                     {
  1869.                         num118 = 8u;
  1870.                     }
  1871.                     damageInfo.scoreRate += num118 * Mevius.DataSheet.Api.GetResidentFloat("scoreSkillCompleteRate", 0.05f);
  1872.                 }
  1873.             }
  1874.             if (owner.IsEnemy() && target.IsPlayer())
  1875.             {
  1876.                 float num119 = Mevius.DataSheet.Api.GetResidentFloat("scoreResistRate", 1.2f) * BattleUtility.GetScoreRate();
  1877.                 damageInfo.resistScore += (long)((float)(num32 - num) * num119 + 0.5f);
  1878.             }
  1879.             if (!flag2 && num > 9999 && !flag && owner.IsPlayer() && (int)damageSourceElem.m99d4196c8ddc2c84aa2a035182a3e754() != 50 && (int)damageSourceElem.m99d4196c8ddc2c84aa2a035182a3e754() != 1 && !owner.IsFlagBit((BattleActor.FlagBitType)10))
  1880.             {
  1881.                 if (owner.NormalAttackNum > 0)
  1882.                 {
  1883.                     if (!owner.IsAutoAbility(DbManager.AutoAbilityType.AUTOABILITYTYPE_CS1331))
  1884.                     {
  1885.                         num = 9999;
  1886.                     }
  1887.                 }
  1888.                 else if (!owner.IsUseCardAbilitySkill(DbManager.AbilitySkillType.ABILITYSKILL_TYPE_5151))
  1889.                 {
  1890.                     num = 9999;
  1891.                 }
  1892.             }
  1893.             if (!flag3)
  1894.             {
  1895.                 if ((int)damageSourceElem.m99d4196c8ddc2c84aa2a035182a3e754() != 50)
  1896.                 {
  1897.                     if (num > 999999)
  1898.                     {
  1899.                         num = 999999;
  1900.                     }
  1901.                 }
  1902.                 else
  1903.                 {
  1904.                     int residentInteger9 = Mevius.DataSheet.Api.GetResidentInteger("padDamageLimit", 9999999);
  1905.                     if (num > residentInteger9)
  1906.                     {
  1907.                         num = residentInteger9;
  1908.                     }
  1909.                 }
  1910.                 if (num3 > 999999)
  1911.                 {
  1912.                     num3 = 999999;
  1913.                 }
  1914.             }
  1915.             if ((int)damageSourceElem.m99d4196c8ddc2c84aa2a035182a3e754() == 1 || flag8)
  1916.             {
  1917.                 num *= -1;
  1918.                 num32 *= -1;
  1919.             }
  1920.             damageInfo.owner = owner;
  1921.             damageInfo.damage = num;
  1922.             damageInfo.breakDamage = num3;
  1923.             damageInfo.isCritical = isCritical;
  1924.             damageInfo.isWeakness = flag7;
  1925.             damageInfo.isResist = flag6;
  1926.             damageInfo.isBreak = flag5;
  1927.             damageInfo.isEnhance = isEnhance;
  1928.             damageInfo.isReduce = isReduce;
  1929.             damageInfo.isAbsorb = flag8;
  1930.             damageInfo.originalDamage = num32;
  1931.             damageInfo.powerType = (DamageSourcePowerType)damageSourceElem.ma32fcd1fe2598c2edcfa5cdbeb0eb64f();
  1932.             damageInfo.power = num5;
  1933.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement