
// Monsters code

//------------------------------CHOKING HAND CODE

action AHANDWALK  0  4  5  1  10
action AHANDSTOP  0  1  5  1  1
action AHANDATTACK 29 2 1 1 5
action AHANDDYING 34 5 1 1 10
action AHANDDEAD 39 1 1 1 10
action AHANDBURNING -287 6 1 1 15
action AHANDBURNED -280 1 1 1 1

move HANDWALK 150
move HANDSTOP 

ai AIHANDWALK AHANDWALK HANDWALK faceplayer
ai AIHANDSEEK AHANDWALK HANDWALK seekplayer
ai AIHANDSTOP AHANDSTOP HANDSTOP
ai AIHANDATTACK AHANDATTACK HANDSTOP 
ai AIHANDDYING AHANDDYING HANDSTOP
ai AIHANDDEAD AHANDDEAD HANDSTOP
ai AIHANDBURNING AHANDBURNING HANDSTOP
ai AIHANDBURNED AHANDBURNED HANDSTOP

state handhurt
ifdead { guts JIBS6 10 soundonce HEADSQ addkills 1 ai AIHANDDYING } else { soundonce HANDPAIN guts JIBS6 3 }
ends

actor EVILHAND fall
getplayer[THISACTOR].i PLAYERID
getactor[THISACTOR].extra extra
getactor[PLAYERID].x mx
getactor[PLAYERID].y my
getactor[PLAYERID].z mz
getactor[THISACTOR].x x
getactor[THISACTOR].y y
getactor[THISACTOR].z z
ifvare VISION 1
{ setactor[THISACTOR].shade -127 }
ifhitweapon { state handhurt }

getactorvar[PLAYERID].invisible perplayer
ifvare perplayer 1 { setactorvar[THISACTOR].handshock 1 ifvare peractor2 0 ifvarg extra 0 { ai AIHANDSEEK setvar peractor2 1 } } else { ifvare peractor2 1 { setactorvar[THISACTOR].handshock 0 setvar peractor2 0 } }

getactorvar[THISACTOR].handshock active
ifai NO ifcanseetarget { strength 10 sizeat 30 30 cstator 257 ai AIHANDSEEK }
ifvare active 0
{
	ifai AIHANDSEEK { ifcansee { ifp palive ai AIHANDWALK else ifcount 130 ai AIHANDSTOP } else ai AIHANDSTOP }
	ifai AIHANDWALK 
	{ 
		ifp pdead ai AIHANDSEEK 
		else 
		{
			ifrnd 1 soundonce HANDROAM else ifrnd 1 soundonce HANDSPOT
			getactorvar[PLAYERID].handattack tmp3
			subvarvar mx x
			subvarvar my y
			getangle mang mx my
			getactor[THISACTOR].ang ang
			getincangle mang mang ang
			ifvarg mang -256 ifvarl mang 256
			ifvarn tmp3 1
			{ ifpdistl 850 ai AIHANDATTACK }
		}
	}
	ifai AIHANDATTACK 
	{ 
		setactorvar[PLAYERID].handattack 1
		killit
	}
} 
else
{
	ifai AIHANDSEEK { ifrnd 1 soundonce HANDROAM ifnotmoving { getactor[THISACTOR].ang ang randvar mang 1024 addvarvar ang mang setactor[THISACTOR].ang ang } randvar peractor 64 ifvare perplayer 0 { ifvare peractor 64 { setactorvar[THISACTOR].handshock 0 } } else ifcount 130 { ai AIHANDSTOP setvar peractor 0 } }
}
ifp phigher ifpdistl 600 ifvarg extra 0 { ai AIHANDDYING }
ifai AIHANDSTOP ifcansee ifp palive ifvare perplayer 0 ai AIHANDSEEK 
getactorvar[THISACTOR].flamedamage tmp
ifvarg tmp 0 ifvare peractor3 0 { ai AIHANDBURNING setvar peractor3 1 }
ifai AIHANDBURNING { strength 0 addkills 1 cstat 128 ifrnd 128 soundonce HANDDIE1 else soundonce HANDDIE2 sizeat 40 40 ifactioncount 6 { ai AIHANDBURNED } }
ifai AIHANDDYING { strength 0 addkills 1 cstat 128 ifrnd 128 soundonce HANDDIE1 else soundonce HANDDIE2 sizeat 40 40 ifactioncount 5 { ai AIHANDDEAD } }
enda

