actor BBA_ShopItem : BasicClassItem
{
inventory.icon "BBASHOP"
inventory.pickupmessage "Roll: Good luck, MEGA MAN!"
Tag "BBA Shop Trigger"
states
{
Spawn:
BBAB Z -1
loop
UseCBM:
TNT1 A 0 A_JumpIfInventory("BBA_Money",600,"BFG")
TNT1 A 0 A_JumpIfInventory("BBA_Money",500,"PlasmaRifle")
TNT1 A 0 A_JumpIfInventory("BBA_Money",400,"RocketLauncher")
TNT1 A 0 A_JumpIfInventory("BBA_Money",300,"SuperShotgun")
TNT1 A 0 A_JumpIfInventory("BBA_Money",200,"Chaingun")
TNT1 A 0 A_JumpIfInventory("BBA_Money",100,"Shotgun")
fail
Shotgun:
TNT1 A 0 A_JumpIfInventory("BBA_Shotgun",1,"AmmoRefill")
TNT1 A 0 A_GiveInventory("BBA_Shotgun",1)
TNT1 A 0 A_SpawnItemEx("BBA_Shop1_H")//A_SelectWeapon("BBA_Shotgun")
TNT1 A 0 A_TakeInventory("BBA_Money",50)
TNT1 A 0 A_TakeInventory("BBA_Money",50,1)
Goto NewWeapon
Chaingun:
TNT1 A 0 A_JumpIfInventory("BBA_Chaingun",1,"AmmoRefill")
TNT1 A 0 A_GiveInventory("BBA_Chaingun",1)
TNT1 A 0 A_GiveInventory("BBA_Clip",40)
TNT1 A 0 A_SpawnItemEx("BBA_Shop2_H")
TNT1 A 0 A_TakeInventory("BBA_Money",100)
TNT1 A 0 A_TakeInventory("BBA_Money",100,1)
Goto NewWeapon
SuperShotgun:
TNT1 A 0 A_JumpIfInventory("BBA_SuperShotgun",1,"AmmoRefill")
TNT1 A 0 A_GiveInventory("BBA_SuperShotgun",1)
TNT1 A 0 A_SpawnItemEx("BBA_Shop3_H")
TNT1 A 0 A_TakeInventory("BBA_Money",150)
TNT1 A 0 A_TakeInventory("BBA_Money",150,1)
Goto NewWeapon
RocketLauncher:
TNT1 A 0 A_JumpIfInventory("BBA_RocketLauncher",1,"AmmoRefill")
TNT1 A 0 A_GiveInventory("BBA_RocketLauncher",1)
TNT1 A 0 A_SpawnItemEx("BBA_Shop4_H")
TNT1 A 0 A_TakeInventory("BBA_Money",200)
TNT1 A 0 A_TakeInventory("BBA_Money",200,1)
Goto NewWeapon
PlasmaRifle:
TNT1 A 0 A_JumpIfInventory("BBA_PlasmaRifle",1,"AmmoRefill")
TNT1 A 0 A_GiveInventory("BBA_PlasmaRifle",1)
TNT1 A 0 A_SpawnItemEx("BBA_Shop5_H")
TNT1 A 0 A_TakeInventory("BBA_Money",250)
TNT1 A 0 A_TakeInventory("BBA_Money",250,1)
Goto NewWeapon
BFG:
TNT1 A 0 A_JumpIfInventory("BBA_BFG9000",1,"AmmoRefill")
TNT1 A 0 A_GiveInventory("BBA_BFG9000",1)
TNT1 A 0 A_SpawnItemEx("BBA_Shop6_H")
TNT1 A 0 A_TakeInventory("BBA_Money",300)
TNT1 A 0 A_TakeInventory("BBA_Money",300,1)
Goto NewWeapon
NewWeapon:
TNT1 A 0 //A_SetMugshotState("Grin")
TNT1 A 0 ACS_NamedExecuteWithResult("cbm_BBA_SetMugShot",4)
TNT1 A 0 A_PlaySound("BBA_Snd/weapon",7)//SoundSlot7
fail
AmmoRefill:
TNT1 A 0 A_PlaySound("BBA_Snd/ammo",7,0.95)//SoundSlot7
TNT1 A 0 A_GiveInventory("BBA_Clip",120)
TNT1 A 0 A_GiveInventory("BBA_Shell",40)
TNT1 A 0 A_GiveInventory("BBA_Rockets",30)
TNT1 A 0 A_GiveInventory("BBA_Cell",120)
TNT1 A 0 A_TakeInventory("BBA_Money",100)
fail
}
}

actor BBA_Shop1_H : BasicHelper
{
States
{
Spawn:
TNT1 A 1
TNT1 A 1 A_GiveToTarget("BBA_Shop1_P",1)
stop
}
}
actor BBA_Shop2_H : BasicHelper{States{Spawn:TNT1 A 1
TNT1 A 1 A_GiveToTarget("BBA_Shop2_P",1)stop}}
actor BBA_Shop3_H : BasicHelper{States{Spawn:TNT1 A 1
TNT1 A 1 A_GiveToTarget("BBA_Shop3_P",1)stop}}
actor BBA_Shop4_H : BasicHelper{States{Spawn:TNT1 A 1
TNT1 A 1 A_GiveToTarget("BBA_Shop4_P",1)stop}}
actor BBA_Shop5_H : BasicHelper{States{Spawn:TNT1 A 1
TNT1 A 1 A_GiveToTarget("BBA_Shop5_P",1)stop}}
actor BBA_Shop6_H : BasicHelper{States{Spawn:TNT1 A 1
TNT1 A 1 A_GiveToTarget("BBA_Shop6_P",1)stop}}

actor BBA_Shop1_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_SelectWeapon("BBA_Shotgun")
stop
}
}
actor BBA_Shop2_P : BBA_Shop1_P{States{Pickup:TNT1 A 0 A_SelectWeapon("BBA_Chaingun")stop}}
actor BBA_Shop3_P : BBA_Shop1_P{States{Pickup:TNT1 A 0 A_SelectWeapon("BBA_SuperShotgun")stop}}
actor BBA_Shop4_P : BBA_Shop1_P{States{Pickup:TNT1 A 0 A_SelectWeapon("BBA_RocketLauncher")stop}}
actor BBA_Shop5_P : BBA_Shop1_P{States{Pickup:TNT1 A 0 A_SelectWeapon("BBA_PlasmaRifle")stop}}
actor BBA_Shop6_P : BBA_Shop1_P{States{Pickup:TNT1 A 0 A_SelectWeapon("BBA_BFG9000")stop}}

