|  Heinz Doofenshertz
 BetaMax.
 
 596
 
 
      | Posted - 2013.12.16 05:15:00 -
          [1] - Quote 
 Ok The following is a commented version of the Logic I use for damage application in my compare tool, I am told I go overboard. However, I feel this is the best way to make sure you are getting the right numbers. I have removed the SQL queries for DB security, anyway feel free to use said logic, as long as you throw my name in someplace :P This logic is in edited Coldfusion format, sorry, if you have any questions please ask, But I wanted to show people how much more complex this stuff is than just hp/dps
 
 cfset shibon = 0 //setting varriable//
 cfset mc = 1 //setting varriable//
 cfset armbon = 0 //setting variable//
 cfset md = 1 //setting varriable//
 cfset spa = .87 //stacking penalty for second mod//
 cfset spb = .57 //stacking penalty for a third mod//
 cfset spc = .28 //stacking penalty for a fourth mod//
 cfset check = 0 //setting varriable//
 cfset checka = 0 //setting varriable//
 cfset adjshi = #get_vehic.shield# //setting base shield value//
 cfset adjarm = #get_vehic.armor# //setting base armor value//
 
 cfloop index="i" from="1" to="#hslot#" //looping thru the high slots//
 cfset test = '#Evaluate( "hard#i#" )#' //setting varriable test to the id for a query to come//
 cfif test is "none" /checking to see if the variable test is empty//
 
 cfelse
 
 //Query ommited for DB security purposes//
 
 cfset mtype = #get_mod_i.type# //setting the mod type for further parsing//
 cfif mtype is 1 //checking mod type 1 is the shield resistance//
 cfif check is 0 //using check variable as a mod number//
 cfset mc = mc - #get_mod_i.bonus# // setting mc equal to reduction//
 cfset check = check + 1 //adding 1 to the mod check value//
 
 cfelseif check is 1 //checking for further mods of this type//
 cfset spaa = spa * #get_mod_i.bonus# //sets the variable ammount//
 cfset mc = mc GÇô spaa //modifies the bonus//
 cfset check = check + 1 //adds to the check counter//
 
 cfelseif check is 2 //checking for another mod of this type//
 cfset spbb = spb * #get_mod_i.bonus#
 cfset mc = mc - spbb
 cfset check = check + 1
 
 cfelseif check is 3 //checking for another mod of this type//
 cfset spcc = spc * #get_mod_i.bonus#
 cfset mc = mc - spcc
 cfset check = check + 1
 /cfif
 
 cfelseif mtype is 2 //checking for mod type 2 shield extenders//
 cfset shibon = shibon + #get_mod_i.bonus# //adds the bonus shields to the total//
 
 cfelseif mtype is 3 //checks for mod type 3 sheild rep//
 cfset srep = #get_mod_i.bonus# //sets the rep ammount//
 
 /cfif
 /cfif
 /cfloop
 
 cfloop index="a" from="1" to="#lslot#" //looping the low slots//
 cfset testa = '#Evaluate( "lard#a#" )#' //setting the test variable to the proper uid//
 cfif testa is "none" //checking to see if that slot has mods in it//
 
 cfelse
 
 //SQL Query removed for DB security//
 
 cfset mtype = #get_mod_a.type# //setting the mod type//
 cfif mtype is 1 //Checking if mod type is 1 armor resistances//
 cfif checka is 0 // checking the check counter//
 cfset md = md * #get_mod_a.bonus# //setting the bonus//
 cfset checka = checka + 1 //adding to the check ammount//
 
 cfelseif check is 1 //checking the check ammount//
 cfset apaa = apa * #get_mod_a.bonus# //setting the variable//
 cfset md = md GÇô apaa //modifing the final variable//
 cfset checka = checka + 1 //stepping the check//
 
 cfelseif check is 2 //checking the ammount//
 cfset apbb = apb * #get_mod_a.bonus#
 cfset md = md - apbb
 cfset checka = checka + 1
 
 cfelseif check is 3 //checking the amount//
 cfset apcc = apc * #get_mod_a.bonus#
 cfset md = md - apcc
 cfset checka = checka + 1
 /cfif
 
 cfelseif mtype is 2 //checking if type 2 armor plates//
 cfset armbon = armbon + #get_mod_a.bonus#
 
 cfelseif mtype is 3 //checking for rep//
 cfset arep = #get_mod_a.bonus#
 
 /cfif
 /cfif
 /cfloop
 
 cfset fshi = adjshi + shibon //adjusting the total shield ammount//
 cfset farm = adjarm + armbon //adjusting the total armor ammount//
 
 cfset tankshield = fshi //setting the final variable, for reasons//
 cfset tankarmor = farm //setting the final varriable, for reasons//
 
 /cfif
 
 cfset shots = 0 //setting shot counter//
 cfset sshottime = 0 //setting shield shot time//
 cfset ashottime = 0 //setting armor shot time//
 cfset sshots = 0 //setting shield shot number//
 cfset ashots = 0 //setting armor shot number//
 cfset reptimer = 1 //setting the base rep timer//
 
 cfset asdmg = tdmg * mc //adjusting dmg ammount by shield resistances//
 cfset sdmg = asdmg * #get_dmg.shield# //adjusting dmg ammount by dmg type//
 cfloop condition="tankshield gt 0" //looping thru the following as long as shields remain//
 cfset tankshield = tankshield - sdmg //stepping the dmg//
 cfset shots = shots + 1 //adding to the shot//
 cfset sshottime = sshottime + #get_wep.sps# //adding to the shot time//
 
 cfif shots is #get_wep.clip# //checking for clip//
 cfset sshots = sshots + shots //adjusting the shots used on shield//
 cfset shots = 0 //reseting the shots//
 cfset sshottime = sshottime + #get_wep.reload# //adding reload//
 /cfif
 cfif sshots is 1 //checking to see is a shot has been made//
 cfif srep gt 0 //checking if there is a shield rep//
 cfset tankshield = tankshield + srep //repping shields//
 /cfif
 /cfif
 cfif tankshield lt 0 //checking to see if the shields have been removed//
 cfset carry = tankshield //setting the carry over dmg//
 /cfif
 cfif sshots gt 1200 //checking if it's taking way to long//
 cfset tankshield = 0 //kills the shields to move to armor//
 cfset kicked = 1 //sets the kick variable saying it's been kicked//
 /cfif
 /cfloop
 
 continued in next post
 
 Dust514 Stats, Have you updated today? I do maths, and sit in a corner. | 
      
      
        |  Heinz Doofenshertz
 BetaMax.
 
 596
 
 
      | Posted - 2013.12.16 05:18:00 -
          [2] - Quote 
 cfset carry = carry / #get_dmg.shield# //adjusting the shield dmg change out//
 cfset carry = carry * #get_dmg.armor# //adjusting carry to armor//
 cfset aadmg = tdmg * md //setting the armor dmg//
 cfset admg = aadmg * #get_dmg.armor# //adjust dmg again//
 cfset tankarmor = tankarmor GÇô carry //removing the carry ammount//
 cfif kicked is 0 //checking for kicked//
 cfif admg lt arep //checking the dmg vs the passive regen//
 cfset kicked = 1 //kicking//
 cfelse
 cfloop condition="tankarmor gt 0" //looping thru the armor//
 cfset tankarmor = tankarmor - admg //stepping dmg//
 cfset shots = shots + 1 //adding to the shot count//
 cfset ashottime = ashottime + #get_wep.sps# //stepping the shot time//
 cfif ashottime gt reptimer //checking for rep time//
 cfloop condition="ashottime gt reptimer" //looping the rep//
 cfset tankarmor = tankarmor + arep //repping//
 cfset reptimer = reptimer + 1 //stepping the rep timer//
 /cfloop
 /cfif
 
 cfif shots is #get_wep.clip# //checking the clip//
 cfset ashots = ashots + shots //stepping shot count//
 cfset shots = 0 //resetting the shot count//
 cfset ashottime = ashottime + #get_wep.reload# //stepping the time with reload//
 /cfif
 
 cfif tankarmor lt 0 //checking for armor value//
 cfset wasted = tankarmor //setting the wasted dmg//
 /cfif
 cfif ashots gt 1200 //checking for kick//
 cfset tankarmor = 0 //stepping armor to kick loop//
 cfset kicked = 1 //setting kick//
 /cfif
 /cfloop
 
 cfset ttime = ashottime + sshottime //setting total time//
 cfif ashots is 0 //checking to see if not time was spent on armor//
 
 cfif sshots is 0 //checking to see if no time was spent on shields//
 cfset tshots = shots //fall back to number of shots fired//
 cfelse
 cfset tshots = ashots + sshots //setting shots//
 /cfif
 cfelse
 cfset tshots = ashots + sshots //setting shots//
 /cfif
 cfset wast = wasted * -1 //making the wasted dmg a positive number so people understand it//
 /cfif
 /cfif
 
 
 If you Have any questions about the logic, sugestions or whatever. please feel free to post below. I want to get this out there so all the people making tool that do HP/ehp, ect will be able to give people the best numbers possible. Base hp is easy, ehp is crap if you are going the give hp/time numbers please do it properly. I am willing to help, just let me know.
 
 Dust514 Stats, Have you updated today? I do maths, and sit in a corner. |