actor Stoneman_W : BaseMM8BDMWep_CBM 
{
tag "$TAGC_5C"
dropitem "PowerStoneWep"
Weapon.AmmoUse 0
Weapon.AmmoGive 0
Obituary "$OB_POWERSTONE"
weapon.ammotype "CantStopTheRockAmmo"
States
{
Spawn:
C_05 C 1
loop

Deselect:
POWB A 0
goto DeselectSwap
Select:
POWB A 0 A_TakeInventory("CantStopTheRockAmmo")
POWB A 0 A_GiveInventory("StonemanSpawnStart_P")
goto SelectSwap

Ready:
POWB E 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_STONEMAN)
POWB E 1 offset(0,80)
POWB E 1 offset(0,80)A_GunFlash("Flash",0)
POWB E 2 offset(0,64)
POWB E 2 offset(0,48)
goto Ready2
Ready2:
POWB E 0 A_JumpIfInventory("StoneBossLeap2",1,"ReadyAir")
POWB E 1 A_WeaponReady
goto Ready2+1
ReadyAir:
POWB E 1 A_WeaponReady(8)
goto Ready2

Fire:
POWB E 0 A_JumpIfInventory("StoneBossLeap",1,"FireLeap")
POWB E 2 offset(0,28)A_PlaySoundEx("weapon/powerstone","Weapon")
POWB F 2 offset(0,42)
POWB F 2 offset(0,34)
POWB G 3 offset(0,48)A_GiveInventory("StoneM_FirePitchCheck_P")
POWB G 2 offset(0,34)
POWB G 2 offset(0,48)
POWB F 2 offset(0,26)
POWB F 2 offset(0,40)
POWB E 2 offset(0,20)
POWB E 2 offset(0,22)
POWB E 2 offset(0,24)
POWB E 2 offset(0,26)
POWB E 2 offset(0,28)
POWB E 2 offset(0,30)
Goto Ready2

FireLeap:
POWB E 0 A_GiveInventory("StoneBossLeap2",1)
POWB E 0 ACS_NamedExecuteWithResult("cbm_cantpushwallsplayer",0,0)
POWB E 0 A_TakeInventory("StoneBossLeap")
POWB E 0 A_TakeInventory("CantStopTheRockAmmo")
POWB E 0 A_TakeInventory("NoJumpCancel",9)
POWB E 0 A_TakeInventory("CBM_200_SpeedPower")
POWB E 0 A_TakeInventory("CBM_DisableJumpPower")
POWB E 0 A_GunFlash("Flash",0)
goto Fire+1

Flash:
TNT1 A 0
TNT1 A 0 A_JumpIf(z-floorz==0,6)
TNT1 A 0 A_JumpIf(momz==0,2)
TNT1 A 1 A_GiveInventory("StonemanHealthCheck_P")
loop
TNT1 A 1 A_GiveInventory("StonemanHealthCheck_P")
TNT1 A 0 A_JumpIf(z-floorz==0,2)
TNT1 A 0 A_JumpIf(momz==0,1)
loop
TNT1 A 0 A_TakeInventory("StoneBossLeap2",9)
TNT1 A 1 A_GiveInventory("StonemanHealthCheck_P")
loop

Altfire:
POWB E 0 A_JumpIfInventory("CantStopTheRockAmmo",1,"AltfireStomp")
POWB H 2 offset(0,23)A_GiveInventory("CantStopTheRockAmmo",1)
POWB I 2 offset(0,16)A_GiveInventory("CantStopTheRockAmmo",1)
AltCharge:
POWB J 0 A_JumpIfInventory("CantStopTheRockAmmo",7,"AltCharge1")
POWB J 2 offset(0,10)A_GiveInventory("CantStopTheRockAmmo",1)
POWB J 0 A_Refire("AltCharge")
goto StoneJump
AltCharge1:
POWB J 0 A_JumpIfInventory("CantStopTheRockAmmo",13,"AltCharge2")
POWB J 2 offset(0,15)A_GiveInventory("CantStopTheRockAmmo",1)
POWB J 0 A_Refire("AltCharge1")
goto StoneJump
AltCharge2:
POWB J 0 A_JumpIfInventory("CantStopTheRockAmmo",19,"AltCharge3")
POWB J 2 offset(0,20)A_GiveInventory("CantStopTheRockAmmo",1)
POWB J 0 A_Refire("AltCharge2")
goto StoneJump
AltCharge3:
POWB J 0 A_JumpIfInventory("CantStopTheRockAmmo",25,"AltCharge4")
POWB J 2 offset(0,25)A_GiveInventory("CantStopTheRockAmmo",1)
POWB J 0 A_Refire("AltCharge3")
goto StoneJump
AltCharge4:
POWB J 0 A_JumpIfInventory("CantStopTheRockAmmo",31,"AltCharge5")
POWB J 2 offset(0,29)A_GiveInventory("CantStopTheRockAmmo",1)
POWB J 0 A_Refire("AltCharge4")
goto StoneJump
AltCharge5:
POWB J 0 A_JumpIfInventory("CantStopTheRockAmmo",36,"AltCharge6")
POWB J 2 offset(0,33)A_GiveInventory("CantStopTheRockAmmo",1)
POWB J 0 A_Refire("AltCharge5")
goto StoneJump
AltCharge6:
POWB J 0 A_JumpIfInventory("CantStopTheRockAmmo",41,"AltCharge7")
POWB J 2 offset(0,37)A_GiveInventory("CantStopTheRockAmmo",1)
POWB J 0 A_Refire("AltCharge6")
goto StoneJump
AltCharge7:
POWB J 0 A_JumpIfInventory("CantStopTheRockAmmo",46,"AltCharge8")
POWB J 2 offset(0,40)A_GiveInventory("CantStopTheRockAmmo",1)
POWB J 0 A_Refire("AltCharge7")
goto StoneJump
AltCharge8:
POWB J 0 A_JumpIfInventory("CantStopTheRockAmmo",51,"AltCharge9")
POWB J 2 offset(0,43)A_GiveInventory("CantStopTheRockAmmo",1)
POWB J 0 A_Refire("AltCharge8")
goto StoneJump
AltCharge9:
POWB J 0 A_JumpIfInventory("CantStopTheRockAmmo",56,"AltFullCharge")
POWB J 2 offset(0,46)A_GiveInventory("CantStopTheRockAmmo",1)
POWB J 0 A_Refire("AltCharge9")
goto StoneJump

AltFullCharge:
POWB J 1 offset(0,49)A_JumpIfInventory("PlayerPropertyRage",1,2)
POWB J 0 A_Refire(1)
goto StoneJump
POWB J 1 offset(0,49)
POWB J 0 A_Refire(1)
goto StoneJump
POWB J 1 offset(0,46)A_JumpIfInventory("PlayerPropertyRage",1,2)
POWB J 0 A_Refire(1)
goto StoneJump
POWB J 1 offset(0,46)
POWB J 0 A_Refire("AltFullCharge")
goto StoneJump
StoneJump:
POWB I 1 offset(0,30)A_GiveInventory("StoneM_AltLeapStart_P")
goto AltfireRise

AltfireJumpLeap:
POWB I 0 offset(0,30)A_JumpIf(CallACS("cbm_GetPointerButtonInput",0,false) & BT_JUMP,2)
POWB I 1 ThrustThingZ(0,84,0,0)
goto AltfireRise
POWB I 1 ThrustThingZ(0,108,0,0)
goto AltfireRise
AltfireJumpLeap2:
POWB I 0 offset(0,30)A_JumpIf(CallACS("cbm_GetPointerButtonInput",0,false) & BT_JUMP,2)
POWB I 1 ThrustThingZ(0,108,0,0)
goto AltfireRise
POWB I 1 ThrustThingZ(0,132,0,0)
goto AltfireRise

AltfireRise:
POWB I 0 A_TakeInventory("ToadLeapFlagX",999)
POWB I 1 offset(0,30)ThrustThingZ(0,4,1,1)
POWB I 0 A_SpawnItemEx("StoneCrushHead",0,0,56,0,0,20)
POWB H 1 offset(0,13)ThrustThingZ(0,4,1,1)
POWB H 0 A_SpawnItemEx("StoneCrushHead",0,0,56,0,0,20)
POWB H 1 offset(0,13)ThrustThingZ(0,4,1,1)
Fallcheck:
POWB F 0 ThrustThingZ(0,1,1,1)
POWB F 0 A_SpawnItemEx("StoneCrushHead",0,0,56,0,0,20)
POWB F 0 A_JumpIf(momz<=0,"Fall")
POWB F 0 A_GiveInventory("StoneBossLeap",1)
POWB F 1 A_WeaponReady(2)//6//WRF_NOPRIMARY
loop

Fall:
POWB G 0 ThrustThingZ(0,1,1,1)//10
POWB G 0 A_SpawnItemEx("StoneCrush",0,0,-10,0,0,-10)
POWB G 0 A_JumpIf(z-floorz==0, "Shockland")
POWB G 0 A_JumpIfInventory("StoneBossLeap",999,"Shockland")
POWB G 0 A_GiveInventory("StoneBossLeap",1)
POWB G 0 A_JumpIfInventory("ToadLeapFlagX",1,"AltfireJumpLeap")
POWB G 1 A_WeaponReady(2)
loop

AltfireStomp:
POWB G 1 offset(0,40)ThrustThingZ(0,40,1,1)
POWB G 0 A_SpawnItemEx("StoneCrush",0,0,-10,0,0,-10)
POWB G 0 A_GiveInventory("StoneBossLeap",2)
POWB G 0 A_JumpIf(z-floorz==0, "Shockland")
POWB G 0 A_JumpIfInventory("ToadLeapFlagX",1,"AltfireJumpLeap2")
POWB G 0 A_Refire(1)
goto Fall
POWB G 1 offset(0,43)ThrustThingZ(0,40,1,1)
POWB G 0 A_SpawnItemEx("StoneCrush",0,0,-10,0,0,-10)
POWB G 0 A_GiveInventory("StoneBossLeap",2)
POWB G 0 A_JumpIf(z-floorz==0, "Shockland")
POWB G 0 A_JumpIfInventory("ToadLeapFlagX",1,"AltfireJumpLeap2")
POWB G 0 A_Refire("AltfireStomp")
goto Fall

Shockland:
POWB G 0 ACS_NamedExecuteWithResult("cbm_cantpushwallsplayer",0,0)
POWB G 0 A_TakeInventory("NoJumpCancel",9)
POWB G 0 A_FireCustomMissile("StoneHandBoss",0,0,0,0)
POWB F 0 A_GiveInventory("Stoneman_FloorQuake_P")
POWB F 0 A_Stop
POWB F 1 offset(0,36)A_GiveInventory("CBM_DisableSpeedPowerGiver",1)
POWB F 1 A_Stop
POWB H 2 offset(0,32)
POWB I 2 offset(0,53)
POWB J 2 offset(0,74)
TNT1 A 7 offset(0,95)A_JumpIfInventory("StoneM_LandedDelay",1,1)
Goto ShocklandEnd
ShocklandX:
TNT1 A 13 offset(0,95)
goto ShocklandEnd
ShocklandEnd:
POWB E 0 A_TakeInventory("CBM_DisableSpeedPower")
POWB E 0 A_TakeInventory("CBM_200_SpeedPower")
POWB E 0 A_TakeInventory("CBM_DisableJumpPower")
POWB E 2 offset(0,77)
POWB E 2 offset(0,67)
POWB E 2 offset(0,58)
POWB E 2 offset(0,50)
POWB E 2 offset(0,43)
POWB E 2 offset(0,37)
Goto Ready2
}
}

