Hi all,
So, I’ve spent a little over a week on my game. It’s essentially a text-based dungeon crawler, where the player is given the option to play as one of three archetypes (rather than classes, so there aren’t any conflicts with python keywords). The user can choose to play as a barbarian, a ranger, or a wizard. They’re all extremely watered-down versions of the classes you can choose from in DnD.
Combat Sequence:
Map & Engine:
Archetype (where the player chooses their archetype and gains access to their abilities):
Enemies (enemy archetypes and abilities):
As of right now, I’ve been able to get the game working if I play as a wizard; if I choose any of the other classes, however, I encounter a problem. If I attempt to play the game as a wizard, once I go into my first combat sequence and attempt to use one of the ranger’s abilities, it returns this error message:
Traceback (most recent call last):
File ".\map_engine.py", line 413, in <module>
game_engine.play(combat_mechanics, arch_map)
File ".\map_engine.py", line 34, in play
next_room_name = current_room.enter()
File ".\map_engine.py", line 155, in enter
combat_mechanics.combat(kobold_grunt)
File "C:\Users\nickm\documents\python\my_game\combat_sequence.py", line 117, in combat
self.arch_map.raw_damage_staff(self.arch_map, enemy_arch, enemy_choice, block_amt, stun)
AttributeError: 'Ranger' object has no attribute 'raw_damage_staff'
For some reason, it thinks I’m wanting to call on one of the Wizard’s class methods; however, I attempted to automate the process to where the combat_sequence.py script knows what archetype you picked, then only allows the user to select from a specific list of moves. I know for sure I should only have access to the Ranger’s move set thanks to printing; when I print the instance variable self.arch_map, it returns this:
<archetype.Ranger object at 0x032B1190>
So, where am I going wrong? (Also, I’ve provided my other scripts for context, if needed. Just run map_engine.py from the command line.)
On a side note, if you go through the archetype.py module, you’ll notice some of the abilities are blank. I’m having a tough time implementing abilities that have a duration. In the case of the Ranger class method poision_shot, I only want it to last three turns. I was thinking of defining a local variable within the method (turn = 0), then, if the player does choose the poison shot attack, add and return 1 to the true variable. After the enemy took their turn, I was going to create an if-statement saying that if turn == 1, add and return 1 (with the enemy taking some damage). I was then going to have another if-statement (though I don’t know where to place this one…) saying that if turn == 3, then the poison would subside. Any thoughts?
I understand many users may not invest as much effort in this exercise, and I don’t want to spend too much time here when I could move on and begin learning new things. At the same time, I don’t want to just quit working on this game with 85% (hopefully I don’t find out I have to do a lot of reconstruction) or so of the program done. I definitely don’t want to miss out on that satisfaction. For now, I’ll move on to the next exercise, and maybe come back to it intermittently.
Thanks!