



/*
Skorzeny_1 17893
Skorzeny_2 17894
Skorzeny_3 17895
Skorzeny_4 17896

*/

//#include SYNTH_mon.txt is in Nazis.txt

ACTOR HeadboxMkIIScorzeny: HeadboxMkII {
	BloodType "GlassBlood", "GlassBlood", "GlassBlood"
	+NOBLOODDECALS
	Radius 12
	Height 22
	+DONTRIP
	+NOTARGET // prevents BFG 9000 lightning (fast seeker ripper missiles) from locking onto it
	+NEVERTARGET
	Species "Nazis"

	DamageFactor "Railgun", 3.0 // the boss is designed to be ohk'd with the railgun
	
	DamageFactor "Desintegrate", 0.0 // immune to bfg headshots
	DamageFactor "Fire", 0.0
	DamageFactor "Ice", 0.0
	DamageFactor "Slime", 0.0
	DamageFactor "Electric", 0.0

	//for debugging
	XScale 1.71
	YScale 1.22
	States
	{
		Spawn:
			TNT1 A 0 NODELAY A_GiveInventory("TargetIsAHeadbox")
			TNT1 A 0 A_SetUserVar("user_use_headache", 1) 
			Goto Follow
		
		Pain.Railgun:	
			TNT1 A 0 A_SetUserVar("user_nolimit", 1)
			Goto Pain
	}
}

