Actor Solarman_W : BaseMM8BDMWep_CBM 
{
tag "$TAGC_10H"
dropitem "SolarBlazeWep"
Weapon.AmmoUse 22
Weapon.AmmoGive 0
Obituary "$OB_SOLARBLAZERARE"
Inventory.Pickupmessage "If only I could be so grossly incandescent!"
weapon.ammotype "SolarInfernoAmmo"
weapon.ammotype2 "SunAmmo"
States
{
Spawn:
C_10 H 1
loop

Deselect:
SOLX A 0
goto DeselectSwap
DeselectDeath:
SOLX A 0 A_GunFlash("NoFlash",1)
SOLX A 0 A_GiveInventory("SolarM_FlashStateEnd_P")
SOLX A 1 A_SetTics(1-CallACS("cbm_IsItOnline"))
goto DeselectSwap+1
Select:
SOLX A 0
goto SelectSwap

Ready:
SOLX A 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_SOLARMAN)
SOLX A 1
SOLX A 0 A_Gunflash("Flash.Start",1)
goto Ready1

Ready1:
SOLX A 0 A_JumpIfInventory("SolarHoldCoolDown",1,"Ready2a")
SOLX A 0 A_JumpIfInventory("SolarInfernoAmmo",22,"Ready3")
SOLX A 2 A_WeaponReady(4)
SOLX A 0 A_GiveInventory("SolarInfernoAmmo",2)
goto Ready1+1
Ready2a:
SOLX A 0 A_JumpIfInventory("SolarInfernoAmmo",22,"Ready2b")
SOLX A 2 A_WeaponReady(12)
SOLX A 0 A_GiveInventory("SolarInfernoAmmo",2)
SOLX A 0 A_JumpIfInventory("SolarHoldCoolDown",1,"Ready2a")
Goto Ready1
Ready2b:
SOLX A 2 A_WeaponReady(8)
SOLX A 0 A_GiveInventory("SolarInfernoAmmo",2)
SOLX A 0 A_JumpIfInventory("SolarHoldCoolDown",1,"Ready2b")
Goto Ready3
Ready3:
SOLX A 2 A_WeaponReady
SOLX A 0 A_GiveInventory("SolarInfernoAmmo",2)
Loop

Fire:
SOLX B 1 Offset(16,18)
SOLX B 1 Offset(54,-20)
SOLX B 1 Offset(102,-52)
TNT1 A 4 Offset(42,1)
SOLX C 1 Offset(42,1)
SOLX C 8 Offset(-15,52)A_GiveInventory("SolarM_MainfireCheck_P") 
SOLX A 2 Offset(-4,42)
Goto Ready1

AltFire:
SOLX A 0 A_GiveInventory("VivifyDelay4",1)
SOLX A 0 A_GiveInventory("SolarHoldFlag",1)
SOLX A 0 A_GiveInventory("PowerSolarM_HeadTiltSlow")
SOLX A 0 A_ReFire(1)
SOLX AA 1 Offset(0,45)A_SetArg(1,args[1]-7)
SOLX AA 1 Offset(0,60)A_SetArg(1,args[1]-7)
SOLX A 0 A_GiveInventory("VivifyFlag1",1)
SOLX A 0 A_ReFire(1)
SOLX AA 1 Offset(0,77)A_SetArg(1,args[1]-7)
SOLX A 0 A_ReFire(1)
SOLX AA 1 Offset(0,96)A_SetArg(1,args[1]-7)
TNT1 A 0 A_ReFire(1)
TNT1 A 1 A_GiveInventory("SolarM_HeadAdjust_P")
TNT1 A 0 A_ReFire(1)
TNT1 A 1 A_GiveInventory("SolarM_HeadAdjust_P")
TNT1 A 0 A_ReFire(1)
TNT1 A 1 A_GiveInventory("SolarM_HeadAdjust_P")
TNT1 A 0 A_ReFire(1)
TNT1 A 1 A_GiveInventory("SolarM_HeadAdjust_P")
TNT1 A 0 A_ReFire(1)
TNT1 A 1 A_GiveInventory("SolarM_HeadAdjust_P")
TNT1 A 0 A_ReFire(1)
TNT1 A 1 A_GiveInventory("SolarM_HeadAdjust_P")
TNT1 A 0 A_ReFire(1)
TNT1 A 1 A_GiveInventory("SolarM_HeadAdjust_P")
TNT1 A 0 A_ReFire(1)
AltFire2:
TNT1 A 1 A_GiveInventory("SolarM_HeadAdjust_P")
TNT1 A 0 A_JumpIfInventory("SolarHoldFlag",140,"AltEnding")
TNT1 A 0 A_ReFire("AltFire2")
AltEnding:
TNT1 A 1 A_TakeInventory("PowerSolarM_HeadTiltSlow")
TNT1 A 0 A_TakeInventory("VivifyFlag1")
SOLX AA 1 Offset(0,89)A_GiveINventory("SolarM_HeadArgReset_P")
SOLX AA 1 Offset(0,68)A_GiveINventory("SolarM_HeadArgReset_P")
SOLX AA 1 Offset(0,51)A_GiveINventory("SolarM_HeadArgReset_P")
SOLX AA 1 Offset(0,39)A_GiveINventory("SolarM_HeadArgReset_P")
SOLX A 0 A_SetArg(2,0)
SOLX A 0 A_SetArg(3,0)
SOLX A 0 A_GiveInventory("SolarHoldCoolDown",35+CallACS("cbm_countinv_acs",107,0))
SOLX A 0 A_TakeInventory("SolarHoldFlag")
Goto Ready1

Flash.Start:
TNT1 A 1 A_PlaySoundEx("wep/SolarM_Charge","Body")
TNT1 A 1 A_SpawnItemEx("SolarM_HeadSunFXA",0,0,40,momx,momy,momz,0,1+8+32)
TNT1 A 1 A_SpawnItemEx("SolarM_HeadSunFXB",0,0,50,momx,momy,momz,0,1+8+32)
TNT1 A 1 A_SpawnItemEx("SolarM_HeadSunFXB",0,0,58,momx,momy,momz,0,1+8+32)
TNT1 A 1 A_SpawnItemEx("SolarM_HeadSunFXB",0,0,64,momx,momy,momz,0,1+8+32)
TNT1 A 0 A_GunFlash("Flash",1)
stop
Flash:
TNT1 A 1 A_GiveInventory("SolarM_FlashState_P")
loop
}
}


