actor Crystalman_W : BaseMM8BDMWep_CBM
{
tag "$TAGC_5H"
dropitem "CrystalEyeWep"
Weapon.AmmoUse2 4
Weapon.AmmoGive2 28
Obituary "$OB_CRYSTALEYE"
weapon.ammotype1 "TotallyNotFakeCrystalsAmmo"
States
{
Spawn:
C_05 H 1
loop

Deselect:
CRYA A 0
goto DeselectSwap
Select:
CRYA A 0
goto SelectSwap

Ready:
CRYA A 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_CRYSTALMAN)
CRYA A 0 A_GiveInventory("SpawningMisfire",1)
goto Ready0
Ready0:
CRYA A 2 A_WeaponReady
CRYA A 0 A_TakeInventory("SpawningMisfire",1)
Goto Ready1
SpawnProtect:
CRYA A 1
Goto Ready0

ReadyCheck:

CRYA H 0 A_JumpIfInventory("CrystalEyeDelay",1,"Ready1a")
CRYA H 0 A_JumpIfInventory("CrystalEyeIsOut",1,"ReadyCheck2")
goto Ready1
ReadyCheck2:
CRYA A 0 A_JumpIfInventory("TotallyNotFakeCrystalsAmmo",56,"Ready2.d")
CRYA A 0 A_JumpIfInventory("TotallyNotFakeCrystalsAmmo",42,"Ready2.c")
CRYA A 0 A_JumpIfInventory("TotallyNotFakeCrystalsAmmo",28,"Ready2.b")
CRYA A 0 A_JumpIfInventory("TotallyNotFakeCrystalsAmmo",14,"Ready2.a")
goto Ready2

Ready1:
CRYA A 0 A_JumpIfInventory("CrystalEyeDelay",1,"Ready1a")
CRYA A 2 A_WeaponReady
wait
Ready1a:
CRYA A 2 A_WeaponReady(4)
CRYA A 0 A_TakeInventory("CrystalEyeDelay",1)
goto Ready1

Ready2:
CRYA A 2 A_WeaponReady
CRYA A 0 A_JumpIfInventory("CrystalEyeIsOut",1,"Ready2")
goto Ready2End
Ready2.a:
CRYA G 2 A_WeaponReady
CRYA G 0 A_JumpIfInventory("CrystalEyeIsOut",1,1)
goto Ready2End
CRYA A 2 A_WeaponReady
CRYA A 0 A_JumpIfInventory("CrystalEyeIsOut",1,"Ready2.a")
goto Ready2End
Ready2.b:
CRYA H 2 A_WeaponReady
CRYA H 0 A_JumpIfInventory("CrystalEyeIsOut",1,1)
goto Ready2End
CRYA A 2 A_WeaponReady
CRYA A 0 A_JumpIfInventory("CrystalEyeIsOut",1,"Ready2.b")
goto Ready2End
Ready2.c:
CRYA I 2 A_WeaponReady
CRYA I 0 A_JumpIfInventory("CrystalEyeIsOut",1,1)
goto Ready2End
CRYA A 2 A_WeaponReady
CRYA A 0 A_JumpIfInventory("CrystalEyeIsOut",1,"Ready2.c")
goto Ready2End
Ready2.d:
CRYA J 2 A_WeaponReady
CRYA J 0 A_JumpIfInventory("CrystalEyeIsOut",1,1)
goto Ready2End
CRYA A 2 A_WeaponReady
CRYA A 0 A_JumpIfInventory("CrystalEyeIsOut",1,"Ready2.d")
goto Ready2End

Ready2End:
CRYA A 0 A_GiveInventory("CrystalEyeDelay",14)
CRYA A 0 A_TakeInventory("TotallyNotFakeCrystalsAmmo")
goto Ready1a

Fire:
CRYA B 0 A_JumpIfInventory("IsBot",1,"BotFire2")
CRYA B 0 A_JumpIfInventory("SpawningMisfire",1,"SpawnProtect")
CRYA B 0 A_JumpIfInventory("CrystalEyeIsOut",1,"FireDet")
CRYA B 0 A_JumpIfInventory("CrystalEyeDelay",1,"FireDet")
CRYA B 1 A_GiveInventory("TotallyNotFakeCrystalsAmmo",1)
CRYA B 0 A_Refire("FireH")
goto FireEnd

FireH:
CRYA B 0 A_JumpIfInventory("TotallyNotFakeCrystalsAmmo",14,"FireH2")
CRYA B 1
CRYA B 0 A_Refire("FireH.a")
goto FireEnd
FireH.a:
CRYA B 1 A_GiveInventory("TotallyNotFakeCrystalsAmmo",1+CallACS("core_checkrune",RUNE_RAGE))
CRYA B 0 A_Refire("FireH")
goto FireEnd

FireH2:
CRYA B 0 A_PlaySoundEx("wep/CrysCharge1","Body")
FireH2.a:
CRYA B 0 A_JumpIfInventory("TotallyNotFakeCrystalsAmmo",28,"FireH3")
CRYA B 1
CRYA B 0 A_Refire("FireH2.b")
goto FireEnd
FireH2.b:
CRYA C 1 A_GiveInventory("TotallyNotFakeCrystalsAmmo",1+CallACS("core_checkrune",RUNE_RAGE))
CRYA C 0 A_Refire("FireH2.a")
goto FireEnd

FireH3:
CRYA B 0 A_PlaySoundEx("wep/CrysCharge2","Body")
FireH3.a:
CRYA B 0 A_JumpIfInventory("TotallyNotFakeCrystalsAmmo",42,"FireH4")
CRYA B 1
CRYA B 0 A_Refire("FireH3.b")
goto FireEnd
FireH3.b:
CRYA D 1 A_GiveInventory("TotallyNotFakeCrystalsAmmo",1+CallACS("core_checkrune",RUNE_RAGE))
CRYA D 0 A_Refire("FireH3.a")
goto FireEnd

FireH4:
CRYA B 0 A_PlaySoundEx("wep/CrysCharge3","Body")
FireH4.a:
CRYA B 0 A_JumpIfInventory("TotallyNotFakeCrystalsAmmo",56,"FireH5")
CRYA B 1
CRYA B 0 A_Refire("FireH4.b")
goto FireEnd
FireH4.b:
CRYA E 1 A_GiveInventory("TotallyNotFakeCrystalsAmmo",1+CallACS("core_checkrune",RUNE_RAGE))
CRYA E 0 A_Refire("FireH4.a")
goto FireEnd

FireH5:
CRYA B 0 A_PlaySoundEx("wep/CrysCharge4","Body")
FireH5.a:
CRYA B 1
CRYA B 0 A_Refire("FireH5.b")
goto FireEnd
FireH5.b:
CRYA F 1 A_GiveInventory("TotallyNotFakeCrystalsAmmo",1+CallACS("core_checkrune",RUNE_RAGE))
CRYA F 0 A_Refire("FireH5.a")
goto FireEnd

FireEnd:
CRYA B 0 A_GiveInventory("Crystalman_Fire_P")
CRYA B 0 A_JumpIfInventory("TotallyNotFakeCrystalsAmmo",14,"FireEnd2")
CRYA B 2 OffSet(-6,20)
CRYA B 2 OffSet(-12,8)
CRYA B 2 OffSet(-12,8)
CRYA B 2 OffSet(-9,13)
CRYA B 2 OffSet(-6,18)
CRYA B 2 OffSet(-4,23)
CRYA B 2 OffSet(-2,28)
goto ReadyCheck
FireEnd2:
CRYA B 0 A_JumpIfInventory("TotallyNotFakeCrystalsAmmo",28,"FireEnd3")
CRYA B 2 OffSet(-6,20)
CRYA C 2 OffSet(-12,8)
CRYA B 2 OffSet(-12,8)
CRYA C 2 OffSet(-9,13)
CRYA B 2 OffSet(-6,18)
CRYA C 2 OffSet(-4,23)
CRYA B 2 OffSet(-2,28)
goto ReadyCheck
FireEnd3:
CRYA B 0 A_JumpIfInventory("TotallyNotFakeCrystalsAmmo",42,"FireEnd4")
CRYA B 2 OffSet(-6,20)
CRYA D 2 OffSet(-12,8)
CRYA B 2 OffSet(-12,8)
CRYA D 2 OffSet(-9,13)
CRYA B 2 OffSet(-6,18)
CRYA D 2 OffSet(-4,23)
CRYA B 2 OffSet(-2,28)
goto ReadyCheck
FireEnd4:
CRYA B 0 A_JumpIfInventory("TotallyNotFakeCrystalsAmmo",56,"FireEnd5")
CRYA B 2 OffSet(-6,20)
CRYA E 2 OffSet(-12,8)
CRYA B 2 OffSet(-12,8)
CRYA E 2 OffSet(-9,13)
CRYA B 2 OffSet(-6,18)
CRYA E 2 OffSet(-4,23)
CRYA B 2 OffSet(-2,28)
goto ReadyCheck
FireEnd5:
CRYA B 2 OffSet(-6,20)
CRYA F 2 OffSet(-12,8)
CRYA B 2 OffSet(-12,8)
CRYA F 2 OffSet(-9,13)
CRYA B 2 OffSet(-6,18)
CRYA F 2 OffSet(-4,23)
CRYA B 2 OffSet(-2,28)
goto ReadyCheck

FireDet:
CRYA K 0 A_PlaySoundEx("weapon/crystalshot","Weapon")
CRYA K 0 A_GiveInventory("CrystalEyeDetonate",1)

CRYA K 2 OffSet(-6,20)
CRYA B 2 OffSet(-12,8)
CRYA K 2 OffSet(-12,8)
CRYA B 2 OffSet(-9,13)
CRYA K 2 OffSet(-6,18)
CRYA B 2 OffSet(-4,23)A_GiveInventory("CrystalEyeDelay",14)
CRYA K 2 OffSet(-2,28)

CRYA A 0 A_TakeInventory("TotallyNotFakeCrystalsAmmo")
CRYA A 0 A_TakeInventory("CrystalEyeDetonate")
CRYA A 0 A_TakeInventory("CrystalEyeIsOut")
Goto Ready1

AltFire:
CRYA B 0 A_PlaySoundEx("weapon/crystalshot","Weapon")
CRYA B 0 A_FireCustomMissile("CrystalShot",0,0,8,0)
CRYA B 2 OffSet(-6,23)
CRYA B 0 A_JumpIfInventory("TotallyNotFakeCrystalsAmmo",14,"AltFireE2")
CRYA B 2 OffSet(-12,14)
CRYA B 0 A_JumpIfInventory("CrystalEyeIsOut",1,2)
CRYA B 0 A_TakeInventory("CrystalEyeDelay",2)
CRYA B 2 OffSet(-12,14)
CRYA B 2 OffSet(-10,17)
CRYA B 2 OffSet(-8,20)
CRYA B 2 OffSet(-6,23)
CRYA B 2 OffSet(-4,26)
CRYA B 2 OffSet(-2,29)
goto ReadyCheck
AltFireE2:
CRYA B 0 A_JumpIfInventory("TotallyNotFakeCrystalsAmmo",28,"AltFireE3")
CRYA C 2 OffSet(-12,14)
CRYA B 2 OffSet(-12,14)
CRYA C 2 OffSet(-10,17)
CRYA B 2 OffSet(-8,20)
CRYA C 2 OffSet(-6,23)
CRYA B 2 OffSet(-4,26)
CRYA C 2 OffSet(-2,29)
goto ReadyCheck
AltFireE3:
CRYA B 0 A_JumpIfInventory("TotallyNotFakeCrystalsAmmo",42,"AltFireE4")
CRYA D 2 OffSet(-12,14)
CRYA B 2 OffSet(-12,14)
CRYA D 2 OffSet(-10,17)
CRYA B 2 OffSet(-8,20)
CRYA D 2 OffSet(-6,23)
CRYA B 2 OffSet(-4,26)
CRYA D 2 OffSet(-2,29)
goto ReadyCheck
AltFireE4:
CRYA B 0 A_JumpIfInventory("TotallyNotFakeCrystalsAmmo",56,"AltFireE5")
CRYA E 2 OffSet(-12,14)
CRYA B 2 OffSet(-12,14)
CRYA E 2 OffSet(-10,17)
CRYA B 2 OffSet(-8,20)
CRYA E 2 OffSet(-6,23)
CRYA B 2 OffSet(-4,26)
CRYA E 2 OffSet(-2,29)
goto ReadyCheck
AltFireE5:
CRYA F 2 OffSet(-12,14)
CRYA B 2 OffSet(-12,14)
CRYA F 2 OffSet(-10,17)
CRYA B 2 OffSet(-8,20)
CRYA F 2 OffSet(-6,23)
CRYA B 2 OffSet(-4,26)
CRYA F 2 OffSet(-2,29)
goto ReadyCheck


BotFire:
CRYA B 0 A_Jump(16,"HoldEND")
CRYA B 3 A_GiveInventory("TotallyNotFakeCrystalsAmmo",1)
CRYA B 0 A_Refire
Goto HoldEND
BotFire2:
CRYA B 0 A_Jump(128, "AltFire")
Goto Fire+1
}
}

actor TotallyNotFakeCrystalsAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 56
+INVENTORY.IGNORESKILL
}

actor CrystalEyeDelay : Inventory
{
inventory.amount 1
inventory.maxamount 14
}

actor CrystalEyeIsOut : Powerup
{
Powerup.Duration -22
}

actor CrystalEyeDetonate : Powerup
{
Powerup.Duration 20
}

actor CrystalmanEyeEnd_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_GiveInventory("CrystalEyeDelay",14)
TNT1 A 0 A_TakeInventory("CrystalEyeIsOut",9)
TNT1 A 0 A_TakeInventory("TotallyNotFakeCrystalsAmmo")
stop
}
}


actor Crystalman_Fire_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_SetArg(0,CallACS("cbm_countinv_acs",57,0))//TotallyNotFakeCrystalsAmmo
TNT1 A 0 A_PlaySoundEx("CrystalM/FireBig","Weapon")//weapon/crystalshot
TNT1 A 0 A_GiveInventory("CrystalEyeIsOut",1)
TNT1 A 0 A_SpawnItemEx("CrystalEyeC",0,0,32,cos(pitch),0,-sin(pitch),0,SXF_MULTIPLYSPEED+SXF_TRANSFERSPECIAL)//8192+32768
//TNT1 A 0 A_SpawnItemEx("CrystalEyeC",cos(pitch)*11,8,-sin(pitch)*11+32,cos(pitch),0,-sin(pitch),0,8192+32768)
TNT1 A 0 A_JumpIf(CallACS("core_checkrune",RUNE_SPREAD),1)
stop
TNT1 A 0 A_SpawnItemEx("CrystalEyeC",0,0,32,cos(pitch),0,-sin(pitch),15,8192+32768)
TNT1 A 0 A_SpawnItemEx("CrystalEyeC",0,0,32,cos(pitch),0,-sin(pitch),-15,8192+32768)
stop
}
}