actor CantStopTheRockAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 56
+INVENTORY.IGNORESKILL
}

actor StoneBossLeap : Inventory
{
inventory.amount 1
inventory.maxamount 999
}

actor StoneBossLeap2 : OnceC {}

actor StoneM_LandedDelay : Powerup
{
Powerup.Duration 10
}

actor StoneM_FirePitchCheck_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIf(pitch<340 && pitch>=270, "FireUp")
TNT1 A 0 A_JumpIf(pitch>20 && pitch<=90, "FireDown")
TNT1 A 0 A_FireCustomMissile("StoneM_PowerStoneStart_H",0,0,0,0)
stop
FireUp:
TNT1 A 0 A_FireCustomMissile("StoneM_PowerStoneStart_H2",0,0,0,8)
stop
FireDown:
TNT1 A 0 A_FireCustomMissile("StoneM_PowerStoneStart_H2",0,0,0,-8)
stop
}
}

actor StoneM_AltLeapStart_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_GiveInventory("CBM_200_SpeedPowerGiver",1)
TNT1 A 0 A_GiveInventory("CBM_DisableJumpPowerGiver",1)
TNT1 A 0 A_Recoil(-10)//A_Recoil(-25)
TNT1 A 0 A_GiveInventory("StoneBossLeap",1)
TNT1 A 0 A_GiveInventory("NoJumpCancel",1)
TNT1 A 0 ACS_NamedExecuteWithResult("cbm_cantpushwallsplayer",0,1)
TNT1 A 0 A_SpawnItemEx("StoneCrushHead",0,0,56,0,0,20)
TNT1 A 0 ThrustThingZ(0,60+CallACS("cbm_countinv_acs",52,0)*15/11,0,0)
stop
}
}

