actor DarkMan3_W : BaseMM8BDMWep_CBM
{
tag "$TAGC_5K"
dropitem "DarkShieldWep"
Weapon.AmmoUse 16
Weapon.AmmoUse2 28
Weapon.AmmoGive 64
Obituary "$OB_DARK3SNIPE"
Inventory.Pickupmessage "maybe"
weapon.ammotype1 "Darkman3SniperAmmo"
weapon.ammotype2 "Darkman3RingAmmo"
+WEAPON.NOAUTOAIM
States
{
Spawn:
C_05 K 1
loop

Deselect:
DKC3 A 0 A_GunFlash("NoFlash",1)
DKC3 A 0 A_ZoomFactor(1.0,1)
DKC3 A 0 A_GiveInventory("DarkSniperFlashReset_P")
goto DeselectSwap
Select:
DKC3 A 0
goto SelectSwap

Ready:
DKC3 A 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_DARKMAN3)
DKC3 A 0 A_GunFlash("Flash",1)
goto Ready0
Ready0:
DKC3 A 0 A_GiveInventory("DarkSniperCharge_F",1)
Ready1:
DKC3 A 0 A_JumpIfInventory("Darkman3SniperAmmo",16,"Ready2")
DKC3 A 0 A_JumpIfInventory("Darkman3RingAmmo",28,"Ready3")
DKC3 A 0 A_JumpIfInventory("DarkSniperFlag",1,2)
DKC3 A 0 A_WeaponReady(8)
DKC3 A 2 A_WeaponReady(12)
DKC3 A 0 A_JumpIfInventory("DarkSniperFlag",1,2)
DKC3 A 0 A_WeaponReady(8)
DKC3 A 2 A_WeaponReady(12)
DKC3 A 0 A_JumpIfInventory("DarkSniperFlag",1,2)
DKC3 AA 0 A_GiveInventory("Darkman3SniperAmmo",1)
DKC3 A 0 A_JumpIfInventory("DarkSniperFlag",1,2)
DKC3 AA 0 A_GiveInventory("Darkman3RingAmmo",1)
loop
Ready2:
DKC3 A 0 A_JumpIfInventory("Darkman3RingAmmo",28,"Ready4")
DKC3 A 4 A_WeaponReady(8)
DKC3 A 0 A_JumpIfInventory("DarkSniperFlag",1,2)
DKC3 AA 0 A_GiveInventory("Darkman3SniperAmmo",1)
DKC3 A 0 A_JumpIfInventory("DarkSniperFlag",1,2)
DKC3 AA 0 A_GiveInventory("Darkman3RingAmmo",1)
loop
Ready3:
DKC3 A 0 A_JumpIfInventory("Darkman3SniperAmmo",16,"Ready4")
DKC3 A 0 A_JumpIfInventory("DarkSniperFlag",1,2)
DKC3 A 0 A_WeaponReady
DKC3 A 2 A_WeaponReady(4)
DKC3 A 0 A_JumpIfInventory("DarkSniperFlag",1,2)
DKC3 A 0 A_WeaponReady
DKC3 A 2 A_WeaponReady(4)
DKC3 A 0 A_JumpIfInventory("DarkSniperFlag",1,2)
DKC3 AA 0 A_GiveInventory("Darkman3SniperAmmo",1)
DKC3 A 0 A_JumpIfInventory("DarkSniperFlag",1,2)
DKC3 AA 0 A_GiveInventory("Darkman3RingAmmo",1)
loop
Ready4:
DKC3 A 4 A_WeaponReady
DKC3 A 0 A_JumpIfInventory("DarkSniperFlag",1,2)
DKC3 AA 0 A_GiveInventory("Darkman3SniperAmmo",1)
DKC3 A 0 A_JumpIfInventory("DarkSniperFlag",1,2)
DKC3 AA 0 A_GiveInventory("Darkman3RingAmmo",1)
loop

Fire:
DKC3 B 0 A_TakeInventory("DarkSniperCharge_F",1)
DKC3 B 0 A_JumpIfInventory("DarkSniperFlag",1,"Fire1")
DKC3 B 0 A_GiveInventory("VivifyDelay8",1)
DKC3 B 0 A_ReFire(1)
DKC3 B 2 A_GiveInventory("Darkman3_Fire0_P")
DKC3 C 2
DKC3 B 2 A_GiveInventory("Darkman3_Fire1_P")
DKC3 C 2
DKC3 B 2 A_GiveInventory("Darkman3_Fire1_P")
DKC3 C 2
DKC3 B 2 A_GiveInventory("Darkman3_Fire1_P")
DKC3 C 2
DKC3 B 2
DKC3 A 14
DKC3 A 0 A_ReFire("Fire")
goto Ready0

Fire1:
DKC3 C 12 A_GiveInventory("Darkman3_Fire2_P")
DKC3 B 2
DKC3 A 10
goto Ready0

AltFire:
DKC3 E 0 A_GiveInventory("VivifyDelay6",1)
DKC3 E 0 A_TakeInventory("DarkSniperCharge_F",1)
DKC3 E 0 A_ReFire(1)
DKC3 E 4 A_GiveInventory("Darkman3_Alt_P")
DKC3 E 12
DKC3 D 4
DKC3 A 4
goto Ready0

FireOld:
DKC3 B 0 A_PlaySoundEx("weapon/dark3shot","Weapon")
DKC3 B 0 A_FireCustomMissile("Darkman3SnipeShot",0,1,0,0)
DKC3 B 2
DKC3 C 2
DKC3 B 2
DKC3 A 13
goto Ready1

AltfireOld:
DKC3 A 6
DKC3 E 0 A_PlaySoundEx("weapon/sparkalt","Weapon")
DKC3 E 0 A_FireCustomMissile("Dark3_ShockRing",0,0,8,0)
DKC3 E 0 A_FireCustomMissile("Dark3_ShockRing",15,0,8,0)
DKC3 E 0 A_FireCustomMissile("Dark3_ShockRing",-15,0,8,0)
DKC3 E 0 A_GiveInventory("Darkman3SniperAmmo",1)
DKC3 E 8 A_SetTics(Health*3/CallACS("core_getmaxhealth")+5)
DKC3 D 0 A_GiveInventory("Darkman3SniperAmmo",1)
DKC3 D 14 A_SetTics(Health*8/CallACS("core_getmaxhealth")+6)
goto Ready1

Flash:
TNT1 A 0
TNT1 A 0 A_JumpIfInventory("DarkSniperFlag",1,2)
TNT1 A 1
loop
TNT1 A 0 A_GiveInventory("Darkman3SnipingSlow",1)
TNT1 A 0 A_GiveInventory("CBM_Ratio5_6JumpPowerGiver",1)
TNT1 A 1 A_ZoomFactor(2.0,1)
TNT1 A 0
TNT1 A 1 A_GiveInventory("DarkSniperFlash_P",1)
TNT1 A 0 A_JumpIfInventory("DarkSniperFlag",1,1)
goto Flash+10
TNT1 A 0
goto Flash+6
TNT1 A 0 A_GiveInventory("DarkSniperFlashReset_P")
TNT1 A 1 A_ZoomFactor(1.0,1)
loop
}
}

