ID:143654
 
Code:
ob/verb/Attack(mob/M in oview(1))
set category = "Skills"
if(M.koed == 1)
return
else
if(usr.attackdelay == 1)
return
else
if(prob(usr.reactions + usr.offense - M.reactions - M.defense + 10))//All of this adds up to the chance they have to landa hit
usr << "[M] has dodged your attack."
M << "You have dodged [usr]'s attack."
KOcheck()
attackdelay()
addstats()
else
if(prob(usr.strength + usr.offense + usr.reactions - M.reactions - M.defense - M.endurance + 20))//Same
usr << "[M] has blocked your attack."
M << "You have blocked [usr]'s attack."
M.health -= usr.strength + usr.offense + 2 - M.endurance - M.defense
KOcheck()
attackdelay()
addstats()
else
if(prob(usr.reactions + usr.offense + 5 - M.reactions - M.defense ))//Same
usr << "[M] counters your attack."
M << "You counter [usr]'s attack."
if(M.reactions + M.defense < usr.defense + usr.reactions)
usr.health -= 1
KOcheck()
attackdelay()
addstats()
else
usr.health -= M.reactions + M.defense - usr.reactions - usr.defense
KOcheck()
attackdelay()
addstats()
else
usr << "You attack [M]."
M << "[usr] attacks you."
M.health -= usr.strength + usr.offense - M.endurance
if(usr.strength + usr.offense < M.endurance)
M.health -= 1
KOcheck()
attackdelay()
addstats()
else
KOcheck()
attackdelay()
addstats()


Problem description: Sorry for the huge amount of code. I just want to be sure if those are right. What I'm talking about is where the probability is. I mean, say usr.reactions = 10, usr.strength = 10, M.reactions = 5, M.defense = 5. Now, I want it to caluclate it so it gives a realistic answer. Bah, I know I'm not explaining this too well...What I want to know is if usr.reactions + usr.strength - M.reactions - M.defense, for example, will give me 10, or will the defense subtract from the reactions to give me a full 20. This probably sounds stupid, but I just don't want the complete opposite to happen. Thanks.

Did you ever think of simply testing that equation out to see what you'd get? It's a lot faster than waiting for a response on the forums.

On the other hand, DM follows order of operations, so you'll get 10.

-TKL
In response to Kangchao
*Shrugs.* I did. Just wanted to be sure though. And thanks.