/*
===BURAN===

My personal sidearm. Rapid fire and compact.
Squeeze trigger for burstfire, hold for full auto.
Fires slower flechettes if I lack ammo.

Better than his sidearm, I will remind him of this.

===MAGSWORD===

Buran's power source, forms a crystalline blade for close range fighting.
Sharp, unbreakable.
Can be used to parry oncoming attacks with good timing.
Can be augmented to fire energy waves.

He bested me before with his own sword, I intend to return the favor.
*/

ACTOR Buran : Weapon
{
	+Weapon.AMMO_OPTIONAL
	+Weapon.ALT_AMMO_OPTIONAL
	+Weapon.noalert
	+undroppable
	+cheatnotweapon
	Weapon.SlotNumber 1
	Weapon.SelectionOrder 60
	Weapon.AmmoUse 1
	Weapon.AmmoGive 20
	Weapon.AmmoType "Clip"
	Weapon.BobStyle smooth
	Weapon.BobRangeX 0.1
	Weapon.BobRangeY 0.6
	Weapon.BobSpeed 2
	Inventory.PickupMessage "Recovered Buran."
	Obituary "%k shredded %o."
	Inventory.RestrictedTo "Deriver"
	Tag "Buran"
	States
	{
	Select:
		TNT1 A 0
	Riseup:
		TNT1 AA 0 A_Raise
		TNT1 AAAAA 0 A_Raise
		TNT1 A 1
		loop
	
	Ready:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory ("BuranStack",40,"DropMag")
		TNT1 A 0 A_PlaySound ("Buran/Draw",0,0.80)
		BRN1 ABCDE 1 A_WeaponReady
		TNT1 A 0 A_PlaySound ("Buran/Spin",0,0.60)
		BRN1 FGHIJKLMNOPQ 1 A_WeaponReady
		Goto RealReady
	SilentReady:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory ("BuranStack",40,"DropMag")
		BRN1 ABCDE 1 A_WeaponReady
		TNT1 A 0 A_PlaySound ("Buran/Spin",0,0.60)
		BRN1 FGHIJKLMNOPQ 1 A_WeaponReady
		Goto RealReady
	Deselect:
		TNT1 A 0
		TNT1 A 0 A_JumpIfHealthLower (1, "DeadLower")
		TNT1 A 0 A_PlaySound ("Buran/Spin",0,0.60)
		BRNX ABCDEFG 1
		TNT1 A 0 A_PlaySound ("Buran/Holster",0,0.80)
	holster:
		TNT1 A 0
		TNT1 A 1 A_Lower
		TNT1 AAA 0 A_Lower
		TNT1 A 1 A_Lower
		loop
	DeadLower:
		TNT1 A 0
		TNT1 A 0
		TNT1 AAAAAAAAAAAAA 0 A_Lower
		TNT1 A 0 A_StopSound (6)
		TNT1 A 1 A_Lower
		wait
	RealReady:
		BRN2 A 1 A_WeaponReady
		Loop
	Fire:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory ("BuranStack",40,"DropMag")
		TNT1 A 0 A_JumpIfInventory ("Clip",1, "SilverBurst")
		TNT1 A 0 A_FireBullets (0,0,1,0,"DeriverFlickPuff",FBF_NOFLASH)
		TNT1 A 0 A_AlertMonsters
		TNT1 A 0 A_GunFlash ("OrangeFlash",GFF_NOEXTCHANGE)
		BRN3 B 1 Bright A_FireCustomMissile ("DeriverFlechette",0,0,0,0,0)
		TNT1 A 0 A_GiveInventory ("BuranStack",1)
		TNT1 A 0 A_Quake (1, 2, 0, 32)
		BRN3 C 2 Bright
		TNT1 A 0 A_JumpIfInventory ("BuranStack",40,"DropMag")
		TNT1 A 0 A_FireBullets (0,0,1,0,"DeriverFlickPuff",FBF_NOFLASH)
		TNT1 A 0 A_GunFlash ("OrangeFlash",GFF_NOEXTCHANGE)
		BRN3 B 1 Bright A_FireCustomMissile ("DeriverFlechette",0,0,0,0,0)
		TNT1 A 0 A_GiveInventory ("BuranStack",1)
		TNT1 A 0 A_Quake (1, 2, 0, 32)
		BRN3 C 2 Bright
		TNT1 A 0 A_JumpIfInventory ("BuranStack",40,"DropMag")
		TNT1 A 0 A_FireBullets (0,0,1,0,"DeriverFlickPuff",FBF_NOFLASH)
		TNT1 A 0 A_GunFlash ("OrangeFlash",GFF_NOEXTCHANGE)
		BRN3 B 1 Bright A_FireCustomMissile ("DeriverFlechette",0,0,0,0,0)
		TNT1 A 0 A_GiveInventory ("BuranStack",1)
		TNT1 A 0 A_Quake (1, 2, 0, 32)
		TNT1 A 0 A_JumpIfInventory ("BuranStack",40,"DropMag")
		BRN3 C 2 Bright
		TNT1 A 0 A_JumpIfInventory ("BuranStack",40,"DropMag")
		TNT1 A 0 A_FireBullets (0,0,1,0,"DeriverFlickPuff",FBF_NOFLASH)
		TNT1 A 0 A_GunFlash ("OrangeFlash",GFF_NOEXTCHANGE)
		BRN3 B 1 Bright A_FireCustomMissile ("DeriverFlechette",0,0,0,0,0)
		TNT1 A 0 A_GiveInventory ("BuranStack",1)
		TNT1 A 0 A_Quake (1, 2, 0, 32)
		TNT1 A 0 A_JumpIfInventory ("BuranStack",40,"DropMag")
		BRN3 CD 1 Bright A_WeaponReady (WRF_NOPRIMARY)	
		BRN3 E 1 A_WeaponReady (WRF_NOPRIMARY)	
		BRN2 FG 1 A_WeaponReady (WRF_NOPRIMARY)	
		TNT1 A 0 A_Refire ("RapidFire")
		BRN2 A 3 A_WeaponReady (WRF_NOPRIMARY)
		Goto RealReady

	RapidFire:
		TNT1 A 0 A_FireBullets (0,0,1,0,"DeriverFlickPuff",FBF_NOFLASH)
		TNT1 A 0 A_AlertMonsters
		TNT1 A 0 A_GunFlash ("OrangeFlash",GFF_NOEXTCHANGE)
		BRN3 B 1 A_FireCustomMissile ("DeriverFlechette",FRandom(-2,2),0,0,0,0,Frandom(-1,1))
		TNT1 A 0 A_GiveInventory ("BuranStack",1)
		TNT1 A 0 A_Quake (1, 2, 0, 32)
		BRN3 CD 1 Bright
		TNT1 A 0 A_JumpIfInventory ("BuranStack",40,"DropMag")
		TNT1 A 0 A_Refire ("RapidFire")
		BRN3 CD 1 Bright A_WeaponReady (WRF_NOPRIMARY)	
		BRN3 E 1 A_WeaponReady (WRF_NOPRIMARY)	
		BRN2 FG 1 A_WeaponReady (WRF_NOPRIMARY)	
		goto RealReady
		

	//----------------------------------------------------------------------
	//Hitscan attacks
	//----------------------------------------------------------------------
	SilverBurst:
		TNT1 A 0
		TNT1 A 0 A_GunFlash ("SilverFlash",GFF_NOEXTCHANGE)
		BRN2 B 1 Bright A_FireBullets (0,0,-1,10,"DVPuff", FBF_USEAMMO|FBF_NORANDOM)
		TNT1 A 0 A_GiveInventory ("BuranStack",1)
		TNT1 A 0 A_TakeInventory ("TossedMag",99)
		TNT1 A 0 A_Quake (1, 2, 0, 32)
		TNT1 A 0 A_AlertMonsters
		BRN2 C 2 Bright
		TNT1 A 0 A_JumpIfNoAmmo ("DropMag")
		TNT1 A 0 A_JumpIfInventory ("BuranStack",40,"DropMag")
		TNT1 A 0 A_GunFlash ("SilverFlash",GFF_NOEXTCHANGE)
		BRN2 B 1 Bright A_FireBullets (0,0,-1,10,"DVPuff", FBF_USEAMMO|FBF_NORANDOM)
		TNT1 A 0 A_GiveInventory ("BuranStack",1)
		TNT1 A 0 A_Quake (1, 2, 0, 32)
		BRN2 C 2 Bright
		TNT1 A 0 A_JumpIfNoAmmo ("DropMag")
		TNT1 A 0 A_JumpIfInventory ("BuranStack",40,"DropMag")
		TNT1 A 0 A_GunFlash ("SilverFlash",GFF_NOEXTCHANGE)
		BRN2 B 1 Bright A_FireBullets (0,0,-1,10,"DVPuff", FBF_USEAMMO|FBF_NORANDOM)
		TNT1 A 0 A_GiveInventory ("BuranStack",1)
		TNT1 A 0 A_Quake (1, 2, 0, 32)
		BRN2 C 2 Bright
		TNT1 A 0 A_JumpIfNoAmmo ("DropMag")
		TNT1 A 0 A_JumpIfInventory ("BuranStack",40,"DropMag")
		TNT1 A 0 A_GunFlash ("SilverFlash",GFF_NOEXTCHANGE)
		BRN2 B 1 Bright A_FireBullets (0,0,-1,10,"DVPuff", FBF_USEAMMO|FBF_NORANDOM)
		TNT1 A 0 A_GiveInventory ("BuranStack",1)
		TNT1 A 0 A_Quake (1, 2, 0, 32)
		BRN2 CD 1 Bright
		BRN2 EFG 1
		TNT1 A 0 A_JumpIfNoAmmo ("DropMag")
		TNT1 A 0 A_JumpIfInventory ("BuranStack",40,"DropMag")
		TNT1 A 0 A_Refire ("SilverRapidFire")
		BRN2 A 3 A_WeaponReady (WRF_NOPRIMARY)
		Goto RealReady
	SilverRapidFire:
		TNT1 A 0 A_GunFlash ("SilverFlash",GFF_NOEXTCHANGE)
		BRN2 B 1 Bright A_FireBullets (3.5,1.5,1,10,"DVPuff", FBF_USEAMMO|FBF_NORANDOM)
		TNT1 A 0 A_GiveInventory ("BuranStack",1)
		TNT1 A 0 A_Quake (1, 2, 0, 32)
		TNT1 A 0 A_AlertMonsters
		BRN2 CD 1 Bright
		TNT1 A 0 A_JumpIfNoAmmo ("DropMag")
		TNT1 A 0 A_JumpIfInventory ("BuranStack",40,"DropMag")
		TNT1 A 0 A_Refire ("SilverRapidFire")
		BRN2 CD 1 Bright A_WeaponReady (WRF_NOPRIMARY)	
		BRN2 EFG 1 A_WeaponReady (WRF_NOPRIMARY)	
		goto RealReady


	//----------------------------------------------------------------------
	//Reloading
	//----------------------------------------------------------------------
	DropMag:
		BRN4 AB 2 A_WeaponReady (WRF_NOPRIMARY)
		TNT1 A 0 A_GiveInventory ("BuranStack", 40)
		TNT1 A 0 A_GunFlash ("BuranMagSpawner",GFF_NOEXTCHANGE)
		BRN4 CDD 1 A_WeaponReady (WRF_NOPRIMARY)
		BRN4 E 4 A_WeaponReady (WRF_NOPRIMARY)
		BRN4 F 2 A_WeaponReady (WRF_NOPRIMARY)
		TNT1 A 0 A_JumpIfInventory ("Clip",1,"LoadMag")
		BRN5 ABC 1 A_WeaponReady (WRF_NOPRIMARY)
		BRN5 DE 2 A_WeaponReady (WRF_NOPRIMARY)
		TNT1 A 0 A_TakeInventory ("BuranStack",99)
		TNT1 A 0 A_PlaySound ("Buran/Slide",0,0.85)
		BRN5 FGH 2 A_WeaponReady (WRF_NOPRIMARY)
		BRN4 OP 2 A_WeaponReady (WRF_NOPRIMARY)
		Goto RealReady
	LoadMag:
		BRN4 GHI 1 A_WeaponReady (WRF_NOPRIMARY)
		BRN4 J 2 A_WeaponReady (WRF_NOPRIMARY)
		TNT1 A 0 A_TakeInventory ("BuranStack",99)
		TNT1 A 0 A_PlaySound ("Buran/Load",0,0.80)
		TNT1 A 0 A_TakeInventory ("TossedMag",99)
		BRN4 KLMN 2 A_WeaponReady (WRF_NOPRIMARY)
		BRN4 OP 2 A_WeaponReady (WRF_NOPRIMARY)
		Goto RealReady


	//----------------------------------------------------------------------
	//Actual gunflashes 
	//----------------------------------------------------------------------
	SilverFlash:
		TNT1 A 0
		TNT1 A 0 A_GiveInventory ("UsingDeriverGun",1)
		TNT1 A 0 ACS_NamedExecuteAlways("DeriverAmmoWarn",0,0,0,0)
		TNT1 A 0 A_PlaySound ("Buran/Fire", 6)
		BFL1 ABC 1 bright
		Stop
	OrangeFlash:
		TNT1 A 0
		TNT1 A 0 A_GiveInventory ("UsingDeriverGun",1)
		TNT1 A 0 ACS_NamedExecuteAlways("DeriverAmmoWarn",0,0,0,0)
		TNT1 A 0 A_PlaySound ("Buran/Flechette", 6)
		BFL2 ABC 1 bright
		Stop
		
	//----------------------------------------------------------------------
	//Gunflashes to spawn magazines
	//----------------------------------------------------------------------
	BuranMagSpawner:
		TNT1 A 0 
		TNT1 A 0 A_JumpIfInventory ("TossedMag",1, "NoMag")
		TNT1 A 1 A_FireCustomMissile("BuranMagDropper",0,0,-9,9)
		TNT1 A 0 A_PlaySound ("Buran/Eject",0,0.50)
		TNT1 A 0 A_PlaySound ("Buran/Ping",0,0.15)
		TNT1 A 0 A_GiveInventory ("TossedMag",1)
		TNT1 A 1
		Stop
	NoMag:
		TNT1 A 0
		TNT1 A 1
		TNT1 A 0 A_PlaySound ("Buran/DryEject",0,0.45)
		TNT1 A 1
		Stop
		
		
		
	AltFire:
		TNT1 A 2
		Goto ParryStance
	AltFireEnd:
		TNT1 A 0
		TNT1 A 2 A_WeaponReady
		Goto SilentReady
	
	//********************************************************************
	//********************************************************************
	//INHERITANCE STUFF BELOW
	//********************************************************************
	//********************************************************************
	ParryStance:
		TNT1 A 3 
		TNT1 A 0 A_Refire ("Slash1")
		TNT1 A 0 A_PlaySound ("MagSword/Parry",5)
		TNT1 A 0 A_GiveInventory ("UsingParry",1)
		TNT1 A 0 A_FireCustomMissile ("BladeDefense",0,0)
		MGS4 A 1 A_FireCustomMissile ("BladeDefense",0,0)
		TNT1 A 0 A_JumpIfInventory ("BladeParried", 1, "MagParry")
		MGS4 B 1 A_FireCustomMissile ("BladeDefense",0,0)
		TNT1 A 0 A_JumpIfInventory ("BladeParried", 1, "MagParry")
		MGS4 C 1 A_FireCustomMissile ("BladeDefense",0,0)
		TNT1 A 0 A_JumpIfInventory ("BladeParried", 1, "MagParry")
		MGS4 D 1 A_JumpIfInventory ("BladeParried", 1, "MagParry")
		TNT1 A 0 A_FireCustomMissile ("BladeDefense",0,0)
		MGS4 E 1 A_JumpIfInventory ("BladeParried", 1, "MagParry")
		MGS4 E 1 A_JumpIfInventory ("BladeParried", 1, "MagParry")
		MGS4 E 1 A_JumpIfInventory ("BladeParried", 1, "MagParry")
		MGS4 E 1 A_JumpIfInventory ("BladeParried", 1, "MagParry")
		MGS4 F 5 
		TNT1 A 0 A_PlaySound ("MagSword/ParryEnd",5)
		MGS4 GHI 2 A_WeaponReady (WRF_NOSECONDARY)
		TNT1 A 1 A_Jump (256,"AltfireEnd")
		Goto AltFireEnd
	MagParry:
		MGS5 A 1 A_PlaySound ("MagSword/Block",5)
		TNT1 A 0 A_GunFlash ("ParryCheck",GFF_NOEXTCHANGE)
		MGS5 B 1 A_Recoil (7)
		MGS5 CDCDCD 1 A_WeaponReady (WRF_NOSECONDARY|WRF_NOSWITCH)
		MGS5 D 3 A_WeaponReady (WRF_NOSECONDARY|WRF_NOSWITCH)
		TNT1 A 0 A_TakeInventory ("BladeParried",99)
		TNT1 A 0 A_JumpIfInventory ("PowerStrength",1,"CounterAttack")
		MGS5 EFGHIJK 2 A_WeaponReady (WRF_NOSWITCH)
		TNT1 A 1 A_Jump (256,"AltfireEnd")
		Goto AltFireEnd

		
	Slash1:
		MGS1 A 1 A_GiveInventory ("UsingMagSword",1)
		MGS1 B 1 A_FireCustomMissile ("DeriverSlash1",0,0)
		TNT1 A 0 A_PlaySound ("MagSword/Swing",0)
		TNT1 A 0 A_JumpIfInventory ("PowerStrength",1,2)
		TNT1 A 0 A_Jump (256,2)
		TNT1 A 0 A_PlaySound ("MagSword/ZerkSwing",0,0.60)
		MGS1 CDEF 1
		TNT1 A 7
		TNT1 A 0 A_Refire ("Slash2")
		TNT1 A 1 A_Jump (256,"SwordSheathe")
		Goto RealReady
	Slash2:
		MGS2 A 1 A_GiveInventory ("UsingMagSword",1)
		MGS2 A 1
		MGS2 B 1 A_FireCustomMissile ("DeriverSlash2",0,0)
		TNT1 A 0 A_PlaySound ("MagSword/Swing",0)
		TNT1 A 0 A_JumpIfInventory ("PowerStrength",1,2)
		TNT1 A 0 A_Jump (256,2)
		TNT1 A 0 A_PlaySound ("MagSword/ZerkSwing",0,0.60)
		MGS2 CDEF 1
		TNT1 A 7
		TNT1 A 0 A_Refire ("Slash3")
		TNT1 A 1 A_Jump (256,"SwordSheathe")
		Goto RealReady
	Slash3:
		MGS3 A 1 
		MGS3 B 1 A_GiveInventory ("UsingMagSword",1)
		TNT1 A 0 A_PlaySound ("MagSword/BigSwing",0)
		TNT1 A 0 A_JumpIfInventory ("PowerStrength",1,2)
		TNT1 A 0 A_Jump (256,2)
		TNT1 A 0 A_PlaySound ("MagSword/ZerkFinisher",0,0.60)
		MGS3 C 1 A_FireCustomMissile ("DeriverSlash3",0,0)
		MGS3 DE 1
		TNT1 A 14
		TNT1 A 0 A_Refire ("Slash1")
		TNT1 A 1 A_Jump (256,"SwordSheathe")
		Goto RealReady
	SwordSheathe:
		TNT1 A 3 A_WeaponReady
		MGS6 AB 1 A_WeaponReady
		MGS6 CDEF 2 A_WeaponReady
		MGS6 G 1 A_WeaponReady
		TNT1 A 0 A_PlaySound ("MagSword/Sheathe1",0)
		MGS6 HI 1 A_WeaponReady
		TNT1 A 0 A_PlaySound ("MagSword/Sheathe2",0)
		MGS6 JJ 1 A_WeaponReady
		MGS6 KLKL 1 A_WeaponReady
		MGS6 L 3 A_WeaponReady
		MGS6 MNOPQ 1 A_WeaponReady
		
		
		TNT1 A 0 A_PlaySound ("Buran/Spin",0,0.60)
		BRN1 EFGHIJKLMNOPQ 1 A_WeaponReady
 		TNT1 A 0 A_JumpIfInventory ("BuranStack",40,"DropMag")
		BRN1 Q 1 A_Jump (256,"RealReady")
		Goto RealReady
	
	
	//Gunflash states for parry-related actions
	ParryCheck:
		TNT1 A 0
		TNT1 A 1 A_JumpIfInventory ("PowerStrength",1,"ParryFlash")
		TNT1 A 1
		Stop
	ParryFlash:
		TNT1 A 0
		TNT1 A 0 A_PlaySound ("MagSword/ParryPowerUp",0,0.60)
		MGS7 ABCDEF 1 Bright
		Stop
	
	//This isn't a gunflash.
	CounterAttack:
		TNT1 A 0
		MGS8 A 1 A_GiveInventory ("UsingMagSword",1)
		MGS8 B 1 A_FireCustomMissile ("DeriverSlash1",0,0)
		TNT1 A 0 A_FireCustomMissile ("DeriverWaveSlash",0,0)
		TNT1 A 0 A_PlaySound ("MagSword/BigSwing",0)
		MGS8 CDEFG 1
		TNT1 A 5
		TNT1 A 0 A_Refire ("Slash2")
		TNT1 A 1 A_Jump (256,"SwordSheathe")
		Goto RealReady


		
	}
}




