actor Needleman_W : BaseMM8BDMWep_CBM
{
tag "$TAGC_3A"
dropitem "NeedleCannonWep"
Weapon.AmmoUse 1
Weapon.AmmoGive 0
Obituary "$OB_NEEDLEHAMMER"
weapon.ammotype "NoodleAmmo"
+WEAPON.NOAUTOAIM
inventory.icon "NEEDSI"
States
{
Spawn:
C_03 A 1
loop

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

Ready:
NEDR A 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_NEEDLEMAN)
Goto Ready2
Ready2:
NEDR A 2 Offset(0,70)A_WeaponReady(1)
NEDR A 0 A_GiveInventory("NoodleAmmo",1)
loop

Fire:
NEDR A 0 A_JumpIfInventory("NeedleReved",1,"FireStart")
NEDR A 0 A_JumpIfInventory("IsBot",1,"BotFire")
RevUp:
NEDR A 0 A_GiveInventory("NeedleReved",1)
NEDR A 0 A_Refire(1)
NEDR A 0 A_GiveInventory("NeedleM_RevSnd_P")
NEDR A 1 Offset(0,68)
NEDR A 0
NEDR A 0 A_GiveInventory("NeedlemanRevvingSlow",1)

NEDR A 1 Offset(0,66)A_JumpIfInventory("PlayerPropertyRage",1,1)
NEDR A 1 Offset(0,64)
NEDR A 1 Offset(0,62)A_JumpIfInventory("PlayerPropertyRage",1,1)
NEDR A 1 Offset(0,60)
NEDR A 1 Offset(0,58)A_JumpIfInventory("PlayerPropertyRage",1,1)
NEDR A 1 Offset(0,56)
NEDR A 1 Offset(0,54)A_JumpIfInventory("PlayerPropertyRage",1,1)
NEDR A 1 Offset(0,52)
NEDR A 0 A_JumpIfInventory("PlayerPropertyRage",1,2)
NEDR A 1 Offset(0,50)A_GiveInventory("NoodleAmmo",2)
NEDR A 1 Offset(0,49)
NEDR A 1 Offset(0,48)A_JumpIfInventory("PlayerPropertyRage",1,1)
NEDR A 1 Offset(0,47)
NEDR A 1 Offset(0,46)A_JumpIfInventory("PlayerPropertyRage",1,1)
NEDR A 1 Offset(0,45)
NEDR A 1 Offset(0,44)A_JumpIfInventory("PlayerPropertyRage",1,1)
NEDR A 1 Offset(0,43)
NEDR A 1 Offset(0,42)A_JumpIfInventory("PlayerPropertyRage",1,1)
NEDR A 1 Offset(0,41)A_GiveInventory("NoodleAmmo",2)
NEDR A 1 Offset(0,40)A_JumpIfInventory("PlayerPropertyRage",1,1)
NEDR A 1 Offset(0,39)
NEDR A 1 Offset(0,38)A_JumpIfInventory("PlayerPropertyRage",1,1)
NEDR A 1 Offset(0,37)
NEDR A 1 Offset(0,36)A_JumpIfInventory("PlayerPropertyRage",1,1)
NEDR A 1 Offset(0,35)
NEDR A 1 Offset(0,34)A_JumpIfInventory("PlayerPropertyRage",1,1)
NEDR A 1 Offset(0,33)A_GunFlash("Flash",1)
NEDR A 0 A_GiveInventory("NoodleAmmo",2)
Reved:
NEDR A 10 A_WeaponReady(2)//WRF_NOSWITCH
goto UnRev

UnRev:
NEDR A 0 A_TakeInventory("NeedlemanRevvingSlow")
NEDR A 0 A_TakeInventory("NeedleReved",1)
NEDR A 0 A_JumpIfInventory("PlayerPropertyRage",1,2)
NEDR A 1 Offset(0,32)A_WeaponReady(3)
NEDR A 1 Offset(0,34)A_WeaponReady(3)
NEDR A 0 A_JumpIfInventory("PlayerPropertyRage",1,2)
NEDR A 1 Offset(0,36)A_WeaponReady(3)
NEDR A 1 Offset(0,38)A_WeaponReady(3)
NEDR A 0 A_JumpIfInventory("PlayerPropertyRage",1,2)
NEDR A 1 Offset(0,40)A_WeaponReady(3)
NEDR A 1 Offset(0,42)A_WeaponReady(3)
NEDR A 0 A_JumpIfInventory("PlayerPropertyRage",1,2)
NEDR A 1 Offset(0,44)A_WeaponReady(3)
NEDR A 1 Offset(0,46)A_WeaponReady(3)
NEDR A 0 A_JumpIfInventory("PlayerPropertyRage",1,2)
NEDR A 1 Offset(0,48)A_WeaponReady(3)
NEDR A 0 A_GiveInventory("NoodleAmmo",2)
NEDR A 1 Offset(0,50)A_WeaponReady(3)
NEDR A 0 A_JumpIfInventory("PlayerPropertyRage",1,2)
NEDR A 1 Offset(0,52)A_WeaponReady(3)
NEDR A 1 Offset(0,54)A_WeaponReady(3)
NEDR A 0 A_JumpIfInventory("PlayerPropertyRage",1,2)
NEDR A 1 Offset(0,56)A_WeaponReady(3)
NEDR A 1 Offset(0,58)A_WeaponReady(3)
NEDR A 0 A_JumpIfInventory("PlayerPropertyRage",1,2)
NEDR A 1 Offset(0,60)A_WeaponReady(3)
NEDR A 1 Offset(0,62)A_WeaponReady(3)
NEDR A 0 A_JumpIfInventory("PlayerPropertyRage",1,2)
NEDR A 1 Offset(0,64)A_WeaponReady(3)
NEDR A 1 Offset(0,66)A_WeaponReady(3)
NEDR A 0 A_GiveInventory("NoodleAmmo",2)
NEDR A 0 A_JumpIfInventory("PlayerPropertyRage",1,2)
NEDR A 1 Offset(0,68)A_WeaponReady(3)
NEDR A 1 Offset(0,70)A_WeaponReady(3)
goto Ready+1

FireStart:
NEDR D 0 A_GiveInventory("VivifyDelay10",1)
NEDR D 0 A_Refire(1)
NEDR D 0 A_WeaponReady(14)//Fix offsets
NEDR D 0 A_GunFlash("Flash",1)
NEDR D 0 A_JumpIfInventory("IsBot",1,"BotFireLoop")
NEDR D 0 A_JumpIfInventory("NeedleDuoFlag",1,"FireStart2")
NEDR D 1 A_GiveInventory("NeedlemanMain_P2",1)
NEDR E 2
NEDR G 0 A_Refire("FireLoop")
Goto FireEndD
FireStart2:
NEDR G 1 A_GiveInventory("NeedlemanMain_P1",1)
NEDR H 2
NEDR G 0 A_Refire("FireLoop2")
Goto FireEndG

FireLoop:
NEDR B 0 A_GunFlash("Flash",1)
NEDR B 1 A_GiveInventory("NeedlemanMain_P1",1)
NEDR H 2
NEDR G 0 A_Refire("FireLoop2")
Goto FireEndG
FireLoop2:
NEDR B 0 A_GunFlash("Flash",1)
NEDR B 1 A_GiveInventory("NeedlemanMain_P2",1)
NEDR E 2
NEDR D 0 A_Refire("FireLoop")
Goto FireEndD

FireEndD:
NEDR D 0 A_GiveInventory("NeedleDuoFlag",1)
NEDR D 0 A_TakeInventory("VivifyDelay10")
NEDR D 1 A_GunFlash("Flash",1)
Goto Reved
FireEndG:
NEDR G 0 A_TakeInventory("NeedleDuoFlag",1)
NEDR G 0 A_TakeInventory("VivifyDelay10")
NEDR G 1 A_GunFlash("Flash",1)
Goto Reved


Altfire:
NEDR A 0 A_JumpIfInventory("NeedleReved",1,"Reved")
Goto RevUp

Flash.NeedleHammer:
NEDR NOPONQR 2 A_RailWait
stop

Flash:
TNT1 A 1
TNT1 A 0 A_JumpIfInventory("NeedleReved",1,1)
stop
TNT1 A 1 A_PlaySoundEx("Class/NeedleRevved","Body")
TNT1 A 0 A_JumpIfInventory("NeedleReved",1,1)
stop
TNT1 A 1 A_JumpIfInventory("PlayerPropertyRage",1,2)
TNT1 A 0 A_JumpIfInventory("NeedleReved",1,1)
stop
TNT1 A 1
TNT1 A 0 A_JumpIfInventory("NeedleReved",1,1)
stop
TNT1 A 1 A_PlaySoundEx("Class/NeedleRevved","Body")
TNT1 A 0 A_JumpIfInventory("NeedleReved",1,1)
stop
TNT1 A 1 A_JumpIfInventory("PlayerPropertyRage",1,2)
TNT1 A 0 A_JumpIfInventory("NeedleReved",1,1)
stop
TNT1 A 1
TNT1 A 0 A_JumpIfInventory("NeedleReved",1,1)
stop
TNT1 A 1 A_PlaySoundEx("Class/NeedleRevved","Body")
TNT1 A 0 A_JumpIfInventory("NeedleReved",1,1)
stop
TNT1 A 1 A_JumpIfInventory("PlayerPropertyRage",1,2)
TNT1 A 0 A_JumpIfInventory("NeedleReved",1,1)
stop
TNT1 A 0 A_GiveInventory("NoodleAmmo",2)
goto Flash

BotFire:
NEDR A 0 A_FaceTarget
NEDR A 0 A_JumpIfCloser(150,"BotAltfire")
goto RevUp

BotFireLoop:
NEDR A 0 A_JumpIfCloser(150,"BotFire1")
NEDR B 0 A_GunFlash("Flash",1)
NEDR B 1 A_GiveInventory("NeedlemanMain_P1",1)
NEDR H 2
NEDR G 0 A_Refire("BotFireLoop2")
Goto FireEndG
BotFireLoop2:
NEDR A 0 A_JumpIfNoAmmo("BotFire2")
NEDR B 0 A_GunFlash("Flash",1)
NEDR B 1 A_GiveInventory("NeedlemanMain_P2",1)
NEDR E 2
NEDR D 0 A_Refire("BotFireLoop")
Goto FireEndD

BotFire1:
NEDR A 0 A_FaceTarget
NEDR A 0 A_Jump(32,"BotUnRev")
goto BotFireLoop+1
BotFire2:
NEDR A 0 A_Jump(16,"BotUnRev2")
goto BotFireLoop2+1

BotUnRev2:
NEDR A 0 A_GiveInventory("BotRetreatFlag",1)
BotUnRev:
NEDR A 0 A_TakeInventory("NeedlemanRevvingSlow")
NEDR A 0 A_TakeInventory("NeedleReved",1)
NEDR A 10 Offset(0,52)
NEDR A 10 Offset(0,70)A_GiveInventory("NoodleAmmo",7)
NEDR A 0 A_FaceTarget
NEDR A 0 A_JumpIfCloser(150,"BotAltfire")
NEDR AAAAAAA 2 A_JumpIfCloser(150,"BotAltfire")
NEDR A 0 A_GiveInventory("NoodleAmmo",random(7,14))
NEDR AAAAAAA 2 A_JumpIfCloser(150,"BotAltfire")
NEDR A 0 A_GiveInventory("NoodleAmmo",random(7,14))
NEDR AAAAAAA 2 A_JumpIfCloser(150,"BotAltfire")
NEDR A 0 A_GiveInventory("NoodleAmmo",random(7,14))
NEDR A 0 A_TakeInventory("BotRetreatFlag",1)
goto Ready2
Fire2Old:
NEDR H 2 A_GiveInventory("NeedlemanMain_P1",1)
NEDR B 1
NEDR D 2 A_GiveInventory("NeedlemanMain_P2",1)
NEDR B 1
Goto Ready2

BotAltfire:
NEDR J 0 A_TakeInventory("BotRetreatFlag",1)
NEDR J 0 A_TakeInventory("VivifyDelay10",1)
NEDR J 0 A_TakeInventory("NeedleReved",1)
NEDR J 0 A_GiveInventory("VivifyDelay6",1)
NEDR J 0 A_Refire(1)
NEDR J 0 A_GiveInventory("PowerNeedlePokeSlow",1)
NEDR J 0 A_GunFlash("Flash.NeedleHammer",1)
NEDR J 0 A_PlaySoundEx("weapon/needleWham","Weapon")
NEDR J 0 A_FireCustomMissile("NeedlePokerStab",0,0,0,0)
NEDR JKLKJ 2
NEDR AA 10 A_GiveInventory("NoodleAmmo",2)
NEDR A 5 A_GiveInventory("NoodleAmmo",2)
Goto Ready2
}
}

