peaceknight05 / spellGame

Simple text based spell game with real life spell casting
MIT License
0 stars 0 forks source link

KeyError: 'damage' (player.py, line 131) #1

Open peaceknight05 opened 5 years ago

peaceknight05 commented 5 years ago

Output: our attribute is: fire You have encountered: Small Fireball (Tier: 0) Greetings, young mage. skip tutorial? (y/n) y small fireball You cast: Small Fireball (Tier: 0) You have mastered Small Fireball (Tier: 0) Enemy's health remained the same Opponent cast: Healing Drop (Tier: 0) Healing Drop backfired! Health dropped from 110 to 102 Traceback (most recent call last): File "main.py", line 122, in castSpell(castedSpell, THE_ENEMY, THE_PLAYER) File "main.py", line 82, in castSpell THE_PLAYER.processAttack(spellName, caster) File "/Users/jonathantan/Desktop/pythonCode/textspellgame/player.py", line 131, in processAttack attack = self.SPELL_DATA[spellName]["damage"] KeyError: 'damage'

The error should be about dict with name "spellName" in SPELL_DATA not having key "damage", but the .json file clearly states the "damage".

peaceknight05 commented 5 years ago

using a test text based version (which is exactly the same except for the input processing)