ACTOR Skorzeny_2: AbstractSynthMonster 17894
{
	Tag "$BOSS_SCORCZENY"
	//$category "EDAY Bosses"
	
	Species "Nazis"
	Health 2000
	Mass 400
	Radius 20
	Height 45
	Speed 5
	PainChance 25
	DropItem None // two MG-42s are dropped by his mech arms flying off
	SeeSound "scorzeny/sight"
	PainSound None
	ActiveSound None
	DeathSound "scorzeny/death"	
	
	-FASTER
	-DONTHURTSPECIES
	
	+NOTARGET
	
	+FLOORCLIP
	+NORADIUSDMG
	+DONTMORPH
	+BOSSDEATH
	BloodType "TankBlood", "TankBlood", "TankBlood"
	
	DamageFactor "Normal", 0.4
	DamageFactor "Bfg10k", 0.4
	
	+DONTRIP // drastically decreases the damage done by BFG 9000
		// *and* allows deflecting secondary lightning
		// (the arch trickster cannot do that and gets hit through his shield)
	DamageFactor "Desintegrate", 0.4 // bfg 9000
	DamageFactor "Shotgun", 0.2
	DamageFactor "SSG", 1.0
	DamageFactor "ExplosiveImpact", 0.0
	DamageFactor "FriendlyExplosion", 0.0
	DamageFactor "Shrapnel", 0.1
	DamageFactor "ExtremePunches", 0.5
	DamageFactor "Melee", 0.5
	DamageFactor "KillMe", 0.0 // ignore captured marines
	DamageFactor "PussyGrab", 0.0	
	DamageFactor "Argent", 0.0
	
	DamageFactor "Electric", 2.0 // a weakness!

	+NOPAIN // temporary, cleared after spawn
	
	// subscribed to player railgun alerter -- dodges fiercely if you point your railgun in his direction!
	PainChance "RailAvoid", 255
	DamageFactor "RailAvoid", 1.0	
	
	// subsscribed to rocket dodging
	PainChance "Avoid", 255
	DamageFactor "Avoid", 1.0
	
	States
	{
		Spawn:
			KYSZ A 0 NODELAY ACS_NamedExecuteWithResult("FBD_RunMonster", 33) // uses unique custom headbox
			"----" A 0 A_GiveInventory("TargetIsAFormerHuman", 1) //used by AOE DOT inflictors to reward players with soul ammo -- otherwise untraceable
			"----" A 0 A_SetUserVar("user_speed_limit", 4) // strafing speed, map units per tic. May overshoot it briefly.
			
			"----" A 0 A_SetUserVar("user_ambush_duration", 150)
			"----" A 0 A_SetUserVar("user_ambush_chance", 96)
			"----" A 0 A_SetUserVar("user_fire_period", 1) // n-sane fire rate
			"----" A 0 A_SetUserVar("user_burst_length", 12) // this is *minimum*! Can add randomly
			"----" A 0 A_SetUserVar("user_charge_time", 35) // a full second
			"----" A 0 A_SetUserVar("user_weapon_cooldown_time", 35) // a full second
			"----" A 0 A_SetUserVar("user_too_close_range", 700) // prefers medium distances		
			
			
			Goto SetupDefaults	
		
		SetupDefaults:
			"----" A 0
			"----" A 0 A_SetUserVar("user_default_weapon", 33) // four MG-42s. Ur ded, bro.
			"----" A 0 A_SetUserVar("user_melee_weapon", 33)		
			"----" A 0 A_SetUserVar("user_nag_period", 0) // never use
			
			"----" A 0 A_SetUserVar("user_footstep_mask", 2 | 8) // footsteps on synth frames B and D
			
			"----" A 1
			"----" A 0 A_ChangeFlag("NOPAIN", 0)
			Goto WeaponSwitch // will proceed to Stand	

		Stand:
			"----" A 0 ACS_NamedExecuteWithResult("AdjustHeadboxMkII", 0, 0, 45)
			KYSZ AAAA 5 A_Look
			Loop

		AnimFootstep:		
			"----" A 0 A_PlaySound("KYBHOOF1")
			Goto AnimFrame	
			
		AnimFrameJ:
			KYSZ A 1 
			Goto WeaponPhase
		AnimFrame1:
			KYSZ A 1
			Goto WeaponPhase
		AnimFrame2:
			KYSZ B 1
			Goto WeaponPhase
		AnimFrame3:
			KYSZ C 1
			Goto WeaponPhase
		AnimFrame4:
			KYSZ D 1
			Goto WeaponPhase
			

		WpnFire_MonsterDefined: 
			// 25 damage x 2 (50 x 2 on Equality skills)
			"----" A 0 A_JumpIf(user_shots % 2, "WpnFire_Odd")
			
			// bottom right, top left
			"----" A 0 A_SpawnItemEx("MG42Muzzle", 40,25,user_muzzle_z - 13, 0,0,0, 0,SXF_NOCHECKPOSITION)
			"----" A 0 A_SpawnItemEx("MG42Muzzle", 40,-25,user_muzzle_z, 0,0,0, 0,SXF_NOCHECKPOSITION)
			
			"----" A 0 A_PlaySound("m14FIRE", (user_shots % 2) % 2 ? 6 : 7) // up to 4 overlapping sounds
			"----" A 0 A_SpawnItemEx("RifleCaseSpawn", 0,-25,30, 0,0,0, 0,0)
			"----" A 0 A_SpawnItemEx("RifleCaseSpawn", 0,25,30, 0,0,0, 180,0)

			// top right, bottom left
			"----" A 0 A_CustomMissile("EnemyHeavyMachinegunProjectile", user_muzzle_z - 13, 25, angle + 0.1 * Random(-15, 15) + FIXED_TO_FLOAT * CallAcs("GetAngleAdjustFromYToTarget", 25), CMF_ABSOLUTEANGLE | (user_best_d ? CMF_AIMDIRECTION : CMF_OFFSETPITCH) | CMF_SAVEPITCH, (user_best_d ? user_best_p * 0.005493164 : 0) + 0.1 * Random(-15, 15)) 
			"----" A 0 A_CustomMissile("EnemyHeavyMachinegunProjectile", user_muzzle_z, -25, angle + 0.1 * Random(-15, 15) + FIXED_TO_FLOAT * CallAcs("GetAngleAdjustFromYToTarget", -25), CMF_ABSOLUTEANGLE | (user_best_d ? CMF_AIMDIRECTION : CMF_OFFSETPITCH) | CMF_SAVEPITCH, (user_best_d ? user_best_p * 0.005493164 : 0) + 0.1 * Random(-15, 15)) 
			
			"----" A 0 A_Jump(96, "OneMoreShot")
			"----" A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), "WeaponAfterFiring")
			"----" A 0 A_JumpIfTargetInLOS(1, 0, JLOSF_DEADNOJUMP) 
			Goto WeaponAfterFiring
			// Copying the chaingunner hack: keep firing at the dead player until his dead body splatters into a gory shower of innards
			"----" A 0 A_JumpIfInTargetInventory("ChainguyguyContinue", 1, "OneMoreShot")
			
			Goto WeaponAfterFiring				
			
		WpnFire_Odd:  // top right, bottom left

			"----" A 0 A_SpawnItemEx("MG42Muzzle", 40,25,user_muzzle_z, 0,0,0, 0,SXF_NOCHECKPOSITION)
			"----" A 0 A_SpawnItemEx("MG42Muzzle", 40,-25,user_muzzle_z - 13, 0,0,0, 0,SXF_NOCHECKPOSITION)
			
			"----" A 0 A_PlaySound("m14FIRE", (user_shots % 2) % 2 ? CHAN_WEAPON : 5)
			"----" A 0 A_SpawnItemEx("RifleCaseSpawn", 0,-25,30, 0,0,0, 0,0)
			"----" A 0 A_SpawnItemEx("RifleCaseSpawn", 0,25,30, 0,0,0, 180,0)

			
			"----" A 0 A_CustomMissile("EnemyHeavyMachinegunProjectile", user_muzzle_z, 25, angle + 0.1 * Random(-15, 15) + FIXED_TO_FLOAT * CallAcs("GetAngleAdjustFromYToTarget", 25), CMF_ABSOLUTEANGLE | (user_best_d ? CMF_AIMDIRECTION : CMF_OFFSETPITCH) | CMF_SAVEPITCH, (user_best_d ? user_best_p * 0.005493164 : 0) + 0.1 * Random(-15, 15)) 
			"----" A 0 A_CustomMissile("EnemyHeavyMachinegunProjectile", user_muzzle_z - 13, -25, angle + 0.1 * Random(-15, 15) + FIXED_TO_FLOAT * CallAcs("GetAngleAdjustFromYToTarget", -25), CMF_ABSOLUTEANGLE | (user_best_d ? CMF_AIMDIRECTION : CMF_OFFSETPITCH) | CMF_SAVEPITCH, (user_best_d ? user_best_p * 0.005493164 : 0) + 0.1 * Random(-15, 15)) 
			
			"----" A 0 A_Jump(96, "OneMoreShot")
			"----" A 0 A_JumpIf(CallAcs("FBD_TargetIsInvisible"), "WeaponAfterFiring")
			"----" A 0 A_JumpIfTargetInLOS(1, 0, JLOSF_DEADNOJUMP) 
			Goto WeaponAfterFiring
			// Copying the chaingunner hack: keep firing at the dead player until his dead body splatters into a gory shower of innards
			"----" A 0 A_JumpIfInTargetInventory("ChainguyguyContinue", 1, "OneMoreShot")
			Goto WeaponAfterFiring	

		Pain_MonsterDefined:
			"----" A 0 // a tough cookie, does not flinch
			Goto PainContinue
		
		// There is no need for complex animation: most of the impact comes from his flaming weapon arms flying off and his scream that has very large faloff distance.
		// But, more importantly, the SILENCE, the void left by the ceasing of his clanging footsteps
		// and his weapons roaring as you barely manage ducking into cover.
		// There's a 90% chance you won't even *see* his death as you'd be hunkering down
		// but you will definitely *hear* it - a scream, then silence.
		
		Death.Head:
		Death.HeadStun:
		Death.HeadPlasma:
			"----" A 0
			"----" A 0 A_CustomMissile ("MuchBlood", 45, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 160))
		Death:
		XDeath:
			"----" A 0
			"----" A 0 ACS_NamedExecuteWithResult("DeleteHeadboxMkII")
			KYSZ E 0 A_Scream
			KYSZ E 0 A_FaceTarget
			KYSZ E 0 A_SpawnItemEx("ScorzenyGibArmLeft",0,-25,40, 0,Random(-7,-3),Random(3,6), -90,SXF_NOCHECKPOSITION)
			KYSZ E 0 A_SpawnItemEx("ScorzenyGibArmRight",0,25,40, 0,Random(3,7),Random(3,6), 90,SXF_NOCHECKPOSITION)
			"----" AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_CustomMissile ("GlassBloodParticle", 50, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 90))
			
			KYSZ EEEEFFFF 2 
			KYSZ G 0
			"----" AAAAAAAA 0 A_CustomMissile ("MetalShard1", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 90))
			"----" AAAAAAAA 0 A_CustomMissile ("MetalShard2", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 90))
			"----" AAAAAAAA 0 A_CustomMissile ("MetalShard3", 30, 0, random (0, 360), CMF_AIMDIRECTION, random (0, 90))
			KYSZ GGGG 2
			"----" A 0 A_PlaySound("BIKECLW", CHAN_BODY)
			KYSZ HHHH 2
			TNT1 A 0 A_NoBlocking
			TNT1 A 0 A_GiveToTarget("SoulAmmo", 1)
			TNT1 A 0 A_SpawnItem ("GrowingBloodPool")
			KYSZ I -1
			Stop
	}		
}


ACTOR Skorzeny_1: Skorzeny_2 17893
{
	Health 1600
	Speed 2
	States {
		Spawn:
			KYSZ A 0 NODELAY ACS_NamedExecuteWithResult("FBD_RunMonster", 33) 
			"----" A 0 A_GiveInventory("TargetIsAFormerHuman", 1) //used by AOE DOT inflictors to reward players with soul ammo -- otherwise untraceable
			"----" A 0 A_SetUserVar("user_speed_limit", 2)
			
			"----" A 0 A_SetUserVar("user_ambush_duration", 0)
			"----" A 0 A_SetUserVar("user_ambush_chance", 0)
			"----" A 0 A_SetUserVar("user_fire_period", 1) // n-sane fire rate
			"----" A 0 A_SetUserVar("user_burst_length", 8) // this is *minimum*! Can add randomly
			"----" A 0 A_SetUserVar("user_charge_time", 45) // more than one second
			"----" A 0 A_SetUserVar("user_weapon_cooldown_time", 35) // a full second
			"----" A 0 A_SetUserVar("user_too_close_range", 700) // prefers medium distances				
			Goto SetupDefaults		
	}
}


ACTOR Skorzeny_3:  Skorzeny_2 17895
{
	Speed 6
	
	// the shields do not recharge but rather jump back to full user_deflector_shield_recovery tics after depletion
	// if brought below zero by breaking (say, max 30 but one rocked takes 100) the recovery time is scaled up according to max
	var int user_deflector_shield_max;
	var int user_deflector_shield;
	var int user_deflector_shield_recovery;
	var int user_missile_deflection_spread;	
	
	States {
		Spawn:
			KYSZ A 0 NODELAY ACS_NamedExecuteWithResult("FBD_RunMonster", 33)
			"----" A 0 A_GiveInventory("TargetIsAFormerHuman", 1) //used by AOE DOT inflictors to reward players with soul ammo -- otherwise untraceable
			"----" A 0 A_SetUserVar("user_speed_limit", 6)
			
			
			// You. Are. Screwed. :D
			"----" A 0 A_GiveInventory("FBD_CanDeflectPlayersMissiles", 1)
			"----" A 0 A_SetUserVar("user_deflector_shield_max", 100) // one rocket or 5 plasma shots
			"----" A 0 A_SetUserVar("user_deflector_shield_recovery", 6 * 35)
			"----" A 0 A_SetUserVar("user_missile_deflection_spread", 12) // in your general direction
			
			"----" A 0 A_SetUserVar("user_ambush_duration", 150)
			"----" A 0 A_SetUserVar("user_ambush_chance", 96)
			"----" A 0 A_SetUserVar("user_fire_period", 1) // n-sane fire rate
			"----" A 0 A_SetUserVar("user_burst_length", 12) // this is *minimum*! Can add randomly
			"----" A 0 A_SetUserVar("user_charge_time", 35) // a full second
			"----" A 0 A_SetUserVar("user_weapon_cooldown_time", 25) 
			"----" A 0 A_SetUserVar("user_too_close_range", 550) // prefers medium distances				
			
			"----" A 0 ACS_NamedExecuteWithResult("DeflectorShieldsUp", 130) /*
				NOTE: in monstersonly, this script k increases monster's current health instead
				-- since the deflecting is implemented player weapons side
				and thus does not exist in monstersonly!
				Thus, the archtrikster heals every time he'd bring his shields up.
			*/			
			
			Goto SetupDefaults		
	}
}



