actor ProtoBusterSpecial : ProtoBuster
{
weapon.ammotype "ProtoChargeLevel"
weapon.ammotype2 "ProtoManBashAmmo"
States
{
Ready:
PROC J 0 A_GiveInventory("StopShield",1)
PROC J 0 ACS_ExecuteAlways(991,0,36)
PROC B 0 //A_GunFlash
Goto Ready2
Ready2:
PROC D 0 ACS_ExecuteAlways(991,0,36)
PROC D 0 A_TakeInventory("WeaponCharge",999)
PROC D 0 //A_GiveInventory("ProtoManBashAmmo",1)
PROC D 1 A_WeaponReady//(WRF_NOSECONDARY)
Goto Ready2+1
Deselect:
TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Lower
PROC D 1 A_Lower
Loop
Select:
TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Raise
PROC D 1 A_Raise
Loop
Fire:
PRCH B 0 A_TakeInventory("ProtoLevelFlag2",999999)
PRCH B 0 A_TakeInventory("ProtoLevelFlag",999999)
PROC D 0 A_ClearRefire
PROC D 0 ACS_ExecuteAlways(991,0,36)
PROC D 0 A_GunFlash("NoFlash")
PROC D 0 A_JumpIfInventory("ProtoChargeLevel",1,"Fire3")
PROC D 0 A_PlaySoundEx("weapon/mbuster","Weapon")
PROC D 0 A_FireCustomMissile("ProtoShotSpecial",0,0,8,0)
PROC E 3 A_TakeInventory("WeaponCharge",999)
PROC F 3
PROC D 1 A_Refire
goto Ready+1
Altfire:
PROC J 0 A_JumpIfInventory("ProtomanBashAmmo",224,1)
goto Altfire.a
PROC D 0 A_JumpIfInventory("ProtoChargeLevel",1,"Altfire.a")
PROC D 1 A_JumpIf(z-floorz==0,"BashTime")
Altfire.a:
PROC D 0 A_GiveInventory("StopShield",1)
PROC D 0 A_JumpIfInventory("ProtoChargeLevel",1,"Fire3")
//PROC D 1 A_TakeInventory("WeaponCharge",999)
Altfire.b:
PROC D 0 A_PlaySoundEx("weapon/mbuster","Weapon")
PROC D 0 A_FireCustomMissile("ProtoShotSpecial",0,0,8,0)
PROC EF 3
PROC D 1
PROC D 0 A_Refire("Altfire.a")
goto Ready2+2

BashTime:
PROC L 1 A_TakeInventory("StopShield")
PROC LKJ 1 A_GunFlash
PROC D 0 A_PlaySoundEx("weapon/chargekick","Weapon")
TNT1 A 0 SetPlayerProperty(0,1,4)
PROC B 0 A_TakeInventory("ProtomanBashAmmo",224)
PROC B 0 A_ChangeVelocity(cos(pitch)*45,0,sin(pitch)*-5,CVF_RELATIVE)
PROC D 0 ACS_ExecuteAlways(191,0,APROP_JumpZ,0,1)
PROC J 0 A_TakeInventory("StopShield")
PROC J 0 A_GiveInventory("ProtoShieldBashFlag",1)
PROC J 0 A_SpawnItemEx("ShieldBashFXSpawner",0,0,0,0,0,0,0,1)
PROC J 1 Offset(16,32) A_SpawnItemEx("ProtomanShieldBasher",10,0,0,5)
PROC J 1 Offset(38,32) A_SpawnItemEx("ProtomanShieldBasher",10,0,0,5)
PROC J 1 Offset(54,32) A_SpawnItemEx("ProtomanShieldBasher",10,0,0,5)
PROC J 1 Offset(66,32) A_SpawnItemEx("ProtomanShieldBasher",10,0,0,5)
PROC J 1 Offset(92,32) A_SpawnItemEx("ProtomanShieldBasher",10,0,0,5)
PROC JJJJJJJJJJ 1 Offset(78,32) A_SpawnItemEx("ProtomanShieldBasher",10,0,0,5)
PROC JJJJJ 1 Offset(78,32)
PROC J 0 ACS_ExecuteAlways(191,0,APROP_Speed,1,1)
PROC J 0 ACS_ExecuteAlways(191,0,APROP_JumpZ,10,1)
PROC J 0 SetPlayerProperty(0,0,0)
TNT1 A 0 SetPlayerProperty(0,0,4)
PROC K 1 Offset(66,32)
PROC K 1 Offset(54,32)
PROC L 1 Offset(38,32)
PROC L 1 Offset(16,32)
PROC K 0 A_TakeInventory("ProtoShieldBashFlag",1)
PROC K 0 A_TakeInventory("WeaponCharge",999)
PROC K 0 A_GiveInventory("StopShield",1)
goto Ready2+7

Fire2:
PRCH B 0 A_TakeInventory("ProtoLevelFlag2",999999)
PRCH B 0 A_TakeInventory("ProtoLevelFlag",999999)
PROC D 0 A_ClearRefire
PROC D 0 ACS_ExecuteAlways(991,0,36)
PROC D 0 A_GunFlash("NoFlash")
PROC D 0 A_TakeInventory("WeaponCharge",999)
PROC F 0 A_PlaySoundEx("weapon/pshot","Weapon")
PROC F 3 A_FireCustomMissile("ProtoShot2Special",0,0,8,0)
PROC EFD 3
PROC D 0 A_Refire
goto Ready2+1
Fire3nc:
PRCH B 0 A_TakeInventory("ProtoLevelFlag2",999999)
PRCH B 0 A_TakeInventory("ProtoLevelFlag",999999)
PROC D 0 A_TakeInventory("WeaponCharge",999)
PROC D 0 A_ClearRefire
PROC D 0 ACS_ExecuteAlways(991,0,36)
PROC D 0 A_GunFlash("NoFlash")
PROC D 0 A_PlaySoundEx("weapon/pshot","Weapon")
PROC F 4 A_FireCustomMissile("ProtoShot3Special",0,0,8,0)
PROC ED 3
PROC D 3
PROC D 0 A_Refire
goto Ready2+1
Fire3:
PRCH B 0 A_TakeInventory("ProtoLevelFlag2",999999)
PRCH B 0 A_TakeInventory("ProtoLevelFlag",999999)
PROC D 0 A_ClearRefire
PROC D 0 ACS_ExecuteAlways(991,0,36)
PROC D 0 A_GunFlash("NoFlash")
PROC D 0 A_TakeInventory("WeaponCharge",999)
PROC D 0 A_PlaySoundEx("weapon/pshot","Weapon")
PROC F 0 A_TakeInventory("ProtoChargeLevel",1)
PROC F 4 A_FireCustomMissile("ProtoShot3Special",0,0,8,0)
PROC ED 3
PROC D 3
PROC D 0 A_Refire
goto Ready2+1
Hold:
TNT1 A 0 A_GiveInventory("StopShield")
TNT1 A 0 A_Gunflash("NoFlash")
TNT1 A 0 A_GiveInventory("ProtoLevelFlag",1)
PROC D 0 A_JumpIfInventory("WeaponCharge",32,"Charge2")
PROC D 0 A_JumpIfInventory("WeaponCharge",10,"Charge")
PROC D 1 A_GiveInventory("WeaponCharge",1)
PROC D 0 A_Refire
Goto Ready2+1
Charge:
PROC D 0 A_JumpIfInventory("WeaponCharge",32,"Charge2")
PROC D 0 A_JumpIfInventory("WeaponCharge",11,"Charge1")
PROC D 0 A_PlaySoundEx("weapon/pchargelong","Weapon")
Goto Charge1
Charge1:
PROC E 0 A_JumpIfInventory("WeaponCharge",32,"Charge2")
PROC D 1 ACS_ExecuteAlways(991,0,63)
PROC I 0 A_Refire("Charge1.a")
Goto Fire2
Charge1.a:
PROC H 1 ACS_ExecuteAlways(991,0,36)
PROC I 0 A_Refire("Charge1.b")
Goto Fire2
Charge1.b:
PROC D 1 ACS_ExecuteAlways(991,0,63)
PROC I 0 A_Refire("Charge1.c")
Goto Fire2
Charge1.c:
PROC H 1 ACS_ExecuteAlways(991,0,36)
PROC I 0 A_GiveInventory("WeaponCharge",2)
PROC I 0 A_Refire("Charge1")
Goto Fire2
Charge2:
PROC D 0 A_GunFlash("Flash.Charge")
Charge2Y:
TNT1 A 0 A_JumpIfInventory("ProtoLevelFlag2",1,"Charge.Flashing")
TNT1 A 0 A_JumpIfInventory("ProtoChargeLevel",4,"Charge2.FlashEnded")
TNT1 A 1 ACS_ExecuteAlways(991,0,64)
PROC I 0 A_Refire("Charge2.a")
Goto Fire3nc
Charge2.a:
TNT1 A 0 A_JumpIfInventory("ProtoLevelFlag2",1,"Charge.Flashing")
TNT1 A 0 A_JumpIfInventory("ProtoChargeLevel",4,"Charge2.FlashEnded")
TNT1 A 1 ACS_ExecuteAlways(991,0,36)
PROC I 0 A_Refire("Charge2Y")
Goto Fire3nc
Charge.Flashing:
TNT1 A 0 ACS_ExecuteAlways(991,0,36)
TNT1 A 0 A_TakeInventory("ProtoLevelFlag2",99999999)
TNT1 A 1 A_WeaponReady(WRF_NOFIRE|WRF_NOSWITCH)
TNT1 A 1 A_Refire("Charge2Y")
Goto Charge2Y
Charge2.FlashEnded:
PROC I 1 ACS_ExecuteAlways(991,0,64)
PROC I 0 A_Refire("Charge2.FlashEndedA")
Goto Fire3nc
Charge2.FlashEndedA:
PROC D 1 ACS_ExecuteAlways(991,0,36)
PROC I 0 A_Refire("Charge2.FlashEnded")
Goto Fire3nc
Flash:
TNT1 A 0
TNT1 A 0 A_SpawnItemEx("ProtoShieldHitbox1",32,-16,8,0,0,0,0,1)
TNT1 A 0 A_SpawnItemEx("ProtoShieldHitbox2",32,-8,8,0,0,0,0,1)
TNT1 A 0 A_SpawnItemEx("ProtoShieldHitbox3",32,0,8,0,0,0,0,1)
TNT1 A 0 A_SpawnItemEx("ProtoShieldHitbox4",32,8,8,0,0,0,0,1)
TNT1 A 0 A_SpawnItemEx("ProtoShieldHitbox5",32,16,8,0,0,0,0,1)
FlashLoop:
TNT1 A 0 A_SpawnItemEx("ProtoShieldFX",32,-10,8,momx,momy,momz,0,9,0)
TNT1 A 0 //A_GiveInventory("ProtoManBashAmmo",1)
TNT1 A 1 A_JumpIfInventory("StopShield",1,"NoFlash")
TNT1 A 0 A_JumpIfInventory("IsDead",1,"NoFlash")
loop
NoFlash:
TNT1 A 0 
Stop
//Charge Gives
Flash.Charge:
TNT1 A 0 A_JumpIfInventory("ProtoChargeLevel",4,"NoFlash")
PROC I 1
PROC D 1
TNT1 A 0 A_JumpIfInventory("ProtoChargeLevel",4,"NoFlash")
TNT1 A 0 A_GiveInventory("CutterFlag",1)
TNT1 A 0 A_JumpIfInventory("ProtoChargeLevel",4,"NoFlash")
TNT1 A 0 A_JumpIfInventory("CutterFlag",5,"Flash.Give")
TNT1 A 0 A_JumpIfInventory("IsDead",1,"NoFlash")
loop
Flash.Give:
TNT1 A 0 A_JumpIfInventory("ProtoChargeLevel",4,"NoFlash")
TNT1 A 0 A_PlaySoundEx("IFI/ProtoChargeLevel","Auto")
TNT1 A 0 A_GiveInventory("ProtoLevelFlag2",1)
TNT1 A 0 A_GiveInventory("ProtoChargeLevel",1)
TNT1 A 0 A_TakeInventory("CutterFlag",99999999)
PRCH BCDE 1
PRCH EE 1
PROC D 1
goto Flash.Charge

}
}


