actor SkullBarrierBoss : BaseMM8BDMWep_CBM
{
tag "$TAGC_4H"
dropitem "SkullmanWepDroppedX"
Weapon.AmmoUse 2
Weapon.AmmoGive 2
Weapon.AmmoUse2 1
Weapon.AmmoGive2 2
Obituary "$OB_SKULLBUSTER"
Inventory.Pickupmessage "Power up! Skull Buster!"
weapon.ammotype "AlasPoorYorickAmmo"
weapon.ammotype2 "SpookyScaryAmmo"
+WEAPON.NOAUTOAIM
States
{
Spawn:
C_04 H 1
loop
Ready:
SKUB A 0 ACS_ExecuteAlways(998,0,DYE_SKULLMAN)
goto Ready1

Ready1D:
SKUB A 0 A_JumpIfInventory("AlasPoorYorickAmmo",2,"Ready2D")
SKUB A 0 A_JumpIfInventory("SpookyScaryAmmo",112,"Ready3D")
SKUB A 0 A_JumpIfInventory("PowerSkullCounter",1,2)
SKUB AA 2 A_WeaponReady(12)
SKUB A 0 A_GiveInventory("SpookyScaryReady_P")
goto Ready1
Ready2D:
SKUB A 0 A_JumpIfInventory("SpookyScaryAmmo",112,"Ready4D")
SKUB A 0 A_JumpIfInventory("PowerSkullCounter",1,2)
SKUB AA 2 A_WeaponReady(8)
SKUB A 0 A_GiveInventory("SpookyScaryReady_P")
goto Ready2
Ready3D:
SKUB A 0 A_JumpIfInventory("AlasPoorYorickAmmo",2,"Ready4D")
SKUB A 0 A_JumpIfInventory("PowerSkullCounter",1,2)
SKUB AA 2 A_WeaponReady(4)
SKUB A 0 A_GiveInventory("SpookyScaryReady_P")
goto Ready3
Ready4D:
SKUB A 0 A_JumpIfInventory("PowerSkullCounter",1,2)
SKUB AA 2 A_WeaponReady
SKUB A 0 A_GiveInventory("SpookyScaryReady_P")
goto Ready4

Ready1:
SKUB A 0 A_JumpIfInventory("AlasPoorYorickAmmo",2,"Ready2")
SKUB A 0 A_JumpIfInventory("SpookyScaryAmmo",112,"Ready3")
SKUB A 0 A_JumpIfInventory("PowerSkullCounter",1,2)
SKUB AA 2 A_WeaponReady(12)
SKUB A 0 A_GiveInventory("SpookyScaryReady_P")
SKUB A 0 A_GiveInventory("AlasPoorYorickAmmo",3)
loop
Ready2:
SKUB A 0 A_JumpIfInventory("SpookyScaryAmmo",112,"Ready4")
SKUB A 0 A_JumpIfInventory("PowerSkullCounter",1,2)
SKUB AA 2 A_WeaponReady(8)
SKUB A 0 A_GiveInventory("SpookyScaryReady_P")
SKUB A 0 A_GiveInventory("AlasPoorYorickAmmo",3)
loop
Ready3:
SKUB A 0 A_JumpIfInventory("AlasPoorYorickAmmo",2,"Ready4")
SKUB A 0 A_JumpIfInventory("PowerSkullCounter",1,2)
SKUB AA 2 A_WeaponReady(4)
SKUB A 0 A_GiveInventory("SpookyScaryReady_P")
SKUB A 0 A_GiveInventory("AlasPoorYorickAmmo",3)
loop
Ready4:
SKUB A 0 A_JumpIfInventory("PowerSkullCounter",1,2)
SKUB AA 2 A_WeaponReady
SKUB A 0 A_GiveInventory("SpookyScaryReady_P")
SKUB A 0 A_GiveInventory("AlasPoorYorickAmmo",3)
loop

Deselect:
SKUB A 0 A_GiveInventory("SkullM_BarrierEnd_P",1)
SKUB AAAAAAAAAAAAAAAAAAAAAA 0 A_Lower
SKUB A 1 A_Lower
Loop
Select:
SKUB AAAAAAAAAAAAAAAAAAAAAA 0 A_Raise
SKUB A 1 A_Raise
Loop

Fire:
SKUB A 0 A_JumpIfNoAmmo("NoAmmo")
SKUB A 0 A_JumpIfInventory("PowerSkullCounter",1,"FireRage")
SKUB A 0 A_PlaySoundEx("weapon/skullbust","Weapon")
SKUB A 0 A_GiveInventory("SkullmanMain_CI",1)
SKUB BCA 4 A_GiveInventory("SpookyScaryFire_P")
SKUB A 0 A_Refire
SKUB A 0 A_GiveInventory("SpookyScaryFire_P")
Goto Ready1D
FireRage:
SKUB A 0 A_PlaySoundEx("weapon/skullbust","Weapon")
SKUB A 0 A_GiveInventory("SkullmanMain2_CI",1)
SKUB B 2
SKUB C 2 A_GiveInventory("SpookyScaryFire_P")
SKUB A 2
SKUB A 0 A_Refire
Goto Ready1D

NoAmmo:
SKUB A 0
Goto Ready1D

AltFire:
SKUB A 0 A_JumpIfInventory("ShieldCheck",1,"Ready1")
SKUB A 0 A_JumpIfInventory("SpookyScaryAmmo",112,"Activate")
Goto Ready1
Activate:
SKUB A 0 A_GiveInventory("VivifyDelay4",1)
SKUB A 0 A_Refire(1)
SKUB A 0 A_GiveInventory("RareSkullHud_P",1)
SKUB A 0 A_GiveInventory("ShieldCheck",1)
SKUB A 0 A_GiveInventory("SkullBarrierCounter",1)
SKUB A 0 A_TakeInventory("SpookyScaryAmmo",12)
SKUB A 0 A_SpawnItemEx("SkullmanShieldWarper",0,0,28,0,0,0,0,1)
SKUB A 8 A_GunFlash
SKUB A 0 A_GiveInventory("AlasPoorYorickAmmo",9)
Goto Ready1

Flash:
TNT1 A 0 A_JumpIfInventory("PowerRareSkullHud",1,"Flash.Skull")
SKUB DEFGGG 1 A_SpawnItemEx("SkullM_CounterChecker",0,0,0,momx,momy,momz,0,8,0)
SKUB GG 1
SKUB G 0 ACS_ExecuteAlways(982,0,1)//vanilla's skullbarrier script
SKUB G 1 //urgh hopefully this tic wont come back to bite me [Muz]
SKUB G 0 A_JumpIfInventory("SkullRageFlag",1,"RageBarrier")//This is being done so that there can be different sprites for a rage barrier and a missed rage [Muz]
SKUB G 0 A_ChangeFlag("INVULNERABLE",0)
SKUB GFFF 1
SKUB F 1 A_JumpIfInventory("ShieldHits",1,1)
Goto MissedHit
SKUB FEEE 1
SKUB E 0 A_TakeInventory("SpookyScaryAmmo",4)
SKUB E 1 A_JumpIfInventory("ShieldHits",1,1)
Goto MissedHit
SKUB EDDD 1
SKUB D 1 A_JumpIfInventory("ShieldHits",1,"MissWait")
Goto MissedHit

Flash.Skull:
SKUB HIJKK 1 A_SpawnItemEx("SkullM_CounterChecker",0,0,0,momx,momy,momz,0,8,0)
SKUB KK 1
SKUB K 0 ACS_ExecuteAlways(982,0,1)
SKUB K 1
SKUB K 0 A_JumpIfInventory("SkullRageFlag",1,"RageBarrier.Skull")
SKUB K 0 A_ChangeFlag("INVULNERABLE",0)
SKUB KJJJ 1
SKUB J 1 A_JumpIfInventory("ShieldHits",1,1)
Goto MissedHit
SKUB JIII 1
SKUB I 0 A_TakeInventory("SpookyScaryAmmo",2)
SKUB I 1 A_JumpIfInventory("ShieldHits",1,1)
Goto MissedHit
SKUB IHHH 1
SKUB H 1 A_JumpIfInventory("ShieldHits",1,"MissWait")
Goto MissedHit

MissWait:
TNT1 AAAA 1
TNT1 A 0 A_TakeInventory("SpookyScaryAmmo",2)
TNT1 A 1 A_JumpIfInventory("ShieldHits",1,1)
Goto MissedHit
TNT1 AAAA 1
TNT1 A 0 A_TakeInventory("SpookyScaryAmmo",2,1)
TNT1 A 1 A_JumpIfInventory("ShieldHits",1,1)
Goto MissedHit
TNT1 A 0 A_JumpIfInventory("IsDead",1,"NoFlash")
TNT1 A 0 A_JumpIfInventory("SpookyScaryAmmo",1,"MissWait")
goto MissedEnd
MissedHit:
TNT1 A 1
TNT1 A 0 A_PlaySoundEx("S3_K/MetalSpark","Weapon")
TNT1 A 0 A_GiveInventory("SkullBarrierProtection",1)
Goto MissedEnd
MissedEnd:
TNT1 A 1
TNT1 A 0 A_GiveInventory("SkullM_BarrierEnd_P",1)
TNT1 A 1 A_TakeInventory("SpookyScaryAmmo",112,1)
//TNT1 A 0 A_JumpIfINventory("ShieldCheck",1,"missedEnd")//A_TakeInventory("ShieldCheck",99)//Just to double make sure
stop//Goto FlashAmmo


RageBarrier.Skull:
SKUB K 0 A_TakeInventory("SpookyScaryAmmo",26,1)
SKUB KJJJJIII 1
SKUB I 0 A_TakeInventory("SpookyScaryAmmo",26,1)
SKUB IHHHH 1
goto FlashWait+5
RageBarrier://SKUB FED 4
SKUB G 0 A_TakeInventory("SpookyScaryAmmo",26,1)
SKUB GFFFFEEE 1
SKUB E 0 A_TakeInventory("SpookyScaryAmmo",26,1)
SKUB EDDDD 1
goto FlashWait+5

FlashWait:
TNT1 AAAAAAAA 1
TNT1 A 0 A_TakeInventory("SpookyScaryAmmo",26)
TNT1 A 0 A_JumpIfInventory("IsDead",1,"NoFlash")
TNT1 A 1 A_JumpIfInventory("ShieldCheck",1,2)
TNT1 A 0 A_GiveInventory("SkullM_BarrierEnd_P",1)
stop//goto FlashAmmo
TNT1 A 0 A_JumpIfInventory("SpookyScaryAmmo",1,"FlashWait")
TNT1 A 0 A_GiveInventory("SkullM_BarrierEnd_P",1)
stop//goto FlashAmmo
FlashAmmo:
TNT1 A 0 A_JumpIfInventory("SpookyScaryAmmo",112,"NoFlash")
TNT1 AAAA 1
TNT1 A 0 A_GiveInventory("SpookyScaryAmmo",3)
TNT1 AAAA 1
TNT1 A 0 A_GiveInventory("SpookyScaryAmmo",3)
goto FlashAmmo
}
}

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

actor SpookyScaryAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 112
+INVENTORY.IGNORESKILL
}

actor SkullRageFlag : Inventory
{
inventory.amount 1
inventory.maxamount 56
}

actor PowerSkullCounter : Powerup
{
powerup.Duration 56
}

actor PowerSkullCounterSpeed : PowerSpeed
{
Speed 1.6
powerup.Duration 35
}

actor PowerSkullBarrierBlast : Powerup
{
powerup.Duration 8
}
actor PowerRareSkullHud : Powerup
{
powerup.Duration 8
}

actor SkullmanWepDroppedX : BasicHelper
{
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_Jump(256,1,2)
TNT1 A 1 A_SpawnItemEx("SkullBarrierWepCDropped",0,0,0,momx,momy,momz,0,8)
stop
TNT1 A 1 A_SpawnItemEx("SkullSniperWepCDropped",0,0,0,momx,momy,momz,0,8)
stop
}
}

actor SpookyScaryReady_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("ShieldCheck",1,3)
TNT1 A 0 A_JumpIfInventory("PowerSkullCounter",1,3)
TNT1 A 0 A_GiveInventory("SpookyScaryAmmo",4)//3
TNT1 A 0
stop
TNT1 A 0 A_GiveInventory("SpookyScaryAmmo",4)//5
stop
}
}
actor SpookyScaryFire_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("ShieldCheck",1,2)
TNT1 A 0 A_GiveInventory("SpookyScaryAmmo",2)
TNT1 A 0
stop
}
}