action ABURNINGGUYDEAD 0 3 1 1 7
spritenoshade BURNINGGUYDEAD
useractor notenemy BURNINGGUYDEAD 1 ABURNINGGUYDEAD soundonce FLESH_BURNING fall cstat 128 sizeat 30 30
setactorvar[THISACTOR].active 1
ifvare peractor 0
{
	espawn SMALLSMOKE
	setvar light_radius 2048
	setvar red 255
	setvar green 144
	setvar blue 0
	state spawnlight
	setvar peractor 1
}
ifpdistl 800 ifcansee { ifrnd 32 { addphealth -1 palfrom 32 32 } palfrom 32 32 }
ifactioncount 10 sizeat 30 30 ifactioncount 20 sizeat 30 25 ifactioncount 30 sizeat 30 20 ifactioncount 40 sizeat 30 15 ifactioncount 50 { sizeat 30 10 cstator 258 } ifactioncount 60 sizeat 30 5 ifactioncount 70 sizeat 30 1 ifactioncount 80 { setactorvar[THISACTOR].active 0 killit }
enda 

action ABURNINGGUYWALK  0 4 5 1 15
action ABURNINGGUYDYING -383 3 1 1 25

move BURNINGGUYWALK 140
move BURNINGGUYSTOP 

ai AIBURNINGGUYWALK ABURNINGGUYWALK BURNINGGUYWALK faceplayer seekplayer
ai AIBURNINGGUYDYING ABURNINGGUYDYING BURNINGGUYSTOP

state burningguyhurt
ifwasweapon RPG { spawn BURNING2 ai AIBURNINGGUYDYING } else ifwasweapon RADIUSEXPLOSION { spawn BURNING2 ai AIBURNINGGUYDYING }
else { spawn BURNING spawn SMALLSMOKE strength WEAK }
ends

useractor notenemy BURNINGSMOKE cstat 642 sizeat 32 32 
getactorvar[THISACTOR].spriteid tmp
getactor[tmp].x x
getactor[tmp].y y
getactor[tmp].z z
addvar z -24000
setactor[THISACTOR].x x
setactor[THISACTOR].y y
setactor[THISACTOR].z z
ifcount 100 killit
enda

spritenoshade BURNINGGUY
useractor notenemy BURNINGGUY fall
setactorvar[THISACTOR].active 1
ifvare peractor 0
{
	espawn SMALLSMOKE
	setvar light_radius 2048
	setvar red 255
	setvar green 128
	setvar blue 0
	state spawnlight
	espawn BURNINGSMOKE
	setactorvar[RETURN].spriteid THISACTOR
	setvar peractor 1
}
ifaction 0 { ifrnd 85 { soundonce CULTFIR1 } else ifrnd 85 { soundonce CULTFIR2 } else soundonce CULTFIR3 }
ifhitweapon { state burningguyhurt }
ifai NO { fall sizeat 30 30 cstator 257 ai AIBURNINGGUYWALK }
ifai AIBURNINGGUYWALK { ifpdistl 800 ifactioncount 2 { addphealth -5 palfrom 32 32 resetactioncount } else ifcount 100 ai AIBURNINGGUYDYING } 
ifai AIBURNINGGUYDYING { ifactioncount 3 { action 0 spawn BURNINGGUYDEAD setactorvar[THISACTOR].active 0 killit } }
enda

//------------------------------FANATIC CODE

actor HERETICSTOPED1 
sizeat 24 24
ifcansee { spawn HERETIC killit }
enda

actor HERETICSTOPED2 
sizeat 24 24
ifcansee { spawn HERETIC killit }
enda

action AHERETICWALK  0 4 5 1 15
action AHERETICSTAYPUT  0 1 5 1 1
action AHERETICSHOOT -40 2 5 1 28
action AHERETICGRENADE -30 5 5 1 20
action AHERETICSWIM 381 4 5 1 20
action AHERETICDYING 70 7 1 1 15
action AHERETICDEAD 77 1 1 1 10
action AHERETICDUCK 515 3 5 1 22
action AHERETICSHOOTDUCK 535 2 5 1 28

move HERETICWALK 90
move HERETICDUCK 80
move HERETICSTOP 

ai AIHERETICWALK AHERETICWALK HERETICWALK faceplayer seekplayer
ai AIHERETICSTAYPUT AHERETICSTAYPUT HERETICSTOP
ai AIHERETICASS AHERETICWALK HERETICWALK randomangle
ai AIHERETICSHOOT AHERETICSHOOT HERETICSTOP faceplayer 
ai AIHERETICGRENADE AHERETICGRENADE HERETICSTOP faceplayer 
ai AIHERETICRANDOM AHERETICWALK HERETICWALK randomangle 
ai AIHERETICDUCK AHERETICDUCK HERETICDUCK faceplayer seekplayer
ai AIHERETICSHOOTDUCK AHERETICSHOOTDUCK HERETICSTOP faceplayer
ai AIHERETICDYING AHERETICDYING HERETICSTOP 
ai AIHERETICDEAD AHERETICDEAD HERETICSTOP 

