actor Fakeman_W : BaseMM8BDMWep_CBM
{
tag "$TAGC_9I"
dropitem "FakeRepeaterWep"
Weapon.AmmoUse2 1
Weapon.AmmoGive 40
Weapon.AmmoGive2 6
Obituary "$OB_FAKEBRUTAL"
Inventory.Pickupmessage "I am the law."
weapon.ammotype "CounterfeitTumbleAmmo"
weapon.ammotype2 "IAmTheLawAmmo"
+WEAPON.PRIMARY_USES_BOTH
//+WEAPON.NOAUTOFIRE
States
{
Spawn:
C_09 I 1
loop

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

Ready:
FAKR A 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_FAKEMAN)
FAKR A 0 A_GunFlash("Flash",1)
goto Ready1
Ready1:
FAKR A 0 A_Jumpifinventory("IAmTheLawAmmo",6,"Ready2")
FAKR A 1 A_WeaponReady
wait
Ready2:
FAKR A 1 A_WeaponReady(8)
wait

Fire:
FAKR E 0 A_JumpIfInventory("FakemanBatonFlag",3,"FireBaton3")
FAKR E 0 A_JumpIfInventory("FakemanBatonFlag",2,"FireBaton2")
FAKR E 0 A_JumpIfInventory("FakemanBatonFlag",1,"FireBatonStart")
FAKR E 0 A_JumpIfNoAmmo("NoAmmo")
FAKR E 0 A_JumpIfInventory("FOMBuffer",1,"FOMCheck")
FAKR E 0 A_JumpIfInventory("FOMBufferR",1,"FOMCheck")
Fire1:
FAKR E 0 A_GiveInventory("FakemanBatonDelay",1)
FAKR E 0 A_GiveInventory("FakemanFiring",1)
FAKR E 0 A_GiveInventory("Fakeman_Fire1_P")
FAKR E 1 A_Giveinventory("FOMBuffer_RC")
FAKR E 0 A_Refire("FireH1")
Goto FireEnd
FOMCheck:
FAKR E 0 A_JumpIfInventory("FakeDashShotBuff",1,"FOMCheckX")
Goto Fire2
FOMCheckX:
FAKR E 0 A_JumpIf(floorz-z>=0,"Fire2")
Goto Fire1
Fire2://fan the hammer shots
FAKR E 0 A_JumpIfNoAmmo("NoAmmo")
FAKR E 1
FAKR A 0 A_GiveInventory("FakemanBatonDelay",1)
FAKR A 0 A_GiveInventory("FakemanFiring",1)
FAKR A 0 A_GiveInventory("Fakeman_Fire2_P")
FAKR A 1 A_Giveinventory("FOMBuffer_RC")
FAKR B 0 A_Refire("FireH1")
Goto FireEnd
FireH1:
FAKR B 0 A_JumpIfInventory("PlayerPropertyRage",1,"FireH2")
FAKR B 1 A_RailWait
FAKR C 0 A_Refire("FireH2")
goto FireEnd+1
FireH2:
FAKR C 1 A_RailWait
FAKR D 0 A_Refire("FireH3")
goto FireEnd+2
FireH3:
FAKR D 0 A_JumpIfInventory("PlayerPropertyRage",1,"FireH4")
FAKR D 1 A_RailWait
FAKR A 0 A_Refire("FireH4")
goto Ready1
FireH4C:
FAKR A 0 A_JumpIf(floorz-z>=0,"Fire2")
Goto Fire1
FireH4:
FAKR A 0 A_JumpIfNoAmmo(2)
FAKR A 0 A_JumpIfInventory("FakeDashShotBuff",1,"FireH4C")
FAKR A 1 A_RailWait
FAKR A 0 A_Refire("FireH4")
goto Ready1
FireEnd:
FAKR BCD 1
goto Ready1

NoAmmo:
FAKR A 1 A_PlaySoundEx("weapon/fakeempty","Body")
Goto FireEmptyH1
FireEmptyH1:
FAKR A 1 A_RailWait
FAKR A 0 A_Refire("FireEmptyH1")
goto FireEmptyEnd
FireEmptyEnd:
FAKR A 0 A_JumpIfInventory("FakemanBatonDelay",1,2)
FAKR A 2 A_GiveInventory("FakemanBatonFlag",1)
goto Ready1
FAKR A 2
goto Ready1

FireBatonStart:
FAKR A 1 Offset(30,57)A_JumpIfInventory("PlayerPropertyRage",1,1)
FAKR A 1 Offset(60,82)A_GiveInventory("FakemanBatonFlag",1)
goto FireBaton2
FireBaton2:
FAKR F 0 A_PlaySoundEx("SoRage123/Punch","Weapon")

FAKR F 1 Offset(110,84)
FAKR F 1 Offset(96,75)A_JumpIfInventory("PlayerPropertyRage",1,1)
FAKR F 1 Offset(81,66)A_FireCustomMissile("FakeBatonSwing1",0,0,0,0)
FAKR F 1 Offset(65,57)A_JumpIfInventory("PlayerPropertyRage",1,1)
FAKR F 1 Offset(48,45)
FAKR F 1 Offset(30,33)A_JumpIfInventory("PlayerPropertyRage",1,1)
FAKR G 1 Offset(8,22)
FAKR G 1 Offset(-18,12)A_JumpIfInventory("PlayerPropertyRage",1,1)
FAKR G 1 Offset(-48,3)
FAKR G 1 Offset(-82,-5)A_JumpIfInventory("PlayerPropertyRage",1,1)
FAKR G 1 Offset(-120,-12)
FAKR G 1 Offset(-162,-18)A_JumpIfInventory("PlayerPropertyRage",1,1)
FAKR G 1 Offset(-208,-23)
FAKR G 1 Offset(-258,-27)A_JumpIfInventory("PlayerPropertyRage",1,1)
TNT1 A 6 A_GiveInventory("FakemanBatonFlag",1)
TNT1 A 0 A_ReFire("FireBaton3")
goto ReadyBaton
FireBaton3:
FAKR I 0 A_PlaySoundEx("SoRage123/Punch","Weapon")
FAKR I 1 Offset(-9,21)
FAKR I 1 Offset(1,31)A_JumpIfInventory("PlayerPropertyRage",1,1)
FAKR I 1 Offset(12,42)A_FireCustomMissile("FakeBatonSwing1",0,0,0,0)
FAKR I 1 Offset(24,53)A_JumpIfInventory("PlayerPropertyRage",1,1)
FAKR I 1 Offset(37,65)
FAKR I 1 Offset(51,77)A_JumpIfInventory("PlayerPropertyRage",1,1)
FAKR J 1 Offset(16,48)
FAKR J 1 Offset(30,65)A_JumpIfInventory("PlayerPropertyRage",1,1)
FAKR J 1 Offset(43,84)
FAKR J 1 Offset(55,105)A_JumpIfInventory("PlayerPropertyRage",1,1)
FAKR J 1 Offset(66,128)
FAKR J 1 Offset(76,153)A_JumpIfInventory("PlayerPropertyRage",1,1)
FAKR J 1 Offset(85,180)
FAKR J 1 Offset(93,209)A_JumpIfInventory("PlayerPropertyRage",1,1)
TNT1 A 6 A_TakeInventory("FakemanBatonFlag",1)
TNT1 A 0 A_ReFire("FireBaton2")
goto ReadyBaton

ReadyBaton:
TNT1 A 30 A_WeaponReady
FAKR A 0 A_TakeInventory("FakemanBatonFlag",9)
FAKR A 1 Offset(60,82)
FAKR A 1 Offset(30,57)A_JumpIfInventory("PlayerPropertyRage",1,1)
FAKR A 0 A_GiveInventory("FakemanBatonFlag",1)
goto Ready1

AltfireBatonEnd:
FAKR A 1 Offset(60,82)
FAKR A 1 Offset(30,57)A_JumpIfInventory("PlayerPropertyRage",1,1)
FAKR A 0 A_WeaponReady(14)
FAKR A 1 A_TakeInventory("FakemanBatonFlag",99)
goto Altfire+2

Altfire:
FAKR A 0 A_JumpIfInventory("FakemanBatonFlag",2,"AltfireBatonEnd")
FAKR A 2
FAKR A 1 Offset(0,42)A_TakeInventory("FakemanBatonFlag",99)
FAKR A 1 Offset(0,52)A_JumpIfInventory("PlayerPropertyRage",1,1)
FAKR A 1 Offset(0,62)
FAKR A 1 Offset(0,72)A_JumpIfInventory("PlayerPropertyRage",1,1)
FAKR A 2 Offset(0,82)//A_GiveInventory("FakemanReloadSlowdown",1)
FAKR A 3 Offset(0,82)A_PlaySoundEx("weapon/fakereloadshort","Body")
FAKR DCB 2
FAKR A 4
QLoad:
FAKR A 0 //A_GiveInventory("FakemanReloadSlowdown",1)
FAKR A 1 Offset(0,82)A_PlaySoundEx("weapon/fakereload3","Body")
FAKR BC 2 Offset(0,82)

FAKR D 0 A_SpawnItemEx("RevolverShotReloadFX_H",0,0,0,0,0,0,0,1)
FAKR D 2 Offset(0,82)A_Giveinventory("IAmTheLawAmmo",1)
FAKR A 2 Offset(0,82)
FAKR A 0 A_Jumpifinventory("IAmTheLawAmmo",6,1)
Goto QLoad
FAKR A 0
FAKR A 2 Offset(0,82)A_TakeInventory("FakemanReloadSlowdown",999)
FAKR A 1 Offset(0,72)A_JumpIfInventory("PlayerPropertyRage",1,1)
FAKR A 1 Offset(0,62)
FAKR A 1 Offset(0,52)A_JumpIfInventory("PlayerPropertyRage",1,1)
FAKR A 1 Offset(0,42)
FAKR A 0 A_WeaponReady(14)
//FAKR A 0 A_Giveinventory("IAmTheLawAmmo",6)
FAKR A 1 A_PlaySoundEx("weapon/fakereload4","Body")
Goto Ready1

Flash:
TNT1 A 3 A_GiveInventory("CounterfeitTumbleAmmo",2)
loop
}
}