actor Needleman_W2 : BaseMM8BDMWep_CBM
{
tag "$TAGC_3A2"
dropitem "NeedleCannonWep"
Weapon.AmmoUse 1
Weapon.AmmoGive 0
Obituary "$OB_NEEDLEHAMMER"
weapon.ammotype "NoodleAmmo"
inventory.icon "NeedIcon"
States
{
Spawn:
C_03 A 1
loop

Deselect:
NEDR J 0
goto DeselectSwap
Select:
NEDR J 0
goto SelectSwap

Ready:
NEDR J 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_NEEDLEMAN)
goto Ready2
Ready2:
NEDR J 2 A_WeaponReady
NEDR J 0 A_GiveInventory("NoodleAmmo",1)
loop

Fire:
Altfire:
NEDR J 0 A_GiveInventory("VivifyDelay6",1)
NEDR J 0 A_Refire(1)
NEDR J 0 A_GiveInventory("PowerNeedlePokeSlow",1)
NEDR J 0 A_GunFlash("Flash.NeedleHammer",1)
NEDR J 0 A_PlaySoundEx("weapon/needleWham","Weapon")//weapon/chargekick
NEDR J 0 A_FireCustomMissile("NeedlePokerStab",0,0,0,0)
NEDR JKLKJ 2
NEDR JJ 10 A_GiveInventory("NoodleAmmo",1)
NEDR J 5 A_GiveInventory("NoodleAmmo",1)
Goto Ready2

Flash.NeedleHammer:
NEDR NOPONQR 2 A_RailWait
stop

}
}

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