//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

//===========================================================================
//===========================================================================
//SWORD ATTACKS
//===========================================================================
//===========================================================================

Actor DeriverSlash1 : fastprojectile
{
	Projectile
	speed 120
	damage (20)
	obituary "%o was cut down by %k's MagSword."
	+BLOODSPLATTER
	+thruspecies
	+dontblast
	+dontreflect
	+HITTRACER
	species "Player"
	height 8
	radius 10
	YScale 0.40
	XScale 0.50
	renderstyle add
	alpha 0.85
	+bright
	mass 50000
	DamageType "CABladeBeam"
	Decal SaberDecal
	states
	{
	Spawn:
		TNT1 A 1
		stop
	Death:
		TNT1 A 0
		TNT1 A 0 
		TNT1 A 1 
		TNT1 A 0 A_PlaySound ("MagSword/Miss", CHAN_VOICE)
		TNT1 A 0 radius_quake (2,5,0,8,0)
		DFX1 ABCDEE 1
		TNT1 A 5 
		stop
	Xdeath:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 1
		TNT1 A 0 A_PlaySound ("MagSword/Hit", CHAN_VOICE)
		TNT1 A 0 radius_quake (1,5,0,8,0)
		TNT1 A 0 A_GiveToTarget ("MultiStrikeChecker1",1)
		DFX1 ABCDEE 1
		TNT1 A 5
		stop
	}
}

