user1763914
user1763914

Reputation: 7

Problems basing enemy stats off of player stats in text based rpg

So I am making a text based rpg, and I've come up with a weird syntax error that I can't seem to fix on the line:

max_hp = randint((player.level * 0.75) * 50, player.level * 50)

in class Enemy. Any help would be greatly appreciated :).

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

Upvotes: 1

Views: 414

Answers (1)

Jonathan Vanasco
Jonathan Vanasco

Reputation: 15680

you're missing a closing parenthesis on the line above

Upvotes: 4

Related Questions