//===========================================================================
//
// Arch Vile
//
//===========================================================================

ACTOR TehArchvile: Archvile Replaces Archvile
{
	Game Doom
	SpawnID 111
	Radius 20
	Height 56
    damagefactor "Crush", 10.0
	Mass 500
	Speed 15
	PainChance 10
	PainChance "Kick", 90
	damagefactor "Avoid", 0.0
	Monster
	MaxTargetRange 896
	+QUICKTORETALIATE 
	+FLOORCLIP 
	+NOTARGET
    DamageType Rape
	DropItem "Berserker" 5
	SeeSound "vile/sight"
	PainSound "vile/pain"
	DeathSound "vile/death"
	ActiveSound "vile/active"
	MeleeSound "vile/stop"
	Obituary "%o was exploded by an Arch-Vile."
damagefactor "Blood", 0.0 damagefactor "BlueBlood", 0.0 damagefactor "GreenBlood", 0.0
	States
	{
	Spawn:
		DIAB B 10 A_Look
		Loop
	See:
        TNT1 A 0 A_SpawnItemEx("FootStep", 0, 0)
		DIAB AABBCCDDCCBB 2 A_VileChase
		Loop
	Missile:
		DIAB E 0 BRIGHT A_VileStart
		DIAB E 10 A_FaceTarget 
		DIAB E 1 A_VileTarget 
		DIAB E 7 A_VileTarget

        
		DIAB E 1 A_VileTarget 
        TNT1 A 0 A_CustomMissile ("SmallFlameTrails", 85, 35, random (0, 40), 2, random (0, 160))
        TNT1 A 0 A_CustomMissile ("SmallFlameTrails", 85, -35, random (0, 40), 2, random (0, 160))
        DIAB E 3 A_FaceTarget
        TNT1 A 0 A_CustomMissile ("SmallFlameTrails", 85, 35, random (0, 40), 2, random (0, 160))
        TNT1 A 0 A_CustomMissile ("SmallFlameTrails", 85, -35, random (0, 40), 2, random (0, 160))
        DIAB F 3 BRIGHT A_FaceTarget
		
		DIAB F 3 BRIGHT A_FaceTarget
		DIAB E 1 A_VileTarget 
        TNT1 A 0 A_CustomMissile ("SmallFlameTrails", 85, 35, random (0, 40), 2, random (0, 160))
        TNT1 A 0 A_CustomMissile ("SmallFlameTrails", 85, -35, random (0, 40), 2, random (0, 160))
        DIAB E 3 A_FaceTarget 
        TNT1 A 0 A_CustomMissile ("SmallFlameTrails", 85, 35, random (0, 40), 2, random (0, 160))
        TNT1 A 0 A_CustomMissile ("SmallFlameTrails", 85, -35, random (0, 40), 2, random (0, 160))
        DIAB F 3 BRIGHT A_FaceTarget
		DIAB E 1 A_VileTarget 
        TNT1 A 0 A_CustomMissile ("SmallFlameTrails", 85, 35, random (0, 40), 2, random (0, 160))
        TNT1 A 0 A_CustomMissile ("SmallFlameTrails", 85, -35, random (0, 40), 2, random (0, 160))
        DIAB E 3 A_FaceTarget
        TNT1 A 0 A_CustomMissile ("SmallFlameTrails", 85, 35, random (0, 40), 2, random (0, 160))
        TNT1 A 0 A_CustomMissile ("SmallFlameTrails", 85, -35, random (0, 40), 2, random (0, 160))
        DIAB F 3 BRIGHT A_FaceTarget
		DIAB E 1 A_VileTarget 
        TNT1 A 0 A_CustomMissile ("SmallFlameTrails", 85, 35, random (0, 40), 2, random (0, 160))
        TNT1 A 0 A_CustomMissile ("SmallFlameTrails", 85, -35, random (0, 40), 2, random (0, 160))
        DIAB E 3 A_FaceTarget
        TNT1 A 0 A_CustomMissile ("SmallFlameTrails", 85, 35, random (0, 40), 2, random (0, 160))
        TNT1 A 0 A_CustomMissile ("SmallFlameTrails", 85, -35, random (0, 40), 2, random (0, 160))
        DIAB F 3 BRIGHT A_FaceTarget
		
		DIAB JKLMN 3 BRIGHT A_FaceTarget 
		DIAB O 3 BRIGHT A_VileAttack
		DIAB P 3 BRIGHT
		Goto See
	Heal:
DIAB E 3
		Goto See //Had to remove it for now due some bugs.
	Pain:
		DIAB Q 5   
		DIAB Q 5 A_Pain
		Goto See

	Pain.Kick:
        TNT1 A 0 A_FaceTarget
        TNT1 A 0 A_Recoil(8)
		DIAB Q 10 A_Pain  
		DIAB Q 10
		Goto See


	Death:
       
		TNT1 A 0 A_Scream 
		TNT1 A 0 A_NoBlocking
		DIAB RSTUVWX 5 A_SpawnItem ("MuchBlood", 40)
		TNT1 A 0 A_SpawnItem ("MediumBloodSpot")
		DIAB X -1
		Stop
		
	Death.Shotgun:
	Death.Cutless:
	Death.Cut:
	TNT1 A 0
	TNT1 A 0 A_JumpIfCloser(400, "BrutalDeath")
	TNT1 A 0
	Goto Death
	
	BrutalDeath:
	TNT1 A 0
	TNT1 A 0 A_Scream
	TNT1 AA 0 A_CustomMissile ("XDeath1", 32, 0, random (0, 360), 2, random (60, 120))
	TNT1 A 0 A_CustomMissile ("XDeath2", 32, 0, random (0, 360), 2, random (60, 120))
	TNT1 A 0 A_CustomMissile ("XDeath3", 32, 0, random (0, 360), 2, random (60, 120))
	TNT1 A 0 A_CustomMissile ("XDeath4", 52, 0, random (0, 360), 2, random (60, 120))
	TNT1 AA 0 A_CustomMissile ("Instestin", 32, 0, random (0, 360), 2, random (60, 120))
	TNT1 A 0 A_CustomMissile ("XDeathArchVileLeg", 32, 0, random (0, 360), 2, random (60, 120))
	TNT1 A 0 A_CustomMissile ("XDeathArchVile", 64, 0, random (0, 360), 2, random (60, 120))
	VILE STUV 6
	VILE V -1
	Stop


	XDeath:
       
		 TNT1 AA 0 A_CustomMissile ("XDeath1", 32, 0, random (0, 360), 2, random (0, 160))
		 TNT1 AA 0 A_CustomMissile ("XDeath2", 32, 0, random (0, 360), 2, random (0, 160))
		 TNT1 AA 0 A_CustomMissile ("XDeath3", 32, 0, random (0, 360), 2, random (0, 160))
		 TNT1 AA 0 A_CustomMissile ("XDeath4", 32, 0, random (0, 360), 2, random (0, 160))
		 TNT1 AAAAA 0 A_CustomMissile ("Instestin", 32, 0, random (0, 360), 2, random (0, 160))
		VIGI C 4 A_Scream
		VIGI D 4 
		VIGI E 4 A_NoBlocking
		VIGI FGHIJ 4
		TNT1 A 0 A_SpawnItem ("MediumBloodSpot")
		VIGI J -1
		Stop
Death.SuperPlasma:
    Death.Plasma: Death.Plasma2:
        TNT1 A 0
        TNT1 A 0 A_XScream
        TNT1 A 0 A_NoBlocking
        TNT1 AAA 0 A_CustomMissile ("Nashgore_FlyingBlood", 50, 0, random (0, 360), 2, random (0, 160))
	    TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat3", 32, 0, random (0, 360), 2, random (0, 160))
	    TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat2", 32, 0, random (0, 360), 2, random (0, 160))
	    TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat", 32, 0, random (0, 360), 2, random (0, 160))
		EXPL AAAAAA 0 A_CustomMissile ("ExplosionSmoke", 32, 0, random (0, 360), 2, random (0, 360))
        CARB MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 10 A_CustomMissile ("SmallSmoke", 1, 0, random (0, 360), 2, random (0, 160))
        CARB M -1
        Stop
		
	    Death.Fire:
        TNT1 A 0
        TNT1 A 0 A_Scream
        TNT1 A 0 A_NoBlocking
		TNT1 A 0 A_Playsound("props/redfire")
        TNT1 AAA 0 A_CustomMissile ("Nashgore_FlyingBlood", 50, 0, random (0, 360), 2, random (0, 160))
	    TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat3", 32, 0, random (0, 360), 2, random (0, 160))
	    TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat2", 32, 0, random (0, 360), 2, random (0, 160))
	    TNT1 A 0 A_CustomMissile ("XDeathBurnedMeat", 32, 0, random (0, 360), 2, random (0, 160))
		CARB MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 2 A_CustomMissile ("FlameTrails", 15, 0, random (0, 360), 2, random (70, 130))
        CARB MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM 10 A_CustomMissile ("SmallSmoke", 15, 0, random (0, 360), 2, random (70, 130))
        CARB M -1
        Stop

    Death.Fatality:
	    TNT1 A 0 A_GiveToTarget("GoFatality", 1)
        TNT1 A 0 A_NoBlocking
        TNT1 A 0 A_GiveToTarget("ArchvileFatality", 1)
        Stop

    Crush:
        TNT1 A 0 A_PlaySound("misc/xdeath4")
        CRS2 A 5
        CRS2 A -1
        Stop

    Pain.KillMe:
    Pain.Taunt:
        TNT1 A 0
        Goto Missile
    Death.KillMe:
    Death.Taunt:
	    TNT1 A 0 A_ChangeFlag("SOLID", 0)
        TNT1 A 0 A_SpawnItem("ArchVile")
        Stop
	}
}