state heretichurt
getactor[THISACTOR].extra extra
ifwasweapon RPG { addkills 1 state bloodsprayshit ifrnd 64 { soundonce CULTDIE1 } else ifrnd 64 { soundonce CULTDIE2 } else { soundonce CULTDIE3 } ai AIHERETICDYING } //else ifwasweapon RADIUSEXPLOSION { addkills 1 spawn BURNINGGUY killit }
else ifvare extra 0 ifvarl extra 0 { addkills 1 state bloodsprayshit ifrnd 64 { soundonce CULTDIE1 } else ifrnd 64 { soundonce CULTDIE2 } else { soundonce CULTDIE3 } ai AIHERETICDYING } else { ifrnd 128 { sound CULTPAN1 } else { sound CULTPAN2 } spawn BLOODPOOL2 state bloodspraystate state bloodspraystate ai AIHERETICWALK }
ends

useractor enemy HERETIC fall state enemyeffects
killit
getactor[THISACTOR].extra extra
getactorvar[THISACTOR].reflective tmp
ifvare tmp 1 { state bloodspraystate setactorvar[THISACTOR].reflective 0 }
getactorvar[PLAYERID].invisible tmp2
ifvarn tmp2 1
{
	ifhitweapon { state heretichurt }
	ifai NO { strength 80 sizeat 32 32 cstator 257 ifrnd 4 { soundonce CULTROM1 } else ifrnd 4 { soundonce CULTROM2 } else ifrnd 4 { soundonce CULTROM3 } else ifrnd 4 { soundonce CULTROM4 } else { soundonce CULTROM5 } ai AIHERETICWALK }
	ifai AIHERETICWALK { ifrnd 4 ifcansee { ai AIHERETICSHOOT } else ifrnd 2 ai AIHERETICRANDOM else ifrnd 5 ai AIHERETICDUCK else ifp pdead ai AIHERETICASS } 
	ifai AIHERETICASS { ifp palive ai AIHERETICWALK }
	ifai AIHERETICRANDOM { ifrnd 4 { soundonce CULTROM1 } else ifrnd 4 { soundonce CULTROM2 } else ifrnd 4 { soundonce CULTROM3 } else ifrnd 4 { soundonce CULTROM4 } else ifrnd 4 { soundonce CULTROM5 } ifrnd 4 ifcansee { ai AIHERETICSHOOT } else ifrnd 6 ifcansee ifpdistg 4096 ai AIHERETICGRENADE else ifrnd 6 ai AIHERETICWALK else ifnotmoving ai AIHERETICWALK } 
	ifai AIHERETICSHOOT 
	{ 
		ifactioncount 2
		ifcansee
		{
			ifvarg extra 0
			{
				ifrnd 128 { sound CULTATT1 } else { sound CULTATT2 }
				shoot SHOTSPARK1 
				shoot SHOTSPARK1 
				shoot SHOTSPARK1 
				shoot SHOTSPARK1 
				shoot SHOTSPARK1 
				resetactioncount 
			}
			else
			{ ifrnd 128 { sound CULTATT1 } else { sound CULTATT2 } addkills 1 state bloodsprayshit ifrnd 64 { soundonce CULTDIE1 } else ifrnd 64 { soundonce CULTDIE2 } else { soundonce CULTDIE3 } ai AIHERETICDYING }
		} else ifcount 56 ai AIHERETICRANDOM 
	} 
	ifai AIHERETICSTAYPUT { ai AIHERETICRANDOM }
}
else
{
	ifhitweapon { state heretichurt }
	ifai NO { strength 80 sizeat 32 32 cstator 257 ai AIHERETICSTAYPUT }
	ifai AIHERETICSHOOT { ifcount 26 ai AIHERETICRANDOM }
	ifai AIHERETICWALK { ai AIHERETICRANDOM }
	ifai AIHERETICRANDOM { ifrnd 4 { randvar ang 2048 setactor[THISACTOR].ang ang } ifcount 390 { ai AIHERETICSTAYPUT resetcount break } } 
}
ifai AIHERETICGRENADE { ifactioncount 5 { soundonce CULTTOSS ezshoot -4096 ENEMYTNTBUNDLE  resetactioncount } else ifcount 30 ai AIHERETICRANDOM } 
ifai AIHERETICDYING { cstat 0 ifactioncount 7 { sound THUD ai AIHERETICDEAD } }
ifai AIHERETICDUCK { ifcount 30 ifcansee ai AIHERETICSHOOTDUCK else ai AIHERETICWALK }  
ifai AIHERETICSHOOTDUCK { ifactioncount 2 { sound SHOTGUN_FIRE shoot SHOTSPARK1 shoot SHOTSPARK1 shoot SHOTSPARK1 shoot SHOTSPARK1 shoot SHOTSPARK1 resetactioncount } else ifcount 40 ai AIHERETICRANDOM }  
enda

//------------------------------ZOMBIE CODE

action AZR1 1 0 1 1 0
action AZR2 -8 10 1 1 14

action AZOMBIEWALK  0 4 5 1 16
action AZOMBIESTAYPUT  0 1 5 1 1
action AZOMBIESHOOT 54 7 5 1 12
action AZOMBIEGOTHIT 30 1 5 1 10
action AZOMBIEJIB 46 6 1 1 20
action AZOMBIEGUTS 158 6 1 1 20
action AZOMBIEFALLING 35 4 1 1 12
action AZOMBIEGETUP 40 2 1 1 12
action AZOMBIEDEAD 53 1 1 1 1
action AZOMBIEDEAD2 39 1 1 1 1
action AZOMBIEGUTS2 165 1 1 1 1


move ZOMBIEWALK 80
move ZOMBIESTOP

ai AIZOMBIEWALK AZOMBIEWALK ZOMBIEWALK faceplayer seekplayer
ai AIZOMBIESTAYPUT AZOMBIESTAYPUT ZOMBIESTOP
ai AIZOMBIESHOOT AZOMBIESHOOT ZOMBIESTOP faceplayer 
ai AIZOMBIERANDOM AZOMBIEWALK ZOMBIEWALK randomangle
ai AIZOMBIEGOTHIT AZOMBIEGOTHIT ZOMBIESTOP
ai AIZOMBIEDYING AZOMBIEJIB ZOMBIESTOP
ai AIZOMBIEFALLING AZOMBIEFALLING ZOMBIESTOP
ai AIZOMBIEGETUP AZOMBIEGETUP ZOMBIESTOP
ai AIZOMBIEGUTS AZOMBIEGUTS ZOMBIESTOP
ai AIZOMBIEDEAD AZOMBIEDEAD ZOMBIESTOP 
ai AIZOMBIEDEAD2 AZOMBIEDEAD2 ZOMBIESTOP 
ai AIZOMBIEGUTS2 AZOMBIEGUTS2 ZOMBIESTOP 

actor ZOMBIERISE cstat 0 fall
ifaction 0 action AZR1
ifaction AZR1 ifcansee ifpdistl 2048 action AZR2
ifaction AZR2 ifactioncount 8 cactor ZOMBIE
enda

state checkzombiehitstate
getactor[THISACTOR].extra extra
ifwasweapon PR_NAPALM { addkills 1 ifrnd 85 soundonce AZOMDIE1 else ifrnd 85 soundonce AZOMDIE2 else ifrnd 85 soundonce AZOMDIE3 ai AIZOMBIEGUTS } 
else ifwasweapon RADIUSEXPLOSION { addkills 1 ai AIZOMBIEGUTS }
else { ifvarg extra 0 { state bloodspraystate sound AZOMPAIN ifrnd 6 ai AIZOMBIEGOTHIT else ifvarg htextra 5 ai AIZOMBIEFALLING else ai AIZOMBIEGOTHIT }
else { setactorvar[THISACTOR].w_enemyhitag 0 addkills 1 state bloodsprayshit ifrnd 85 soundonce AZOMDIE1 else ifrnd 85 soundonce AZOMDIE2 else soundonce AZOMDIE3 ifrnd 64 { state bloodspraystate ai AIZOMBIEDYING setprojectile[ZOMBIEHEAD].vel 60 ezshoot 256 ZOMBIEHEAD getactor[RETURN].z z addvar z -3800 setactor[RETURN].z z } else ai AIZOMBIEFALLING } }
ends

eventloadactor ZOMBIE
getactor[THISACTOR].hitag HITAGSET
setactorvar[THISACTOR].w_enemyhitag HITAGSET
enda

useractor enemy ZOMBIE fall state enemyeffects
getactor[THISACTOR].extra extra
getactor[THISACTOR].htextra htextra
getplayer[THISACTOR].i PLAYERID
  
