actor magegunner : arachnotron replaces arachnotron
{
	Health 1000 
	PainChance 60 
	painthreshold 50
	Speed 13
	Radius 30 
	Height 56 
	Mass 400 
	+DONTHARMSPECIES
	MONSTER
	painchance "grappler", 256
 	Painchance "Blazmelee", 160
    bloodtype newbloodsplatter
	seesound "magegunner/spot"
	painsound "magegunner/pain"
	deathsound "magegunner/die"
	activesound ""
	+floorclip
    Obituary "%o was overwhelmed by a Mage Gunner's assault."
	dropitem "lilcube" 60
	dropitem "smallsubrefresh" 60
	states
	{
	spawn:
		MAGN AB 10 a_look
		loop
	see:
		MAGN AABBCCDD 2 a_chase
		loop
	missile:
		TNT1 A 0 a_jump (60, "chargeshot")
		MAGN E 4 a_facetarget
		MAGN F 4 a_custommissile ("magerifleshot")
		TNT1 A 0 a_custommissile ("magerifleshot",32,0,random(-4,11),2,random(-2,4))
		MAGN E 2
		MAGN E 4 a_facetarget
		MAGN F 4 a_custommissile ("magerifleshot")
		TNT1 A 0 a_custommissile ("magerifleshot",32,0,random(-7,14),2,random(-3,2))
		MAGN E 2
		MAGN E 4 a_facetarget
		MAGN F 4 a_custommissile ("magerifleshot")
		TNT1 A 0 a_custommissile ("magerifleshot",32,0,random(-2,13),2,random(-2,3))
		goto see
	chargeshot:
		MAGN E 0 a_playsound ("magegunner/charge",0)
		MAGN E 0 a_facetarget
		MAGN E 5 a_spawnitemex ("riflechargeup1",20,10,32)
		MAGN E 0 a_facetarget
		MAGN E 5 a_spawnitemex ("riflechargeup1",20,10,32)
		MAGN E 0 a_facetarget
		MAGN E 5 a_spawnitemex ("riflechargeup2",20,10,32)
		MAGN E 0 a_facetarget
		MAGN E 5 a_spawnitemex ("riflechargeup2",20,10,32)
		MAGN E 0 a_facetarget
		MAGN E 5 a_spawnitemex ("riflechargeup3",20,10,32)
		MAGN E 0 a_facetarget
		MAGN E 5 a_spawnitemex ("riflechargeup3",20,10,32)
		MAGN E 0 a_facetarget
		MAGN E 5 a_spawnitemex ("riflechargeup3",20,10,32)
		MAGN E 0 a_facetarget
		MAGN E 5 a_spawnitemex ("riflechargeup3",20,10,32)
		MAGN E 0 a_facetarget
		MAGN E 5 a_spawnitemex ("riflechargeup3",20,10,32)
		MAGN E 4 a_facetarget
		TNT1 A 0 a_jump (140, "missileshoot")
		goto chargefire
	missileshoot:
		MAGN E 12 a_playsound ("magegunner/missileload",0)
		MAGN E 15 a_playsound ("magegunner/attack",0)
		MAGN E 8 a_facetarget
		TNT1 A 0 a_recoil (20)
		MAGN F 4 a_custommissile ("magicmissile")
		MAGN E 4
		goto see
	chargefire:
		MAGN E 15 a_playsound ("magegunner/attack",0)
		MAGN F 1 a_custommissile ("magebigshot")
		MAGN F 4 a_recoil (20)
		MAGN E 4 
		goto see
	pain:
		MAGN G 4
		MAGN G 8 a_pain
		goto see
	death:
		TNT1 A 0 a_jump (40, "specialdeath")
		MAGN G 1 a_scream 
		MAGN G 1 a_noblocking 
		MAGN H 1 a_facetarget
		TNT1 A 0 thrustthingz (0,30,0,1)
		TNT1 A 0 ThrustThing(angle*256/360+128, 4, 0, 0)		
		MAGN H 3 
		MAGN I 3 
		MAGN J 2
		MAGN K 3
		MAGN L 2 a_playsound("magebane/fall",0)
		MAGN L -1 a_bossdeath
		stop
	xdeath:
		MAGN M 1 
		MAGN M 2 a_fall
		MAGN M 0 a_playsound ("magegunner/xdeath",0)
		TNT1 A 0 a_spawnitem ("bigbloodsplatter")
		TNT1 AAAAAAAA 0 a_spawnitem ("newbloodsplatter") 
		TNT1 AAA 0 a_spawnitemex("bonegib",0,0,0,random(-10,10),random(-10,10),10)		
		MAGN NOPQRSTU 4 
		MAGN U -1 a_bossdeath
		stop
	death.sunder:
		MAGN M 1 
		MAGN M 2 a_fall
		MAGN M 0 a_playsound ("magegunner/xdeath",0)
		TNT1 A 0 a_spawnitem ("bigbloodsplatter")
		TNT1 AAAAAAAA 0 a_spawnitem ("newbloodsplatter") 
		TNT1 AAA 0 a_spawnitemex("bonegib",0,0,0,random(-10,10),random(-10,10),10)		
		TNT1 AAA 0 a_dropitem ("cell",1)
		MAGN NOPQRSTU 4 
		MAGN U -1 a_bossdeath
		stop
	death.slayermelee:
		MAGN G 1 a_scream 
		MAGN G 1 a_noblocking 
		MAGN H 1 a_facetarget
		TNT1 AAA 0 a_spawnitemex ("Strongsunderlootorb", 0, 0, 0, random (-4, 7), random (-6, 3), random (3,6))
		TNT1 AA 0 a_spawnitemex ("sunderlootorb", 0, 0, 0, random (-3, 6), random (-8, 8), random (3,5))
		TNT1 A 0 thrustthingz (0,30,0,1)
		TNT1 A 0 ThrustThing(angle*256/360+128, 4, 0, 0)		
		MAGN H 3 
		MAGN I 3 
		MAGN J 2
		MAGN K 3
		MAGN L 2 a_playsound("magebane/fall",0)
		MAGN L -1 a_bossdeath
		stop
	Death.slayersupermelee:
		MAGN M 1 
		MAGN M 2 a_fall
		MAGN M 0 a_playsound ("magegunner/xdeath",0)
		TNT1 A 0 a_spawnitem ("bigbloodsplatter")
		TNT1 AAAAAAAA 0 a_spawnitem ("newbloodsplatter") 
		TNT1 AAA 0 a_spawnitemex("bonegib",0,0,0,random(-10,10),random(-10,10),10)		
		TNT1 A 0 a_spawnitemex ("Strongsunderlootorb", 0, 0, 0, random (-4, 7), random (-6, 3), random (3,6))
		TNT1 AA 0 a_spawnitemex ("sunderlootorb", 0, 0, 0, random (-3, 6), random (-8, 8), random (3,5))
		MAGN NOPQRSTU 4 
		MAGN U -1 a_bossdeath
		stop

	specialdeath:
		MAGN G 0 
		MAGN G 0 a_stop
		MAGN G 1 a_fall
		MAGN G 1 a_playsound ("magegunner/specialdeath",0)
		MAGN G 68 
		MAGN H 5 
		MAGN I 4
		MAGN J 4
		MAGN K 3
		MAGN L 2 a_playsound("magebane/fall",0)
		MAGN L -1 a_bossdeath
		stop		
	death.blazice:
		MAGN G 2 a_scream
		MAIC A 2 A_noblocking
		TNT1 A 0 a_playsound ("swordtech/freezedeath")
		TNT1 A 0 a_fadeout (0.20)
		TNT1 AAAAAAAAAAAA 0 a_spawnitemex ("iceparticle",random(-8,8),random(-8,8),32,random(-100,100)/10.0,random(-100,100)/10.0,random(-100,100)/20.0,0,160)
		MAIC B 90 bright
		MAIC C 2 bright
		TNT1 A 0 a_playsound ("swordtech/iceshatter")
		TNT1 A 0 A_CustomMissile("icicle", 30,0, 0, CMF_AIMDIRECTION | CMF_TRACKOWNER)
		TNT1 A 0 A_CustomMissile("icicle", 30,0, 45, CMF_AIMDIRECTION | CMF_TRACKOWNER)
		TNT1 A 0 A_CustomMissile("icicle", 30,0, 90, CMF_AIMDIRECTION | CMF_TRACKOWNER)
		TNT1 A 0 A_CustomMissile("icicle", 30,0, 180, CMF_AIMDIRECTION | CMF_TRACKOWNER)
		TNT1 A 0 A_CustomMissile("icicle", 30,0, 270, CMF_AIMDIRECTION | CMF_TRACKOWNER)
		TNT1 A 0 A_CustomMissile("icicle", 30,0, 360, CMF_AIMDIRECTION | CMF_TRACKOWNER)
		TNT1 A 0 a_dropitem ("treatspawner",1,256)
		TNT1 AAAA 0 a_spawnitemex ("icefragment",0,0,0,random(-10,10),random(-10,10),10) 
		TNT1 AAAAAA 0 a_spawnitemex ("icefragment",0,0,0,random(-4,13),random(-8,13),8) 
		stop
	death.fatalslash:
		MAGN G 2 a_scream
		MAIC A 4 a_noblocking
		TNT1 A 0 a_bossdeath
		MAGN G 15
	randomwait:
		FDMG A 1 a_jump (20,"split")
		loop
	split:
		FDMG AABBCC 5
		FDMG DE 2
		FDMG FGHIJ 3 bright A_SpawnItemEx ("fatalburst", frandom(-20,20),frandom(-20,20),frandom(10,30), 0,0,0, 0, SXF_NOCHECKPOSITION,80)
		FDMG J 1 bright A_SpawnItemEx ("fatalburst", frandom(-20,20),frandom(-20,20),frandom(10,30), 0,0,0, 0, SXF_NOCHECKPOSITION,80)
		FDMG J 1 bright A_SpawnItemEx ("fatalburst", frandom(-20,20),frandom(-20,20),frandom(10,30), 0,0,0, 0, SXF_NOCHECKPOSITION,80)
		FDMG J 1 bright A_SpawnItemEx ("fatalburst", frandom(-20,20),frandom(-20,20),frandom(10,30), 0,0,0, 0, SXF_NOCHECKPOSITION,80)
		FDMG J 1 bright A_SpawnItemEx ("fatalburst", frandom(-20,20),frandom(-20,20),frandom(10,30), 0,0,0, 0, SXF_NOCHECKPOSITION,80)
		FDMG J 1 bright A_SpawnItemEx ("fatalburst", frandom(-20,20),frandom(-20,20),frandom(10,30), 0,0,0, 0, SXF_NOCHECKPOSITION,80)
	exploding:
		FDMG J 1 Bright
		TNT1 A 1 Bright A_SpawnItemEx ("fatalburst", frandom(-20,20),frandom(-20,20),frandom(10,30), 0,0,0, 0, SXF_NOCHECKPOSITION,80)
		FDMG J 1 Bright
		TNT1 A 1 Bright A_SpawnItemEx ("fatalburst", frandom(-20,20),frandom(-20,20),frandom(10,30), 0,0,0, 0, SXF_NOCHECKPOSITION,80)
		FDMG J 1 Bright
		TNT1 A 1 Bright A_SpawnItemEx ("fatalburst", frandom(-20,20),frandom(-20,20),frandom(10,30), 0,0,0, 0, SXF_NOCHECKPOSITION,80)
		FDMG J 1 Bright a_jump (100,"reallydie")
		TNT1 A 1 Bright A_SpawnItemEx ("fatalburst", frandom(-20,20),frandom(-20,20),frandom(10,30), 0,0,0, 0, SXF_NOCHECKPOSITION,80)
		loop
	reallydie:
		TNT1 A 0
		TNT1 A 1 a_spawnitemex ("fataldrawdeath",0,0,30)
		stop
	Raise:
		MAGN LKJIHG 4 
		TNT1 A 0 a_jump (40,"chaosexplode")
		goto see
	Chaosexplode:
 		TNT1 A 0
		TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
		MAGN A 8
        MAGN G 6 A_Pain
    	MAGN A 8
        MAGN G 6 A_Pain
    	MAGN A 8
        MAGN G 6 A_Pain
        TNT1 A 0 a_scream
		TNT1 A 0 a_bossdeath
        TNT1 A 0 A_NoBlocking
		TNT1 A 0 a_radiusgive ("chaoslaugh",650,RGF_MONSTERS)
		TNT1 A 0 a_spawnitemex("skellytun",0,0,12,random(-6,6),random(-8,8),random(6,10),0,SXF_NOCHECKPOSITION)
		TNT1 A 0 a_playsound ("bonelord/explode",0,1,0,0.6)
		TNT1 A 0 Radius_Quake (4,20,0,32,0)
		TNT1 A 0 a_spawnitem ("bigbloodsplatter")
		TNT1 AAAAAAAAAAAA 0 a_spawnitem ("newbloodsplatter") 
		TNT1 AAAAAAAA 0 a_spawnitemex("bonegib",0,0,0,random(-30,30),random(-30,30),10)
		ISKL AAAAAAA 0 a_spawnitemex("hipbonegib",0,0,32,random(-10,10),random(-10,10),10)
		ISKL AAAAA 0 a_spawnitemex("ribbonegib",0,0,32,random(-10,10),random(-10,10),12)
		TNT1 AAA 0 a_spawnitemex("bonegib",0,0,0,random(-30,30),random(-30,30),10)
		TNT1 A 20
		stop
	}
}


