actor Crashman_W : BaseMM8BDMWep_CBM
{
tag "$TAGC_2E"
dropitem "CrashBombWep"
Weapon.AmmoUse 0
Weapon.AmmoGive 28
Obituary "$OB_CRASHBOMB"
Inventory.Pickupmessage "Power up! Crash Bomb!"
weapon.ammotype "KurasshuAmmo"
States
{
Spawn:
C_02 E 1
loop

Deselect:
CRAA A 0 A_GiveInventory("ClashFlag1")
CRAA A 0 A_GiveInventory("ClashFlag2")
CRAA A 0 A_GiveInventory("ClashFlag3")
CRAA A 0 A_GiveInventory("ClashFlag4")
goto DeselectSwap
Select:
CRAA A 0
goto SelectSwap

Ready:
CRAA A 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_CRASHMAN)
CRAA F 2
CRAA E 2 //A_GunFlash("Flash",1)
CRAA DCB 2
goto Ready1

Ready0:
CRAA A 0 A_JumpIfInventory("KurasshuAmmo",7,"Ready0c")
CRAA A 0 A_JumpIfInventory("KurasshuAmmo",5,"Ready0b")
CRAA A 10 A_WeaponReady(12)
goto Ready1
Ready0b:
CRAA A 10 A_WeaponReady(8)
goto Ready2
Ready0c:
CRAA A 10 A_WeaponReady
goto Ready3

Ready1:
CRAA A 0 A_JumpIfInventory("KurasshuAmmo",5,"Ready2")
CRAA A 2 A_WeaponReady(12)
CRAA A 0 A_GiveInventory("KurasshuAmmo",1)
loop
Ready2:
CRAA A 0 A_JumpIfInventory("KurasshuAmmo",7,"Ready3")
CRAA A 2 A_WeaponReady(8)
CRAA A 0 A_GiveInventory("KurasshuAmmo",1)
loop
Ready3:
CRAA A 2 A_WeaponReady
CRAA A 0 A_GiveInventory("KurasshuAmmo",1)
loop

Fire:
CRAA A 0 A_JumpIfInventory("IsBot",1,"BotFire")
CRAA H 3 A_GiveInventory("Clashman_Fire_P")
CRAA G 3
CRAA F 6
CRAA EDCB 2
//CRAA FEDCBAA 3
//CRAA A 2
Goto Ready0

Altfire:
CRAA H 3 A_GiveInventory("Clashman_Alt_P")
CRAA G 3
CRAA F 6
CRAA EDCB 2
Goto Ready0

BotFire:
CRAA A 0 A_Jump(32,"BotFire2")
CRAA A 0 A_Jump(96,"Altfire")
goto Fire+1
BotFire2:
CRAA A 0 A_PlaySoundEx("weapon/BoobeamBeep","SoundSlot7")
CRAA A 0 A_GiveInventory("ClashFlag1",1)
CRAA A 0 A_GiveInventory("ClashFlag2",1)
CRAA A 0 A_GiveInventory("ClashFlag3",1)
CRAA A 0 A_GiveInventory("ClashFlag4",1)
CRAA A 0 A_GiveInventory("ClashFlagT",1)
CRAA A 0 A_GiveInventory("KurasshuAmmo",14)
goto BotFire+1

}
}

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

actor ClashFlag1 : Powerup
{
Powerup.Duration 3
}
actor ClashFlag2 : ClashFlag1{}
actor ClashFlag3 : ClashFlag1{}
actor ClashFlag4 : ClashFlag1{}
actor ClashFlagT : ClashFlag1{}
actor ClashFlagJ : ClashFlag1{}

actor ClashLaunched1 : Inventory
{
inventory.amount 1
inventory.maxamount 4
}
actor ClashLaunched2 : ClashLaunched1{}
actor ClashLaunched3 : ClashLaunched1{}
actor ClashLaunched4 : ClashLaunched1{}