Actor SolarInfernoAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 112
+INVENTORY.IGNORESKILL
}
Actor SunAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 800
+INVENTORY.IGNORESKILL
}

Actor PowerSolarM_HeadTiltSlow : PowerSpeed
{
powerup.duration 210//156
Speed 0.225
+INVENTORY.ALWAYSPICKUP
+POWERSPEED.NOTRAIL
}

Actor SolarM_AmmoDrainDelay : Inventory
{
inventory.maxamount 175
}
Actor SolarHoldFlag : Inventory
{
inventory.maxamount 140
}
Actor SolarHoldCoolDown : Inventory
{
inventory.maxamount 140
}

Actor PowerSolarAbsorbGrace : PowerFrightener
{
powerup.duration 6
}

Actor SolarM_BlazeWaveProtect : PowerProtection
{
Powerup.Duration 8
DamageFactor "SolarM_BlazeWave", 0.0
}
Actor SolarM_HeadProtect : PowerProtection
{
Powerup.Duration 4
DamageFactor "SolarM_Head", 0.0
}

Actor SolarM_MainfireCheck_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpifInventory("SunAmmo",750,"Fire4")
TNT1 A 0 A_JumpifInventory("SunAmmo",400,"Fire3")
TNT1 A 0 A_JumpifInventory("SunAmmo",1,"Fire2")
goto Fire1
Fire1:
TNT1 A 0 A_PlaySoundEx("wep/SolarM_Shot1","Weapon")
TNT1 A 0 A_FireCustomMissile("SolarManBlaze1",0,1,0,8)
stop
Fire2:
TNT1 A 0 A_PlaySoundEx("wep/SolarM_Shot2","Weapon")
TNT1 A 0 A_FireCustomMissile("SolarManBlaze2",0,1,0,8)
stop
Fire3:
TNT1 A 0 A_PlaySoundEx("wep/SolarM_Shot3","Weapon")
TNT1 A 0 A_FireCustomMissile("SolarManBlaze3",0,1,0,8)
stop
Fire4:
TNT1 A 0 A_PlaySoundEx("wep/SolarM_Shot3","Weapon")//weapon/solarshoot
TNT1 A 0 A_FireCustomMissile("SolarManBlaze4",0,1,0,8)
stop
}
}

Actor SolarM_FlashState_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("WeaponCharge",5,2)
TNT1 A 0 A_GiveInventory("WeaponCharge",1)
goto Pick0
TNT1 A 0 A_TakeInventory("WeaponCharge")
goto Pick0

Pick0:
TNT1 A 0 A_JumpIfInventory("SunAmmo",750,"Pick4")
TNT1 A 0 A_JumpIfInventory("SunAmmo",400,"Pick3")
TNT1 A 0 A_JumpIfInventory("SunAmmo",1,"Pick2")
goto Pick1

Pick1:
TNT1 A 0 A_JumpIfInventory("WeaponCharge",3,2)
TNT1 A 0 A_GiveInventory("SolarM_HeadSun_P1a")
stop
TNT1 A 0 A_GiveInventory("SolarM_HeadSun_P1b")
stop
Pick2:
TNT1 A 0 A_JumpIfInventory("WeaponCharge",3,2)
TNT1 A 0 A_GiveInventory("SolarM_HeadSun_P2a")
stop
TNT1 A 0 A_GiveInventory("SolarM_HeadSun_P2b")
stop
Pick3:
TNT1 A 0 A_JumpIfInventory("WeaponCharge",3,2)
TNT1 A 0 A_GiveInventory("SolarM_HeadSun_P3a")
stop
TNT1 A 0 A_GiveInventory("SolarM_HeadSun_P3b")
stop
Pick4:
//TNT1 A 0 ACS_ExecuteAlways(247,0,1,328,0)
TNT1 A 0 A_JumpIfInventory("WeaponCharge",3,2)
TNT1 A 0 A_GiveInventory("SolarM_HeadSun_P4a")
stop
TNT1 A 0 A_GiveInventory("SolarM_HeadSun_P4b")
//TNT1 A 0 ACS_NamedExecuteAlways("cbm_GalaxyBHB_ACS",0,1,1,328)//move this to the sun?
stop
}
}