ACTOR ArchvileFire2 Replaces ArchvileFire
{
	Game Doom
    Scale 1.0
	+NOBLOCKMAP +NOGRAVITY
	RenderStyle Add
	Alpha 0.6
	States
	{
	Spawn:
		TNT1 A 0 A_CustomMissile("RealFlameTrailsSmall",random(4,10),random(-10,10),random(0,360),2,random(70,110))
		TNT1 A 2 bright A_StartFire
		TNT1 A 0 A_CustomMissile("RealFlameTrailsSmall",random(4,10),random(-10,10),random(0,360),2,random(70,110))
		TNT1 B 2 bright A_Fire
		TNT1 A 0 A_CustomMissile("RealFlameTrailsSmall",random(4,10),random(-10,10),random(0,360),2,random(70,110))
		TNT1 A 2 bright A_Fire
		TNT1 A 0 A_CustomMissile("RealFlameTrailsSmall",random(4,10),random(-10,10),random(0,360),2,random(70,110))
		TNT1 B 2 bright A_Fire
		TNT1 A 0 A_CustomMissile("RealFlameTrailsSmall",random(4,10),random(-10,10),random(0,360),2,random(70,110))		
		TNT1 C 2 bright A_FireCrackle
		 
		 		
		TNT1 B 2 bright A_Fire
		 
		 		
		TNT1 C 2 bright A_Fire
		 
		 		
		TNT1 B 2 bright A_Fire
		 
		 		
		TNT1 C 2 bright A_Fire
		 
		 		
		TNT1 D 2 bright A_Fire
		 
		 		
		TNT1 C 2 bright A_Fire
		 
		 		
		TNT1 D 2 bright A_Fire
		 
		 		
		TNT1 C 2 bright A_Fire
		 
		 		
		TNT1 D 2 bright A_Fire
		 
		 		
		TNT1 E 2 bright A_Fire
		 
		 
		TNT1 D 2 bright A_Fire
		 
		 		
		TNT1 E 2 bright A_Fire
		 
		 		
		TNT1 D 2 bright A_Fire
		 
		 
		TNT1 E 2 bright A_FireCrackle
 		 
		 
		TNT1 F 2 bright A_Fire
		 
		 		
		TNT1 E 2 bright A_Fire
		 
		 		
		TNT1 F 2 bright A_Fire
		 
		 		
		TNT1 E 2 bright A_Fire
		 
		 		
		TNT1 F 2 bright A_Fire
		 
		 		
		TNT1 G 2 bright A_Fire
		 
		 		
		TNT1 H 2 bright A_Fire
			
		TNT1 G 2 bright A_Fire
		
		TNT1 H 2 bright A_Fire
				
		TNT1 G 2 bright A_Fire
		TNT1 A 0
		TNT1 H 2 bright A_Fire
		
		Stop
		
	}
}