actor CrystalEyeC : ProjSpawnFuncActor
{
var int user_TranslateBlackColors;
PROJECTILE
damagetype "CrystalM_Eye"
Obituary "$OB_CRYSTALEYEB"
+SKYEXPLODE
BounceSound "CrystalM/BounceBig"
+BOUNCEONFLOORS
+BOUNCEONWALLS
+BOUNCEONCEILINGS
+ALLOWBOUNCEONACTORS
+CANBOUNCEWATER
+BOUNCEAUTOOFF
//+EXPLODEONWATER
+DONTREFLECT
+FORCEXYBILLBOARD
bouncefactor 1.0
wallbouncefactor 1.0
BounceCount 125
Damage (220+Args[0]*2.5)
ReactionTime 25
Height 16
Radius 16
speed 22//28
Scale 2.5
States
{
Spawn:
//ABCDE Big
//FGHIJ Small
//KLMNO Big white
//PQRST Small white
Q_5H A 0
Q_5H A 0 A_GiveInventory("TotallyNotFakeCrystalsAmmo",4)
Q_5H AAAA 1 A_JumpIfInTargetInventory("CrystalEyeDetonate",1,"BoomAim")
Q_5H A 0 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"Death2")
Q_5H LLLL 1 A_JumpIfInTargetInventory("CrystalEyeDetonate",1,"BoomAim")
Q_5H A 0 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"Death2")
Q_5H CCCC 1 A_JumpIfInTargetInventory("CrystalEyeDetonate",1,"BoomAim")
Q_5H A 0 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"Death2")
Q_5H NNNN 1 A_JumpIfInTargetInventory("CrystalEyeDetonate",1,"BoomAim")
Q_5H A 0 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"Death2")
Q_5H DDDD 1 A_JumpIfInTargetInventory("CrystalEyeDetonate",1,"BoomAim")
Q_5H A 0 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"Death2")
Q_5H KKKK 1 A_JumpIfInTargetInventory("CrystalEyeDetonate",1,"BoomAim")
Q_5H A 0 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"Death2")
Q_5H AAAA 1 A_JumpIfInTargetInventory("CrystalEyeDetonate",1,"BoomAim")
Q_5H A 0 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"Death2")
Q_5H A 0 A_CountDown
goto Spawn+3
BoomAim://Aimed
TNT1 A 0 A_Stop
TNT1 A 0 ACS_NamedExecuteWithResult("cbm_CopyPointerAnglePitch",2,1)//Set angle based on player pitch/angle
TNT1 A 0 A_PlaySound("weapons/mm5/crystaleyesplit",2)
//TNT1 A 0 A_LogInt(Pitch)

TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,Cos(pitch)*28,0,-sin(pitch)*28)
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,Cos(pitch+10)*28,0,-sin(pitch+10)*28)
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,Cos(pitch-10)*28,0,-sin(pitch-10)*28)
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,Cos(pitch)*28,7,-sin(pitch)*28)
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,Cos(pitch)*28,-7,-sin(pitch)*28)

TNT1 A 0 A_JumpIfInTargetInventory("TotallyNotFakeCrystalsAmmo",28,"BoomAim28")
TNT1 A 0 A_JumpIfInTargetInventory("TotallyNotFakeCrystalsAmmo",14,"BoomAim14")
goto BoomE

BoomAim14:
TNT1 A 0 A_Jump(128,"BoomAim14.a")
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,Cos(pitch+10)*28,7,-sin(pitch+10)*28)
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,Cos(pitch-10)*28,-7,-sin(pitch-10)*28)
goto BoomE
BoomAim14.a:
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,Cos(pitch+10)*28,-7,-sin(pitch+10)*28)
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,Cos(pitch-10)*28,7,-sin(pitch-10)*28)
goto BoomE

BoomAim28:
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,Cos(pitch+10)*28,7,-sin(pitch+10)*28)
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,Cos(pitch-10)*28,7,-sin(pitch-10)*28)
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,Cos(pitch+10)*28,-7,-sin(pitch+10)*28)
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,Cos(pitch-10)*28,-7,-sin(pitch-10)*28)
TNT1 A 0 A_JumpIfInTargetInventory("TotallyNotFakeCrystalsAmmo",56,"BoomAim56")
TNT1 A 0 A_JumpIfInTargetInventory("TotallyNotFakeCrystalsAmmo",42,"BoomAim42")
goto BoomE

