actor DuoFistSpecial : DuoFist
{
Weapon.SlotNumber 2
Weapon.SlotPriority 0
weapon.ammotype2 "DuoChargeAmmo"
inventory.icon "DUOICON1"
States
{
Fire:
DUOF C 0 A_JumpIfNoAmmo("Hold")
DUOF C 0 A_PlaySoundEx("weapon/mbuster","Weapon")
DUOF C 0 A_FireCustomMissile("DuoPunchSH",0,0,8,0)
DUOF C 0 A_TakeInventory("WeaponCharge",999)
DUOF C 0 A_TakeInventory("DuoChargeAmmo",999)
DUOF G 1 A_TakeInventory("FistFlag",1)
Goto FistWait
Altfire:
DUOF C 0 A_JumpIfNoAmmo("Hold")
DUOF C 0 A_PlaySoundEx("weapon/mbuster","Weapon")
DUOF C 0 A_FireCustomMissile("DuoPunchSH",0,0,8,0)
DUOF C 0 A_TakeInventory("WeaponCharge",999)
DUOF G 1 A_TakeInventory("FistFlag",1)
Goto FistWait
FistWait:
DUOF G 1
DUOF G 0 A_GiveInventory("AdapterWaitCount",1)
DUOF G 0 A_JumpIfInventory("AdapterWaitCount",20,"FistFinish")
DUOF G 0 A_JumpIfInventory("FistFlag",1,"FistFinish")
loop
FistFinish:
DUOF G 0 A_PlayWeaponSound("weapon/adapterreturn")
DUOF G 0 A_TakeInventory("FistFlag",1)
DUOF G 0 A_JumpIfInventory("AdapterWaitCount", 8, 2) //Adds a slight delay if fired at very close range
DUOF DDDD 1 
DUOF G 0 A_TakeInventory("AdapterWaitCount",999)
DUOF DDDD 1
DUOF CCCC 1 A_Refire 
DUOF B 0 A_Refire
Goto Ready2+2
Fire2:
DUOF B 0 A_TakeInventory("DuoChargeAmmo",999)
DUOF B 0 A_TakeInventory("WeaponCharge",999)
DUOF CD 1
DUOF C 0 ACS_ExecuteAlways(991,0,101)
DUOF B 0 A_PlaySoundEx("weapon/minchrgshot","Weapon")
DUOF B 0 A_FireCustomMissile("MidFistSH",0,0,8,0)
DUOF G 20
DUOF DC 4
DUOF B 0 A_Refire
goto Ready2+2
Fire3:
DUOF B 0 A_TakeInventory("DuoChargeAmmo",999)
DUOF B 0 A_TakeInventory("WeaponCharge",999)
DUOF B 0
DUOF B 0 ACS_ExecuteAlways(991,0,101)
DUOF B 0 A_PlaySoundEx("weapon/cfire","Weapon")
DUOF B 0 A_FireCustomMissile("GigaFistSH",0,0,8,0)
DUOF EF 1 
DUOF G 22
DUOF DC 4
DUOF B 0 A_Refire
goto Ready2+2
Hold:
DUOF B 0 A_JumpIfInventory("DuoChargeAmmo",170,"Charge2")
DUOF B 0 A_JumpIfInventory("WeaponCharge",18,"Charge")
DUOF B 1 A_GiveInventory("WeaponCharge",1)
DUOF B 0 A_Refire
Goto Ready2+2
Charge:
DUOF B 0 A_JumpIfInventory("DuoChargeAmmo",170,"Charge2")
DUOF B 0 A_JumpIfInventory("WeaponCharge",19,"Charge1")
DUOF B 0 A_PlaySoundEx("weapon/coilstart","Weapon")
Goto Charge1
Charge1:
DUOF B 0 A_JumpIfInventory("DuoChargeAmmo",170,"Charge2Start")
DUOF B 0 A_GiveInventory("DuoChargeAmmo",5)
DUOF H 1 ACS_ExecuteAlways(991,0,102)
DUOF H 0 A_Refire("Charge1.a")
DUOF C 0 ACS_ExecuteAlways(991,0,101)
Goto Fire2
Charge1.a:
DUOF B 1 ACS_ExecuteAlways(991,0,101)
DUOF B 0 A_GiveInventory("DuoChargeAmmo",5)
DUOF H 0 A_Refire("Charge1")
DUOF C 0 ACS_ExecuteAlways(991,0,101)
Goto Fire2
Charge2Start:
DUOF K 0 A_GunFlash("Sound.BusterCharge", GFF_NOEXTCHANGE)
Goto Charge2
Charge2:
DUOF K 1 ACS_ExecuteAlways(991,0,103)
DUOF J 0 A_GiveInventory("DuoChargeAmmo",5)
DUOF H 0 A_Refire("Charge2.a")
DUOF C 0 ACS_ExecuteAlways(991,0,101)
Goto Fire3
Charge2.a:
DUOF I 1 ACS_ExecuteAlways(991,0,104)
DUOF J 0 A_GiveInventory("DuoChargeAmmo",5)
DUOF J 0 A_SpawnItemEx("DuoChargeLight",8,-8,8)
DUOF H 0 A_Refire("Charge2.b")
DUOF C 0 ACS_ExecuteAlways(991,0,101)
Goto Fire3
Charge2.b:
DUOF J 1 ACS_ExecuteAlways(991,0,101)
DUOF JJJ 0 A_SpawnItemEx("DuoChargeLight",8,-8,8)
DUOF J 0 A_JumpIfInventory("DuoChargeAmmo", 170, 3)
DUOF J 0 A_GiveInventory("DuoChargeAmmo",10)
DUOF J 0 A_GunFlash
DUOF J 0 A_JumpIfInventory("IsBot", 1, "BotFire")
DUOF H 0 A_Refire("Charge2")
DUOF C 0 ACS_ExecuteAlways(991,0,101)
Goto Fire3
}
}

