Panicked Hat of Wonders (5e Creature)
From D&D Wiki
Panicked Hat of Wonders
small construct, neutral good
Damage Vulnerabilities fire, slashing, piercing
Create Item. The hat creates 1D4+5 items based off of whatever item the user that caused the hat to turn hostile wanted. It doesn't have to be exact, and can be a similar type of item instead. Creating a set of items takes a bonus action. It will always create items in the same size category as the item that user wanted. It can't create items of medium size or larger. It will never create the type of item exactly if the item wanted was particularly useful, such as a magical item. It can't create items if grappled or restrained in a way that closes the hat's opening. Any items it does create in this way aren't genuine, and disintegrate at the end of the fight, regardless of who wins.
Forceful Creation. When the hat creates items in any way, one of the items it creates immediately becomes a Launch Item attack. When it uses Launch Item as its attack, it creates a new item to launch, because it can't pick up objects on its own.
Item Flood. Every 20 tiny items and/or 10 small ones created makes difficult terrain in a 5 foot area around the hat. Each of that amount of items increases the area of difficult terrain by 5 feet in all directions. Each time the area grows larger, the pile gets 1 foot taller as well linearly from the center. Any creature that touches this flood must make a DC 15 Strength saving throw or be knocked prone. Any creature that starts its turn prone in the area of items takes 1D4+5 damage of a type appropriate to the type of items being made. A prone creature also takes 6 damage of the same type each time the hat makes new items.
Good Natured. All damage done by the hat is nonlethal. If all threats against the hat are knocked unconscious, it stops attacking. Additionally, any creature besides the one that originally caused the fight can calm it down with a DC 15 Persuasion check. That original creature that caused the fight would have to succeed on a DC 18 Persuasion check. If they succeed, the hat will stop fighting. Unless threatened again.
Launch Item. Ranged Weapon Attack: +7 to hit, reach 30/60 ft., one target. Hit: Tiny items deal 6 (1 + 5) damage of an appropriate type to the item. Small items deal 7 (1D4 + 5) instead. If the item is already a weapon with the thrown property, it deals that weapon's damage +5 instead.
The Hat of Wonders can take 1 legendary actions, choosing from the options below. Only one legendary action option can be used at a time and only at the end of another creature's turn. The Hat of Wonders regains spent legendary actions at the start of its turn.
Item Storm. The hat uses a legendary action to create 5D4+5 items using the same rules as with its Create Item feature.
Well this was difficult to logic out. Let me know in the discussion page if you have a way to improve this item, because while the idea is obvious it's kinda difficult to put to stats. This encounter of the hat kind is related to the Hat of Wonders, which can create mundane items at will for those that treat it nicely. Keep in mind, it will only attack if it genuinely believes it is in danger, or if it is overwhelmed by lots of requests for items in a short amount of time.
Also, keep in mind that a minor magic property that can be added to the item is the Unbreakable property, which makes it indestructible except by a specific means of harming it. If this is the case, defeating the hat could be much harder, as it simply won't take damage from most sources.