だから私はテキストベースのRPGを作っています、そして私は行で修正できないように見える奇妙な構文エラーを思いつきました:
max_hp = randint((player.level * 0.75) * 50, player.level * 50)
クラスエネミーで。どんな助けでも大歓迎です:)。
from random import randint
import math
class Character(object):
def __init__(self,hp,max_hp,strength,level,exp):
self.level = level
self.exp = exp
self.hp = hp
self.max_hp = max_hp
self.strength = strength
class Player(Character):
def __init__(self):
exp = 0
level = 1
max_hp = 100
hp = max_hp
strength = level * 0.5
print max_hp, hp, strength
def Level(level, current_exp):
if current_exp >= level * 100:
level += 1
else:
pass
class Enemy(Character):
def __init__(self):
player = Player()
level = randint(player.level, math.ciel((player.level * .75) + 1)
max_hp = randint((player.level * 0.75) * 50, player.level * 50)
hp = max_hp
strength = randint(player.level + 1, player.level + 3)
print max_hp, strength
player = Player()
enemy = Enemy()