actor Pharaohman_W : BaseMM8BDMWep_CBM 
{
tag "$TAGC_4D"
dropitem "PharaohShotWep"
Weapon.AmmoUse 0
Weapon.AmmoGive 0
Obituary "$OB_PHARAOHSHOT"
Inventory.Pickupmessage "Power up! Pharaoh Shot!"
weapon.ammotype "ManInGauseAmmo"
States
{
Spawn:
C_04 D 1
loop

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

Ready:
PHAA A 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_PHARAOHMAN)
PHAA A 0 A_TakeInventory("PharaohHover")
goto Ready1
Ready1:
PHAA A 1 A_WeaponReady
wait

Fire:
//PHAA A 0 A_TakeInventory("ManInGauseAmmo",999)
PHAA B 1 A_JumpIfInventory("PlayerPropertyRage",1,2)
PHAA B 0 A_Refire(1)
Goto Throw1
PHAA B 1
PHAA B 0 A_Refire(1)
Goto Throw1
PHAA B 1 Offset(16,2)A_JumpIfInventory("PlayerPropertyRage",1,2)
PHAA B 0 A_Refire(1)
Goto Throw1
PHAA B 1 Offset(16,2)
PHAA B 0 A_Refire(1)
Goto Throw1
PHAA C 1 Offset(-27,45)A_JumpIfInventory("PlayerPropertyRage",1,2)
PHAA C 0 A_Refire(1)
Goto Throw1
PHAA C 1 Offset(-27,45)
PHAA C 0 A_Refire(1)
Goto Throw1
PHAA C 1 Offset(-1,33)A_JumpIfInventory("PlayerPropertyRage",1,2)
PHAA C 0 A_Refire(1)
Goto Throw1
PHAA C 1 Offset(-1,33)A_SpawnItemEx("PharaohM_ChargeWarpFX",0,0,90,0,0,0,0,33)
PHAA C 0 A_Refire("FireH1")
Goto Throw1

FireH1:
PHAA C 0 A_JumpIfInventory("ManInGauseAmmo",78,"FireH2")
PHAA C 1 A_GiveInventory("ManInGauseAmmo",2+CallACS("core_checkrune",RUNE_RAGE)*2)
PHAA C 0 A_Refire("FireH1")
PHAA C 0 A_JumpIfInventory("ManInGauseAmmo",78,"Throw3")
PHAA C 0 A_JumpIfInventory("ManInGauseAmmo",33,"Throw2")
Goto Throw1
FireH2:
PHAA C 0 A_GiveInventory("ManInGauseAmmo",1)
PHAA C 0 A_JumpIfInventory("IsBot",1,"BotFireH3")
FireH3:
PHAA C 1 A_WeaponReady(6)
PHAA C 0 A_Refire("FireH3")
Goto Throw3
BotFireH3:
PHAA C 1 A_Jump(16,"Throw3","ThrowW")
PHAA C 0 A_Refire("BotFireH3")
Goto Throw3

Throw1:
PHAA D 0 A_PlaySoundEx("weapon/Phar_Fire1","Weapon")//pharaoh1
PHAA D 0 A_GiveInventory("Pharaohman_Fire1_P")

PHAA D 1 Offset(-50,72)
PHAA D 1 Offset(-111,112)
PHAA E 1 Offset(8,22)
PHAA E 1 Offset(-20,56)
TNT1 A 2 Offset(-51,95)A_JumpIfInventory("PlayerPropertyRage",1,3)
PHAA A 1 Offset(-30,69)
PHAA A 1 Offset(-13,48)
Goto Ready1
PHAA A 1 Offset(-25,58)
Goto Ready1

Throw2:
PHAA D 0 A_GiveInventory("Pharaohman_Fire2_P")

PHAA D 1 Offset(-1,32)
PHAA D 1 Offset(-70,72)
PHAA D 1 Offset(-121,112)
PHAA E 1 Offset(1,32)
PHAA E 1 Offset(-21,56)
PHAA E 1 Offset(-33,84)
TNT1 A 6 A_JumpIfInventory("PlayerPropertyRage",1,3)
PHAA A 2 Offset(-10,69)
PHAA A 2 Offset(-5,48)
Goto Ready1
TNT1 A 2
PHAA A 1 Offset(-25,58)
Goto Ready1
Throw3:
PHAA D 0 A_GiveInventory("Pharaohman_Fire3_P")

PHAA D 2 Offset(-1,32)
PHAA D 2 Offset(-70,72)
PHAA D 2 Offset(-121,112)
PHAA E 2 Offset(1,32)
PHAA E 2 Offset(-21,56)
PHAA E 2 Offset(-33,84)
TNT1 A 4
PHAA A 2 Offset(-10,69)
PHAA A 2 Offset(-5,48)
PHAA A 2 A_WeaponReady(14)
Goto Ready1
ThrowW:
//PHAA C 0 A_PlaySoundEx("weapon/pharaoh1","Body")
PHAA C 0 A_PlaySoundEx("weapon/pharaoh2","Weapon")
PHAA C 0 A_GiveInventory("PharaohShotWaveBSpreadCheck",1)

PHAA C 2 Offset(-1,32)
PHAA C 2 Offset(-27,45)
PHAA B 2 Offset(16,2)
PHAA B 2 A_WeaponReady(14)

PHAA A 8
PHAA A 6
Goto Ready1


AltFire:
TNT1 A 0 A_JumpIfInventory("ManInGauseAmmo",78,"ThrowW")
PHAA A 2 A_GiveInventory("VivifyFlag1",1)
PHAA A 0 ACS_NamedExecuteWithResult("core_nogravityplayer",0,2)
PHAA A 0 ACS_NamedExecuteWithResult("core_stopplayer",0,1)
PHAA B 4 Offset(-41,49)
PHAA D 4 Offset(-187,227)
TNT1 A 0 ThrustThingZ(0,1,0,1)
TNT1 A 0 A_ReFire(1)
HoverHold:
TNT1 A 0 A_JumpIfInventory("PharaohHover",28,"HoverFinish")
TNT1 A 0 A_PlaySoundEx("classes/float","Weapon")
TNT1 A 5 A_GiveInventory("PharaohM_Hover_P")
TNT1 A 0 A_ReFire(1)
Goto HoverFinish
TNT1 A 0 A_JumpIfInventory("PharaohHover",28,"HoverFinish")
TNT1 A 0 A_PlaySoundEx("classes/float","Body")
TNT1 A 5 A_GiveInventory("PharaohM_Hover_P")
TNT1 A 0 A_ReFire("HoverHold")
Goto HoverFinish
HoverFinish:
PHAA D 2 Offset(-187,227)//A_Stop
TNT1 A 0 ACS_NamedExecuteWithResult("core_nogravityplayer",0,0)
TNT1 A 0 ACS_NamedExecuteWithResult("core_stopplayer",0,0)
TNT1 A 0 A_TakeInventory("VivifyFlag1")
TNT1 A 0 A_TakeInventory("PharaohHover")

PHAA B 4 Offset(-41,49)
PHAA A 4 A_WeaponReady(14)

TNT1 A 0 A_ReFire("AltFireEnd")
Goto Ready1
AltFireEnd:
PHAA A 1 A_RailWait
PHAA A 0 A_ReFire("AltFireEnd")
Goto Ready1
}
}