ACTOR Skorzeny_4: Skorzeny_3 17896
{
	+MISSILEMORE
	+MISSILEEVENMORE
	Speed 8
	States {
		Spawn:
			KYSZ A 0 NODELAY ACS_NamedExecuteWithResult("FBD_RunMonster", 33) 
			"----" A 0 A_GiveInventory("TargetIsAFormerHuman", 1) //used by AOE DOT inflictors to reward players with soul ammo -- otherwise untraceable
			"----" A 0 A_SetUserVar("user_speed_limit", 8)
			
			// You are SOOO screwed. >:D
			"----" A 0 A_GiveInventory("FBD_CanDeflectPlayersMissiles", 1)
			"----" A 0 A_SetUserVar("user_deflector_shield_max", 300) // 3 rockets or 15 plasma shots
			"----" A 0 A_SetUserVar("user_deflector_shield_recovery", 5 * 35)
			"----" A 0 A_SetUserVar("user_missile_deflection_spread", 4) // right in your face	

			"----" A 0 A_SetUserVar("user_ambush_duration", 150)
			"----" A 0 A_SetUserVar("user_ambush_chance", 96)
			"----" A 0 A_SetUserVar("user_fire_period", 1) // n-sane fire rate
			"----" A 0 A_SetUserVar("user_burst_length", 12) // this is *minimum*! Can add randomly
			"----" A 0 A_SetUserVar("user_charge_time", 25)
			"----" A 0 A_SetUserVar("user_weapon_cooldown_time", 20)
			"----" A 0 A_SetUserVar("user_too_close_range", 500) // prefers medium distances	
			"----" A 0 ACS_NamedExecuteWithResult("DeflectorShieldsUp", 150) /*
				NOTE: in monstersonly, this script k increases monster's current health instead
				-- since the deflecting is implemented player weapons side
				and thus does not exist in monstersonly!
				Thus, the archtrikster heals every time he'd bring his shields up.
			*/
			
			
			Goto SetupDefaults		
	}
}


