actor SniperJoe_W : BaseMM8BDMWep_CBM
{
tag "$TAGC_0J"
dropitem "FragBomberWep"
Weapon.AmmoUse 0
Weapon.AmmoGive 25
Obituary "$OB_JOEBUSTER"
Inventory.Pickupmessage "You got the Joe Buster!"
weapon.ammotype "JoeUpgradeAmmo"
weapon.ammotype2 "AverageJoeAmmo"
inventory.icon "JOSHU"
States
{
Spawn:
C_00 J 1
loop

Deselect:
JOEB H 0 A_GiveInventory("StopShield",1)
goto DeselectSwap
Select:
JOEB H 0 A_TakeInventory("AverageJoeAmmo")
goto SelectSwap

Ready:
JOEB H 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_SNIPERJOE,0,CBM_TCLR_DEFAULT)
JOEB H 0 A_GunFlash("Flash",1)
goto Ready2

Ready2:
JOEB HG 1 A_WeaponReady
JOEB A 0 A_TakeInventory("SpawningMisfire",1)
goto Ready3

Ready3:
//JOEB D 0 A_JumpIfInventory("InBoat",1,"WaveBikeReady")
JOEB A 0 A_TakeInventory("StopShield",1)
JOEB A 0 A_GiveInventory("ProtoShieldHitbox_P",1)
JOEB A 0 A_SpawnItemEx("SniperJoeFancyShieldFX",23,-17,8,momx,momy,momz,0,1+8)
JOEB A 1 A_WeaponReady
//JOEB D 0 A_GiveInventory("AverageJoeAmmo",1)
goto Ready3+2

SpawnProtect:
JOEB H 1
Goto Ready2

Fire:
//JOEB D 0 A_JumpIfInventory("InBoat",1,"WaveBikeFire")
JOEB D 0 A_JumpIfInventory("SpawningMisfire",1,"SpawnProtect")
JOEB D 0 A_GiveInventory("StopShield",1)
JOEB BC 1
JOEB D 0 A_PlaySoundEx("misc/devilfire","Weapon")
JOEB D 1 A_FireCustomMissile("JoeShot",0,1,8,0)
JOEB EF 3
JOEB D 7
JOEB D 0 A_Refire("FireH")
JOEB CB 1 A_WeaponReady
goto Ready3
FireH:
JOEB D 0 A_PlaySoundEx("misc/devilfire","Weapon")
JOEB D 1 A_FireCustomMissile("JoeShot",0,1,8,0)
JOEB EF 3
JOEB D 7
JOEB D 0 A_Refire("FireH")
JOEB CB 1 A_WeaponReady
goto Ready3
Altfire:
//TNT1 A 0 A_JumpIfInventory("InBoat",1,"WaveBikeFire")
JOEB G 0 A_JumpIfInventory("SpawningMisfire",1,"SpawnProtect")
JOEB G 2 A_GiveInventory("StopShield",1)
JOEB H 2 A_TakeInventory("AverageJoeAmmo")
JOEB H 0 A_ReFire("AltH")
JOEB H 0 A_PlaySoundEx("weapon/BombThrow","Weapon")
goto AltToss
AltH:
JOEB H 0 A_JumpIfInventory("AverageJoeAmmo",5,"AltH2")
JOEB H 1 A_GiveInventory("PowerJoeChargeSlow",1)
JOEB H 0 A_Refire("AltH.a")
goto AltToss
AltH.a:
JOEB H 1 A_GiveInventory("AverageJoeAmmo",1+CallACS("core_checkrune",RUNE_RAGE))
JOEB H 0 A_Refire("AltH")
goto AltToss
AltH2:
JOEB H 0 A_JumpIfInventory("AverageJoeAmmo",28,"AltExplode")
JOEB H 1 A_GiveInventory("PowerJoeChargeSlow",1)
JOEB H 0 A_Refire("AltH2.a")
goto AltToss
AltH2.a:
JOEB H 1 A_GiveInventory("AverageJoeAmmo",1+CallACS("core_checkrune",RUNE_RAGE))
JOEB H 0 A_Refire("AltH2")
goto AltToss
AltExplode:
JOEB H 0 A_FireCustomMissile("JoeGrenadeCooked",0,1,8,0)
JOEB H 0 ThrustThingZ(0,10,0,0)
JOEB H 0 A_ChangeVelocity(Cos(pitch)*22,0,(-sin(pitch)*14)+(Cos(pitch)*10),1)
TNT1 A 12
TNT1 AA 2 A_TakeInventory("AverageJoeAmmo")
JOEB HG 3
goto Ready3
AltToss:
JOEB H 0 A_PlaySoundEx("weapon/BombThrow","Weapon")
JOEB H 0 A_FireCustomMissile("JoeGrenade",0,1,8,0)
JOEB K 2 Offset(1,33)
JOEB K 2 Offset(70,74)
JOEB K 2 Offset(122,114)
JOEB L 2 Offset(-1,31)
JOEB L 2 Offset(16,55)
JOEB L 2 Offset(33,84)
TNT1 AA 2 A_TakeInventory("AverageJoeAmmo")
TNT1 A 12 A_WeaponReady(14)
JOEB HG 3
goto Ready3
NoAmmo:
JOEB A 0
goto Ready3
/*WaveBikeReady:
WAVJ A 1 A_WeaponReady
Goto Ready3
WaveBikeFire:
JOEB D 0 A_PlaySoundEx("misc/devilfire","Weapon")
JOEB D 0 A_FireCustomMissile("BikeShot",0,0,0,0)
WAVJ A 3
WAVJ A 6
WAVJ A 3 A_Refire
goto Ready3*/
Flash:
TNT1 A 4
TNT1 A 1 A_GiveInventory("JoeUpgradeAmmo",2)
loop
}
}


actor JoeUpgradeAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 420
+INVENTORY.IGNORESKILL
}

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

actor PowerJoeChargeSlow : PowerSpeed
{
+POWERSPEED.NOTRAIL
powerup.duration 4
speed 0.75
}

actor ScoreBallPickup : CustomInventory
{
inventory.amount 1
inventory.maxamount 0
inventory.pickupmessage "Picked up a Score Ball!"
scale 2.0
States
{
Spawn:
TNT1 A 0
TNT1 A 0 ACS_NamedExecuteWithResult("core_copytranslation")
SCOR B 0 //90 B's
SCOR BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB 35 A_SpawnItemEx("ScoreBallPickupFX",random(-16,16),random(-16,16),random(0,32),0,0,0,0,1) 
stop
Pickup:
TNT1 A 0 A_JumpIfInventory("CanKillStreak",1,"Pickup2")
TNT1 A 0 A_JumpIfInventory("CanSnatch_F",1,"TheSnatch")
TNT1 A 0
fail
Pickup2:
TNT1 A 0 A_JumpIfInventory("SniperJoe_W",1,"Joe")
fail
Joe:
TNT1 A 0 A_PlaySound("item/ScorePickup",3,1.0)
TNT1 A 0 A_GiveInventory("JoeUpgradeAmmo",105)
stop
TheSnatch:
TNT1 A 0 A_GiveInventory("SnatchItems_P2",1)
stop
No:
TNT1 A 0 
fail
}
}