actor ManInGauseAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 78//38
+INVENTORY.IGNORESKILL 
}

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


actor Pharaohman_Fire1_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_PlaySoundEx("weapon/Phar_Fire1","Weapon")//pharaoh1
TNT1 A 0 A_FireCustomMissile("PharaohShot1B",0,0,8,0)
End:
TNT1 A 0 A_TakeInventory("ManInGauseAmmo")
stop
}
}
actor Pharaohman_Fire2_P : Pharaohman_Fire1_P
{
States
{
Pickup:
TNT1 A 0 A_PlaySoundEx("weapon/Phar_Fire2","Weapon")//pharaoh1
TNT1 A 0 A_FireCustomMissile("PharaohShot2B",0,0,8,0)
goto End
}
}
actor Pharaohman_Fire3_P : Pharaohman_Fire1_P
{
States
{
Pickup:
TNT1 A 0 A_PlaySoundEx("weapon/Phar_Fire3","Body")//pharaoh2 Weapon
TNT1 A 0 A_FireCustomMissile("PharaohShot3B",0,0,8,0)
goto End
}
}

actor PharaohM_Hover_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_SpawnItemEx("PharaohAura",0,0,32)
TNT1 A 0 A_GiveInventory("PharaohHover",1)
TNT1 A 0 A_Recoil(-6.25)
stop
}
}