ACTOR GlassBloodParticle: SFXGlassParticle1
{
	States
    {
		Spawn:
			TNT1 A 0 NODELAY A_SetScale(0.01 * (Random(0, 1) ? Random(-30, -10) : Random(10, 30)), 0.01 * (Random(0, 1) ? Random(-30, -10) : Random(10, 30)))
			TNT1 A 0 A_Jump (256, "Fly1", "Fly2", "Fly3", "Fly4")
		Fly1:
			GLSP ABCDEFGH 1
			Loop
		Fly2:
			GLSP ABCDEFGH 2
			Loop
		Fly3:
			GLSP ABCDEFGH 3
			Loop
		Fly4:
			GLSP ABCDEFGH 4
			Loop	
		Death:
			"----" AAAAAAAAAAAAA 1 A_FadeOut(0.01)
			Stop
    }
}

ACTOR GlassBlood: MecCockpitBlood
{
	States {
		Spawn:
			TNT1 A 0
			TNT1 A 0 A_Stop
			TNT1 A 0 A_PlaySound("ice/shatter")
			TNT1 AAAA 0 A_CustomMissile ("GlassBloodParticle", 0, 0, random (-30, 30), 2, random (-30, 30))
			TNT1 A 0 A_SpawnItem ("YellowFlareSmall", 0)
			FX58 ABCD 1 BRIGHT 
			FX58 EFGHIJ 1 bright
			TNT1 A 60
			Stop
	}
}

