mob
var
adelay=55
onadelay=0
mob
verb
A()
if(src.onadelay)
return
else
flick("Attack1",src)
for(var/mob/M in get_step(src,src.dir))
var/damage=(usr.Strength*2)
view(M)<<"[M] has been hit for [damage]!"
M.TakeDamage(damage,src)
src.onadelay=1
sleep(src.adelay)
src.onadelay=0
Problem description:
Well, like I said in previous topics, my coding skill isn't the greatest. I'm trying to set a thing that monitors punching speed, but I'm not sure exactly how to do it.
Passive Name: Melee Speed
Passive Description: Melee Speed determines the delay between your punches
Passive Values: 0/10
How to Train: By punching
Stat Reqs: 5 Agi
Class: Parent
Notes: Those below 15 Agility will not be able to exceed 6/10. Melee Delay decreases by 5 per point(reducing speed from 55 to 5 at 10). At 10/10, delay is almost unnoticable
This is a description of the passive that dictates melee speed. What could I set in the melee code(more specifically, in the sleep proc I have in there) that reduces melee's delay based on the melee speed(src.MeleeSpeed) passive?
The format X?Y:Z can be thought as a compact-if() statement, which translates to if(X){return Y}else{return Z}
Here, if Agi is < 15, min() will return 6 at most. If Agi >= 15, up to 10 is possible.
Really, this needs to be fixed. As it is currently, only if Agi < 6 will the value be lower. Between 6-14, the agi will be 6 (as 6 will be picked via min()). >= 15 will be 10 due to min()
An example of all of the above together:
Mind you, this is just an example. You just have to break everything down, translate it and piece it together (like transcription/translation of DNA)