actor Punk_W : BaseMM8BDMWep_CBM 
{
tag "$TAGC_KB"
dropitem "ScrewCrusherWep"
Weapon.AmmoUse 1
Weapon.AmmoGive 0
Obituary "$OB_SCREWCRUSHER"
Inventory.Pickupmessage "Power up! Screw Crusher!"
weapon.ammotype "ScrewCrushAmmo"
inventory.icon "PunkIco2"
States
{
Spawn:
C_0K B 1
loop

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

Ready:
PNKA A 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_PUNK)
goto Ready1
Ready1:
PNKA A 0 A_JumpIfInventory("ScrewCrushAmmo",28,"Ready2")
PNKA A 7 A_WeaponReady(8)
PNKA A 0 A_GiveInventory("ScrewCrushAmmo",2)
loop
Ready2:
PNKA A 1 A_WeaponReady
loop

Fire:
PNKA A 0 A_JumpIfInventory("IsBot",1,"BotFire")
//PNKA A 0 A_JumpIfInventory("WepToggleFlag",1,"Fire2")
PNKA A 0 A_GiveInventory("VivifyDelay5",1)
PNKA A 0 A_Refire(1)
PNKA A 2 OffSet(-19,58)
PNKA A 2 OffSet(-43,88)
PNKA D 2 OffSet(-28,70)//-48,70
PNKA D 0 A_PlaySoundEx("weapon/screwcrusher","Weapon")
PNKA D 0 A_FireCustomMissile("ScrewCrusherPunkC",0,0,8,0)
//PNKA D 2 OffSet(-28,51)
PNKA D 2 OffSet(-2,27)
PNKA C 2 OffSet(-114,86)
PNKA C 2 OffSet(-59,45)
PNKA C 2 OffSet(1,3)
TNT1 A 2 OffSet(150,24)//
PNKA A 2 OffSet(90,24)
PNKA A 2 OffSet(40,29)A_GiveInventory("ScrewCrushAmmo",2)
goto Ready1
Fire2:
PNKA A 0 A_JumpIfInventory("IsBot",1,"BotFire2")
PNKA C 2 Offset(-1,32)
PNKA C 2 Offset(-70,74)
PNKA C 0 A_PlaySoundEx("weapon/screwcrusher","Weapon")
PNKA C 0 A_FireCustomMissile("BounceCrusher_H",0,0,8,0)
PNKA C 2 Offset(-121,114)
PNKA D 2 Offset(1,32)
PNKA D 2 Offset(-21,56)A_Refire
PNKA D 2 Offset(-33,84)A_Refire
PNKA A 2 Offset(-11,92)A_Refire
PNKA A 2 Offset(-7,72)A_Refire
PNKA A 2 Offset(-3,52)A_Refire
Goto Ready1

BotFire:
PNKA A 0 A_JumpIfInventory("ScrewCrushAmmo",28,"BotFire3")
PNKA A 0 A_Jump(32,1)
goto Fire+1
PNKA A 0
goto Fire2+1
BotFire2:
PNKA A 0 A_Jump(225,1)
goto Fire+1
PNKA A 0
goto Fire2+1
BotFire3:
PNKA A 0 A_JumpIfCloser(500,"SpinAttack")
PNKA A 0 A_Jump(64,"SpinAttack")
goto Fire+1

AltFire:
PNKA A 0 A_JumpIfInventory("VivifyFlag1",1,"StopSpin")
PNKA A 0 A_JumpIfInventory("ScrewCrushAmmo",28,"SpinAttack")
goto Ready1
SpinAttack:
PNKA B 0 ACS_NamedExecuteWithResult("core_invulnerableplayer",0,1)
PNKA B 0 ACS_NamedExecuteWithResult("core_stopplayer",0,1)
PNKA B 0 ACS_NamedExecuteWithResult("core_nogravityplayer",0,2)
PNKA B 0 A_GiveInventory("VivifyFlag1",1)
PNKA B 0 ThrustThingZ(0,8,0,1)
PNKA B 0 A_Refire(1)

PNKA B 2 Offset(5,52)A_GiveInventory("Punk_AltTakeStop_P")
PNKA B 2 Offset(12,72)A_GiveInventory("Punk_AltTakeStop_P")
PNKA B 2 Offset(21,92)A_GiveInventory("Punk_AltTakeStop_P")

TNT1 AA 2 A_GiveInventory("Punk_AltTakeStop_P",1)

TNT1 AAAAAAAAAAAAAAAAAA 2 A_GiveInventory("Punk_AltTakeStop_P2",1)

TNT1 A 0 //A_Stop
TNT1 A 0 ACS_NamedExecuteWithResult("cbm_NoHitStunplayer",0,true)
TNT1 A 0 ACS_NamedExecuteWithResult("core_unsolidplayer",0,USP_TOGGLEON)
TNT1 A 0 A_GiveInventory("CBM_DisableJumpPowerGiver",1)
TNT1 A 0 //ThrustThingZ(0,100,0,1)
TNT1 A 0 //A_Stop

TNT1 A 0 A_ChangeVelocity(Cos(pitch)*100,0,-sin(pitch)*100,3)//A_Recoil(-100)
TNT1 A 0 A_PlaySoundEx("weapon/GameBoyPunkRam","Weapon")
TNT1 A 0 ACS_NamedExecuteWithResult("core_invulnerableplayer",0,0)
TNT1 A 0 A_TakeInventory("ScrewCrushAmmo",1)
TNT1 AA 1 A_GiveInventory("Punk_AltMelee_P")
TNT1 A 0 A_TakeInventory("ScrewCrushAmmo",1)
TNT1 AA 1 A_GiveInventory("Punk_AltMelee_P")
TNT1 A 0 A_TakeInventory("ScrewCrushAmmo",1)
TNT1 AA 1 A_GiveInventory("Punk_AltMelee_P")
TNT1 A 0 A_TakeInventory("ScrewCrushAmmo",1)
TNT1 AA 1 A_GiveInventory("Punk_AltMelee_P")
TNT1 A 0 A_TakeInventory("ScrewCrushAmmo",1)
TNT1 AAAAAAAAAAAAAAAAAAAAAAA 1 A_GiveInventory("Punk_AltMelee_P")
TNT1 A 0 ACS_NamedExecuteWithResult("cbm_NoHitStunplayer",0,false)
TNT1 A 0 A_TakeInventory("ScrewCrushAmmo",28,1)
goto StopSpin+1
StopSpin:
PNKA B 0 ACS_NamedExecuteWithResult("core_invulnerableplayer",0,0)
PNKA B 0 ACS_NamedExecuteWithResult("core_unsolidplayer",0,USP_TOGGLEOFF_DAMAGE,CallACS("core_getmaxhealth")/10)
PNKA B 0 A_TakeInventory("ScrewCrushAmmo",6)
PNKA B 0 A_TakeInventory("VivifyFlag1")
PNKA B 0 A_GiveInventory("VivifyDelay4",1)
PNKA B 0 A_ReFire(1)
PNKA B 0 A_Jump(256,"StopSpin2")
StopSpin2:
PNKA B 2 Offset(21,92)A_GiveInventory("VivifyDelay4",1)
PNKA B 2 Offset(16,72)
PNKA B 2 Offset(9,52)

PNKA A 2 A_WeaponReady(14)
PNKA A 0 ACS_NamedExecuteWithResult("core_nogravityplayer",0,0)
PNKA A 0 ACS_NamedExecuteWithResult("core_stopplayer",0,0)
PNKA A 0 //A_GiveInventory("SelfTotallyUnfrozen",1)
PNKA A 0 A_TakeInventory("CBM_DisableJumpPower")
Goto Ready1
}
}

actor Punk_W2 : Punk_W 
{
tag "$TAGC_KB2"
inventory.icon "PunkIcon"
States
{

Deselect:
PNKA B 0
goto DeselectSwap
Select:
PNKA B 0
goto SelectSwap

Ready:
PNKA B 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_PUNK)
goto Ready1
Ready1:
PNKA B 0 A_JumpIfInventory("ScrewCrushAmmo",28,"Ready2")
PNKA B 7 A_WeaponReady(8)
PNKA B 0 A_GiveInventory("ScrewCrushAmmo",2)
loop
Ready2:
PNKA B 1 A_WeaponReady
loop

Fire:
PNKA C 2 Offset(-1,32)
PNKA C 2 Offset(-70,74)
PNKA C 0 A_PlaySoundEx("weapon/screwcrusher","Weapon")
PNKA C 0 A_FireCustomMissile("BounceCrusher_H",0,0,8,0)
PNKA C 2 Offset(-121,114)
PNKA D 2 Offset(1,32)
PNKA D 2 Offset(-21,56)A_Refire
PNKA D 2 Offset(-33,84)A_Refire
PNKA B 2 Offset(-11,92)A_Refire
PNKA B 2 Offset(-7,72)A_Refire
PNKA B 2 Offset(-3,52)A_Refire
Goto Ready1

StopSpin2:
PNKA B 2 Offset(21,92)A_GiveInventory("VivifyDelay4",1)
PNKA B 2 Offset(16,72)
PNKA B 2 Offset(9,52)

PNKA B 2 A_WeaponReady(14)
PNKA B 0 ACS_NamedExecuteWithResult("core_nogravityplayer",0,0)
PNKA B 0 ACS_NamedExecuteWithResult("core_stopplayer",0,0)
PNKA B 0 A_TakeInventory("CBM_DisableJumpPower")
Goto Ready1
}
}

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