actor RareSkullHud_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_Jump(8,"Pickup.Skull")
stop
Pickup.Skull:
TNT1 A 0 A_GiveInventory("PowerRareSkullHud",1)
stop
}
}

actor SkullM_CounterTime_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_Blast(0,255,192,40.0,"SkullRepulsionFX")
TNT1 A 0 A_JumpIfInventory("PowerSkullBarrierBlast",1,"Pickup1")
TNT1 A 0 A_GiveInventory("PowerSkullBarrierBlast",1)
TNT1 A 0 A_GiveInventory("SkullmanAlt_CI",1)
goto Pickup1
Pickup1:
TNT1 A 0 A_JumpIfInventory("SkullRageFlag",1,2)
TNT1 A 0 A_SpawnItemEx("SkullRageFlag_H")
TNT1 A 0 A_SetBlend(white,0.95,5)
TNT1 A 0 A_PlaySoundEx("classes/skullabs","Body")
TNT1 A 0 A_GiveInventory("PowerSkullCounter",1)
TNT1 A 0 A_GiveInventory("PowerSkullCounterSpeed",1)
TNT1 A 0 A_GiveInventory("AlasPoorYorickAmmo",28)
TNT1 A 0 A_GiveInventory("SkullRageFlag",56)//32
stop
}
}
actor SkullM_CounterRefresh_P : SkullM_CounterTime_P
{
States
{
Pickup:
TNT1 A 0
goto Pickup1
}
}

