
class HereticWeapon : Weapon
{
	Default
	{
		Weapon.Kickback 150;
	}
}


// Skull (Horn) Rod ---------------------------------------------------------

class SkullRod : HereticWeapon
{
	Default
	{
		Weapon.SelectionOrder 200;
		Weapon.AmmoUse1 1;
		Weapon.AmmoGive1 50;
		Weapon.YAdjust 15;
		Weapon.AmmoType1 "SkullRodAmmo";
		Weapon.SisterWeapon "SkullRodPowered";
		Inventory.PickupMessage "$TXT_WPNSKULLROD";
		Tag "$TAG_SKULLROD";
	}

	action native void A_FireSkullRodPL1();

	States
	{
	Spawn:
		WSKL A -1;
		Stop;
	Ready:
		HROD A 1 A_WeaponReady;
		Loop;
	Deselect:
		HROD A 1 A_Lower;
		Loop;
	Select:
		HROD A 1 A_Raise;
		Loop;
	Fire:
		HROD AB 4 A_FireSkullRodPL1;
		HROD B 0 A_ReFire;
		Goto Ready;
	}
}

class SkullRodPowered : SkullRod
{
	Default
	{
		+WEAPON.POWERED_UP
		Weapon.AmmoUse1 5;
		Weapon.AmmoGive1 0;
		Weapon.SisterWeapon "SkullRod";
		Tag "$TAG_SKULLRODP";
	}

	action native void A_FireSkullRodPL2();

	States
	{
	Fire:
		HROD C 2;
		HROD D 3;
		HROD E 2;
		HROD F 3;
		HROD G 4 A_FireSkullRodPL2;
		HROD F 2;
		HROD E 3;
		HROD D 2;
		HROD C 2 A_ReFire;
		Goto Ready;
	}
}

// Horn Rod FX 1 ------------------------------------------------------------

class HornRodFX1 : Actor
{
	Default
	{
		Radius 12;
		Height 8;
		Speed 22;
		Damage 3;
		Projectile;
		+WINDTHRUST
		-NOBLOCKMAP
		RenderStyle "Add";
		SeeSound "weapons/hornrodshoot";
		DeathSound "weapons/hornrodhit";
		Obituary "$OB_MPSKULLROD";
	}

	States
	{
	Spawn:
		FX00 AB 6 BRIGHT;
		Loop;
	Death:
		FX00 HI 5 BRIGHT;
		FX00 JK 4 BRIGHT;
		FX00 LM 3 BRIGHT;
		Stop;
	}
}


// Horn Rod FX 2 ------------------------------------------------------------

class HornRodFX2 : Actor
{
	Default
	{
		Radius 12;
		Height 8;
		Speed 22;
		Damage 10;
		Health 140;
		Projectile;
		RenderStyle "Add";
		SeeSound "weapons/hornrodpowshoot";
		DeathSound "weapons/hornrodpowhit";
		Obituary "$OB_MPPSKULLROD";
	}

	native void A_AddPlayerRain();
	native void A_HideInCeiling();
	native void A_SkullRodStorm();

	States
	{
	Spawn:	
		FX00 C 3 BRIGHT;
		FX00 D 3 BRIGHT A_SeekerMissile(10, 30);
		FX00 E 3 BRIGHT;
		FX00 F 3 BRIGHT A_SeekerMissile(10, 30);
		Loop;
	Death:
		FX00 H 5 BRIGHT A_AddPlayerRain;
		FX00 I 5 BRIGHT;
		FX00 J 4 BRIGHT;
		FX00 KLM 3 BRIGHT;
		FX00 G 1 A_HideInCeiling;
		FX00 G 1 A_SkullRodStorm;
		Wait;
	}
	
	override int DoSpecialDamage (Actor target, int damage, Name damagetype)
	{
		Sorcerer2 s2 = Sorcerer2(target);
		if (s2 != null && random[HornRodFX2]() < 96)
		{ // D'Sparil teleports away
			s2.DSparilTeleport ();
			return -1;
		}
		return damage;
	}
	
}

// Rain pillar 1 ------------------------------------------------------------

class RainPillar : Actor native
{
	Default
	{
		Radius 5;
		Height 12;
		Speed 12;
		Damage 5;
		Mass 5;
		Projectile;
		-ACTIVATEPCROSS
		-ACTIVATEIMPACT
		RenderStyle "Add";
		Obituary "$OB_MPPSKULLROD";
	}

	native void A_RainImpact();

	States
	{
	Spawn:
		FX22 A -1 BRIGHT;
		Stop;
	Death:
		FX22 B 4 BRIGHT A_RainImpact;
		FX22 CDEF 4 BRIGHT;
		Stop;
	NotFloor:
		FX22 GHI 4 BRIGHT;
		Stop;
	}
}