actor StoneM_PowerStoneStart_H : BasicExplosion
{
RenderStyle None
Speed 0
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_SpawnItemEx("PowerStoneMan",46,0,0,1,0,0,0,1)
TNT1 A 0 A_SpawnItemEx("PowerStoneMan",46,0,0,1,0,0,120,1)
TNT1 A 0 A_SpawnItemEx("PowerStoneMan",46,0,0,1,0,0,240,1)
//TNT1 A 0 A_SpawnItemEx("PowerStoneMan",46,0,0,0,0,0,0+28,0)//v9e
//TNT1 A 0 A_SpawnItemEx("PowerStoneMan",46,0,0,0,0,0,180+28,0)
//TNT1 A 0 A_SpawnItemEx("PowerStoneMan",54,0,0,0,0,0,0,0)//Oldest?
//TNT1 A 0 A_SpawnItemEx("PowerStoneMan2",54,0,0,0,0,0,180,0)
stop
}
}

actor StoneM_PowerStoneStart_H2 : StoneM_PowerStoneStart_H{Speed 1}

actor StoneM_RockProtect : PowerProtection
{
Powerup.Duration 3
DamageFactor "StoneM_Rock", 0.281
}

actor PowerStoneMan : ProjSpawnFuncActor
{
//var int user_warpZ;
PROJECTILE
damagetype "StoneM_Rock"
Obituary "$OB_POWERSTONE"
+FORCEXYBILLBOARD
Radius 38
Height 10
damage (250)
speed 10
scale 2.5
Args 38,1000,96,4//30,1500,40,14
//speed,maxturn,turndivisor,add
States
{
Spawn:
Q_5C Q 0
Spawn2:
Q_5C Q 0 A_ChangeVelocity(30,0,momz,3)
Q_5C QRS 2
Q_5C T 1 A_Stop
Q_5C V 3 A_Setangle(angle-80)//A_SetRenderStyle(1.0,STYLE_Stencil)
Q_5C T 0
goto Spawn3+1
/*
Q_5C Q 0 A_Setangle(angle-Args[1]/Args[2])
Q_5C Q 1 A_ChangeVelocity(Args[0],0,momz,3)
Q_5C Q 0 A_SetArg(2,Args[2]+Args[3])
Q_5C Q 0 A_Setangle(angle-Args[1]/Args[2])
Q_5C Q 1 A_ChangeVelocity(Args[0],0,momz,3)
Q_5C R 0 A_SetArg(2,Args[2]+Args[3])
Q_5C R 0 A_Setangle(angle-Args[1]/Args[2])
Q_5C R 1 A_ChangeVelocity(Args[0],0,momz,3)
Q_5C R 0 A_SetArg(2,Args[2]+Args[3])
Q_5C R 0 A_Setangle(angle-Args[1]/Args[2])
Q_5C R 1 A_ChangeVelocity(Args[0],0,momz,3)
Q_5C S 0 A_SetArg(2,Args[2]+Args[3])
Q_5C S 0 A_Setangle(angle-Args[1]/Args[2])
Q_5C S 1 A_ChangeVelocity(Args[0],0,momz,3)
Q_5C S 0 A_SetArg(2,Args[2]+Args[3])
Q_5C S 0 A_Setangle(angle-Args[1]/Args[2])
Q_5C S 1 A_ChangeVelocity(Args[0],0,momz,3)
Q_5C T 0 A_SetArg(2,Args[2]+Args[3])
*/
Spawn3:
Q_5C T 0 A_Setangle(angle-Args[1]/Args[2])
Q_5C T 1 A_ChangeVelocity(Args[0],0,momz,3)
//X_5C T 0 A_LogInt(Args[1]*10000/Args[2])
Q_5C T 0 A_JumpIf(Args[2]*100/Args[1]>92,"Spawn4")
Q_5C T 0 A_SetArg(2,Args[2]+Args[3])
loop
Spawn4:
Q_5C T 1
wait
//XDeath:
//Crash:
Death:
TNT1 A 1
TNT1 A 0 A_SpawnItemEX("PowerStonemanFX",16,0,0,frandom(4,8),0,frandom(1,5),random(-20,20),1)
TNT1 A 0 A_SpawnItemEX("PowerStonemanFX",16,0,0,frandom(4,8),0,frandom(1,5),random(-20,20)+120,1)
TNT1 A 0 A_SpawnItemEX("PowerStonemanFX",16,0,0,frandom(4,8),0,frandom(1,5),random(-20,20)+240,1)

TNT1 A 1
stop
}
}