actor Darkman3SniperAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 64
+INVENTORY.IGNORESKILL
}

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

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

actor DarkSniperCharge : Inventory
{
inventory.amount 1
inventory.maxamount 700
}

actor DarkSniperFlag : Inventory {}
actor DarkSniperCharge_F : Inventory {}

actor DarkSniperItem : BasicClassItem
{
inventory.icon "DarkIco3"
inventory.pickupmessage "What nine thousand?!"
Tag "Dark Sniping Toggle"
states
{
Spawn:
DKC3 Z 1
loop
UseCBM:
TNT1 A 0 A_PlaySoundEx("item/ItemUseMM9","SoundSlot7")
TNT1 A 0 A_JumpIfInventory("DarkSniperFlag",1,"Use2")
TNT1 A 0 A_GiveInventory("DarkSniperFlag",1)
fail
Use2:
TNT1 A 0 A_TakeInventory("DarkSniperFlag",1)
TNT1 A 0 A_TakeInventory("DarkSniperCharge")
fail
}
}

actor Darkman3_Fire0_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_FireCustomMissile("Darkman3SMG",0,0,8,0)
End:
TNT1 A 0 A_PlaySoundEx("weapon/enemyweapon","Weapon")
stop
}
}
actor Darkman3_Fire1_P : Darkman3_Fire0_P
{
States
{
Pickup:
TNT1 A 0 A_FireCustomMissile("Darkman3SMG",frandom(-2,2),0,8,0,0,frandom(-2,2))
goto End
}
}

