//Stand still charge now has contact damage
actor Magmaman : VCBaseClass
{
Player.ScoreIcon "MAGMMUGS"
player.startitem "BaseFlagPack", 1
player.soundclass "magmamanc"
Player.ViewHeight 44
Player.JumpZ 14
player.displayname "Magmaman"
player.startitem "MagmaBazookaBoss"
player.startitem "MagmaManAmmo", 36
player.startitem "BaseAltfireAmmo", 56
player.startitem "UltimateAttackItem3", 1
player.startitem "UltSoundWatcherSpawn3"
player.startitem "IsFromMM9"
States
{
Animation3:
Spawn:
MGMA A 0
MGMA B 1 A_JumpIf(z-floorz>0, "Jumping")
MGMA A 1 A_JumpIf(z-floorz>0, "Jumping")
MGMA L 0 //A_PlaySoundEx("weapon/magmamancharge","SoundSlot7",1)
MGMA L 0 //A_GiveInventory("MagmaManAmmo",1)
MGMA L 0 //A_GiveInventory("MagmaContactDamage_CI",1)
MGMA L 0 //A_SpawnItemEx("MagmaChargeFX",random(0,32),0,random(40,80),0,0,0,random(0,359))
MGMA L 1 A_JumpIf(z-floorz>0, "Jumping")
MGMA L 0 //A_SpawnItemEx("MagmaChargeFX",random(0,32),0,random(40,80),0,0,0,random(0,359))
MGMA L 1 A_JumpIf(z-floorz>0, "Jumping")
goto Spawn+4

See:
MGMA B 0 A_StopSoundEx("SoundSlot7")
MGMA B 0 A_TakeInventory("MagmaAmmoTimer",999)
MGMA BBBBBCCCCCDDDDDEEEEE 1 A_JumpIf(z-floorz>0, "Jumping")
Goto Spawn

Jumping:
MGM4 A 0 A_StopSoundEx("SoundSlot7")
MGM4 A 0 A_TakeInventory("MagmaAmmoTimer",999)
MGM4 A 1 A_JumpIf(z-floorz<=0, "Spawn")
loop

Animation5:
Missile:
MGM3 A 0 A_StopSoundEx("SoundSlot7")
MGM3 A 0 A_TakeInventory("MagmaAmmoTimer",999)
MGM3 AAAAA 1 A_JumpIf(z-floorz>0, "JumpingMissile")

Missile2:
MGM3 BBBBB 1 A_JumpIf(z-floorz>0, "JumpingMissile2")
Goto Spawn+1

JumpingMissile:
MGM4 BBBBB 1 A_JumpIf(z-floorz<=0, "Missile")

JumpingMissile2:
MGM4 CCCCC 1 A_JumpIf(z-floorz<=0, "Missile2")
goto Jumping

Animation1:
MGMA MNNN 3
goto Spawn+1

Animation2:
MGMA MMMMNNNNNNNNNMMMMNNNNNNNNNMMMMNNNNNNNNN 1

A2Loop:
MGM3 AB 1
loop

Animation4:
MGM3 ABAB 1 A_JumpIf(z-floorz>0, "JumpingA4")
goto Spawn+1

JumpingA4:
MGM4 BCBC 1 A_JumpIf(z-floorz<=0, "Animation4")
goto Jumping

ClassTimeStop:
PLAY A 0 SetPlayerProperty(0,1,4)
//PLAY A 0 A_GiveInventory("TimeStoppedFlag",1)
PLAY A 0 ACS_Execute(528,0)
MGMA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 1 A_Stop
//PLAY A 0 A_TakeInventory("TimeStoppedFlag",999)
PLAY A 0 SetPlayerProperty(0,0,4)
Goto pain+1
ClassPain:
MGMA H 0 A_StopSoundEx("SoundSlot7")
MGMA H 0 A_TakeInventory("MagmaAmmoTimer",999)
MGMA HHHHHHHHHH 2 A_SpawnItem("PainFX",0,3)
Goto Spawn+1
ClassDeath:
MGMA H 0 A_StopSoundEx("SoundSlot7")
MGMA H 0 A_TakeInventory("MagmaAmmoTimer",999)
MGMA H 20 ACS_ExecuteAlways(999,0,0)
MGMA H 0 A_PlayerScream
NOFX A 0 A_SpawnItemEx("FakeDeathFXMM9",0,0,32)
NOFX A 1 A_CheckPlayerDone
wait
ClassIceDeath:
MGMA A 35
NOFX A 0 A_SpawnItemEx("FrozenDeathFX",0,0,16)
NOFX A 1 A_CheckPlayerDone
wait
WeaponGetM:
CUTM H 0 A_JumpIfInTargetInventory("MagmaBazookaWepM",1,2)
CUTM H 0 A_GiveToTarget("WeaponGetter")
CUTM H 0 A_GiveToTarget("MagmaBazookaWepM")
goto ClassDeath
}
}