BoomAim42:
TNT1 A 0 A_Jump(128,"BoomAim42.a")
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,Cos(pitch+5)*28,3.5f,-sin(pitch+5)*28)
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,Cos(pitch-5)*28,-3.5f,-sin(pitch-5)*28)
goto BoomE
BoomAim42.a:
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,Cos(pitch+5)*28,-3.5f,-sin(pitch+5)*28)
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,Cos(pitch-5)*28,3.5f,-sin(pitch-5)*28,0,1)
goto BoomE

BoomAim56:
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,Cos(pitch+5)*28,3.5f,-sin(pitch+5)*28)
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,Cos(pitch+5)*28,-3.5f,-sin(pitch+5)*28)
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,Cos(pitch-5)*28,3.5f,-sin(pitch-5)*28)
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,Cos(pitch-5)*28,-3.5f,-sin(pitch-5)*28)
goto BoomE

Boom0://Classic
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,12,random(40,50))
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,12,random(-40,-50))
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,-12,random(40,50))
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,-12,random(-40,-50))
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,12,random(220,230))
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,12,random(-220,-230))
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,-12,random(220,230))
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,-12,random(-220,-230))
TNT1 A 0 A_JumpIfInTargetInventory("TotallyNotFakeCrystalsAmmo",1,1)
goto DeathBoom
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,0,random(-5,5))
TNT1 A 0 A_JumpIfInTargetInventory("TotallyNotFakeCrystalsAmmo",5,1)
goto DeathBoom
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,0,random(175,185))
TNT1 A 0 A_JumpIfInTargetInventory("TotallyNotFakeCrystalsAmmo",10,1)
goto DeathBoom
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,0,random(85,95))
TNT1 A 0 A_JumpIfInTargetInventory("TotallyNotFakeCrystalsAmmo",15,1)
goto DeathBoom
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,0,random(-85,-95))
TNT1 A 0 A_JumpIfInTargetInventory("TotallyNotFakeCrystalsAmmo",20,1)
goto DeathBoom
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,0,random(40,50))
TNT1 A 0 A_JumpIfInTargetInventory("TotallyNotFakeCrystalsAmmo",25,1)
goto DeathBoom
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,0,random(-130,-140))
TNT1 A 0 A_JumpIfInTargetInventory("TotallyNotFakeCrystalsAmmo",30,1)
goto DeathBoom
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,0,random(130,140))
TNT1 A 0 A_JumpIfInTargetInventory("TotallyNotFakeCrystalsAmmo",35,1)
goto DeathBoom
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,0,random(-40,-50))
TNT1 A 0 A_JumpIfInTargetInventory("TotallyNotFakeCrystalsAmmo",40,1)
goto DeathBoom
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,random(-5,5),0,28,random(-5,5))
TNT1 A 0 A_JumpIfInTargetInventory("TotallyNotFakeCrystalsAmmo",45,1)
goto DeathBoom
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,random(-5,5),0,-28,random(-5,5))
TNT1 A 0 //A_JumpIfInTargetInventory("TotallyNotFakeCrystalsAmmo",50,1)
goto DeathBoom

