- I love dungeon crawlers. Consider the following items:
- Swords: small, medium, large
- Axes: small, medium, large
- Magical potions: red, blue, green
- Bows: crossbow, short bow, longbow
- Loot: gems, coins, artifact
- Stuff that keeps you alive: food, healing potions
- Magical items: wand, scroll, ring, empty / none
- Classes: fighter, wizard, thief, healer, ranger
- Races: human, elf, dwarf, halfling, gnome
- Miscellaneous items: torch, lamp, key, map, empty / none
Now consider the following text file (character.txt) for an adventurer in a dungeon crawler:
Adventure's name: Foo Bobo
Class: Ranger
Race: Gnome
Strength: 16
Constitution: 15
Dexterity: 18
Intelligence:15
Wisdom: 15
Charisma: 20
Back Slot: short bow
Belt Slot: small axe
Right Hand: torch
Left Hand: empty
Pack: potion red, ring, food, coins, key, food, lamp, scroll, artifact, potion blue
Write a program that will create a file called character.txt. Your file should look like the one provided above, and meet these expectations:
Your program will:
- be divided into functions
- use appropriate data structures and documentation
- be text menu driven (simplified using capital letters or numbers). Consider the importance of balancing your menu so that the options are not in a horizontal sprawl.
- write to a file called character.txt (see example above).
- ask separately for the character's first name, then last name
- randomly generate a class and race
- Generate a random number between 1 - 20 per stat. Character stats: Strength, Constitution, Dexterity, Intelligence, Wisdom, Charisma
- randomly generate a weapon for the character's 'back slot' and 'belt slot'
- randomly generate an item (Miscellaneous item, Magical item) per hand
- randomly generate 10 items (Miscellaneous items, Magical potions, Loot, Stuff that keeps you alive, Magical items) for the pack
- the frequency for generation is based on how many things there are in a given category. Please don't forget to include 'empty / none' when you are thinking about generation.
- read from a file called character.txt to display the character
- allow the user to change the default file name (character.txt) for reading or writing
Bonus
- once a character has been written, allow the user to edit any line. If they choose the pack, ask for a position