基本上,用户更早地选择了一个类。在这个菜单中,它会检查,如果用户选择了巫师,那么他们可以选择最多花费 4 个技能点。
if Class == ("wizard") or Class == ("Wizard"):
print("You have four spell points. You can learn up to four level- one spells, or one level-four spell, or any combination thereof.")
Spellpoints = 4
FireballLvl = 0
IceBlastLvl = 0
TelekeniticSheildLvl = 0
ElectricShockLvl = 0
WindLvl = 0
while True:
Spellmenu = input("Press 1 to spend a point on Fireball. Press 2 to spend a point on Ice Blast. Press 3 to spend a point on Telekenitic Sheild. Press 4 to spend a point on Electric Shock. Press 5 to spend a point on Wind.")
if Spellpoints == 0:
print ("You have no more spell points")
break
if Spellmenu == ("1"):
Spellpoints - 1
FireballLvl + 1
elif Spellmenu == ("2"):
Spellpoints - 1
IceBlastLvl + 1
elif Spellmenu ==("3"):
Spellpoints - 1
TelekeniticSheildLvl + 1
elif Spellmenu ==("4"):
Spellpoints - 1
ElectricShockLvl + 1
elif Spellmenu ==("5"):
Spellpoints - 1
WindLvl + 1
我的问题是循环永远不会结束。当没有更多的法术点时应该是这样,但它并没有结束。提前谢谢了。