//actor PowerStoneMan2 : PowerStoneMan{MeleeRange 180}

actor PowerStoneManFX : BasicGraphicEffectM
{
-NOGRAVITY
+DOOMBOUNCE
//+THRUACTORS
bouncecount 3
Reactiontime 5
Radius 8
Height 8
States
{
SpawnFrame:
TNT1 A 0
TNT1 A 1 A_Jump(256,"FX1","FX2","FX3")
FX1:
POWB U 2
TNT1 A 1 A_CountDown
loop
FX2:
POWB V 2
TNT1 A 1 A_CountDown
loop
FX3:
POWB W 2
TNT1 A 1 A_CountDown
loop
}
}

actor StoneCrush
{
PROJECTILE
Damagetype "StoneM_Leap"
Obituary "$OB_STONECRUSH"
+DONTBLAST
+DONTREFLECT
+THRUGHOST
+HITTRACER
renderstyle none
damage (150+CallACS("core_checkrune",RUNE_RAGE,2)*300)
Radius 24
Height 2
States
{
Spawn:
PLAY A 1
stop
XDeath:
PLAY A 0 A_JumpIf(CallACS("cbm_istracerenemy")==1,"DeathCrushCheck")
stop
DeathCrushCheck:
PLAY A 0 A_GiveToTarget("ToadLeapFlagX",1)
PLAY A 0 A_JumpIfInventory("StoneCrushHitDelay",1,"Death",AAPTR_TRACER)
PLAY A 1 A_JumpIf(CallACS("cbm_pointerheightfromground",1)>0,"DeathGravity")
stop
DeathGravity:
PLAY A 0 A_JumpIfInventory("StoneCrushHitDelay",1,"Death",AAPTR_TRACER)
PLAY A 0 A_GiveInventory("StoneCrushHitDelay",1,AAPTR_TRACER)
PLAY A 1 A_SpawnItemEx("PainStoneCrushSlamHit",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS)
PLAY A 1
stop
Death:
PLAY H 1
stop
}
}

