Code:
d = vec_dist (my.x,you.x);
my.health -= (1000 - d) * some_factor_to_control_the_strength * (d < 1000);


1000 is the maximum damage radius