actor ScoreBallPickupFX : BasicClientSide
{
Renderstyle "Translucent"
Alpha 0.95
ReactionTime 3
Scale 1.5
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_Jump(75,"SpawnNo")
X_2F A 0 A_Jump(256,1,2,3,4,5,6)
X_2F ABC 2 bright A_CountDown
goto Spawn+3
X_2F DEF 2 bright A_CountDown
goto Spawn+6
SpawnNo:
TNT1 A 1
stop
}
}


actor PowerJoeHit : PowerUp
{
+INVENTORY.ALWAYSPICKUP
Powerup.Duration -8
}
actor JoeHitFlag : Inventory{}

actor JoeHitItem : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("PowerJoeHit",1,3)
TNT1 A 0 A_GiveInventory("JoeHitFlag",1)
TNT1 A 0 A_SpawnItemEx("JoeHitWatcher")
TNT1 A 0 A_GiveInventory("PowerJoeHit",1)
stop
}
}
actor JoeHitWatcher : BasicWatcher
{
States
{
Spawn:
TNT1 A 0
TNT1 A 1
TNT1 A 0 A_JumpIfInTargetInventory("PowerJoeHit",1,"Spawn")
TNT1 A 0 A_TakeFromTarget("JoeHitFlag",999)
stop
}
}

actor SniperJoeFancyShieldFX : ProtoShieldFX
{
States
{
Spawn:
TNT1 A 0
JOSH S 1
stop
}
}

actor JoeShot : ProjSpawnFuncActor
{
PROJECTILE
Obituary "$OB_JOEBUSTER"
damagetype "Joe_Buster"
+THRUGHOST
+DONTREFLECT
+FORCEXYBILLBOARD
+BRIGHT
Damage (120)
radius 10
height 6
Speed 48
scale 2.5
States
{
Spawn:
TNT1 A 1 
TNT1 A 0 A_ChangeFlag("DONTREFLECT",0)
TNT1 A 0 A_ChangeFlag("THRUGHOST",0)
JOSH A 1
wait
Death:
TNT1 A 1
stop
}
}

/*actor BikeShot : ProjSpawnFuncActor
{
PROJECTILE
damagetype "Joe_Buster"
//seesound "weapon/mbuster"
Damage (30)
+THRUGHOST
+FORCEXYBILLBOARD
+BRIGHT
radius 13
height 9
Speed 50
scale 4.5
States
{
Spawn:
TNT1 A 2
JOSH A 1
goto spawn+1
Death:
JOSH A 1
stop
}
}*/

actor JoeGrenade : ProjSpawnFuncActor
{
var int user_Count;
PROJECTILE
Obituary "$OB_JOEGRENADE"
Damagetype "Joe_Grenade"
//-NOGRAVITY
+SKYEXPLODE
+BOUNCEONFLOORS
+BOUNCEONWALLS
+BOUNCEONCEILINGS
+ALLOWBOUNCEONACTORS
+CANBOUNCEWATER
Bouncefactor 0.6
Wallbouncefactor 0.25
Bouncecount 6
Mass 350
Reactiontime 32
Damage(0)
Radius 11
Height 11
Speed 1//15
Scale 2.5
States
{
Spawn:
JOSH G 0
JOSH G 0 A_SetArg(2,0)
JOSH G 0 A_SetUserVar("user_Count",CallACS("cbm_countinv_acs",204,2))
JOSH G 0
JOSH G 0 A_ScaleVelocity(user_Count*0.75+24)
JOSH G 0 A_ChangeFlag("NOGRAVITY",0)
JOSH G 0 A_ChangeVelocity(0,0,6.25)
JOSH G 0 A_Jump(256,1,3,5,7,9)
Spawn2:
JOSH G 0 A_JumpIf(Reactiontime <= user_Count,"SpawnDead")
JOSH G 4 A_CountDown
JOSH H 0 A_JumpIf(Reactiontime <= user_Count,"SpawnDead")
JOSH H 4 A_CountDown
JOSH I 0 A_JumpIf(Reactiontime <= user_Count,"SpawnDead")
JOSH I 4 A_CountDown
JOSH J 0 A_JumpIf(Reactiontime <= user_Count,"SpawnDead")
JOSH J 4 A_CountDown
JOSH K 0 A_JumpIf(Reactiontime <= user_Count,"SpawnDead")
JOSH K 4 A_CountDown
loop
SpawnDead:
JOSH "#" 1 A_CountDownArg(2)
wait

Death:
TNT1 A 0 A_PlaySoundEx("weapon/napalm","Weapon")
TNT1 A 0 A_Explode(Mass,128,0,0,12)
TNT1 A 0 A_SpawnItemEx("BasicBoom5FX_4_210",0,0,0,0,0,0,0,1)
TNT1 A 2
stop
}
}

actor JoeGrenadeCooked : JoeGrenade
{
Reactiontime 1
Speed 20
States
{
Spawn:
JOSH G 0
JOSH G 0 A_Jump(256,1,2,3,4,5)
JOSH GHIJK 4 A_CountDown
goto Spawn+2
}
}



/////////////////////////////////////////////////////////////////
// ___  ___           _     _              _____              //
// |  \/  |          | |   (_)            |  __ \             //
// | .  . | __ _  ___| |__  _ _ __   ___  | |  \/_   _ _ __   //
// | |\/| |/ _` |/ __| '_ \| | '_ \ / _ \ | | __| | | | '_ \  //
// | |  | | (_| | (__| | | | | | | |  __/ | |_\ \ |_| | | | | //
// \_|  |_/\__,_|\___|_| |_|_|_| |_|\___|  \____/\__,_|_| |_| //
//                                                            //
/////////////////////////////////////////////////////////////////

actor SniperJoe_W2 : BaseMM8BDMWep_CBM
{
tag "$TAGC_0J2"
dropitem "FragBomberWep"
weapon.preferredskin "MachineGun-SniperJoe"
Weapon.AmmoUse 0
Weapon.AmmoGive 56
Obituary "$OB_JOEMGUN"
Inventory.Pickupmessage "You found the Machine Gun!"
weapon.ammotype "JoeUpgradeAmmo"
weapon.ammotype2 "ContraJoeAmmo"
inventory.icon "JOSHV"
+WEAPON.NOAUTOAIM
States
{
Spawn:
C_00 J 1
loop

Deselect:
JOEB Q 0
goto DeselectSwap
Select:
JOEB Q 0
goto SelectSwap

Ready:
JOEB Q 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_SNIPERJOE,0,CBM_TCLR_DEFAULT)
JOEB Q 0 A_GunFlash("Flash",1)
Ready2:
JOEB Q 1 A_GiveInventory("MachineGunJoe_Ready_P")
wait

Fire:
JOEB Q 0 A_GiveInventory("MachineGunJoe_Fire_P")
JOEB Q 0 A_JumpIfInventory("PlayerPropertyRage",1,"FireR")
JOEB RQ 1
JOEB S 1 Offset(8,36)
JOEB Q 1 Offset(4,33)
goto Ready2
FireR:
JOEB RS 1
goto Ready2
Altfire:
JOEB OPOQ 1
JOEB R 0 A_GiveInventory("MachineGunJoe_Alt_P")
JOEB R 0 A_JumpIfInventory("PlayerPropertyRage",1,"Altfire2_R")
JOEB RQ 1
JOEB S 1 Offset(8,36)
JOEB Q 1 Offset(7,36)
JOEB Q 1 Offset(6,35)
JOEB Q 1 Offset(5,35)
JOEB Q 1 Offset(4,34)
JOEB Q 1 Offset(3,34)
JOEB Q 1 Offset(2,33)
JOEB Q 1 Offset(1,33)
goto Ready2
Altfire2_R:
JOEB RQ 1
JOEB S 1 Offset(9,37)
JOEB Q 1 Offset(6,35)
JOEB Q 1 Offset(3,33)
goto Ready2

Flash:
TNT1 A 4
TNT1 A 1 A_GiveInventory("JoeUpgradeAmmo",2)
loop
}
}

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