Actor SolarM_FlashStateEnd_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpifInventory("Solarman_W",1,1)//Bearer
stop
TNT1 A 0 A_JumpifInventory("SunAmmo",750,"Drop4")
TNT1 A 0 A_JumpifInventory("SunAmmo",400,"Drop3")
TNT1 A 0 A_JumpifInventory("SunAmmo",1,"Drop2")
Drop1:
TNT1 A 0 A_SpawnItemEx("SolarManBlazeCollapse1",args[1]*-1,args[2],args[1]+68+args[3],momx,momy,momz,0,1+8+32)
stop
Drop2:
TNT1 A 0 A_SpawnItemEx("SolarManBlazeCollapse2",args[1]*-1,args[2],args[1]+68+args[3],momx,momy,momz,0,1+8+32)
stop
Drop3:
TNT1 A 0 A_SpawnItemEx("SolarManBlazeCollapse3",args[1]*-1,args[2],args[1]+68+args[3],momx,momy,momz,0,1+8+32)
stop
Drop4:
TNT1 A 0 A_SpawnItemEx("SolarManBlazeCollapse4",args[1]*-1,args[2],args[1]+68+args[3],momx,momy,momz,0,1+8+32)
stop
}
}


Actor SolarM_HeadAdjust_P : CustomInventory
{
States
{
Pickup://THERE IS NO WAY TO ESCAPE THIS
TNT1 A 0 A_GiveInventory("SolarInfernoAmmo",1)
TNT1 A 0 A_GiveInventory("SolarHoldFlag",1)

stop
TNT1 A 0 A_JumpIf(CallACS("cbm_FetchMovementInputOld")==21,"UpL")
TNT1 A 0 A_JumpIf(CallACS("cbm_FetchMovementInputOld")==19,"UpR")
TNT1 A 0 A_JumpIf(CallACS("cbm_FetchMovementInputOld")==17,"Up")
TNT1 A 0 A_JumpIf(CallACS("cbm_FetchMovementInputOld")==13,"DownL")
TNT1 A 0 A_JumpIf(CallACS("cbm_FetchMovementInputOld")==11,"DownR")
TNT1 A 0 A_JumpIf(CallACS("cbm_FetchMovementInputOld")==9,"Down")
TNT1 A 0 A_JumpIf(CallACS("cbm_FetchMovementInputOld")==5,"Left")
TNT1 A 0 A_JumpIf(CallACS("cbm_FetchMovementInputOld")==3,"Right")
Stop
UpL:
TNT1 A 0 A_GiveInventory("SolarM_HeadZAdd_P")
TNT1 A 0 A_GiveInventory("SolarM_HeadXSub_P")
Stop
UpR:
TNT1 A 0 A_GiveInventory("SolarM_HeadZAdd_P")
TNT1 A 0 A_GiveInventory("SolarM_HeadXAdd_P")
Stop
Up :
TNT1 A 0 A_GiveInventory("SolarM_HeadZAdd_P")	
Stop
DownL:
TNT1 A 0 A_GiveInventory("SolarM_HeadZSub_P")
TNT1 A 0 A_GiveInventory("SolarM_HeadXSub_P")
Stop
DownR:
TNT1 A 0 A_GiveInventory("SolarM_HeadZSub_P")
TNT1 A 0 A_GiveInventory("SolarM_HeadXAdd_P")
stop
Down:
TNT1 A 0 A_GiveInventory("SolarM_HeadZSub_P")
Stop
Left:
TNT1 A 0 A_GiveInventory("SolarM_HeadXSub_P")
Stop
Right:
TNT1 A 0 A_GiveInventory("SolarM_HeadXAdd_P")
Stop
}
}

Actor SolarM_HeadBase_P : CustomInventory
{
States
{
No:
TNT1 A 0 
Stop
}
}
Actor SolarM_HeadXAdd_P : SolarM_HeadBase_P
{
States
{
Pickup:
TNT1 A 0 A_JumpIf(Args[2]>=50,"no")
TNT1 A 0 A_SetArg(2,args[2]+5)
Stop
}
}

Actor SolarM_HeadXSub_P : SolarM_HeadBase_P
{
States
{
Pickup:
TNT1 A 0 A_JumpIf(Args[2]<=-50,"no")
TNT1 A 0 A_SetArg(2,args[2]-5)
Stop
}
}

Actor SolarM_HeadZAdd_P : SolarM_HeadBase_P
{
States
{
Pickup:
TNT1 A 0 A_JumpIf(Args[3]>=40,"no")
TNT1 A 0 A_SetArg(3,args[3]+5)
Stop
}
}