actor Punk_AltTakeStop_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_TakeInventory("ScrewCrushAmmo",1,1)
TNT1 A 0 A_Stop
stop
}
}
actor Punk_AltTakeStop_P2 : Punk_AltTakeStop_P
{
States
{
Pickup:
TNT1 A 0 A_WeaponReady(6)
goto Punk_AltTakeStop_P::Pickup
}
}

actor PunkMeleeC : BasicImplosion
{
damagetype "Punk_Ram"
Obituary "$OB_PUNKRAM"
States
{
Spawn:
TNT1 A 0
TNT1 A 3 A_Explode(250+CallACS("core_checkrune",RUNE_SPREAD,2)*500,64,0,0,64)
stop
}
}

actor Punk_RamProtect : PowerProtection
{
Powerup.Duration 10
DamageFactor "Punk_Ram", 0.0775
}

actor Punk_AltMelee_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_SpawnItemEx("PunkMeleeC",0,0,28,momx,momy,momz,0,8)
//TNT1 A 0 A_Recoil(-0.55)//-0.15
TNT1 A 0 A_ChangeVelocity(Cos(pitch)*0.55,0,-sin(pitch)*0.885,1)
stop
}
}

actor ScrewCrusherPunkC : ProjSpawnFuncActor
{
PROJECTILE
Obituary "$OB_SCREWCRUSHER"
damagetype "Punk_Shot"
StencilColor "D82800"
damage (160)
Radius 10
Height 12
speed 55
scale 2.5
States
{
Spawn:
PNKA TT 1 //A_SpawnItemEx("ScrewCrusherPunkC_FX1",0,0,0,0,0,0,0,1+131072)
PNKA UU 1 //A_SpawnItemEx("ScrewCrusherPunkC_FX2",0,0,0,0,0,0,0,1+131072)
loop
}
}
//StencilColor "0070E8"
//StencilColor "E00058"
//StencilColor "00A800"
//StencilColor "C07000"

actor ScrewCrusherPunkC_FX1 : BasicGraphicEffect
{
RenderStyle "Stencil"
Alpha 1.0
States
{
SpawnFrame:
TNT1 A 0
TNT1 A 1
PNKA TTT 1 A_FadeOut(0.15)
stop
}
}
actor ScrewCrusherPunkC_FX2 : ScrewCrusherPunkC_FX1
{
States
{
Spawn:
TNT1 A 0
TNT1 A 1
PNKA UUU 1 A_FadeOut(0.15)
stop
}
}

actor BounceCrusher_H : BasicWatcher
{
Speed 1
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_SpawnItemEx("BounceCrusher",0,0,0,momx*0.8,momy*0.8,0.5+momz*1.0,0,8+SXF_MULTIPLYSPEED)//8192
stop
}
}

actor BounceCrusher : ProjSpawnFuncActor
{
PROJECTILE
damagetype "Punk_Rapid"
Obituary "$OB_SCREWCRUSHER"
-NOGRAVITY
+SKYEXPLODE
+BOUNCEONWALLS
+BOUNCEONFLOORS
+BOUNCEONCEILINGS
+CANBOUNCEWATER
+BOUNCEAUTOOFFFLOORONLY
+USEBOUNCESTATE
//bouncecount 5
bouncefactor 0.8
gravity 1.8
reactiontime 30
Damage (140)//190
Radius 12
Height 12
Speed 20//16
scale 2.5
Args 2
States
{
Spawn:
PNKA T 0
SpawnL:
PNKA TU 3 A_CountDown
loop
Bounce.floor:
PNKA A 0 A_CountDownArg(0)
goto SpawnL
}
}


actor Punk_W_NormalBar : NormalBar {Args 54,42}
actor Punk_W2_NormalBar : NormalBar {Args 54,42}