actor StoneCrushHitDelay : Powerup
{
Powerup.Duration 5
}

actor StoneM_LeapProtect : PowerProtection
{
Powerup.Duration 6
DamageFactor "StoneM_Leap", 0.0
}

actor PainStoneCrushSlamHit : BasicPain_SlamHit//StoneCrush
{
Mass 250
states
{
Spawn:
TNT1 A 0
TNT1 A 0 ACS_NamedExecuteWithResult("cbm_GravitySlam",CallACS("core_getptrtid",8))
goto CollideWait

Collide:
TNT1 A 0 A_Warp(8,0,0,28)
TNT1 A 2 A_SpawnItemEX("StoneCrushSlamCollide",0,0,0,0,0,0,0,SXF_TRANSFERSPECIAL)
stop
CollideX:
TNT1 A 0 A_Warp(8,0,0,28)
TNT1 A 2 A_SpawnItemEX("StoneCrushSlamCollideX",0,0,0,0,0,0,0,SXF_TRANSFERSPECIAL)
stop
}
}

actor StoneCrushSlamCollide : BasicCollideSlam
{
Obituary "$OB_STONECRUSHB"
damagetype "StoneM_Dunked"
}
actor StoneCrushSlamCollideX : BasicCollideSlam
{
Obituary "$OB_STONECRUSHX"
damagetype "StoneM_Dunked"
}


actor StoneCrushHead
{
PROJECTILE
Damagetype "StoneM_Head"
Obituary "$OB_STONEHEAD"
+DONTBLAST
+DONTREFLECT
+THRUGHOST
renderstyle none
damage (150+CallACS("core_checkrune",RUNE_RAGE,2)*300)
Radius 16
Height 2
States
{
Spawn:
PLAY A 0
PLAY A 1
stop
}
}

actor Stoneman_FloorQuake_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_TakeInventory("CantStopTheRockAmmo")
TNT1 A 0 A_JumpIfInventory("StoneBossLeap",30,"P_Stun")
goto P_NoStun
P_Stun:
TNT1 A 0 A_GiveInventory("StoneM_LandedDelay",1)
TNT1 A 0 ACS_NamedExecuteWithResult("cbm_FloorQuakeDamage",250,1,52)
TNT1 A 0 A_SpawnItemEx("Stoneman_FloorQuakeFX_H")
goto P_End
P_NoStun:
TNT1 A 0 ACS_NamedExecuteWithResult("cbm_FloorQuakeDamage",200,1,1052)
TNT1 A 0 A_SpawnItemEx("Stoneman2_FloorQuakeFX_H")
goto P_End
P_End:
TNT1 A 0 A_TakeInventory("StoneBossLeap")
stop
}
}

