// Resistance

ACTOR ResistSphereSpawnActor1 : CustomInventory 10077
{
	Tag "Ballistic Resistance"
	//$Category Powerups
	//$Sprite BIOSA0
	+NOBLOCKMAP
	+NOGRAVITY
	States
	{
	Spawn:
	  TNT1 A 0
	  TNT1 A 1
	  TNT1 A 1 A_JumpIf(ACS_NamedExecuteWithResult("GunModifierSpawn") == 666,"Nothing")
	  TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("DuelSpawn") == true,"Duel")
	  TNT1 A 1 A_SpawnItemEx("ResistSphereSpawner1")
	Nothing:
	  TNT1 A 1
	  TNT1 A -1
	  Stop
	Duel:
	  TNT1 A 1 A_SpawnItemEx("DuelResistSphereSpawner1")
	  TNT1 A 1
	  TNT1 A -1
	  Stop
	}
}

ACTOR ResistSphereSpawner1 : RandomSpawner
{
	DropItem "ResistSphere"
}

ACTOR DuelResistSphereSpawner1 : RandomSpawner
{
	DropItem "DuelResistSphere"
}

ACTOR ResistSphereSpawnActor2 : CustomInventory 10095
{
	Tag "Explosive Resistance"
	//$Category Powerups
	//$Sprite BIO2A0
	+NOBLOCKMAP
	+NOGRAVITY
	States
	{
	Spawn:
	  TNT1 A 0
	  TNT1 A 1 A_JumpIf(ACS_NamedExecuteWithResult("GunModifierSpawn") == 666,"Nothing")
	  TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("DuelSpawn") == true,"Duel")
	  TNT1 A 1 A_SpawnItemEx("ResistSphereSpawner2")
	Nothing:
	  TNT1 A 1
	  TNT1 A -1
	  Stop
	Duel:
	  TNT1 A 1 A_SpawnItemEx("DuelResistSphereSpawner2")
	  TNT1 A 1
	  TNT1 A -1
	  Stop
	}
}

ACTOR ResistSphereSpawner2 : RandomSpawner
{
	DropItem "ResistSphere2"
}

ACTOR DuelResistSphereSpawner2 : RandomSpawner
{
	DropItem "DuelResistSphere2"
}

ACTOR ResistSphereSpawnActor3 : CustomInventory 10096
{
	Tag "Plasma Resistance"
	//$Category Powerups
	//$Sprite BIO3A0
	+NOBLOCKMAP
	+NOGRAVITY
	States
	{
	Spawn:
	  TNT1 A 0
	  TNT1 A 1 A_JumpIf(ACS_NamedExecuteWithResult("GunModifierSpawn") == 666,"Nothing")
	  TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("DuelSpawn") == true,"Duel")
	  TNT1 A 1 A_SpawnItemEx("ResistSphereSpawner3")
	Nothing:
	  TNT1 A 1
	  TNT1 A -1
	  Stop
	Duel:
	  TNT1 A 1 A_SpawnItemEx("DuelResistSphereSpawner3")
	  TNT1 A 1
	  TNT1 A -1
	  Stop
	}
}

ACTOR ResistSphereSpawner3 : RandomSpawner
{
	DropItem "ResistSphere3"
}

ACTOR DuelResistSphereSpawner3 : RandomSpawner
{
	DropItem "DuelResistSphere3"
}

ACTOR ResistSphere : CustomInventory
{
    +FLOAT
    +FLOATBOB
    +COUNTITEM
    +INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	+INVENTORY.FANCYPICKUPSOUND
	-INVENTORY.INVBAR
	Inventory.PickupSound "misc/resi_pkup"
	Inventory.MaxAmount 0
	Inventory.PickupMessage "Ballistic Resistance!"
	Inventory.PickupAnnouncerEntry "resistance"
	Inventory.RespawnTics 2100
	Tag "Ballistic Resistance"
	States
	{
	Spawn:
	  TNT1 A 0
	  TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("SphereNoGravCheck") == true,"NoGrav")
	SpawnLoop:
      BIOS A 28 Bright
	  BIOS B 14 Bright
      Loop
	NoGrav:
	  TNT1 A 0 A_ScaleVelocity(0)
	  TNT1 A 0 A_ChangeFlag(NOGRAVITY,true)
	  Goto SpawnLoop
	Pickup:
	  TNT1 A 0 A_JumpIfInventory("TimeFreezeInvulnerable",1,3)
	  TNT1 A 0 A_JumpIfInventory("RageSphereInvulnerable",1,2)
	  TNT1 A 0 A_GiveInventory("PickupProtection")
	  TNT1 A 0 A_Print("\n\n\n\n\n\nBallistic Resistance!\n\n\n\n50% damage resistance!\n90% resistance to ballistic & melee attacks!",4)
	  TNT1 A 0 A_GiveInventory("ResistSphereProtection")
	  Stop
	}
}

