# Path: oscar/util/point.py
# class Point:
# 
#     def __init__(self, x=None, y=None):
#         self.x = x
#         self.y = y
# 
#     def squared_distance(self, other):
#         return (self.x-other.x)*(self.x-other.x) + (self.y-other.y)*(self.y-other.y)
# 
#     def distance(self, other):
#         return math.sqrt(self.squared_distance(other))
# 
#     def get_flipped(self):
#         return Point(self.y, self.x)
# 
#     def to_array(self):
#         return [self.x, self.y]
# 
#     def equals(self, other):
#         return self.x == other.x and self.y == other.y
# 
#     def difference(self, other):
#         return Point(self.x - other.x, self.y - other.y)
# 
#     def addition(self, other):
#         return Point(self.x + other.x, self.y + other.y)
# 
#     def __str__(self):
#         return "Point("+str(self.x)+","+str(self.y)+")"


import random
from oscar.constants import *
from oscar.util.point import Point


def is_enemy_visible(obs):
    player_relative = obs.observation[MINIMAP][MINI_PLAYER_RELATIVE]
    hostile_y, hostile_x = (player_relative == PLAYER_HOSTILE).nonzero()

    return len(hostile_x) > 0

def get_random_enemy_location(obs):
    player_relative = obs.observation[MINIMAP][MINI_PLAYER_RELATIVE]
    hostile_y, hostile_x = (player_relative == PLAYER_HOSTILE).nonzero()

    if len(hostile_x) == 0:
    	return None

# Path: oscar/util/point.py
# class Point:
# 
#     def __init__(self, x=None, y=None):
#         self.x = x
#         self.y = y
# 
#     def squared_distance(self, other):
#         return (self.x-other.x)*(self.x-other.x) + (self.y-other.y)*(self.y-other.y)
# 
#     def distance(self, other):
#         return math.sqrt(self.squared_distance(other))
# 
#     def get_flipped(self):
#         return Point(self.y, self.x)
# 
#     def to_array(self):
#         return [self.x, self.y]
# 
#     def equals(self, other):
#         return self.x == other.x and self.y == other.y
# 
#     def difference(self, other):
#         return Point(self.x - other.x, self.y - other.y)
# 
#     def addition(self, other):
#         return Point(self.x + other.x, self.y + other.y)
# 
#     def __str__(self):
#         return "Point("+str(self.x)+","+str(self.y)+")"


# Path: oscar/util/attack.py
import random
from oscar.constants import *
from oscar.util.point import Point



def is_enemy_visible(obs):
    player_relative = obs.observation[MINIMAP][MINI_PLAYER_RELATIVE]
    hostile_y, hostile_x = (player_relative == PLAYER_HOSTILE).nonzero()

    return len(hostile_x) > 0

def get_random_enemy_location(obs):
    player_relative = obs.observation[MINIMAP][MINI_PLAYER_RELATIVE]
    hostile_y, hostile_x = (player_relative == PLAYER_HOSTILE).nonzero()

    if len(hostile_x) == 0:
    	return None

    else: