﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using lewt.Entity;
using OldSkool;

namespace lewt.CharacterClasses {
    public class Brute : CharacterClass {
        public Dictionary<Attributes, Ref<float>> BaseAttributes(Ref<int> Level) {
            Dictionary<Attributes, Ref<float>> table=new Dictionary<Attributes, Ref<float>>();
            table.Add( Attributes.Health, new Var<float>( 100 ) );
            table.Add( Attributes.HealthRegen, new Var<float>( 2 ) );
            table.Add( Attributes.Energy, new Var<float>( 100 ) );
            table.Add( Attributes.EnergyRegen, new Var<float>( 100 ) );
            table.Add( Attributes.Speed, new Var<float>( 500.0f ) );
            table.Add( Attributes.Block, new Var<float>( 10.0f ) );
            table.Add( Attributes.Evasion, new Var<float>( 10.0f ) );
            table.Add( Attributes.Luck, new Var<float>( 10.0f ) );
            table.Add( Attributes.Defense, new Var<float>( 1.0f ) );
            table.Add( Attributes.Attack, new Var<float>( 15 ) );
            return table;
        }

        public String Name { get { return "Brute"; } }
        public int BaseMovementCooldownAfterSpecial { get { return 500; } }
        public int BaseCooldown(Entity.XAction action) {
            if (action==XAction.BasicAttack) return 1500;
            if (action==XAction.AdvancedAttack) return 5000;
            if (action==XAction.Special1) return 6000;
            return 250;
        }
        public ExecuteActionResult ExecuteAction(BaseCharacter me, Dungeon dungeon, XAction action) {
            BaseCharacter enemy=dungeon.findClosestOfTeam( me.OtherTeam, me.X, me.Y );
            if (enemy==null) return ExecuteActionResult.DoesNotApply;
            if (enemy.DistanceTo( me )<=2) {
                if (action==XAction.BasicAttack)
                    enemy.Attack( dungeon, me, me.BasicAttackDamage );
                if (action==XAction.AdvancedAttack && me.CanExpend(50)) {
                    enemy.Attack( dungeon, me, me.BasicAttackDamage*2 );
                }
                return ExecuteActionResult.Executed;
            }
            return ExecuteActionResult.DoesNotApply;
        }

        public XAction RecommendAction(BaseCharacter me, Func<XAction, bool> canPerform) {
            if (canPerform( XAction.AdvancedAttack ) && me.CanExpend(50))
                return XAction.AdvancedAttack;
            return XAction.BasicAttack;
        }
        public void NotifyDealtDamange(Dungeon dungeon, BaseCharacter me, BaseCharacter victim, float damageTaken) {

        }
    }
}