ACTOR DuelResistSphere : ResistSphere
{
	States
	{
	Pickup:
	  TNT1 A 0 A_JumpIfInventory("TimeFreezeInvulnerable",1,3)
	  TNT1 A 0 A_JumpIfInventory("RageSphereInvulnerable",1,2)
	  TNT1 A 0 A_GiveInventory("PickupProtection")
	  TNT1 A 0 A_Print("\n\n\n\n\n\nBallistic Resistance!\n\n\n\n50% damage resistance!\n90% resistance to ballistic & melee attacks!",4)
	  TNT1 A 0 A_GiveInventory("DuelResistSphereProtection")
	  Stop
	}
}	

ACTOR PowerResistance : PowerProtection
{
  DamageFactor "Bullet", 0.1
  DamageFactor "Nail", 0.1
  DamageFactor "Punch", 0.1
  DamageFactor "Saw", 0.1
  DamageFactor "Mace", 0.1
  DamageFactor "Fire", 0.5
  DamageFactor "Rocket", 0.5
  DamageFactor "Grenade", 0.5
  DamageFactor "Hellstorm", 0.5
  DamageFactor "Slime", 0.5
  DamageFactor "Plasma", 0.5
  DamageFactor "HitPlasma", 0.5
  DamageFactor "RedPlasma", 0.5
  DamageFactor "Pulse", 0.5
  DamageFactor "Blaster", 0.5
  DamageFactor "Railgun", 0.5
  DamageFactor "BFGSpray", 0.5
  DamageFactor "BFG10k", 0.5
  DamageFactor "Reflection", 0.5
  //DamageFactor "Normal", 0.5
  Inventory.Icon "GRESIS1"
}

ACTOR ResistSphereProtection : PowerupGiver
{
  Inventory.MaxAmount 1
  Powerup.Type "Resistance"
  Powerup.Colormap 0.0,1.0,0.0
  Powerup.Duration -30
  Inventory.PickupMessage ""
  Inventory.PickupSound ""
  +INVENTORY.AUTOACTIVATE
  +INVENTORY.ALWAYSPICKUP
  -INVENTORY.INVBAR
}

ACTOR DuelResistSphereProtection : ResistSphereProtection
{
  Powerup.Duration -15
}

ACTOR ResistSphere2 : ResistSphere
{
  Inventory.RespawnTics 3150
  Inventory.PickupMessage "Explosive Resistance!"
  Tag "Explosive Resistance"
  States
  {
  Spawn:
	TNT1 A 0
	TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("SphereNoGravCheck") == true,"NoGrav")
  SpawnLoop:
    BIO2 A 28 Bright
	BIO2 B 14 Bright
    Loop
  NoGrav:
	TNT1 A 0 A_ScaleVelocity(0)
	TNT1 A 0 A_ChangeFlag(NOGRAVITY,true)
	Goto SpawnLoop
  Pickup:
	TNT1 A 0 A_JumpIfInventory("TimeFreezeInvulnerable",1,3)
	TNT1 A 0 A_JumpIfInventory("RageSphereInvulnerable",1,2)
	TNT1 A 0 A_GiveInventory("PickupProtection")
	TNT1 A 0 A_Print("\n\n\n\n\n\nExplosive Resistance!\n\n\n\n50% damage resistance!\n90% resistance to explosive attacks!",4)
	TNT1 A 0 A_GiveInventory("ResistSphere2Protection")
	Stop
  }
}

ACTOR DuelResistSphere2 : ResistSphere2
{
	States
	{
	Pickup:
	  TNT1 A 0 A_JumpIfInventory("TimeFreezeInvulnerable",1,3)
	  TNT1 A 0 A_JumpIfInventory("RageSphereInvulnerable",1,2)
	  TNT1 A 0 A_GiveInventory("PickupProtection")
	  TNT1 A 0 A_Print("\n\n\n\n\nExplosive Resistance!\n\n\n\n50% damage resistance!\n90% resistance to explosive attacks!",4)
	  TNT1 A 0 A_GiveInventory("DuelResistSphere2Protection")
	  Stop
	}
}