actor BBAWeapons : CustomInventory
{
states
{
Pickup:
TNT1 A 0 A_GiveInventory("BBA_Pistol",1)
TNT1 A 0 A_GiveInventory("BBA_Shotgun",1)
TNT1 A 0 A_GiveInventory("BBA_SuperShotgun",1)
TNT1 A 0 A_GiveInventory("BBA_Chaingun",1)
TNT1 A 0 A_GiveInventory("BBA_PlasmaRifle",1)
TNT1 A 0 A_GiveInventory("BBA_RocketLauncher",1)
TNT1 A 0 A_GiveInventory("BBA_BFG9000",1)
stop
}
}

actor BBAMegamanWepDroppedX1 : BasicHelper
{
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_Jump(256,1,2)
TNT1 A 1 A_SpawnItemEx("PowerAdaptorUpgrade",0,0,0,momx,momy,momz,0,8)
stop
TNT1 A 1 A_SpawnItemEx("JetAdaptorUpgrade",0,0,0,momx,momy,momz,0,8)
stop
}
}
actor BBAMegamanWepDroppedX2 : BasicHelper
{
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_Jump(256,1,2)
TNT1 A 1 A_SpawnItemEx("ArrowBusterUpgrade",0,0,0,momx,momy,momz,0,8)
stop
TNT1 A 1 A_SpawnItemEx("LaserBusterUpgrade",0,0,0,momx,momy,momz,0,8)
stop
}
}
actor BBAMegamanWepDroppedX3 : BasicHelper
{
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_Jump(256,1,2)
TNT1 A 1 A_SpawnItemEx("AdaptorUpgrade",0,0,0,momx,momy,momz,0,8)
stop
TNT1 A 1 A_SpawnItemEx("TrebleBoostUpgrade",0,0,0,momx,momy,momz,0,8)
stop
}
}

ACTOR BBA_BaseWeapon : BaseMM8BDMWep_CBM
{
	tag "$TAGC_0T"
	dropitem "MegaArmUpgrade"
	Obituary "$OB_BBAPUNCH"
	Weapon.AmmoType2 "BBA_Money"
	-WEAPON.DONTBOB
	+WEAPON.CHEATNOTWEAPON
	states
	{
	Flash:
		PUNG B 2
		PUNG C 2 A_FireCustomMissile("BBAPunch",0,0,0,0)
		PUNG D 7
		PUNG C 5
		PUNG B 4
	stop
	Spawn:
		C_00 T -1
	Stop

	NoAmmo:
		"----" A 12 A_PlaySoundEx("weapon/fakeempty","Body")
		"----" A 1 A_Jump(256,"Ready")
	wait
	}
}

actor BBA_Clip : Ammo
{
inventory.maxamount 200
+INVENTORY.IGNORESKILL
}

actor BBA_Shell : Ammo
{
inventory.maxamount 50
+INVENTORY.IGNORESKILL
}

actor BBA_Rockets : Ammo
{
inventory.maxamount 50
+INVENTORY.IGNORESKILL
}

actor BBA_Cell : Ammo
{
inventory.maxamount 300
+INVENTORY.IGNORESKILL
}

actor BBA_Money : Ammo
{
inventory.maxamount 600
+INVENTORY.IGNORESKILL
}

actor BBA_MoneyGiver : BasicHelper
{
+SERVERSIDEONLY
states
{
Spawn:
TNT1 A 1
TNT1 A 5 A_JumpIfInTargetInventory("PlayerPropertyRage",1,1)
TNT1 A 4
TNT1 A 1 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"Death")
TNT1 A 0 A_GiveToTarget("BBA_MoneyGiver_P",1)
TNT1 A 0 A_JumpIfInTargetInventory("BBA_Pistol",1,"Spawn")
goto Death
}
}

actor BBA_MoneyGiver_P : CustomInventory
{
states
{
Pickup:
TNT1 A 0 A_JumpIfInventory("BBA_Shotgun",1,"Chaingun")
TNT1 A 0 A_JumpIfInventory("BBA_Money",100,"No")
Goto GiveCash
Chaingun:
TNT1 A 0 A_JumpIfInventory("BBA_Chaingun",1,"SuperShotgun")
TNT1 A 0 A_JumpIfInventory("BBA_Money",200,"No")
Goto GiveCash
SuperShotgun:
TNT1 A 0 A_JumpIfInventory("BBA_SuperShotgun",1,"RocketLauncher")
TNT1 A 0 A_JumpIfInventory("BBA_Money",300,"No")
Goto GiveCash
RocketLauncher:
TNT1 A 0 A_JumpIfInventory("BBA_RocketLauncher",1,"PlasmaRifle")
TNT1 A 0 A_JumpIfInventory("BBA_Money",400,"No")
Goto GiveCash
PlasmaRifle:
TNT1 A 0 A_JumpIfInventory("BBA_PlasmaRifle",1,"GiveCash")
TNT1 A 0 A_JumpIfInventory("BBA_Money",500,"No")
Goto GiveCash
No:
TNT1 A 0
stop
GiveCash:
TNT1 A 0 A_GiveInventory("BBA_Money",1)
stop
}
}

actor BBAPunch : ProjSpawnFuncActor
{
seesound "BBA_Snd/throwpunch"
PROJECTILE
damagetype "BBA_Punch"
Obituary "$OB_BBAPUNCH"
+DONTBLAST
+DONTREFLECT
+HITTRACER
+FORCEXYBILLBOARD
//+GIVEFISTINGMEDAL
reactiontime 1
Damage (180)
Radius 20
Height 20
speed 75
scale 1.5
states
{
Spawn:
TNT1 A 0
TNT1 A 1 A_CountDown
wait
Death:
OMFX B 0
goto FXDeath
Crash:
XDeath:
OMFX B 0 A_PlaySoundEx("BBA_Snd/punch","SountSlot7")
OMFX B 0 A_Stop
OMFX B 0 A_JumpIf(CallACS("cbm_istracerenemy")==1,"Give")
Goto FXDeath
Give:
OMFX B 0 A_GiveToTarget("BBA_Money",75)
Goto FXDeath
FXDeath:
OMFX BOBC 2
stop
}
}