actor CounterfeitTumbleAmmo : Ammo 
{
inventory.amount 1
inventory.maxamount 106
+INVENTORY.IGNORESKILL
}

actor IAmTheLawAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 6
+INVENTORY.IGNORESKILL
}

Actor FakeDashShotBuff : Powerup
{
Powerup.duration 28
}

actor FakemanFiring : Powerup
{
powerup.duration 7
}

actor FakemanReloadSlowdown : PowerSpeed
{
+POWERSPEED.NOTRAIL
powerup.duration -1
speed 0.58
}

Actor FOMBuffer : Powerup
{
Powerup.duration 8
}
Actor FOMBufferR : Powerup
{
Powerup.duration 4
}

actor FakemanBatonDelay : Powerup
{
powerup.duration 35
}
actor FakemanBatonFlag : Inventory
{
inventory.amount 1
inventory.maxamount 3
}

actor FakemanDashItem : BasicClassItem
{
inventory.icon "FAKBUM"
inventory.pickupmessage "I found you, faker!"
Tag "Perform Fake Dash"
states
{
Spawn:
FAKR Z 1
wait
UseCBM:
TNT1 A 0 A_JumpIfInventory("CounterfeitTumbleAmmo",106,"Activate")
fail
Activate:
TNT1 A 0 A_GiveInventory("FakemanDashItem_P",1)
fail
}
}