getactorvar[PLAYERID].invisible tmp2
ifvarn tmp2 1
{
	ifhitweapon { state checkzombiehitstate }
	ifai NO { strength 40 sizeat 24 24 cstat 257 ai AIZOMBIEWALK }
	ifai AIZOMBIEWALK { ifrnd 128 ifcansee ifp palive ifpdistl 1024 ai AIZOMBIESHOOT else ifrnd 2 soundonce AZOMROAM ifrnd 1 soundonce AZOMSPOT } 
	ifai AIZOMBIERANDOM { ifrnd 6 ai AIZOMBIEWALK else ifnotmoving ai AIZOMBIEWALK }
	ifai AIZOMBIESHOOT 
	{ 
			getactorvar[PLAYERID].reflective tmp
			ifpdistl 1536
			ifactioncount 5 
			{ 
				ifvare tmp 1
				{
					state bloodspraystate 
					subvar extra 10
					setactor[THISACTOR].extra extra
					ifvarg extra 0 { sound AZOMPAIN ai AIZOMBIEFALLING } else { addkills 1 state bloodsprayshit ifrnd 85 soundonce AZOMDIE1 else ifrnd 85 soundonce AZOMDIE2 else soundonce AZOMDIE3 ifrnd 64 { state bloodspraystate ai AIZOMBIEDYING setprojectile[ZOMBIEHEAD].vel 60 ezshoot 256 ZOMBIEHEAD getactor[RETURN].z z addvar z -3800 setactor[RETURN].z z } else ai AIZOMBIEFALLING }
				} 
				else
				{
					sound AZOMSWIP 
					getactor[THISACTOR].ang ang
					setactor[PLAYERID].htang ang
					setactor[PLAYERID].htextra 10 
					getactor[PLAYERID].htextra paextra
					state checkb_armor
					palfrom 32 0 0 0
				}
				resetactioncount 
			} 
			else 
			ifcount 26 ai AIZOMBIERANDOM 
	}   
	ifai AIZOMBIESTAYPUT { ai AIZOMBIERANDOM }
} else
{
	ifhitweapon { state checkzombiehitstate }
	ifai NO { strength 40 sizeat 24 24 cstat 257 ai AIZOMBIESTAYPUT }
	ifai AIZOMBIESHOOT { ifcount 26 ai AIZOMBIERANDOM }
	ifai AIZOMBIEWALK { ai AIZOMBIERANDOM }
	ifai AIZOMBIERANDOM { ifrnd 4 { randvar ang 2048 setactor[THISACTOR].ang ang } ifcount 390 { ai AIZOMBIESTAYPUT resetcount break } } 
}
ifai AIZOMBIEGOTHIT { ifcount 5 ai AIZOMBIERANDOM }
ifai AIZOMBIEGETUP { cstat 257 ifactioncount 2 ai AIZOMBIERANDOM }
ifai AIZOMBIEDYING { cstat 0 ifactioncount 6 ai AIZOMBIEDEAD }
ifai AIZOMBIEFALLING { cstat 0 ifactioncount 4 ai AIZOMBIEDEAD2 }
ifai AIZOMBIEDEAD2 { cstat 0 ifvarg extra 0 ifcount 45 ai AIZOMBIEGETUP }
ifai AIZOMBIEGUTS { cstat 128 ifactioncount 6 { cstat 128 ai AIZOMBIEGUTS2 } }
	
enda

//---------------------------INNOCENT CODE 

actor CIVILIANSTOPED 
sizeat 50 50
ifcansee { spawn CIVILIAN killit }
enda

action ACIVILIANSTAND 44 2 5 1 40
action ACIVILIANWALK 0 4 5 1 12
action ACIVILIANDYING 30 8 1 1 12
action ACIVILIANDEAD 38 1 1 1 12

move CIVILIANWALK 180
move CIVILIANSTOP 0

ai AICIVILIANWALKING ACIVILIANWALK CIVILIANWALK randomangle
ai AICIVILIANSTOP ACIVILIANSTAND CIVILIANSTOP
ai AICIVILIANDYING ACIVILIANDYING CIVILIANSTOP
ai AICIVILIANDEAD ACIVILIANDEAD CIVILIANSTOP

state civilianhurt
ifwasweapon RPG { addkills 1 spawn BURNINGGUY killit } else ifwasweapon RADIUSEXPLOSION { addkills 1 spawn BURNINGGUY killit }
else ifdead { addkills 1 guts JIBS6 10 soundonce ISCREAM2 ai AICIVILIANDYING } else { spawn BLOOD sound DUKE_LONGTERM_PAIN5 guts JIBS6 3 ai AICIVILIANWALKING break }
ends

actor CIVILIAN TOUGH state enemyeffects
fall 
//ifmove 0 { sound 8 }
ifaction 0 ifcansee { sizeat 24 24 cstat 257 ai AICIVILIANWALKING }
ifhitweapon { state civilianhurt break }
ifai AICIVILIANWALKING { ifrnd 1 { ai AICIVILIANSTOP break } }
ifai AICIVILIANSTOP { ifrnd 128 { ifcount 50 { ai AICIVILIANWALKING resetcount break } }
else { ifcount 150 { ai AICIVILIANWALKING resetcount break } } }
ifai AICIVILIANDYING { cstat 0 ifactioncount 8 { sound THUD ai AICIVILIANDEAD } }
enda

//------------------------------HELL DOG CODE

action AHELLDOGWALK  0  7  5  1  7
action AHELLDOGBITE 35 3 5 1 10
action AHELLDOGDYING 405 7 1 1 10
action AHELLDOGDEAD 412 1 1 1 10

move HELLDOGWALK 200
move HELLDOGSTOP 

ai AIHELLDOGWALK AHELLDOGWALK HELLDOGWALK faceplayer seekplayer
ai AIHELLDOGASS AHELLDOGWALK HELLDOGWALK randomangle
ai AIHELLDOGRANDOM AHELLDOGWALK HELLDOGWALK randomangle
ai AIHELLDOGBITE AHELLDOGBITE HELLDOGSTOP faceplayer 
ai AIHELLDOGDYING AHELLDOGDYING HELLDOGSTOP
ai AIHELLDOGDEAD AHELLDOGDEAD HELLDOGSTOP

