Ejemplo n.º 1
0
    def __init__(self, name):

        # does not try loading a formation if name is not passed
        if not name:
            return

        path = os.path.join("data", "actors", "formations")
        formationini = Configuration(os.path.join("..", path, name + ".ini")).formation

        # formation's name can come from it's ini or just the filename
        self.name = formationini.__getattr__("name", default=name)

        self.enemies = []
        names = formationini.enemies.split("|")
        while len(names) > 0:
            self.enemies.append(Enemy(names[0]))
            if names.count(names[0]) > 0:
                self.enemies[-1].name += " " + chr(64 + names.count(names[0]))
            names.pop(0)
        self.enemies.reverse()

        # assigns the positions and scales to the enemies
        for i, enemy in enumerate(self.enemies):
            n = formationini.__getattr__("coord").split("|")[i]
            x = int(n.split(",")[0])
            y = int(n.split(",")[1])
            enemy.position = (x, y)
            n = formationini.__getattr__("scale").split("|")[i]
            enemy.scale = float(n)

        self.terrain = formationini.__getattr__("terrain")
Ejemplo n.º 2
0
    def __init__(self, name):

        # does not try loading a family if name is not passed
        # ONLY do this during family creation
        if not name:
            return

        path = os.path.join("data", "actors", "families", name)
        familyini = Configuration(os.path.join("..", path, "family.ini")).family

        # family's last name, all members of the family will have this last name
        self.name = name

        # all the members in your party
        path = os.path.join("..", path)
        members = [n.split("/")[-1] for n in glob.glob(os.path.join(path, "*.ini"))]
        exclude = ["family.ini", "bestiary.ini", "inventory.ini"]
        for item in exclude:
            if item in members:
                members.remove(item)

        self.members = [Character(self, n.replace(".ini", "")) for n in members]

        # the party used in battle is the first 3 members you have ordered
        if len(self.members) >= 3:
            self.party = Party(self.members[0:3])
        # party should only be 0 during character creation
        elif len(self.members) == 0:
            self.party = None
        else:
            self.party = Party(self.members[0 : len(self.members)])

        # the items your family has
        self.inventory = Inventory(self)
        print self.inventory

        # amount of money your family possesses
        self.gold = familyini.__getattr__("gold", int)
        # gameplay difficulty (0 - easy, 1- normal, 2 - hard)
        self.difficulty = familyini.__getattr__("difficulty", int)

        # family bestiary
        self.bestiary = Bestiary(self)