actor MachineGunJoe_Ready_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("ContraJoeAmmo",7,4)
TNT1 A 0 A_JumpIfInventory("ContraJoeAmmo",1,2)
TNT1 A 0 A_WeaponReady(WRF_NOFIRE)
stop
TNT1 A 0 A_WeaponReady(WRF_NOSECONDARY)
stop
TNT1 A 0 A_WeaponReady
stop
}
}
actor MachineGunJoe_Fire_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_PlaySoundEx("misc/devilfire","Weapon")
TNT1 A 0 A_FireCustomMissile("MGunJoeShot",random(-2,2),0,8,0)
TNT1 A 0 A_TakeInventory("ContraJoeAmmo",1,1)
stop
}
}
actor MachineGunJoe_Alt_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_PlaySoundEx("weapon/dustbit","Weapon")
TNT1 A 0 A_FireCustomMissile("JoeGrenadeLaunch",0,0,8,0)
TNT1 A 0 A_TakeInventory("ContraJoeAmmo",1)
TNT1 A 0 A_TakeInventory("ContraJoeAmmo",6,1)
stop
}
}

actor MGunJoeShot : ProjSpawnFuncActor
{
PROJECTILE
Obituary "$OB_JOEMGUN"
damagetype "Joe_MGun"
+THRUGHOST
+BRIGHT
Damage (60)
radius 10
height 6
Speed 54
scale 3.0
States
{
Spawn:
TNT1 A 1
TNT1 A 0 A_ChangeFlag("THRUGHOST",0)
JOSH D 1
goto Spawn+2
Death:
TNT1 A 1
stop
}
}

actor JoeGrenadeLaunch : JoeGrenade
{
damagetype "Joe_Grenade"
-NOGRAVITY
Mass 250
reactiontime 9
speed 30
States
{
Spawn:
JOSH G 0
JOSH G 0 A_ChangeVelocity(0,0,4)
JOSH G 0 A_CountDown
JOSH GHIJK 4
goto Spawn+2
}
}

//////////////////////////////////////////////////
//    ___              _____           _        //
//   |_  |            /  __ \         | |       //
//     | | ___   ___  | /  \/_ __ __ _| |_ ___  //
//     | |/ _ \ / _ \ | |   | '__/ _` | __/ _ \ //
// /\__/ / (_) |  __/ | \__/\ | | (_| | ||  __/ //
// \____/ \___/ \___|  \____/_|  \__,_|\__\___| //
//////////////////////////////////////////////////

actor JoeKillStreakItem : BasicClassItem
{
inventory.pickupmessage "You found a Professional Killstreak Kit (Joe Buster)."
inventory.icon "JoeIcon"
Tag "Joe Kill Streak"
States
{//6000
Spawn:
SCOR I 6
loop
UseCBM:
TNT1 A 0 A_JumpIfInventory("JoeUpgradeAmmo",420,"Use3")
TNT1 A 0 A_JumpIfInventory("JoeUpgradeAmmo",3,"Use2")//105
fail
Use2:
TNT1 A 0 A_JumpIfInventory("ContraJoeAmmo",56,"No")
TNT1 A 0 //A_PlaySound("item/ScoreUse",7,0.55)//SoundSlot7
TNT1 A 0 //A_GiveInventory("ContraJoeAmmo",56)
TNT1 A 0 A_SpawnItemEx("ContraJoeAmmoHelper")//A_TakeInventory("JoeUpgradeAmmo",105)
fail
Use3:
TNT1 A 0 A_PlaySound("item/ScoreUse",7,0.55)//SoundSlot7
TNT1 A 0 A_TakeInventory("JoeUpgradeAmmo",100)
TNT1 A 0 A_TakeInventory("JoeUpgradeAmmo",215,1)
TNT1 A 0 A_SpawnItemEx("JoeCrateSpawner",cos(-pitch)*0,0,28+sin(-pitch),cos(-pitch)*1000,0,sin(-pitch)*1000,0,32)
fail
}
}

actor ContraJoeAmmoHelper : BasicHelper
{
States
{
Spawn://CountInv
TNT1 A 0
TNT1 A 0 A_PlaySound("item/ScoreUse",7,0.55)
TNT1 A 0 A_SetArg(0,CallACS("cbm_countinv_JoeAmmo",56))
TNT1 A 0 A_GiveToTarget("ContraJoeAmmo",Args[0])
TNT1 A 0 A_TakeFromTarget("JoeUpgradeAmmo",Args[0]*3,1)
TNT1 A 1
stop
}
}


actor JoeCrateSpawner : FastProjectile
{
var int user_Height;
var int user_XX;
+SKYEXPLODE
+EXPLODEONWATER
+DONTBLAST
+THRUGHOST
+DONTREFLECT
reactiontime 7
damage (0)
radius 12
height 12
speed 1000
States
{
Spawn:
TNT1 A 0
TNT1 A 1 A_CountDown
loop
XDeath:
TNT1 A 0 A_SetUserVar("user_XX",12)
goto Death
Death:
TNT1 A 0 A_JumpIf(z-ceilingz>=-16,"DeathC")
TNT1 A 0 A_JumpIf(z-ceilingz<=-512,"DeathC2")
TNT1 A 0 A_SetUserVar("user_Height",ceilingz-z-16)
TNT1 A 0 A_Jump(256,"Death2")
Death2:
TNT1 A 0 A_SpawnItemEx("JoeCrateDrop",user_XX,0,user_Height,0,0,-20,0,32)
stop
DeathC:
TNT1 A 0 A_SetUserVar("user_Height",-0)
goto Death+3
DeathC2:
TNT1 A 0 A_SetUserVar("user_Height",496)
goto Death+3
}
}

actor JoeCrateDrop : ProjSpawnFuncActor
{
PROJECTILE
Obituary "$OB_JOECRATE"
Damagetype "Joe_Crate"
+THRUGHOST
+DONTBLAST
+DONTREFLECT
+RIPPER
-NOGRAVITY
+BOUNCEONWALLS
+BOUNCEONFLOORS
+BOUNCEONCEILINGS
bouncecount 4
bouncefactor 0.25
wallbouncefactor 0.75
Damage (30+CallACS("core_checkrune",RUNE_SPREAD,2)*60)
Speed 26
Radius 11
Height 11
gravity 1.5
scale 2.5
States
{
Spawn:
JOSH X 0
JOSH X 1 A_PlaySound("weapon/JoeDrop",1,0.55)
JOSH X 1 //A_SpawnItemEx("JoeCrateDropFX",0,0,0,momx,momy,0,0,9)
wait
Death:
JOSH X 0 A_SpawnItemEx("JoeCrateWait",0,0,0,0,0,1)
TNT1 A 2
stop
NoDeath:
JOSH X 1 A_FadeOut(0.05)
wait
}
}

actor JoeCrateDropFX : BasicClientSide
{
States
{
Spawn:
JOSH W 0
JOSH W 1
stop
}
}

