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

public partial class Example1 : Action
{

    public override void _Ready()
    {
        base._Ready();
    }

    public override void Fire()
    {
        base.Fire();
        // GD.Print(_owner);
        List<Shield> unbrokenShields = [.. _contact._owner._board._shields.Where(s=>!s._broken)];
        int shieldNumber = Globals._rng.Next(0, unbrokenShields.Count);
        int damageAmount = Globals._rng.Next(-12,-8);
        _contact._owner._board._shields[shieldNumber].ChangeHealth(damageAmount);
        ((Player)_contact._owner)._phone._debug.Text = "Shield " + shieldNumber + " damaged " + damageAmount + "hp";
    }
}