ACTOR BBA_Pistol : BBA_BaseWeapon
{
	tag "$TAGC_0T1"
	Weapon.SelectionOrder 1900
	Weapon.AmmoUse 1
	Weapon.AmmoGive 20
	Weapon.AmmoType "BBA_Clip"
	//Obituary "$OB_BBAPISTOL"
	+WEAPON.WIMPY_WEAPON
	-WEAPON.CHEATNOTWEAPON
	Inventory.Pickupmessage "Power Up! Trusty Sidearm!"
	States
	{
	Ready:
		PISG A 0 A_JumpifInventory("OnceC",1,"Ready0")
		PISG A 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_BBAMEGAMAN,0,TINT_BBA)
		PISG A 0 A_GiveInventory("OnceC",1)
		PISG A 0 A_SpawnItemEx("BBA_MoneyGiver")
	Ready0:
		PISG A 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_BBAMEGAMAN,1,TINT_BBA)
		PISG A 1 A_WeaponReady
	Wait
	Deselect:
		PISG A 0 A_Lower
		PISG A 1 A_Lower
	Loop
	Select:
		PISG A 0 A_Raise
		PISG A 1 A_Raise
	Loop
	Fire:
		PISG A 0 A_JumpIfNoAmmo("NoAmmo")
		PISG B 4
		PISG C 6 A_GiveInventory("BBA_FirePistol_P")//A_FirePistol
		PISG D 4
		PISG B 5 A_ReFire
	Goto Ready0+1
	Altfire:
		PISG A 0 A_GiveInventory("VivifyDelay5",1)
		PISG A 0 A_Refire(1)
		PISG A 1 OffSet(-15,42)A_JumpIfInventory("PlayerPropertyRage",1,1)
		PISG A 1 OffSet(-45,62)
	Fist:
		PISG A 19 OffSet(-45,152)A_GunFlash("Flash",1)
		PISG A 0 A_GiveInventory("VivifyDelay5",1)
		PISG A 0 A_Refire("Fist")
		PISG A 1 OffSet(-45,152)A_TakeInventory("VivifyDelay5",99)
		PISG A 1 OffSet(-45,114)A_JumpIfInventory("PlayerPropertyRage",1,1)
		PISG A 1 OffSet(-45,72)
		PISG A 1 OffSet(-45,62)A_JumpIfInventory("PlayerPropertyRage",1,1)
		PISG A 1 OffSet(-30,52)
		PISG A 1 OffSet(-15,42)A_JumpIfInventory("PlayerPropertyRage",1,1)
		PISG A 0
	goto Ready0+1
	}
}

Actor BBA_FirePistol_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_FireCustomMissile("BBA_PistolShot",0,1,0)
TNT1 A 0 A_PlaySound("BBA_Snd/shot",1,0.9)
stop
}
}

ACTOR BBA_Shotgun : BBA_BaseWeapon
{
	tag "$TAGC_0T2"
	dropitem "BBAMegamanWepDroppedX1"
	Weapon.SelectionOrder 1300
	Weapon.AmmoUse 1
	Weapon.AmmoGive 8
	Weapon.AmmoType "BBA_Shell"
	Inventory.PickupMessage "Power up! Spread Gun"
	//Obituary "$OB_BBASHOTGUN"
	-WEAPON.CHEATNOTWEAPON
	States
	{
	Ready:
		SHTG A 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_BBAMEGAMAN,1,TINT_BBA)
		SHTG A 1 A_WeaponReady
	Wait
	Deselect:
		SHTG A 0 A_Lower
		SHTG A 1 A_Lower
	Loop
	Select:
		SHTG A 0 A_Raise
		SHTG A 1 A_Raise
	Loop
	Fire:
		SHTG A 3 A_JumpIfNoAmmo("NoAmmo")
		SHTG A 0 A_PlayWeaponSound("BBA_Snd/shotgun")
		SHTG A 0 A_GiveInventory("BBA_FireShotgun_P")
		SHTG B 4 //A_FireShotgun
		SHTG C 3
		//SHTG DE 5
		//SHTG F 4
		//SHTG GH 5
		SHTG D 8
		SHTG E 4 A_PlaySound("BBA_Snd/shotgun_r",4)
		SHTG FG 2
		SHTG H 4
		SHTG A 3
		SHTG A 7 A_ReFire
	Goto Ready+1
	Altfire:
		SHTG A 0 A_GiveInventory("VivifyDelay5",1)
		SHTG A 0 A_Refire(1)
		SHTG A 1 OffSet(-15,42)A_JumpIfInventory("PlayerPropertyRage",1,1)
		SHTG A 1 OffSet(-45,62)
	Fist:
		SHTG A 19 OffSet(-45,152)A_GunFlash("Flash",1)
		SHTG A 0 A_GiveInventory("VivifyDelay5",1)
		SHTG A 0 A_Refire("Fist")
		SHTG A 1 OffSet(-45,152)A_TakeInventory("VivifyDelay5",99)
		SHTG A 1 OffSet(-45,114)A_JumpIfInventory("PlayerPropertyRage",1,1)
		SHTG A 1 OffSet(-45,72)
		SHTG A 1 OffSet(-45,62)A_JumpIfInventory("PlayerPropertyRage",1,1)
		SHTG A 1 OffSet(-30,52)
		SHTG A 1 OffSet(-15,42)A_JumpIfInventory("PlayerPropertyRage",1,1)
		SHTG A 0
	goto Ready+1
	}
}

Actor BBA_FireShotgun_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_FireCustomMissile("BBA_ShotgunShot",0,1,0,0)
TNT1 AAA 0 A_FireCustomMissile("BBA_ShotgunShot",frandom(0.8,5.6),0,0,0,0,0)
TNT1 AAA 0 A_FireCustomMissile("BBA_ShotgunShot",frandom(-5.6,-0.8),0,0,0,0,0)
stop
}
}

ACTOR BBA_SuperShotgun : BBA_BaseWeapon
{
	tag "$TAGC_0T3"
	dropitem "BBAMegamanWepDroppedX2"
	Weapon.SelectionOrder 400
	Weapon.AmmoUse 2
	Weapon.AmmoGive 8
	Weapon.AmmoType "BBA_Shell"
	Inventory.PickupMessage "Power up! Super Spread Gun!"
	//Obituary "$OB_BBASUPERSHOTGUN"
	-WEAPON.CHEATNOTWEAPON
	States
	{
	Ready:
		SHT2 A 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_BBAMEGAMAN,1,TINT_BBA)
		SHT2 A 1 A_WeaponReady
	Wait
	Deselect:
		SHT2 A 0 A_Lower
		SHT2 A 1 A_Lower
	Loop
	Select:
		SHT2 A 0 A_Raise
		SHT2 A 1 A_Raise
	Loop
	Fire3333:
		SHT2 A 3 A_JumpIfNoAmmo("NoAmmo")
		SHT2 B 3 A_GiveInventory("BBA_FireShotgun2_P")
		//A_FireShotgun2//A_CheckReload//A_OpenShotgun2//A_LoadShotgun2//A_CloseShotgun2
		SHT2 CD 6
		SHT2 E 13
		SHT2 F 10 Offset(0,40)
		SHT2 F 10 Offset(0,36)
		SHT2 F 6 A_WeaponReady(14)
		SHT2 A 5 A_ReFire
	Goto Ready+1
	Fire:
		SHT2 A 3 A_JumpIfNoAmmo("NoAmmo")
		SHT2 B 4 A_GiveInventory("BBA_FireShotgun2_P")
		SHT2 C 3
		SHT2 D 3
		SHT2 E 4
		SHT2 G 4
		SHT2 F 6 A_PlaySound("BBA_Snd/ssg_r1",4)//29
		SHT2 F 6 A_GunFlash("Flash.SSG",1)
		SHT2 A 0 A_PlaySound("BBA_Snd/ssg_r2",4)
		SHT2 AFAF 2
		SHT2 H 4
		SHT2 A 6 A_PlaySound("BBA_Snd/ssg_r3",4)
		//57
		SHT2 A 5 A_ReFire
	Goto Ready+1
	//A_PlaySound("BBA_Snd/ssg_1",4)
	//A_PlaySound("BBA_Snd/ssg_2",4)
	//A_PlaySound("BBA_Snd/ssg_3",4)
	Flash.SSG:
		PUNG HIJJJJIIHH 2
	Stop
	Altfire:
		SHT2 A 0 A_GiveInventory("VivifyDelay5",1)
		SHT2 A 0 A_Refire(1)
		SHT2 A 1 OffSet(-15,42)A_JumpIfInventory("PlayerPropertyRage",1,1)
		SHT2 A 1 OffSet(-45,62)
	Fist:
		SHT2 A 19 OffSet(-45,152)A_GunFlash("Flash",1)
		SHT2 A 0 A_GiveInventory("VivifyDelay5",1)
		SHT2 A 0 A_Refire("Fist")
		SHT2 A 1 OffSet(-45,152)A_TakeInventory("VivifyDelay5",99)
		SHT2 A 1 OffSet(-45,114)A_JumpIfInventory("PlayerPropertyRage",1,1)
		SHT2 A 1 OffSet(-45,72)
		SHT2 A 1 OffSet(-45,62)A_JumpIfInventory("PlayerPropertyRage",1,1)
		SHT2 A 1 OffSet(-30,52)
		SHT2 A 1 OffSet(-15,42)A_JumpIfInventory("PlayerPropertyRage",1,1)
		SHT2 A 0
	goto Ready+1
	}
}

Actor BBA_FireShotgun2_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_FireCustomMissile("BBA_SuperShotgunShot",0,1,0,0)
TNT1 AAAAAAAAAAAAAAAAAAAAA 0 A_FireCustomMissile("BBA_SuperShotgunShot",frandom(-7,7),0,0,0,1,frandom(-5,5))
TNT1 A 0 A_PlaySound("BBA_Snd/ssg",1)
stop
}
}

ACTOR BBA_Chaingun : BBA_BaseWeapon
{
	tag "$TAGC_0T4"
	dropitem "BBAMegamanWepDroppedX1"
	Weapon.SelectionOrder 700
	Weapon.AmmoUse 1//2
	Weapon.AmmoGive 20
	Weapon.AmmoType "BBA_Clip"
	Inventory.PickupMessage "Power up! Vulcan Repeater!"
	//Obituary "$OB_BBACHAINGUN"
	-WEAPON.CHEATNOTWEAPON
	States
	{
	Ready:
		CHGG A 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_BBAMEGAMAN,1,TINT_BBA)
		CHGG A 1 A_WeaponReady
	Wait
	Deselect:
		CHGG A 0 A_Lower
		CHGG A 1 A_Lower
	Loop
	Select:
		CHGG A 0 A_Raise
		CHGG A 1 A_Raise
	Loop
	Fire:
		CHGG A 0 A_JumpIfNoAmmo("NoAmmo")
		CHGG BC 4 A_GiveInventory("BBA_FireCGunX_P")//A_FireCGun
		CHGG FG 4 A_ReFire("Fire2")
	Goto Ready+1
	Fire1:
		CHGG A 0 A_JumpIfNoAmmo("NoAmmo")
		CHGG BC 4 A_GiveInventory("BBA_FireCGun_P")
		CHGG FG 4 A_ReFire("Fire2")
	Goto Ready+1
	Fire2:
		CHGG A 0 A_JumpIfNoAmmo("NoAmmo")
		CHGG DE 4 A_GiveInventory("BBA_FireCGun_P")
		CHGG AA 4 A_ReFire("Fire1")
	Goto Ready+1
	Altfire:
		CHGG A 0 A_GiveInventory("VivifyDelay5",1)
		CHGG A 0 A_Refire(1)
		CHGG A 1 OffSet(-15,42)A_JumpIfInventory("PlayerPropertyRage",1,1)
		CHGG A 1 OffSet(-45,62)
	Fist:
		CHGG A 19 OffSet(-45,152)A_GunFlash("Flash",1)
		CHGG A 0 A_GiveInventory("VivifyDelay5",1)
		CHGG A 0 A_Refire("Fist")
		CHGG A 1 OffSet(-45,152)A_TakeInventory("VivifyDelay5",99)
		CHGG A 1 OffSet(-45,114)A_JumpIfInventory("PlayerPropertyRage",1,1)
		CHGG A 1 OffSet(-45,72)
		CHGG A 1 OffSet(-45,62)A_JumpIfInventory("PlayerPropertyRage",1,1)
		CHGG A 1 OffSet(-30,52)
		CHGG A 1 OffSet(-15,42)A_JumpIfInventory("PlayerPropertyRage",1,1)
		CHGG A 0
	goto Ready+1
	}
}

Actor BBA_FireCGun_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_FireCustomMissile("BBA_ChaingunShot",frandom(-4,4),1,0,0,0,frandom(-1,1))
Snd:
TNT1 A 0 A_PlaySound("BBA_Snd/shot",1,0.9)
stop
}
}
Actor BBA_FireCGunX_P : BBA_FireCGun_P
{
States
{
Pickup:
TNT1 A 0 A_FireCustomMissile("BBA_ChaingunShot",0,1,0,0)
goto Snd
}
}

ACTOR BBA_RocketLauncher : BBA_BaseWeapon
{
	tag "$TAGC_0T5"
	dropitem "BBAMegamanWepDroppedX2"
	Weapon.SelectionOrder 2500
	Weapon.AmmoUse 1
	Weapon.AmmoGive 8
	Weapon.AmmoType "BBA_Rockets"
	//+WEAPON.NOAUTOFIRE
	Inventory.PickupMessage "Power Up! Heavy Cannon!"
	+WEAPON.EXPLOSIVE
	-WEAPON.CHEATNOTWEAPON
	States
	{
	Ready:
		MISG A 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_BBAMEGAMAN,1,TINT_BBA)
		MISG A 1 A_WeaponReady
	Wait
	Deselect:
		MISG A 0 A_Lower
		MISG A 1 A_Lower
	Loop
	Select:
		MISG A 0 A_Raise
		MISG A 1 A_Raise
	Loop
	Fire:
		MISG A 4 A_JumpIfNoAmmo("NoAmmo")
		MISG D 4
		//MISG D 0 //A_PlaySound("BBA_Snd/rocketfire",1,1.0)
		MISG E 4 A_FireCustomMissile("BBA_Rocket",0,1,0,0)//A_FireMissile
		MISG F 4
		MISG B 4
		MISG B 0 A_ReFire
	Goto Ready+1
	Altfire:
		MISG A 0 A_GiveInventory("VivifyDelay5",1)
		MISG A 0 A_Refire(1)
		MISG A 1 OffSet(-15,42)A_JumpIfInventory("PlayerPropertyRage",1,1)
		MISG A 1 OffSet(-45,62)
	Fist:
		MISG A 19 OffSet(-45,152)A_GunFlash("Flash",1)
		MISG A 0 A_GiveInventory("VivifyDelay5",1)
		MISG A 0 A_Refire("Fist")
		MISG A 1 OffSet(-45,152)A_TakeInventory("VivifyDelay5",99)
		MISG A 1 OffSet(-45,114)A_JumpIfInventory("PlayerPropertyRage",1,1)
		MISG A 1 OffSet(-45,72)
		MISG A 1 OffSet(-45,62)A_JumpIfInventory("PlayerPropertyRage",1,1)
		MISG A 1 OffSet(-30,52)
		MISG A 1 OffSet(-15,42)A_JumpIfInventory("PlayerPropertyRage",1,1)
		MISG A 0
	goto Ready+1
	}
}

actor BBA_Rocket : ProjSpawnFuncActor
{
SeeSound "BBA_Snd/rocketfire"
DeathSound "BBA_Snd/rocket"
PROJECTILE
damagetype "BBA_Rocket"
Obituary "$OB_BBAROCKET"
+SKYEXPLODE//
+EXPLODEONWATER//
+HITTRACER
//+DEHEXPLOSION
//+ROCKETTRAIL
ReactionTime 8
Damage (random(40,80))
Radius 11
Height 8
Speed 35
scale 2.5
states
{
Spawn:
MISL AAAAAABBBBBB 1 A_SpawnItemEx("BBA_RocketFX0",0,0,0,0,0,0,0,1)
loop
Death:
//MISL C 0 A_PlaySound("BBA_Snd/rocket",2,0.95)
MISL C 4 A_SpawnItemEx("BBA_RocketExplode")//A_Explode(30,128,0)
MISL DEFGHI 4
stop
XDeath:
Crash:
TNT1 A 0 A_JumpIf(CallACS("cbm_istracerenemy")==1,"Give")
Goto Death
Give:
TNT1 A 0 A_GiveToTarget("BBA_Money",reactiontime)
Goto Death
}
}

actor BBA_RocketFX0 : BasicGraphicEffect
{
States
{
Spawn:
TNT1 A 0
TNT1 AAAA 0 A_SpawnItemEx("BBA_RocketFX1",-15,random(-1,1),random(0,3),0,frandom(-1.0f,1.0f),0,0,1)
TNT1 A 0 A_SpawnItemEx("BBA_RocketFX2",-15,random(-1,1),random(-1,0),0,frandom(-1.0f,1.0f),0,0,1)
stop
}
}

actor BBA_RocketFX1 : BasicGraphicEffect
{
+FORCEXYBILLBOARD
+BRIGHT
RenderStyle Translucent
Alpha 1.0
ReactionTime 4
Scale 0.25
States
{
SpawnFrame:
MISL J 1
MISL J 0 ThrustThingZ(0,1,0,1)
MISL JJJ 1 A_FadeOut(frandom(0.05f,0.075f))
MISL J 0 A_CountDown
goto Spawn+1
}
}
actor BBA_RocketFX2 : BBA_RocketFX1
{
States
{
SpawnFrame:
MISL K 1
MISL K 0 ThrustThingZ(0,1,1,1)
MISL KKK 1 A_FadeOut(frandom(0.05f,0.075f))
MISL K 0 A_CountDown
goto Spawn+1
}
}

actor PainBBA_RocketBoomHit : BasicWatcher
{
States
{
Spawn:
TNT1 A 0 nodelay A_GiveToTarget("BBA_Money",16,AAPTR_TARGET)
stop
}
}

actor BBA_RocketExplode : BasicExplosion
{
damagetype "BBA_RocketBoom"
obituary "$OB_BBAR_SPLASH"
Reactiontime 16
states
{
Spawn:
TNT1 A 0
TNT1 A 4 A_Explode(240,144,0,0,12)//320//128
//A_JumpIf(A_Explode(240,144,0,0,12)>0,"Give")
stop
Give:
TNT1 A 4 A_GiveToTarget("BBA_Money",reactiontime)
stop
}
}


ACTOR BBA_PlasmaRifle : BBA_BaseWeapon
{
	tag "$TAGC_0T6"
	dropitem "BBAMegamanWepDroppedX2"
	Weapon.SelectionOrder 100
	Weapon.AmmoUse 1
	Weapon.AmmoGive 40
	Weapon.AmmoType "BBA_Cell"
	Inventory.PickupMessage "Power Up! Energy Lancer!"
	-WEAPON.CHEATNOTWEAPON
	States
	{
	Ready:
		PLSG A 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_BBAMEGAMAN,1,TINT_BBA)
		PLSG A 1 A_WeaponReady
	Wait
	Deselect:
		PLSG A 0 A_Lower
		PLSG A 1 A_Lower
	Loop
	Select:
		PLSG A 0 A_Raise
		PLSG A 1 A_Raise
	Loop
	Fire:
		PLSG A 0 A_JumpIfNoAmmo("NoAmmo")
		PLSG B 3 A_GiveInventory("BBA_FirePlasma_P")//A_FirePlasma
		PLSG B 0 A_ReFire("Fire2")
		PLSG D 20
	Goto Ready+1
	Fire2:
		PLSG A 0 A_JumpIfNoAmmo("NoAmmo")
		PLSG C 3 A_GiveInventory("BBA_FirePlasma_P")//A_FirePlasma
		PLSG C 0 A_ReFire("Fire")
		PLSG D 19
	Goto Ready+1
	Altfire:
		PLSG A 0 A_GiveInventory("VivifyDelay5",1)
		PLSG A 0 A_Refire(1)
		PLSG A 1 OffSet(-15,42)A_JumpIfInventory("PlayerPropertyRage",1,1)
		PLSG A 1 OffSet(-45,62)
	Fist:
		PLSG A 19 OffSet(-45,152)A_GunFlash("Flash",1)
		PLSG A 0 A_GiveInventory("VivifyDelay5",1)
		PLSG A 0 A_Refire("Fist")
		PLSG A 1 OffSet(-45,152)A_TakeInventory("VivifyDelay5",99)
		PLSG A 1 OffSet(-45,114)A_JumpIfInventory("PlayerPropertyRage",1,1)
		PLSG A 1 OffSet(-45,72)
		PLSG A 1 OffSet(-45,62)A_JumpIfInventory("PlayerPropertyRage",1,1)
		PLSG A 1 OffSet(-30,52)
		PLSG A 1 OffSet(-15,42)A_JumpIfInventory("PlayerPropertyRage",1,1)
		PLSG A 0
	goto Ready+1
	}
}


actor BBA_FirePlasma_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_PlaySound("BBA_Snd/plasma",1)
TNT1 A 0 A_FireCustomMissile("BBA_PlasmaBall",0,1,0,0)
stop
}
}

actor BBA_PlasmaBall : ProjSpawnFuncActor
{
PROJECTILE
damagetype "BBA_Plasma"
obituary "$OB_BBAPLASMARIFLE"
+FORCEXYBILLBOARD
+BRIGHT
+RANDOMIZE
+HITTRACER
reactiontime 8
Damage (80)//50
Radius 13
Height 10//8
Speed 26
scale 1.5
states
{
Spawn:
PLSS AB 6
loop
Death:
PLSE ABC 4
stop
XDeath:
Crash:
TNT1 A 0 A_JumpIf(CallACS("cbm_istracerenemy")==1,"Give")
Goto Death
Give:
TNT1 A 0 A_GiveToTarget("BBA_Money",reactiontime)
Goto Death
}
}

ACTOR BBA_BFG9000 : BBA_BaseWeapon
{
	tag "$TAGC_0T7"
	dropitem "BBAMegamanWepDroppedX3"
	//Height 20
	Weapon.SelectionOrder 2800
	Weapon.AmmoUse 40
	Weapon.AmmoGive 50
	Weapon.AmmoType "BBA_Cell"
	//+WEAPON.NOAUTOFIRE
	//+WEAPON.NOLMS
	Inventory.PickupMessage "Power Up! BFG90XX!"
	+WEAPON.BFG
	-WEAPON.CHEATNOTWEAPON
	States
	{
	Ready:
		BFGG A 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_BBAMEGAMAN,1,TINT_BBA)
		BFGG A 1 A_WeaponReady
	Wait
	Deselect:
		BFGG A 0 A_Lower
		BFGG A 1 A_Lower
	Loop
	Select:
		BFGG A 0 A_Raise
		BFGG A 1 A_Raise
	Loop
	Fire:
		BFGG A 0 A_JumpIfNoAmmo("NoAmmo")
		BFGG A 20 A_PlaySound("BBA_Snd/bfgcharge",1,0.75)//A_BFGSound
		BFGG B 10
		BFGG C 0 A_PlayWeaponSound("BBA_Snd/bfgfire")//A_FireBFG
		BFGG C 6 A_FireCustomMissile("BBA_BFGBall",0,1,0,0)
		BFGG D 24
		BFGG A 4 A_ReFire
	Goto Ready+1
	Altfire:
		BFGG A 0 A_GiveInventory("VivifyDelay5",1)
		BFGG A 0 A_Refire(1)
		BFGG A 1 OffSet(-15,42)A_JumpIfInventory("PlayerPropertyRage",1,1)
		BFGG A 1 OffSet(-45,62)
	Fist:
		BFGG A 19 OffSet(-45,152)A_GunFlash("Flash",1)
		BFGG A 0 A_GiveInventory("VivifyDelay5",1)
		BFGG A 0 A_Refire("Fist")
		BFGG A 1 OffSet(-45,152)A_TakeInventory("VivifyDelay5",99)
		BFGG A 1 OffSet(-45,114)A_JumpIfInventory("PlayerPropertyRage",1,1)
		BFGG A 1 OffSet(-45,72)
		BFGG A 1 OffSet(-45,62)A_JumpIfInventory("PlayerPropertyRage",1,1)
		BFGG A 1 OffSet(-30,52)
		BFGG A 1 OffSet(-15,42)A_JumpIfInventory("PlayerPropertyRage",1,1)
		BFGG A 0
	goto Ready+1
	}
}

actor BBA_BFGBall : ProjSpawnFuncActor
{
PROJECTILE
damagetype "BBA_BFG"
obituary "$OB_BBABFG"
+SKYEXPLODE
+EXPLODEONWATER
+DONTREFLECT
+BRIGHT
Damage (300)
Radius 13
height 13
speed 25
scale 2.5
states
{
Spawn:
BFS1 AAAABBBB 1 A_SpawnItemEx("BBA_BFGBallFX",0,random(-32,32),random(-32,32),-1,0,0,0,1)
loop
Death:
BFE1 A 0 A_PlaySound("BBA_Snd/bfg",7,0.95)
BFE1 A 0 A_SpawnItemEx("BBA_BFGBallFX",0,0,0,15,0,0,18 * 0,1)
BFE1 A 0 A_SpawnItemEx("BBA_BFGBallFX",0,0,0,15,0,0,18 * 1,1)
BFE1 A 0 A_SpawnItemEx("BBA_BFGBallFX",0,0,0,15,0,0,18 * 2,1)
BFE1 A 0 A_SpawnItemEx("BBA_BFGBallFX",0,0,0,15,0,0,18 * 3,1)
BFE1 A 0 A_SpawnItemEx("BBA_BFGBallFX",0,0,0,15,0,0,18 * 4,1)
BFE1 A 0 A_SpawnItemEx("BBA_BFGBallFX",0,0,0,15,0,0,18 * 5,1)
BFE1 A 0 A_SpawnItemEx("BBA_BFGBallFX",0,0,0,15,0,0,18 * 6,1)
BFE1 A 0 A_SpawnItemEx("BBA_BFGBallFX",0,0,0,15,0,0,18 * 7,1)
BFE1 A 0 A_SpawnItemEx("BBA_BFGBallFX",0,0,0,15,0,0,18 * 8,1)
BFE1 A 0 A_SpawnItemEx("BBA_BFGBallFX",0,0,0,15,0,0,18 * 9,1)
BFE1 A 0 A_SpawnItemEx("BBA_BFGBallFX",0,0,0,15,0,0,18 * 10,1)
BFE1 A 0 A_SpawnItemEx("BBA_BFGBallFX",0,0,0,15,0,0,18 * 11,1)
BFE1 A 0 A_SpawnItemEx("BBA_BFGBallFX",0,0,0,15,0,0,18 * 12,1)
BFE1 A 0 A_SpawnItemEx("BBA_BFGBallFX",0,0,0,15,0,0,18 * 13,1)
BFE1 A 0 A_SpawnItemEx("BBA_BFGBallFX",0,0,0,15,0,0,18 * 14,1)
BFE1 A 0 A_SpawnItemEx("BBA_BFGBallFX",0,0,0,15,0,0,18 * 15,1)
BFE1 A 0 A_SpawnItemEx("BBA_BFGBallFX",0,0,0,15,0,0,18 * 16,1)
BFE1 A 0 A_SpawnItemEx("BBA_BFGBallFX",0,0,0,15,0,0,18 * 17,1)
BFE1 A 0 A_SpawnItemEx("BBA_BFGBallFX",0,0,0,15,0,0,18 * 18,1)
BFE1 A 0 A_SpawnItemEx("BBA_BFGBallFX",0,0,0,15,0,0,18 * 19,1)
BFE1 A 0 A_SpawnItemEx("BBA_BFGBallFX",0,0,0,15,0,0,18 * 20,1)
BFE1 AB 4
BFE1 C 0 ACS_NamedExecuteAlways("cbm_bbabfg",0,1000) // Scan for players in range
BFE1 C 4 A_Explode(350,300,0,0,24)
BFE1 DEF 4
stop
}
}

actor BBA_BFGBallFX : BasicGraphicEffect
{
+BRIGHT
States
{
SpawnFrame:
BFS1 CD 3
BFS1 E 2 A_ScaleVelocity(1.15)
BFS1 E 1 A_Fadeout(0.2)
goto SpawnFrame+2
}
}



actor BBA_BFGTracerSpawner_P : CustomInventory
{
states
{
Pickup:
TNT1 A 0 A_SpawnItemEx("BBA_BFGTracer",0,0,8,0,0,0,0,1)
stop
}
}

actor BBA_BFGTracerSpawner_-1 : CustomInventory
{
states
{
Pickup:
TNT1 A 0 A_SpawnItemEx("BBA_BFGTracer",0,0,8,0,0,0,0,1)
stop
}
}
actor BBA_BFGTracerSpawner_0 : CustomInventory{states{Pickup:TNT1 A 0 A_SpawnItemEx("BBA_BFGTracer0",0,0,8,0,0,0,0,1)stop}}
actor BBA_BFGTracerSpawner_1 : CustomInventory{states{Pickup:TNT1 A 0 A_SpawnItemEx("BBA_BFGTracer1",0,0,8,0,0,0,0,1)stop}}
actor BBA_BFGTracerSpawner_2 : CustomInventory{states{Pickup:TNT1 A 0 A_SpawnItemEx("BBA_BFGTracer2",0,0,8,0,0,0,0,1)stop}}
actor BBA_BFGTracerSpawner_3 : CustomInventory{states{Pickup:TNT1 A 0 A_SpawnItemEx("BBA_BFGTracer3",0,0,8,0,0,0,0,1)stop}}
actor BBA_BFGTracerSpawner_255 : BBA_BFGTracerSpawner_P{}


actor BBA_BFGTracer : BasicExplosion
{
damagetype "BBA_BFGSplash"
obituary "$OB_BBABFGZAP"
+SEEKERMISSILE
+LOOKALLAROUND
renderstyle none
reactiontime 1
speed 0
states
{
Spawn:
TNT1 A 0
TNT1 A 0 ACS_NamedExecuteWithResult("core_setpointer",AAPTR_TRACER,CallACS("cbm_getfixedangle")+1000)
//TNT1 A 2  // Set Tracer field to scanned player
TNT1 A 1 A_JumpIfTargetInLOS("SpawnGive",0,1) // Check if can actually see the player
stop
SpawnGive:
TNT1 A 0 A_ReArrangePointers(8,1,2) // Shenanigans (Swap Tracer to Target and Target to Tracer)
TNT1 A 1 A_CustomRailgun(0,0,0,0,RGF_SILENT|RGF_NOPIERCING,1,40,"none",0,0,1000,0,1.0,0,"BBA_BFGFX",0) // Zap FX
goto SpawnBoom
SpawnBoom:
TNT1 A 0 A_ReArrangePointers(8,1,2) // Do it again
TNT1 A 0 A_Warp(8,0,0,28,0,8)
TNT1 A 0 A_Explode(200,14,0,0,14)
TNT1 A 3 A_GiveToTarget("BBA_Money",reactiontime)
stop
}
}

actor BBA_BFGTracer0 : BBA_BFGTracer
{
states
{
SpawnGive:
TNT1 A 0 A_ReArrangePointers(8,1,2)
TNT1 A 1 A_CustomRailgun(0,0,0,0,3,1,40,"none",0,0,1000,0,1.0,0,"BBA_BFGFX0",0)
goto SpawnBoom
}
}
actor BBA_BFGTracer1 : BBA_BFGTracer
{
states
{
SpawnGive:
TNT1 A 0 A_ReArrangePointers(8,1,2)
TNT1 A 1 A_CustomRailgun(0,0,0,0,3,1,40,"none",0,0,1000,0,1.0,0,"BBA_BFGFX1",0)
goto SpawnBoom
}
}
actor BBA_BFGTracer2 : BBA_BFGTracer
{
states
{
SpawnGive:
TNT1 A 0 A_ReArrangePointers(8,1,2)
TNT1 A 1 A_CustomRailgun(0,0,0,0,3,1,40,"none",0,0,1000,0,1.0,0,"BBA_BFGFX2",0)
goto SpawnBoom
}
}
actor BBA_BFGTracer3 : BBA_BFGTracer
{
states
{
SpawnGive:
TNT1 A 0 A_ReArrangePointers(8,1,2)
TNT1 A 1 A_CustomRailgun(0,0,0,0,3,1,40,"none",0,0,1000,0,1.0,0,"BBA_BFGFX3",0)
goto SpawnBoom
}
}

actor BBA_BFGFX
{
+NOINTERACTION
+CLIENTSIDEONLY
+FORCEXYBILLBOARD
+BRIGHT
Radius 2
Height 2
scale 0.25
Args -1
states
{
Spawn:
TNT1 A 0
TNT1 A 0 A_JumpIf(args[0]<0,2)
TNT1 A 0 A_GiveInventory("BBA_BFGFX_GrossHack_P",1)//To get team colors working on an actor that has no pointers
TNT1 A 0 A_Jump(256,1,3)//But the actor knows which team fired it!
BFE1 G 2
BFE1 G 1 A_FadeOut(0.1)
wait
Spawn2:
BFE1 H 2
BFE1 H 1 A_FadeOut(0.25)
loop
}
}

actor BBA_BFGFX0 : BBA_BFGFX{Args 0}
actor BBA_BFGFX1 : BBA_BFGFX{Args 1}
actor BBA_BFGFX2 : BBA_BFGFX{Args 2}
actor BBA_BFGFX3 : BBA_BFGFX{Args 3}

actor BBA_BFGFX_GrossHack_P : CustomInventory
{
states
{
Pickup:
TNT1 A 0 A_JumpIf(CallACS("core_Check_ProjectileColor_Server"),"Pickup2")
stop
Pickup2:
TNT1 A 0 ACS_NamedExecuteWithResult("core_Set_Projectile_Translation",args[0],CallACS("core_Check_TranslateWhiteColors"),CallACS("core_Check_TranslateBlackColors"))
stop
}
}

actor BBA_PistolShot : ProjSpawnFuncActorFast
{
PROJECTILE
damagetype "BBA_Pistol"
Obituary "$OB_BBAPISTOL"
Damage (50)
radius 10
height 7
+FORCEXYBILLBOARD
Speed 150
scale 2.5
+HITTRACER
reactiontime 28
States
{
Spawn:
TNT1 A 0 
Goto Fly
Fly:
BBAB A 1 //A_SpawnItemEx("RevolverShotFX",0,0,0,0,0,0,0,1)
loop
XDeath:
Crash:
TNT1 A 0 A_JumpIf(CallACS("cbm_istracerenemy")==1,"Give")
Goto Death
Give:
TNT1 A 0 A_GiveToTarget("BBA_Money",reactiontime)
Goto Death
Death:
BBAB BCD 2
stop
}
}

actor BBA_ChaingunShot : BBA_PistolShot
{
damagetype "BBA_Chaingun"
Obituary "$OB_BBACHAINGUN"
reactiontime 9
Damage (50)
}

actor BBA_ShotgunShot : BBA_PistolShot
{
damagetype "BBA_Shotgun"
Obituary "$OB_BBASHOTGUN"
reactiontime 14
Speed 100
}

actor BBA_SuperShotgunShot : BBA_PistolShot
{
damagetype "BBA_SSG"
Obituary "$OB_BBASUPERSHOTGUN"
reactiontime 6
Damage (30)
speed 120
}


//actor BBAMegaman_W_NormalBar : NormalBar {Args 160,198}
actor BBA_Pistol_ScriptBar : ScriptBar {}
actor BBA_Shotgun_ScriptBar : ScriptBar {}
actor BBA_SuperShotgun_ScriptBar : ScriptBar {}
actor BBA_Chaingun_ScriptBar : ScriptBar {}
actor BBA_RocketLauncher_ScriptBar : ScriptBar {}
actor BBA_PlasmaRifle_ScriptBar : ScriptBar {}
actor BBA_BFG9000_ScriptBar : ScriptBar {}