actor Stoneman_FloorQuakeSpawn : Basic_FloorQuakeSpawn
{
Obituary "$OB_STONECRUSH"
damagetype "StoneM_Shock"
States
{
Quake:
TNT1 A 4 A_SpawnItemEx("Stoneman_FloorQuakeBoom",0,0,28,0,0,0,0,1+SXF_TRANSFERSPECIAL)//32768
stop
}
}
actor Stoneman2_FloorQuakeSpawn : Stoneman_FloorQuakeSpawn
{
damagetype "StoneM_Quake"
States
{
Quake:
TNT1 A 4 A_SpawnItemEx("Stoneman2_FloorQuakeBoom",0,0,28,0,0,0,0,1+32768)
stop
}
}

actor Stoneman_FloorQuakeBoom : Basic_FloorQuakeBoom
{
Obituary "$OB_STONECRUSH"
damagetype "StoneM_Shock"
MeleeRange 10
Accuracy 200
}
actor Stoneman2_FloorQuakeBoom : Stoneman_FloorQuakeBoom
{
damagetype "StoneM_Quake"
Accuracy 150
}

actor Stoneman_FloorQuakeFX_H : Basic_FloorQuakeFX_H
{
//var int user_TranslateWhiteColors;
ActiveSound "misc/hugequake"
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_Quake(7,20,0,300,"none")
TNT1 A 0 A_ActiveSound
TNT1 A 20 A_SpawnItemEx("Stoneman_FloorQuakeFX",0,0,0,0,0,0,360/10,1)
stop
}
}
actor Stoneman2_FloorQuakeFX_H : Basic_FloorQuakeFX_H
{
ActiveSound "weapon/StoneQuakeWeak"
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_ActiveSound
TNT1 A 10 A_SpawnItemEx("Stoneman2_FloorQuakeFX",0,0,0,0,0,0,360/12,1)
stop
}
}

actor Stoneman_FloorQuakeFX : Basic_FloorQuakeFX//250
{
Accuracy 22
Mass 57
MeleeRange 6
Args 0,0,0,0,30
}
actor Stoneman2_FloorQuakeFX : Basic_FloorQuakeFX//200
{
Accuracy 20
Mass 60
MeleeRange 5
Args 0,0,0,0,20
}



actor StoneHandBoss : ProjSpawnFuncActor
{
PROJECTILE
damagetype "StoneM_Hand"
Obituary "$OB_STONEHAND"
+SEEKERMISSILE
+SCREENSEEKER
+FLOORHUGGER
+NOINTERACTION
ReactionTime 20
damage (100)
radius 16
height 32
speed 15
scale 2.5
States
{
Spawn:
TNT1 A 2
TNT1 A 0 A_Stop
POWB TSRQPONK 2 ACS_NamedExecuteWithResult("cbm_CopyPointerAnglePitch",2,2)
POWB K 0 A_ChangeFlag("NOINTERACTION",0)
POWB K 0 A_ChangeVelocity(20,0,0,3)
Spawn2:
POWB LM 2 A_SeekerMissile(2,10,3,50,6)
POWB L 0 A_CountDown
loop
Death:
POWB K 0 A_Stop
POWB KNOPQRST 2 
stop
Crash:
XDeath:
TNT1 A 1
stop
}
}


actor StonemanHealthCheck_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfHealthLower(2,1)
stop
TNT1 A 0 A_JumpIfInventory("IsDead",1,3)
TNT1 A 0 ThrustThingZ(0,4,0,1)
TNT1 A 0 A_GiveInventory("StoneDestroyedFX_P",1)
TNT1 A 0 //Man I'm dead
stop
}
}

actor Stoneman_W2 : BaseMM8BDMWep_CBM
{
tag "$TAGC_5C2"
dropitem "PowerStoneWep"
Weapon.AmmoUse 0
Weapon.AmmoGive 0
Obituary "$OB_POWERSTONE"
weapon.ammotype "TheRockWasStoppedAmmo"
+WEAPON.CHEATNOTWEAPON
States
{
Spawn:
C_05 C 1
stop

Deselect:
POWB Y 0
goto DeselectSwap
Select:
POWB Y 0
goto SelectSwap

Ready:
POWB Y 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_STONEMANCORE,CLRF_SILENT)
POWB Y 0 A_GunFlash("Flash",0)
POWB Y 0 A_TakeInventory("StoneCoreBounceFlag",99)
POWB Y 1
POWB Y 1 A_JumpIfInventory("StoneCoreBounceFlag",8,"ReadyX")
wait
ReadyX:
POWB YZ 5
loop

Fire:
POWB Z 1
goto ReadyX

Flash:
TNT1 AA 7 A_GiveInventory("TheRockWasStoppedAmmo",1)
TNT1 A 7 A_GiveInventory("StoneCoreFlag_P",1)
TNT1 AA 7 A_GiveInventory("TheRockWasStoppedAmmo",1)
TNT1 A 0 A_JumpIfInventory("StoneCoreFlag",0,1)
loop
TNT1 A 5 A_GiveInventory("StoneRebornFX_P",1)
stop
}
}