//Mage gunner projectiles

//Normal shot

actor magerifleshot 
{
	+notimefreeze
	projectile
	+THRUSPECIES
	species "enemyshot"
	+FORCEXYBILLBOARD	
	+LOOKALLAROUND
	height 12
	radius 5
	speed 28
	damage (9)
	scale 1.5
	seesound "magegunner/rifle"
	states
	{
	spawn:
		MWND C 1 bright A_SpawnItem("magerifletrail")
		MWND D 1 bright A_SpawnItem("magerifletrail")
		loop
	Death:
		MWND E 4 Bright
		MWND F 3 Bright
		MWND G 4 Bright
		MWND H 3 Bright
		MWND I 4 Bright
		Stop
	}
}

//normal shot trails

ACTOR magerifletrail
{
	+NOBLOCKMAP
	+NOGRAVITY
	+SHADOW
	+NOTELEPORT
	+CANNOTPUSH
	+NODAMAGETHRUST
	+clientsideonly
	RenderStyle add
	Alpha 0.50
	scale 1.2
	States
	{
	Spawn:
		TNT1 A 0
		MWND CD 2 
		MWND CD 2
		Stop
	}
}

//Big shot

actor magebigshot
{
	+notimefreeze
	projectile
	+noblood
	+FORCEXYBILLBOARD	
	+LOOKALLAROUND
	+SHOOTABLE
	+THRUSPECIES
	+DONTRIP
	-noblockmap
	species "enemyshot"
	health 99999
	mass 40
	height 12
	radius 20
	speed 20
	damage (20)
	scale 1.5
	seesound "magegunner/bigshot"
	states
	{
	spawn:
		MGCS E 2 bright
		MGCS F 2 bright a_spawnitem ("bigshottrail")
		loop
	death:
		TNT1 A 0 A_CustomMissile("magerifleshot", 0,0, 0, CMF_AIMDIRECTION | CMF_TRACKOWNER)
		TNT1 A 0 A_CustomMissile("magerifleshot", 0,0, 80, CMF_AIMDIRECTION | CMF_TRACKOWNER)
		TNT1 A 0 A_CustomMissile("magerifleshot", 0,0, 160, CMF_AIMDIRECTION | CMF_TRACKOWNER)
		TNT1 A 0 A_CustomMissile("magerifleshot", 0,0, 240, CMF_AIMDIRECTION | CMF_TRACKOWNER)
		TNT1 A 0 A_CustomMissile("magerifleshot", 0,0, 320, CMF_AIMDIRECTION | CMF_TRACKOWNER)
 		MWND E 4 Bright
		MWND F 3 Bright
		MWND G 4 Bright
		MWND H 3 Bright
		MWND I 4 Bright
		Stop
	}
}

		
//big shot trails