state helldoghurt
ifwasweapon RPG { addkills 1 state squishcode killit } else ifwasweapon RADIUSEXPLOSION { addkills 1 state squishcode killit }
else ifdead { addkills 1 guts JIBS6 10 soundonce DRON_DYING ai AIHELLDOGDYING } else { spawn BLOOD sound PIG_PAIN guts JIBS6 5 }
ends

actor HELLDOG fall state enemyeffects
ifhitweapon { state helldoghurt }
ifai NO ifcansee { strength 60 sizeat 30 30 cstator 257 ai AIHELLDOGWALK sound BOS2_ROAM }
ifai AIHELLDOGWALK { ifrnd 3 sound COMM_RECOG else ifpdistl 1000 ai AIHELLDOGBITE else ifrnd 4 ai AIHELLDOGRANDOM else ifp pdead { ai AIHELLDOGASS } }
ifai AIHELLDOGASS { ifp palive ai AIHELLDOGWALK }
ifai AIHELLDOGRANDOM { ifpdistl 1000 ai AIHELLDOGBITE else ifrnd 6 ai AIHELLDOGWALK else ifnotmoving ai AIHELLDOGWALK }  
ifai AIHELLDOGBITE { ifpdistl 1000 ifcansee ifrnd 96 { sound OCTA_ATTACK2 addphealth -5 palfrom 32 32 } else ifrnd 64 ai AIHELLDOGWALK } 
ifai AIHELLDOGDYING { cstat 0 ifactioncount 7 { sound THUD ai AIHELLDOGDEAD } }
enda

//------------------------------BONE EEL CODE

action AFISHWALK  0  3  5  1  20
action AFISHBITE 5 2 5 1 7
action AFISHDYING -413 7 1 1 10
action AFISHDEAD -409 1 1 1 10

move FISHWALK 130
move FISHSTOP 

ai AIFISHWALK AFISHWALK FISHWALK faceplayer seekplayer
ai AIFISHBITE AFISHBITE FISHSTOP faceplayer 
ai AIFISHRANDOM AFISHWALK FISHWALK randomangle 
ai AIFISHASS AFISHWALK FISHWALK randomangle 
ai AIFISHDYING AFISHDYING FISHSTOP
ai AIFISHDEAD AFISHDEAD FISHSTOP

state fishhurt
ifwasweapon RPG { addkills 1 state squishcode killit } else ifwasweapon RADIUSEXPLOSION { addkills 1 state squishcode killit }
else ifdead { addkills 1 guts JIBS6 10 soundonce DRON_DYING ai AIFISHDYING } else { spawn BLOOD guts JIBS6 3 ai AIFISHRANDOM }
ends

actor FISH TOUGH state enemyeffects
ifhitweapon { state fishhurt }
ifai NO ifcansee { strength TOUGH sizeat 25 25 cstator 257 ai AIFISHWALK }
ifai AIFISHWALK { ifpdistl 1000 ai AIFISHBITE else ifrnd 5 ai AIFISHRANDOM } 
ifai AIFISHRANDOM { ifpdistl 1000 ai AIFISHBITE else ifrnd 5 ai AIFISHWALK else ifnotmoving ai AIFISHWALK else ifp pdead { ai AIFISHASS } } 
ifai AIFISHASS { ifp palive ai AIFISHWALK }
ifai AIFISHDEAD fall
ifai AIFISHBITE { ifpdistl 1000 ifcansee ifrnd 56 { sound OCTA_ATTACK2 addphealth -1 palfrom 32 32 } else ifrnd 64 ai AIFISHWALK } 
ifai AIFISHDYING { cstat 0 fall ifactioncount 7 { ai AIFISHDEAD } }
enda

//------------------------------FAT RAT CODE

action AFATRATWALK  0  4  5  1  20
action AFATRATBITE 5 2 5 1 7
action AFATRATDYING 20 5 1 1 14
action AFATRATDEAD 25 1 1 1 10

move FATRATWALK 90
move FATRATSTOP 

ai AIFATRATWALK AFATRATWALK FATRATWALK faceplayer seekplayer
ai AIFATRATGOAWAY AFATRATWALK FATRATWALK randomangle
ai AIFATRATBITE AFATRATBITE FATRATSTOP faceplayer 
ai AIFATRATDYING AFATRATDYING FATRATSTOP
ai AIFATRATDEAD AFATRATDEAD FATRATSTOP

state fatrathurt
ifwasweapon RPG { addkills 1 state squishcode killit } else ifwasweapon RADIUSEXPLOSION { addkills 1 state squishcode killit }
else ifdead { addkills 1 guts JIBS6 10 soundonce STEPNIT ai AIFATRATDYING } else { guts JIBS6 3 }
ends

