Actor StreetMerchantSpawner : Inventory
{
  Inventory.RespawnTics 0x7FFFFFFF
  +NEVERRESPAWN
  +Inventory.Quiet
  +Inventory.AlwaysPickup
  Inventory.MaxAmount 0
  States
  {
  Spawn:
    TNT1 A 0
	TNT1 A 0 A_SpawnItemEx("StreetMerchant", 0, 0, 0, 0, 0, 0, 0, SXF_NOCHECKPOSITION)
  PermaLoop:
    TNT1 A 1
    Loop
  }
}

ACTOR StreetMerchant : WoC_FriendlyMon
{
	Health 200
	PainChance 255
	Radius 16
	Height 56
	Monster
	-COUNTKILL
	+USESPECIAL
	+NODAMAGETHRUST
	MeleeRange 64
	RadiusDamageFactor 0.25
	Activation THINGSPEC_NoDeathSpecial|THINGSPEC_ThingTargets
	Scale 1.15
	HitObituary "%o was beaten to death by a street merchant."
	AttackSound "FighterPunchMiss"
	PainSound "streetmer/pain"
	DeathSound "streetmer/death"
	Damagetype "Physical"
	Species "Player"
	+THRUSPECIES
	+DONTHARMSPECIES
	+FRIENDLY
	+FLOORCLIP
	Tag "Merchant"
	States
	{
	Spawn:
		SMER A 0
		SMER A 0 A_GiveInventory("EnemyInDisguise")
		SMER A 0 Thing_SetSpecial(0,226,WOC_SHOPSTART,0,0)
		SMER A 0 ACS_NamedExecuteAlways("WOC Monster Init",0,64,0)
	Idle:
		SMER A 0 A_CheckSight(3)
		SMER A 0 A_ChangeFlag("Friendly",1)
		SMER A 1 A_SpawnItemEx("ShopAttentionExplosion",0,0,32)
		Goto See
		SMER A 10
		Loop
	See:
		SMER A 4 A_FaceTarget
		Loop
	Pain:
		SMER A 3 A_Pain
		SMER A 3
		Goto Melee
	Melee:
		SMER D 8 A_FaceTarget
		SMER E 8 A_CustomMeleeAttack(ACS_NamedExecuteWithResult("WOC Monster Damage Scale",ACTIVATOR,random(2,16)),"FighterPunchHitThing","none","Physical")
		SMER E 1
		SMER D 8
		Goto See
	Death:
		SMER F 0 A_ChangeFlag("UseSpecial",0)
		SMER F 4 ACS_ExecuteAlways(WOC_SHOPDEAD,0,0,0,0)
		SMER G 4 A_Scream
		SMER H 4
		SMER I 4 A_NoBlocking
		SMER JKLM 4
		SMER N -1
		Stop
	Ice:
		"----" H 0 A_ChangeFlag("UseSpecial",0)
		"----" H 0 ACS_ExecuteAlways(WOC_SHOPDEAD,0,0,0,0)
		"----" H 5 A_GenericFreezeDeath
		"----" H 1 A_FreezeDeathChunks
		Wait
	}
}

Actor ShopUnfreezer : CustomInventory
{
	+INVENTORY.AUTOACTIVATE
	Inventory.MaxAmount 0
	States
	{
	Use:
		TNT1 A 0 SetPlayerProperty(0,0,4)
		Stop
	}
}

actor ShopAttentionExplosion
{
	Radius 10
	Height 10
	PROJECTILE
	+NODAMAGETHRUST
	+NOCLIP
	+NOEXTREMEDEATH
	+FORCERADIUSDMG
	+PAINLESS
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_AlertMonsters
		TNT1 A 0 A_Explode(1,1000,0,1,1000)
		TNT1 A 1 A_AlertMonsters
		Stop
	}
}