I'll take a pistol for home defense, over any longarm, cause the longarm is not likely to BE there when it's needed. WEAR the pistol at all times and not only will it be just 3/4 second from firing at an enemy, but it will be where un-authorized hands can't get to it. Not true of any longarm . Just ccw a 1 lb pocket 9mm in a pants pocket holster, the same way you'd wear a pager and cellphone, never noticing the bulk=weight after you've done it for a day or so. You're 10x more likely to not HAVE the longarm than you are to have the pistol not suffice. As long as the attacker can SEE your pistol and your determination to empty it into his chest if he doesn't stop, and as long as there's at least 6 ft of space between you, the odds are 4 to 1 that he'll just leave the area, without your having to fire at all. If the ones that DONT, about half flee when MISSES come too close, too.
for foraging, or outdoor fighting, you want a sound-suppressed M4, with a .22lr conversion unit, so that you dont scare off the other critters, call in enemies. Often, the missed critter just sits there and lets you try again, if the bullet has not kicked debris onto him. The 60 gr BlackHills Nosler Partition softpoint makes the 223 every bit as much of a deer rifle as the 30-30 ever was and twice as much so as the Ky rifle ever was. You can reliably brain bigger animals with it, like moose and elk, at twice the range at which anyone can reliably hit their chests with an arrow. Bowhunters get within 40 m of trophy males of such species, all the time, under conditions of fair chase, so why can't you within 80m, by using jacklighting at night, bait, etc? Females and juveniles are both far more commonly found and much easier to take.
The shotgun is extremely limited in its effective range. At the typical indoor range of 10ft from the muzzle, the pattern is just 3-4" wide, so you can easily miss with it. Outdoors, the effective range of a typical riot barrel and 00 buck load is 25m and less. 20m and less if the guy is using cover, and gives you only his head as a target. Nobody practices enough to be much good with $1 per shot slugs. If you were so inclined, you'd practice 3x as much with the 223, and 15x as much with the 6c per shot .22lr ammo in the conversion unit. The 12 ga has lots of flash at night and there's no efficient sound suppressors or flashhiders for it. So the first shot ruins your night vision and if you lack hearing protection, it ruins your hearing, especially indoors.
The shorty AR, scoped, will snipe effectively to 1/4 mile. Using the 60 gr Aquila subsonic .22 ammo, it's BB gun quiet thru the 223 silencer, and only handclap loud without the "can". This is if you know to hold shut the bolt with your non-firing hand. 22 is still quite lethal at 100m, guys, and it can brain hogs, dogs, men, or average- sized black bears to 40m, if you hit the top of head, ear hole, eyesocket, nasal cavities, or temple.
.22 conversions are welcome at indoor ranges, high v rifles and shotguns typically are not. The shorty AR can be concealed in a backpack when it's taken down. This gun is also quite easy to use with just one arm. It will shoot thru soft armor, too.
The stats prove that you're many times more likely to be attacked while you're not at home, than when you're ensconced in your castle. So you need the pistol anyway. Unless you're a survivalist, the fighting rifle is just a plinker sort of gun. The shotgun is something a lot of people use on birds and small game, so they HOPE it will suffice for defense or shtf, but the odds are, it wont.