LCKB
Ok so my math skills are not the greatest... - Printable Version

+- LCKB (https://lckb.dev/forum)
+-- Forum: ** OLD LCKB DATABASE ** (https://lckb.dev/forum/forumdisplay.php?fid=109)
+--- Forum: Off-Topic (The Outer World) (https://lckb.dev/forum/forumdisplay.php?fid=198)
+---- Forum: General Discussion (https://lckb.dev/forum/forumdisplay.php?fid=147)
+---- Thread: Ok so my math skills are not the greatest... (/showthread.php?tid=135)



- illusionist - 08-18-2011


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) Big Grin

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 Big Grin 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. Smile

 

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.




- illusionist - 08-18-2011


Well i did a last minute tweak before i wanted to go to sleep and here is the line i changed.

 

if (HpCalc_Value2 <= (5621 * 0.14)) HpCalc_Value2 = Convert.ToInt32(ac * 0.20 * .95);

 

print out from this was more realistic for 5k damage still needs a lot of work i am gonna try 10,000 calculations with a few modifications and see what it gives me.




- Ariel - 08-18-2011

adding to my server?




- illusionist - 08-18-2011

I would not add this to anything just yet Lol its far from done. :/




- piscina - 08-19-2011


The HP/MP stealer have 30% probability of suction:

 

1. HP stealer: 5% of dmg done

2. MP stealer: 5% max mana

 

The acc stealer seals work:

 

1. Each seal has a 5% chance of suction x%

2. You must add the probabilities of each seal

3 The suction of life or mana works as a block, ie if you have 3 SOL (3% suction each seal) then you have a 15% chance of suction 9% dmg done




- megachombas - 08-19-2011


pickit, contact me for the calculations.

 

coz, for the moment, its not random at all lol, it seems its follow a logical order. i havent look the code yet, but seeing in the test of 100, not random.




- illusionist - 08-22-2011

This was a first attempt really had no where to start from but days pass my understanding grows my will to get this project going increases thanks for all the info Smile also i think i was like 90% asleep cause it was 6 am in the morning and i had been awake like 23 hours Sad