Entities/Blocks/BlockSquidPierce.cs
namespace BlockParty;

/// <summary>
/// Squid variant whose rotating beam ignores blocks, obstacles, and arena walls, stopping only at
/// living hardened players. The beam renders above obstacle faces but beneath the outer wall
/// and out-of-bounds mask, with a short overshoot beyond the arena to avoid attached-obstacle gaps.
/// </summary>
public sealed class BlockSquidPierce : BlockSquid
{
	static readonly Color TRACER_COLOR = new( 0.34f, 0.22f, 0.46f );
	static readonly Color CORE_COLOR = new( 0.82f, 0.62f, 1f );
	static readonly Color GLOW_COLOR = new( 0.42f, 0.16f, 0.92f );

	protected override Color BeamTracerColor => TRACER_COLOR;
	protected override Color BeamCoreColor => CORE_COLOR;
	protected override Color BeamGlowColor => GLOW_COLOR;
	protected override float BeamArenaOvershoot => Arena.WALL_SIZE;
	protected override bool RendersTailUnderBlocks => false;
	protected override bool CanBeamKill( Player player ) => !player.IsHardened;
	// The beam pierces walls, but a shot straight into the wall we're resting on still reads as a dud.
	protected override AimAvoid FreshAimAvoids => AimAvoid.Walls;

	protected override float BeamGlowLocalZ( bool underBlocks )
		=> Globals.DEPTH_WALL + 0.25f - Globals.DEPTH_BLOCK;
	protected override float BeamCoreLocalZ( bool underBlocks )
		=> Globals.DEPTH_WALL + 0.35f - Globals.DEPTH_BLOCK;
	protected override float BeamSparkLocalZ( bool underBlocks )
		=> Globals.DEPTH_WALL + 0.45f - Globals.DEPTH_BLOCK;

	protected override IEnumerable<Entity2D> BeamBlockers()
	{
		foreach ( Player player in Stage.Players )
			if ( player.IsHardened && !player.IsDead )
				yield return player;
	}
}