actor MasterMindClass : PlayerPawn
{
  Speed 0.40 //0.30
  Health 5000 //3000 3.0.1
  gibhealth 99999 //added - actor can not be gibbed
  Radius 100
  Height 100
  Mass 1000
  PainChance 40
  player.maxhealth 5000
  player.soundclass "MasterMindClass"
  Player.DisplayName "SpiderMasterMind"
  Player.MorphWeapon "MasterMindGun"
  Player.WeaponSlot 1, MasterMindGun
  
  DamageFactor "Suicide", 0 // puppetmaster can not suicide a monster
  DamageFactor "MarineDamage", 0.7
  DamageFactor "MarineRLDamage", 0.7
  DamageFactor "BFGSplash", 0.7
  DamageFactor "MarineRail", 0.5
  
  DamageFactor "CybRLDamage", 0
  DamageFactor "CybYamato", 0.15 //added 3.0.1
  DamageFactor "ImpBallDamage", 0
  DamageFactor "CacoDamage", 0
  DamageFactor "SkelDamage", 0
  DamageFactor "FatsoDamage", 0
  DamageFactor "KnightDamage", 0
  DamageFactor "ArachDamage", 0
  DamageFactor "ZombiesDamage", 0
  DamageFactor "viledamage", 0

  DamageFactor "Control", 0
  DamageFactor "Slime", 0
  
  Player.JumpZ 10 //0
  Player.ViewHeight 70
  
  -PICKUP
  +NOSKIN
  +NOPAIN
  -FRIENDLY
  +NOTARGET
  +NOTRIGGER //added - avoid issues in level design

  states
  {
  Spawn:
    SPID AB 10 
    loop
  See:
    SPID A 3 A_PlaySoundEx ("spider/walk","body")
    SPID ABB 3 
    SPID C 3 A_PlaySoundEx ("spider/walk","body")
    SPID CDD 3 
    SPID E 3 A_PlaySoundEx ("spider/walk","body")
    SPID EFF 3 
    loop
  Missile:
    SPID G 2 Bright
    SPID H 2
    SPID G 2 Bright
    SPID H 3
    goto spawn
  Death:
    TNT1 A 0 A_GiveToTarget ("MarineExp",25)
    SPID J 20 A_Scream 
    SPID K 10 A_NoBlocking
    SPID LMNOPQR 10
    SPID R 1 A_SpawnItemEx ("MDeathGhost",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0) //0
    SPID S 30 Thing_changeTid(144,0)
    SPID S -1 
    stop
  }
}

ACTOR MasterMindGun : Weapon
{
  OBITUARY "%o was perforated by %k."
  ATTACKSOUND "weapons/shotgf"
  weapon.kickback 60
  Weapon.AmmoUse 0
  +WEAPON.NOALERT
  +WEAPON.DONTBOB
  +WEAPON.AMMO_OPTIONAL
  +WEAPON.CHEATNOTWEAPON
  //+INVENTORY.UNDROPPABLE //added
  states
  {
  Spawn:
    TNT1 A 0 Thing_Remove (0)
    Stop
  Ready:
    CHGG A 2 A_WeaponReady
    CHGG A 1 //ACS_ExecuteAlways(571,0,4,0,0)
    CHGG A 1
    TNT1 A 0 A_JumpIfInventory ("nothere",1,"nouse")
    CHGG A 0 A_JumpIfInventory ("Mskull",0,5)
    CHGG A 4 A_WeaponReady
    CHGG A 0 A_JumpIfInventory ("Mskull",4,3)
    CHGG A 4 A_WeaponReady
    CHGG A 0 A_JumpIfInventory ("Mskull",2,1)
    Loop
    CHGG A 0 HealThing(2)
    goto ready 
  DeSelect: 
    CHGG A 1 A_Lower
    Loop
  Select:
    CHGG A 1 A_Raise
    goto ready
  Fire:
    //TNT1 A 0 SetPlayerProperty (0, 1, 0)
	CHGG A 0 A_JumpIfInventory ("PM_AltFireX",1,"AltFireX")
	CHGG A 0 A_JumpIfInventory ("PM_AltFireY",1,"AltFireY")
	CHGG A 0 A_JumpIfInventory ("PM_AltFireZ",1,"AltFireZ")
    CHGG A 0 A_Gunflash
	CHGG A 0 A_FireCustomMissile("PuppetBulletTracer", random(-10,10),0,12,-6,0,random(-1,1))
    CHGG A 2 A_FireBullets (3,3,3,random(2,3)*3, "PuppetBulletRico") //7.7, 3.7 3.0.1
    CHGG B 2
	CHGG C 0 A_FireCustomMissile("PuppetBulletTracer", random(-10,10),0,12,-6,0,random(-1,1))
    CHGG C 2 A_FireBullets (3,3,3,random(2,3)*3, "PuppetBulletRico") //7.7, 3.7 3.0.1
    CHGG D 2
    //TNT1 A 0 SetPlayerProperty (0, 0, 0)
    goto Ready
	
  AltFireX:
	CHGG A 0 A_Gunflash
	CHGG A 0 A_FireCustomMissile("PuppetBulletTracer", random(-10,10),0,12,-6,0,random(-1,1))
    CHGG A 1 A_FireBullets (9,9,3,random(2,3)*3, "PuppetBulletRico") //7.7, 3.7 3.0.1
    CHGG B 1
	CHGG C 0 A_FireCustomMissile("PuppetBulletTracer", random(-10,10),0,12,-6,0,random(-1,1))
    CHGG C 1 A_FireBullets (9,9,3,random(2,3)*3, "PuppetBulletRico") //7.7, 3.7 3.0.1
    CHGG D 1
	goto Ready
  AltFireY:
  	CHGG A 0 A_Gunflash
	CHGG A 0 A_FireCustomMissile("PuppetBulletTracer", random(-10,10),0,12,-6,0,random(-1,1))
    CHGG A 0 A_FireBullets (15,15,3,random(2,3)*3, "PuppetBulletRico") //7.7, 3.7 3.0.1
    CHGG B 1
	CHGG C 0 A_FireCustomMissile("PuppetBulletTracer", random(-10,10),0,12,-6,0,random(-1,1))
    CHGG C 0 A_FireBullets (15,15,3,random(2,3)*3, "PuppetBulletRico") //7.7, 3.7 3.0.1
    CHGG D 1
	goto Ready
  AltFireZ:
	CHGG A 0 A_PlaySound("weapons/RailAttackCyber", CHAN_WEAPON, 1, 0, ATTN_NONE)
	CHGG A 12 Bright A_RailAttack(random(16,25)*3, 15, 1, "none", "red", 0, 0, "PuppetCybRailPuff")
		CHGG A 0 A_PlaySound("weapons/RailAttackCyber", CHAN_WEAPON, 1, 0, ATTN_NONE)
		CHGG A 12 Bright A_RailAttack(random(16,25)*3, -15, 1, "none", "red", 0, 0, "PuppetCybRailPuff")
	goto Ready
  nouse:
    TNT1 A 1
    TNT1 A 4 A_Print("cant use this")
    goto altfire
  AltFire:
    CHGG A 0
    CHGG A 1 A_Takeinventory("nothere",1)
    CHGG A 4 ACS_ExecuteAlways (419,0,14)
    goto ready
  Flash:
    CHGF A 2 bright A_Light1
    TNT1 A 2 bright A_Light2
    CHGF B 2 bright A_Light1
    TNT1 A 2 bright A_Light2
    TNT1 A 2 bright A_Light1
    TNT1 A 0 A_Light0
    Stop
  }
}
