﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Simulator.ItemHandler;
using Simulator.Social;

namespace Simulator.Goals
{
    [Serializable]
    class attractSuitor : Goal
    {
        public List<NPC> potentialSuiters = new List<NPC>();
        public NPC primeSuitor = null;
        public override void finish()
        {
            Character.Relationships.WantsToMarry = primeSuitor;
        }

        public override string Message()
        {
            string result = Character.firstName + " is now attracted to";
            if(primeSuitor != null)
            {
                Character.Relationships.tryToAdvanceRelationshipWith(primeSuitor);
                result = Character.firstName + " is now attracted to " + primeSuitor.firstName + " Compatability is " + Social.CompareNPCs.CompareRomance(Character, primeSuitor);
            }
            return result;
        }
        public override bool Completed()
        {
            return Social.CompareNPCs.CompareRomance(Character, primeSuitor) > 90;
        }
        public override bool Verify()
        {
            return true;
        }
        public override void startUp()
        {
            if(Verify())
            {
                float best = 0;
                foreach(NPC suitor in _G._City._NPCs)
                {
                    if(Character.NPCID != suitor.NPCID)
                    {

                        float compare = Social.CompareNPCs.CompareRomance(Character, suitor);
                        if(compare > best)
                        {
                            best = compare;
                            primeSuitor = suitor;
                        }
                    }
                }
                //_G.goalMessages.Add(this.Message());
            }
            else
            {
                Failed = true;
            }

        }
    }
}
