class Game_Interpreter
def region_count(region_id, distance)
x = $game_player.x
y = $game_player.y
(-distance..distance).inject(0) do |result, dx|
dy_max = distance - dx.abs
(-dy_max..dy_max).count { |dy|
$game_map.region_id(x + dx, y + dy) == region_id
} + result
end
end
end
class Game_Interpreter
def region_count(region_id, distance)
x = $game_player.x
y = $game_player.y
(-distance..distance).inject(0) do |result, dx|
dy_max = distance - dx.abs
(-dy_max..dy_max).count { |dy|
$game_map.region_id(x + dx, y + dy) == region_id
} + result
end
end
end