The analogy I use in my own thinking is that swearing is a garnish. Your dish won't be any less delicious without it; but a little placed here and there in the areas where it will have the most impact can enhance your hack's tone, characterization, and/or storytelling. This "garnish" should never be added frivolously - if your dish is already artfully arranged just the way it is; than even a sprinkling of parsley could be seen as distracting and unnecessary. A good "test" to do is this: if you can imagine your scene without swearing and finds it loses much of its impact in the process, you'll know your garnish is well-placed; if the lack of bad language seems to make no difference whatsoever, than err on the side of caution and leave it out. :)
Of course, garnishes are meant to be used sparingly, and their purpose should be to enhance the overall attractiveness of the meal of a whole. If you heap on so much garnish that it stands out more than your dish does - like so many of those "My first ROM Hack!" videos you find on Youtube; that are essentially one-trick ponies modded with Advance-Text who's sole reason for being is to have PROFESSOR PENIS give you a Pokemon in PUSSY TOWN while NPCs ask you to **** them - you give off the impression of being a twelve-year-old with a mentality that hasn't advanced beyond the Beavis and Butt-Head stage yet. Hacking a slew of four-letter words and dirty sex talk into a Pokemon game doesn't make one "mature" and "edgy" - far from it!
Edited to add: Sometimes, however, your dish NEEDS garnish. Slavishly avoiding bad language in situations that would appropriately call for it can be just as bad as overdoing it. Lines like "gosh dang it to heck!" - in the mouth of a character where such wouldn't make sense (such as your scary Big Bad) - can push your hack into the realm of Narm (in other words, ridiculously cheesy and ineffective at delivering the intended emotional impact). If you're wanting to avoid both swearing and the Narm-y avoidance of such in tense situations, reworking your dialogue to avoid any need for silly euphemisms (or planning it that way from the beginning) is generally what I recommend. The fine line between avoiding swearing to silly extremes and cursing like a sailor can be a difficult one to walk sometimes...but if you have a good instinct for your story, your characters, your setting, your overall mood, and your audience; finding that opportune moment where you have a real reason to use "damn" over "darn" - or not needing to use an expletive at all - will come easy to you. ^^