Attack(var/mob/target in get_step(src, src.dir))
set category = "Skills"
if(bounds_dist(src, target) <= 16)
if(!Attacking && Chi >= 10)
Attacking = 1
flick("Attack", src)
var/hit = max(1, (50 * ((BP * Offense) / (target.BP * target.Defense))))
if(prob(hit))
var/Damage = max(1, round((BP * Strength) - (target.BP * (target.Durability/1.5))))
target.TakeDamage(Damage, src)
Spar(src, target)
else
flick("Dodge", target)
Chi -= 10
sleep(20/Speed) // Stopping consecutive attacks
Attacking = 0
Problem description:
This here is the Attack verb I wrote, all of the calculations work fine, but I changed it up not too long ago and things just keep going downhill.
My problem really is, I'm using pixel movement in my game and that allows multiple mobs to be on one tile. I'd like to have it attack the closest, and VISUALLY closest mob from it.
Like this, it doesn't even attack anything even though its selected.
Can anyone help me out or point me in the right direction with this?
And see which one is closest.
Also, just a note for good practice: Don't use src in verbs unless it is necessary, which is not very often.