08-18-2011, 01:17 PM
Ok so as i said my math skills are not the greatest and this calculation is far from done but i had nothing better to do so i decided to try and create a calculation method for HP/MP Stealer Suction which might also work for Seals on Equipment.
This was developed out of context of the design of the emu so it will take some adapting to shove it in there.
/* Begin Create Random Double */
Random random = new Random(); // Makes a Random Statement had to google how to do this cause this not Java lol
double randomValue = random.NextDouble(); //Creates a Random Double Value 0.0 - 1.0
/* Finish Crafting Data from nothing */
int ad = 5621; //Attack Damage will be collected later from a other calculations this is just a number for reference
if (randomValue <= 0.15) randomValue = 0.15; //randomValue must be greater or equal to 0.15 to keep the Steal value Slightly realistic looking for a better way to do this...
double ac = Convert.ToDouble(ad); //In the event of Calling next method //which is unavoidable cause the idiot design
int HpCalc_Value2 = Convert.ToInt32(Convert.ToDouble(ad) * random2 / 2); //843.15 before divide by 2 after divide by 2 421.575 HpCalc_Value2 will Always be less then 5621 * 0.15
if (HpCalc_Value2 <= (5621 * 0.15)) HpCalc_Value2 = Convert.ToInt32(ac * 0.65); //Might have done something Wrong here but Seems to work to the advantage o.o?
decimal HpCalc_Value3 = Convert.ToDecimal(HpCalc_Value2);
if (Math.Round(HpCalc_Value3) <= 0) HpCalc_Value3 = 1; //Anti Zero Protection cause IDKWTF would Happen if this Returned a zero xD
int HpCalc_ReturnValue = Convert.ToInt32(HpCalc_Value3);
Heres the Output from one run of this baby! (1000 calculations)

3654, 3654, 3654, 1239, 1239, 1239, 1239, 1239, 1239, 1239, 1239, 1239, 1239, 1239, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 1787, 1787, 1787, 1787, 1787, 1787, 1787, 2796, 2796, 2796, 2796, 2796, 2796, 2796, 2796, 2796, 2336, 2336, 2336, 2336, 2336, 2336, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 1083, 1083, 1083, 1083, 1083, 1083, 1083, 1083, 1083, 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091, 1631, 1631, 1631, 1631, 1631, 1631, 2640, 2640, 2640, 2640, 2640, 2640, 2640, 2640, 2640, 2180, 2180, 2180, 2180, 2180, 2180, 2180, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 1386, 1386, 1386, 1386, 1386, 1386, 1386, 1386, 1386, 926, 926, 926, 926, 926, 926, 926, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1475, 1475, 1475, 1475, 1475, 1475, 1475, 2483, 2483, 2483, 2483, 2483, 2483, 2483, 2483, 2483, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 1778, 1778, 1778, 1778, 1778, 1778, 1778, 1778, 1778, 2787, 2787, 2787, 2787, 2787, 2787, 2787, 2327, 2327, 2327, 2327, 2327, 2327, 2327, 2327, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 1073, 1073, 1073, 1073, 1073, 1073, 1073, 1073, 1073, 2082, 2082, 2082, 2082, 2082, 2082, 2082, 1622, 1622, 1622, 1622, 1622, 1622, 1622, 1622, 2630, 2630, 2630, 2630, 2630, 2630, 2630, 2630, 2630, 2170, 2170, 2170, 2170, 2170, 2170, 2170, 2170, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 1377, 1377, 1377, 1377, 1377, 1377, 1377, 1377, 1377, 917, 917, 917, 917, 917, 917, 917, 1925, 1925, 1925, 1925, 1925, 1925, 1925, 1925, 1465, 1465, 1465, 1465, 1465, 1465, 2474, 2474, 2474, 2474, 2474, 2474, 2474, 2474, 2474, 2474, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 1220, 1220, 1220, 1220, 1220, 1220, 1220, 1220, 1220, 1220, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 1769, 1769, 1769, 1769, 1769, 1769, 1769, 1769, 1769, 1769, 1769, 1769, 1769, 2777, 2777, 2777, 2777, 2777, 2777, 2777, 2777, 2777, 2777, 2777, 2777, 2777, 2317, 2317, 2317, 2317, 2317, 2317, 2317, 2317, 2317, 2317, 2317, 2317, 2317, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 1064, 1064, 1064, 1064, 1064, 1064, 1064, 1064, 1064, 1064, 1064, 1064, 1064, 1064, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 2072, 1613, 1613, 1613, 1613, 1613, 1613, 1613, 1613, 1613, 1613, 1613, 1613, 1613, 2621, 2621, 2621, 2621, 2621, 2621, 2621, 2621, 2621, 2621, 2621, 2621, 2161, 2161, 2161, 2161, 2161, 2161, 2161, 2161, 2161, 2161, 2161, 2161, 2161, 2161, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 1367, 1367, 1367, 1367, 1367, 1367, 1367, 1367, 1367, 1367, 1367, 1367, 1367, 1367, 908, 908, 908, 908, 908, 908, 908, 908, 908, 908, 908, 1916, 1916, 1916, 1916, 1916, 1916, 1916, 1916, 1916, 1916, 1916, 1916, 1456, 1456, 1456, 1456, 1456, 1456, 1456, 1456, 1456, 1456, 1456, 2465, 2465, 2465, 2465, 2465, 2465, 2465, 2465, 2465, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 1211, 1211, 1211, 1211, 1211, 1211, 1211, 1211, 1211, 1211, 1211, 1211, 1211, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 1760, 1760, 1760, 1760, 1760, 1760, 1760, 1760, 1760, 2768, 2768, 2768, 2768, 2768, 2768, 2768, 2768, 2768, 2308, 2308, 2308, 2308, 2308, 2308, 2308, 2308, 2308, 2308, 2308, 2308, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 1055, 1055, 1055, 1055, 1055, 1055, 1055, 1055, 1055, 1055, 1055, 1055, 1055, 2063, 2063, 2063, 2063, 2063, 2063, 2063, 2063, 2063, 2063, 1603, 1603, 1603, 1603, 1603, 1603, 1603, 1603, 1603, 1603, 1603, 1603, 2612, 2612, 2612, 2612, 2612, 2612, 2612, 2612, 2612, 2612, 2612, 2612, 2152, 2152, 2152, 2152, 2152, 2152, 2152, 2152, 2152, 2152, 2152, 2152, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 1358, 1358, 1358, 1358, 1358, 1358, 1358, 1358, 1358, 1358, 1358, 1358, 1358, 898, 898, 898, 898, 898, 898, 898, 898, 898, 898, 898, 898, 1907, 1907, 1907, 1907, 1907, 1907, 1907, 1907, 1907, 1907, 1447, 1447, 1447, 1447, 1447, 1447, 1447, 1447, 1447, 1447, 1447, 1447, 2455, 2455, 2455, 2455, 2455, 2455, 2455, 2455, 2455, 2455, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 1202, 1202, 1202, 1202, 1202, 1202, 1202, 1202, 1202, 1202, 1202, 1202, 1202, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 1750, 1750, 1750, 1750, 1750, 1750, 1750, 1750, 1750, 1750, 1750, 1750, 2759, 2759, 2759, 2759, 2759, 2759, 2759, 2759, 2759, 2759, 2759, 2759, 2759, 2299, 2299, 2299, 2299, 2299, 2299, 2299, 2299, 2299, 2299, 2299, 2299, 2299, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 1594, 1594, 1594, 1594, 1594, 1594, 1594, 1594, 1594, 1594, 2602, 2602, 2602, 2602, 2602, 2602, 2602, 2602, 2602, 2602, 2602, 2143, 2143, 2143, 2143, 2143, 2143, 2143, 2143, 2143, 2143, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 3654, 1349, 1349, 1349, 1349, 1349, 1349, 1349, 1349, 1349, 1349, 889, 889, 889, 889, 889, 889, 889, 889, 889, 889, 889, 889, 889, 889, 1897, 1897, 1897, 1897, 1897, 1897, 1897, 1897,
about the value returning zero it should not happen but in the event another area of code goes a muck i put it in there just to be safe
might also add in that if a zero does occur it writes an error to the console saying that a said value came back zero(idk just thinking of ideas)very messy still very new to the idea go easy on it please.

Notes: Require adjustments for higher damage, Must not allow for CurHp gain to exceed MaxHP, Timing Values to be generated for Stealing time, work more on making the calculation so that it is more realistic maybe a decrease of .65 to .45 could manage to even the output.