Actor SolarM_HeadZSub_P : SolarM_HeadBase_P
{
States
{
Pickup:
TNT1 A 0 A_JumpIf(Args[3]<=-10,"no")
TNT1 A 0 A_SetArg(3,args[3]-5)
Stop
}
}

Actor SolarM_HeadArgReset_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_SetArg(1,args[1]+7)
TNT1 A 0 A_SetArg(2,args[2]/2)
TNT1 A 0 A_SetArg(3,args[3]/2)
Stop
}
}

Actor SolarManBlaze1 : ProjSpawnFuncActor
{
PROJECTILE
Obituary "$OB_SOLARBLAZE"
DamageType "SolarM_Blaze"
-NOGRAVITY
+SKYEXPLODE
+EXPLODEONWATER
+FORCEXYBILLBOARD
+BRIGHT
+THRUSPECIES
Species "SolarHead"
damage (60)
Radius 7
Height 14
speed 40
scale 2.5

Accuracy 10
DeathSound "wep/SolarM_Split1"
States
{
Spawn:
SOBL A 0
SOBL A 0 A_ChangeVelocity(0,0,0.5)
SOBL A 0 ThrustThing(angle*256/360,1,1,0)
S_L:
SOBL AB 3
loop
Death:
TNT1 A 0 A_SetGravity(0.0)
TNT1 A 0 A_SpawnItemEx("OilPitIgnite")
TNT1 A 0 A_SetArg(2,(z-floorz <= Accuracy)*(Accuracy-(z-floorz))+Accuracy-(ceilingz-z <= Height)*(Accuracy*3/2)-(ceilingz-z <= Height)*(Height-(ceilingz-z)))
TNT1 A 0 A_SpawnItemEx("SolarBlazeDeathFX",0,0,Args[2],0,0,0,0,1+SXF_TRANSFERSCALE)//16384
TNT1 A 0 A_Jump(256,"DeathSpawn")
DeathSpawn:
TNT1 A 0 A_SpawnItemEx("SolarManWave1b",0,0,Args[2],28,0,0,0)
TNT1 A 0 A_SpawnItemEx("SolarManWave1a",0,0,Args[2],28,0,0,45)
TNT1 A 0 A_SpawnItemEx("SolarManWave1b",0,0,Args[2],28,0,0,90)
TNT1 A 0 A_SpawnItemEx("SolarManWave1a",0,0,Args[2],28,0,0,135)
TNT1 A 0 A_SpawnItemEx("SolarManWave1b",0,0,Args[2],28,0,0,180)
TNT1 A 0 A_SpawnItemEx("SolarManWave1a",0,0,Args[2],28,0,0,225)
TNT1 A 0 A_SpawnItemEx("SolarManWave1b",0,0,Args[2],28,0,0,270)
TNT1 A 0 A_SpawnItemEx("SolarManWave1a",0,0,Args[2],28,0,0,315)
stop
}
}

Actor SolarManBlaze2 : SolarManBlaze1
{
damage (80)
Radius 13
Height 26

Accuracy 15
DeathSound "wep/SolarM_Split2"
States
{
Spawn:
SOBL C 0
SOBL C 0 A_ChangeVelocity(0,0,0.5)
SOBL C 0 ThrustThing(angle*256/360,1,1,0)
S_L:
SOBL CD 3
loop
DeathSpawn:
TNT1 A 0 A_SpawnItemEx("SolarManWave2b",0,0,Args[2],28,0,0,0)
TNT1 A 0 A_SpawnItemEx("SolarManWave2a",0,0,Args[2],28,0,0,45)
TNT1 A 0 A_SpawnItemEx("SolarManWave2b",0,0,Args[2],28,0,0,90)
TNT1 A 0 A_SpawnItemEx("SolarManWave2a",0,0,Args[2],28,0,0,135)
TNT1 A 0 A_SpawnItemEx("SolarManWave2b",0,0,Args[2],28,0,0,180)
TNT1 A 0 A_SpawnItemEx("SolarManWave2a",0,0,Args[2],28,0,0,225)
TNT1 A 0 A_SpawnItemEx("SolarManWave2b",0,0,Args[2],28,0,0,270)
TNT1 A 0 A_SpawnItemEx("SolarManWave2a",0,0,Args[2],28,0,0,315)
stop
}
}