actor CrashDetonateItem : BasicClassItem
{
inventory.icon "CrasIcon"
inventory.pickupmessage "Hey, hey, step aside, Magnet Man. It's time for Crash Man to finish this job with his Time Bombs."
Tag "Clash Bomb Detonate"
states
{
Spawn:
CRAA X 1
loop
UseCBM:
TNT1 A 0 A_PlaySoundEx("weapon/BoobeamBeep","SoundSlot7")
//TNT1 A 0 A_JumpIfInventory("ClashFlagT",1,"No")
TNT1 A 0 A_GiveInventory("ClashFlag1",1)
TNT1 A 0 A_GiveInventory("ClashFlag2",1)
TNT1 A 0 A_GiveInventory("ClashFlag3",1)
TNT1 A 0 A_GiveInventory("ClashFlag4",1)
TNT1 A 0 A_GiveInventory("ClashFlagT",1)
fail
}
}

actor Clashman_Fire_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_PlaySoundEx("weapon/dustbit","Weapon")
TNT1 A 0 A_TakeInventory("KurasshuAmmo",5,1)
TNT1 A 0 A_FireCustomMissile("ClashBomb_Timer",0,0,8,0)
stop
}
}
actor Clashman_Alt_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_PlaySoundEx("weapon/dustbit","Weapon")
TNT1 A 0 A_TakeInventory("KurasshuAmmo",7,1)
TNT1 A 0 A_FireCustomMissile("ClashBomb_Mine",0,0,8,0)
stop
}
}

actor ClashBomb_Mine : ProjSpawnFuncActor
{
PROJECTILE
DamageType "CrashM_Clash"
Obituary "$OB_CRASHBOMB"
+SKYEXPLODE
+EXPLODEONWATER
+DONTREFLECT
+NOTARGETSWITCH
damage (20)
Radius 6
Height 6
speed 60
scale 2.5
States
{
Spawn:
CDRL C 1
wait

Death:
TNT1 A 0 A_JumpIfInTargetInventory("ClashLaunched1",1,1)
goto Bomb1
TNT1 A 0 A_JumpIfInTargetInventory("ClashLaunched2",1,1)
goto Bomb2
TNT1 A 0 A_JumpIfInTargetInventory("ClashLaunched3",1,1)
goto Bomb3
TNT1 A 0 A_JumpIfInTargetInventory("ClashLaunched4",1,"Bomb1")
goto Bomb4
Bomb1:
TNT1 A 0 A_TakeFromTarget("ClashLaunched2",1)
TNT1 A 0 A_GiveToTarget("ClashLaunched1",1)
TNT1 A 0 A_GiveToTarget("ClashFlag1",1)
TNT1 A 0 A_GiveInventory("ClashLaunched1",1)
goto WallCheck
Bomb2:
TNT1 A 0 A_TakeFromTarget("ClashLaunched3",1)
TNT1 A 0 A_GiveToTarget("ClashLaunched2",1)
TNT1 A 0 A_GiveToTarget("ClashFlag2",1)
TNT1 A 0 A_GiveInventory("ClashLaunched2",1)
goto WallCheck
Bomb3:
TNT1 A 0 A_TakeFromTarget("ClashLaunched4",1)
TNT1 A 0 A_GiveToTarget("ClashLaunched3",1)
TNT1 A 0 A_GiveToTarget("ClashFlag3",1)
TNT1 A 0 A_GiveInventory("ClashLaunched3",1)
goto WallCheck
Bomb4:
TNT1 A 0 A_TakeFromTarget("ClashLaunched1",1)
TNT1 A 0 A_GiveToTarget("ClashLaunched4",1)
TNT1 A 0 A_GiveToTarget("ClashFlag4",1)
TNT1 A 0 A_GiveInventory("ClashLaunched4",1)
goto WallCheck

WallCheck:
CDRL C 0 A_PlaySound("weapon/crashland")
CDRL C 0 A_JumpIf(z-floorz<5,"Floor")
CDRL C 0 A_JumpIf(z-ceilingz==0-6,"Ceiling")
CDRL C 3
CDRL F 18
CDRL F 0 A_JumpIfInventory("ClashLaunched4",1,"WallBeep4")
CDRL F 0 A_JumpIfInventory("ClashLaunched3",1,"WallBeep3")
CDRL F 0 A_JumpIfInventory("ClashLaunched2",1,"WallBeep2")
CDRL F 0 A_JumpIfInventory("ClashLaunched1",1,"WallBeep1")
goto WallWait1
WallBeep1:
CDRL IIIFFF 1 A_JumpIfInTargetInventory("ClashFlag1",1,"Detonate")
CDRL I 0 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"Detonate")
loop
WallBeep2:
CDRL IIIFFF 1 A_JumpIfInTargetInventory("ClashFlag2",1,"Detonate")
CDRL I 0 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"Detonate")
loop
WallBeep3:
CDRL IIIFFF 1 A_JumpIfInTargetInventory("ClashFlag3",1,"Detonate")
CDRL I 0 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"Detonate")
loop
WallBeep4:
CDRL IIIFFF 1 A_JumpIfInTargetInventory("ClashFlag4",1,"Detonate")
CDRL I 0 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"Detonate")
loop