// Rain tracker "inventory" item --------------------------------------------

class RainTracker : Inventory native
{
	Default
	{
		+INVENTORY.UNDROPPABLE
	}
}


// Phoenix Rod --------------------------------------------------------------

class PhoenixRod : Weapon native
{
	Default
	{
		+WEAPON.NOAUTOFIRE
		Weapon.SelectionOrder 2600;
		Weapon.Kickback 150;
		Weapon.YAdjust 15;
		Weapon.AmmoUse 1;
		Weapon.AmmoGive 2;
		Weapon.AmmoType "PhoenixRodAmmo";
		Weapon.Sisterweapon "PhoenixRodPowered";
		Inventory.PickupMessage "$TXT_WPNPHOENIXROD";
		Tag "$TAG_PHOENIXROD";
	}

	action native void A_FirePhoenixPL1();

	States
	{
	Spawn:
		WPHX A -1;
		Stop;
	Ready:
		PHNX A 1 A_WeaponReady;
		Loop;
	Deselect:
		PHNX A 1 A_Lower;
		Loop;
	Select:
		PHNX A 1 A_Raise;
		Loop;
	Fire:
		PHNX B 5;
		PHNX C 7 A_FirePhoenixPL1;
		PHNX DB 4;
		PHNX B 0 A_ReFire;
		Goto Ready;
	}
}

class PhoenixRodPowered : PhoenixRod native
{
	Default
	{
		+WEAPON.POWERED_UP
		+WEAPON.MELEEWEAPON
		Weapon.SisterWeapon "PhoenixRod";
		Weapon.AmmoGive 0;
		Tag "$TAG_PHOENIXRODP";
	}

	action native void A_InitPhoenixPL2();
	action native void A_FirePhoenixPL2();
	action native void A_ShutdownPhoenixPL2();

	States
	{
	Fire:
		PHNX B 3 A_InitPhoenixPL2;
	Hold:
		PHNX C 1 A_FirePhoenixPL2;
		PHNX B 4 A_ReFire;
	Powerdown:
		PHNX B 4 A_ShutdownPhoenixPL2;
		Goto Ready;
	}
}

// Phoenix FX 1 -------------------------------------------------------------

class PhoenixFX1 : Actor
{
	Default
	{
		Radius 11;
		Height 8;
		Speed 20;
		Damage 20;
		DamageType "Fire";
		Projectile;
		+THRUGHOST
		+SPECIALFIREDAMAGE
		SeeSound "weapons/phoenixshoot";
		DeathSound "weapons/phoenixhit";
		Obituary "$OB_MPPHOENIXROD";
	}

	native void A_PhoenixPuff();

	States
	{
	Spawn:
		FX04 A 4 BRIGHT A_PhoenixPuff;
		Loop;
	Death:
		FX08 A 6 BRIGHT A_Explode;
		FX08 BC 5 BRIGHT;
		FX08 DEFGH 4 BRIGHT;
		Stop;
	}
	
	override int DoSpecialDamage (Actor target, int damage, Name damagetype)
	{
		Sorcerer2 s2 = Sorcerer2(target);
		if (s2 != null && random[HornRodFX2]() < 96)
		{ // D'Sparil teleports away
			s2.DSparilTeleport ();
			return -1;
		}
		return damage;
	}
	
}

// Phoenix puff -------------------------------------------------------------

class PhoenixPuff : Actor
{
	Default
	{
		+NOBLOCKMAP
		+NOGRAVITY
		+NOTELEPORT
		+CANNOTPUSH
		RenderStyle "Translucent";
		Alpha 0.4;
	}

	States
	{
	Spawn:
		FX04 BCDEF 4;
		Stop;
	}
}

// Phoenix FX 2 -------------------------------------------------------------

class PhoenixFX2 : Actor native
{
	Default
	{
		Radius 6;
		Height 8;
		Speed 10;
		Damage 2;
		DamageType "Fire";
		Projectile;
		RenderStyle "Add";
		Obituary "$OB_MPPPHOENIXROD";
	}

	native void A_FlameEnd();
	native void A_FloatPuff();

	States
	{
	Spawn:
		FX09 ABABA 2 BRIGHT;
		FX09 B 2 BRIGHT A_FlameEnd;
		FX09 CDEF 2 BRIGHT;
		Stop;
	Death:
		FX09 G 3 BRIGHT;
		FX09 H 3 BRIGHT A_FloatPuff;
		FX09 I 4 BRIGHT;
		FX09 JK 5 BRIGHT;
		Stop;
	}
}