Actor SolarManBlaze3 : SolarManBlaze1
{
damage (100)
Radius 16
Height 32

Accuracy 20
DeathSound "wep/SolarM_Split3"
States
{
Spawn:
SOBL E 0
SOBL E 0 A_ChangeVelocity(0,0,0.5)
SOBL E 0 ThrustThing(angle*256/360,1,1,0)
S_L:
SOBL EF 3
loop
DeathSpawn:
TNT1 A 0 A_SpawnItemEx("SolarManWave3b",0,0,Args[2],28,0,0,0)
TNT1 A 0 A_SpawnItemEx("SolarManWave3a",0,0,Args[2],28,0,0,45)
TNT1 A 0 A_SpawnItemEx("SolarManWave3b",0,0,Args[2],28,0,0,90)
TNT1 A 0 A_SpawnItemEx("SolarManWave3a",0,0,Args[2],28,0,0,135)
TNT1 A 0 A_SpawnItemEx("SolarManWave3b",0,0,Args[2],28,0,0,180)
TNT1 A 0 A_SpawnItemEx("SolarManWave3a",0,0,Args[2],28,0,0,225)
TNT1 A 0 A_SpawnItemEx("SolarManWave3b",0,0,Args[2],28,0,0,270)
TNT1 A 0 A_SpawnItemEx("SolarManWave3a",0,0,Args[2],28,0,0,315)
stop
}
}

Actor SolarManBlaze4 : SolarManBlaze1
{
damage (120)
Radius 19
Height 38
Scale 3.5

Accuracy 28
DeathSound "wep/SolarM_Split3"//weapon/solarblaze
States
{
Spawn:
SOBL E 0
SOBL E 0 A_ChangeVelocity(0,0,0.5)
SOBL E 0 ThrustThing(angle*256/360,1,1,0)
S_L:
SOBL EF 3
loop
DeathSpawn:
TNT1 A 0 A_SpawnItemEx("SolarManWave4b",0,0,Args[2],28,0,0,0)
TNT1 A 0 A_SpawnItemEx("SolarManWave4a",0,0,Args[2],28,0,0,45)
TNT1 A 0 A_SpawnItemEx("SolarManWave4b",0,0,Args[2],28,0,0,90)
TNT1 A 0 A_SpawnItemEx("SolarManWave4a",0,0,Args[2],28,0,0,135)
TNT1 A 0 A_SpawnItemEx("SolarManWave4b",0,0,Args[2],28,0,0,180)
TNT1 A 0 A_SpawnItemEx("SolarManWave4a",0,0,Args[2],28,0,0,225)
TNT1 A 0 A_SpawnItemEx("SolarManWave4b",0,0,Args[2],28,0,0,270)
TNT1 A 0 A_SpawnItemEx("SolarManWave4a",0,0,Args[2],28,0,0,315)
stop
}
}


Actor SolarBlazeDeathFX : BasicGraphicEffect
{
+BRIGHT
States
{
SpawnFrame:
NMFX O 0
NMFX O 2
SOLX VWX 2
stop
}
}

Actor SolarManWave1a : ProjSpawnFuncActor
{
PROJECTILE
Obituary "$OB_SOLARBLAZE"
DamageType "SolarM_BlazeWave"
+RIPPER
+BRIGHT
+DONTREFLECT
damage (0)
Radius 4
Height 4
speed 28
scale 2.5
States
{
Spawn:
SOBL G 0
SOBL GGHH 1 A_Explode(60,12,0,0,12)
Loop
}
}

Actor SolarManWave2a : SolarManWave1a 
{
Radius 5
Height 5
States
{
Spawn:
SOBL J 0
SOBL JJKK 1 A_Explode(80,16,0,0,16)
Loop
}
}

Actor SolarManWave3a : SolarManWave1a 
{
Radius 6
Height 6
States
{
Spawn:
SOBL L 0
SOBL LLMM 1 A_Explode(100,20,0,0,20)
Loop
}
}

Actor SolarManWave4a : SolarManWave3a 
{
Radius 7
Height 7
Scale 3.5
States
{
Spawn:
SOBL L 0
SOBL LLMM 1 A_Explode(120,24,0,0,24)
Loop
}
}

Actor SolarManWave1b : SolarManWave1a
{
States
{
Spawn:
SOBL G 0
SOBL GGHHG 1 A_Explode(60,12,0,0,12)
SOBL G 0 A_Fadeout(0.25)
SOBL G 1 A_Explode(60,12,0,0,12)
SOBL G 0 A_Fadeout(0.25)
SOBL H 1 A_Explode(60,12,0,0,12)
SOBL H 0 A_Fadeout(0.25)
SOBL H 1 A_Explode(60,12,0,0,12)
Stop
}
}

Actor SolarManWave2b : SolarManWave1b 
{
States
{
Spawn:
SOBL J 0
SOBL JJKKJ 1 A_Explode(80,16,0,0,16)
SOBL J 0 A_Fadeout(0.25)
SOBL J 1 A_Explode(80,16,0,0,16)
SOBL J 0 A_Fadeout(0.25)
SOBL K 1 A_Explode(80,16,0,0,16)
SOBL K 0 A_Fadeout(0.25)
SOBL K 1 A_Explode(80,16,0,0,16)
Stop
}
}

Actor SolarManWave3b : SolarManWave1b 
{
States
{
Spawn:
SOBL L 0
SOBL LLMML 1 A_Explode(100,20,0,0,20)
SOBL L 0 A_Fadeout(0.25)
SOBL L 1 A_Explode(100,20,0,0,20)
SOBL M 0 A_Fadeout(0.25)
SOBL M 1 A_Explode(100,20,0,0,20)
SOBL M 0 A_Fadeout(0.25)
SOBL M 1 A_Explode(100,20,0,0,20)
Stop
}
}

