
//***Che *** MODIFIED BY CHEBMASTER
// This file contains bug fixes for BDv21 and should be included in any BDv21 fix patch


//Projectiles on TRACER and MELEE lump
//Meatshield blocking effect on Head_Sys lump

ACTOR ZMANShield : Rifle
{
	Weapon.AmmoUse1 0
	Weapon.AmmoGive1 0
	Weapon.AmmoUse2 0
	Weapon.AmmoGive2 0
	Weapon.AmmoType1 "BDPistolAmmo"
	Weapon.AmmoType2 "MeatAmmo"
	States
	{
	Ready:
		
		ZSHG A 2 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeatAmmo", 100, 4)
		TNT1 A 0 A_SpawnItemEx("MeatShield", 15, 0, 15, 0)
		TNT1 A 0 A_AlertMonsters
        Loop
		TNT1 AAA 0
		Goto Destroy
	Deselect:
        Goto AltFire
	Select:
		TNT1 A 0 A_Giveinventory("GoSpecial",1)
	    TNT1 A 0 A_TakeInventory("MeatAmmo", 100)
		TNT1 AAAAAAAA 0 A_Raise
		ZSHG A 1 offset(0,40)
		ZSHG A 1 offset(0,48)
		Goto LoadBullets
	
	LoadBullets:
		TNT1 A 0 A_JumpIfInventory("BDPistolAmmo",15,15)
		TNT1 A 0 A_JumpIfInventory("Clip1",1,3)
		Goto Ready
        TNT1 AAAAAA 0
		TNT1 A 0 A_Giveinventory("BDPistolAmmo",1)
		TNT1 A 0 A_Giveinventory("BDDualPistolAmmo",1)
		TNT1 A 0 A_Takeinventory("Clip1",1)
		Goto LoadBullets
		
		TNT1 AAAAAAAAAA 0
		TNT1 A 0 A_Takeinventory("Reloading",1)
		
        Goto Ready
		TNT1 AAAA 0
		TNT1 A 0 A_Takeinventory("Reloading",1)
		
	
    Fire:
	    TNT1 A 0
        TNT1 A 0 A_JumpIfInventory("BDPistolAmmo", 1, 1)
		Goto AltFire
		TNT1 A 0 A_AlertMonsters
		TNT1 A 0 A_SpawnItemEx("MeatShield", 15, 0, 15, 0)
		TNT1 A 0 A_FireCustomMissile("YellowFlareSpawn",-5,0,0,0)
		TNT1 A 0 A_PlaySound("pfire")
        TNT1 A 0 A_FireCustomMissile("SmokeSpawner",0,0,0,5)
		TNT1 A 0 A_FireCustomMissile("MeatShieldTracer", random(1,-1), 0, 3, 0)
		TNT1 A 0 A_TakeInventory("BDPistolAmmo", 1)
		TNT1 A 0 A_TakeInventory("BDDualPistolAmmo", 1)
		ZSHF A 1 BRIGHT
		ZSHF BC 1
		ZSHG A 1
		Goto Ready
		

    AltFire:
		GRZ1 D 1 offset(-4, 32)
		GRZ1 D 1 offset(-9, 33)
		GRZ1 D 1 offset(-16, 34)
		GRZ1 D 2 offset(-24, 35)
		GRZ1 D 3 offset(-36, 48)
		GRZ1 D 1 offset(-24, 35)
		GRZ1 B 1 offset(-16, 34)
		GRZ1 B 1 offset(-9, 33)
		GRZ1 B 1 offset(-1, 32)
        TNT1 A 0 A_PlaySound("skeleton/swing")
		TNT1 A 0 A_FireCustomMissile("FBD_ThrowedZman", 0, 0, 0, 0)
		TNT1 A 0 A_TakeInventory("GoSpecial",1)
		TNT1 A 0 A_TakeInventory("GotMeatShield", 1)
		TNT1 A 0 A_TakeInventory("HasZmanShield",1)
		TNT1 A 0 A_Giveinventory("Punching",1)
        THEF B 4 
        THEF C 4
		TNT1 A 0 A_Giveinventory("Punching",1)
		THEF D 4
		TNT1 A 0 A_TakeInventory("GoSpecial",1)
		TNT1 A 0 A_TakeInventory("GotMeatShield", 1)
		TNT1 A 0 A_TakeInventory("HasZmanShield",1)
		TNT1 A 0 A_Giveinventory("Punching",1)
		TNT1 A 0 A_TakeInventory("ZmanShield",1)
		TNT1 A 10
		Goto Ready
 	Spawn:
		8876 A -1
		Stop
	Destroy:
	    TNT1 A 0
		TNT1 A 0 A_SpawnItem("ZombiemanHeadExplode", 0, 50)
		TNT1 A 0 A_TakeInventory("GoSpecial",1)
		ZSHG DEFGHII 5
		TNT1 A 0 A_TakeInventory("GoSpecial",1)
		TNT1 A 0 A_TakeInventory("GotMeatShield", 1)
		TNT1 A 0 A_TakeInventory("HasZManShield",1)
		TNT1 A 0 A_Giveinventory("Punching",1)
		TNT1 A 0 A_SpawnItem("FBD_DeadZombieMan_NoHeadFront", 0, 30)
		TNT1 A 0 A_TakeInventory("ZManShield",1)
		Goto Ready
		
	}
}

//***Che evicted to FBD_Throwed.txt