Actor MagmaContactDamage_CI : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("MagmaStandDamageCooldown",1,"Failed")
TNT1 A 0 A_SpawnItemEx("MagmaManStandStillHitbox")
TNT1 A 0 A_GiveInventory("MagmaStandDamageCooldown")
Failed:
TNT1 A 0
stop
}
}

Actor MagmaManStandStillHitbox : BasicExplosion
{
damagetype "MagmamanChangkey"
Obituary "$OB_MAGMAMAN5"
states
{
Spawn:
TNT1 A 0
TNT1 A 0 A_Explode(1,40,0,0,40)
stop
}
}

actor MagmaStandDamageCooldown : powerup
{
Powerup.Duration 9
}

actor MagmaBazookaBoss : VCBaseWeapon
{
	Weapon.AmmoType "MagmaManAmmo"
	Weapon.AmmoType2 "BaseAltfireAmmo"
	Weapon.ammouse 9
	Obituary "$OB_MAGMAMAN1"
	States
	{
		Ready:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory("BaseAltfireAmmo",28,"Ready.TF")
		MGMH A 1 A_WeaponReady(WRF_NOPRIMARY*CallACS("VC_AmmoCheck",5,1)|WRF_NOSECONDARY*CallACS("VC_AmmoCheck",5,9)) MGMH A 0 A_JumpIfInventory("UltAttackFlag",1,"UltimateAttack")
		MGMH A 1 A_WeaponReady(WRF_NOPRIMARY*CallACS("VC_AmmoCheck",5,1)|WRF_NOSECONDARY*CallACS("VC_AmmoCheck",5,9)) MGMH A 0 A_JumpIfInventory("UltAttackFlag",1,"UltimateAttack")
		MGMH A 1 A_WeaponReady(WRF_NOPRIMARY*CallACS("VC_AmmoCheck",5,1)|WRF_NOSECONDARY*CallACS("VC_AmmoCheck",5,9)) MGMH A 0 A_JumpIfInventory("UltAttackFlag",1,"UltimateAttack")
		MGMH A 1 A_WeaponReady(WRF_NOPRIMARY*CallACS("VC_AmmoCheck",5,1)|WRF_NOSECONDARY*CallACS("VC_AmmoCheck",5,9)) MGMH A 0 A_JumpIfInventory("UltAttackFlag",1,"UltimateAttack")
		MGMH A 0 A_GiveInventory("MagmaManAmmo",1)
		MGMH A 0 A_GiveInventory("BaseAltfireAmmo",3)
		goto Ready
		
		Ready.TF:
		MGMH A 1 A_WeaponReady(WRF_NOPRIMARY*CallACS("VC_AmmoCheck",5,1)|WRF_NOSECONDARY*CallACS("VC_AmmoCheck",5,9)) MGMH A 0 A_JumpIfInventory("UltAttackFlag",1,"UltimateAttack") MGMH A 0 A_JumpIf(ACS_NamedExecuteWithResult("VC_CheckBtn",3)==3,"User1")
		MGMH A 1 A_WeaponReady(WRF_NOPRIMARY*CallACS("VC_AmmoCheck",5,1)|WRF_NOSECONDARY*CallACS("VC_AmmoCheck",5,9)) MGMH A 0 A_JumpIfInventory("UltAttackFlag",1,"UltimateAttack") MGMH A 0 A_JumpIf(ACS_NamedExecuteWithResult("VC_CheckBtn",3)==3,"User1")
		MGMH A 1 A_WeaponReady(WRF_NOPRIMARY*CallACS("VC_AmmoCheck",5,1)|WRF_NOSECONDARY*CallACS("VC_AmmoCheck",5,9)) MGMH A 0 A_JumpIfInventory("UltAttackFlag",1,"UltimateAttack") MGMH A 0 A_JumpIf(ACS_NamedExecuteWithResult("VC_CheckBtn",3)==3,"User1")
		MGMH A 1 A_WeaponReady(WRF_NOPRIMARY*CallACS("VC_AmmoCheck",5,1)|WRF_NOSECONDARY*CallACS("VC_AmmoCheck",5,9)) MGMH A 0 A_JumpIfInventory("UltAttackFlag",1,"UltimateAttack") MGMH A 0 A_JumpIf(ACS_NamedExecuteWithResult("VC_CheckBtn",3)==3,"User1")
		MGMH A 0 A_GiveInventory("MagmaManAmmo",1)
		MGMH A 0 A_GiveInventory("BaseAltfireAmmo",3)
		goto Ready
		
		Deselect:
		TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Lower
		MGMH A 1 A_Lower
		Loop
		
		Select:
		TNT1 A 0 ACS_ExecuteAlways(991,0,9886)
		TNT1 A 0 A_SpawnItemEx("MagmaHeadFlame")
		TNT1 A 0 A_SpawnItemEx("MagmaMovementWatcher")
		TNT1 A 0 A_SpawnItemEx("MagmaAmmoWatcher") //For head flame status
		TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Raise
		MGMH A 1 A_Raise
		Loop
		
		User1:
		TNT1 A 0 ACS_NamedExecuteWithResult("VC_SetState",5)
		MGMH DMN 1
		MGMH N 0 A_GunFlash("Flash.TF") //For other ammo recharge
		MGMH N 1 A_PlaySoundEx("weapon/popoheli","Weapon",1)
		
		U1.Loop:
		MGMH N 0 A_JumpIfInventory("BaseAltfireAmmo",3,2)
		MGMH N 0 A_Jump(256,"U1.End")
		MGMH N 0 A_GiveInventory("MagmaTFHandler",1)
		MGMH FO 1
		MGMH AA 0 A_JumpIf(ACS_NamedExecuteWithResult("VC_CheckBtn",3)==3,"U1.Loop")
		MGMH N 0 A_JumpIfInventory("BaseAltfireAmmo",3,2)
		MGMH N 0 A_Jump(256,"U1.End")
		MGMH N 0 A_GiveInventory("MagmaTFHandler",1)
		MGMH FO 1
		MGMH AA 0 A_JumpIf(ACS_NamedExecuteWithResult("VC_CheckBtn",3)==3,"U1.Loop")
		MGMH N 0 A_Jump(256,"U1.End")

		U1.End:
		TNT1 A 0 ACS_NamedExecuteWithResult("VC_SetState",3)
		MGMH N 0 A_GunFlash("NoFlash")
		MGMH NNNNMA 2 A_StopSound(CHAN_WEAPON)
		goto Ready

		Fire:
		MGMH A 0 A_JumpIfNoAmmo("Fire2")
		MGMH M 1
		MGMH D 0 A_PlaySoundEx("weapon/magmabazooka","Weapon")
		MGMH D 0 A_FireCustomMissile("MagmaManBazooka2",-20,1,-1,8)
		MGMH D 0 A_FireCustomMissile("MagmaManBazooka2",0,0,-1,8)
		MGMH D 0 A_FireCustomMissile("MagmaManBazooka2",20,0,-1,8)
		MGMH FFOONNNNNNNMM 1
		MGMH A 8
		goto Ready

		Fire2:
		MGMH M 1
		MGMH D 0 A_PlaySoundEx("weapon/magmabazooka","Weapon")
		MGMH D 0 A_TakeInventory("MagmaManAmmo",1)
		MGMH D 0 A_FireCustomMissile("MagmaManBazooka1",-20,0,-1,8)
		MGMH D 0 A_FireCustomMissile("MagmaManBazooka1",0,0,-1,8)
		MGMH D 0 A_FireCustomMissile("MagmaManBazooka1",20,0,-1,8)
		MGMH FFOONNNMM 1
		MGMH A 4
		goto Ready

		Altfire:
		RATU A 0 A_JumpIfInventory("NoAltfire",1,"Ready")
		TNT1 A 0 ACS_NamedExecuteWithResult("VC_SetState",1)
		MGMH G 0 A_PlaySoundEx("weapon/magmamanalt","Weapon")
		MGMH GHI 1
		MGMH G 0 A_PlaySoundEx("weapon/magmamanbomb","Body")
		MGMH D 0 A_TakeInventory("MagmaManAmmo",9)
		MGMH D 0 A_Quake(2,8,0,128)
		MGMH D 0 A_GunFlash
		MGMH I 14 A_FireCustomMissile("MagmaManBomb",0,0,0,30)
		MGMH HGAAA 1
		goto Ready
		
		
		UltimateAttack:
		MGMA B 0 A_StopSoundEx("SoundSlot7")
		MGMH C 0 A_SetGravity(0.0)
		TNT1 A 0 ACS_NamedExecuteWithResult("VC_SetState",2)
		TNT1 A 0 ACS_NamedExecuteAlways("VC_UltimateText",0,81)
		PLGH A 0 A_PlaySoundEx("classes/ultimateactivation","Auto")
		NEDR A 0 A_GiveInventory("MagmaUltCooldown",1)
		TNT1 A 0 A_GiveInventory("InvProtection")
		TNT1 A 0 A_ChangeFlag("INVULNERABLE",1)
		CUTA A 0 A_PlaySoundEx("weapon/magmamanult","Body")
		CUTA A 0 SetPlayerProperty(0,1,0)
		TNT1 A 0 A_Quake(1,13,0,128)
		MGMH GHIIIIIIIIIHG 1 A_Stop
		TNT1 A 0 A_Quake(2,13,0,128)
		MGMH GHIIIIIIIIIHG 1 A_Stop
		TNT1 A 0 A_Quake(3,13,0,128)
		MGMH GHIIIIIIIIIHG 1 A_Stop
		MGMH G 0 A_Quake(4,70,0,256)
		MGMH G 0 A_PlaySoundEx("weapon/magmaultbeam","SoundSlot6")
		CUTA A 0 A_TakeInventory("MediumUltimateAmmo",999)
		MGMH B 1 A_SpawnItemEx("MagmaManBeam1",25,0,40,25)
		MGMH CBCBCBCB 1 A_SpawnItemEx("MagmaManBeam2",25,0,40,25)
		MGMH C 0 SetPlayerProperty(0,1,4)
		MGMH CBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCB 1 A_SpawnItemEx("MagmaManBeam2",25,0,40,25)
		TNT1 A 0 A_TakeInventory("InvProtection")
		TNT1 A 0 A_ChangeFlag("INVULNERABLE",0)
		MGMH B 1 A_SpawnItemEx("MagmaManBeam3",25,0,40,25)
		TNT1 A 0 ACS_NamedExecuteWithResult("VC_SetState",3)
		MGMH C 0 A_GiveInventory("GravityRestore")
		MGMH C 0 A_TakeInventory("UltAttackFlag")
		CUTA A 0 SetPlayerProperty(0,0,0)
		MGMH A 10 SetPlayerProperty(0,0,4)
		goto Ready
		
		Flash:
		MGMH JJKKLLJJKKLL 1 A_JumpIfInventory("IsDead",1,"NoFlash")
		stop
		
		Flash.TF:
		TNT1 A 0 A_GiveInventory("MagmaManAmmo",1)
		TNT1 A 4 A_JumpIfInventory("IsDead",1,"NoFlash")
		loop
	}
}

