private sub dim dim dim dim dim dim dim
autocalcop() attackerop as double defenderdp as double curhops as integer curprods as integer curbiremes as double curhero as integer curgt as integer
autocalchops = 0 autocalcprods = 0 autocalcbiremes = 0 autocalcgt = 0 calculadefrawdp() calculadefmoddp() defenderdp = txtdefmoddp.text curhops = iif(txtatkhopsstay.text = "", 0, txtatkhopsstay.text) curprods = iif(txtatkprodstay.text = "", 0, txtatkprodstay.text) curbiremes = iif(txtatkbirstay.text = "", 0, txtatkbirstay.text) curhero = iif(chkatksendhero.checked = false, iif(txtatkheroop.text = "", 0, txtatkheroop.text), 0) curgt = iif(txtatkgtstay.text = "", 0, txtatkgtstay.text) attackerop = autocalculaatkmodop(autocalculaatkrawop(curhops, curprods, curbiremes, curhero, curgt)) if attackerop > defenderdp then lblautocalc.visible = false defenderdp = defenderdp / iif(autocalcatkatktotalmods = 0, 1, autocalcatkatktotalmods) if not isisland then ' checking if only hero is enough attackerop = 12 autocalculaatkmodop(autocalculaatkrawop(0, 0, 0, curhero, 0)) if attackerop > defenderdp then autocalchero = true else defenderdp = defenderdp - attackerop autocalchero = iif(txtatkheroop.text > 0, true, false) 'checking if hero + hops are enough attackerop = autocalculaatkrawop(curhops, 0, 0, 0, 0) if attackerop > defenderdp then autocalchops = (defenderdp div 3) + 1 else autocalchops = curhops defenderdp = defenderdp - attackerop
0, 0, 0)) + 1
'checking if hero + hops + prods attackerop = autocalculaatkrawop(0, curprods, 0, 0, 0) if attackerop > defenderdp then autocalcprods = (defenderdp div autocalculaatkrawop(0, 1, else
autocalcprods = curprods defenderdp = defenderdp - attackerop
'checking if hero + hops + prods + gt attackerop = autocalculaatkrawop(0, 0, 0, 0, curgt) if attackerop > defenderdp then autocalcgt = (defenderdp div atktroopop) + 1 else autocalcgt = curgt defenderdp = defenderdp - attackerop 'checking if hero + hops + prods + gt + biremes attackerop = autocalculaatkrawop(0, 0, curbiremes, 0, 0)
autocalcbiremes = (defenderdp div autocalculaatkrawop(0, 0, 1, 0, 0)) + 1 end if end if end if end if else
'checking if hero is admiral to use with carrying capacity admiral=iif(cmbatkclass.selecteditem = "admiral",1,0)
' checking if only hero is enough attackerop = autocalculaatkrawop(0, 0, 1, 0, 0) + autocalculaatkrawop(0, 0, 0, curhero, 0) if attackerop > defenderdp then autocalchero = true autocalcbiremes = 1 else defenderdp = defenderdp - autocalculaatkrawop(0, 0, 1, 0, 0)/((1+admiral)+25) - autocalculaatkrawop(0, 0, 0, curhero, 0) autocalchero = iif(txtatkheroop.text > 0, true and autocalcbiremes = 1, false) ' checking if hero + hops + biremes needed to carry are enough ' the following statement gets the hops' op, keeping in mind that for every 25 or 50, a boat needs to be sent (thus giving the virtual op) attackerop = curhops*((3*25*(1+admiral)+autocalculaatkrawop(0, 0, 1, 0, 0))/(25*(admiral+1)) if attackerop > defenderdp then autocalchops = (defenderdp div ((3*25*(1+admiral)+autocalculaatkrawop(0, 0, 1, 0, 0))/(25*(admiral+1))) + 1 autocalcbiremes = (autocalchops + autocalchero)div((1+admiral)*25+1) else ' note that we don't count boats sent yet if we fail, but we still count their op.. this should ensure that we don't end up with spare boat capacity, but still have the right results autocalchops = curhops defenderdp = defenderdp - attackerop enough
'checking if hero + hops + prods + biremes needed to carry are
attackerop = curprods*((autocalculaatkrawop(0, 1, 0, 0, 0)*25*(1+admiral)+autocalculaatkrawop(0, 0, 1, 0, 0))/(25*(admiral+1)) if attackerop > defenderdp then autocalcprods = (defenderdp div (autocalculaatkrawop(0, 1, 0, 0, 0)*25*(1+admiral)+12)/(25*(admiral+1)) + 1
autocalcbiremes = (autocalchops + autocalchero+autocalcprods)div((1+admiral)*25+1) else autocalcprods = curprods defenderdp = defenderdp - attackerop 'checking if hero + hops + prods + gt +blahblah attackerop = curgt*((autocalculaatkrawop(0, 0, 0, 0, 1)*25*(1+admiral)+autocalculaatkrawop(0, 0, 1, 0, 0))/(25*(admiral+1)) if attackerop > defenderdp then autocalcgt = (defenderdp div (autocalculaatkrawop(0, 0, 0, 0, 1)*25*(1+admiral)+12)/(25*(admiral+1)) + 1 autocalcbiremes = (autocalchops + autocalchero + autocalcprods + autocalcgt)div((1+admiral)*25+1) else autocalcgt = curgt 'need the following line to make sure biremes aren't counted twice for op.. you'll see soon autocalcbiremes = (autocalchops + autocalchero + autocalcprods + autocalcgt)div((1+admiral)*25+1) defenderdp = defenderdp - attackerop 'checking if hero + hops + prods + gt + biremes autocalcbiremes = autocalcbiremes + (defenderdp / autocalculaatkrawop(0, 0, 1, 0, 0)) end if end if end if end if end if else lblautocalc.visible = true end if chkatksendhero.checked = autocalchero txtatkhopssend.text = txtatkhopssend.text + autocalchops txtatkhopsstay.text = txtatkhopsstay.text - autocalchops txtatkprodsend.text = txtatkprodsend.text + autocalcprods txtatkprodstay.text = txtatkprodstay.text - autocalcprods txtatkbirsend.text = txtatkbirsend.text + autocalcbiremes txtatkbirstay.text = txtatkbirstay.text - autocalcbiremes txtatkgtsend.text = txtatkgtsend.text + autocalcgt txtatkgtstay.text = txtatkgtstay.text - autocalcgt end sub