Actor SolarManWave4b : SolarManWave1b 
{
Scale 3.5
States
{
Spawn:
SOBL L 0
SOBL LLMML 1 A_Explode(120,24,0,0,24)
SOBL L 0 A_Fadeout(0.25)
SOBL L 1 A_Explode(120,24,0,0,24)
SOBL M 0 A_Fadeout(0.25)
SOBL M 1 A_Explode(120,24,0,0,24)
SOBL M 0 A_Fadeout(0.25)
SOBL M 1 A_Explode(120,24,0,0,24)
Stop
}
}

Actor SolarM_HeadSun_P1a : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_SpawnItemEx("SolarM_HeadSunFXA",args[1]*-1,args[2],args[1]+68+args[3],momx,momy,momz,0,1+8+32)
goto TheSun1
TheSun1:
TNT1 A 0 A_SpawnItemEx("SolarM_SunHeadBoom1",args[1]*-1,args[2],args[1]+68+args[3]+10,momx,momy,momz,0,8+32)
TNT1 A 0 A_SpawnItemEx("SolarM_SunCounter1",args[1]*-1,args[2],args[1]+68+args[3],momx,momy,momz,0,8+32)
goto P_Ammo
TheSun2:
TNT1 A 0 A_SpawnItemEx("SolarM_SunHeadBoom2",args[1]*-1,args[2],args[1]+68+args[3]+16,momx,momy,momz,0,8+32)
TNT1 A 0 A_SpawnItemEx("SolarM_SunCounter2",args[1]*-1,args[2],args[1]+68+args[3],momx,momy,momz,0,8+32)
goto P_Ammo
TheSun3:
TNT1 A 0 A_SpawnItemEx("SolarM_SunHeadBoom3",args[1]*-1,args[2],args[1]+68+args[3]+21,momx,momy,momz,0,8+32)
TNT1 A 0 A_SpawnItemEx("SolarM_SunCounter3",args[1]*-1,args[2],args[1]+68+args[3],momx,momy,momz,0,8+32)
goto P_Ammo
TheSun4:
TNT1 A 0 A_SpawnItemEx("SolarM_SunHeadBoom4",args[1]*-1,args[2],args[1]+68+args[3]+26,momx,momy,momz,0,8+32)
TNT1 A 0 A_JumpIf(Args[1]!=0,2)
TNT1 A 0 A_SpawnItemEx("SolarM_SunCounter4",args[1]*-1,args[2],args[1]+68+args[3],momx,momy,momz,0,8+32)
goto P_Ammo
TNT1 A 0 A_SpawnItemEx("SolarM_SunCounter4_Pull",args[1]*-1,args[2],args[1]+68+args[3],momx,momy,momz,0,8+32)
goto P_Ammo
P_Ammo:
TNT1 A 0 A_TakeInventory("SolarHoldCoolDown",1+CallACS("core_checkrune",RUNE_RAGE))
TNT1 A 0 A_JumpIfInventory("SolarM_AmmoDrainDelay",175,3)
TNT1 A 0 A_GiveInventory("SolarM_AmmoDrainDelay",1)
TNT1 A 0
stop
TNT1 A 0 A_JumpIfInventory("SolarHoldFlag",1,2)
TNT1 A 0 A_TakeInventory("SunAmmo",2-CallACS("core_checkrune",RUNE_RAGE))
TNT1 A 0
stop
}
}

Actor SolarM_HeadSun_P1b : SolarM_HeadSun_P1a
{
States
{
Pickup:
TNT1 A 0 A_SpawnItemEx("SolarM_HeadSunFXB",args[1]*-1,args[2],args[1]+68+args[3],momx,momy,momz,0,1+8+32)
goto TheSun1
}
}

Actor SolarM_HeadSun_P2a : SolarM_HeadSun_P1a
{
States
{
Pickup:
TNT1 A 0 A_SpawnItemEx("SolarM_HeadSunFXC",args[1]*-1,args[2],args[1]+68+args[3],momx,momy,momz,0,1+8+32)
goto TheSun2
}
}

Actor SolarM_HeadSun_P2b : SolarM_HeadSun_P1a
{
States
{
Pickup:
TNT1 A 0 A_SpawnItemEx("SolarM_HeadSunFXD",args[1]*-1,args[2],args[1]+68+args[3],momx,momy,momz,0,1+8+32)
goto TheSun2
}
}

Actor SolarM_HeadSun_P3a : SolarM_HeadSun_P1a
{
States
{
Pickup:
TNT1 A 0 A_SpawnItemEx("SolarM_HeadSunFXE",args[1]*-1,args[2],args[1]+68+args[3],momx,momy,momz,0,1+8+32)
goto TheSun3
}
}

Actor SolarM_HeadSun_P3b : SolarM_HeadSun_P1a
{
States
{
Pickup:
TNT1 A 0 A_SpawnItemEx("SolarM_HeadSunFXF",args[1]*-1,args[2],args[1]+68+args[3],momx,momy,momz,0,1+8+32)
goto TheSun3
}
}

