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

ACTOR TehArchvile: Archvile Replaces Archvile
{
	Game Doom
	SpawnID 111
	Radius 20
	Height 56
    damagefactor "Crush", 10.0
	Mass 500
	Speed 15
	Health 750
	PainChance 10
	PainChance "Kick", 90
	damagefactor "Avoid", 0.0
	damagefactor "GibRemoving", 0.0
	DamageFactor "CauseObjectsToSplash", 0.0
	BloodType "Brutal_Blood", "BloodSPlatterReplacer", "SawBlood"
	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"
	damagefactor "TeleportRemover", 0.0
	Obituary "%o was exploded by an Arch-Vile."
damagefactor "Blood", 0.0 damagefactor "BlueBlood", 0.0 damagefactor "GreenBlood", 0.0
	States
	{
	ReplaceVanilla:
		TNT1 A 0 A_ChangeFlag("THRUACTORS", 1)
		TNT1 A 0 A_ChangeFlag("COUNTKILL", 0)
		TNT1 A 0 A_SpawnItemEx ("VanillaArchvile",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
		Stop
    Spawn:
		TNT1 A 0
		MARN A 0 ACS_ExecuteAlways(177, 0, 0, 0, 0)//Check if you are playing on an Wolfenstein level
		TNT1 A 0 ACS_ExecuteAlways(796, 0, 0, 0, 0)//Check if Vanilla Mode is activated
		
	Spawn2:	
		DIAB B 9 A_Look
		Loop
	See:
        //TNT1 A 0 A_SpawnItemEx("FootSep", 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:
        TNT1 A 0 
		TNT1 A 0 A_SpawnItem("PentagramSpawner")
		DIBR X 10 BRIGHT
		Goto See
	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 ("GrowingBloodPool")
		DIAB X -1
		Stop
		
	Death.Shotgun:
	Death.Cutless:
	Death.Cut:
	Death.Saw:
	TNT1 A 0
	TNT1 A 0 A_JumpIfCloser(400, "BrutalDeath")
	TNT1 A 0
	Goto Death
	
	BrutalDeath:
	Death.Desintegrate:
	TNT1 A 0
	TNT1 A 0 A_Scream
	TNT1 AA 0 A_CustomMissile ("XDeath1", 32, 0, random (0, 360), 2, random (60, 120))
	TNT1 AA 0 A_CustomMissile ("XDeath2b", 52, 0, random (0, 360), 2, random (60, 120))
	TNT1 AA 0 A_CustomMissile ("XDeath3b", 52, 0, random (0, 360), 2, random (60, 120))
	TNT1 AAAA 0 A_CustomMissile ("SuperWallRedBlood", 32, 0, random (170, 190), 2, random (0, 40))
	TNT1 AAAA 0 A_CustomMissile ("BloodMistBig", 40, 0, random (0, 360), 2, random (30, 90))
	TNT1 AAA 0 A_CustomMissile ("Instestin", 32, 0, random (0, 360), 2, random (60, 120))
	XVIL ABCDEFGHIJKLMNOPQ 2 A_NoBlocking
	TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
	XVIL Q -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 AAAAAA 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 ("GrowingBloodPool")
		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 ("Brutal_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 ("Brutal_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_Pain
	    TNT1 A 0 A_JumpIfIntargetInventory("FistsSelected", 1, 1)
		Goto BrutalDeath
	    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
	
	Death.Ice:
	Death.Freeze:
	Death.Frost:
	TNT1 A 0 A_ChangeFlag("SHOOTABLE", 0)
	TNT1 A 0 A_ChangeFlag("SOLID", 0)
	TNT1 A 0 A_SpawnItem("FrozenArchvile")
	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 ("Brutal_FlyingBloodTrail5", 0, 0, random (0, 180), 2, random (0, 180))
        TNT1 A 0 A_SpawnItem("Brutal_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 ("Brutal_FlyingBloodTrail5", 0, 0, random (0, 180), 2, random (0, 180))
        TNT1 A 0 A_SpawnItem("Brutal_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("Brutal_BloodSpot",0,0,0,1)
AVF1 Z -1
       Stop    }}