ACTOR HalfArchVile1
{
    Radius 1
    Height 8
    Speed 8
    Scale 1.5
	Mass 1
	BounceFactor 0.3
	+DOOMBOUNCE
    +NOBLOCKMAP
	+MISSILE
    +NOTELEPORT
    +MOVEWITHSECTOR
    +CLIENTSIDEONLY
	Decal BloodSuper
    SeeSound "misc/xdeath4"
    DeathSound "misc/xdeath3"
    States
    {
    Spawn:
	    TNT1 A 0 A_JumpIf(waterlevel > 1, "Splash")
        VIGP A 4 A_CustomMissile("BloodTrails",0,0,180,2)
        Loop
    Death:
        TNT1 AAAAAAA 0 A_CustomMissile ("NashGore_FlyingBloodTrail5", 0, 0, random (0, 180), 2, random (0, 180))
        TNT1 A 0 A_SpawnItem("NashGore_BloodSpot",0,0,0,1)
        VIGP B 1
        VIGP B -1
        Splash:
        TNT1 A 1
        Stop
    }
}

ACTOR HalfArchVile2
{
    Radius 1
    Height 8
    Speed 8
    Scale 1.5
	Mass 1
	BounceFactor 0.3
	+DOOMBOUNCE
    +NOBLOCKMAP
	+MISSILE
    +NOTELEPORT
    +MOVEWITHSECTOR
    +CLIENTSIDEONLY
	Decal BloodSuper
    SeeSound "misc/xdeath4"
    DeathSound "misc/xdeath3"
    States
    {
    Spawn:
	    TNT1 A 0 A_JumpIf(waterlevel > 1, "Splash")
        VIGP C 4 A_CustomMissile("BloodTrails",0,0,180,2)
        Loop
    Death:
        TNT1 AAAAAAA 0 A_CustomMissile ("NashGore_FlyingBloodTrail5", 0, 0, random (0, 180), 2, random (0, 180))
        TNT1 A 0 A_SpawnItem("NashGore_BloodSpot",0,0,0,1)
        VIGP D 1
        VIGP D -1
        Splash:
        TNT1 A 1
        Stop
    }
}


actor FatalizedArchVile1: CurbstompedMarine
{
    States
    {
    Spawn:
AVF1 Z 1 A_SpawnItem("NashGore_BloodSpot",0,0,0,1)
AVF1 Z -1
       Stop    }}