actor ProtomanShieldBasher
{
+MISSILE
-SOLID
+DONTBLAST
+NOGRAVITY
+RIPPER
+SKYEXPLODE
+NOINTERACTION
+DONTSPLASH
+THRUGHOST
+THRUACTORS
+DONTREFLECT
Damage 0
radius 2
height 2
Obituary "%o was in the way of %k's Proto Shield Bash."
DamageType "ProtoBash"
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_Explode(50,64,0,0,64)
stop
}
}

actor ProtoBashProtection : PowerProtection
{
damagefactor "ProtoBash", 0
powerup.duration 35
}

actor ShieldBashFXSpawner
{
PROJECTILE
ReactionTime 10
+DONTBLAST
+NOINTERACTION
States
{
Spawn:
TNT1 A 0 A_Countdown
//TNT1 A 0 A_SpawnItemEx("BasicHardQuakeFX",0,-10,0,0,0,0,0,1)
//TNT1 A 0 A_SpawnItemEx("BasicHardQuakeFX",0,10,0,0,0,0,0,1)
TNT1 A 0 A_Warp(AAPTR_TARGET,0,0,0,0,WARPF_NOCHECKPOSITION)
TNT1 A 3
loop
}
}



actor ProtomanBashAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 224
+INVENTORY.IGNORESKILL
}
actor ProtoShieldBashFlag : inventory {inventory.amount 1 inventory.maxamount 1}
actor ProtoLevelFlag : inventory {inventory.amount 1 inventory.maxamount 1}
actor ProtoLevelFlag2 : inventory {inventory.amount 1 inventory.maxamount 1}
actor ProtoChargeLevel : Ammo
{
inventory.amount 0
inventory.maxamount 4
}