Actor DeriverSlash2 : DeriverSlash1
{
	states
	{
	Spawn:
		TNT1 A 1
		stop
	Death:
		TNT1 A 0
		TNT1 A 0 
		TNT1 A 1 A_SetScale (-0.50,-0.50)
		TNT1 A 0 A_PlaySound ("MagSword/Miss", CHAN_VOICE)
		TNT1 A 0 radius_quake (2,5,0,8,0)
		DFX1 ABCDEE 1
		TNT1 A 5 
		stop
	Xdeath:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 1 A_SetScale (-0.50,-0.50)
		TNT1 A 0 A_PlaySound ("MagSword/Hit", CHAN_VOICE)
		TNT1 A 0 radius_quake (1,5,0,8,0)
		TNT1 A 0 A_GiveToTarget ("MultiStrikeChecker2",1)
		DFX1 ABCDEE 1
		TNT1 A 5
		stop
	}
}




Actor DeriverSlash3 : DeriverSlash1
{
	YScale 0.50
	XScale 0.70
	+FORCEPAIN
	ProjectileKickBack 300
	damage (60)
	Decal VerticalSaberDecal
	states
	{
	Death:
		TNT1 A 0
		TNT1 A 0 
		TNT1 A 1 
		TNT1 A 0 A_PlaySound ("MagSword/BigMiss", CHAN_VOICE)
		TNT1 A 0 A_PlaySound ("MagSword/Miss", 0,0.50)
		TNT1 A 0 radius_quake (2,5,0,8,0)
		DFX2 ABCDEE 1
		TNT1 A 5 
		stop
	Xdeath:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 1
		TNT1 A 0 A_PlaySound ("MagSword/BigHit", CHAN_VOICE)
		TNT1 A 0 radius_quake (1,5,0,8,0)
		TNT1 A 0 A_GiveToTarget ("MultiStrikeChecker3",1)
		DFX2 ABCDEE 1
		TNT1 A 5
		stop
	}
}