actor bigshottrail 
{
	+NOGRAVITY
	+NOTELEPORT
	+CANNOTPUSH
	+clientsideonly
	+NODAMAGETHRUST
	scale 1.5
	states
	{
	spawn:
		TNT1 A 0
		TNT1 A 2
		MGCS CD 2 bright
		MGCS CD 2 bright
		MGCS AB 2 bright
		stop
	}
}


//Magic Missile

actor magicmissile
{
	+notimefreeze
	projectile
	species "enemyshot"
	+FORCEXYBILLBOARD	
	+LOOKALLAROUND
	+THRUGHOST
	height 12
	radius 5
	speed 20
	damage (30)
	scale 1.5
	seesound "magegunner/missileshot"
	deathsound "magegunner/missileexplode"
	states
	{
	spawn:
		MGMS A 2 bright a_spawnitem ("missiletrail")
		loop
	death:
		TNT1 A 0 a_explode (40,120,0,0,80)
		TNT1 A 0 Radius_Quake (2,10,0,30,0)
		TNT1 AAAAAAA 0 a_spawndebris ("missiledebris1")
		TNT1 AAAAAAAAAAAA 0 a_spawnitemex ("missiledebris2",random(-16,16),random(-16,16),random(-10,10),random(-100,100)/20.0,random(-100,100)/20.0,random(-100,100)/20.0,0,160)
		MMXP ABCDEFGHIJKL 2
		stop
	}
}

