//===========================================================================
//
// Mel's Melee Style
//
// by Marty Kirra
// Sprites by Marty Kirra, Blox, Scuba Steve, Banjo Entertainment
// 
//
//===========================================================================

ACTOR MelMelee : Weapon
{
   Inventory.PickupMessage "You relearned your fighting style you apparently dropped [Class: Melee, Slot 1]"
   Obituary "%o learned why %k is the king of the iron fist."
   Weapon.Kickback 100
   //Weapon.BobStyle Alpha
   //Weapon.BobSpeed 1.5
   //Weapon.BobRangeY 1.0
   //Weapon.BobRangeX 0.5
   Tag "Melee"
	+WEAPON.WIMPY_WEAPON
	+WEAPON.MELEEWEAPON
    +WEAPON.NOALERT
    +WEAPON.NOAUTOAIM
	+WEAPON.NOAUTOFIRE
    +NOEXTREMEDEATH
	+INVENTORY.UNDROPPABLE
    States
    {
    Spawn:
      	TNT1 A -1
      	Loop
	Deselect:
	    TNT1 A 0 A_TakeInventory("MeleeSelected", 1)
		TNT1 A 0 A_JumpIfInventory("ComboCoolDown", 1, "ComboDeselect")
	    TNT1 A 0 A_JumpIfInventory("MelPistolCombo", 1, "PistolComboDeselect")
	    MLED ABCDE 1
		TNT1 A 3
		TNT1 A 0 A_TakeInventory("MelPrimaryCombo", 99)
		TNT1 A 0 A_TakeInventory("MelAlternateCombo", 99)
		TNT1 A 0 A_TakeInventory("MelMachCombo", 99)
		TNT1 A 0 A_TakeInventory("MelPistolCombo", 99)
		TNT1 A 0 A_TakeInventory("ComboCoolDown", 99)
	DeselectLoop:
	    TNT1 A 1 A_Lower
		Loop
	PistolComboDeselect:
		TNT1 A 0 A_TakeInventory("MelPrimaryCombo", 99)
		TNT1 A 0 A_TakeInventory("MelAlternateCombo", 99)
		TNT1 A 0 A_TakeInventory("MelMachCombo", 99)
	    TNT1 A 5 A_Lower
		Loop
    ComboDeselect:
		TNT1 A 0 A_TakeInventory("MelPrimaryCombo", 99)
		TNT1 A 0 A_TakeInventory("MelAlternateCombo", 99)
		TNT1 A 0 A_TakeInventory("MelMachCombo", 99)
	    TNT1 A 4 A_Lower
		Loop
	Select:
		TNT1 A 0 A_GiveInventory("MeleeSelected", 1)
		TNT1 A 4 SetPlayerProperty(0,1,2)
		MLEU ABCDE 1
	SelectLoop:
		MLEG A 1 A_Raise
		Loop
	Ready:
	    TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    MLEG A 1 A_WeaponReady
		Loop
	Fire:
		TNT1 A 0 A_JumpIfInventory("MagPushToken", 1,"MagPush")
	    TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    ML1F A 0 A_JumpIfInventory("MelMachCombo",4,"AfterMelee") //made so you can't knifehand again after the Rapid Fire Finish
	    ML1F A 0 A_JumpIfInventory("MelMachCombo",3,"RapidFireFinish")
	    ML1F A 0 A_JumpIfInventory("MelMachCombo",2,"CrossDuo")
	    ML1F A 0 A_JumpIfInventory("MelMachCombo",1,"CrossPunch")
	    ML1F A 0 A_JumpIfInventory("MelAlternateCombo",2,"KnifeHand")
	    ML1F A 0 A_JumpIfInventory("MelPrimaryCombo",3,"ScorpionTailFinisher")
		ML1F A 0 A_JumpIfInventory("MelPrimaryCombo",2,"LeftOverhead")
		ML1F A 0 A_JumpIfInventory("MelPrimaryCombo",1,"RightHook")
	    ML1F A 0 A_PlaySoundEX("basicmelee/miss", 5)
	    ML1F ABCD 1
		ML1F D 0 A_JumpIfInventory("PowerStrength",1,"FireBerserk")
		ML1F E 1 A_CustomPunch(5,0,0,"BasicMeleePuff",70)
		Goto FireA
	FireBerserk:
		ML1F E 1 A_CustomPunch(10,0,0,"BasicMeleePuff",70)
		Goto FireA
	FireA:
		ML1F FGJK 1
        TNT1 A 0 A_GiveInventory("MelPrimaryCombo", 1)
		TNT1 A 0 A_GiveInventory("ComboCoolDown", 1)
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		Goto AfterMelee
	RightHook:
	    ML2F A 0 A_PlaySoundEX("basicmelee/miss", 5)
		ML2F ABC 1
		ML1F D 0 A_JumpIfInventory("PowerStrength",1,"RightHookBerserk")
		ML2F D 1 A_CustomPunch(6,0,0,"BasicMeleePuff",70)
		Goto RightHookA
	RightHookBerserk:
		ML2F D 1 A_CustomPunch(12,0,0,"BasicMeleePuff",70)
		Goto RightHookA
	RightHookA:
		ML2F EH 1
		TNT1 A 0 A_GiveInventory("MelPrimaryCombo", 1)
		TNT1 A 0 A_GiveInventory("ComboCoolDown", 1)
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		Goto AfterMelee
	LeftOverhead:
	    ML2F A 0 A_PlaySoundEX("basicmelee/miss", 5)
		ML2F A 0 A_PlaySound("*melee")
		ML3F ABC 1 
		ML1F D 0 A_JumpIfInventory("PowerStrength",1,"LeftOverheadBerserk")
		ML3F E 1 A_CustomPunch(6,0,0,"BasicMeleePuff",70)
		Goto LeftOverheadA
	LeftOverheadBerserk:
		ML3F E 1 A_CustomPunch(12,0,0,"BasicMeleePuff",70)
		Goto LeftOverheadA
	LeftOverheadA:
		ML3F FGJ 1
		TNT1 A 0 A_GiveInventory("MelPrimaryCombo", 1)
		TNT1 A 0 A_GiveInventory("ComboCoolDown", 1)
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 3
		Goto AfterMelee
	ScorpionTailFinisher:
	    TNT1 A 5 A_PlaySound("*strongmelee")
	    ML2F A 0 A_PlaySoundEX("strongmelee/miss", 5)
		ML4F ABC 1
		ML1F D 0 A_JumpIfInventory("PowerStrength",1,"ScorpionTailFinisherBerserk")
		ML4F E 0 A_CustomPunch(1,0,0,"BlankMeleePuff",90)
		ML4F E 0 A_CustomPunch(1,0,0,"BlankMeleePuff",90)
		ML4F E 0 A_CustomPunch(1,0,0,"BlankMeleePuff",90)
		ML4F E 0 A_CustomPunch(1,0,0,"BlankMeleePuff",90)
		ML4F D 1 A_CustomPunch(7,0,0,"UppercutMeleePuff",90)
		Goto ScorpionTailFinisherA
	ScorpionTailFinisherBerserk:
		ML4F E 0 A_CustomPunch(2,0,0,"BlankMeleePuff",90)
		ML4F E 0 A_CustomPunch(2,0,0,"BlankMeleePuff",90)
		ML4F E 0 A_CustomPunch(2,0,0,"BlankMeleePuff",90)
		ML4F E 0 A_CustomPunch(2,0,0,"BlankMeleePuff",90)
		ML4F D 1 A_CustomPunch(14,0,0,"UppercutMeleePuff",90)
		Goto ScorpionTailFinisherA
	ScorpionTailFinisherA:
		ML4F E 2
		ML4F DCBA 1
		TNT1 A 8
		Goto AfterMelee
	KnifeHand:
	    ML2F A 0 A_PlaySoundEX("strongmelee/miss", 5)
		ML5F ABC 1 
		ML5F D 1 A_CustomPunch(7,0,0,"StrongMeleePuff",70)
		ML5F EFGHI 1
		TNT1 A 0 A_GiveInventory("MelMachCombo", 1)
		TNT1 A 0 A_GiveInventory("ComboCoolDown", 1)
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 5
		Goto AfterMelee
	CrossPunch:
	    TNT1 A 2 A_PlaySound("*melee")
	    ML2F A 0 A_PlaySoundEX("basicmelee/miss", 5)
		ML6F AB 1 
		ML1F D 0 A_JumpIfInventory("PowerStrength",1,"CrossPunchBerserk")
		ML6F D 1 A_CustomPunch(6,0,0,"BasicMeleePuff",70)
		Goto CrossPunchA
	CrossPunchBerserk:
		ML6F D 1 A_CustomPunch(12,0,0,"BasicMeleePuff",70)
		Goto CrossPunchA
	CrossPunchA:
		ML6F CBA 1
		TNT1 A 0 A_TakeInventory("MelPrimaryCombo", 99)
		TNT1 A 0 A_GiveInventory("MelMachCombo", 1)
		TNT1 A 0 A_GiveInventory("ComboCoolDown", 1)
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 3
		Goto AfterMelee
	CrossDuo:
	    TNT1 A 1
	    ML2F A 0 A_PlaySoundEX("basicmelee/miss", 5)
		ML7F AB 1 
		ML1F D 0 A_JumpIfInventory("PowerStrength",1,"CrossDuoBerserk")
		ML7F D 1 A_CustomPunch(6,0,0,"BasicMeleePuff",70)
		Goto CrossDuoA
	CrossDuoBerserk:
		ML7F D 1 A_CustomPunch(12,0,0,"BasicMeleePuff",70)
		Goto CrossDuoA
	CrossDuoA:
		ML7F CBA 1
		TNT1 A 0 A_TakeInventory("MelPrimaryCombo", 99)
		TNT1 A 0 A_GiveInventory("MelMachCombo", 1)
		TNT1 A 0 A_GiveInventory("ComboCoolDown", 1)
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 3
		Goto AfterMelee
	RapidFireFinish:
	    TNT1 A 1 A_PlaySound("*strongmelee")
	    ML2F A 0 A_PlaySoundEX("strongmelee/miss", 5)
		ML8F ABD 1 
		ML1F D 0 A_JumpIfInventory("PowerStrength",1,"RapidFireFinishBerserk")
		ML8F E 5 A_CustomPunch(8,0,0,"StrongMeleePuff",90)
		Goto RapidFireFinishA
	RapidFireFinishBerserk:
		ML8F E 5 A_CustomPunch(16,0,0,"StrongMeleePuff",90)
		Goto RapidFireFinishA
	RapidFireFinishA:
		ML8F DCBA 1
		TNT1 A 0 A_TakeInventory("MelPrimaryCombo", 99)
		TNT1 A 0 A_GiveInventory("MelMachCombo", 1)
		TNT1 A 0 A_GiveInventory("ComboCoolDown", 1)
		TNT1 AAAAAAAAA 1 A_WeaponReady
		TNT1 A 0 A_TakeInventory("MelAlternateCombo", 99)
		TNT1 A 6
		Goto AfterMelee
	AltFire:
	    TNT1 A 0 A_JumpIfInventory("MagPushToken", 1,"MagPush")//TNT1 A 0 A_JumpIfInventory("MagSlingToken", 1,"MagSling")
	    ML1F A 0 A_JumpIfInventory("MelAlternateCombo",4,"StingrayFinisher")
		ML1F A 0 A_JumpIfInventory("MelAlternateCombo",2,"ViperFinisher")
		ML1F A 0 A_JumpIfInventory("MelAlternateCombo",1,"UpperKick")
	    ML1F A 0 A_JumpIfInventory("MelPrimaryCombo",3,"AzureKnee")
	    ML1F A 0 A_JumpIfInventory("MelPrimaryCombo",2,"StreetSweeperFinisher")
		ML1F A 0 A_PlaySoundEX("basicmelee/miss", 5)
	    MK4F ABC 1
		ML1F D 0 A_JumpIfInventory("PowerStrength",1,"AltFireBerserk")
		MK4F D 1 A_CustomPunch(6,0,0,"BasicMeleePuff",90)
		Goto AltFireA
	AltFireBerserk:
		MK4F D 1 A_CustomPunch(12,0,0,"BasicMeleePuff",90)
		Goto AltFireA
	AltFireA:
		MK4F EFGH 1
		TNT1 A 0 A_GiveInventory("MelAlternateCombo", 1)
		TNT1 A 0 A_GiveInventory("ComboCoolDown", 1)
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 3
		Goto AfterMelee
    UpperKick:
	    TNT1 A 3
	    ML2F A 0 A_PlaySoundEX("basicmelee/miss", 5)
		ML2F A 0 A_PlaySound("*melee")
	    MK5F ABC 1
		ML1F D 0 A_JumpIfInventory("PowerStrength",1,"UpperKickBerserk")
		MK5F D 2 A_CustomPunch(6,0,0,"BasicMeleePuff",90)
		Goto UpperKickA
	UpperKickBerserk:
		MK5F D 2 A_CustomPunch(12,0,0,"BasicMeleePuff",90)
		Goto UpperKickA
	UpperKickA:
		MK5F EFG 1
		TNT1 A 0 A_GiveInventory("MelAlternateCombo", 1)
		TNT1 A 0 A_GiveInventory("ComboCoolDown", 1)
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 3
		Goto AfterMelee
    ViperFinisher:
	    TNT1 A 3 A_PlaySound("*strongmelee")
	    ML2F A 0 A_PlaySoundEX("strongmelee/miss", 5)
	    MK6F AB 1
		ML1F D 0 A_JumpIfInventory("PowerStrength",1,"ViperFinisherBerserk")
		MK3F E 0 A_CustomPunch(1,0,0,"BlankMeleePuff",90)
		MK3F E 0 A_CustomPunch(1,0,0,"BlankMeleePuff",90)
		MK3F E 0 A_CustomPunch(1,0,0,"BlankMeleePuff",90)
		MK6F C 2 A_CustomPunch(9,0,0,"StrongMeleePuff",90)
		Goto ViperFinisherA
	ViperFinisherBerserk:
		MK3F E 0 A_CustomPunch(2,0,0,"BlankMeleePuff",90)
		MK3F E 0 A_CustomPunch(2,0,0,"BlankMeleePuff",90)
		MK3F E 0 A_CustomPunch(2,0,0,"BlankMeleePuff",90)
		MK6F C 2 A_CustomPunch(18,0,0,"StrongMeleePuff",90)
		Goto ViperFinisherA
	ViperFinisherA:
		MK6F DEF 1
		TNT1 A 8
		Goto AfterMelee
	StreetSweeperFinisher:
	    TNT1 A 4 A_PlaySound("*strongmelee")
	    ML2F A 0 A_PlaySoundEX("strongmelee/miss", 5)
		MK1F ABC 1
		ML1F D 0 A_JumpIfInventory("PowerStrength",1,"StreetSweeperFinisherBerserk")
		MK3F E 0 A_CustomPunch(1,0,0,"BlankMeleePuff",90)
		MK3F E 0 A_CustomPunch(1,0,0,"BlankMeleePuff",90)
		MK3F E 0 A_CustomPunch(1,0,0,"BlankMeleePuff",90)
		MK1F D 1 A_CustomPunch(9,0,0,"StrongMeleePuff",90)
		Goto StreetSweeperFinisherA
	StreetSweeperFinisherBerserk:
		MK3F E 0 A_CustomPunch(2,0,0,"BlankMeleePuff",90)
		MK3F E 0 A_CustomPunch(2,0,0,"BlankMeleePuff",90)
		MK3F E 0 A_CustomPunch(2,0,0,"BlankMeleePuff",90)
		MK1F D 1 A_CustomPunch(18,0,0,"StrongMeleePuff",90)
		Goto StreetSweeperFinisherA
	StreetSweeperFinisherA:
		MK1F EFGHI 1
		TNT1 A 5
		Goto AfterMelee
	AzureKnee:
	    TNT1 A 2
	    ML2F A 0 A_PlaySoundEX("basicmelee/miss", 5)
		MK2F ABC 1
		ML1F D 0 A_JumpIfInventory("PowerStrength",1,"AzureKneeBerserk")
		MK2F D 3 A_CustomPunch(6,0,0,"BasicMeleePuff",70)
		Goto AzureKneeA
	AzureKneeBerserk:
		MK2F D 3 A_CustomPunch(12,0,0,"BasicMeleePuff",70)
		Goto AzureKneeA
	AzureKneeA:
		MK2F CBA 1
		TNT1 A 0 A_GiveInventory("MelAlternateCombo", 4)
		TNT1 A 0 A_GiveInventory("ComboCoolDown", 1)
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("MeleePressed",1,"SPMeleeMelee")
	    TNT1 A 1 A_WeaponReady
		TNT1 A 6
		Goto AfterMelee
	StingRayFinisher:
	    TNT1 A 3 A_PlaySound("*strongmelee")
		ML2F A 0 A_PlaySoundEX("strongmelee/miss", 5)
		MK3F ABCD 1
		ML1F D 0 A_JumpIfInventory("PowerStrength",1,"StingRayFinisherBerserk")
		MK3F E 0 A_CustomPunch(1,0,0,"BlankMeleePuff",90)
		MK3F E 0 A_CustomPunch(1,0,0,"BlankMeleePuff",90)
		MK3F E 0 A_CustomPunch(1,0,0,"BlankMeleePuff",90)
		MK3F E 1 A_CustomPunch(9,0,0,"StrongMeleePuff",90)
		Goto StingRayFinisherA
	StingRayFinisherBerserk:
		MK3F E 0 A_CustomPunch(2,0,0,"BlankMeleePuff",90)
		MK3F E 0 A_CustomPunch(2,0,0,"BlankMeleePuff",90)
		MK3F E 0 A_CustomPunch(2,0,0,"BlankMeleePuff",90)
		MK3F E 1 A_CustomPunch(18,0,0,"StrongMeleePuff",90)
		Goto StingRayFinisherA
	StingRayFinisherA:
		MK3F FGHI 1
		TNT1 A 0 A_GiveInventory("MelPistolCombo", 1)//allows you to do the pistol combo
		TNT1 A 0 A_TakeInventory("MelPrimaryCombo", 99)
		TNT1 A 0 A_TakeInventory("MelAlternateCombo", 99)
		TNT1 A 0 A_TakeInventory("MelMachCombo", 99)
		TNT1 A 5 A_WeaponReady
		Goto AfterMelee 
	AfterMelee:
		TNT1 A 0 A_TakeInventory("MelPrimaryCombo", 99)
		TNT1 A 0 A_TakeInventory("MelAlternateCombo", 99)
		TNT1 A 0 A_TakeInventory("MelMachCombo", 99)
		TNT1 A 0 A_TakeInventory("MelPistolCombo", 99)
		TNT1 A 0 A_TakeInventory("MagPushToken", 99)
		TNT1 A 0 A_TakeInventory("MagSlingToken", 99)
		TNT1 A 0 A_TakeInventory("ComboCoolDown", 99)
	    MLED EDCBA 1
		MLEG A 1
		Goto Ready
	SPMeleeMelee:
	    TNT1 A 0 A_JumpIfInventory("ComboCoolDown", 1, "MagPull")
		TNT1 A 0 A_GiveInventory("MagPushToken", 1)
		TNT1 A 0 A_GiveInventory("MagSlingToken", 1)
		MLED ABCDE 1 
		TNT1 A 5 A_WeaponReady
	MagPull:
	    TNT1 A 2 A_TakeInventory("ComboCoolDown", 99)
	    MLGF A 0 A_PlaySound("magpull",6)
	    MLGF ABCDEFGH 1
		TNT1 A 0 A_SetBlend("39 99 0", 0.4, 15)
		MLGF I 1 A_FireCustomMissile("MagPullProjectile", 0, 0, 0, 0)
		MLGF JKLM 1
		TNT1 A 0 A_TakeInventory("MagPushToken", 99)
		TNT1 A 0 A_TakeInventory("MagSlingToken", 99)
		TNT1 A 0 A_GiveInventory("ComboCoolDown", 1)
		TNT1 A 4
		TNT1 AAAAAAAAAAAAA 1 A_WeaponReady
		Goto AfterMelee
	MagPush:
	    TNT1 A 2 A_TakeInventory("ComboCoolDown", 99)
	    MLGF A 0 A_PlaySound("magpush", 6)
	    MLGF ABCDEFGH 1
		TNT1 A 0 A_SetBlend("18 65 32", 0.4, 15)
		MLGF I 0 A_SpawnItemEx ("MagPushProjectileReflective",0,0,18,cos(-pitch)*60,0,sin(-pitch)*60,0,SXF_NOCHECKPOSITION) 
		MLGF I 0 A_SpawnItemEx ("MagPushProjectileReflective",0,15,18,cos(-pitch)*60,0,sin(-pitch)*60,0,SXF_NOCHECKPOSITION)
		MLGF I 0 A_SpawnItemEx ("MagPushProjectileReflective",0,-15,18,cos(-pitch)*60,0,sin(-pitch)*60,0,SXF_NOCHECKPOSITION) 
		MLGF I 1 A_SpawnItemEx ("MagPushProjectile",20,0,18,cos(-pitch)*200,0,sin(-pitch)*200,0,SXF_NOCHECKPOSITION)
		MLGF HGFEDCBA 1
		TNT1 A 0 A_TakeInventory("MagPushToken", 99)
		TNT1 A 0 A_TakeInventory("MagSlingToken", 99)
		TNT1 A 0 A_GiveInventory("ComboCoolDown", 1)
		TNT1 A 4
		TNT1 AAAAAAAAAAAAA 1 A_WeaponReady
		Goto AfterMelee
	MagSling:
	    TNT1 A 2 A_TakeInventory("ComboCoolDown", 99)
	    MLGF A 0 A_PlaySound("magsling", 6)
	    MLGF ABCDEFGH 1
		TNT1 A 0 A_SetBlend("45 55 20", 0.4, 15)
		MLGF I 0 A_FireCustomMissile("MagSlingActivate", 0, 0, 0, 0)
		MLGF JKLM 1
		TNT1 A 0 A_TakeInventory("MagPushToken", 99)
		TNT1 A 0 A_TakeInventory("MagSlingToken", 99)
		TNT1 A 0 A_GiveInventory("ComboCoolDown", 1)
		TNT1 A 6
		TNT1 AAAAAAAAAAAAA 1 A_WeaponReady
		Goto AfterMelee
		     }
}