Actor DeriverWaveSlash : DeriverSlash1
{
	Projectile
	Xscale 1.40
	Yscale 0.50
	speed 70
	damage (150)
	obituary "%o was cut down by %k's MagSword."
	+BLOODSPLATTER
	+thruspecies
	+dontblast
	+dontreflect
	+HITTRACER
	species "Player"
	height 8
	radius 18
	renderstyle add
	alpha 0.85
	+bright
	mass 50000
	DamageType "CABladeBeam"
	Decal SaberDecal
	states
	{
	Spawn:
		SW8V A 8
	FadeOff:
		SW8V A 1 A_SetScale (1.60,0.30)
		SW8V A 1 A_SetScale (1.80,0.10)
		stop
	Death:
		TNT1 A 0
		TNT1 A 0 
		TNT1 A 1 A_SetScale (1.80,0.80)
		TNT1 A 0 A_PlaySound ("MagSword/Miss", CHAN_VOICE)
		TNT1 A 0 radius_quake (2,5,0,8,0)
		DFX1 ABCDEE 1
		TNT1 A 5 
		stop
	Xdeath:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 1 A_SetScale (1.80,0.80)
		TNT1 A 0 A_PlaySound ("MagSword/ParryWaveHit", CHAN_VOICE)
		TNT1 A 0 radius_quake (1,5,0,8,0)
		DFX1 ABCDEE 1
		TNT1 A 5
		stop
	}
}