ACTOR ScorzenyGibArmLeft
{
	Projectile
	-NOGRAVITY
	Gravity 0.3
	Speed 6
	+THRUSPECIES
	Species "Nazis"
	BounceFactor 0.3
	+DOOMBOUNCE
	Damage 0
	SeeSound "scorzeny/armbreak"
	DeathSound "scorzeny/armshatter"
	States {
		Spawn:
			TNT1 A 0
		Fly:
			TNT1 AAA 0 A_CustomMissile ("MetalShard1", 0, 0, random (-30, 30), 2, random (-30, 30))
			TNT1 AAA 0 A_CustomMissile ("MetalShard2", 0, 0, random (-30, 30), 2, random (-30, 30))
			TNT1 AAA 0 A_CustomMissile ("MetalShard3", 0, 0, random (-30, 30), 2, random (-30, 30))
			TNT1 A 0 A_Jump(256, "Fly1", "Fly2")
		Fly1:
			KYSZ PQRSTUVW 2 A_CustomMissile ("FireAndSmokeMedium", 0, 0, random (-180, 180), 2, random (-90, 90)) 
			Loop
		Fly2:	
			KYSZ PWVUTSRQ 2 A_CustomMissile ("FireAndSmokeMedium", 0, 0, random (-180, 180), 2, random (-90, 90)) 
			Loop
		Death:
			TNT1 A 0
			TNT1 AAAA 0 A_CustomMissile ("SFXShrapnelParticle1", random (0, 16), 0, random (0, 360), 2, random (30, 60))
			TNT1 AAAA 0 A_CustomMissile ("SFXShrapnelParticle2", random (0, 16), 0, random (0, 360), 2, random (30, 60))
			TNT1 AAAA 0 A_CustomMissile ("SFXShrapnelParticle3", random (0, 16), 0, random (0, 360), 2, random (30, 60))
			TNT1 AAAA 0 A_CustomMissile ("SFXShrapnelParticle4", random (0, 16), 0, random (0, 360), 2, random (30, 60))
			TNT1 A 0 A_StopSound(CHAN_VOICE)
			TNT1 A 0 A_Scream
			TNT1 AAA 0 A_CustomMissile ("MetalShard1", 0, 0, random (-30, 30), 2, random (-30, 30))
			TNT1 AAA 0 A_CustomMissile ("MetalShard2", 0, 0, random (-30, 30), 2, random (-30, 30))
			TNT1 AAA 0 A_CustomMissile ("MetalShard3", 0, 0, random (-30, 30), 2, random (-30, 30))
			TNT1 A 1
			TNT1 A 0 A_SpawnItemEx("MG42Spawner", 0,0,0, 0,0,0, 0,SXF_NOCHECKPOSITION)
			TNT1 A 60
			Stop
	}
}

ACTOR ScorzenyGibArmRight: ScorzenyGibArmLeft
{
	States {
		Spawn:
			TNT1 A 0 NODELAY A_SetScale(-1.0, 1.0)
			Goto Fly
	}
}