actor NeedlemanRevvingSlow : PowerSpeed
{
Powerup.Duration 0x7FFFFFFC
Speed 0.5
+POWERSPEED.NOTRAIL
+INVENTORY.ALWAYSPICKUP
}

actor PowerNeedlePokeSlow : PowerSpeed
{
powerup.duration 30
Speed 0.7
+POWERSPEED.NOTRAIL
}

actor NeedleDuoFlag : OnceC{}

actor NeedleReved : OnceC{}

actor NeedleFireDelay1 : Powerup
{
+ADDITIVETIME
Powerup.Duration 4
}
actor NeedleFireDelay2 : NeedleFireDelay1{}


actor NeedleM_RevSnd_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("PlayerPropertyRage",1,2)
TNT1 A 0 A_PlaySoundEx("class/NeedleRevup","SoundSlot7")
stop
TNT1 A 0 A_PlaySoundEx("class/NeedleRevupQ","SoundSlot7")
stop
}
}

actor NeedlemanMain_P1 : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_TakeInventory("NeedleDuoFlag",1)
TNT1 A 0 A_GiveInventory("VivifyDelay10",1)
TNT1 A 0 A_JumpIfInventory("NoodleAmmo",1,"Pickup1")
TNT1 A 0 A_PlaySound("weapon/mbuster",1,0.75)
TNT1 A 0 A_FireCustomMissile("NeedleM_CannonShot2",frandom(-1,5),1,-8,0,0,frandom(-3,3))
stop
Pickup1:
TNT1 A 0 A_PlaySoundEx("weapon/needleDakka","Weapon")
TNT1 A 0 A_JumpIfInventory("NeedleFireDelay1",1,"Pickup2")
TNT1 A 0 A_FireCustomMissile("NeedleM_CannonShot",0,1,-8,0,0,0)
TNT1 A 0 A_Jump(256,"P_4","P_5","P_6","P_7","P_8")
goto P_5
P_4:
TNT1 AAAA 0 A_GiveInventory("NeedleFireDelay1",1)
stop
P_5:
TNT1 AAAAA 0 A_GiveInventory("NeedleFireDelay1",1)
stop
P_6:
TNT1 AAAAAA 0 A_GiveInventory("NeedleFireDelay1",1)
stop
P_7:
TNT1 AAAAAAA 0 A_GiveInventory("NeedleFireDelay1",1)
stop
P_8:
TNT1 AAAAAAAA 0 A_GiveInventory("NeedleFireDelay1",1)
stop
Pickup2:
TNT1 A 0 A_FireCustomMissile("NeedleM_CannonShot",frandom(-1,5),1,-8,0,0,frandom(-3,3))//4
stop
}
}