actor JoeCrateWait : JoeCrateDrop
{
-RIPPER
+THRUACTORS
//+NOGRAVITY
-BOUNCEONFLOORS
+NOEXPLODEFLOOR
ReactionTime 350
States
{
Spawn:
JOSH X 1 A_JumpIfCloser(36,"BuffJoeCheck")
JOSH X 0 A_CountDown
JOSH X 0 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"Death2")
JOSH X 0 A_JumpIfInTargetInventory("JoeSelectKillFlag",1,"Death2")
loop
SpawnDelay:
JOSH X 1
goto Spawn+1
BuffJoeCheck:
JOSH X 0 A_JumpIfInTargetInventory("SniperJoe_W0",1,"SpawnDelay")
JOSH X 0 A_JumpIfInTargetInventory("JoeSelectApacheFlag",1,"SpawnDelay")
JOSH X 0 A_JumpIfInTargetInventory("JoeSelectTruckFlag",1,"SpawnDelay")
BuffJoe:
JOSH X 0 A_SetGravity(0.0)//A_ChangeFlag("NOGRAVITY",1)
JOSH X 0 A_ChangeFlag("NOINTERACTION",1)
JOSH X 0 A_Stop
JOSH X 0 A_GiveToTarget("Joe_KS_Select_Pickup",1)
JOSH X 20
BuffJoeWait:
JOSH X 0 A_JumpIfInTargetInventory("JoeSelectApacheFlag",1,"BuffJoeDeath")
JOSH X 0 A_JumpIfInTargetInventory("JoeSelectTruckFlag",1,"BuffJoeDeath")
JOSH X 1 A_GiveInventory("WeaponCharge",1)
JOSH X 0 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"Death2")
JOSH X 0 A_JumpIfInTargetInventory("WeaponCharge",100,"Death2")
loop
BuffJoeDeath:
JOSH X 16
JOSH XXX 1
goto Death2
Death2:
JOSH XXXX 1 A_FadeOut(0.2)
stop
Death:
JOSH X 0 A_GiveToTarget("JoeUpgradeAmmo",140)
goto NoDeath
}
}


//////////////////////////////////
//  _____      _           _    //
// /  ___|    | |         | |   //
// \ `--.  ___| | ___  ___| |_  //
//  `--. \/ _ \ |/ _ \/ __| __| //
// /\__/ /  __/ |  __/ (__| |_  //
// \____/ \___|_|\___|\___|\__| //
//////////////////////////////////

actor SniperJoe_W0 : BaseMM8BDMWep_CBM
{
tag "$TAGC_0J3"
dropitem "FragBomberWep"
Weapon.AmmoUse 0
Weapon.AmmoGive 0
Obituary "%o thought %k was an average joe."
Inventory.Pickupmessage "You got the Joe Select!"
weapon.ammotype "JoeMontyHallAmmo"
+WEAPON.CHEATNOTWEAPON
States
{
Spawn:
C_00 J 1
loop

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

Ready:
TNT1 A 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_SNIPERJOE_APACHE,1,CBM_TCLR_DEFAULT)
TNT1 A 0 A_GunFlash("Flash",1)
goto Ready2
Ready2:
TNT1 AA 1 A_WeaponReady
TNT1 A 0 A_TakeInventory("JoeMontyHallAmmo",1)
TNT1 A 0 A_JumpIfInventory("JoeMontyHallAmmo",1,"Ready2")
Goto ReadyTime
ReadyTime:
TNT1 A 0 A_Jump(256,"Fire","Altfire")
TNT1 A 1
loop

Fire:
TNT1 A 0 A_PlaySound("item/ScoreUse",7,0.55)//SoundSlot7
TNT1 A 0 A_SpawnItemEx("JoeSelectApacheFX",0,0,0,0,0,0,0,1)
TNT1 A 2 A_GiveInventory("JoeSelectApacheFlag",1)
TNT1 A 2 A_SpawnItemEx("JoeSelectApacheFX1",0,0,0,0,0,0,0,1)
TNT1 A 2 A_SpawnItemEx("JoeSelectApacheFX2",0,0,0,0,0,0,0,1)
TNT1 A 2 A_SpawnItemEx("JoeSelectApacheFX3",0,0,0,0,0,0,0,1)
TNT1 A 2 A_SpawnItemEx("JoeSelectApacheFX4",0,0,0,0,0,0,0,1)
TNT1 A 2 A_SpawnItemEx("JoeSelectApacheFX5",0,0,0,0,0,0,0,1)
TNT1 A 2 A_SpawnItemEx("JoeSelectApacheFX6",0,0,0,0,0,0,0,1)
TNT1 A 2 A_SpawnItemEx("JoeSelectApacheFX7",0,0,0,0,0,0,0,1)
TNT1 A 2 A_SpawnItemEx("JoeSelectApacheFX8",0,0,0,0,0,0,0,1)
TNT1 A 2 A_SpawnItemEx("JoeSelectApacheFX9",0,0,0,0,0,0,0,1)
TNT1 A 2 A_GiveInventory("Joe_KS_Apache_Pickup",1)
TNT1 A 1 A_SpawnItemEx("JoeSelectApacheFX0",0,0,0,0,0,0,0,1)
wait
Altfire:
TNT1 A 0 A_PlaySound("item/ScoreUse",7,0.55)//SoundSlot7
TNT1 A 0 A_SpawnItemEx("JoeSelectTruckFX",0,0,0,0,0,0,0,1)
TNT1 A 2 A_GiveInventory("JoeSelectTruckFlag",1)
TNT1 A 2 A_SpawnItemEx("JoeSelectTruckFX1",0,0,0,0,0,0,0,1)
TNT1 A 2 A_SpawnItemEx("JoeSelectTruckFX2",0,0,0,0,0,0,0,1)
TNT1 A 2 A_SpawnItemEx("JoeSelectTruckFX3",0,0,0,0,0,0,0,1)
TNT1 A 2 A_SpawnItemEx("JoeSelectTruckFX4",0,0,0,0,0,0,0,1)
TNT1 A 2 A_SpawnItemEx("JoeSelectTruckFX5",0,0,0,0,0,0,0,1)
TNT1 A 2 A_SpawnItemEx("JoeSelectTruckFX6",0,0,0,0,0,0,0,1)
TNT1 A 2 A_SpawnItemEx("JoeSelectTruckFX7",0,0,0,0,0,0,0,1)
TNT1 A 2 A_SpawnItemEx("JoeSelectTruckFX8",0,0,0,0,0,0,0,1)
TNT1 A 2 A_SpawnItemEx("JoeSelectTruckFX9",0,0,0,0,0,0,0,1)
TNT1 A 2 A_GiveInventory("Joe_KS_Truck_Pickup",1)
TNT1 A 1 A_SpawnItemEx("JoeSelectTruckFX0",0,0,0,0,0,0,0,1)
wait
Flash:
TNT1 A 1
stop
}
}

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

actor JoeSelectApacheFlag : OnceC {}
actor JoeSelectTruckFlag : OnceC {}
actor JoeSelectKillFlag : Powerup
{
Powerup.Duration 35
}