actor PharaohAura : BasicExplosion
{
var int user_translateLikePlayer;
Translation "192:192=4:4","198:198=216:216"
damagetype "PharaohM_Aura"
Obituary "$OB_PHARAOHAURA"
Scale 2.5
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_Explode(100+CallACS("core_checkrune",RUNE_SPREAD,2)*200,80,0)
TNT1 A 2 A_SpawnItemEx("PharaohAfterImage",0,0,-32,0,0,0,0,1)
stop
}
}

actor PharaohAfterImage : BasicGraphicEffect
{
renderstyle Translucent
alpha 0.75
States
{
Spawn:
TNT1 A 0
PHAR JK 5
PHAR LLLLL 1 A_FadeOut(0.12)
stop
}
}


actor PharaohM_ChargeWarpFX : BasicExplosion
{
damagetype "PharaohM_Hold"
Obituary "$OB_PHARAOHSHOT"
+FORCEXYBILLBOARD
+BRIGHT
+NOTIMEFREEZE
Radius 20
Height 16
Scale 2.5
states
{
Spawn:
TNT1 A 0
TNT1 A 1
TNT1 A 1 A_PlaySoundEx("weapon/Phar_Charge","Weapon")
Spawn_A:
TNT1 A 0 A_JumpIfInventory(ManInGauseAmmo,8,"Spawn_B",2)
TNT1 A 1 A_Warp(2,0,0,90,0,8)
TNT1 A 0 A_JumpIf(CallACS("cbm_Pharaoh_OOC")==0,"Death")
loop
Spawn_B:
PHAA I 0 A_JumpIfInventory(ManInGauseAmmo,16,"Spawn_C",2)
PHAA I 0 A_Warp(2,0,0,90,0,8)
PHAA I 1 A_Warp(2,0,0,90-(z-ceilingz > -Height)*(Height+z-ceilingz),0,WARPF_NOCHECKPOSITION+WARPF_COPYINTERPOLATION)//8+
PHAA I 0 A_JumpIf(CallACS("cbm_Pharaoh_OOC")==0,"Death")
loop
Spawn_C:
PHAA J 0 A_JumpIfInventory(ManInGauseAmmo,24,"Spawn_D",2)
PHAA J 0 A_Warp(2,0,0,90,0,8)
PHAA J 1 A_Warp(2,0,0,90-(z-ceilingz > -Height)*(Height+z-ceilingz),0,8+64)
PHAA J 0 A_JumpIf(CallACS("cbm_Pharaoh_OOC")==0,"Death")
loop
Spawn_D:
PHAA K 0 A_JumpIfInventory(ManInGauseAmmo,32,"Spawn_E",2)
PHAA K 0 A_Warp(2,0,0,90,0,8)
PHAA K 1 A_Warp(2,0,0,90-(z-ceilingz > -Height)*(Height+z-ceilingz),0,8+64)
PHAA K 0 A_JumpIf(CallACS("cbm_Pharaoh_OOC")==0,"Death")
loop
Spawn_E:
PHAA L 0 A_JumpIfInventory(ManInGauseAmmo,40,"Spawn_F",2)
PHAA L 0 A_Warp(2,0,0,90,0,8)
PHAA L 1 A_Warp(2,0,0,90-(z-ceilingz > -Height)*(Height+z-ceilingz),0,8+64)
PHAA L 0 A_JumpIf(CallACS("cbm_Pharaoh_OOC")==0,"Death")
loop
Spawn_F:
PHAA M 0 A_JumpIfInventory(ManInGauseAmmo,48,"Spawn_G",2)
PHAA M 0 A_Warp(2,0,0,90,0,8)
PHAA M 1 A_Warp(2,0,0,90-(z-ceilingz > -Height)*(Height+z-ceilingz),0,8+64)
PHAA M 0 A_JumpIf(CallACS("cbm_Pharaoh_OOC")==0,"Death")
loop
Spawn_G://Throw2 technically should be possible here!
PHAA N 0 A_JumpIfInventory(ManInGauseAmmo,58,"Spawn_H",2)
PHAA N 0 A_Warp(2,0,0,90,0,8)
PHAA N 1 A_Warp(2,0,0,90-(z-ceilingz > -Height)*(Height+z-ceilingz),0,8+64)
PHAA N 0 A_JumpIf(CallACS("cbm_Pharaoh_OOC")==0,"Death")
loop
Spawn_H:
PHAA O 0 A_JumpIfInventory(ManInGauseAmmo,68,"Spawn_I",2)
PHAA O 0 A_Warp(2,0,0,90,0,8)
PHAA O 1 A_Warp(2,0,0,90-(z-ceilingz > -Height)*(Height+z-ceilingz),0,8+64)
PHAA O 0 A_JumpIf(CallACS("cbm_Pharaoh_OOC")==0,"Death")
loop
Spawn_I:
PHAA P 0 A_JumpIfInventory(ManInGauseAmmo,78,"Spawn_JK_Snd",2)
PHAA P 0 A_Warp(2,0,0,90,0,8)
PHAA P 1 A_Warp(2,0,0,90-(z-ceilingz > -Height)*(Height+z-ceilingz),0,8+64)
PHAA P 0 A_JumpIf(CallACS("cbm_Pharaoh_OOC")==0,"Death")
loop
Spawn_JK_Snd:
PHAA Q 0 A_PlaySoundEx("weapon/Phar_ChargeLoop","Weapon",1)
Spawn_JK:
PHAA Q 0 A_Warp(2,0,0,90,0,8)
PHAA Q 1 A_Warp(2,0,0,90-(z-ceilingz > -Height)*(Height+z-ceilingz),0,8+64)
PHAA Q 0 A_JumpIf(CallACS("cbm_Pharaoh_OOC")==0,"Death")
PHAA Q 0 A_Warp(2,0,0,90,0,8)
PHAA Q 0 A_Warp(2,0,0,90-(z-ceilingz > -Height)*(Height+z-ceilingz),0,8+64)
PHAA Q 1 A_Explode(50,64,0)
PHAA Q 0 A_JumpIf(CallACS("cbm_Pharaoh_OOC")==0,"Death")
PHAA Q 0 A_Warp(2,0,0,90,0,8)
PHAA Q 1 A_Warp(2,0,0,90-(z-ceilingz > -Height)*(Height+z-ceilingz),0,8+64)
PHAA R 0 A_JumpIf(CallACS("cbm_Pharaoh_OOC")==0,"Death")
PHAA R 0 A_Warp(2,0,0,90,0,8)
PHAA R 0 A_Warp(2,0,0,90-(z-ceilingz > -Height)*(Height+z-ceilingz),0,8+64)
PHAA R 1 A_Explode(50,64,0)
PHAA R 0 A_JumpIf(CallACS("cbm_Pharaoh_OOC")==0,"Death")
PHAA R 0 A_Warp(2,0,0,90,0,8)
PHAA R 1 A_Warp(2,0,0,90-(z-ceilingz > -Height)*(Height+z-ceilingz),0,8+64)
PHAA R 0 A_JumpIf(CallACS("cbm_Pharaoh_OOC")==0,"Death")
PHAA R 0 A_Warp(2,0,0,90,0,8)
PHAA R 0 A_Warp(2,0,0,90-(z-ceilingz > -Height)*(Height+z-ceilingz),0,8+64)
PHAA R 1 A_Explode(50,64,0)
PHAA Q 0 A_JumpIf(CallACS("cbm_Pharaoh_OOC")==0,"Death")
loop
Death:
TNT1 A 0 A_StopSound(1)
stop
}
}