actor NeedlemanMain_P2 : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_GiveInventory("NeedleDuoFlag",1)
TNT1 A 0 A_GiveInventory("VivifyDelay10",1)
TNT1 A 0 A_JumpIfInventory("NoodleAmmo",1,"Pickup1")
TNT1 A 0 A_PlaySound("weapon/mbuster",1,0.75)
TNT1 A 0 A_FireCustomMissile("NeedleM_CannonShot2",frandom(-5,1),1,8,0,0,frandom(-3,3))
stop
Pickup1:
TNT1 A 0 A_PlaySoundEx("weapon/needleDakka","Weapon")
TNT1 A 0 A_JumpIfInventory("NeedleFireDelay2",1,"Pickup2")
TNT1 A 0 A_FireCustomMissile("NeedleM_CannonShot",0,1,8,0,0,0)
TNT1 A 0 A_Jump(256,"P_4","P_5","P_6","P_7","P_8")
goto P_5
P_4:
TNT1 AAAA 0 A_GiveInventory("NeedleFireDelay2",1)
stop
P_5:
TNT1 AAAAA 0 A_GiveInventory("NeedleFireDelay2",1)
stop
P_6:
TNT1 AAAAAA 0 A_GiveInventory("NeedleFireDelay2",1)
stop
P_7:
TNT1 AAAAAAA 0 A_GiveInventory("NeedleFireDelay2",1)
stop
P_8:
TNT1 AAAAAAAA 0 A_GiveInventory("NeedleFireDelay2",1)
stop
Pickup2:
TNT1 A 0 A_FireCustomMissile("NeedleM_CannonShot",frandom(-5,1),1,8,0,0,frandom(-3,3))
stop
}
}