//===========================================================================
//===========================================================================
//SWORD PARRY
//===========================================================================
//===========================================================================


	
actor BladeDefense : fastprojectile
{
	projectile
	+noblood
	+shootable
	+bloodlessimpact
	+thruspecies
	+notargetswitch
	+NORADIUSDMG
	+PAINLESS
	+DONTRIP
	+DONTREFLECT
	+NOCLIP
	-bloodsplatter
	-noblockmap
	-ACTIVATEIMPACT
	painchance 255
	species "Player"
	radius 20
	height 38
	speed 40
	mass 1
	damage (0)
	states
	{
	spawn:
		TNT1 A 0
		TNT1 A 1
		goto Death
	death:
		TNT1 A 0
		TNT1 A 1
		stop
	pain:
		TNT1 A 0 Radius_Quake (1,8,0,20,0)
		TNT1 A 0 A_GiveInventory ("BladeParried",1,AAPTR_TARGET)
		TNT1 A 1
		stop
	Pain.Linked:
		TNT1 A 1
		stop
	}
}

//===========================================================================
//===========================================================================
//SWORD MULTIATTACKS (berserk)
//===========================================================================
//===========================================================================


Actor DeriverMultiSlash1 : DeriverSlash1
{
	+PAINLESS
	radius 12
	states
	{
	Spawn:
		TNT1 A 1
		stop
	Death:
		TNT1 A 0
		TNT1 A 0 
		TNT1 A 1 
		TNT1 A 0 A_PlaySound ("MagSword/Miss", CHAN_VOICE)
		DFX1 ABCDEE 1
		TNT1 A 5 
		stop
	Xdeath:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 1
		TNT1 A 0 A_PlaySound ("MagSword/Hit", 0)
		TNT1 A 0 radius_quake (1,5,0,8,0)
		DFX1 ABCDEE 1
		TNT1 A 5
		stop
	}
}