actor DuoChargeLight : BasicExplosionEffect
{
    mass 1
    States
    {
    Spawn:
        TNT1 AA 1 A_SetTics(mass)
        stop
    }
}


actor DuoPunchSH
{
PROJECTILE
+SKYEXPLODE
PROJECTILE
Damage (25)
Speed 58
Radius 10
Height 10
scale 2.5
damagetype "DuoFist1"
Obituary "$OB_DUOFIST"
States
{
Spawn:
GIGF A 0
GIGF A 0 A_GiveInventory("CutterFlag", 5)
Spawn2: 
GIGF A 0
GIGF A 1 A_SpawnItemEx("DuoPunchWire")
GIGF A 0 A_TakeInventory("CutterFlag", 1)
GIGF A 0 A_JumpIfInventory("Cutterflag", 2, "Spawn2")
GIGF A 0
Goto Spawn3
Spawn3:
GIGF AA 1
GIGF A 0 A_TakeInventory("CutterFlag", 999) 
Goto Death
Death:
TNT1 A 1 A_CustomMissile("DuoPunchReturnSH",0,0,0,0)
stop
}
}

Actor DuoPunchReturnSH
{
radius 0
height 0
speed 80
damage (0)
scale 2.5
+DONTBLAST
+RIPPER
PROJECTILE
+SKYEXPLODE
+NOINTERACTION
states
{
Spawn:
GIGF J 0
GIGF J 0 A_FaceTarget
GIGF J 0 A_CustomMissile("DuoPunchWire",0,0,0,0)
GIGF J 1 A_JumpIfCloser(60,"Return")
TNT1 A 0 A_CustomMissile("DuoPunchReturn",0,0,0,0)
stop
Return:
GIGF A 0 A_GiveToTarget("FistFlag",1)
stop
}
}

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

actor MidFistSH : MidFist {Damage (33) Speed 30}

actor GigaFistSH : GigaFist 
{
Damage (60)
Speed 32
damagetype "GigaFistSH"
}

actor GigaFistProtection : PowerProtection
{
Powerup.duration 12
damagefactor "GigaFistSH", 0.0
}