Floor:
CDRL A 3
CDRL D 18
CDRL D 0 A_JumpIfInventory("ClashLaunched4",1,"FloorBeep4")
CDRL D 0 A_JumpIfInventory("ClashLaunched3",1,"FloorBeep3")
CDRL D 0 A_JumpIfInventory("ClashLaunched2",1,"FloorBeep2")
CDRL D 0 A_JumpIfInventory("ClashLaunched1",1,"FloorBeep1")
goto FloorBeep1
FloorBeep1:
CDRL GGGDDD 1 A_JumpIfInTargetInventory("ClashFlag1",1,"DetonateF") 
CDRL G 0 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"DetonateF")
loop
FloorBeep2:
CDRL GGGDDD 1 A_JumpIfInTargetInventory("ClashFlag2",1,"DetonateF") 
CDRL G 0 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"DetonateF")
loop
FloorBeep3:
CDRL GGGDDD 1 A_JumpIfInTargetInventory("ClashFlag3",1,"DetonateF") 
CDRL G 0 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"DetonateF")
loop
FloorBeep4:
CDRL GGGDDD 1 A_JumpIfInTargetInventory("ClashFlag4",1,"DetonateF") 
CDRL G 0 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"DetonateF")
loop

Ceiling:
CDRL B 3
CDRL E 18
CDRL E 0 A_JumpIfInventory("ClashLaunched4",1,"CeilingBeep4")
CDRL E 0 A_JumpIfInventory("ClashLaunched3",1,"CeilingBeep3")
CDRL E 0 A_JumpIfInventory("ClashLaunched2",1,"CeilingBeep2")
CDRL E 0 A_JumpIfInventory("ClashLaunched1",1,"CeilingBeep1")
goto CeilingBeep1
CeilingBeep1:
CDRL HHHEEE 1 A_JumpIfInTargetInventory("ClashFlag1",1,"DetonateC")
CDRL H 0 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"DetonateC")
loop
CeilingBeep2:
CDRL HHHEEE 1 A_JumpIfInTargetInventory("ClashFlag2",1,"DetonateC")
CDRL H 0 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"DetonateC")
loop
CeilingBeep3:
CDRL HHHEEE 1 A_JumpIfInTargetInventory("ClashFlag3",1,"DetonateC")
CDRL H 0 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"DetonateC")
loop
CeilingBeep4:
CDRL HHHEEE 1 A_JumpIfInTargetInventory("ClashFlag4",1,"DetonateC")
CDRL H 0 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"DetonateC")
loop