Actor DeriverMultiSlash2 : DeriverSlash2
{
	+PAINLESS
	radius 12
	states
	{
	Death:
		TNT1 A 0
		TNT1 A 0 
		TNT1 A 1 A_SetScale (-0.50,-0.50)
		TNT1 A 0 A_PlaySound ("MagSword/Miss", CHAN_VOICE)
		DFX1 ABCDEE 1
		TNT1 A 5 
		stop
	Xdeath:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 1 A_SetScale (-0.50,-0.50)
		TNT1 A 0 A_PlaySound ("MagSword/Hit", 0)
		TNT1 A 0 radius_quake (1,5,0,8,0)
		DFX1 ABCDEE 1
		TNT1 A 5
		stop
	}
}




Actor DeriverMultiSlash3 : DeriverSlash3
{
	-FORCEPAIN
	+Painless
	ProjectileKickBack 300
	radius 12
	states
	{
	Death:
		TNT1 A 0
		TNT1 A 0 
		TNT1 A 1 
		TNT1 A 0 A_PlaySound ("MagSword/BigMiss", CHAN_VOICE)
		TNT1 A 0 A_PlaySound ("MagSword/Miss", 0,0.50)
		DFX2 ABCDEE 1
		TNT1 A 5 
		stop
	Xdeath:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 1
		TNT1 A 0 A_PlaySound ("MagSword/BigHit", 0)
		DFX2 ABCDEE 1
		TNT1 A 5
		stop
	}
}



