actor CrystalEyeBoss : BaseMM8BDMWep_CBM
{
dropitem "CrystalEyeWepCDropped"
Weapon.AmmoUse2 4
Weapon.AmmoGive2 28
Weapon.SlotNumber 4
Obituary "$OB_CRYSTALEYE"
weapon.ammotype1 "CrystalEyeClassAmmo"
States
{
Spawn:
C_05 H 1
loop
Ready:
CRYA X 0 ACS_ExecuteAlways(998,0,807)
CRYA X 0 A_TakeInventory("CrystalEyeDelay",99)
CRYA X 0 A_GiveInventory("SpawningMisfire",1)
goto Ready0
Ready0:
CRYA X 2 A_WeaponReady
CRYA X 0 A_TakeInventory("SpawningMisfire",1)
Goto Ready1
SpawnProtect:
CRYA X 1
Goto Ready0


Ready1:
CRYA X 0 A_JumpIfInventory("CrystalEyeDelay",1,"Ready1a")
CRYA X 2 A_WeaponReady
goto Ready1+1
Ready1a:
CRYA X 1 A_WeaponReady(4)
CRYA X 0 A_JumpIfInventory("CrystalEyeDelay",1,"Ready1a")
goto Ready1

Ready2:
CRYA X 2 A_WeaponReady
CRYA X 0 A_GiveInventory("CrystalEyeCharge",1)
CRYA X 0 A_JumpIfInventory("CrystalEyeIsOut",1,1)
goto Ready2X
CRYA K 2 A_WeaponReady
CRYA K 0 A_GiveInventory("CrystalEyeCharge",1)
CRYA K 0 A_JumpIfInventory("CrystalEyeIsOut",1,1)
goto Ready2X
CRYA L 2 A_WeaponReady
CRYA L 0 A_GiveInventory("CrystalEyeCharge",1)
CRYA X 0 A_JumpIfInventory("CrystalEyeIsOut",1,"Ready2")
goto Ready2X
Ready2X:
CRYA X 0 A_TakeInventory("CrystalEyeCharge",999)
goto Ready1

Deselect:
TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Lower
CRYA X 1 A_Lower
Loop
Select:
TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Raise
CRYA X 1 A_Raise
Loop

Fire:
CRYA Y 0 A_JumpIfInventory("IsBot",1,"BotFire2")
CRYA Y 0 A_JumpIfInventory("SpawningMisfire",1,"SpawnProtect")
CRYA Y 0 A_JumpIfInventory("CrystalEyeIsOut",1,"Fire2")
CRYA Y 0 A_JumpIfInventory("CrystalEyeDelay",1,"NoAmmo")
CRYA Y 0
CRYA Y 0 A_PlaySoundEx("weapon/crystalshot","Weapon")
CRYA Y 0 A_GiveInventory("CrystalmanMain_CI",1)
CRYA Y 0 A_GiveInventory("CrystalEyeIsOut",1)
CRYA Y 0 A_GiveInventory("CrystalEyeDelay",30)
CRYA Y 0 A_GunFlash
CRYA Y 2 OffSet(-6,20)
CRYA Y 2 OffSet(-12,8)
CRYA Y 2 OffSet(-12,8)
CRYA Y 2 OffSet(-9,13)
CRYA Y 2 OffSet(-6,18)
CRYA Y 2 OffSet(-4,23)
CRYA Y 2 OffSet(-2,28)
goto Ready2
Fire2:
CRYA M 0 A_PlaySoundEx("weapon/crystalshot","Weapon")
CRYA M 0 A_GiveInventory("CrystalEyeDetonateAlt",1)
CRYA M 0 A_GiveInventory("CrystalEyeDetonate",1)
CRYA MYMYMYM 2
CRYA X 0 A_TakeInventory("CrystalEyeCharge",999)
CRYA X 0 A_TakeInventory("CrystalEyeDetonateAlt",999)
CRYA X 0 A_TakeInventory("CrystalEyeDetonate",999)
CRYA X 0 A_TakeInventory("CrystalEyeIsOut",999)
Goto Ready1

Flash:
TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 2 A_TakeInventory("CrystalEyeDelay",1)
stop

NoAmmo:
CRYA X 0 A_TakeInventory("CrystalEyeCharge",999)
Goto Ready1

AltFire:
CRYA Y 0 A_JumpIfInventory("CrystalEyeIsOut",1,"AltFire2")
CRYA Y 0
CRYA Y 0 A_PlaySoundEx("weapon/crystalshot","Weapon")
CRYA Y 0 A_GiveInventory("CrystalmanAlt_CI",1)
CRYA Y 2 OffSet(-6,23)
CRYA Y 2 OffSet(-12,14)
CRYA Y 2 OffSet(-12,14)
CRYA Y 2 OffSet(-10,17)
CRYA Y 2 OffSet(-8,20)
CRYA X 2 OffSet(-6,23)
CRYA X 2 OffSet(-4,26)
CRYA X 2 OffSet(-2,29)
CRYA X 0 A_Refire
Goto Ready1
AltFire2:
CRYA Z 0 A_PlaySoundEx("weapon/crystalshot","Weapon")
CRYA Z 0 A_GiveInventory("CrystalEyeDetonate",1)
CRYA ZYZYZYZ 2
CRYA X 0 A_TakeInventory("CrystalEyeCharge",999)
CRYA X 0 A_TakeInventory("CrystalEyeIsOut",999)
CRYA X 0 A_TakeInventory("CrystalEyeDetonate",999)
Goto Ready1



BotFire:
CRYA Y 0 A_Jump(16,"HoldEND")
CRYA Z 0 A_TakeInventory("CrystalEyeEndLag",3)
CRYA Y 3 A_GiveInventory("CrystalEyeCharge",1)
CRYA Y 0 A_Refire
Goto HoldEND
BotFire2:
CRYA Y 0 A_Jump(128, "AltFire")
Goto Fire+1
}
}

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

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

