things/enemies/SpikerElite.cs

Enemy subclass for an elite Spiker. It configures stats, visuals, AI ranges, timers and behavior overrides specific to the Elite variant.

Networking
using System;
using System.Drawing;
using Sandbox;

public class SpikerElite : Spiker
{
	public override EnemyType EnemyType => EnemyType.SpikerElite;
	public override float GetMaxHealth()
	{
		switch ( Manager.Instance.Difficulty )
		{
			case 0: default: return 205f;
			case 1: return 215f;
			case 2: return 220f;
		}
	}

	public override Vector3 SpawnScale => new Vector3( 1.5f );

	public override float SpawnZPos => -150f;

	public override int ExtraDeathBloodSprayAmount => 20;
	public override float ParticleYPosOverride => 0.4f;
	public override float StunParticleYPosOverride => 1f;

	protected override void OnStart()
	{
		base.OnStart();

		CoinValueMin = 6;
		CoinValueMax = 9;
		CoinChance = 1f;

		PushStrength = 9500f;
		Weight = 1.75f;

		_personalSpeedScale = Game.Random.Float( 0.75f, 0.85f );
		_personalSpeedFreq = Game.Random.Float( 7f, 9f );

		_projectileName = "spiker_head_elite";
		_crackParticleColor = new Color( 0.01f, 0.005f, 0.01f );

		if ( IsProxy )
			return;

		AggroRange = 60f;
		DetectTargetRange = 900f;
		LoseTargetRange = 1300f;
		LoseTargetTime = 7f;
		MeleeDamage = Utils.Select( Manager.Instance.Difficulty, 12f, 13f, 14f );
		DamageTargetDelay = 0.6f;
		_personalTurnSpeed = Game.Random.Float( 4f, 6f );
		Acceleration = 150f;
		AccelerationAttacking = 160f;
		Deceleration = 2.4f;
		DecelerationAttacking = 2.2f;

		_shootDelayMin = 2f;
		_shootDelayMax = 7f;
		_shootRange = 700f;
		_maxExtraHeadDist = 23f;

		_digDelayMin = 5f;
		_digDelayMax = 10f;
		_digRange = 900f;
		_digTime = 1.5f;
		_digOffsetMin = 200f;
		_digOffsetMax = 500f;

		_shootDelayTimer = Game.Random.Float( _shootDelayMin, _shootDelayMax );
		_digDelayTimer = Game.Random.Float( _digDelayMin, _digDelayMax );

		_moveClockwise = Game.Random.Int( 0, 1 ) == 0;
	}

	protected override void StartShooting()
	{
		base.StartShooting();

		SetPlaybackRate( 0.75f );
	}
}