actor MagmaManAmmo : Ammo
{
	inventory.amount 1
	inventory.maxamount 36
	+INVENTORY.IGNORESKILL
}

actor MagmaAmmoTimer : Inventory
{
inventory.amount 1
inventory.maxamount 14
}

actor MagmaManBazooka1 : MagmaBazooka1
{
translation "217:217=[240,184,56]:[240,184,56]" 
Damage (9)
Obituary "$OB_MAGMAMAN1"
damagetype "MagmaManBazooka"
Radius 8
Height 8
States
{
Spawn:
TNT1 AA 0 A_GiveInventory("ProjectileCode",1)
goto Super::Spawn
}
}

actor MagmaManBazooka2 : MagmaManBazooka1
{
Damage (21)
Radius 24
Height 24
States
{
Spawn:
TNT1 AA 0 A_GiveInventory("ProjectileCode",1)
loopit:
MGM2 ABCDEF 2
loop
}
}

actor MagmamanBazookaProtect : PowerProtection
{
Powerup.Duration 5
DamageFactor "MagmaManBazooka", 0.25
}

actor MagmaManBeam1
{
Translation "192:192=229:229", "198:198=227:227", "0:8=161:161", "243:247=161:161"
Obituary "$OB_MAGMAMAN3"
PROJECTILE
+RIPPER
+DONTBLAST
damagetype "MagmamanUlt"
Damage (1000)
radius 32
height 40
speed 70
scale 2.5
+STEPMISSILE
maxstepheight 24
States
{
Spawn:
TNT1 AA 0 A_GiveInventory("ProjectileCode")
TNT1 A 1 ACS_NamedExecuteAlways("VC_MagmaBeamColors", 0)
loopit:
MGMB H 0 A_SpawnItemEx("MagmaGrazer",50,0,0,0,0,0,-90)
MGMB H 0 A_SpawnItemEx("MagmaGrazer",50,0,0,0,0,0,90)
MGMB H 1 A_GiveToTarget("MagmaUltCooldown")
loop
Death:
TNT1 A 0 A_PlaySoundEx("weapon/firestorm","Body")
TNT1 AAAAAAAA 0 A_SpawnItemEx("MagmaBeamFX",0,random(-24,24),random(-36,36),random(-20,20),random(-20,20),random(-20,20))
TNT1 A 0 A_SpawnItemEx("OilPitIgnite",0,0,8)
TNT1 A 5
stop
}
}