actor missiletrail : bigshottrail
{
	states
	{
	spawn:
		TNT1 A 3
		MGSP AA 3 bright
		MGSP BB 2 bright
		MGSP C 2 bright
		stop
	death:
		TNT1 A 0
		stop
	}
}

actor missiledebris1
{
	Health 4
	radius 3
	height 6
	speed .1
	RenderStyle ADD
	scale 0.8
	Alpha	1
	Mass	0
	+missile
	+clientsideonly
	+doombounce
	+FLOORCLIP
	+DONTSPLASH
	+NOTELEPORT
	States
	{
		TNT1 A 0
		MGSP BBBBBB 1  Bright A_SetTranslucent(.6,1)
		MGSP BBBBBB 1 Bright 
		TNT1 BBB 1  Bright 
		MGSP BBBB 1 Bright 
		TNT1 BB 1  Bright 
		MGSP BB 1 Bright 
		TNT1 BB 1  Bright 
		MGSP B 1 Bright 
		TNT1 B 1  Bright 
		MGSP B 1 Bright 
		Stop
	}
}

actor missiledebris2
{
	projectile
	speed 10
	+clientsideonly
	+NOINTERACTION
	states
	{
	spawn:	
		TNT1 A 0
		MGSP BBBBBB 1  Bright A_SetTranslucent(.6,1)
		TNT1 BB 1  Bright 
		MGSP BB 1 Bright 
		TNT1 BB 1  Bright 
		MGSP B 1 Bright 
		TNT1 B 1  Bright 
		MGSP B 1 Bright 
		Stop
	}
}
	
//Charge up effects

actor riflechargeup1
{
	+NOBLOCKMAP
	+clientsideonly
	+NOINTERACTION
	+NOTELEPORT
	+CANNOTPUSH
	+NODAMAGETHRUST
	+bright
	states
	{
	spawn:
		TNT1 A 0
		MGCS ABABAB 4
		stop
	death:
		TNT1 A 0
		stop
	}
}

actor riflechargeup2 : riflechargeup1
{
	states
	{
	spawn:
		MGCS CDCDCD 4
		stop
	}
}

actor riflechargeup3 : riflechargeup1
{
	states
	{
	spawn:
		MGCS EFEFEF 3
		stop
	}
}

		