actor DuoRushSpecial : DuoFistSpecial
{
Weapon.SlotNumber 3
Weapon.SlotPriority 0
tag "Duo Rush"
inventory.icon "DUOICON2"
States
{
Ready:
DUOF B 0 
DUOF B 0 
Goto Ready2
Ready2:
DUOF B 0 ACS_ExecuteAlways(998,0,101)
DUOF B 0 ACS_ExecuteAlways(991,0,101)
DUOF B 0 A_TakeInventory("WeaponCharge",999)
DUOF B 1 A_WeaponReady
Goto Ready2+2
Fire:
Hold:
DUOF B 5
DUOF CD 3
DUOF D 0 SetPlayerProperty(0,1,0)
Fire2:
DUOF G 0 A_JumpIfInventory("RuneSpread",1,"FireS")
DUOF G 0 A_JumpIfInventory("DuoChargeAmmo",170,"FireEnd")
DUOF G 0 A_PlaySoundEx("weapon/mbuster","Weapon")
DUOF G 0 A_GiveInventory("DuoRapidPB_P",1)
DUOF G 0 A_SpawnItemEx("DuoRapidFist",0,random(-56,56),random(28,56),cos(-pitch)*42,0,sin(-pitch)*42,0,1)
DUOF G 2 A_GiveInventory("DuoChargeAmmo",3)
DUOF G 0 A_Refire("Fire2")
goto FireEnd
FireS:
DUOF G 0 A_JumpIfInventory("DuoChargeAmmo",170,"FireEnd")
DUOF G 0 A_PlaySoundEx("weapon/mbuster","Weapon")
DUOF G 0 A_Recoil(-3)
DUOF GGG 0 A_SpawnItemEx("DuoRapidFist",0,random(-56,56),random(28,56),cos(-pitch)*42,0,sin(-pitch)*42,0,1)
DUOF G 2 A_GiveInventory("DuoChargeAmmo",3)
DUOF G 0 A_Refire("FireS")
goto FireEnd
FireEnd:
DUOF D 3
DUOF CBB 3
DUOF D 0 SetPlayerProperty(0,0,0)

FireEnd2:
DUOF B 0 A_JumpIfInventory("RageRuneFlag",1,"FireEndR")
DUOF B 0 A_TakeInventory("DuoChargeAmmo",2)
DUOF B 1 A_WeaponReady(WRF_NOPRIMARY|WRF_NOSWITCH)
DUOF B 0 A_JumpIfInventory("DuoChargeAmmo",1,"FireEnd2")
Goto Ready2+2
FireEndR:
DUOF B 1 A_TakeInventory("DuoChargeAmmo",4)
DUOF B 0 A_WeaponReady(WRF_NOPRIMARY|WRF_NOSWITCH)
DUOF B 0 A_JumpIfInventory("DuoChargeAmmo",1,"FireEndR")
Goto Ready2+2
Altfire:
DUOF C 0 A_JumpIfNoAmmo("Hold")
DUOF C 0 A_PlaySoundEx("weapon/mbuster","Weapon")
DUOF C 0 A_FireCustomMissile("DuoPunchSH",0,0,8,0)
DUOF C 0 A_TakeInventory("WeaponCharge",999)
DUOF G 0 A_TakeInventory("DuoChargeAmmo",2)
DUOF G 1 A_TakeInventory("FistFlag",1)
Goto FistWait

FistWait:
DUOF G 1 A_TakeInventory("DuoChargeAmmo",2)
DUOF G 0 A_GiveInventory("AdapterWaitCount",1)
DUOF G 0 A_JumpIfInventory("AdapterWaitCount",20,"FistFinish")
DUOF G 0 A_JumpIfInventory("FistFlag",1,"FistFinish")
loop
FistFinish:
DUOF G 0 A_PlayWeaponSound("weapon/adapterreturn")
DUOF G 0 A_TakeInventory("FistFlag",1)
DUOF G 0 A_JumpIfInventory("AdapterWaitCount", 8, 2) //Adds a slight delay if fired at very close range
DUOF DDDD 1 A_TakeInventory("DuoChargeAmmo",2)
DUOF G 0 A_TakeInventory("AdapterWaitCount",999)
DUOF DDDDCCCC 1 A_TakeInventory("DuoChargeAmmo",2)
DUOF B 0 A_JumpIfInventory("DuoChargeAmmo",1,"FireEnd2")
DUOF B 0 A_Refire
Goto Ready2+2
}
}

actor DuoRapidPB_P : CustomInventory
{
states
{
Pickup:
	TNT1 A 0 
	TNT1 A 1 A_JumpIf(z-floorz==0, 2)
	TNT1 A 0 A_Recoil(-1.2)
	stop
	TNT1 A 0 A_Recoil(-3)

	Nope:
	TNT1 A 0
	stop
}
}