actor TheRockWasStoppedAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 40
+INVENTORY.IGNORESKILL
}

actor StoneCoreFlag : Inventory
{
inventory.amount 1
inventory.maxamount 9
}
actor StoneCoreBuddha : OnceC {}

actor StoneCoreBounceFlag : Inventory
{
inventory.amount 1
inventory.maxamount 8
}

actor StonemanInvulnerability : PowerInvulnerable
{
powerup.duration 15
}

actor StonemanGutsGWeakness : PowerProtection
{
Powerup.duration -10
DamageFactor "Melee", 2.0
}

actor StonemanSpawnStart_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("StoneCoreBuddha",1,3)
TNT1 A 0 ACS_NamedExecuteWithResult("core_buddhaplayer",0,1)
TNT1 A 0 A_GiveInventory("StoneCoreBuddha",1)
TNT1 A 0 
stop
}
}

actor StoneCoreFlag_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_GiveInventory("StoneCoreFlag",1)
TNT1 A 0 A_GiveInventory("TheRockWasStoppedAmmo",1)
TNT1 A 0 A_SpawnItemEx("StoneTimeSlowFX",0,0,8)
stop
}
}

actor StoneDestroyedFX_P : CustomInventory
{
states
{
Pickup:
TNT1 A 0 ACS_NamedExecuteWithResult("cbm_noteleportplayer",0,true)
TNT1 A 0 ACS_NamedExecuteWithResult("cbm_pickupdisableplayer",0,true)
TNT1 A 0 ACS_NamedExecuteWithResult("core_unsolidplayer",0,USP_TOGGLEON)
TNT1 A 0 ACS_NamedExecuteWithResult("core_stopplayer",0,1)
TNT1 A 0 A_SpawnItemEx("StoneDestroyedFX",0,0,0,0,0,0,0,1)

TNT1 A 0 //A_Stop
TNT1 A 0 ThrustThing(angle*256/360,18,1,0)
TNT1 A 0 ThrustThingZ(0,4,0,1)

TNT1 A 0 A_GiveInventory("Stoneman_W2",1)
TNT1 A 0 ACS_NamedExecuteWithResult("core_buddhaplayer",0,0)
TNT1 A 0 A_GiveInventory("StonemanInvulnerability",1)
TNT1 A 0 A_GiveInventory("StonemanGutsGWeakness",1)

TNT1 A 0 ACS_NamedExecuteWithResult("cbm_NoHitStunplayer",0,true)
TNT1 A 0 A_GiveInventory("StoneCoreFlag",1)

TNT1 A 0 A_SetArg(4,0)//Bounce tracking on Stoneman playerclass

TNT1 A 0 HealThing(30000,CallACS("core_getmaxhealth")*0.355)//Heal back to 550

TNT1 A 0 A_GiveInventory("CBM_DisableJumpPowerGiver",1)

TNT1 A 0 A_TakeInventory("StoneCoreBuddha")
//TNT1 A 0 A_TakeInventory("StoneBossLeap")
TNT1 A 0 A_TakeInventory("StoneBossLeap2",9)
TNT1 A 0 A_TakeInventory("TheRockWasStoppedAmmo")
TNT1 A 0 A_TakeInventory("CantStopTheRockAmmo")

TNT1 A 0 A_TakeInventory("Stoneman_W",1)


TNT1 A 0 A_JumpIfInventory("StoneBossLeap",1,2)//Ladder is disabled fix
stop
TNT1 A 0 A_TakeInventory("StoneBossLeap")
TNT1 A 0 ACS_NamedExecuteWithResult("cbm_cantpushwallsplayer",0,0)
stop
}
}


actor StoneCoreBounce_P : CustomInventory
{
states
{
Pickup:
TNT1 A 0 A_PlaySoundEx("weapon/StoneBounce","Body")
TNT1 A 0 A_ChangeVelocity(11-Args[4],0,momz+(10.0-(Args[4]*0.75)),3)
//TNT1 A 0 ThrustThingZ(0,40-(Args[4]*3),0,1)
TNT1 A 0 A_GiveInventory("StoneCoreBounceFlag",1)
TNT1 A 0 A_SetArg(4,Args[4]+1)
stop
}
}