actor SkullBarrierCounter : CustomInventory
{
States
{
Pickup:
//TNT1 A 0 A_ChangeFlag("SHOOTABLE",0)
TNT1 A 0 A_GiveInventory("InvulnerableOn_Pickup",1)
TNT1 A 0 A_SpawnItemEx("SkullM_BarrierSnd_H")
stop
}
}

actor SkullM_BarrierEnd_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("SkullBarrierBoss",1,"InGame")
stop
InGame:
TNT1 A 0 A_GiveInventory("InvulnerableOff_Pickup",1)
TNT1 A 0 A_TakeInventory("ShieldCheck",1)
TNT1 A 0 A_TakeInventory("ShieldHits",999)
stop
}
}

actor SkullM_BarrierSnd_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_PlaySound("classes/SkullShieldBuzz",7,1.0)//SoundSlot7
stop
}
}

actor SkullRageFlag_H : BasicHelper
{
States
{
Spawn:
TNT1 A 0
TNT1 A 1 A_TakeFromTarget("SkullRageFlag",1)
TNT1 A 0 A_JumpIfInTargetInventory("IsDead",1,1)
TNT1 A 0 A_JumpIfInTargetInventory("SkullRageFlag",1,"Spawn")
TNT1 A 0
stop
}
}

actor SkullM_BarrierSnd_H : BasicHelper
{
States
{
Spawn:
TNT1 A 0
TNT1 A 12 A_GiveToTarget("SkullM_BarrierSnd_P",1)
TNT1 A 0 A_JumpIfInTargetInventory("IsDead",1,1)
TNT1 A 0 A_JumpIfInTargetInventory("ShieldCheck",1,"Spawn")
TNT1 A 0
stop
}
}