XDeath:
TNT1 A 1 A_SpawnItemEx("ClashBomb_MineDirectBoom")
stop
Detonate:
TNT1 A 1 A_SpawnItemEx("ClashBomb_MineDetonate")
stop
DetonateF:
TNT1 A 1 A_SpawnItemEx("ClashBomb_MineDetonate",0,0,16)
stop
DetonateC:
TNT1 A 1 A_SpawnItemEx("ClashBomb_MineDetonate",0,0,-16)
stop
}
}

actor ClashBomb_MineDirectBoom : BasicExplosion
{
DamageType "CrashM_Clash"
Obituary "$OB_CLASHBOMB"
+DONTREFLECT
+NOTARGETSWITCH
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_PlaySound("weapon/directcrash2")
TNT1 A 0 A_SpawnItemEx("ClashBomb_MineDirectBoomFX",0,0,0,0,0,0,0,1)
TNT1 A 4 A_Explode(160,72,0,0,12)
stop
}
}

actor ClashBomb_MineDirectBoomFX : BasicGraphicEffect
{
+FORCEXYBILLBOARD
+BRIGHT
ReactionTime 4
States
{
SpawnFrame:
TNT1 A 0
SpawnL:
TNT1 A 0 A_CountDown
TNT1 A 0 A_Jump(256,1,5,9,13,17)
Q_2V ABCD 1
loop
Q_2V EFGH 1
loop
Q_2V IJKL 1
loop
Q_2V MNOP 1
loop
Q_2V QRST 1
loop
}
}

actor ClashBomb_MineDetonate : ClashBomb_MineDirectBoom
{
DamageType "CrashM_Mine"
Obituary "$OB_CRASHBOMB"
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_PlaySound("weapon/directclash")//weapon/directcrash
TNT1 A 0 A_SpawnItemEx("ClashBomb_MineDetonateFX",0,0,0,0,0,0,0,1)
TNT1 AAAA 9 A_Explode(180,72,0,0,16)
stop
}
}

actor ClashBomb_MineDetonateFX : BasicGraphicEffect
{
+FORCEXYBILLBOARD
+BRIGHT
States
{
SpawnFrame:
TNT1 A 0
Q_2V ABCDEFGHIJKLMNOPQRSTEFGHIJKLMNOP 1
stop
/*
ABCD
4
EFGH
4
IZJZKL
1
MNOP
4
QZRZSZTZ
0
EZFZGZH
0
IZJZKL
1
MZNZOP
*/
}
}

actor ClashBomb_Timer : ProjSpawnFuncActor
{
PROJECTILE
DamageType "CrashM_Clash"
Obituary "$OB_CLASHBOMB"
+SKYEXPLODE
+EXPLODEONWATER
+DONTREFLECT
damage (20)
Radius 7
Height 6
speed 50
scale 2.5
States
{
Spawn:
Q_2E A 1
loop
Death:
Q_2E A 0 A_JumpIf(z-floorz<5,"Floor")
Q_2E A 0 A_JumpIf(z-ceilingz==0-6,"Ceiling")
Q_2E B 3 A_PlaySound("weapon/crashland")
Q_2E C 3
Q_2E DDDCCCDDDCCCDDDCCCDDDCCCDDDCCCDDDCCCDDDCCC 1 A_JumpIfInTargetInventory("ClashFlagT",1,"DeathDetonate")
TNT1 A 3 A_SpawnItemEx("ClashBomb_TimerDelayBoom")
stop
DeathDetonate:
TNT1 A 3 A_SpawnItemEx("ClashBomb_TimerDelayBoom2")
stop
Floor:
Q_2E E 3 A_PlaySound("weapon/crashland")
Q_2E F 3
Q_2E GGGFFFGGGFFFGGGFFFGGGFFFGGGFFFGGGFFFGGGFFF 1 A_JumpIfInTargetInventory("ClashFlagT",1,"DeathDetonateF")
TNT1 A 3 A_SpawnItemEx("ClashBomb_TimerDelayBoom",0,0,16)
stop
DeathDetonateF:
TNT1 A 3 A_SpawnItemEx("ClashBomb_TimerDelayBoom2",0,0,16)
stop
Ceiling:
Q_2E H 3 A_PlaySound("weapon/crashland")
Q_2E I 3
Q_2E JJJIIIJJJIIIJJJIIIJJJIIIJJJIIIJJJIIIJJJIII 1 A_JumpIfInTargetInventory("ClashFlagT",1,"DeathDetonateC")
TNT1 A 3 A_SpawnItemEx("ClashBomb_TimerDelayBoom",0,0,-16)
stop
DeathDetonateC:
TNT1 A 3 A_SpawnItemEx("ClashBomb_TimerDelayBoom2",0,0,-16)
stop

XDeath:
TNT1 A 3 A_SpawnItemEx("ClashBomb_TimerDirectBoom")
stop
}
}