actor Darkman3_Fire2_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("DarkSniperCharge",700,"Fire2")
TNT1 A 0 A_PlaySoundEx("weapon/Dark3Shot","Weapon")
TNT1 A 0 A_FireCustomMissile("Darkman3SnipeShot",0,1,0,0)
goto PickEnd
Fire2:
TNT1 A 0 A_PlaySoundEx("weapon/Dark3Rail","Weapon")
TNT1 A 0 A_FireCustomMissile("Darkman3SniperShot",0,1,0,0)
goto PickEnd
PickEnd:
TNT1 A 0 A_TakeInventory("DarkSniperCharge")
stop
}
}

actor Darkman3_Alt_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_TakeInventory("Darkman3RingAmmo",8)
TNT1 A 0 A_TakeInventory("Darkman3RingAmmo",20,1)
TNT1 A 0 A_PlaySoundEx("weapon/sparkalt","Weapon")
TNT1 A 0 A_JumpIfInventory("DarkSniperFlag",1,"AltfireZoom")
TNT1 A 0 A_FireCustomMissile("Dark3_ShockRing",0,0,8,0)
TNT1 A 0 A_FireCustomMissile("Dark3_ShockRing",15,0,8,0)
TNT1 A 0 A_FireCustomMissile("Dark3_ShockRing",-15,0,8,0)
stop
AltfireZoom:
TNT1 A 0 A_FireCustomMissile("Dark3_ShockRinger",0,0,0,0)
stop
}
}



actor DarkSniperFlashReset_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_TakeInventory("DarkSniperCharge")
TNT1 A 0 A_TakeInventory("Darkman3SnipingSlow")
TNT1 A 0 A_TakeInventory("CBM_Ratio5_6JumpPower")
stop
}
}

actor DarkSniperFlash_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("DarkSniperCharge_F",1,1)
stop
TNT1 A 0 A_JumpIfInventory("Darkman3SniperAmmo",16,1)
stop
TNT1 A 0 A_GiveInventory("DarkSniperCharge",(10+(100-health*100.0/CallACS("core_getmaxhealth"))/10)*(CallACS("core_checkrune",RUNE_RAGE)+1))
TNT1 A 0
TNT1 A 0 A_JumpIfInventory("DarkSniperCharge",701,2)
TNT1 A 0 A_JumpIfInventory("DarkSniperCharge",700,2)
TNT1 A 0
stop
TNT1 A 0 A_TakeInventory("DarkSniperCharge",-50)
TNT1 A 0 A_PlaySound("weapon/BassCombine",4,0.5)
stop
}
}

actor DarkSniperFlash_P2 : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_StopSound(-6)
stop
}
}

actor Darkman3SMG : ProjSpawnFuncActor
{
var int user_TranslateWhiteColors;
PROJECTILE
damagetype "DM3_Rapid"
Obituary "$OB_DARK3SMG"
+FORCEXYBILLBOARD
+BRIGHT
Damage (60)
radius 8
height 8
speed 45
scale 2.0
States
{
Spawn:
DSHO A 1
wait
}
}