actor SkullRepulsionFX : BasicClientSide
{
States
{
Spawn:
TNT1 A 0
TNT1 A 1
stop
}
}

actor SkullShot : FastProjectile
{
var int user_POWER;
Translation "192:192=4:4","198:198=87:87","204:204=215:215"
PROJECTILE
damagetype "SkullM_Shot"
Obituary "$OB_SKULLBUSTER"
+FORCEXYBILLBOARD
+BRIGHT
Damage (100-user_POWER)
radius 6
height 6
Speed 150
scale 2.5
States
{
Spawn:
W_0D BBBBB 1 nodelay A_SpawnItemex("SkullShotFX",0,Random(8,-8),Random(8,-8),0,0,0,0,1)
W_0D BBBBBBB 2 A_SetUserVar("user_POWER",user_POWER+10)
W_0D B 3
wait
Death:
TNT1 A 1
stop
}
}
actor SkullShotB : SkullShot{Translation "192:192=205:205","198:198=74:74","204:204=205:205"}
actor SkullShotR : SkullShot{Translation "192:192=171:171","198:198=41:41","204:204=171:171"}
actor SkullShotO : SkullShot{Translation "192:192=104:104","198:198=128:128","204:204=104:104"}
actor SkullShotP : SkullShot{Translation "192:192=229:229","198:198=232:232","204:204=229:229"}

actor SkullShotFX : BasicClientSide
{
+FORCEXYBILLBOARD
+BRIGHT
Renderstyle Translucent
Alpha 0.6
States
{
Spawn:
SKUB UV 1 A_Fadeout
loop
}
}

actor SkullShotRage : SkullShot
{
damagetype "SkullM_ShotX"
Damage (120)
States
{
Spawn:
W_0D B 0
W_0D BBB 0 A_SpawnItemex("SkullShotRageFX",0,Random(24,-24),Random(24,-24),0,0,0,0,1)
W_0D B 1
loop
}
}
actor SkullShotRageB : SkullShotRage{Translation "192:192=205:205","198:198=74:74","204:204=205:205"}
actor SkullShotRageR : SkullShotRage{Translation "192:192=171:171","198:198=41:41","204:204=171:171"}
actor SkullShotRageO : SkullShotRage{Translation "192:192=104:104","198:198=128:128","204:204=104:104"}
actor SkullShotRageP : SkullShotRage{Translation "192:192=229:229","198:198=232:232","204:204=229:229"}

actor SkullShotRageFX : SkullShotFX
{
Alpha 0.9
}

actor SkullmanShieldWarper : ShieldWarper_CBM
{
+BRIGHT
+NOTIMEFREEZE
States
{
Shield:
//SKUB M 0 A_JumpIfInTargetInventory("",1,"Shield2")
X_4H ABCDEFGH 1 A_Warp(2,0,0,28,0,24)
loop
}
}

actor SkullM_BarrierBlast : BasicExplosion
{
Translation "192:192=4:4","198:198=87:87"
damagetype "SkullM_Barrier"
Obituary "$OB_SKULLBARRIER"
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_SpawnItemEx("SkullM_BarrierBlastRingFX",0,0,0,0,0,0,random(0,35),1)
TNT1 AAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("SkullM_BarrierBlastFX",0,0,28,22,0,random2(256/12),random(0,359),1)
TNT1 A 3 A_Explode(100,192,0,0,56)
stop
}
}
actor SkullM_BarrierBlastB : SkullM_BarrierBlast{Translation "192:192=205:205","198:198=74:74"}
actor SkullM_BarrierBlastR : SkullM_BarrierBlast{Translation "192:192=171:171","198:198=41:41"}
actor SkullM_BarrierBlastO : SkullM_BarrierBlast{Translation "192:192=104:104","198:198=128:128"}
actor SkullM_BarrierBlastP : SkullM_BarrierBlast{Translation "192:192=229:229","198:198=232:232"}