actor DuoRapidFist : FastProjectile
{
PROJECTILE
damagetype "DuoRapidFist"
Obituary "%k punched holes into %o."
//+DONTBLAST
-RIPPER
reactiontime 5
damage (26)
Radius 15
Height 15
speed 96
scale 2.7
States
{
Spawn:
TNT1 A 0
TNT1 A 0 ACS_ExecuteAlways(259,0,0)//Change pitch to player pitch
GIGF A 1 A_CountDown
wait
Crash:
XDeath:
Death:
GIGF AAAAA 1 A_FadeOut(0.22)
stop
}
}


actor DuoRapidFist2 : FastProjectile
{
PROJECTILE
damagetype "DuoRapidFist2"
Obituary "%k punched holes into %o."
//+DONTBLAST
-RIPPER
reactiontime 5
damage (8)
Radius 15
Height 15
speed 96
scale 2.7
States
{
Spawn:
TNT1 A 0
TNT1 A 0 ACS_ExecuteAlways(259,0,0)//Change pitch to player pitch
GIGF A 1 A_CountDown
wait
Crash:
XDeath:
Death:
GIGF AAAAA 1 A_FadeOut(0.22)
stop
}
}

actor DuoRushProtection : PowerProtection
{
Powerup.duration 20
damagefactor "DuoRapidFist", 0.26
}

actor DuoShockwavePartSH
{
Obituary "%o was purged by %k's Duo Fist."
PROJECTILE
Scale 2.0
//+FLOORHUGGER
+DONTBLAST
//+NOEXPLODEFLOOR
+RIPPER
damagetype "DuoFist3"
//+NOINTERACTION
Speed 40
Damage (2)
Radius 32
Height 32
States
{
Spawn:
DUOR T 0
DUOR T 2
DUOR T 0 A_ChangeFlag("NOINTERACTION",0)
DUOR T 0 A_ChangeFlag("RIPPER",0)
loopit:
DUOR T 1 A_FadeOut(0.05)
loop
}
}

actor DuoMeleeDamager
{
Obituary "%o was purged by %k's \Duo Fist."
PROJECTILE
+RIPPER
Radius 1
Height 1
scale 2.5
damage (0)
damagetype "DuoFist3"
speed 40
States
{
Spawn:
TNT1 A 0
TNT1 A 1 A_Explode(64,64,0)
stop
}
}

actor TanksNeverDie : PowerProtection
{
	Powerup.Duration -5//87 // == 2.5s
	damagefactor "Normal", 0.0
	Powerup.Colormap 0.2, 0.2, 0.2, 0.7, 0.7, 1.0
}

/*actor DuoPunchSpecial : DuoPunch
{
damage (20)
}

actor MidFistSpecial : MidFist
{
damage (30)
}

actor GigaFistSpecial : GigaFist
{
damage (60)
}*/

actor ImHeavyWeaponsGuy : Inventory
{
inventory.amount 1
inventory.maxamount 1
}

actor DuoIsChargingFlag : Inventory
{
inventory.amount 1
inventory.maxamount 1
}

actor DuoFlashFlag : Inventory
{
inventory.amount 1
inventory.maxamount 1
}

actor DuoDashFlag : Inventory
{
inventory.amount 1
inventory.maxamount 1
}

actor MedicControlSummonTANK : CustomInventory
{
states
{
Pickup:
TNT1 A 0 A_SpawnItemEx("MedicControlTANK")
stop
}
}

actor MedicControlTANK : MedicControlNORMAL
{
states
{
Spawn:
TNT1 A 0
CheckingHealth:
TNT1 A 1 A_GiveToTarget("MedicHealthTank", 1)
TNT1 A 0 A_JumpIfInTargetInventory("IsDead", 1, "Death")
loop
}
}

actor MedicHealthTank : MedicHealthNormal
{
states
{
Pickup:
TNT1 A 0 A_JumpIfHealthLower(200, "MedicPossible")
TNT1 A 0 A_GiveInventory("MedicHealthMaximiser")
stop
}
}

actor ATrueTankNeverDies...OnlyHisBodyDeceases : CustomInventory
{
states
{
Pickup:
TNT1 A 0 ACS_ExecuteAlways(400, 0, 394)
stop
}
}

actor TankRecoilSH : CustomInventory
{
states
{
Pickup:
PLAY H 0 A_Recoil(15)
PLAY H 0 ThrustThingZ(0,65,0,1)
stop
}
}

actor DuoChargeAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 170
+INVENTORY.IGNORESKILL
}