actor MagmaManBeam2 : MagmaManBeam1
{
States
{
Spawn:
TNT1 AA 0 A_GiveInventory("ProjectileCode")
TNT1 A 1 ACS_NamedExecuteAlways("VC_MagmaBeamColors", 0)
loopit:
MGMB I 0 A_SpawnItemEx("MagmaGrazer",50,0,0,1,1,0,-90,8)
MGMB I 0 A_SpawnItemEx("MagmaGrazer",50,0,0,1,1,0,90,8)
MGMB I 1 A_GiveToTarget("MagmaUltCooldown")
loop
}
}

actor MagmaManBeam3 : MagmaManBeam1
{
States
{
Spawn:
TNT1 AA 0 A_GiveInventory("ProjectileCode")
TNT1 A 1 ACS_NamedExecuteAlways("VC_MagmaBeamColors", 0)
loopit:
MGMB J 0 A_SpawnItemEx("MagmaGrazer",50,0,0,0,0,0,-90)
MGMB J 0 A_SpawnItemEx("MagmaGrazer",50,0,0,0,0,0,90)
MGMB J 1 A_GiveToTarget("MagmaUltCooldown")
loop
}
}

actor MagmaGrazer
{
PROJECTILE
radius 16
height 16
scale 2.5
States
{
Spawn:
TNT1 A 2
stop
XDeath:
TNT1 AAAAAA 0 A_SpawnItemEx("MagmaGrazeFX",random(-8,8),random(-16,16),16,random(0,3),0,random(7,12),random(-30,30),0,200)
stop
}
}