Actor MultiStrikeChecker1 : custominventory 
{
	inventory.maxamount 1
	+INVENTORY.AUTOACTIVATE
	states
	{
	pickup:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory ("PowerStrength", 1, "MultiStrike")
		TNT1 A 1 
		Stop
	MultiStrike:
		TNT1 A 0
		TNT1 A 0 A_FireCustomMissile("MultiStrikeSpawner1",0,0)
		TNT1 A 1
		stop
	}
}


Actor MultiStrikeChecker2 : MultiStrikeChecker1 
{
	inventory.maxamount 1
	+INVENTORY.AUTOACTIVATE
	states
	{
	MultiStrike:
		TNT1 A 0
		TNT1 A 0 A_FireCustomMissile("MultiStrikeSpawner2",0,0)
		TNT1 A 1
		stop
	}
}

Actor MultiStrikeChecker3 : MultiStrikeChecker1 
{
	inventory.maxamount 1
	+INVENTORY.AUTOACTIVATE
	states
	{
	MultiStrike:
		TNT1 A 0
		TNT1 A 0 A_FireCustomMissile("MultiStrikeSpawner3",0,0)
		TNT1 A 1
		stop
	}
}


actor MultiStrikeSpawner1
{
	PROJECTILE
	+NOINTERACTION
	Speed 1
	Radius 4
	Height 8
	Damage (0)
	RenderStyle None
	//Seesound "TechMonk/Waveball3"
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 4 //A_SpawnItemEx("DeriverMultiSlash1",0,0,0,momx*120,momy*120,momz*120,0,SXF_NOCHECKPOSITION|SXF_ABSOLUTEMOMENTUM)
		TNT1 A 4 A_SpawnItemEx("DeriverMultiSlash1",0,0,0,momx*130,momy*130,momz*130,0,SXF_NOCHECKPOSITION|SXF_ABSOLUTEMOMENTUM)
		Stop
	}
}


