﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AcademyRPG
{
    class Giant:Character,IGatherer,IFighter
    {
        public Giant(string name, Point position)
            : base(name, position, 0)
        {
            HitPoints = 200;
            hasRock = false;
        }

        private bool hasRock;

        public bool TryGather(IResource resource)
        {
            if (resource.Type == ResourceType.Stone)
            {
                hasRock = true;
                return true;
            }

            return false;
        }

        public int AttackPoints
        {
            get { return hasRock?250:150; }
        }

        public int DefensePoints
        {
            get { return 80; }
        }

        public int GetTargetIndex(List<WorldObject> availableTargets)
        {
            for (int i = 0; i < availableTargets.Count; i++)
            {
                if (availableTargets[i].Owner != this.Owner && availableTargets[i].Owner != 0)
                {
                    return i;
                }
            }

            return -1;
        }
        
    }
}