ACTOR MagPullProjectile : LoreShot
{
   Speed 140
   Damage 1
   Height 20
   Radius 20
   SeeSound "magloop"
   DeathSound "maghit"
   DamageType Melee
   Obituary "%o was allured by %k's magnetic personality."
   Projectile
   States
   {
   Spawn:
      TNT1 AAAAAAAAAAA 2
      stop
   Death:
      TNT1 A 1 A_Scream
      Stop 
   } 
}


ACTOR MagPushProjectileReflective //this is a completely new actor
{
   Height 30
   Radius 15
   Scale 4.0
   Monster
   +REFLECTIVE
   +DEFLECT
   +NOBLOOD
   +INVULNERABLE
   +NOGRAVITY
   +THRUSPECIES
   
   Species "Player"
   States
   {
   Spawn:
      TNT1 AAAAAAA 1
      Stop
   Death:
      TNT1 A 1 A_Scream
      Stop 
   } 
}

ACTOR MagPushProjectile : FastProjectile  //this replaces the same-named actor
{
   Damage 1
   Height 30
   Radius 30
   Scale 6.0
   SeeSound ""
   DeathSound "magphit"
   DamageType Melee
   Obituary "%k was rejected by %o magnetic push."
   //ProjectileKickback 70000
   Projectile
   +STRIFEDAMAGE
   +THRUSPECIES
   Species "Player"
   States
   {
   Spawn:
      TNT1 AAAAAAA 1
      Stop
   Death:
      TNT1 A 0 A_RadiusThrust(2000,6)
	  TNT1 A 1 A_Scream
      Stop 
   } 
}