actor PharaohShot1B : ProjSpawnFuncActor
{
Translation "192:192=4:4", "198:198=216:216"
PROJECTILE
damagetype "PharaohM_Shot1"
Obituary "$OB_PHARAOHSHOT"
+SKYEXPLODE
+EXPLODEONWATER
+FORCEXYBILLBOARD
+BRIGHT
damage (120)
Radius 10
Height 10
speed 35
scale 2.5
States
{
Spawn:
PHAA H 4
loop
Death:
TNT1 A 0
TNT1 A 0 A_SpawnItemEx("OilPitIgnite",0,0,8)
stop
}
}

actor PharaohShot2B : PharaohShot1B
{
damagetype "PharaohM_Shot"
Obituary "$OB_PHARAOHSHOT"
damage (250)//damage (400)
Radius 14//10
Height 14//10
States
{
Spawn:
PHAA O 4
loop
}
}

actor PharaohShot3B : PharaohShot2B
{
damagetype "PharaohM_Shot3"
Obituary "$OB_PHARAOHSHOT"
+DONTREFLECT
Damage (0)
Radius 16//10
Height 16//10
States
{
Spawn:
PHAA QR 4
loop
Death:
TNT1 A 0
TNT1 A 0 A_SpawnItemEx("OilPitIgnite",0,0,8)
TNT1 A 0 A_Explode(450,128,0,0,24)//A_Explode(650,128,0)//A_Explode(600,96,0,0,16)
PHAA STUV 2
stop
}
}