actor JoeSelectApacheFX
{
-SOLID
+NOGRAVITY
+NOINTERACTION
RenderStyle "Translucent"
Alpha 0.1
Scale 0.25
States
{
Spawn:
S5IP A 0
//TNT1 A 0 ACS_NamedExecuteWithResult("core_copytranslation")
S5IP A 2
stop
}
}
actor JoeSelectApacheFX1:JoeSelectApacheFX{Alpha 0.2 Scale 0.5}
actor JoeSelectApacheFX2:JoeSelectApacheFX{Alpha 0.3 Scale 0.75}
actor JoeSelectApacheFX3:JoeSelectApacheFX{Alpha 0.4 Scale 1.0}
actor JoeSelectApacheFX4:JoeSelectApacheFX{Alpha 0.5 Scale 1.25}
actor JoeSelectApacheFX5:JoeSelectApacheFX{Alpha 0.6 Scale 1.5}
actor JoeSelectApacheFX6:JoeSelectApacheFX{Alpha 0.7 Scale 1.75}
actor JoeSelectApacheFX7:JoeSelectApacheFX{Alpha 0.8 Scale 2.0}
actor JoeSelectApacheFX8:JoeSelectApacheFX{Alpha 0.9 Scale 2.25}
actor JoeSelectApacheFX9:JoeSelectApacheFX{Alpha 1.0 Scale 2.5}
actor JoeSelectApacheFX0:JoeSelectApacheFX9
{
States
{
Spawn:
S5IP A 0
S5IP A 1
stop
}
}

actor JoeSelectTruckFX : JoeSelectApacheFX
{
States
{
Spawn:
S7IP A 0
S7IP A 2
stop
}
}
actor JoeSelectTruckFX1:JoeSelectTruckFX{Alpha 0.2 Scale 0.5}
actor JoeSelectTruckFX2:JoeSelectTruckFX{Alpha 0.3 Scale 0.75}
actor JoeSelectTruckFX3:JoeSelectTruckFX{Alpha 0.4 Scale 1.0}
actor JoeSelectTruckFX4:JoeSelectTruckFX{Alpha 0.5 Scale 1.25}
actor JoeSelectTruckFX5:JoeSelectTruckFX{Alpha 0.6 Scale 1.5}
actor JoeSelectTruckFX6:JoeSelectTruckFX{Alpha 0.7 Scale 1.75}
actor JoeSelectTruckFX7:JoeSelectTruckFX{Alpha 0.8 Scale 2.0}
actor JoeSelectTruckFX8:JoeSelectTruckFX{Alpha 0.9 Scale 2.25}
actor JoeSelectTruckFX9:JoeSelectTruckFX{Alpha 1.0 Scale 2.5}
actor JoeSelectTruckFX0:JoeSelectTruckFX9
{
States
{
Spawn:
S7IP A 0
S7IP A 1
stop
}
}

actor Joe_KS_Select_Pickup : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_GiveInventory("SniperJoe_W0",1)
TNT1 A 0 A_GiveInventory("JoeMontyHallAmmo",56)

TNT1 A 0 A_TakeInventory("SniperJoe_W",1)
TNT1 A 0 A_TakeInventory("SniperJoe_W2",1)
TNT1 A 0 //A_TakeInventory("ContraJoeAmmo")
TNT1 A 0 A_TakeInventory("AverageJoeAmmo")
TNT1 A 0 A_TakeInventory("JoeKillStreakItem",1)

TNT1 A 0 A_GiveInventory("StopShield",1)

TNT1 A 0 ACS_NamedExecuteWithResult("core_nogravityplayer",0,2)

TNT1 A 0 ACS_NamedExecuteWithResult("cbm_noradiusdmgplayer",0,1)
TNT1 A 0 ACS_NamedExecuteWithResult("core_nonshootableplayer",0,1)

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_invisibleplayer",0,true)
TNT1 A 0 ACS_NamedExecuteWithResult("core_nopushplayer",0,true)
TNT1 A 0 A_GiveInventory("CBM_00_AlphaPowerGiver",1)
TNT1 A 0 A_Stop
//TNT1 A 0 ACS_NamedExecuteWithResult("core_stopplayer",0,1)
TNT1 A 0 A_GiveInventory("CBM_DisableSpeedPowerGiver",1)
TNT1 A 0 A_GiveInventory("CBM_DisableJumpPowerGiver",1)
stop
}
}

actor Joe_KS_Truck_Pickup : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_GiveInventory("JoeUpgradeAmmo",420)
TNT1 A 0 A_GiveInventory("SniperJoe_W3",1)
TNT1 A 0 A_GiveInventory("JoeTruck_BasicArmor_P",1)
TNT1 A 0 A_GiveInventory("SetDynamicArmorDosage",1)

TNT1 A 0 A_GiveInventory("StopShield",1)
TNT1 A 0 A_TakeInventory("SniperJoe_W0",1)
TNT1 A 0 A_TakeInventory("JoeMontyHallAmmo")
TNT1 A 0 A_TakeInventory("SniperJoe_W",1)
TNT1 A 0 A_TakeInventory("SniperJoe_W2",1)
TNT1 A 0 //A_TakeInventory("ContraJoeAmmo")
TNT1 A 0 A_TakeInventory("JoeKillStreakItem",1)
TNT1 A 0 A_GiveInventory("JoeNukeMyRideItem",1)

TNT1 A 0 ACS_NamedExecuteWithResult("cbm_HalfHitStunplayer",0,true)

TNT1 A 0 ACS_NamedExecuteWithResult("core_nogravityplayer",0,0)

TNT1 A 0 ACS_NamedExecuteWithResult("cbm_noradiusdmgplayer",0,0)
TNT1 A 0 ACS_NamedExecuteWithResult("core_nonshootableplayer",0,0)

TNT1 A 0 ACS_NamedExecuteWithResult("cbm_pickupdisableplayer",0,false)
TNT1 A 0 ACS_NamedExecuteWithResult("core_unsolidplayer",0,USP_TOGGLEOFF_NONE)
TNT1 A 0 ACS_NamedExecuteWithResult("core_invisibleplayer",0,false)
TNT1 A 0 ACS_NamedExecuteWithResult("core_nopushplayer",0,false)
TNT1 A 0 A_TakeInventory("CBM_00_AlphaPower")
TNT1 A 0 A_TakeInventory("CBM_DisableJumpPower")
stop
}
}


actor Joe_KS_Apache_Pickup : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_GiveInventory("JoeUpgradeAmmo",420)
TNT1 A 0 A_GiveInventory("SniperJoe_W4",1)
TNT1 A 0 A_GiveInventory("JoeApache_BasicArmor_P",1)
TNT1 A 0 A_GiveInventory("SetDynamicArmorDosage",1)

TNT1 A 0 A_GiveInventory("StopShield",1)
TNT1 A 0 A_TakeInventory("SniperJoe_W0",1)
TNT1 A 0 A_TakeInventory("JoeMontyHallAmmo")
TNT1 A 0 A_TakeInventory("SniperJoe_W",1)
TNT1 A 0 A_TakeInventory("SniperJoe_W2",1)
TNT1 A 0 //A_TakeInventory("ContraJoeAmmo")
TNT1 A 0 A_TakeInventory("JoeKillStreakItem",1)
TNT1 A 0 A_GiveInventory("JoeNukeMyRideItem",1)

TNT1 A 0 ACS_NamedExecuteWithResult("core_nogravityplayer",0,0)

TNT1 A 0 ACS_NamedExecuteWithResult("cbm_noradiusdmgplayer",0,0)
TNT1 A 0 ACS_NamedExecuteWithResult("core_nonshootableplayer",0,0)