BoomE:
"####" "#" 0 A_GiveInventory("CrystalEyeDetonate",1)
"####" "#" 1 A_CountDownArg(4)
wait

XDeath:
Crash:
TNT1 A 0 A_SpawnItemEx("CrystalEyeC_FX_H",0,0,0,0,0,0,0,1+32768)
TNT1 A 0 A_GiveToTarget("CrystalmanEyeEnd_P",1)
TNT1 A 0 A_PlaySound("weapons/mm5/crystaleyehit",2)
TNT1 A 1
stop

Death:
TNT1 A 0 A_JumpIfInventory("CrystalEyeDetonate",1,"DeathBoom")
TNT1 A 1 A_GiveToTarget("CrystalmanEyeEnd_P",1)
stop

DeathBoom:
OMFX LLAAABBBCCCEEE 1 bright
stop

Death2:
TNT1 A 1
stop
}
}

actor CrystalEyeC_FX_H : BasicGraphicEffect
{
States
{
SpawnFrame:
TNT1 A 0 A_SetArg(1,5+(Args[0]/14)*2)
SpawnL:
TNT1 A 0 A_SpawnItemEx("CrystalEyeC_FX",0,0,0,random(-10,10),random(-10,10),random(5,10),random(0,359),1)
TNT1 A 0 A_CountDown
loop
}
}

actor CrystalEyeC_FX : BasicGraphicEffectM
{
+FORCEXYBILLBOARD
-NOGRAVITY
+THRUACTORS
ReactionTime 10
States
{
SpawnFrame:
Q_5H F 1
TNT1 A 1 A_CountDown
loop
}
}


actor CrystalShot : ProjSpawnFuncActor
{
var int user_TranslateBlackColors;
PROJECTILE
damagetype "CrystalM_EyeShot"
Obituary "$OB_CRYSTALEYE"
+SKYEXPLODE
BounceSound "weapon/crystalbit"
+BOUNCEONFLOORS
+BOUNCEONWALLS
+BOUNCEONCEILINGS
+ALLOWBOUNCEONACTORS
+CANBOUNCEWATER
+BOUNCEAUTOOFF
+FORCEXYBILLBOARD
bouncefactor 1.0
wallbouncefactor 1.0
BounceCount 4
reactiontime 15
Damage(120)
Height 8
Radius 8
speed 28
Scale 2.5
States
{
Spawn:
//CRYE NOPQRNN 4
//CRYE FGHIJFF 4
Q_5H FQHSJPF 4
Q_5H F 0 A_CountDown
loop
Death:
OMFX ABCE 2 bright
stop
}
}

actor CrystalShot2 : CrystalShot
{
damagetype "CrystalM_EyeBit"
BounceCount 10
reactiontime 3
Damage(140)
}

actor CrystalM_EyeBitProtect : PowerProtection
{
Powerup.Duration 10
DamageFactor "CrystalM_EyeBit", 0.45
}

actor Crystalman_W_NormalBar : NormalBar {Args 4,193}
actor Crystalman_W_ScriptBar : ScriptBar {Args 4,193}