actor PharaohShotWaveB : ProjSpawnFuncActor
{
var int user_P;
PROJECTILE
Obituary "$OB_PHARAOHWAVE"
damagetype "PharaohM_Wave"
+RIPPER
+BRIGHT
Damage(90+user_P)
Radius 10
Height 32//10
speed 35
scale 2.5
States
{
Spawn:
PHAA W 2
PHAA W 2 A_SetUserVar("user_P",90)
PHAA W 2
wait
Death:
PHAA W 0
PHAA W 0 A_SpawnItemEx("OilPitIgnite",0,0,8)
PHAA W 0 A_Recoil(1)
PHAA W 1 A_FadeOut
wait
}
}

actor PharaohShotWaveBSpreadCheck : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_TakeInventory("ManInGauseAmmo")
TNT1 A 0 A_SpawnItemEx("PharaohShotWaveB",8,0,32,35,0,0,0)
TNT1 A 0 A_SpawnItemEx("PharaohShotWaveB",8,0,32,35,0,0,45)
TNT1 A 0 A_SpawnItemEx("PharaohShotWaveB",8,0,32,35,0,0,-45)
TNT1 A 0 A_SpawnItemEx("PharaohShotWaveB",8,0,32,35,0,0,90)
TNT1 A 0 A_SpawnItemEx("PharaohShotWaveB",8,0,32,35,0,0,-90)
TNT1 A 0 A_SpawnItemEx("PharaohShotWaveB",8,0,32,35,0,0,135)
TNT1 A 0 A_SpawnItemEx("PharaohShotWaveB",8,0,32,35,0,0,-135)
TNT1 A 0 A_SpawnItemEx("PharaohShotWaveB",8,0,32,35,0,0,180)
TNT1 A 0 A_JumpIfInventory("PlayerPropertySpread",1,"PickupS")
stop
PickupS:
TNT1 A 0 A_SpawnItemEx("PharaohShotWaveB",8,0,32,35,0,0,15)
TNT1 A 0 A_SpawnItemEx("PharaohShotWaveB",8,0,32,35,0,0,60)
TNT1 A 0 A_SpawnItemEx("PharaohShotWaveB",8,0,32,35,0,0,-30)
TNT1 A 0 A_SpawnItemEx("PharaohShotWaveB",8,0,32,35,0,0,105)
TNT1 A 0 A_SpawnItemEx("PharaohShotWaveB",8,0,32,35,0,0,-75)
TNT1 A 0 A_SpawnItemEx("PharaohShotWaveB",8,0,32,35,0,0,150)
TNT1 A 0 A_SpawnItemEx("PharaohShotWaveB",8,0,32,35,0,0,-120)
TNT1 A 0 A_SpawnItemEx("PharaohShotWaveB",8,0,32,35,0,0,195)

TNT1 A 0 A_SpawnItemEx("PharaohShotWaveB",8,0,32,35,0,0,-15)
TNT1 A 0 A_SpawnItemEx("PharaohShotWaveB",8,0,32,35,0,0,30)
TNT1 A 0 A_SpawnItemEx("PharaohShotWaveB",8,0,32,35,0,0,-60)
TNT1 A 0 A_SpawnItemEx("PharaohShotWaveB",8,0,32,35,0,0,75)
TNT1 A 0 A_SpawnItemEx("PharaohShotWaveB",8,0,32,35,0,0,-105)
TNT1 A 0 A_SpawnItemEx("PharaohShotWaveB",8,0,32,35,0,0,120)
TNT1 A 0 A_SpawnItemEx("PharaohShotWaveB",8,0,32,35,0,0,-150)
TNT1 A 0 A_SpawnItemEx("PharaohShotWaveB",8,0,32,35,0,0,165)
stop
}
}


actor Pharaohman_W_NormalBar : NormalBar {Args 52,225}
actor Pharaohman_W_ScriptBar : ScriptBar {}