actor MagmaGrazeFX : BasicClientSide
{
reactiontime 13
States
{
Spawn:
TNT1 AA 0 A_GiveInventory("ProjectileCode")
TNT1 A 0 A_Jump(256,"S_1","S_2","S_3","S_4","S_5","S_6","S_7","S_8","S_9")

S_1:
MGMB K 1 ThrustThingZ(0,4,1,1)
goto S_0

S_2:
MGMB L 1 ThrustThingZ(0,4,1,1)
goto S_0

S_3:
MGMB M 1 ThrustThingZ(0,4,1,1)
goto S_0

S_4:
MGMB N 1 ThrustThingZ(0,4,1,1)
goto S_0

S_5:
MGMB O 1 ThrustThingZ(0,4,1,1)
goto S_0

S_6:
MGMB P 1 ThrustThingZ(0,4,1,1)
goto S_0

S_7:
MGMB Q 1 ThrustThingZ(0,4,1,1)
goto S_0

S_8:
MGMB R 1 ThrustThingZ(0,4,1,1)
goto S_0

S_9:
MGMB S 1 ThrustThingZ(0,4,1,1)
goto S_0

S_0:
TNT1 A 0 A_Countdown
TNT1 A 0 A_Jump(256,"S_1","S_2","S_3","S_4","S_5","S_6","S_7","S_8","S_9")
goto S_1
}
}