actor ProtoShotSpecial : ProtoShot
{
damage (10)
}

actor ProtoShot2Special : ProtoShot2
{
damage (20) //20
}

actor ProtoShot3Special
{
Translation "198:198=42:42", "192:192=87:87"
PROJECTILE
+LOOKALLAROUND
+SKYEXPLODE
+DONTBLAST
+THRUGHOST
//seesound "weapon/mbuster"
Speed 60
Damage(40+pitch)
radius 20
height 20
scale 2.5
damagetype "ProtoBuster3"
Obituary "$OB_PROTOBUSTER"

States
{
Spawn:
PROC A 0
PROC A 0 A_JumpIf(pitch>=35,"SpawnDone")
PROC A 0 A_SpawnItemEx("ProtoMarksmanShotFX", -momx, frandom(-8, 8), frandom(-8, 8)-momz,0,0,0,0,SXF_ABSOLUTEPOSITION)
PROC AA 1 A_SetPitch(pitch+1)
PROC B 0 A_JumpIf(pitch>=35,"SpawnDone")
PROC B 0 A_SpawnItemEx("ProtoMarksmanShotFX", -momx, frandom(-8, 8), frandom(-8, 8)-momz,0,0,0,0,SXF_ABSOLUTEPOSITION)
PROC BB 1 A_SetPitch(pitch+2)
PROC C 0 A_JumpIf(pitch>=35,"SpawnDone")
PROC C 0 A_SpawnItemEx("ProtoMarksmanShotFX", -momx, frandom(-8, 8), frandom(-8, 8)-momz,0,0,0,0,SXF_ABSOLUTEPOSITION)
PROC CC 1 A_SetPitch(pitch+1)
loop
SpawnDone:
PROC C 0 A_SetPitch(35) 
PROC AAAAAA 0 A_SpawnItemEx("ProtoMarksmanShotFX", random(16,32)-momx, frandom(-16, 16), frandom(-16, 16)-momz,0,0,0,0,SXF_ABSOLUTEPOSITION)
PROC AA 1 
PROC AAAAAA 0 A_SpawnItemEx("ProtoMarksmanShotFX", random(16,32)-momx, frandom(-16, 16), frandom(-16, 16)-momz,0,0,0,0,SXF_ABSOLUTEPOSITION)
PROC BB 1 
PROC AAAAAA 0 A_SpawnItemEx("ProtoMarksmanShotFX", random(16,32)-momx, frandom(-16, 16), frandom(-16, 16)-momz,0,0,0,0,SXF_ABSOLUTEPOSITION)
PROC CC 1 
loop
Death:
PROC A 0
stop
XDeath:
MXP1 DCBA 2
stop
}
}