actor Darkman3SnipeShot : ProjSpawnFuncActorFast
{
var int user_TranslateWhiteColors;
damagetype "DM3_Shot"
Obituary "$OB_DARK3SNIPE"
+FORCEXYBILLBOARD
+BRIGHT
Damage(250)
radius 14//11
height 14
speed 180
scale 2.75
States
{
Spawn:
DSHO A 0
DSHO A 1 A_SpawnItemEx("Darkman3ShotFX1",0,0,0,0,0,0,0,1)
wait
}
}

actor PainDM3_SnipeHit : Basic_PainFling_H{Args 11,8,2}
actor DeathDM3_SnipeHit : Basic_DeathFling_H{Args 19,32,0}

actor Darkman3SniperShot : Darkman3SnipeShot
{
var int user_P;
Obituary "$OB_DARK3SNIPER"
damagetype "DM3_Snipe"
Damage (400+user_P)
States
{
Spawn:
DSHO A 0
DSHO A 0 A_SpawnItemEx("Darkman3ShotFX2",0,0,0,0,0,0,0,1)
DSHO A 0 A_SpawnItemEx("Darkman3ShotFX1",0,0,0,0,cos(pitch+30)*2.5,-sin(pitch+30)*2.5,0,1)
DSHO A 0 A_SpawnItemEx("Darkman3ShotFX1",0,0,0,0,cos(pitch+150)*2.5,-sin(pitch+150)*2.5,0,1)
DSHO A 1 A_SpawnItemEx("Darkman3ShotFX1",0,0,0,0,cos(pitch+270)*2.5,-sin(pitch+270)*2.5,0,1)
DSHO A 0 A_SetUserVar("user_P",user_P+5)
DSHO A 0 A_SetPitch(pitch%360+30)
loop
}
}

actor Darkman3ShotFX1 : BasicGraphicEffect
{
var int user_TranslateWhiteColors;
+FORCEXYBILLBOARD
+BRIGHT
Alpha 0.9
ReactionTime 7
States
{
SpawnFrame:
DSHO A 1 A_CountDown
DSHO A 0 A_FadeOut
DSHO A 0 A_SetScale(scaleX-0.2)
loop
}
}
actor Darkman3ShotFX2 : Darkman3ShotFX1
{
Alpha 1.0
ReactionTime 8
}

actor Dark3_ShockRing : ProjSpawnFuncActor
{
PROJECTILE
damagetype "NeutralShock"
Obituary "$OB_DARK3RING"
+FORCEXYBILLBOARD
+BRIGHT
damage (60)
radius 13
height 18
speed 40
scale 2.5
States
{
Spawn:
//DSHO BCBCBC 4
DSHO CCCCCCCC 2 A_SpawnItemEx("DarkRingFX",0,0,0,0,0,0,0,1)
stop
Death:
TNT1 A 0 A_SpawnItemEX("ElectrifyEffect")
stop
}
}

actor Dark3_ShockRinger : Dark3_ShockRing
{
Obituary "$OB_DARK3RINGER"
damage (90)
speed 180
States
{
Spawn:
DSHO C 0
DSHO C 1 A_SpawnItemEx("DarkRingFX",0,0,0,0,0,0,0,1)
wait
}
}

actor DarkRingFX : BasicGraphicEffect
{
+FORCEXYBILLBOARD
+BRIGHT
Alpha 0.6
States
{
SpawnFrame:
DSHO C 3
DSHO C 1 A_FadeOut(0.15)
wait
}
}


actor DarkMan3_W_NormalBar : NormalBar {Args 64,62}//65,60
actor DarkMan3_W_SecondBar : SecondBar {Args 4,216}
actor DarkMan3_W_ScriptBar : ScriptBar {}