actor MagmaHeadFlame
{
PROJECTILE
+NOINTERACTION
+CLIENTSIDEONLY
scale 2.5
radius 1
height 1
States
{
Spawn:
TNT1 AAA 1
loopit:
TNT1 A 0 A_Warp(AAPTR_TARGET,0,0,2,0,WARPF_INTERPOLATE|WARPF_NOCHECKPOSITION)
TNT1 A 0 A_JumpIfInTargetInventory("IsTheTerminator",1,"Death")
TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("core_targetexists",0)==0,"Death")
TNT1 A 0 A_JumpIfInTargetInventory("MagmaNoFlame",1,"Off")
MGMC A 1 A_Warp(AAPTR_TARGET,0,0,2,0,WARPF_INTERPOLATE|WARPF_NOCHECKPOSITION)
TNT1 A 0 A_JumpIfInTargetInventory("IsTheTerminator",1,"Death")
TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("core_targetexists",0)==0,"Death")
TNT1 A 0 A_JumpIfInTargetInventory("MagmaNoFlame",1,"Off")
MGMC A 1 A_Warp(AAPTR_TARGET,0,0,2,0,WARPF_INTERPOLATE|WARPF_NOCHECKPOSITION)
TNT1 A 0 A_JumpIfInTargetInventory("IsTheTerminator",1,"Death")
TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("core_targetexists",0)==0,"Death")
TNT1 A 0 A_JumpIfInTargetInventory("MagmaNoFlame",1,"Off")
MGMC B 1 A_Warp(AAPTR_TARGET,0,0,2,0,WARPF_INTERPOLATE|WARPF_NOCHECKPOSITION)
TNT1 A 0 A_JumpIfInTargetInventory("IsTheTerminator",1,"Death")
TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("core_targetexists",0)==0,"Death")
TNT1 A 0 A_JumpIfInTargetInventory("MagmaNoFlame",1,"Off")
MGMC B 1 A_Warp(AAPTR_TARGET,0,0,2,0,WARPF_INTERPOLATE|WARPF_NOCHECKPOSITION)
loop
Off:
TNT1 A 0 A_JumpIfInTargetInventory("IsTheTerminator",1,"Death")
TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("core_targetexists",0)==0,"Death")
TNT1 A 0 A_JumpIfInTargetInventory("MagmaYesFlame",1,"Spawn")
TNT1 A 1 A_Warp(AAPTR_TARGET,0,0,2,0,WARPF_INTERPOLATE|WARPF_NOCHECKPOSITION)
loop
Death:
TNT1 A 0
stop
}
}

actor MagmaAmmoWatcher
{
Height 0
Radius 0
+NOINTERACTION
-SOLID
+NOGRAVITY
+MISSILE
States
{
Spawn:
TNT1 AAA 1
Spawn2:
TNT1 A 0 A_JumpIfInTargetInventory("MagmaManAmmo",9,"Spawn3")
TNT1 A 1 A_JumpIf(ACS_NamedExecuteWithResult("core_targetexists",0) == 0, "Death")
TNT1 A 0 A_TakeFromTarget("MagmaYesFlame")
TNT1 A 0 A_GiveToTarget("MagmaNoFlame")
loop
Spawn3:
TNT1 A 0
TNT1 A 1 A_JumpIf(ACS_NamedExecuteWithResult("core_targetexists",0) == 0, "Death")
TNT1 A 0 A_TakeFromTarget("MagmaNoFlame")
TNT1 A 0 A_GiveToTarget("MagmaYesFlame")
goto Spawn2
Death:
TNT1 A 0 A_GiveToTarget("MagmaNoFlame")
stop
}
}

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

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

actor MagmaChargeFX : BasicClientSide
{
renderstyle translucent
alpha 1.0
States
{
Spawn:
TNT1 AA 0 A_GiveInventory("ProjectileCode")
MGME EFGHI 1
stop
}
}

actor MagmaBombFX : MagmaChargeFX
{
States
{
Spawn:
TNT1 AA 0 A_GiveInventory("ProjectileCode")
loopit:
MGME A 1 A_ScaleVelocity(0.8)
MGME A 0 A_FadeOut(0.05)
MGME B 1 A_ScaleVelocity(0.8)
MGME B 0 A_FadeOut(0.05)
loop
}
}

actor MagmaBeamFX : MagmaChargeFX
{
States
{
Spawn:
TNT1 AA 0 A_GiveInventory("ProjectileCode")
loopit:
MGME C 1 A_ScaleVelocity(0.8)
MGME C 0 A_FadeOut(0.05)
MGME D 1 A_ScaleVelocity(0.8)
MGME D 0 A_FadeOut(0.05)
loop
}
}

