Attack Problems in Developer Help
|
|
Code:
proc battle(mob/attacker, mob/victim) if(victim.stats) var/dmg = round(attacker.stats["Strength"] * rand(1/2, 3/2) + rand(1, 3)- \ victim.stats["Defense"] * rand(1/2, 3/2) + rand(1, 3)) var/dodge = round(attacker.stats["Speed"] * rand(1/2, 3/2) + rand(1, 3)- \ victim.stats["Speed"] * rand(1/2, 3/2) + rand(1, 3)) if(dodge <= 0) chat("[_m] [pick(dodgemessages)] [m]'s attack.", "battleoutput", view()) else if(dmg <= 0) chat("[_m] [pick(blockmessages)] [m]'s attack.", "battleoutput", view()) else victim.stats["Health"] -= dmg chat("[m] [pick(attackmessages)] [_m].", "battleoutput", view())
|
Problem description:
I made some messages that output the dodge and dmg variables to me. Even when the dmg variable is 0 the dmg line runs instead of the block line(last if/else statement).
|