__author__ = 'Daniel'


def find_spell_target(game, filter_function):

    targets = game.other_player.minions.copy()
    targets.extend(game.current_player.minions)
    targets.append(game.other_player.hero)
    targets.append(game.current_player.hero)

    targets = [target for target in targets if filter_function(target)]
    return targets


def find_battlecry_target(game, filter_function):
    targets = game.other_player.minions.copy()
    targets.extend(game.current_player.minions)
    targets.append(game.other_player.hero)
    targets.append(game.current_player.hero)

    targets = [target for target in targets if filter_function(target)]
    return targets


def find_enemy_spell_target(game, filter_function):

    targets = game.other_player.minions.copy()
    targets.append(game.other_player.hero)

    targets = [target for target in targets if filter_function(target)]
    return targets


def find_friendly_spell_target(game, filter_function):

    targets = game.current_player.minions.copy()
    targets.append(game.current_player.hero)

    targets = [target for target in targets if filter_function(target)]
    return targets


def find_minion_spell_target(game, filter_function):
    targets = game.other_player.minions.copy()
    targets.extend(game.current_player.minions)

    targets = [target for target in targets if filter_function(target)]
    return targets


def find_minion_battlecry_target(game, filter_function):
    targets = game.other_player.minions.copy()
    targets.extend(game.current_player.minions)
    targets = [target for target in targets if filter_function(target)]
    if len(targets) is 0:
        return None

    return targets


def find_enemy_minion_spell_target(game, filter_function):

    targets = game.other_player.minions.copy()

    targets = [target for target in targets if filter_function(target)]
    return targets


def find_enemy_minion_battlecry_target(game, filter_function):
    targets = game.other_player.minions.copy()
    targets = [target for target in targets if filter_function(target)]
    if len(targets) is 0:
        return None
    return targets


def find_friendly_minion_battlecry_target(game, filter_function):
    targets = game.current_player.minions.copy()
    targets = [target for target in targets if filter_function(target)]
    if len(targets) is 0:
        return None
    return targets
    
def find_friendly_hero_battlecry_target(game):
    targets = game.current_player.hero
    targets = [target for target in targets if filter_function(target)]
    if len(targets) is 0:
        return None
    return targets
    
def find_enemy_hero_battlecry_target(game):
    targets = game.other_player.hero
    targets = [target for target in targets if filter_function(target)]
    if len(targets) is 0:
        return None
    return targets

@@ -1297,16 +1297,20 @@
 inions)%0A
+    
 %0A    tar
@@ -1539,32 +1539,37 @@
 player.minions)%0A
+    %0A
     targets = %5Bt
@@ -1743,33 +1743,32 @@
 lter_function):%0A
-%0A
     targets = ga
@@ -1798,16 +1798,233 @@
 .copy()%0A
+    %0A    targets = %5Btarget for target in targets if filter_function(target)%5D%0A    return targets%0A%0A    %0Adef find_friendly_minion_spell_target(game, filter_function):%0A    targets = game.current_player.minions.copy()%0A    
 %0A    tar
@@ -2100,33 +2100,32 @@
 return targets%0A%0A
-%0A
 def find_enemy_m
@@ -2210,32 +2210,37 @@
 .minions.copy()%0A
+    %0A
     targets = %5Bt
@@ -2353,33 +2353,32 @@
 return targets%0A%0A
-%0A
 def find_friendl
@@ -2468,32 +2468,37 @@
 .minions.copy()%0A
+    %0A
     targets = %5Bt
@@ -2701,32 +2701,37 @@
 ent_player.hero%0A
+    %0A
     targets = %5Bt
@@ -2933,24 +2933,29 @@
 player.hero%0A
+    %0A
     targets 

Update targeting.py