ACTOR PowerResistance2 : PowerProtection
{
  DamageFactor "Bullet", 0.5
  DamageFactor "Nail", 0.5
  DamageFactor "Punch", 0.5
  DamageFactor "Saw", 0.5
  DamageFactor "Mace", 0.5
  DamageFactor "Fire", 0.1
  DamageFactor "Rocket", 0.1
  DamageFactor "Grenade", 0.1
  DamageFactor "Hellstorm", 0.1
  DamageFactor "Slime", 0.5
  DamageFactor "Plasma", 0.5
  DamageFactor "HitPlasma", 0.5
  DamageFactor "RedPlasma", 0.5
  DamageFactor "Pulse", 0.5
  DamageFactor "Blaster", 0.5
  DamageFactor "Railgun", 0.5
  DamageFactor "BFGSpray", 0.5
  DamageFactor "BFG10k", 0.5
  DamageFactor "Reflection", 0.5
  //DamageFactor "Normal", 0.5
  Inventory.Icon "RRESIS1"
}

ACTOR ResistSphere2Protection : PowerupGiver
{
  Inventory.MaxAmount 1
  Powerup.Type "Resistance2"
  Powerup.Colormap 1.25,0.25,0.1
  Powerup.Duration -30
  Inventory.PickupMessage ""
  Inventory.PickupSound ""
  +INVENTORY.AUTOACTIVATE
  +INVENTORY.ALWAYSPICKUP
  -INVENTORY.INVBAR
}

ACTOR DuelResistSphere2Protection : ResistSphere2Protection
{
  Powerup.Duration -15
}

ACTOR ResistSphere3 : ResistSphere
{
  Inventory.RespawnTics 3150
  Inventory.PickupMessage "Plasma Resistance!"
  Tag "Plasma Resistance"
  States
  {
  Spawn:
	TNT1 A 0
	TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("SphereNoGravCheck") == true,"NoGrav")
  SpawnLoop:
    BIO3 A 28 Bright
	BIO3 B 14 Bright
    Loop
  NoGrav:
	TNT1 A 0 A_ScaleVelocity(0)
	TNT1 A 0 A_ChangeFlag(NOGRAVITY,true)
	Goto SpawnLoop
  Pickup:
	TNT1 A 0 A_JumpIfInventory("TimeFreezeInvulnerable",1,3)
	TNT1 A 0 A_JumpIfInventory("RageSphereInvulnerable",1,2)
	TNT1 A 0 A_GiveInventory("PickupProtection")
	TNT1 A 0 A_Print("\n\n\n\n\n\nPlasma Resistance!\n\n\n\n50% damage resistance!\n90% resistance to plasma attacks!",4)
	TNT1 A 0 A_GiveInventory("ResistSphere3Protection")
	Stop
  }
}

ACTOR DuelResistSphere3 : ResistSphere3
{
	States
	{
	Pickup:
	  TNT1 A 0 A_JumpIfInventory("TimeFreezeInvulnerable",1,3)
	  TNT1 A 0 A_JumpIfInventory("RageSphereInvulnerable",1,2)
	  TNT1 A 0 A_GiveInventory("PickupProtection")
	  TNT1 A 0 A_Print("\n\n\n\n\nPlasma Resistance!\n\n\n\n50% damage resistance!\n90% resistance to plasma attacks!",4)
	  TNT1 A 0 A_GiveInventory("DuelResistSphere3Protection")
	  Stop
    }
}

ACTOR PowerResistance3 : PowerProtection
{
  DamageFactor "Bullet", 0.5
  DamageFactor "Nail", 0.5
  DamageFactor "Punch", 0.5
  DamageFactor "Saw", 0.5
  DamageFactor "Mace", 0.5
  DamageFactor "Fire", 0.5
  DamageFactor "Rocket", 0.5
  DamageFactor "Grenade", 0.5
  DamageFactor "Hellstorm", 0.5
  DamageFactor "Slime", 0.1
  DamageFactor "Plasma", 0.1
  DamageFactor "HitPlasma", 0.1
  DamageFactor "RedPlasma", 0.1
  DamageFactor "Pulse", 0.1
  DamageFactor "Blaster", 0.1
  DamageFactor "Railgun", 0.1
  DamageFactor "BFGSpray", 0.1
  DamageFactor "BFG10k", 0.1
  DamageFactor "Reflection", 0.1
  ///DamageFactor "Normal", 0.5
  Inventory.Icon "BRESIS1"
}

ACTOR ResistSphere3Protection : PowerupGiver
{
  Inventory.MaxAmount 1
  Powerup.Type "Resistance3"
  Powerup.Colormap 0.0,1.0,1.3
  Powerup.Duration -30
  Inventory.PickupMessage ""
  Inventory.PickupSound ""
  +INVENTORY.AUTOACTIVATE
  +INVENTORY.ALWAYSPICKUP
  -INVENTORY.INVBAR
}

ACTOR DuelResistSphere3Protection : ResistSphere3Protection
{
  Powerup.Duration -15
}