import cocos

class Note(cocos.sprite.Sprite):

    def __init__(self, image, text="Blah"):

        super(Note, self).__init__(image)
        self.pos = None
        self.text = text
        self.positive = None
        self.target = None
        self.criteria = None
        self.part = None
        self.info = False

    def update_visibility(self, value):
        self.visible = value

    def generate_info(self, which):
        infos = {}
        infos[0] = 'Gunshots attract attention from the Police. I should be careful.'
        infos[1] = 'Keep your ammo.'
        infos[2] = 'Goats are not always what they seem.'
        infos[3] = 'Sometimes, I confuse goats and owls.'
        infos[4] = 'LdMdR Uuae!'
        infos[5] = 'My target is a dangerous socialist. He must be stopped.'
        infos[6] = 'There are too many guitar players these days'
        infos[7] = 'If the Police cannot see me, they will stop chasing me.'

        self.text = infos[which]
        self.info = True

    def generate(self, positive=True, target='color', criteria=None, part='hat'):

        self.positive = positive
        self.target = target
        self.criteria = criteria
        self.part = part

        if criteria == '_policeman':
            if part == 'hat':
                self.text = 'You should be wary of those with the strange kepi.'
            elif part == 'torso':
                self.text = 'They with the weird cape will pose problems.'
            return

        if target == 'color':
            if positive:
                if part == 'hat':
                    self.text = 'He always wears a ' + criteria[1:] + ' hat.'
                elif part == 'torso':
                    self.text = 'He never parts from his ' + criteria[1:] + ' jacket.'
                elif part == 'legs':
                    self.text = 'No one ever saw him without ' + criteria[1:] + ' trousers.'
            else:
                if part == 'hat':
                    self.text = 'His hat would never be ' + criteria[1:] + '.'
                elif part == 'torso':
                    self.text = 'I have never seen him with a ' + criteria[1:] + ' jacket.'
                elif part == 'legs':
                    self.text = 'A goat would be more likely to wear ' + criteria[1:] + ' trousers than him.'               

        elif target == 'shape':
            if positive:
                if part == 'hat':
                    if self.criteria == '_npc1':
                        self.text = 'Always wears these round hats.'
                    elif self.criteria == '_npc2':
                        self.text = 'He prefers a top hat.'
                elif part == 'torso':
                    self.text = 'Does he ever leaves his suit?'
                elif part == 'legs':
                    self.text = 'Plain trousers seem to fit him nicely.'
            else:
                if part == 'hat':
                    if self.criteria == '_npc1':
                        self.text = 'I do not think he wears those round hats.'
                    elif self.criteria == '_npc2':
                        self.text = 'He never was fond of top hats.'