actor StoneRebornFX_P : CustomInventory
{
states
{
Pickup:
TNT1 A 0 ACS_NamedExecuteWithResult("cbm_noteleportplayer",0,false)
TNT1 A 0 ACS_NamedExecuteWithResult("cbm_pickupdisableplayer",0,false)
TNT1 A 0 ACS_NamedExecuteWithResult("core_unsolidplayer",0,USP_TOGGLEOFF_DAMAGE,CallACS("core_getmaxhealth")/10)
TNT1 A 0 ACS_NamedExecuteWithResult("core_stopplayer",0,0)
TNT1 A 0 A_SpawnItemEx("StoneRebornFX")

TNT1 A 0 HealThing(30000,CallACS("core_getmaxhealth")*0.549)//Heal back to 850

TNT1 A 0 ACS_NamedExecuteWithResult("core_buddhaplayer",0,1)
TNT1 A 0 A_GiveInventory("StoneCoreBuddha",1)
TNT1 A 0 A_GiveInventory("Stoneman_W",1)

TNT1 A 0 A_TakeInventory("StoneCoreFlag")
TNT1 A 0 A_TakeInventory("StonemanInvulnerability",1)
TNT1 A 0 ACS_NamedExecuteWithResult("cbm_NoHitStunplayer",0,false)
TNT1 A 0 A_TakeInventory("StonemanGutsGWeakness",1)
//unfreeze?
TNT1 A 0 A_TakeInventory("CBM_200_SpeedPower")
TNT1 A 0 A_TakeInventory("CBM_DisableJumpPower")
TNT1 A 0 A_TakeInventory("CBM_DisableSpeedPower")

TNT1 A 0 A_TakeInventory("Stoneman_W2",1)
stop
}
}

actor StoneDestroyedFX : BasicHelper
{
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_PlaySoundEx("weapon/StoneCore","Weapon",0,0)
TNT1 A 0 A_PlaySoundEx("weapon/StoneBreak","Body",0,0)
TNT1 AAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("StonemanBrickBreakFX",random(0,16),0,random(0,75),random(0,8),0,random(0,2),random(0,359),1)
TNT1 A 1
stop
}
}

actor StoneRebornFX : BasicHelper
{
ReactionTime 19
States
{
Spawn:
TNT1 A 0
TNT1 A 0 ACS_NamedExecuteWithResult("core_copytranslation")
TNT1 A 0 A_PlaySound("weapon/StoneBreak",4)
BuildingBricks:
TNT1 A 0 A_Warp(2)
TNT1 A 0 A_SpawnItemEx("StonemanBrickRezFX",-random(90,110),0,random(0,16),0,0,0,random(0,359),1)
TNT1 A 1 A_CountDown
loop
}
}

actor StoneTimeSlowFX : BasicExplosion
{
var int user_translateLikePlayer;
Translation "192:192=4:4","198:198=42:42"
scale 1.75
States
{
Spawn:
TNT1 A 0
X_1G NMLKJIHGFENMLKJIHGFE 1
stop
}
}

actor StonemanBrickRezFX : BasicGraphicEffect
{
States
{
SpawnFrame:
TNT1 A 0
TNT1 A 0 A_Jump(256,1,2,3)
POWB A 10 A_ChangeVelocity(random(5,10),0,random(0,6),3)
stop
POWB B 10 A_ChangeVelocity(random(5,10),0,random(0,6),3)
stop
POWB C 10 A_ChangeVelocity(random(5,10),0,random(0,6),3)
stop
}
}

actor StonemanBrickBreakFX : BasicGraphicEffectM
{
-NOGRAVITY
+DOOMBOUNCE
+THRUACTORS
bouncecount 3
ReactionTime 10
Radius 14
Height 14
States
{
SpawnFrame:
TNT1 A 0
TNT1 A 1 A_Jump(256,"FX1","FX2","FX3")
FX1:
POWB AA 1
TNT1 A 1 A_CountDown
loop
FX2:
POWB BB 1
TNT1 A 1 A_CountDown
loop
FX3:
POWB CC 1
TNT1 A 1 A_CountDown
loop
}
}


actor Stoneman_W_NormalBar : NormalBar {Args 4,46}
actor Stoneman_W_ScriptBar : ScriptBar {}
actor Stoneman_W2_NormalBar : NormalBar {Args 4,46}