基于文本的RPG中基于玩家统计数据的敌人统计数据的问题

时间:2012-10-21 22:47:42

标签: python python-2.7 text-based

所以我正在制作一个基于文本的RPG,我想出了一个奇怪的语法错误,我似乎无法解决这个问题:

max_hp = randint((player.level * 0.75) * 50, player.level * 50)
在类Enemy中

任何帮助将不胜感激:)。

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()

1 个答案:

答案 0 :(得分:4)

你错过了

上面一行的右括号