actor ClashBomb_TimerDirectBoom : ClashBomb_MineDirectBoom
{
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_PlaySound("weapon/directcrash2")
TNT1 A 0 A_SpawnItemEx("ClashBomb_TimerDirectBoomFX",0,0,0,0,0,0,0,1)
TNT1 A 4 A_Explode(140,72,0,0,12)
stop
}
}

actor ClashBomb_TimerDirectBoomFX : BasicGraphicEffect
{
+FORCEXYBILLBOARD
+BRIGHT
ReactionTime 4
States
{
SpawnFrame:
TNT1 A 0
SpawnL:
TNT1 A 0 A_CountDown
TNT1 A 0 A_Jump(256,1,4,7,10)
CDRL KLM 1
loop
CDRL MOP 1
loop
CDRL QRS 1
loop
CDRL TUV 1
loop
}
}

actor ClashBomb_TimerDelayBoom : ClashBomb_MineDirectBoom
{
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_PlaySound("weapon/directclash2")
TNT1 A 0 A_SpawnItemEx("ClashBomb_TimerDelayBoomFX",0,0,0,0,0,0,0,1)
TNT1 AAAA 9 A_Explode(160,72,0,0,16)
stop
}
}

actor ClashBomb_TimerDelayBoom2 : ClashBomb_MineDirectBoom
{
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_GiveInventory("ClashBomb_TimerDelayBoom2_P",1)
TNT1 A 0 A_PlaySound("weapon/directcrash",1,0.9)
TNT1 A 0 A_SpawnItemEx("ClashBomb_TimerDelayBoomFX",0,0,0,0,0,0,0,1)
TNT1 AAAA 9 A_Explode(140,72,0,0,12)
stop
}
}
actor ClashBomb_TimerDelayBoom2_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInTargetInventory("AirFraudAchieved",3,"No")
TNT1 A 0 A_JumpIf(!CallACS("cbm_MarsRocketJump",22,100,-48),"Pickup2")
stop
Pickup2:
TNT1 A 0 A_JumpIfInTargetInventory("ClashFlagJ",1,"No")
TNT1 A 0 A_GiveToTarget("ClashFlagJ",1)
TNT1 A 0 A_GiveToTarget("AirFraudAchieved",1)
stop
No:
TNT1 A 0
stop
}
}


actor ClashBomb_TimerDelayBoomFX : BasicGraphicEffect
{
+FORCEXYBILLBOARD
+BRIGHT
States
{
SpawnFrame:
TNT1 A 0
//// KKLMNNOPQQRSTTVWKKLMNNOPQQRSTTVW 1
CDRL KKLLMNNOOPQQRRSTTUUVKKLLMNNOOPQQRRSTTUUVVWW 1
//CDRL KLMNOPQRSTUVW 3
stop
}
}



actor Crashman_W_NormalBar : NormalBar {Args 4,225}