def test_get_remaining(self):
     """confirm function of `get_remaning_allocation`"""
     self.assertEqual(
         archetypes.get_remaining_allocation(self.char1.traits), 8)
     # do allocations
     self.char1.traits.STR.base += 2
     self.char1.traits.PER.base += 1
     self.char1.traits.INT.base += 1
     self.char1.traits.DEX.base += 1
     self.char1.traits.CHA.base += 1
     self.char1.traits.VIT.base += 2
     # confirm zero points left
     self.assertEqual(
         archetypes.get_remaining_allocation(self.char1.traits), 0)
 def test_get_remaining(self):
     """confirm function of `get_remaning_allocation`"""
     self.assertEqual(
         archetypes.get_remaining_allocation(self.char1.traits), 8)
     # do allocations
     self.char1.traits.STR.base += 2
     self.char1.traits.PER.base += 1
     self.char1.traits.INT.base += 1
     self.char1.traits.DEX.base += 1
     self.char1.traits.CHA.base += 1
     self.char1.traits.VIT.base += 2
     # confirm zero points left
     self.assertEqual(
         archetypes.get_remaining_allocation(self.char1.traits), 0)
Beispiel #3
0
def menunode_allocate_traits(caller, raw_string):
    """Discretionary trait point allocation menu node."""
    char = caller.new_char
    text = ""
    raw_string = raw_string.strip()
    if raw_string.isdigit() and int(raw_string) <= len(
            archetypes.PRIMARY_TRAITS):
        chartrait = char.traits[archetypes.PRIMARY_TRAITS[int(raw_string) - 1]]
        if chartrait.actual < 10:
            chartrait.mod += 1
        else:
            text += "|rCannot allocate more than 10 points to one trait!|n\n"

    remaining = archetypes.get_remaining_allocation(char.traits)

    text += "Your character's traits influence combat abilities and skills.\n"
    text += "Type 'help' to see individual trait definitions.\n\n"
    text += "Allocate additional trait points as you choose.\n"
    text += "\n  |w{}|n Points Remaining\n".format(remaining)
    text += "Please select a trait to increase:"

    help = "Traits:\n"
    help += "  Strength - affects melee attacks, fortitude saves, and physical tasks\n"
    help += "  Perception - affects ranged attacks, reflex saves, and perception tasks\n"
    help += "  Intelligence - affects skill bonuses, will saves, and magic\n"
    help += "  Dexterity - affects unarmed attacks, defense, and dexterity-based skills\n"
    help += "  Charisma - affects skills related to interaction with others\n"
    help += "  Vitality - affects health and stamina points"

    options = [{
        "desc": _format_trait_opts(char.traits[t]),
        "goto": "menunode_allocate_traits"
    } for t in archetypes.PRIMARY_TRAITS]
    options.append({
        "desc":
        "Start Over",
        "exec":
        lambda s: archetypes.apply_archetype(
            char, char.db.archetype, reset=True),
        "goto":
        "menunode_allocate_traits"
    })

    if remaining > 0:
        return (text, help), options
    else:
        data = []
        for i in xrange(3):
            data.append([
                _format_trait_opts(char.traits[t])
                for t in archetypes.PRIMARY_TRAITS[i::3]
            ])
        table = EvTable(header=False, table=data)
        return menunode_races(caller, "Final Skills:\n{}".format(table))
Beispiel #4
0
def menunode_allocate_traits(caller, raw_string):
    """Discretionary trait point allocation menu node."""
    char = caller.new_char
    text = ""
    raw_string = raw_string.strip()
    if raw_string.isdigit() and int(raw_string) <= len(archetypes.PRIMARY_TRAITS):
        chartrait = char.traits[archetypes.PRIMARY_TRAITS[int(raw_string) - 1]]
        if chartrait.actual < 10:
            chartrait.mod += 1
        else:
            text += "|rCannot allocate more than 10 points to one trait!|n\n"

    remaining = archetypes.get_remaining_allocation(char.traits)

    text += "Your character's traits influence combat abilities and skills.\n"
    text += "Type 'help' to see individual trait definitions.\n\n"
    text += "Allocate additional trait points as you choose.\n"
    text += "\n  |w{}|n Points Remaining\n".format(remaining)
    text += "Please select a trait to increase:"

    help = "Traits:\n"
    help += "  Strength - affects melee attacks, fortitude saves, and physical tasks\n"
    help += "  Perception - affects ranged attacks, reflex saves, and perception tasks\n"
    help += "  Intelligence - affects skill bonuses, will saves, and magic\n"
    help += "  Dexterity - affects unarmed attacks, defense, and dexterity-based skills\n"
    help += "  Charisma - affects skills related to interaction with others\n"
    help += "  Vitality - affects health and stamina points"

    options = [{"desc": _format_trait_opts(char.traits[t]),
                "goto": "menunode_allocate_traits"}
               for t in archetypes.PRIMARY_TRAITS]
    options.append({"desc": "Start Over",
                    "exec": lambda s: archetypes.apply_archetype(
                                          char,
                                          char.db.archetype,
                                          reset=True),
                    "goto": "menunode_allocate_traits"})

    if remaining > 0:
        return (text, help), options
    else:
        data = []
        for i in xrange(3):
            data.append([_format_trait_opts(char.traits[t])
                         for t in archetypes.PRIMARY_TRAITS[i::3]])
        table = EvTable(header=False, table=data)
        return menunode_races(caller, "Final Skills:\n{}".format(table))