Actor SolarM_HeadSun_P4a : SolarM_HeadSun_P1a
{
States
{
Pickup:
TNT1 A 0 A_SpawnItemEx("SolarM_HeadSunFXE2",args[1]*-1,args[2],args[1]+68+args[3],momx,momy,momz,0,1+8+32)
goto TheSun4
}
}

Actor SolarM_HeadSun_P4b : SolarM_HeadSun_P1a
{
States
{
Pickup:
TNT1 A 0 A_SpawnItemEx("SolarM_HeadSunFXF2",args[1]*-1,args[2],args[1]+68+args[3],momx,momy,momz,0,1+8+32)
goto TheSun4
}
}

Actor SolarM_HeadSunFXA : BasicGraphicEffect
{
+NOBLOCKMAP
+FORCEXYBILLBOARD 
+BRIGHT
+NOTIMEFREEZE
States
{
SpawnFrame:
SOBL A 0
SpawnC:
"####" "#" 0 A_JumpIfInTargetInventory("VivifyFlag1",1,2)
"####" "#" 1
stop
"####" "#" 1 A_SetTranslucent(0.75,0)
stop
Death:
TNT1 A 0 
Stop
}
}


Actor SolarM_HeadSunFXB : SolarM_HeadSunFXA
{
States
{
SpawnFrame:
SOBL B 0
goto SpawnC
}
}

Actor SolarM_HeadSunFXC : SolarM_HeadSunFXA
{
States
{
SpawnFrame:
SOBL C 0
goto SpawnC
}
}

Actor SolarM_HeadSunFXD : SolarM_HeadSunFXA
{
States
{
SpawnFrame:
SOBL D 0
goto SpawnC
}
}

Actor SolarM_HeadSunFXE : SolarM_HeadSunFXA
{
States
{
SpawnFrame:
SOBL E 0
goto SpawnC
}
}

Actor SolarM_HeadSunFXF : SolarM_HeadSunFXA
{
States
{
SpawnFrame:
SOBL F 0
goto SpawnC
}
}

Actor SolarM_HeadSunFXE2 : SolarM_HeadSunFXA
{
Scale 3.5
States
{
SpawnFrame:
SOBL E 0 A_SpawnItemEx("SolarM_SunGlareFX1",0,0,30,0,0,0,0,1)
goto SpawnC
}
}

Actor SolarM_HeadSunFXF2 : SolarM_HeadSunFXA
{
Scale 3.5
States
{
SpawnFrame:
SOBL F 0 A_SpawnItemEx("SolarM_SunGlareFX2",0,0,30,0,0,0,0,1)
goto SpawnC
}
}


Actor SolarM_SunGlareFX1 : BasicGraphicEffect
{
+FORCEXYBILLBOARD
+BRIGHT
alpha 0.7
scale 2.6
States
{
SpawnFrame:
TNT1 A 0
SOLX Z 1 
stop
}
}

Actor SolarM_SunGlareFX2 : SolarM_SunGlareFX1
{
alpha 0.6
scale 2.4
}

Actor SolarM_SunGlareFX3 : SolarM_SunGlareFX1
{
alpha 0.4
scale 1.0
States
{
Spawn:
TNT1 A 0
SOLX Z 1 
SOLX Z 1 A_SetScale(1.3)
SOLX Z 1 A_SetScale(1.6)
SOLX Z 1 A_SetScale(1.9)
SOLX Z 1 A_SetScale(2.1)
SOLX Z 1 A_SetScale(2.3)
stop
}
}


Actor SolarM_HeadSunCounter_P : CustomInventory
{
states
{
Pickup:
TNT1 A 0 A_PlaySoundEx("wep/SolarM_Charge","Body")
TNT1 A 0 A_TakeInventory("SolarM_AmmoDrainDelay",999)
TNT1 A 0 A_GiveInventory("PowerSolarAbsorbGrace",1)
stop
}
}


actor PainSolarM_HeadHit : BasicWatcher
{
States
{
Spawn:
TNT1 A 0 nodelay A_GiveToTarget("PainSolarM_HeadHit_P",1,AAPTR_TARGET)
stop
}
}
actor PainSolarM_HeadHit_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_GiveInventory("SunAmmo",25)
TNT1 A 0 A_GiveInventory("SolarInfernoAmmo",11)
TNT1 A 0 A_TakeInventory("SolarM_AmmoDrainDelay")
stop
}
}

