def generate_spell_damage(self, i):
mgl = self.magic[i]['dmg'] - 5
mgh = self.magic[i]['dmg'] + 5
return random.randrange(mgl, mgh)
magic = [{'name': 'Fire', 'cost': 20, 'dmg': 30},
{'name': 'Blizzard', 'cost': 30, 'dmg': 60},
{'name': 'Storm', 'cost': 10, 'dmg': 80}]
Person = Player(200, 100, 60, 40, 'magic')
print(Person.generate_spell_damage(1))
错误:字符串索引必须是整数。 请帮我克服这个错误。谢谢你的帮助
为什么用“magic”填充Player对象不应该是
否则它将被解释为字符串。你知道吗
相关问题 更多 >
编程相关推荐