Rogue C# – Setting Traps
Traps add to the challenge of the game, even if they are annoying sometimes. In this chapter, I add them to the game and discover that the player and monsters have more in common than they know.
Because technology should be the means, not the end.
The excesses of monarchy lead to democratization; the excesses of democracy lead back to monarchy. What goes around, in the words of a later generation, comes around.
Joe Haldeman, 1968
Traps add to the challenge of the game, even if they are annoying sometimes. In this chapter, I add them to the game and discover that the player and monsters have more in common than they know.
During the rescue of the Rogue C# project, I’ve seen some examples of things that weren’t quite thought out the first time around but the MoveMonster() function might have been a case of over-thinking … or of just really needing to walk away for a bit.
Not all scrolls and potions are helpful in a roguelike but that’s part of the fun … more or less. In this update, I add a mix of scrolls including Remove Curse, a frustratingly rare item that you’ll want after putting on the wrong armor and Aggravate Monsters which wil make your life on the level a lot more exciting. As before, every new scroll leads to a re-examination of the code.
The Scroll of Confuse Monster is a scroll that gives the player the power to confuse the next monster they attack for a certain number of turns and then the monster’s confusion lasts a certain number of turns so there are multiple steps to tackle here.
In this chapter, I do some important code review of the MapLevel class which manages map construction and functions within the game. I also track down a few more bugs and look at some testing strategies specific to this roguelike game. Finally, I show how bugs can be accidently introduced through otherwise well-meaning code maintenance.
It’s time to add more inventory items but first we need a way to define their abilities without getting lost in the code.
The method for processing user commands was getting out of control so I decided on some creative use of the Dictionary class to automate things.
In this chapter, I review the access modifiers available in C# and how they affect where properties and procedures can be accessed in the code.
In the latest chapter, a flowchart of the Game startup process points me to a problem assigning inventory to the player.
The classes in the Rogue C# code were developed over time and I decided an important part of the project rescue was to look them over and see who was talking to whom.