actor MagmaManBomb
{
Obituary "$OB_MAGMAMAN2"
DamageType "MagmamanChangkey"
PROJECTILE
-NOGRAVITY
+RIPPER
Radius 20
Height 20
Speed 50
Damage (9)
Scale 2.5
States
{
Spawn:
TNT1 AA 0 A_GiveInventory("ProjectileCode",1)
TNT1 A 0 ThrustThingZ(0,20,0,1)
loopit:
CGDR DDEE 1 A_SpawnItemEx("MagmaBombFX",0,random(-24,24),random(0,48),random(-8,8),random(-8,8),random(-8,8))
loop
Death:
TNT1 A 0 A_Explode(16,128,0)
TNT1 AAAAAAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("MagmaBombFX",random(-24,24),random(-24,24),random(0,48),random(-16,16),random(-16,16),random(-16,16))
TNT1 A 0 A_SpawnItemEx("OilPitIgnite")
TNT1 A 0 A_PlaySoundEx("misc/lava","Body")
TNT1 A 2 A_CheckFloor("Flames")
stop
Flames:
TNT1 A 0 A_SpawnItemEx("OilPitIgnite")
TNT1 A 0 A_SpawnItemEx("MagmaBombFlame",32,0,0,20,0,0,0,1)
TNT1 A 0 A_SpawnItemEx("MagmaBombFlame",32,0,0,20,0,0,90,1)
TNT1 A 0 A_SpawnItemEx("MagmaBombFlame",32,0,0,20,0,0,180,1)
TNT1 A 2 A_SpawnItemEx("MagmaBombFlame",32,0,0,20,0,0,270,1)
stop
}
}

actor MagmaBombFlame
{
Obituary "$OB_MAGMAMAN2"
DamageType "Magmaman"
PROJECTILE
+RIPPER
+FLOORHUGGER
Radius 10
Height 10
Speed 50
Damage (4)
Scale 2.5
States
{
Spawn:
TNT1 AA 0 A_GiveInventory("ProjectileCode",1)
loopit:
HOTH CD 3 A_SpawnItemEx("OilPitIgnite")
loop
Death:
TNT1 A 0
stop
}
}

actor MagmaUltDeathFX : BasicClientSide
{
States
{
Spawn:
TNT1 AA 0 A_GiveInventory("ProjectileCode")
MGME JKLMN 8
stop
}
}

actor MagmaUltCooldown : UltBuildCooldownGiver
{
	Powerup.Duration 35
}

actor MagmaThrower1
{
Obituary "$OB_MAGMAMAN4"
PROJECTILE
damagetype "MagmaBurn"
radius 12
height 12
damage(2)
speed 38//19
scale 2.5
//+RIPPER
States
{
Spawn:
TNT1 AA 0 A_GiveInventory("ProjectileCode")
TNT1 A 1
MGME EF 2//GE 2
goto Death
Death:
MGME H 0 A_ChangeFlag("NOINTERACTION",true)
MGME H 0 A_SpawnItemEx("OilPitIgnite",0,0,8)
MGME HI 2 A_Stop
stop
}
}

actor MagmaThrower1b : MagmaThrower1
{
renderstyle add
}

actor MagmaThrower2 : MagmaThrower1
{
States
{
Spawn:
TNT1 AA 0 A_GiveInventory("ProjectileCode")
TNT1 A 1
MGME FG 2//EF 2
goto Death
}
}

actor MagmaThrower2b : MagmaThrower2
{
renderstyle add
}

actor MagmaThrower3 : MagmaThrower1
{
States
{
Spawn:
TNT1 AA 0 A_GiveInventory("ProjectileCode")
TNT1 A 1
MGME GE 2//FG 2
goto Death
}
}

actor MagmaThrower3b : MagmaThrower3
{
renderstyle add
}

actor MagmaAfterBurnPickup : CustomInventory
{
states
{
Pickup:
TNT1 A 0 A_GiveInventory("MagmaNoNewAfterBurn",1)
TNT1 A 0 A_GiveInventory("MagmaNewAfterBurn",1)
TNT1 A 0 A_TakeInventory("MagmaAfterBurnDuration",1)
TNT1 A 0 A_GiveInventory("MagmaAfterBurnDuration",1)
stop
}
}

actor MagmaAfterBurnDuration : PowerUp
{
Powerup.Duration 255
}

actor MagmaNoNewAfterBurn : PowerUp
{
Powerup.Duration 6
}

actor MagmaNewAfterBurn : PowerUp
{
Powerup.Duration 3
}

actor MagmaAfterBurnDamageTimer : PowerUp
{
Powerup.Duration 17
}