ACTOR MagSlingActivate : FastProjectile
{
   Speed 200
   Damage (1)
   Height 20
   Radius 20
   SeeSound ""
   DeathSound "maghit"
   DamageType "Sling"
   Obituary "%k was rejected by %o magnetic push."
    Projectile
   -NOBLOCKMAP
   +NOBLOOD
   //+FORCEPAIN
   States
   {
   Spawn:
      TNT1 AAAA 1
      stop
   Death:
      TNT1 A 1 A_Scream
      Stop 
   } 
}

ACTOR MagSlingShot : LoreShot
{
   Speed 160
   Height 20
   Radius 20
   Damage 0
   SeeSound ""
   DeathSound "maghit"
   DamageType Sling
   Obituary "%o was allured by %k's magnetic personality."
   Projectile
   //+FORCEPAIN
   States
   {
   Spawn:
      TNT1 AAAAAAAA 2
      stop
   Death:
      TNT1 A 1 A_Scream
      Stop 
   } 
}


ACTOR MelPrimaryCombo : Inventory
{
   Inventory.MaxAmount 99
   Inventory.Icon TNT1A0
}

ACTOR MelAlternateCombo : Inventory
{
   Inventory.MaxAmount 99
   Inventory.Icon TNT1A0
}

ACTOR MelMachCombo : Inventory
{
   Inventory.MaxAmount 99
   Inventory.Icon TNT1A0
}