actor Fakeman_Fire1_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_FireCustomMissile("RevolverShot",0,0,8,0)
End:
TNT1 A 0 A_PlaySoundEx("weapon/fakeshot1","Weapon")
TNT1 A 0 A_TakeInventory("IAmTheLawAmmo",1,1)
stop
}
}
actor Fakeman_Fire2_P : Fakeman_Fire1_P
{
States
{
Pickup:
TNT1 A 0 A_FireCustomMissile("StrayShot",random(-3,3),0,8,0)
goto End
}
}

actor FakemanDashItem_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_SpawnItemEx("FakeDashFXGiver")
TNT1 A 0 A_PlaySoundEx("weapon/fakedash","SoundSlot7")
TNT1 A 0 A_GiveInventory("FakeDashShotBuff",1)
TNT1 A 0 A_TakeInventory("CounterfeitTumbleAmmo",53)
TNT1 A 0 A_TakeInventory("CounterfeitTumbleAmmo",53,1)
TNT1 A 0 A_JumpIfInventory("PlayerPropertyGrounded",1,"PickupF")
TNT1 A 0 A_JumpIf(momz<0,"PickupZ")
goto Pickup2
PickupZ:
TNT1 A 0 A_ChangeVelocity(-25,0,10,3)
stop
Pickup2:
TNT1 A 0 A_ChangeVelocity(-25,0,momz+10,3)
stop
PickupF:
TNT1 A 0 A_ChangeVelocity(-25,0,momz,3)
stop
}
}

actor FOMBuffer_RC : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("PlayerPropertyRage",1,2)
TNT1 A 0 A_GiveInventory("FOMBuffer",1)
stop
TNT1 A 0 A_GiveInventory("FOMBufferR",1)
stop
}
}