TNT1 A 0 ACS_NamedExecuteWithResult("cbm_pickupdisableplayer",0,false)
TNT1 A 0 ACS_NamedExecuteWithResult("core_unsolidplayer",0,USP_TOGGLEOFF_NONE)
TNT1 A 0 ACS_NamedExecuteWithResult("core_invisibleplayer",0,false)
TNT1 A 0 ACS_NamedExecuteWithResult("core_nopushplayer",0,false)
TNT1 A 0 A_TakeInventory("CBM_00_AlphaPower")

//TNT1 A 0 ACS_NamedExecuteWithResult("core_stopplayer",0,0)
TNT1 A 0 A_TakeInventory("CBM_DisableSpeedPower")
TNT1 A 0 A_TakeInventory("CBM_DisableJumpPower")
TNT1 A 0 A_GiveInventory("CBM_125_SpeedPowerGiver",1)
stop
}
}

actor Joe_KS_Normal_Pickup : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_GiveInventory("SniperJoe_W",1)
TNT1 A 0 A_GiveInventory("SniperJoe_W2",1)
TNT1 A 0 //A_GiveInventory("ContraJoeAmmo",28)
TNT1 A 0 A_GiveInventory("JoeKillStreakItem",1)
TNT1 A 0 A_GiveInventory("SpawningMisfire",1)


TNT1 A 0 A_TakeInventory("DynamicArmorDosage")
TNT1 A 0 A_TakeInventory("SniperJoe_W3",1)
TNT1 A 0 A_TakeInventory("JoeTruckDashFlag",99)
TNT1 A 0 A_TakeInventory("SniperJoe_W4",1)
TNT1 A 0 A_TakeInventory("SniperJoe_W0",1)
TNT1 A 0 A_TakeInventory("JoeNukeMyRideItem",1)
TNT1 A 0 A_TakeInventory("JoeUpgradeAmmo",420)

TNT1 A 0 A_JumpIfInventory("JoeSelectApacheFlag",1,"Pick_A")
TNT1 A 0 A_JumpIfInventory("JoeSelectTruckFlag",1,"Pick_T")
stop

Pick_A:
TNT1 A 0 A_GiveInventory("CBM_AviationOff_P")
TNT1 A 0 A_SpawnItemEx("JoeNukedHisApache",0,0,28,0,0,0,0,1)
goto End
Pick_T:
TNT1 A 0 ACS_NamedExecuteWithResult("cbm_HalfHitStunplayer",0,false)
//TNT1 A 0 ACS_NamedExecuteWithResult("core_stopplayer",0,0)
TNT1 A 0 A_TakeInventory("CBM_DisableSpeedPower")
TNT1 A 0 A_SpawnItemEx("JoeNukedHisTruck",0,0,28,0,0,0,0,1)
goto End
End:
TNT1 A 0 A_SpawnItemEx("JoeArmorEjectHelper")
TNT1 A 0 A_Recoil(-6)
TNT1 A 0 ThrustThingZ(0,50,0,0)
TNT1 A 0 A_TakeInventory("JoeSelectApacheFlag",1)
TNT1 A 0 A_TakeInventory("JoeSelectTruckFlag",1)
TNT1 A 0 A_TakeInventory("CBM_DisableJumpPower")
TNT1 A 0 A_TakeInventory("CBM_125_SpeedPower")
stop
}
}

actor JoeArmorEjectHelper : BasicHelper
{
States
{
Spawn:
TNT1 A 0
TNT1 AA 1 A_TakeFromTarget("BasicArmor")
stop
}
}

actor JoeNukedHisApache : BasicExplosion
{
Obituary "$OB_JOENUKEA"
damagetype "Joe_Apache"
Args 50,128,64,32,64
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_Explode(Args[0],Args[1],0,0,Args[2])
TNT1 AAA 0 A_SpawnItemEx("BasicBoom5FX_4_210",random(-Args[3],Args[3]),random(-Args[3],Args[3]),random(-32,Args[4]),0,0,0,0,1)
TNT1 A 5 A_PlaySoundEx("classes/drillexplode","Auto")
TNT1 A 0 A_Explode(Args[0],Args[1],0,0,Args[2])
TNT1 AAA 0 A_SpawnItemEx("BasicBoom5FX_4_210",random(-Args[3],Args[3]),random(-Args[3],Args[3]),random(-32,Args[4]),0,0,0,0,1)
TNT1 A 5 A_PlaySoundEx("classes/drillexplode","Auto")
TNT1 A 0 A_Explode(Args[0],Args[1],0,0,Args[2])
TNT1 AAA 0 A_SpawnItemEx("BasicBoom5FX_4_210",random(-Args[3],Args[3]),random(-Args[3],Args[3]),random(-32,Args[4]),0,0,0,0,1)
TNT1 A 5 A_PlaySoundEx("classes/drillexplode","Auto")
stop
}
}

actor JoeNukedHisTruck : JoeNukedHisApache
{
Obituary "$OB_JOENUKET"
damagetype "Joe_Truck"
Args 40,128,32,48,96
}

actor JoeNukeMyRideItem : BasicClassItem
{
inventory.icon "JoeEject"
inventory.pickupmessage "Flip off your vehicle with 5 bucks."
Tag "Joe Nukes their Ride"
states
{
Spawn:
JOSH Z 1
loop
UseCBM:
TNT1 A 1 A_GiveInventory("Joe_KS_Normal_Pickup",1)
stop
}
}

actor JoeVehicleDuration_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("JoeVehicleDurationDelay",1,"No")
TNT1 A 0 A_GiveInventory("JoeVehicleDurationDelay",1)
TNT1 A 0 A_TakeInventory("JoeUpgradeAmmo",1)
TNT1 A 0 A_TakeInventory("JoeUpgradeAmmo",2,1)
stop
No:
TNT1 A 0
stop
}
}
actor JoeVehicleDurationDelay : Powerup
{
Powerup.Duration 2
}