ACTOR MelPistolCombo : Inventory
{
   Inventory.MaxAmount 99
   Inventory.Icon TNT1A0
}

ACTOR MagPushToken: Inventory
{
   Inventory.MaxAmount 99
   Inventory.Icon TNT1A0
}

ACTOR MagSlingToken: Inventory
{
   Inventory.MaxAmount 99
   Inventory.Icon TNT1A0
}

//This is used to switch weapons without weird graphic stuff happening.
ACTOR ComboCooldown: Inventory
{
   Inventory.MaxAmount 99
   Inventory.Icon TNT1A0
}

ACTOR BasicMeleePuff
{ 
   ActiveSound ""
   AttackSound "basicmelee/wall"
   SeeSound "basicmelee/contact"
   DamageType Melee
   +NOGRAVITY
   +NOEXTREMEDEATH
   +PUFFONACTORS
   Decal "none"
   States
   {
   Spawn:
   		TNT1 A 0
    	TNT1 A 1
    	stop
  	Crash:
	  	TNT1 A 0
	  	TNT1 A 1
	  	stop
  	Melee:
	  	TNT1 A 0
	  	TNT1 A 1
	  	stop
   }
}

ACTOR StrongMeleePuff
{ 
   ActiveSound ""
   AttackSound "strongmelee/wall"
   SeeSound "strongmelee/contact"
   +NOGRAVITY
   +NOEXTREMEDEATH
   +PUFFONACTORS
   Decal "none"
   States
   {
   Spawn:
   		TNT1 A 0
    	TNT1 A 1
    	stop
  	Crash:
	  	TNT1 A 0
	  	TNT1 A 1
	  	stop
  	Melee:
	  	TNT1 A 0
	  	TNT1 A 1
	  	stop
   }
}

ACTOR UppercutMeleePuff
{ 
   ActiveSound ""
   AttackSound "strongmelee/wall"
   SeeSound "uppercutmelee/contact"
   +NOGRAVITY
   +NOEXTREMEDEATH
   +PUFFONACTORS
   DamageType Melee
   DamageType Uppercut
   Decal "none"
   States
   {
   Spawn:
   		TNT1 A 0
    	TNT1 A 1
    	stop
  	Crash:
	  	TNT1 A 0
	  	TNT1 A 1
	  	stop
  	Melee:
	  	TNT1 A 0
	  	TNT1 A 1
	  	stop
   }
}

ACTOR BlankMeleePuff
{ 
   ActiveSound ""
   AttackSound ""
   SeeSound ""
   +NOGRAVITY
   +NOEXTREMEDEATH
   +PUFFONACTORS
   Decal "none"
   States
   {
   Spawn:
   		TNT1 A 0
    	TNT1 A 1
    	stop
  	Crash:
	  	TNT1 A 0
	  	TNT1 A 1
	  	stop
  	Melee:
	  	TNT1 A 0
	  	TNT1 A 1
	  	stop
   }
}