actor MultiStrikeSpawner2
{
	PROJECTILE
	+NOINTERACTION
	Speed 1
	Radius 4
	Height 8
	Damage (0)
	RenderStyle None
	//Seesound "TechMonk/Waveball3"
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 4 //A_SpawnItemEx("DeriverMultiSlash2",0,0,0,momx*120,momy*120,momz*120,0,SXF_NOCHECKPOSITION|SXF_ABSOLUTEMOMENTUM)
		TNT1 A 4 A_SpawnItemEx("DeriverMultiSlash2",0,0,0,momx*130,momy*130,momz*130,0,SXF_NOCHECKPOSITION|SXF_ABSOLUTEMOMENTUM)
		Stop
	}
}


actor MultiStrikeSpawner3
{
	PROJECTILE
	+NOINTERACTION
	Speed 1
	Radius 4
	Height 8
	Damage (0)
	RenderStyle None
	//Seesound "TechMonk/Waveball3"
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 4 //A_SpawnItemEx("DeriverMultiSlash3",0,0,0,momx*120,momy*120,momz*120,0,SXF_NOCHECKPOSITION|SXF_ABSOLUTEMOMENTUM)
		TNT1 A 4 A_SpawnItemEx("DeriverMultiSlash3",0,0,0,momx*130,momy*130,momz*130,0,SXF_NOCHECKPOSITION|SXF_ABSOLUTEMOMENTUM)
		Stop
	}
}


//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

//===========================================================================
//===========================================================================
//FLECHETTES
//===========================================================================
//===========================================================================


actor DeriverFlechette : fastprojectile
{
	projectile
	species "Player"
	+notimefreeze
    +FORCEXYBILLBOARD	
    +BLOODSPLATTER
	+bright
	+thruspecies
	speed 120
	height 4
	radius 4
    missileheight 10
	missiletype "FlechetteTrail"
	Damage (6)
	scale 0.60
	Decal bulletchip
	RenderStyle add
	Alpha 0.80
	states
	{
	spawn:
		DFL1 A 1
		loop
	Xdeath:
		TNT1 A 1
		TNT1 A 0 A_PlaySound ("Buran/FlechetteHit",CHAN_VOICE,0.80,0,1.5)
		TNT1 A 0 A_SetScale (1)
		MNSP ABCD 1
		Stop
	Death:
		TNT1 A 1
		TNT1 A 0 A_PlaySound ("Buran/FlechetteMiss",CHAN_VOICE,0.7,0,1.5)
		TNT1 A 0 A_SpawnItemEx ("CABulletSpark",5,0,0,Frandom(-200,200)/20.0,Frandom(-200,200)/20.0,Frandom(-200,200)/20.0,0,SXF_NOCHECKPOSITION)		
		MNSP ABCD 1 A_SpawnItemEx ("CABulletSpark",5,0,0,Frandom(-200,200)/20.0,Frandom(-200,200)/20.0,Frandom(-200,200)/20.0,0,SXF_NOCHECKPOSITION,80)		
		Stop
	}
}



Actor FlechetteTrail
{
	projectile
	+notimefreeze
	+nointeraction
    +FORCEXYBILLBOARD	
	+LOOKALLAROUND
	+DONTBLAST
	+CLIENTSIDEONLY
	+Bright
	radius 2
	speed 50
    Scale 0.60
	RenderStyle Add
	alpha 0.40
	ReactionTime 2
	states
	{
	spawn:
		TNT1 A 0
		TNT1 A 0 A_CheckRange (50,"Emit")
		TNT1 A 1
		stop
	Emit:
		TNT1 A 0
		DFL1 A 1
	TrailOff:
		SBL1 A 1
		TNT1 A 0 A_Countdown
		loop
	death:
		DFL1 A 1 A_FadeOut (0.60)
		loop
	}
}




//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

//===========================================================================
//===========================================================================
//TOKENS
//===========================================================================
//===========================================================================



actor BuranStack : inventory
{
	Inventory.RestrictedTo "Deriver"
	inventory.maxamount 40
}

Actor BladeParried : Powerup
{
	Powerup.Duration 20
}	


Actor UsingMagSword : Powerup
{
	Powerup.Duration 1
}	

Actor UsingDeriverGun : Powerup
{
	Powerup.Duration 1
}	

Actor UsingParry : Powerup
{
	Powerup.Duration 1
}	

actor TossedMag : inventory
{
	Inventory.RestrictedTo "Deriver"
	inventory.maxamount 1
}