ACTOR TheLostSoul : LostSoul Replaces LostSoul
{
	Game Doom
	Health 100
	Radius 16
	Height 32
	Mass 50
	Speed 12
	DeathHeight 4
	BurnHeight 0
	Damage (random(16,16))
	PainChance 255

	Damagefactor "Avoid", 1.0	Damagefactor "BHFTOnBarrel", 0.0	Damagefactor "Blood", 0.0
	Damagefactor "CancelTeleportFog", 0.0	Damagefactor "CauseWaterSplash", 0.0
	Damagefactor "GibRemoving", 0.0	Damagefactor "Glass", 0.0	Damagefactor "HangingHook", 0.0
	Damagefactor "Head", 0.0	Damagefactor "PussyGrab", 100.0	Damagefactor "Repair", 0.0
	Damagefactor "RevenantHitStomach", 0.0	Damagefactor "SpawnMarine", 0.0	Damagefactor "Stealth", 0.0
	Damagefactor "TeleportRemover", 0.0	Damagefactor "Use", 0.0	Damagefactor "Burn", 0.5
	Damagefactor "Fire", 0.5	Damagefactor "Flames", 0.5	Damagefactor "GreenFire", 0.5
	Damagefactor "HumanBBQ", 0.5	Damagefactor "SSG", 5.0	DamageFactor "TankWeakSpot", 0.0
	Damagefactor "ExtremePunches", 5.0	Damagefactor "Fatality", 5.0	Damagefactor "HelperMarineFatallity", 5.0

	PainChance "Avoid", 64	PainChance "Head", 255	PainChance "PussyGrab", 255
	PainChance "Taunt", 255
	PainChance "Burn", 16	PainChance "Fire", 16	PainChance "Flames", 16
	PainChance "GreenFire", 16	PainChance "HumanBBQ", 16

	DropItem "HealthPlusNoCount", 16
	Monster
	+FLOAT +NOGRAVITY +DONTFALL
	+NOICEDEATH +NOBLOODDECALS
	+FORCEXYBILLBOARD +DONTHARMSPECIES +THRUSPECIES
	AttackSound "skull/melee"
	PainSound "skull/pain"
	DeathSound "LSOD"
	ActiveSound "skull/active"
	Obituary "$OB_SKULL"
	BloodType "LostSoulBlood"
	Tag "Lost Soul"
	Species "LostSoul"
	States
	{
	Pain.Avoid:
	  TNT1 A 0
	  TNT1 A 0 A_Jump(255, "AvoidLeft", "AvoidRight")
	  Goto AvoidLeft
	AvoidLeft:
		LSOL A 0 A_CustomMissile ("SoulTrails", 24, 0, random (0, 360), 2, random (0, 160))
	    TNT1 A 0 ThrustThing(angle*256/360+192, 15, 0, 0)
        LSOL B 6 A_FaceTarget
		LSOL A 0 A_CustomMissile ("SoulTrails", 24, 0, random (0, 360), 2, random (0, 160))
        LSOL B 6 A_FaceTarget
        Goto Missile
	AvoidRight:
	    LSOL A 0 A_CustomMissile ("SoulTrails", 24, 0, random (0, 360), 2, random (0, 160))
	    TNT1 A 0 ThrustThing(angle*256/360+64, 15, 0, 0)
        LSOL B 6 A_FaceTarget
		LSOL A 0 A_CustomMissile ("SoulTrails", 24, 0, random (0, 360), 2, random (0, 160))
        LSOL B 6 A_FaceTarget
        Goto Missile

	Spawn:
		LSOL A 0
		TNT1 A 0 ACS_NamedExecuteAlways("BDCHeckClassicMonsters", 0, 0, 0, 0)//Check if Vanilla Mode is activated
		LSOL A 2
		TNT1 A 0 A_RadiusGive("SlaughterToken", 128, RGF_GIVESELF | RGF_MONSTERS |RGF_CUBE | RGF_NOSIGHT, 1)
		LSOL A 2
		TNT1 A 0 A_JumpIfInventory("SlaughterToken",15,"ReplaceVanilla")
		Goto Stand

	ReplaceVanilla:
		TNT1 A 0 A_ChangeFlag("COUNTKILL", 0)
		TNT1 A 2 A_ChangeFlag("NOINTERACTION", 1)
		TNT1 A 0 A_SpawnItemEx("VanillaLostSoul",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
		TNT1 A 2 Thing_Remove(0)
		Stop

	Idle:
	Stand:
		LSOL A 10 BRIGHT A_Look
		Loop

	See:
	    TNT1 A 0 A_Stop
		TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
		TNT1 A 0 A_TakeInventory("MaxLostSoulRange", 30)
		LSOL A 0 A_CustomMissile ("SoulTrails", 24, 0, random (0, 360), 2, random (0, 160))
		LSOL A 4 BRIGHT A_Chase
		TNT1 A 0 A_JumpIfCloser(160, "Retreat")
		LSOL A 0 A_CustomMissile ("SoulTrails", 24, 0, random (0, 360), 2, random (0, 160))
		LSOL A 4 BRIGHT A_Chase
		TNT1 A 0 A_JumpIfCloser(160, "Retreat")
		Loop

	Retreat:
		TNT1 A 0
        LSOL A 0 A_CustomMissile ("SoulTrails", 24, 0, random (0, 360), 2, random (0, 160))
		LSOL A 4 A_FaceTarget
		TNT1 A 0 A_Recoil(4)
        LSOL A 0 A_CustomMissile ("SoulTrails", 24, 0, random (0, 360), 2, random (0, 160))
		LSOL A 4 A_FaceTarget
		TNT1 A 0 A_Recoil(4)
        LSOL A 0 A_CustomMissile ("SoulTrails", 24, 0, random (0, 360), 2, random (0, 160))
		LSOL A 4 A_FaceTarget
		TNT1 A 0 A_Recoil(4)
        LSOL A 0 A_CustomMissile ("SoulTrails", 24, 0, random (0, 360), 2, random (0, 160))
		LSOL A 4 A_FaceTarget
		TNT1 A 0 A_Recoil(4)
	    Goto See

	Missile:
		TNT1 A 0
		TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
		LSOL B 4 BRIGHT A_SkullAttack
		LSOL B 0 BRIGHT A_CustomMissile ("SoulTrails", 24, 0, random (0, 360), 2, random (0, 160))
		TNT1 AAA 0
		TNT1 A 0 A_JumpIfInventory("MaxLostSoulRange", 5, "See")
		LSOL BB 4 BRIGHT A_CustomMissile ("SoulTrails", 24, 0, random (0, 360), 2, random (0, 160))
		LSOL BB 4 BRIGHT A_CustomMissile ("SoulTrails", 24, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 A_giveInventory("MaxLostSoulRange", 1)
		Goto Missile+4
	Pain:
		LSOL C 3 BRIGHT A_CustomMissile ("SoulTrails", 12, 0, random (0, 360), 2, random (0, 160))
        TNT1 A 0 A_Jump (64, 1)
        Goto Pain.Avoid
        TNT1 AAA 0
        TNT1 A 0 A_CustomMissile ("SoulTrails", 12, 0, random (0, 360), 2, random (0, 160))
		LSOL C 3 BRIGHT A_Pain
		Goto See

    //Death.Fatality:
	Death.PussyGrab:
	    TNT1 A 0 A_Pain
	    TNT1 A 0 A_JumpIfIntargetInventory("FistsSelected", 1, 1)
		Goto Death
        TNT1 A 0 A_GiveToTarget("LostSoulFatality", 1)
        TNT1 A 1
        TNT1 A 0
		Stop
	Death:
		LSOL F 4 BRIGHT A_NoBlocking
		TNT1 AAAA 0 A_CustomMissile ("SmallLSPart1", 0, 0, random (0, 360), 2, random (0, 360))
		TNT1 AAAA 0 A_CustomMissile ("SmallLSPart3", 0, 0, random (0, 360), 2, random (0, 360))
		TNT1 AAA 0 A_CustomMissile ("FireballExplosionFlamesSmall", 12, 0, random (0, 360), 2, random (0, 160))
		LSOL G 0 BRIGHT A_Scream
		EXPL AA 0 A_SpawnItem("ExplosionParticleSpawner")
		TNT1 A 0 A_SpawnItemEx ("ExplosionFlareSpawner",0,0,32,0,0,0,0,SXF_NOCHECKPOSITION,0)
		EXPL AAAAA 0 A_CustomMissile ("FireBallExplosionFlamesMedium", 32, 0, random (0, 360), 2, random (0, 360))
		TNT1 AAAA 0 A_CustomMissile ("PlasmaSmoke", 32, 0, random (0, 360), 2, random (0, 360))
		TNT1 AAA 0 A_CustomMissile ("LSpart1", 42, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0 A_CustomMissile ("LSpart3", 42, 0, random (0, 360), 2, random (0, 160))
		TNT1 AA 0 A_CustomMissile ("LSpart2", 42, 0, random (0, 360), 2, random (0, 160))
		TNT1 A 0
		LSOL HI 0
		Stop

    Pain.KillMe:
    Pain.Taunt:
        TNT1 A 0
		TNT1 A 0 HealThing(2)
        Goto Missile
    Death.KillMe:
    Death.Taunt:
	    Goto Death
	}
}

////// LOSTSOUL BODY PARTS //////

ACTOR LSPart1
{
    Radius 2
    Height 2
    Speed 7
	Mass 3
	BounceFactor 0.4
	+DOOMBOUNCE
    +NOBLOCKMAP
	+MISSILE
    +NOTELEPORT
    +DONTSPLASH
    +MOVEWITHSECTOR
    +CLIENTSIDEONLY
	+THRUACTORS
    Scale 0.7
    States
    {
    Spawn:
		TNT1 A 0

		TNT1 A 0 Thing_ChangeTID(0,394)
		TNT1 A 0 A_Jump(128,9)
		LGI1 ABCDEFGH 2
		wait
		LGI1 HGFEDCBA 2
		wait
	Death:
		TNT1 A 0
		TNT1 A 0 A_QueueCorpse
		TNT1 A 0 A_Jump(128,2)
		LGI1 A 200
		stop
		LGI1 E 200
        Stop
    }
}

actor LSpart2 : LSpart1
{
states
	{
	spawn:
		TNT1 A 0
		TNT1 A 0 Thing_ChangeTID(0,394)
		TNT1 A 0 A_Jump(128,9)
		LGI2 ABCDEFGH 2
		wait
		LGI2 HGFEDCBA 2
		wait
	Death:
		TNT1 A 0
		TNT1 A 0 A_QueueCorpse
		TNT1 A 0 A_Jump(128,2)
		LGI2 A 200
		stop
		LGI2 E 200
        Stop
	}
}

actor LSpart3 : LSpart1
{
states
	{
	spawn:
		TNT1 A 0
		TNT1 A 0 A_QueueCorpse
		TNT1 A 0 Thing_ChangeTID(0,394)
		TNT1 A 0 A_Jump(128,9)
		LGI3 ABCDEFGH 2
		wait
		LGI3 HGFEDCBA 2
		wait
	Death:
		TNT1 A 0
		TNT1 A 0 A_QueueCorpse
		TNT1 A 0 A_Jump(128,2)
		LGI3 A 200
		stop
		LGI3 E 200
        Stop
	}
}

ACTOR SoulTrails
{
	Game Doom
	Radius 1
	Height 1
	Speed 2
	Damage 0
    +NOBLOCKMAP
    +NOTELEPORT
    +DONTSPLASH
	+MISSILE
	+FORCEXYBILLBOARD
    +CLIENTSIDEONLY
	+RANDOMIZE
	RenderStyle Add
    Scale 0.5
	Alpha 0.6
	Gravity 0
	States
	{
    Spawn:
        TNT1 A 2
        FRFX GHIJKLMNOP 1 BRIGHT
        Stop
	}
}

actor LostSoulBlood : Blood
{
	Decal "None"
	game Doom
	+NOBLOCKMAP
	+NOTELEPORT
	-ALLOWPARTICLES
	Speed 0
	states
	{
		Spawn:
		TNT1 A 0
		TNT1 A 0 A_CustomMissile ("SparkXNoModel", 2, 0, random (0, 360), 2, random (0, 360))
		TNT1 A 0 A_CustomMissile ("SmallLSPart1", 0, 0, random (0, 360), 2, random (0, 360))
		TNT1 A 0 A_CustomMissile ("SparkXNoModel", 2, 0, random (0, 360), 2, random (0, 360))
		TNT1 A 0 A_CustomMissile ("SmallLSPart3", 0, 0, random (0, 360), 2, random (0, 360))
		stop
	}
}

actor SmallLSPart1: LSPart1
{
Scale 0.3
Speed 10
}

actor SmallLSPart3: LSPart1
{
Scale 0.3
Speed 12
}

actor BigLSPart1: LSPart1
{
Scale 1.0
Speed 10
}

actor BigLSPart3: LSPart1
{
Scale 1.0
Speed 12
}

actor BigLSPart2: LSPart1
{
Scale 1.0
Speed 12
}
