if hp < 250 and lvl == 1:
hp=250
elif hp < 500 and lvl == 2:
hp=500
elif hp < 750 and lvl == 3:
hp=750
elif hp < 1000 and lvl == 4:
hp=1000
elif hp < 1250 and lvl == 5:
hp=1250
elif hp < 1500 and lvl == 6:
hp=1500
elif hp < 1750 and lvl == 7:
hp=1750
elif hp < 2000 and lvl == 8:
hp=2000
elif hp < 2250 and lvl == 9:
hp=2250
elif hp < 2500 and lvl == 10:
hp=2500
elif hp < 2750 and lvl == 11:
hp=2750
elif hp < 3000 and lvl == 12:
hp=3000
elif hp < 3250 and lvl == 13:
hp=3250
elif hp < 3500 and lvl == 14:
hp=3500
elif hp < 3750 and lvl == 15:
hp=3750
elif hp < 4000 and lvl == 16:
hp=4000
elif hp < 4250 and lvl == 17:
hp=4250
elif hp < 4500 and lvl == 18:
hp=4500
elif hp < 4750 and lvl == 19:
hp=4750
elif hp < 5000 and lvl == 20:
hp=5000
elif hp < 5250 and lvl == 21:
hp=5250
elif hp < 5500 and lvl == 22:
hp=5500
elif hp < 5750 and lvl == 23:
hp=5750
elif hp < 6000 and lvl == 24:
hp=6000
elif hp < 6250 and lvl == 25:
hp=6250
elif hp < 6500 and lvl == 26:
hp=6500
elif hp < 6750 and lvl == 27:
hp=6750
elif hp < 7000 and lvl == 28:
hp=7000
elif hp < 7250 and lvl == 29:
hp=7250
elif hp < 7500 and lvl == 30:
hp=7500
elif hp < 7750 and lvl == 31:
hp=7750
elif hp < 8000 and lvl == 32:
hp=8000
elif hp < 8250 and lvl == 33:
hp=8250
elif hp < 8500 and lvl == 34:
hp=8500
elif hp < 8750 and lvl == 35:
hp=8750
elif hp < 9000 and lvl == 36:
hp=9000
elif hp < 9250 and lvl == 37:
hp=9250
elif hp < 9500 and lvl == 38:
hp=9500
elif hp < 9750 and lvl == 39:
hp=9750
elif hp < 10000 and lvl == 40:
hp=10000
elif hp < 10250 and lvl == 41:
hp=10250
elif hp < 10500 and lvl == 42:
hp=10500
elif hp < 10750 and lvl == 43:
hp=10750
elif hp < 11000 and lvl == 44:
hp=11000
elif hp < 11250 and lvl == 45:
hp=11250
elif hp < 11500 and lvl == 46:
hp=11500
elif hp < 11750 and lvl == 47:
hp=11750
elif hp < 12000 and lvl == 48:
hp=12000
elif hp < 12250 and lvl == 49:
hp=12250
elif hp < 12500 and lvl == 50:
hp=12500
elif hp < 12750 and lvl == 51:
hp=12750
elif hp < 13000 and lvl == 52:
hp=13000
elif hp < 13250 and lvl == 53:
hp=13250
elif hp < 13500 and lvl == 54:
hp=13500
elif hp < 13750 and lvl == 55:
hp=13750
elif hp < 14000 and lvl == 56:
hp=14000
elif hp < 14250 and lvl == 57:
hp=14250
elif hp < 14500 and lvl == 58:
hp=14500
elif hp < 14750 and lvl == 59:
hp=14750
elif hp < 15000 and lvl == 60:
hp=15000
elif hp < 15250 and lvl == 61:
hp=15200
elif hp < 15500 and lvl == 62:
hp=15500
elif hp < 15750 and lvl == 63:
hp=10250
elif hp < 16700 and lvl == 64:
hp=16000
elif hp < 16250 and lvl == 65:
hp=16250
elif hp < 16500 and lvl == 66:
hp=16500
elif hp < 16750 and lvl == 67:
hp=16750
elif hp < 17000 and lvl == 68:
hp=17000
elif hp < 17250 and lvl == 69:
hp=17250
elif hp < 17500 and lvl == 70:
hp=17500
elif hp < 17750 and lvl == 71:
hp=17750
elif hp < 18250 and lvl == 72:
hp=18250
elif hp < 18500 and lvl == 73:
hp=18500
elif hp < 18750 and lvl == 74:
hp=18750
elif hp < 19000 and lvl == 75:
hp=19000
elif hp < 19250 and lvl == 76:
hp=19250
elif hp < 19500 and lvl == 77:
hp=19500
elif hp < 19750 and lvl == 78:
hp=19750
elif hp < 20000 and lvl == 79:
hp=20000
elif hp < 20250 and lvl == 80:
hp=20250
elif hp < 20500 and lvl == 81:
hp=20500
elif hp < 20750 and lvl == 82:
hp=20750
elif hp < 20750 and lvl == 83:
hp=20750
elif hp < 21000 and lvl == 84:
hp=21000
elif hp < 21250 and lvl == 85:
hp=21250
elif hp < 21500 and lvl == 86:
hp=21500
elif hp < 21750 and lvl == 87:
hp=21750
elif hp < 22000 and lvl == 88:
hp=22000
elif hp < 22250 and lvl == 89:
hp=22250
elif hp < 22500 and lvl == 90:
hp=22500
elif hp < 23000 and lvl == 91:
hp=23000
elif hp < 23250 and lvl == 92:
hp=23250
elif hp < 23500 and lvl == 93:
hp=23500
elif hp < 23750 and lvl == 94:
hp=23750
elif hp < 24000 and lvl == 95:
hp=24000
elif hp < 24250 and lvl == 96:
hp=24250
elif hp < 24500 and lvl == 97:
hp=24500
elif hp < 24750 and lvl == 98:
hp=24750
elif hp < 25000 and lvl == 99:
hp=25000
elif hp <25250 and lvl == 100:
hp=25250
这是一个基于lvl的健康系统,用于口袋妖怪游戏(用于pokecenter) 请有人给我这个记录 像这样在下面完成
levels = [100, 200, 300, 400, 500]
lvl = len([x for x in levels if points > x])
这是来源Level system based off points 我不知道怎么做。 我还在学习python 如果您可以根据示例重新编码,我会很高兴,因为我不喜欢这个长版本
答案 0 :(得分:4)
您是否注意到每个hp
每个级别为250?
hp = max(hp, lvl*250)
或换句话说,(较慢,但可能更容易理解*)
if hp < (lvl*250):
hp=(lvl*250)
(如果需要,您可以为lvl
添加不超过100的条件。)
*为此目的有评论;)
编辑:max
是内置的,所以最好使用它:
答案 1 :(得分:0)
我不理解第二部分,但第一部分:
for x in range(1, 100):
if hp < (250*x) and lvl == x:
hp=(250*x)