# BP Calculation

Feb 18th, 2019
110
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
2.  public static int RemoveExcessDamage(int CurrentDamage, Player Attacker, Player Opponent)
3.         {
4.             if (Opponent.PlayerFlag != PlayerFlag.Player)
5.                 return CurrentDamage;
6.             if (Opponent.Reborn == 1)
7.                 CurrentDamage = (int)Math.Round((double)(CurrentDamage * 0.7));
8.             else if (Opponent.Reborn == 2)
9.                 CurrentDamage = (int)Math.Round((double)(CurrentDamage * 0.5));
10.             CurrentDamage = (int)Math.Round((double)(CurrentDamage * (1.00 - (Opponent.ItemBless * 0.01))));
11.
12.             return CurrentDamage;
13.         }
14.         public static int BattlePowerCalculation(int damage, int battlepowerExcess)
15.         {
16.             if (battlepowerExcess == 0)
17.                 return damage;
18.
19.             if (battlepowerExcess < -50)
20.                 battlepowerExcess = -50;
21.
22.             if (battlepowerExcess > 50)
23.                 battlepowerExcess = 50;
24.
25.             return damage + (damage * battlepowerExcess / 100);
26.         }
27.
28. in Meleè/Ranged Only Region Player -> Player
29. if (attacker.PlayerFlag == PlayerFlag.Player && attacked.PlayerFlag == PlayerFlag.Player)
30.
32.  //
33.                 #region Tortoise
34.                 if (attacked.PlayerFlag == PlayerFlag.Player)
35.                 {
36.                     if (Damage > 0)
37.                     {
38.                         Damage -= (Int32)(Math.Floor((Double)Damage * attacked.GemBonus(ItemSocket.Tortoise)));
39.                     }
40.                 }
41.                 #endregion
42.                 #region Elements
43.                 try
44.                 {
45.                     if (attacked.PlayerFlag == PlayerFlag.Player)
46.                     {
47.                         int mr = (int)attacked.MetalResistance * 2;
48.                         int wr = (int)attacked.WaterResistance * 2;
49.                         int wd = (int)attacked.WoodResistance * 2;
50.                         int fr = (int)attacked.FireResistance * 2;
51.                         int er = (int)attacked.EarthResistance * 2;
52.
53.                         Damage -= mr;
54.                         Damage -= fr;
55.                         Damage -= wd;
56.                         Damage -= er;
57.                         Damage -= wr;
58.
59.                     }
60.                     if (Damage <= 0)
61.                         Damage = 1;
62.                 }
63.                 catch (Exception E)
64.                 {
65.                     Console.WriteLine(E);
66.                 }
67.                 #endregion
68.                 Damage = BattlePowerCalculation((int)Damage, attacker.BattlePower - attacked.BattlePower);
69.                 Damage = RemoveExcessDamage((int)Damage, attacker, attacked);
70.                 if (attacked.PlayerFlag == PlayerFlag.Monster)
71.                 {
72.                     if (Damage >= 700 * attacked.MaxHitpoints)
73.                         Damage = (int)(700 * attacked.MaxHitpoints);
74.                 }
75.                 //
76.
77. Finish :d
78.
79. All Right Reserved Pezzi Tomas OverConquer Source (C) 2019
RAW Paste Data