actor RevolverShot : ProjSpawnFuncActorFast
{
PROJECTILE
damagetype "FakeM_Shot"
Obituary "$OB_FAKEBRUTAL"
+FORCEXYBILLBOARD
+BRIGHT
Damage (160)
radius 10
height 7
Speed 90
scale 2.5
States
{
Spawn:
TNT1 A 0 
Q_0D B 1 A_SpawnItemEx("RevolverShotFX",0,0,0,0,0,0,0,1)
wait
Death:
Q_0D B 1
stop
}
}

actor RevolverShotFX : BasicGraphicEffect
{
renderstyle add
states
{
SpawnFrame:
TNT1 A 1
Q_0D B 1 A_FadeOut(0.25)
wait
}
}

actor StrayShot : RevolverShot
{
Damage (120)
speed 5
States
{
Spawn:
TNT1 A 0
TNT1 A 1 A_ScaleVelocity(13)
TNT1 A 0 A_ChangeVelocity(0,random(-6,6),random(-6,6),CVF_RELATIVE)
Q_0D B 1
wait
}
}

actor PowerFakeM_Baton : PowerSpeed
{
Powerup.Duration 35
Speed 0.0
+POWERSPEED.NOTRAIL
}

actor FakeBatonSwing1 : ProjSpawnFuncActorFast
{
Damagetype "FakeM_Baton"
Obituary "$OB_FAKEBATON"
+DONTSPLASH
+DONTBLAST
+DONTREFLECT
damage (100+CallACS("cbm_countinv_snatcher",2))
Radius 14
Height 14
speed 105
scale 2.5
States
{
Spawn:
TNT1 A 1
stop
Crash:
XDeath:
TNT1 A 0 A_Jump(256,1,2)
TNT1 A 1 A_PlaySound("weapon/fakewhack1",1,1.0)
goto Death+2
TNT1 A 1 A_PlaySound("weapon/fakewhack2",1,1.0)
goto Death+2
Death:
TNT1 A 0
TNT1 A 1 A_PlaySound("weapon/fakewhack3",1,1.0)
//QMFX ABC 2
QMFX DEFGH 2 bright
stop
}
}
//weapon/fakewhistle

actor RevolverShotReloadFX_H : BasicExplosion//BasicHelper
{
RenderStyle None
States
{
Spawn:
TNT1 A 0
TNT1 A 2 A_SpawnItemEx("RevolverShotReloadFX",0,4,28,frandom(0,3),0,frandom(3,7),random(0,23)*15,1)
stop
}
}

actor RevolverShotReloadFX : BasicGraphicEffectM
{
-NOGRAVITY
+THRUACTORS
+FLOORCLIP
+HEXENBOUNCE
BounceCount 5
BounceFactor 0.65
WallBounceFactor 0.8
Height 4
Radius 4
Speed 30
Scale 1.5
States
{
SpawnFrame:
TNT1 A 0
TNT1 A 0 A_Jump(256,1,2,3,4,5,6,7,8)
FAKR MNOPQRST 1
goto SpawnFrame+2
}
}


actor FakeDashFX : BasicGraphicEffect
{
renderstyle translucent
alpha 0.75
states
{
Spawn:
TNT1 A 0
TNT1 AA 1 A_JumpIf(CallACS("cbm_IsPointerClient",2)!=1, "Fade")
TNT1 A 1 
stop
Fade:
TNT1 A 0 A_JumpIfInTargetInventory("IsDead",1,"Death")
FAKM O 1 A_FadeOut(0.08)
loop
Death:
TNT1 A 0
stop
}
}

actor FakeDashFXInv : CustomInventory
{
states
{
Pickup:
TNT1 A 0 A_SpawnItemEx("FakeDashFX",0,0,0,0,0,0,0,1)
stop
}
}

actor FakeDashFXGiver : BasicHelper
{
reactiontime 9
states
{
Spawn:
TNT1 A 0 A_GiveToTarget("NoJumpCancel",1)
TNT1 A 0 A_CountDown
TNT1 A 2 A_GiveToTarget("FakeDashFXInv", 1)
loop
Death:
TNT1 A 0 A_TakeFromTarget("NoJumpCancel",9)
TNT1 A 1
stop
}
}


actor Fakeman_W_NormalBar : NormalBar {Args 4,198}//71,73
actor Fakeman_W_ScriptBar : ScriptBar {}