using Godot;
using System;
using System.Collections.Generic;
using System.Linq;

public partial class Dragon : Enemy
{
    // public int _number;
    // public Board _board;
    public List<Mook> _mooks;
    // public Player _playerOpponent;
    // public Shield _shield;
    
	public override void _Ready()
	{
        base._Ready();
		_mooks = GetChildren().Where(c=>c is Mook).Cast<Mook>().ToList();
        for (int i = 0; i < _mooks.Count; i++)
        {
            _mooks[i]._owner = this;
            _mooks[i]._number = _board._shields[i]._address;
            _board._shields[i]._tenant = _mooks[i];
        }
	}

    public void Challenge()
    {
        _playerOpponent.Challenge(this);
    }

    public override void PassPlayer(Player PLAYER)
    {
        base.PassPlayer(PLAYER);
        _mooks.ForEach(m=>m.PassPlayer(PLAYER));
        
    }

    public override void ClickShield(Shield CLICKED_SHIELD)
    {
        _playerOpponent.Challenge(CLICKED_SHIELD._tenant);
    }
}