////////////////////////////////
//  _____               _     //
// |_   _|             | |    //
//   | |_ __ _   _  ___| | __ //
//   | | '__| | | |/ __| |/ / //
//   | | |  | |_| | (__|   <  //
//   \_/_|   \__,_|\___|_|\_\ //
////////////////////////////////
actor SniperJoe_W3 : BaseMM8BDMWep_CBM
{
tag "$TAGC_0J4"
dropitem "FragBomberWep"
weapon.preferredskin "Truck-SniperJoe"

Weapon.AmmoUse 0
Weapon.AmmoGive 3
Weapon.SlotNumber 1
Obituary "$OB_JOETRUCK"
Inventory.Pickupmessage "You found some car keys!"
weapon.ammotype "JoeUpgradeAmmo"
weapon.ammotype2 "TollBoothAmmo"
States
{
Spawn:
C_00 J 1
loop

Deselect:
JOEB T 0
goto DeselectSwap
Select:
JOEB T 0
goto SelectSwap

Ready:
JOEB T 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_SNIPERJOE,0,CBM_TCLR_DEFAULT)
JOEB T 0 A_GunFlash("Flash",1)
JOEB T 2 A_WeaponReady
goto Ready+2

Fire:
JOEB T 0 A_JumpIfInventory("TruckJoeHornDelay",1,3)
JOEB T 0 A_GiveInventory("TruckJoeHornDelay",1)
JOEB T 0 A_PlaySound("classes/CarHonk",1,0.5)
Fire2:
JOEB T 0 A_WeaponReady(15)
JOEB T 0 A_JumpIfInventory("PlayerPropertyRage",1,"Fire2_R")
JOEB T 1 A_GiveInventory("JoeTruckThrustD",1)
JOEB T 0 A_Refire(1)
JOEB T 1 Offset(0,34)A_GiveInventory("JoeTruckThrust",1)
JOEB T 0 A_Refire(1)
JOEB T 1 Offset(0,36)A_GiveInventory("JoeTruckThrust",1)
JOEB T 0 A_Refire(1)
JOEB T 1 Offset(0,38)A_GiveInventory("JoeTruckThrustD",1)
JOEB T 0 A_Refire(1)
JOEB T 1 Offset(0,40)A_GiveInventory("JoeTruckThrust",1)
JOEB T 0 A_Refire(1)
JOEB T 1 Offset(0,40)A_GiveInventory("JoeTruckThrust",1)
JOEB T 0 A_Refire(1)
JOEB T 1 Offset(0,38)A_GiveInventory("JoeTruckThrustD",1)
JOEB T 0 A_Refire(1)
JOEB T 1 Offset(0,36)A_GiveInventory("JoeTruckThrust",1)
JOEB T 0 A_Refire(1)
JOEB T 1 Offset(0,34)A_GiveInventory("JoeTruckThrust",1)
JOEB T 0 A_Refire("Fire2")
JOEB T 0 A_TakeInventory("JoeTruckDashFlag",99)
goto Ready+2
Fire2_R:
JOEB T 1 A_GiveInventory("JoeTruckThrustD",1)
JOEB T 0 A_Refire(1)
JOEB T 1 Offset(0,35)A_GiveInventory("JoeTruckThrust",1)
JOEB T 0 A_Refire(1)
JOEB T 1 Offset(0,38)A_GiveInventory("JoeTruckThrustD",1)
JOEB T 0 A_Refire(1)
JOEB T 1 Offset(0,41)A_GiveInventory("JoeTruckThrust",1)
JOEB T 0 A_Refire(1)
JOEB T 1 Offset(0,38)A_GiveInventory("JoeTruckThrustD",1)
JOEB T 0 A_Refire(1)
JOEB T 1 Offset(0,35)A_GiveInventory("JoeTruckThrust",1)
JOEB T 0 A_Refire("Fire2")
JOEB T 0 A_TakeInventory("JoeTruckDashFlag",99)
goto Ready+2

AltFire:
JOEB T 0 A_JumpIfInventory("TruckJoeHornDelay",1,3)
JOEB T 0 A_GiveInventory("TruckJoeHornDelay",1)
JOEB T 0 A_PlaySound("classes/CarHonk",1,0.5)
Altfire2:
JOEB T 0 A_WeaponReady(15)
JOEB T 0 A_JumpIfInventory("PlayerPropertyRage",1,"Altfire2_R")
JOEB T 1 A_GiveInventory("JoeTruckThrustRD",1)
JOEB T 1 Offset(0,34)A_GiveInventory("JoeTruckThrustR",1)
JOEB T 1 Offset(0,36)A_GiveInventory("JoeTruckThrustR",1)
JOEB T 1 Offset(0,38)A_GiveInventory("JoeTruckThrustRD",1)
JOEB T 1 Offset(0,40)A_GiveInventory("JoeTruckThrustR",1)
JOEB T 1 Offset(0,40)A_GiveInventory("JoeTruckThrustR",1)
JOEB T 1 Offset(0,38)A_GiveInventory("JoeTruckThrustRD",1)
JOEB T 1 Offset(0,36)A_GiveInventory("JoeTruckThrustR",1)
JOEB T 1 Offset(0,34)A_GiveInventory("JoeTruckThrustR",1)
JOEB T 0 A_Refire("Altfire2")
JOEB T 0 A_TakeInventory("JoeTruckDashFlag",99)
goto Ready+2
Altfire2_R:
JOEB T 1 A_GiveInventory("JoeTruckThrustRD",1)
JOEB T 1 Offset(0,35)A_GiveInventory("JoeTruckThrustR",1)
JOEB T 1 Offset(0,38)A_GiveInventory("JoeTruckThrustRD",1)
JOEB T 1 Offset(0,41)A_GiveInventory("JoeTruckThrustR",1)
JOEB T 1 Offset(0,38)A_GiveInventory("JoeTruckThrustRD",1)
JOEB T 1 Offset(0,35)A_GiveInventory("JoeTruckThrustR",1)
JOEB T 0 A_Refire("Altfire2")
JOEB T 0 A_TakeInventory("JoeTruckDashFlag",99)
goto Ready+2

NoAmmo:
JOEB T 0
Goto Ready+2


Flash:
TNT1 A 0 A_SpawnItemEx("TruckJoeRamDamage",0,0,24,100,0,0,0,0)
TNT1 A 1 A_GiveInventory("JoeVehicleDuration_P",1)
TNT1 A 0 A_JumpIfInventory("JoeUpgradeAmmo",1,2)
TNT1 A 1 A_GiveInventory("Joe_KS_Normal_Pickup",1)
stop
TNT1 A 1 A_GiveInventory("JoeVehicleDuration_P",1)
TNT1 A 0 A_JumpIfInventory("JoeUpgradeAmmo",1,2)
TNT1 A 1 A_GiveInventory("Joe_KS_Normal_Pickup",1)
stop
TNT1 A 0 A_JumpIfInventory("PlayerPropertyRage",1,"Flash")
TNT1 A 1 A_GiveInventory("JoeVehicleDuration_P",1)
TNT1 A 0 A_JumpIfInventory("JoeUpgradeAmmo",1,"Flash")
TNT1 A 1 A_GiveInventory("Joe_KS_Normal_Pickup",1)
stop

}
}

actor TollBoothAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 3
+INVENTORY.IGNORESKILL
}

actor JoeTruckDashFlag : Inventory //Used for fire animation
{
inventory.amount 1
inventory.maxamount 8
}

actor TruckJoeRamDamage
{
PROJECTILE
Obituary "$OB_JOETRUCK"
damagetype "Joe_Truck"
+DONTBLAST
+THRUGHOST
+DONTREFLECT
ReactionTime 1
Damage (0)
Radius 10
Height 10
States
{
Spawn:
TNT1 A 0
TNT1 A 1 A_CountDown
goto Spawn+1
Death:
TNT1 A 1 A_Explode(30+CallACS("core_checkrune",RUNE_SPREAD,2)*60,48,0,0,32)
stop
}
}


actor TruckJoeRamDamageAim : TruckJoeRamDamage
{
Damage (20)
Speed 160
States
{
Death:
TNT1 A 1 A_Explode(20,32,0,0,32)
stop
}
}

actor TruckJoeRamDamageR : TruckJoeRamDamageAim
{
Obituary "$OB_JOETRUCKX"
Damage (40)
States
{
Death:
TNT1 A 1 A_Explode(80,48,0,0,48)
stop
}
}


actor TruckJoeHornDelay : Powerup
{
Powerup.Duration -2
}

actor JoeTruckThrust : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIf(z-floorz==0,"Ground")
TNT1 A 0 A_JumpIfInventory("PlayerPropertyRage",1,"PickupR")
TNT1 A 0 A_Recoil(-0.5)
goto End
PickupR:
TNT1 A 0 A_Recoil(-0.75)
goto End
Ground:
TNT1 A 0 A_JumpIfInventory("PlayerPropertyRage",1,"GroundR")
TNT1 A 0 A_Recoil(-2.0)
goto End
GroundR:
TNT1 A 0 A_Recoil(-2.5)
goto End
End:
TNT1 A 0 A_GiveInventory("JoeTruckDashFlag",1)
stop
}
}

