#--------------------------------------------------------------------------
# * Scope Range#技能范围
#Scope Range
#--------------------------------------------------------------------------
def scope_range?(user,target)
t_r2 = [user.screen_x, user.screen_y] rescue nil
t_r3 = [target.screen_x, target.screen_y] rescue nil
return false if t_r2 == nil or t_r3 == nil
s_r = [0,0,0,0] ; s_p = [0,0]
s_r = [$1.to_i,$2.to_i,$3.to_i,$4.to_i,$5.to_i] if @item.object.note =~ /<SR:(\d+):(\d+)-(\d+)-(\d+)-(\d+)>/
#if SCOPE_TYPE > 0
s_p = [target.sprite_size[0] / 2, target.sprite_size[1]]
s_p[0] = s_p[0] * SPRITE_SIZE_RANGE[0] / 100
s_p[1] = s_p[1] * SPRITE_SIZE_RANGE[1] / 100
#end
case s_r[0]
when 1#矩形
return false if !t_r3[0].between?(t_r2[0] - (s_r[1] + s_p[0]), t_r2[0] + (s_r[2] + s_p[0]))
return false if !t_r3[1].between?(t_r2[1] - s_r[3], t_r2[1] + s_r[4] + s_p[1])
when 2#菱形
# <Scope Range = X1 - X2 - Y1 - Y2>
#
# Y1
#
# X1 X2
#
# Y2
#
# Ex -> <Scope Range = (100 - 32 - 64 - 32>
return false if !t_r3[0].between?(t_r2[0] - (s_r[1] + s_p[0]), t_r2[0] + (s_r[2] + s_p[0]))
if t_r3[0]<t_r2[0]#在横坐标负半轴上
return false if !t_r3[1].between?(-s_r[3]/s_r[1]*t_r3[0]-s_r[3],s_r[4]+s_r[4]/s_r[1]*t_r3[0])
else
return false if !t_r3[1].between?(s_r[3]/s_r[2]*t_r3[0]-s_r[3],s_r[4]-s_r[4]/s_r[2]*t_r3[0])
end
when 3#圆形
end
return true
end
end