actor CrystalEyeIsOut : Powerup
{
Powerup.Duration -22
}

actor CrystalEyeDetonate : OnceC{}
actor CrystalEyeDetonateAlt : OnceC{}

actor CrystalEyeCharge : Inventory
{
inventory.amount 1
inventory.maxamount 50
}

actor CrystalFrameFlag : Inventory
{
inventory.amount 1
inventory.maxamount 5
}
actor CrystalFrameFlag2 :OnceC{}

actor CrystalEyeEndLag : Inventory
{
inventory.amount 1
inventory.maxamount 99
}


actor CrystalEyeC
{
Translation "199:199=193:193", "202:202=0:0"
PROJECTILE
Damage (35)
Height 16
Radius 16
damagetype "CrystalEye"
Obituary "$OB_CRYSTALEYE"
//+EXPLODEONWATER
Scale 2.5
speed 22//28
ReactionTime 25
BounceCount 100
SeeSound "weapon/crystalbit"
+SKYEXPLODE
+DOOMBOUNCE
+CANBOUNCEWATER
bouncefactor 1.0
wallbouncefactor 1.0
States
{
Spawn:
CRYA A 0
CRYA A 0
CRYA AAAA 1 A_JumpIfInTargetInventory("CrystalEyeDetonate",1,"S_A")
CRYA A 0 A_JumpIf(ACS_ExecuteWithResult(C_CHECK_TARGET_OOC)==0,"Death2")
CRYA TTTT 1 A_JumpIfInTargetInventory("CrystalEyeDetonate",1,"S_T")
CRYA A 0 A_JumpIf(ACS_ExecuteWithResult(C_CHECK_TARGET_OOC)==0,"Death2")
CRYA CCCC 1 A_JumpIfInTargetInventory("CrystalEyeDetonate",1,"S_C")
CRYA A 0 A_JumpIf(ACS_ExecuteWithResult(C_CHECK_TARGET_OOC)==0,"Death2")
CRYA VVVV 1 A_JumpIfInTargetInventory("CrystalEyeDetonate",1,"S_V")
CRYA A 0 A_JumpIf(ACS_ExecuteWithResult(C_CHECK_TARGET_OOC)==0,"Death2")
CRYA DDDD 1 A_JumpIfInTargetInventory("CrystalEyeDetonate",1,"S_D")
CRYA A 0 A_JumpIf(ACS_ExecuteWithResult(C_CHECK_TARGET_OOC)==0,"Death2")
CRYA SSSS 1 A_JumpIfInTargetInventory("CrystalEyeDetonate",1,"S_S")
CRYA A 0 A_JumpIf(ACS_ExecuteWithResult(C_CHECK_TARGET_OOC)==0,"Death2")
CRYA AAAA 1 A_JumpIfInTargetInventory("CrystalEyeDetonate",1,"S_A")
CRYA A 0 A_JumpIf(ACS_ExecuteWithResult(C_CHECK_TARGET_OOC)==0,"Death2")
CRYA A 0 A_CountDown
goto Spawn+2
S_A:
CRYA A 0 A_JumpIfInTargetInventory("CrystalEyeDetonateAlt",1,"Boom")
CRYA A 2 ACS_ExecuteAlways(259,0,1)//Set angle based on player pitch/angle
goto Boom_A
S_T:
CRYA T 0 A_JumpIfInTargetInventory("CrystalEyeDetonateAlt",1,"Boom")
CRYA T 2 ACS_ExecuteAlways(259,0,1)
goto Boom_A
S_C:
CRYA C 0 A_JumpIfInTargetInventory("CrystalEyeDetonateAlt",1,"Boom")
CRYA C 2 ACS_ExecuteAlways(259,0,1)
goto Boom_A
S_V:
CRYA V 0 A_JumpIfInTargetInventory("CrystalEyeDetonateAlt",1,"Boom")
CRYA V 2 ACS_ExecuteAlways(259,0,1)
goto Boom_A
S_D:
CRYA D 0 A_JumpIfInTargetInventory("CrystalEyeDetonateAlt",1,"Boom")
CRYA D 2 ACS_ExecuteAlways(259,0,1)
goto Boom_A
S_S:
CRYA S 0 A_JumpIfInTargetInventory("CrystalEyeDetonateAlt",1,"Boom")
CRYA S 2 ACS_ExecuteAlways(259,0,1)
goto Boom_A

Boom_A:

TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,14,random(35,45),1)
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,14,random(-35,-45),1)
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,-14,random(35,45),1)
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,-14,random(-35,-45),1)
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,14,random(-5,5),1)
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,-14,random(-5,5),1)
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,0,random(45,55),1)
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,0,random(-45,-55),1)