actor SkullM_BarrierBlastFX : BasicClientSide
{
+FORCEXYBILLBOARD
+BRIGHT
Renderstyle Translucent
Alpha 0.95
States
{
Spawn:
SKUB W 0
SKUB W 0 A_Jump(256,1,2,3)
SKUB WWWVVVUUUVVV 1
stop
}
}

actor SkullM_BarrierBlastRingFX : BasicClientSide
{
Reactiontime 10
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_SpawnItemEx("SkullM_BarrierBlastFX",32,0,0,10,0,frandom(-1,1),Reactiontime*36,1)
TNT1 A 0 A_Countdown
loop
}
}



actor SkullM_CounterChecker
{
var int user_USER;
-SOLID
+NOGRAVITY
+DONTDRAIN
damagefactor "SkullM_Barrier", 0.0
renderstyle "none"
health 1
radius 40
height 56
scale 2.5
States
{
Spawn:
PLAY A 0
PLAY A 0 A_RearrangePointers(0,0,2)
PLAY A 0 A_ChangeFlag("SHOOTABLE",1)
PLAY A 0 A_ChangeFlag("DONTRIP",1)
PLAY A 1
PLAY A 1
stop
Death:
PLAY A 0 ACS_NamedExecuteWithResult("cbm_GiveIfPlayerHitMe",47)
PLAY A 1
stop
}
}


actor SkullmanMain_CI : TeamColor_CI
{
states
{
FireX:
TNT1 A 0 A_FireCustomMissile("SkullShot",0,1,8,0)
goto Done
FireB:
TNT1 A 0 A_FireCustomMissile("SkullShotB",0,1,8,0)
goto Done
FireR:
TNT1 A 0 A_FireCustomMissile("SkullShotR",0,1,8,0)
goto Done
FireO:
TNT1 A 0 A_FireCustomMissile("SkullShotO",0,1,8,0)
goto Done
FireP:
TNT1 A 0 A_FireCustomMissile("SkullShotP",0,1,8,0)
goto Done
}
}

actor SkullmanMain2_CI : TeamColor_CI
{
states
{
FireX:
TNT1 A 0 A_FireCustomMissile("SkullShotRage",0,1,8,0)
goto Done
FireB:
TNT1 A 0 A_FireCustomMissile("SkullShotRageB",0,1,8,0)
goto Done
FireR:
TNT1 A 0 A_FireCustomMissile("SkullShotRageR",0,1,8,0)
goto Done
FireO:
TNT1 A 0 A_FireCustomMissile("SkullShotRageO",0,1,8,0)
goto Done
FireP:
TNT1 A 0 A_FireCustomMissile("SkullShotRageP",0,1,8,0)
goto Done
}
}
actor SkullmanAlt_CI : TeamColor_CI
{
states
{
FireX:
TNT1 A 0 A_FireCustomMissile("SkullM_BarrierBlast",0,0,0,0)
goto Done
FireB:
TNT1 A 0 A_FireCustomMissile("SkullM_BarrierBlastB",0,0,0,0)
goto Done
FireR:
TNT1 A 0 A_FireCustomMissile("SkullM_BarrierBlastR",0,0,0,0)
goto Done
FireO:
TNT1 A 0 A_FireCustomMissile("SkullM_BarrierBlastO",0,0,0,0)
goto Done
FireP:
TNT1 A 0 A_FireCustomMissile("SkullM_BarrierBlastP",0,0,0,0)
goto Done
}
}