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 Cell _cell;
    
	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._cells[i]._address;
            _board._cells[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 ClickCell(Cell CLICKED_CELL)
    {
        _playerOpponent.Challenge(CLICKED_CELL._tenant);
    }
}
