mob/verb/WM()
set
name = "Windmill"
category = "skills"
for(var/mob/M in oview(1,usr))
if(usr.SkillUse == 0 && M.Attackable == 1 && usr.Saber == 1)
usr.SkillUse = 1
flick('SkillWM.dmi',usr)
var/Dmg = src.Off - M.Def
Dmg *=5
Critcheck()
if(src.crit == 1)
Dmg *= src.CritRate
M.life -= Dmg
view(M)<<"[src] hit [M] for [Dmg] Damage!"
src.crit = 0
M.Damagecheck()
M.Deathcheck()
sleep(usr.CoolDown * 5)
usr.SkillUse = 0
else return
Problem description:
My only problem is the code does not loop through all mobs in a one tile space from my character. I have tried several changes to the code, but here was my original piece that works on one mob, but not all.
What I want the code to do is hit all mobs in a one tile space from my character. An Area of Attack skill. But the darn thing just hits the one I am facing.
sleep(usr.CoolDown * 5)
Not really the best place for that to be. You want the attack to affect all within range, so you can't afford to be delaying the loop like that.
With this, if it encounters a mob that cannot be hit or the user cannot attack, it will end the skill entirely. What you want to do is skip over these mobs, which you can do with continue(). There may be certain instances where you do want the skill to stop altogether though, and for that you have break().
But as for the way you are using the SkillUse variable, I'd say you should be doing something different. Something like: