actor FlashStopperBoss : BaseMM8BDMWep_CBM 
{
tag "$TAGC_4A"
dropitem "FlashBulbWepCDropped"
Weapon.AmmoGive 28
Inventory.Pickupmessage "Power up! Flash Stopper??"
weapon.ammotype "WattIsMyAmmo"
weapon.ammotype2 "BrightIdeasAmmo"
+WEAPON.NOAUTOAIM
Obituary "$OB_BRIGHTBUSTER"
States
{
Spawn:
C_04 A 1
loop
Ready:
FSTB A 0 ACS_ExecuteAlways(998,0,DYE_BRIGHTMAN)
FSTB A 0 A_GunFlash
FSTB JI 2
goto Ready1

Ready1:
FSTB A 0 A_JumpIfInventory("WattIsMyAmmo",7,"Ready2")
FSTB A 0 A_JumpIfInventory("BrightIdeasAmmo",28,"Ready1a")
FSTB A 3 A_WeaponReady(WRF_NOFIRE)
FSTB A 0 A_GiveInventory("WattIsMyAmmo",1)
loop
Ready1a:
FSTB A 0 A_JumpIfInventory("WattIsMyAmmo",7,"Ready2a")
FSTB A 3 A_WeaponReady(WRF_NOFIRE|WRF_ALLOWRELOAD)
FSTB A 0 A_GiveInventory("WattIsMyAmmo",1)
loop
Ready2:
FSTB A 0 A_JumpIfInventory("WattIsMyAmmo",28,"Ready3")
FSTB A 0 A_JumpIfInventory("BrightIdeasAmmo",28,"Ready2a")
FSTB A 3 A_WeaponReady(WRF_NOSECONDARY)
FSTB A 0 A_GiveInventory("WattIsMyAmmo",1)
loop
Ready2a:
FSTB A 0 A_JumpIfInventory("WattIsMyAmmo",28,"Ready3a")
FSTB A 3 A_WeaponReady(WRF_NOSECONDARY|WRF_ALLOWRELOAD)
FSTB A 0 A_GiveInventory("WattIsMyAmmo",1)
loop
Ready3:
FSTB A 0 A_JumpIfInventory("BrightIdeasAmmo",28,"Ready3a")
FSTB A 3 A_WeaponReady
FSTB A 0 A_GiveInventory("WattIsMyAmmo",1)
loop
Ready3a:
FSTB A 3 A_WeaponReady(WRF_ALLOWRELOAD)
FSTB A 0 A_GiveInventory("WattIsMyAmmo",1)
loop
Deselect:
FSTB AAAAAAAAAAAAAAAAAAAAAA 0 A_Lower
FSTB A 1 A_Lower
Loop
Select:
FSTB AAAAAAAAAAAAAAAAAAAAAA 0 A_Raise
FSTB A 1 A_Raise
Loop

Fire:
FSTB A 0 A_JumpIfInventory("WattIsMyAmmo",1,"FireBuster")
goto Ready1
FireBuster:
FSTB A 0 A_JumpIfInventory("IsBot",1,"BotFire")
FSTB A 0 A_TakeInventory("WattIsMyAmmo",1)
FSTB A 0 A_PlaySoundEx("weapon/brightbuster","Weapon")
FSTB A 0 A_GiveInventory("BrightmanMain_CI",1)
FSTB BC 2
FSTB A 3
FSTB A 0 A_Refire
goto Ready1
AltFire:
FSTB A 0 A_TakeInventory("WattIsMyAmmo",28,1)
FSTB A 0 A_PlaySoundEx("weapon/BombThrow","Weapon")
FSTB A 0 A_GiveInventory("BrightmanAlt_CI",1)
FSTB I 4 A_GunFlash("Flash.BulbToss",GFF_NOEXTCHANGE)
FSTB JJJI 4
Goto Ready1

Reload:
FSTB I 0 ACS_NamedExecuteWithResult("BULL_SetState",1)
FSTB I 0 SetPlayerProperty(0,1,0)
FSTB I 0 A_PlaySoundEx("weapon/flashstopper","Weapon")
FSTB I 0 A_GiveInventory("BrightmanOther_CI",1)
FSTB I 0 A_GunFlash
FSTB I 5 A_SetBlend(white,0.95,5)
FSTB I 2 A_TakeInventory("BrightFlashStock",99)
FSTB I 2 A_TakeInventory("BrightIdeasAmmo",28,1)
FSTB I 2 A_TakeInventory("BrightFlashStock",99)
FSTB I 2 A_TakeInventory("BrightIdeasAmmo",28,1)
FSTB I 2
FSTB I 0 A_TakeInventory("BrightIdeasAmmo",28,1)
FSTB I 0 A_TakeInventory("BrightFlashStock",99)
FSTB I 0 SetPlayerProperty(0,0,0)
goto Ready1
Flash:
TNT1 A 0 A_JumpIfInventory("IsDead",1,"NoFlash")
TNT1 A 1 A_GiveInventory("BrightFlashStatePickup",1)
loop
Flash.BulbToss:
FSTB DEFGGHH 1 A_GiveInventory("BrightFlashStatePickup",1)
TNT1 AAAAAAAA 1 A_GiveInventory("BrightFlashStatePickup",1)
goto Flash

BotFire:
FSTB A 0 A_JumpIfInventory("BrightIdeasAmmo",28,"BotFire2")
FSTB A 0 A_JumpIfInventory("WattIsMyAmmo",28,"BotFire1")
goto FireBuster+1
BotFire1:
FSTB A 0 A_Jump(64,"AltFire")
goto FireBuster+1
BotFire2:
TNT1 A 0 A_JumpIfCloser(350,"Reload")
TNT1 A 0 A_Jump(64,"BotFire3")
goto BotFire+1
BotFire3:
TNT1 A 0 A_FaceTarget
TNT1 A 0 A_JumpIfCloser(350,"Reload")
goto BotFire+1
}
}

actor WattIsMyAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 28
+INVENTORY.IGNORESKILL
}

actor BrightIdeasAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 28
+INVENTORY.IGNORESKILL
}

actor BrightFlashStock : Inventory
{
inventory.amount 1
inventory.maxamount 999
}

actor BrightSparkleDelayF : Powerup
{
Powerup.Duration 22
}

actor BrightmanPowerLightAmp : PowerLightAmp
{//Needs gl_enhanced_nightvision false, shouldn't force user
Powerup.Duration 0x7FFFFFFC
//powerup.color purple 0.5
}

actor FlashStopperUseItem : BasicClassItem
{
inventory.icon "BriIcon"
inventory.pickupmessage "Careful, this bulb is one of a kind, known as the 'Eternal Light' to some."
Tag "Execute Flash Stopper"
states
{
Spawn:
WEA3 E 1
loop
Use:
TNT1 A 0 A_JumpIfInventory("BrightIdeasAmmo",28,"Success")
fail
Success:
TNT1 A 0 A_GiveInventory("VivifyDelay4",1)
fail
}
}

actor BrightFlashStatePickup : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_GiveInventory("BrightmanSparkleFX_P",1)
TNT1 A 0 A_JumpIfInventory("BrightFlashStock",10,"Success")
TNT1 A 0 A_JumpIfInventory("PowerRage_ST",1,"PickupR")
TNT1 A 0 A_GiveInventory("BrightFlashStock",1)
stop
PickupR:
TNT1 A 0 A_GiveInventory("BrightFlashStock",2)
stop
Success:
TNT1 A 0 A_TakeInventory("BrightFlashStock",10)
TNT1 A 0 A_GiveInventory("BrightIdeasAmmo",1)
stop
}
}

actor BrightmanSparkleFX_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("BrightIdeasAmmo",28,"Pickup2")
stop
Pickup2:
TNT1 A 0 A_JumpIfInventory("BrightSparkleDelayF",1,"No")
TNT1 A 0 A_GiveInventory("BrightSparkleDelayF",1)
TNT1 A 0 A_SpawnItemEx("BrightmanSparkleFX_Helper",0,0,0,0,0,0,0,1)
stop
No:
TNT1 A 0
stop
}
}

actor BrightmanSparkleFX_Helper : BasicHelper
{
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_SpawnItemEx("BrightmanSparkleFX",random(2,12),0,random(68,76),0,0,0,random(1,16)*20,1)
TNT1 A 1
stop
}
}

actor BrightmanSparkleFX : BasicClientSide
{
+FORCEXYBILLBOARD
+BRIGHT
Renderstyle "Translucent"
Alpha 0.95
Scale 2.25
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_Jump(256,"Spawn1","Spawn2","Spawn3","Spawn4")
Spawn1:
FSTB UVWX 2
stop
Spawn2:
FSTB UVVWWXX 1
stop
Spawn3:
FSTB VUUVWX 1
stop
Spawn4:
FSTB VUVWX 1
stop
}
}

actor BrightBulbToss
{
Translation "192:192=211:211","198:198=225:225","202:202=211:211"
PROJECTILE
damagetype "BrightM_Bulb"
Obituary "$OB_BRIGHTBULB"
-NOGRAVITY
+THRUACTORS
+BOUNCEONWALLS
+BOUNCEONCEILINGS
bouncecount 15
Damage (0)
Radius 20
Height 16
Speed 40
scale 2.5
States
{
Spawn:
TNT1 A 0
TNT1 A 0 ACS_NamedExecuteAlways("BULL_Tidifier", 0)
TNT1 A 0 ThrustThingZ(0,34,0,1)
SpawnL:
FSTB KKLLMMNN 1 A_SpawnItemEx("FuseBodySparkleFX",0,0,16,0,0,0,0,1)
loop

Death:
TNT1 A 0 A_ChangeFlag("NOGRAVITY",1)
TNT1 A 0 A_ChangeFlag("FLOORHUGGER",1)
TNT1 A 0 A_Stop
TNT1 A 0 A_PlaySound("weapon/rminestick")
FSTB YYYYYZYZYZ 2
TNT1 A 0 A_SetArg(2,(ceilingz-z<=16)*-4+(z-floorz==0)*4)
TNT1 AAAAAAA 0 A_SpawnItemEx("BrightBulbShardFX",0,0,Args[2],random(-10+abs(Args[2]),10-abs(Args[2])),random(-10+abs(Args[2]),10-abs(Args[2])),random(-2+abs(Args[2]),2+abs(Args[2])),0,1,32)
TNT1 A 0 A_SpawnItemEx("BrightBulbTossBoom",0,0,10,0,0,0,0,1)
TNT1 A 2
stop
}
}

actor BrightBulbTossB : BrightBulbToss{translation "192:192=205:205", "198:198=74:74", "202:202=205:205"}
actor BrightBulbTossR : BrightBulbToss{translation "192:192=171:171", "198:198=41:41", "202:202=171:171"}
actor BrightBulbTossO : BrightBulbToss{translation "192:192=104:104", "198:198=128:128", "202:202=104:104"}
actor BrightBulbTossP : BrightBulbToss{translation "192:192=229:229", "198:198=232:232", "202:202=229:229"}

actor BrightBulbShardFX
{
+MISSILE
+CLIENTSIDEONLY
+THRUACTORS
+DOOMBOUNCE
+RANDOMIZE
BounceFactor 0.3
WallBounceFactor 0.3
renderstyle translucent
Radius 4
Height 4
Speed 20
scale 2.5
States
{
Spawn:
FSTB O 0
FSTB O 0 A_Jump(256,1,2,3,4)
FSTB OPQRSOPQRSOPQRSOPQRSOPQRSOPQRSOPQRSOPQRSOPQRSOPQRSOPQRS 4
stop
Death:
FSTB S 0 A_Jump(256,1,2,3)
FSTB SSSSSSSSSSSS 2
FSTB SSSSS 1 A_FadeOut(0.175)
stop
}
}

actor BrightBulbTossBoom : BasicExplosion
{
damagetype "BrightM_Bulb"
Obituary "$OB_BRIGHTBULB"
+FORCEXYBILLBOARD
+BRIGHT
scale 3.0
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_PlaySoundEx("weapon/centaurflash","Voice")
TNT1 A 1 A_Explode(20,156,0,0,32)
TNT1 A 0 ACS_NamedExecuteAlways("core_flashstopperlight",0,156)
Y_6L JKRSTUVWX 1
stop
}
}

actor BrightShot
{
Translation "202:202=211:211"
PROJECTILE
damagetype "BrightM_Shot"
Obituary "$OB_BRIGHTBUSTER"
+FORCEXYBILLBOARD
+BRIGHT
Damage (10)
radius 6
height 6
Speed 42
scale 2.5
States
{
Spawn:
TNT1 A 0
TNT1 A 0 ACS_NamedExecuteAlways("BULL_Tidifier", 0)
FSTB T 33
wait
//FSTB TT 1 A_SetScale(ScaleX-0.5)
//stop
}
}

actor BrightShotB : BrightShot{translation "202:202=205:205"}
actor BrightShotR : BrightShot{translation "202:202=171:171"}
actor BrightShotO : BrightShot{translation "202:202=104:104"}
actor BrightShotP : BrightShot{translation "202:202=229:229"}

actor BrightmanFlashStopper : BasicExplosion
{
translation "192:192=4:4", "198:198=225:225"
Obituary "$OB_BRIGHTFLASH"
damagetype "BrightM_Stopper"
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_SpawnItemEx("BrightmanFlashStopperFX",0,0,64-28,0,0,0,0,1)
TNT1 A 2 A_Explode(6,512,0,0,256)
stop
}
}

actor BrightmanFlashStopperB : BrightmanFlashStopper{translation "192:192=205:205", "198:198=74:74"}
actor BrightmanFlashStopperR : BrightmanFlashStopper{translation "192:192=171:171", "198:198=41:41"}
actor BrightmanFlashStopperO : BrightmanFlashStopper{translation "192:192=104:104", "198:198=128:128"}
actor BrightmanFlashStopperP : BrightmanFlashStopper{translation "192:192=229:229", "198:198=232:232"}

actor BrightmanFlashStopperFX : BasicClientSide
{
+FORCEXYBILLBOARD
+BRIGHT
renderstyle translucent
alpha 1.0
scale 5.0
States
{
Spawn:
X_4A ABCDEF 1 A_FadeOut(0.12)
stop
}
}

actor PowerBrightFlashWeaken : PowerProtection
{
Powerup.Duration 70
damagefactor "BrightM_Stopper", 2.0
//damagefactor "BrightM_Bulb", 1.5
//damagefactor "BrightM_Shot", 2.0
}

actor BossFlashStoppered : BasicHelper
{
reactiontime 70
States
{
Spawn:
TNT1 A 0
TNT1 A 0 //A_GiveToTarget("PowerBrightFlashWeaken",1)
TNT1 A 1 A_GiveToTarget("BossFlashStopperedStop",1)
TNT1 A 0 A_TakeFromTarget("EndBossFlashStoppered",1)
TNT1 A 0 A_CountDown
goto Spawn2
Spawn2:
TNT1 A 0 A_JumpIfInTargetInventory("EndBossFlashStoppered",1,"Death")
TNT1 A 1 A_GiveToTarget("BossFlashStopperedStop",1)
TNT1 A 0 A_CountDown
loop
Death:
TNT1 A 0
TNT1 A 0 //A_TakeFromTarget("PowerBrightFlashWeaken",1)
TNT1 A 1
stop
}
}

actor BossFlashStopperedStop : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_Stop
TNT1 A 0 A_SpawnItemEx("BossFlashStopperedStopFX",random(16,32),0,random(12,42),0,0,0,random(1,16)*20,1,32)
stop
}
}

actor BossFlashStopperedStopFX
{
scale 0.75
-SOLID
+NOGRAVITY
+CLIENTSIDEONLY
+FORCEXYBILLBOARD
+BRIGHT
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_Jump(256,"Spawn1","Spawn2","Spawn3","Spawn4")
Spawn1:
FSTB UVWX 2
stop
Spawn2:
FSTB UVVWWXX 1
stop
Spawn3:
FSTB VUUVWX 1
stop
Spawn4:
FSTB VUVWX 1
stop
}
}

actor BrightmanMain_CI : TeamColor_CI
{
states
{
FireX:
TNT1 A 0 A_FireCustomMissile("BrightShot",random(-1,1)*3,0,8,0)
goto Done
FireB:
TNT1 A 0 A_FireCustomMissile("BrightShotB",random(-1,1)*3,0,8,0)
goto Done
FireR:
TNT1 A 0 A_FireCustomMissile("BrightShotR",random(-1,1)*3,0,8,0)
goto Done
FireO:
TNT1 A 0 A_FireCustomMissile("BrightShotO",random(-1,1)*3,0,8,0)
goto Done
FireP:
TNT1 A 0 A_FireCustomMissile("BrightShotP",random(-1,1)*3,0,8,0)
goto Done
}
}

actor BrightmanAlt_CI : TeamColor_CI
{
states
{
FireX:
TNT1 A 0 A_FireCustomMissile("BrightBulbToss",0,0,-8,0)
goto Done
FireB:
TNT1 A 0 A_FireCustomMissile("BrightBulbTossB",0,0,-8,0)
goto Done
FireR:
TNT1 A 0 A_FireCustomMissile("BrightBulbTossR",0,0,-8,0)
goto Done
FireO:
TNT1 A 0 A_FireCustomMissile("BrightBulbTossO",0,0,-8,0)
goto Done
FireP:
TNT1 A 0 A_FireCustomMissile("BrightBulbTossP",0,0,-8,0)
goto Done
}
}

actor BrightmanOther_CI : TeamColor_CI
{
states
{
FireX:
TNT1 A 0 A_FireCustomMissile("BrightmanFlashStopper",0,1,0,0)
goto Done
FireB:
TNT1 A 0 A_FireCustomMissile("BrightmanFlashStopperB",0,1,0,0)
goto Done
FireR:
TNT1 A 0 A_FireCustomMissile("BrightmanFlashStopperR",0,1,0,0)
goto Done
FireO:
TNT1 A 0 A_FireCustomMissile("BrightmanFlashStopperO",0,1,0,0)
goto Done
FireP:
TNT1 A 0 A_FireCustomMissile("BrightmanFlashStopperP",0,1,0,0)
goto Done
}
}