Actor SolarM_SunCounter1 : CBM_ShootableActor_Null
{
-SOLID
+MISSILE
+DONTSPLASH
+DONTBLAST
+DONTDRAIN
+DONTREFLECT
+DONTRIP
+NOBLOOD
+NOCLIP
//+NORADIUSDMG
//+SHOOTABLE
+NOTIMEFREEZE
+NOGRAVITY
+NOTAUTOAIMED
//+NODAMAGE

+DONTDRAIN
//+SHOOTABLE
+QUICKTORETALIATE
-NORADIUSDMG
+SERVERSIDEONLY
Species "SolarHead"
DamageFactor "SolarM_Head",0.0
painchance 256
health 100000
stamina 1//For divide by 10 hp for fishing
RenderStyle None
Damage (0)
//Tweaked/Actual/Original
Height 20//20//14
Radius 10//10//7
speed 0
scale 2.5
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_RearrangePointers(0,0,2)
TNT1 A 0 A_ChangeFlag("SHOOTABLE",1)
TNT1 AA 1
stop
Pain:
TNT1 A 0 A_ChangeFlag("NOPAIN",1)//NODAMAGE
TNT1 A 0 A_JumpIfInventory("PowerSolarAbsorbGrace",1,"Death",8)
TNT1 A 1//Delay to gather who hit
TNT1 A 0 ACS_NamedExecuteWithResult("cbm_GiveIfPlayerHitMe",107,(100000-Health)*Stamina)
stop
Death:
TNT1 A 1
stop
}
}

Actor SolarM_SunCounter2 : SolarM_SunCounter1
{
Height 32//35//26
Radius 16//17//13
}

Actor SolarM_SunCounter3 : SolarM_SunCounter1
{
Height 42//50//32
Radius 21//25//16
}

Actor SolarM_SunCounter4 : SolarM_SunCounter1
{
Height 52//70//38
Radius 26//35//19
}
Actor SolarM_SunCounter4_Pull : SolarM_SunCounter4
{
States
{
Spawn:
TNT1 A 0
TNT1 A 0 ACS_NamedExecuteWithResult("cbm_SolarSunMassPull",1+CallACS("core_checkrune",RUNE_RAGE,2),328)
//TNT1 A 0 ACS_NamedExecuteAlways("cbm_SolarGravitationalPull",0,1,1,328)
//TNT1 A 0 ACS_NamedExecuteAlways("cbm_GalaxyBHB_ACS",0,1,1,328)
goto Super::Spawn
}
}

Actor SolarM_SunHeadBoom1 : BasicExplosion
{
Damagetype "SolarM_Head"
Obituary "$OB_SOLARHEAD1"
+NOTIMEFREEZE
//+SERVERSIDEONLY
RenderStyle None
Mass 0
States
{
Spawn:
TNT1 A 0
TNT1 A 1 A_Explode((50+Mass*20)*(CallACS("core_checkrune",RUNE_SPREAD,2)*2+1),12+Mass*4,0,0,12+Mass*4)
stop
}
}

Actor SolarM_SunHeadBoom2 : SolarM_SunHeadBoom1
{
Obituary "$OB_SOLARHEAD2"
Mass 1
}

Actor SolarM_SunHeadBoom3 : SolarM_SunHeadBoom1
{
Obituary "$OB_SOLARHEAD3"
Mass 2
}

Actor SolarM_SunHeadBoom4 : SolarM_SunHeadBoom1
{
Obituary "$OB_SOLARHEAD4"
Mass 3
}

Actor SolarManBlazeCollapse1 : SolarManBlaze1
{
Obituary "$OB_SOLARHEAD1"
States
{
Death:
TNT1 A 0 A_SetGravity(0.0)
TNT1 A 0 A_SpawnItemEx("OilPitIgnite")
TNT1 A 0 A_Explode(60,64,0,0,14)//160//24 128//
//SOBL NONONONONOPPQQ 2
SOBL NOPQ 2
stop
}
}
Actor SolarManBlazeCollapse2 : SolarManBlaze2
{
Obituary "$OB_SOLARHEAD2"
States
{
Death:
TNT1 A 0 A_SetGravity(0.0)
TNT1 A 0 A_SpawnItemEx("OilPitIgnite")
TNT1 A 0 A_Explode(90,96,0,0,26)
//SOBL RSRSRSRSRSTTUU 2
SOBL RSTU 2
stop
}
}
Actor SolarManBlazeCollapse3 : SolarManBlaze3
{
Obituary "$OB_SOLARHEAD3"
States
{
Death:
TNT1 A 0 A_SetGravity(0.0)
TNT1 A 0 A_SpawnItemEx("OilPitIgnite")
TNT1 A 0 A_Explode(120,128,0,0,32)
//SOBL VWVWVWVWVWXXYY 2
SOBL VWXY 2
stop
}
}
Actor SolarManBlazeCollapse4 : SolarManBlaze4
{
Obituary "$OB_SOLARHEAD4"
States
{
Death:
TNT1 A 0 A_SetGravity(0.0)
TNT1 A 0 A_SpawnItemEx("OilPitIgnite")
TNT1 A 0 A_Explode(150,160,0,0,38)//188
TNT1 A 0 A_SetScale(2.5)
//SOBL "Z[Z[Z[Z[Z[\\]]" 2
SOBL "Z[\]" 2
stop
}
}


actor Solarman_W_NormalBar : NormalBar {Args 229,222}//248,222
actor Solarman_W_SecondBar : SecondBar {Args 213,217}
actor Solarman_W_ScriptBar : ScriptBar {}