TNT1 A 0 A_JumpIfInTargetInventory("CrystalEyeCharge",1,1)
goto Boom2
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,0,0,1)
TNT1 A 0 A_JumpIfInTargetInventory("CrystalEyeCharge",5,1)
goto Boom2
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,14,random(15,25),1)
TNT1 A 0 A_JumpIfInTargetInventory("CrystalEyeCharge",10,1)
goto Boom2
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,14,random(-15,-25),1)
TNT1 A 0 A_JumpIfInTargetInventory("CrystalEyeCharge",15,1)
goto Boom2
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,-14,random(15,25),1)
TNT1 A 0 A_JumpIfInTargetInventory("CrystalEyeCharge",20,1)
goto Boom2
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,-14,random(-15,-25),1)
TNT1 A 0 A_JumpIfInTargetInventory("CrystalEyeCharge",25,1)
goto Boom2
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,0,random(20,30),1)
TNT1 A 0 A_JumpIfInTargetInventory("CrystalEyeCharge",30,1)
goto Boom2
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,0,random(-20,-30),1)
TNT1 A 0 A_JumpIfInTargetInventory("CrystalEyeCharge",35,1)
goto Boom2
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,14,random(-5,5),1)
TNT1 A 0 A_JumpIfInTargetInventory("CrystalEyeCharge",40,1)
goto Boom2
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,-14,random(-5,5),1)
TNT1 A 0 A_JumpIfInTargetInventory("CrystalEyeCharge",45,1)
goto Boom2
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,0,random(5,15),1)
TNT1 A 0 A_JumpIfInTargetInventory("CrystalEyeCharge",50,1)
goto Boom2
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,0,random(-5,-15),1)
goto Boom2

Boom_A2:
UMFX BBBCCCDDDEEE 1 A_Stop
stop

Boom:
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,12,random(40,50),1)
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,12,random(-40,-50),1)
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,-12,random(40,50),1)
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,-12,random(-40,-50),1)
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,12,random(220,230),1)
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,12,random(-220,-230),1)
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,-12,random(220,230),1)
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,-12,random(-220,-230),1)
TNT1 A 0 A_JumpIfInTargetInventory("CrystalEyeCharge",1,1)
goto Boom2
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,0,random(-5,5),1)
TNT1 A 0 A_JumpIfInTargetInventory("CrystalEyeCharge",5,1)
goto Boom2
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,0,random(175,185),1)
TNT1 A 0 A_JumpIfInTargetInventory("CrystalEyeCharge",10,1)
goto Boom2
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,0,random(85,95),1)
TNT1 A 0 A_JumpIfInTargetInventory("CrystalEyeCharge",15,1)
goto Boom2
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,0,random(-85,-95),1)
TNT1 A 0 A_JumpIfInTargetInventory("CrystalEyeCharge",20,1)
goto Boom2
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,0,random(40,50),1)
TNT1 A 0 A_JumpIfInTargetInventory("CrystalEyeCharge",25,1)
goto Boom2
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,0,random(-130,-140),1)
TNT1 A 0 A_JumpIfInTargetInventory("CrystalEyeCharge",30,1)
goto Boom2
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,0,random(130,140),1)
TNT1 A 0 A_JumpIfInTargetInventory("CrystalEyeCharge",35,1)
goto Boom2
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,28,0,0,random(-40,-50),1)
TNT1 A 0 A_JumpIfInTargetInventory("CrystalEyeCharge",40,1)
goto Boom2
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,random(-5,5),0,28,random(-5,5),1)
TNT1 A 0 A_JumpIfInTargetInventory("CrystalEyeCharge",45,1)
goto Boom2
TNT1 A 0 A_SpawnItemEx("CrystalShot2",0,0,0,random(-5,5),0,-28,random(-5,5),1)
TNT1 A 0 A_JumpIfInTargetInventory("CrystalEyeCharge",50,1)
goto Boom2
Boom2:
TNT1 A 0
stop