actor ProtoMarksmanShotFX
{
	Translation "198:198=42:42", "192:192=87:87"
    +NOINTERACTION
    +NOGRAVITY
    +CLIENTSIDEONLY
    +FORCEXYBILLBOARD
    -SOLID
    +BRIGHT
    scale 2.5
    height 1
    radius 1
    States
    {
    Spawn:
		TNT1 A 0 
        PBFX MON 2
        stop
    }
}


actor ProtoBashAmmoSupportSummon : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_SpawnItemEx("ProtoBashAmmoSupport")
stop
}
}

actor ProtoBashAmmoSupport
{
PROJECTILE
+NOINTERACTION
+DONTBLAST
states
{
Spawn:
TNT1 A 0
DelayCharge:
TNT1 A 1
NormalCharge:
TNT1 A 1
TNT1 A 0 A_GiveToTarget("ProtomanBashAmmo", 1)
TNT1 A 0 A_JumpifInTargetInventory("WeaponCharge",1,"DelayCharge")
loop
Death:
TNT1 A 0
stop
NoDouble:
TNT1 A 0
stop}}

actor MedicControlSummonSWEEPER : CustomInventory
{
states
{
Pickup:
TNT1 A 0 A_SpawnItemEx("MedicControlSWEEPER")
stop
}
}

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

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