actor JoeTruckThrustD : JoeTruckThrust
{
States
{
Pickup:
TNT1 A 0 A_FireCustomMissile("TruckJoeRamDamageAim",0,0,0,0)
goto Super::Pickup
}
}

actor JoeTruckThrustR : JoeTruckThrust
{
States
{
Pickup:
TNT1 A 0 A_JumpIf(z-floorz==0,"Ground")
TNT1 A 0 A_JumpIfInventory("PlayerPropertyRage",1,"PickupR")
TNT1 A 0 A_Recoil(0.55)
goto End
PickupR:
TNT1 A 0 A_Recoil(0.90)
goto End
Ground:
TNT1 A 0 A_JumpIfInventory("PlayerPropertyRage",1,"GroundR")
TNT1 A 0 A_Recoil(2.25)
goto End
GroundR:
TNT1 A 0 A_Recoil(3.0)
goto End
}
}

actor JoeTruckThrustRD : JoeTruckThrustR
{
States
{
Pickup:
TNT1 A 0 A_SpawnItemEx("TruckJoeRamDamageR",0,0,24,-150,0,0,0,0)
TNT1 A 0 A_JumpIfInventory("PlayerPropertySpread",1,"Pickup_S")
goto Super::Pickup
Pickup_S:
TNT1 A 0 A_SpawnItemEx("TruckJoeRamDamageR",0,0,24,-150,20,0,0,0)
TNT1 A 0 A_SpawnItemEx("TruckJoeRamDamageR",0,0,24,-150,-20,0,0,0)
goto Super::Pickup
}
}


/////////////////////////////////////////
//   ___                   _           //
//  / _ \                 | |          //
// / /_\ \_ __   __ _  ___| |__   ___  //
// |  _  | '_ \ / _` |/ __| '_ \ / _ \ //
// | | | | |_) | (_| | (__| | | |  __/ //
// \_| |_/ .__/ \__,_|\___|_| |_|\___| //
//       | |                           //
//       |_|                           //
/////////////////////////////////////////
actor SniperJoe_W4 : BaseMM8BDMWep_CBM
{
tag "$TAGC_0J5"
dropitem "FragBomberWep"
weapon.preferredskin "Apache-SniperJoe"
Obituary "$OB_JOEAPACHE"
Inventory.Pickupmessage "You found some helicopter keys!"
weapon.ammotype "JoeUpgradeAmmo"
weapon.ammotype2 "AttackHelicopterAmmo"
+WEAPON.NOAUTOAIM
States
{
Spawn:
C_00 J 1
loop

Deselect:
JOEB U 0
goto DeselectSwap
Select:
JOEB U 0
goto SelectSwap

Ready:
JOEB U 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_SNIPERJOE_APACHE,0,CBM_TCLR_DEFAULT)
JOEB U 0 A_GunFlash("Flash",1)
JOEB U 0
JOEB U 2 A_WeaponReady
wait

Fire:
JOEB W 2 A_GiveInventory("ApacheJoe_Fire_P")
JOEB WU 2
JOEB X 2 A_GiveInventory("ApacheJoe_Fire_P")
JOEB XU 2
goto Ready+3
Altfire:
JOEB V 0 A_GiveInventory("ApacheBomb_P",1)
JOEB V 0 A_Refire(1)
JOEB V 6
JOEB U 12
goto Ready+3
NoAmmo:
JOEB U 1
Goto Ready+3
Flash:
TNT1 A 1 A_GiveInventory("ApacheJoe_FlashState_P")
TNT1 A 0 A_JumpIfInventory("JoeUpgradeAmmo",1,"Flash")
TNT1 A 1 A_GiveInventory("Joe_KS_Normal_Pickup",1)
loop
}
}

actor AttackHelicopterAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 3
+INVENTORY.IGNORESKILL
}

actor ApacheJoe_Fire_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_PlaySoundEx("misc/devilfire","Weapon")
TNT1 A 0 A_FireCustomMissile("Apacheshot",random(-2,2),1,0,0,0,random(-2,2))
stop
}
}

actor ApacheJoe_FlashState_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_GiveInventory("JoeVehicleDuration_P",1)
TNT1 A 0 A_JumpIf(z-floorz>=320,"NoFlight")
TNT1 A 0 A_GiveInventory("CBM_AviationOn_P")
stop
NoFlight:
TNT1 A 0 A_GiveInventory("CBM_AviationOff_P")
stop
}
}

actor Apacheshot : ProjSpawnFuncActor
{
PROJECTILE
Obituary "$OB_JOEAPACHE"
damagetype "Joe_Apache"
+FORCEXYBILLBOARD
+BRIGHT
Damage (110)
radius 12
height 10
Speed 48
scale 3.0
States
{
Spawn:
TNT1 A 2
JOSH B 1
goto spawn+1
Death:
JOSH A 1
stop
}
}

actor ApacheBomb_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_GiveInventory("VivifyDelay4",1)
TNT1 A 0 A_PlaySound("weapon/JoeDrop",1,0.65)
TNT1 A 0 A_SpawnItemEx("ApacheBomb",0,0,8,momx*1.15,momy*1.15,-4,0,8)
TNT1 A 0 A_JumpIfInventory("PlayerPropertySpread",1,"PickupS")
stop
PickupS:
TNT1 A 0 A_SpawnItemEx("ApacheBombL",0,0,8,momx*1.15,momy*1.15,-4,0,8)
TNT1 A 0 A_SpawnItemEx("ApacheBombR",0,0,8,momx*1.15,momy*1.15,-4,0,8)
stop
}
}

actor ApacheBomb : ProjSpawnFuncActor
{
PROJECTILE
Obituary "$OB_JOEAPACHEB"
damagetype "Joe_Apache"
-NOGRAVITY
+THRUGHOST
+DONTREFLECT
gravity 2.0
Damage (0)
radius 12
height 16
Speed 0
scale 2.5
States
{
Spawn:
JOSH C 1
loop
Death:
TNT1 A 0 A_PlaySoundEx("weapon/napalm","Weapon")
TNT1 A 0 A_Explode(270,128,0,0,16)
TNT1 A 0 A_SpawnItemEx("BasicBoom5FX_4_210",0,0,0,0,0,0,0,1)
TNT1 A 2
stop
}
}

actor ApacheBombL : ApacheBomb
{
States
{
Spawn:
JOSH C 0
JOSH C 0 A_ChangeVelocity(0,-4,0,1)
JOSH C 1
wait
}
}
actor ApacheBombR : ApacheBomb
{
States
{
Spawn:
JOSH C 0
JOSH C 0 A_ChangeVelocity(0,4,0,1)
JOSH C 1
wait
}
}

actor SniperJoe_W_NormalBar : NormalBar {Args 138,130}
actor SniperJoe_W_SecondBar : SecondBar {Args 4,110}
actor SniperJoe_W_ScriptBar : ScriptBar {}
actor SniperJoe_W2_NormalBar : NormalBar {Args 138,130}
actor SniperJoe_W2_SecondBar : SecondBar {Args 4,94}
actor SniperJoe_W2_ScriptBar : ScriptBar {}
actor SniperJoe_W3_ScriptBar : ScriptBar {}
actor SniperJoe_W4_ScriptBar : ScriptBar {}
actor SniperJoe_W5_ScriptBar : ScriptBar {}
actor SniperJoe_W0_ScriptBar : ScriptBar {}