
ACTOR RLSpiderMastermindBase : RLMonster
{
  Health 3000
  Radius 90
  Height 90
  Speed 12
  Mass 10000
  BloodType "RLNashGore_BossBlood", "RLMNullActor", "RLNashGore_SlashBlood"
  
  PainChance 20
  PainChance "Lith_Energy", 2 // Lithium compatibility
  MinMissileChance 10
  
  RadiusDamageFactor 0.2 // Bosses take only 20% radius damage
  DamageFactor "Melee", 2.0
  DamageFactor "Ice", 0.7
  DamageFactor "Radiation", 0
  DamageFactor "Holy", 2
  DamageFactor "Unholy", 0.25
  DamageFactor "Maser", 1.5 // Final Doomer Damagetype
  DamageFactor "C4Explosive", 10.0 // Final Doomer Damagetype
  DamageFactor "Heroic", 3.0 // LegenDoom Damagetype
  
  SeeSound "spider/sight"
  PainSound "spidermastermind/pain"
  DeathSound "spider/death"
  ActiveSound "spider/active"
  
  +NOFEAR
  +SEEINVISIBLE
  +BOSS
  +NOICEDEATH
  +MISSILEMORE
  +MISSILEEVENMORE
  +FLOORCLIP
  +DONTMORPH
  +BOSSDEATH
  
  Obituary "%o was outwitted by the Spider Mastermind."
  Species "RLSpidermind"
  Tag "Spider Mastermind"
  
  // Guncaster extras
   
  // Resists & Weaknesses
	DamageFactor CloseCombat, 1.2
	DamageFactor Shoelaces, 1.2
	DamageFactor SuperCloseCombat, 1.2
	DamageFactor SuperShoelaces, 1.2
	DamageFactor SuperMidasCloseCombat, 1.2
	DamageFactor SuperMidasShoelaces, 1.2
	DamageFactor Pound, 3.0
	DamageFactor Lightning, 1.25
	DamageFactor LightningBlue, 1.1
	DamageFactor Tiberium, 0.6
	DamageFactor BlueTiberium, 0.6
	DamageFactor Crow, 0.3
	DamageFactor Crow2, 0.3
	
	// Chance Effects
	PainChance Crow, 1
	PainChance Crow2, 1
	PainChance Lightning, 72
	PainChance LightningBlue, 4
	PainChance Manuel, 20
	PainChance Fire, 20
  States
  {
  ArsenalMissileCheck:
	"####" "#" 0 A_JumpIf(CallACS("DRLA_specialstarts") == 2, "Duke2LaserAttack")
    "####" "#" 0 A_JumpIfInventory("DRPGShadowAuraToken", 1, "ShadowAuraMissileAttack") // DRPG Shadow Aura
    "####" "#" 0 A_JumpIfInventory("LDLegendaryMonsterTransformed", 1, "LegendaryMissileAttack") // LegenDoom legendary monster
    "####" "#" 0 A_JumpIf(1, "MissileProper")
	Goto MissileProper
	
  MissileFriendlyCheck:
    "####" "#" 0 A_CheckFlag ("FRIENDLY", "MissileSpecialAttackCheck")
    "####" "#" 0 A_CheckFlag ("FRIENDLY", "MissileSpecialAttackCheck", AAPTR_TARGET)
    "####" "#" 0 A_JumpIf(CheckClass("Arachnotron", AAPTR_TARGET, TRUE), "FriendlyTarget")
    "####" "#" 0 A_JumpIf(CheckClass("SpiderMastermind", AAPTR_TARGET, TRUE), "FriendlyTarget")
    "####" "#" 0 A_JumpIf(CheckClass("Archvile", AAPTR_TARGET, TRUE), "FriendlyTarget")
    "####" "#" 0 A_JumpIf(CheckClass("RLArachnotronBase", AAPTR_TARGET, TRUE), "FriendlyTarget")
    "####" "#" 0 A_JumpIf(CheckClass("RLSpiderMastermindBase", AAPTR_TARGET, TRUE), "FriendlyTarget")
    "####" "#" 0 A_JumpIf(CheckClass("RLArchvileBase", AAPTR_TARGET, TRUE), "FriendlyTarget")
    "####" "#" 0 A_JumpIf(1, "MissileSpecialAttackCheck")
	Goto MissileSpecialAttackCheck
  RepeatFriendlyCheck:
    "####" "#" 0 A_CheckFlag ("FRIENDLY", "RepeatSpecialAttackCheck")
    "####" "#" 0 A_CheckFlag ("FRIENDLY", "RepeatSpecialAttackCheck", AAPTR_TARGET)
    "####" "#" 0 A_JumpIf(CheckClass("Arachnotron", AAPTR_TARGET, TRUE), "FriendlyTarget")
    "####" "#" 0 A_JumpIf(CheckClass("SpiderMastermind", AAPTR_TARGET, TRUE), "FriendlyTarget")
    "####" "#" 0 A_JumpIf(CheckClass("Archvile", AAPTR_TARGET, TRUE), "FriendlyTarget")
    "####" "#" 0 A_JumpIf(CheckClass("RLArachnotronBase", AAPTR_TARGET, TRUE), "FriendlyTarget")
    "####" "#" 0 A_JumpIf(CheckClass("RLSpiderMastermindBase", AAPTR_TARGET, TRUE), "FriendlyTarget")
    "####" "#" 0 A_JumpIf(CheckClass("RLArchvileBase", AAPTR_TARGET, TRUE), "FriendlyTarget")
    "####" "#" 0 A_JumpIf(1, "RepeatSpecialAttackCheck")
	Goto RepeatSpecialAttackCheck
	
  XDeath.MeleeKick:
  XDeath.Melee:
  Death.MeleeKick:
  Death.Melee: // Commando's Berserker ability activates here when you kill bosses in melee
    TNT1 A 0 A_GiveToTarget ("RLBerserkerBloodlustBossBonusCheck", 1)
	Goto Death
	
  TeleportEscape: // Summoned DRPG monsters will teleport out if you kill them with the console
    TNT1 A 0 A_BossDeath
    TNT1 A 0 A_SpawnItemEx ("TeleportFog", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION)
    Stop
//==============================================================================
//					--	GunCaster Compatibility Stuff  --
//==============================================================================
// Override death states to drop the larger mana items in Guncaster
  Death:
    "####" "#" 0 A_StopSound(5)
    "####" "#" 0 A_StopSound(6)
    "####" "#" 0 A_StopSound(7)
    "####" "#" 0 A_StopSound(CHAN_ITEM)
    "####" "#" 0 A_StopSound(CHAN_WEAPON)
	"####" "######" 0 A_DropItem("MajorManaPod",-1,224)
    "####" "#" 0 A_JumpIf(1, "DeathMain")
    Goto DeathMain
  XDeath:
    "####" "#" 0 A_StopSound(5)
    "####" "#" 0 A_StopSound(6)
    "####" "#" 0 A_StopSound(7)
    "####" "#" 0 A_StopSound(CHAN_ITEM)
    "####" "#" 0 A_StopSound(CHAN_WEAPON)
	"####" "######" 0 A_DropItem("MajorManaPod",-1,224)
    "####" "#" 0 A_JumpIf(1, "XDeathMain")
    Goto XDeathMain
	
	GenericFreezeMana:
		"####" "######" 0 A_DropItem("MajorManaPod",-1,224)
		"####" "#" 0 A_BossDeath
		"####" "#" 0 A_JumpIf(1,"GenericFreezeDeathMain")
		Goto GenericFreezeDeathMain

//------------------------------------------------------------------------------

	Death.MidasCloseCombat:
	Death.MidasShoelaces:
		TNT1 A 0 A_FaceTarget
		TNT1 A 0 A_NoBlocking
		"####" "######" 0 A_DropItem("MajorManaPod",-1,224)
		TNT1 A 0 A_Pain
		TNT1 A 0 A_PlaySound("Midas/Touched")
		TNT1 A 0 A_JumpIf(1, "MidasFrame1")
		Goto MidasFrame1
		
	//Scourgebreath
	Death.Breath:
		"####" "#" 0 A_StopSound(5)
		"####" "######" 0 A_DropItem("MajorManaPod",-1,224)
		"####" "#" 0 A_JumpIf(1,"DeathBreathContinue")
		Goto DeathBreathContinue
		
  //Fire
	Death.Meteorfist:
		"####" "#" 0 A_FaceTarget
		"####" "#" 0 A_ChangeVelocity(frandom(-15.0,-20.0),0,frandom(10.0,15.0),CVF_RELATIVE)
		"####" "#" 0 A_JumpIf(1,"Death")
		Goto Death
	Death.Lightning:
	Death.LightningBlue:
	Death.Fire:
		"####" "#" 0 A_JumpIf(1,"Death")
		Goto Death
	
			//Corpseblast
	CorpseBlastA:
		"####" "#" 0 A_SpawnItemEx("MastermindBlast",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS)
		Stop
	CorpseBlastB:
		"####" "#" 0 A_SpawnItemEx("MastermindBlast",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS)
		"####" "#" 0 A_TakeInventory("CorpseTrigger2",1)
		"####" "#" 0 A_JumpIf(1,"DeathEnd")
		Goto DeathEnd
	CorpseBlastC:
		"####" "#" 0 A_SpawnItemEx("MastermindBlast",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS)
		"####" "#" 0 A_TakeInventory("CorpseTrigger2",1)
		"####" "#" 0 A_JumpIf(1,"XDeathEnd")
		Goto XDeathEnd
  }
}