XDeath:
Crash:
TNT1 A 1 A_TakeFromTarget("CrystalEyeIsOut",9)
stop

Death:
TNT1 A 1 A_TakeFromTarget("CrystalEyeIsOut",9)
stop
Death2:
TNT1 A 1
stop
}
}


actor CrystalEyeCB : CrystalEyeC{translation "202:202=205:205", "199:199=74:74"}
actor CrystalEyeCR : CrystalEyeC{translation "202:202=171:171", "199:199=41:41"}
actor CrystalEyeCO : CrystalEyeC{translation "202:202=104:104", "199:199=128:128"}
actor CrystalEyeCP : CrystalEyeC{translation "202:202=229:229", "199:199=232:232"}


actor CrystalShot
{
Translation "199:199=193:193", "202:202=0:0"
//WallBounceSound "weapon/crystalbit"
//BounceSound "weapon/crystalbit"
SeeSound "weapon/crystalbit"

PROJECTILE
Scale 2.5
Height 8
Radius 8
Damage(12)//10
+DOOMBOUNCE
+CANBOUNCEWATER
+SKYEXPLODE
damagetype "CrystalEyeBitB"
Obituary "$OB_CRYSTALEYE"
bouncefactor 1.0
wallbouncefactor 1.0
speed 28//20
reactiontime 50//4

BounceCount 4
//Health 0
//+SHOOTABLE
//-NOBLOCKMAP
//damagefactor "CrystalEyeBit", 0.1

States
{
Spawn:
//CRYE NOPQRNN 4
//CRYE FGHIJFF 4
CRYA FOHQJNF 4
CRYA F 0 A_CountDown
loop
Death:
TNT1 A 0
stop
}
}

actor CrystalShotB : CrystalShot{translation "202:202=205:205", "199:199=74:74"}
actor CrystalShotR : CrystalShot{translation "202:202=171:171", "199:199=41:41"}
actor CrystalShotO : CrystalShot{translation "202:202=104:104", "199:199=128:128"}
actor CrystalShotP : CrystalShot{translation "202:202=229:229", "199:199=232:232"}


actor CrystalShot2 : CrystalShot
{
damagetype "CrystalEyeBit"
BounceCount 30
reactiontime 4
Damage(10)
}

actor CrystalmanMain_CI : TeamColor_CI
{
states
{
FireX:
TNT1 A 0 A_FireCustomMissile("CrystalEyeC",0,0,8,0)
goto Done
FireB:
TNT1 A 0 A_FireCustomMissile("CrystalEyeCB",0,0,8,0)
goto Done
FireR:
TNT1 A 0 A_FireCustomMissile("CrystalEyeCR",0,0,8,0)
goto Done
FireO:
TNT1 A 0 A_FireCustomMissile("CrystalEyeCO",0,0,8,0)
goto Done
FireP:
TNT1 A 0 A_FireCustomMissile("CrystalEyeCP",0,0,8,0)
goto Done
}
}

actor CrystalmanAlt_CI : TeamColor_CI
{
states
{
FireX:
TNT1 A 0 A_FireCustomMissile("CrystalShot",0,0,8,0)
goto Done
FireB:
TNT1 A 0 A_FireCustomMissile("CrystalShotB",0,0,8,0)
goto Done
FireR:
TNT1 A 0 A_FireCustomMissile("CrystalShotR",0,0,8,0)
goto Done
FireO:
TNT1 A 0 A_FireCustomMissile("CrystalShotO",0,0,8,0)
goto Done
FireP:
TNT1 A 0 A_FireCustomMissile("CrystalShotP",0,0,8,0)
goto Done
}
}