actor NeedleM_CannonShot : ProjSpawnFuncActor
{
PROJECTILE
Damagetype "NeedleM_Shot"
Obituary "$OB_NEEDLECANNON"
damage (80)//100
Radius 9
Height 7
speed 60
scale 2.5
States
{
Spawn:
NEDR T 1
loop
Death:
NEDR UVU 2
stop
}
}

actor NeedleM_CannonShot2 : NeedleM_CannonShot
{
-NOGRAVITY
Gravity 1.5
speed 30
States
{
Spawn:
NEDR T 0
NEDR T 0 A_ChangeVelocity(0,0,1)
NEDR T 1
wait
Death:
TNT1 A 1
stop
}
}

actor NeedlePokerStab : ProjSpawnFuncActorFast
{
PROJECTILE
Damagetype "NeedleM_Stab"
Obituary "$OB_NEEDLEHAMMER"
+EXPLODEONWATER
ReactionTime 1
damage (450)//600
Radius 14
Height 14
speed 140//120
scale 2.25
States
{
Spawn:
TNT1 A 1
TNT1 A 1 A_CountDown
wait
Death:
TNT1 A 1 A_Stop
NEDR UVWXXWVU 1
stop
}
}



actor Needleman_W_NormalBar : NormalBar {Args 4,220}
actor Needleman_W2_NormalBar : NormalBar {Args 4,220}