actor FATRAT fall state enemyeffects cstat 257
ifhitweapon { state fatrathurt }
ifai NO ifcansee { strength 15 sizeat 20 20 cstator 257 ai AIFATRATWALK sound RATTY }
ifai AIFATRATWALK { ifrnd 1 sound RATTY else ifpdistl 850 ai AIFATRATBITE else ifp pdead { ai AIFATRATGOAWAY } } 
ifai AIFATRATBITE { ifpdistl 850 ifcansee ifrnd 10 { sound NEWBEAST_ATTACK sound RATTY addphealth -1 palfrom 32 32 } else ifrnd 64 ai AIFATRATWALK } 
ifai AIFATRATDYING { sizeat 40 40 cstat 128 ifactioncount 5 { cstat 0 ai AIFATRATDEAD } }
ifai AIFATRATGOAWAY { ifp palive ai AIFATRATWALK } 
enda

//------------------------------BAT CODE

useractor enemy BATSLEEP WEAK sizeat 35 35
ifcansee ifpdistl 5000 ifcount 16 { soundonce RATTY spawn BAT killit }
ifhitweapon { guts JIBS6 5 killit }
enda

action ABAT   0  4  5  1  8
action ABATSTOP   0  3  5  1  8

move BATSTOP 0
move BATDOWN 150 80
move BATUP 150 -100
move BATFASTUP 400 -200
move BATFASTDOWN 450 200

ai AIBATSTOP ABATSTOP BATSTOP getv geth
ai AIBATDOWN ABAT BATDOWN randomangle getv
ai AIBATUP ABAT BATUP faceplayer seekplayer getv
ai AIBATFASTDOWN ABAT BATFASTDOWN seekplayer getv
ai AIBATFASTUP ABAT BATFASTUP randomangle


actor BAT WEAK state enemyeffects
ifai NO { cstat 257 sizeat 30 30 strength WEAK ai AIBATSTOP }
ifhitweapon { guts JIBS6 3 killit }
ifai AIBATSTOP { ifpdistl 6000 { ai AIBATUP } else { ifpdistl 1000 ifrnd 32 ifcansee { ai AIBATDOWN } ifrnd 1 ai AIBATFASTUP } }
ifai AIBATDOWN { ifpdistl 1000 ifrnd 32 ifcansee { ai AIBATDOWN } else { ifp phigher { soundonce RATTY ai AIBATFASTUP } else ifrnd 16 ai AIBATUP } }
ifai AIBATUP { ifpdistl 1000 ifrnd 32 ifcansee { ai AIBATDOWN } else { ifp phigher ai AIBATDOWN else ai AIBATFASTDOWN } else ifrnd 16 ai AIBATFASTUP else ifpdistl 1000 ai AIBATDOWN }
ifai AIBATFASTUP ifceilingdistl 10 { ifrnd 64 ai AIBATDOWN }
ifai AIBATFASTDOWN iffloordistl 10 ifrnd 64 { ifpdistl 1000 ifrnd 32 ifcansee { ai AIBATDOWN } ai AIBATFASTUP } else ifrnd 1 ai AIBATDOWN
ifp pdead ai AIBATSTOP
ifnotmoving { ifrnd 32 ai AIBATDOWN else ai AIBATUP }
ifrnd 6 ai AIBATFASTUP
enda

//------------------------------BLOATED BUTCHER CODE

action ABUTCHERWALK  0  4  5  1  20
action ABUTCHERATTACK1 48 5 5 1 10
action ABUTCHERATTACK2 48 2 5 1 25
action ABUTCHERATTACK3 2234 3 5 1 15
action ABUTCHERDYING 30 6 1 1 10
action ABUTCHERDEAD 35 1 1 1 20

move BUTCHERWALK 70
move BUTCHERSTOP 

ai AIBUTCHERWALK ABUTCHERWALK BUTCHERWALK faceplayer seekplayer
ai AIBUTCHERASS ABUTCHERWALK BUTCHERWALK randomangle
ai AIBUTCHERRANDOM ABUTCHERWALK BUTCHERWALK randomangle
ai AIBUTCHERATTACK1 ABUTCHERATTACK1 BUTCHERSTOP faceplayer 
ai AIBUTCHERATTACK2 ABUTCHERATTACK2 BUTCHERSTOP faceplayer 
ai AIBUTCHERATTACK3 ABUTCHERATTACK3 BUTCHERSTOP faceplayer 
ai AIBUTCHERDYING ABUTCHERDYING BUTCHERSTOP
ai AIBUTCHERDEAD ABUTCHERDEAD BUTCHERSTOP

state butcherhurt
ifwasweapon RPG { addkills 1 spawn BURNINGGUY killit } else ifwasweapon RADIUSEXPLOSION { addkills 1 spawn BURNINGGUY killit }
else ifdead { addkills 1 guts JIBS6 10 soundonce STEPNIT ai AIBUTCHERDYING } else { sound DUKE_LAND_HURT spawn BLOOD guts JIBS6 3 }
ends