actor MagmaAfterBurn
{
Height 0
Radius 0
+NOINTERACTION
+NOCLIP
damagetype "MagmaBurning"
Obituary "$OB_MAGMAMAN4"
PROJECTILE
states
{
Spawn:
TNT1 A 0
SpawnStart0:
TNT1 A 0 A_GiveInventory("MagmaAfterBurnDamageTimer",1)
SpawnStart:
TNT1 A 1
TNT1 A 0 A_JumpIfInventory("NewAfterBurn",1,"SpawnStart",AAPTR_TRACER)
Spawn2:
TNT1 A 1
TNT1 A 0 A_GiveInventory("MagmaAfterburnFunc",1)
loop
Death:
TNT1 A 0 A_SpawnItemEx("OilPitIgnite",0,0,8)
stop
}
}

actor MagmaAfterburnFunc : CustomInventory
{
states
{
Pickup:
TNT1 A 0 A_JumpIfInventory("MagmaAfterBurnDuration",1,"Pickup2",AAPTR_TRACER)
PickupRemove:
TNT1 A 0 Thing_Remove(0)
stop
Pickup2:
TNT1 A 0 A_JumpIfInventory("MagmaNewAfterBurn",1,"PickupRemove",AAPTR_TRACER)
TNT1 A 0 A_JumpIfInventory("MagmaAfterBurnDamageTimer",1,"PickupWait")
TNT1 A 0 A_GiveInventory("MagmaAfterBurnDamageTimer",1)
TNT1 A 0 A_Warp(AAPTR_TRACER,0,0,ACS_NamedExecuteWithResult("TracerHeightGet")/2,0,0)
TNT1 A 0 A_RadiusGive("AfterBurnImmune",IMMUNE_RADIUS,RGF_PLAYERS|RGF_MONSTERS|RGF_OBJECTS)
TNT1 A 0 A_TakeInventory("AfterBurnImmune",1,0,AAPTR_TRACER)
TNT1 A 0 A_Explode(1,1,0,0,1)
stop
PickupWait:
TNT1 A 0
stop
}
}

actor MagmaTFHandler : CustomInventory
{
States
{
Pickup:
TNT1 A 0 ACS_NamedExecuteWithResult("VC_SetState",4)
TNT1 A 0 A_TakeInventory("BaseAltfireAmmo",3)
TNT1 A 0 A_JumpIfInventory("VC_Timer",2,"Pickup3")
TNT1 A 0 A_JumpIfInventory("VC_Timer",1,"Pickup2")
TNT1 A 0 A_FireCustomMissile("MagmaThrower1",frandom(-3,3),0,8,8,0,frandom(-3,3))
TNT1 A 0 A_FireCustomMissile("MagmaThrower1b",frandom(-3,3),0,8,8,0,frandom(-3,3))
TNT1 A 0 A_GiveInventory("VC_Timer",1)
stop

Pickup2:
TNT1 A 0 A_FireCustomMissile("MagmaThrower1",frandom(-3,3),0,8,8,0,frandom(-3,3))
TNT1 A 0 A_FireCustomMissile("MagmaThrower1b",frandom(-3,3),0,8,8,0,frandom(-3,3))
TNT1 A 0 A_GiveInventory("VC_Timer",1)
stop

Pickup3:
TNT1 A 0 A_FireCustomMissile("MagmaThrower3",frandom(-3,3),0,8,8,0,frandom(-3,3))
TNT1 A 0 A_FireCustomMissile("MagmaThrower3b",frandom(-3,3),0,8,8,0,frandom(-3,3))
TNT1 A 0 A_TakeInventory("VC_Timer",9)
stop
}
}

actor MagmaBurnProtect : PowerProtection
{
Powerup.Duration 3
DamageFactor "MagmaBurn", 0.0
}


actor MagmaMovementWatcher
{
Height 0
Radius 0
+NOINTERACTION
+MISSILE
States
{
Spawn:
TNT1 A 0
TNT1 AAA 2 A_GiveToTarget("MagmaMovementCheck")
TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("core_targetexists",0) == 0, "Death")
loop
Death:
TNT1 A 0
stop
}
}

actor MagmaMovementCheck : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIf(CallACS("VC_CheckBtn",1)>1 || CallACS("VC_CheckBtn",5)>1,"Pickup3")
goto Pickup2

Pickup2:
TNT1 A 0 A_PlaySoundEx("weapon/magmamancharge","SoundSlot7",1)
TNT1 A 0 A_GiveInventory("MagmaManAmmo",1)
TNT1 A 0 A_GiveInventory("MagmaContactDamage_CI",1)
TNT1 A 0 A_SpawnItemEx("MagmaChargeFX",random(0,32),0,random(40,80),0,0,0,random(0,359))
TNT1 A 0
stop

Pickup3:
TNT1 A 0 
stop
}
}