useractor enemy BUTCHER fall state enemyeffects
ifhitweapon { state butcherhurt }
ifai NO { strength 100 sizeat 30 30 cstator 257 ai AIBUTCHERWALK }
ifai AIBUTCHERWALK { ifrnd 2 ai AIBUTCHERRANDOM else ifpdistl 1000 ai AIBUTCHERATTACK1 else ifpdistl 5000 ifrnd 3 ai AIBUTCHERATTACK3 else ifrnd 6 ifcansee ai AIBUTCHERATTACK2 else ifp pdead { ai AIBUTCHERASS } }
ifai AIBUTCHERASS { ifp palive ai AIBUTCHERWALK }
ifai AIBUTCHERRANDOM { ifrnd 2 ai AIBUTCHERWALK else ifpdistl 1000 ai AIBUTCHERATTACK1 else ifpdistl 5000 ifrnd 3 ai AIBUTCHERATTACK3 else ifrnd 8 ifcansee ai AIBUTCHERATTACK2 } 
ifai AIBUTCHERATTACK1 { ifpdistl 1000 ifcansee ifactioncount 2 { sound SQUISHED addphealth -5 palfrom 32 32 resetactioncount } else ifcount 20 ai AIBUTCHERWALK } 
ifai AIBUTCHERATTACK2 { ifcansee ifactioncount 2 { shoot FIRELASER resetactioncount } else ifcount 25 ai AIBUTCHERWALK } 
ifai AIBUTCHERATTACK3 { ifpdistl 7000 ifcansee ifactioncount 1 { soundonce STEPNIT sound VOL4ENDSND2 sound DUKE_GRUNT shoot SPIT resetactioncount } else ifcount 30 ai AIBUTCHERWALK } 
ifai AIBUTCHERDYING { cstat 0 ifactioncount 6 { sound VOL4ENDSND2 ai AIBUTCHERDEAD } }
enda

define MONSTER 6590
define BONE 6582
define BONEHIT 6651
define DEADMONSTER 6659

spriteshadow BONE
defineprojectile BONE PROJ_WORKSLIKE 32770
defineprojectile BONE PROJ_HITRADIUS 0
defineprojectile BONE PROJ_VEL 500
defineprojectile BONE PROJ_DROP -80
defineprojectile BONE PROJ_XREPEAT 32
defineprojectile BONE PROJ_YREPEAT 32
defineprojectile BONE PROJ_OFFSET -2048
defineprojectile BONE PROJ_ISOUND DUKE_CRACK_FIRST
defineprojectile BONE PROJ_EXTRA 20
defineprojectile BONE PROJ_SPAWNS BONEHIT

action ABONE 0 4 1 1 6
actor BONEHIT 0 ABONE
sizeat 40 40 ifactioncount 4 killit enda

//------------------------------MONSTER

action AMONSTERWALK 0 4 5 1 10
action AMONSTERSHOOT 20 6 5 1 10

move MONSTERWALK 250 40
move MONSTERUP 250 -140
move MONSTERSTOP

ai AIMONSTERWALK AMONSTERWALK MONSTERWALK faceplayer seekplayer
ai AIMONSTERUP AMONSTERWALK MONSTERUP faceplayer seekplayer
ai AIMONSTERSHOOT AMONSTERSHOOT MONSTERSTOP faceplayer

spriteshadow MONSTER
actor MONSTER

ifai NO ifcansee { sound DUKE_CRACK_FIRST strength 280 sizeat 30 30 cstator 257 ai AIMONSTERWALK }
ifhitweapon { ifdead { addkills 1 guts JIBS6 10 spawn DEADMONSTER killit } else { spawn BLOOD sound PISTOL_BODYHIT guts JIBS6 3 ifrnd 32 sound DUKE_CRACK_FIRST } }
ifai AIMONSTERWALK { ifrnd 3 ai AIMONSTERUP else ifrnd 4 soundonce DUKE_CRACK_FIRST ifrnd 3 ifcansee ai AIMONSTERSHOOT else ifp phigher { ifcount 10 ai AIMONSTERUP } }
ifai AIMONSTERUP { ifrnd 5 ifcansee ai AIMONSTERSHOOT else ifp pdead ifcount 30 ai AIMONSTERWALK }
ifai AIMONSTERSHOOT { ifactioncount 4 { sound DUKE_CRACK_FIRST shoot BONE resetactioncount } else ifcount 20 ai AIMONSTERWALK }
enda

action ADEADMONSTER1 0 6 1 1 16
action ADEADMONSTER2 5 0 0 0 15
spriteshadow DEADMONSTER
actor DEADMONSTER fall cstat 0 sizeat 30 30
ifaction 0 { sound DUKE_CRACK_FIRST action ADEADMONSTER1 }
ifaction ADEADMONSTER1 ifactioncount 6 action ADEADMONSTER2
enda