Beispiel #1
 def get_population(self, kind):
     # TODO: Figure out actual distribution. These are pretty close.
     if kind == 'Village':
         return xdy(5,95) + 25
     elif kind == 'Castle':
         return xdy(2,50)
     elif kind == 'Citadel':
         return d(100) + d(50)
         return xdy(5,16) + d(10) + 10
    def get_background(self):
        backgrounds = [
            ("Poulticer", "mortar and pestle, dagger, mystery potion (you know what it doesn't do), oil flask, chalk"),
            ("Slaughterer", "heavy cleaver, half-chain, a string of fine sausage, twine"),
            ("Fungus Picker", "two different kinds of mushrooms, club, sling, rabbuck-hide gloves, lamp, oil flask"),
            ("Pickler", "pickle cask with delicious pickles, spice-rack, trident, wading boots"),
            ("Charcoal Burner", "Iron-banded broom, knife, sooty rags, mastic, crampons"),
            ("Purloiner", "hammer and spike, off-hand daggers, 50' rope, clothes with hidden pockets, a golden ring (stolen)"),
            ("Hunter", "crossbow OR bow, quiver, skinning-knife, leather jack, axe, brace of smoked frog"),
            ("Noble", "sword and shield and full chain OR pistolet and powderhorn and chain shirt, off-hand dagger, map to 'inheritance', a fine cape and mantle, laudanum OR signet ring"),
            ("Mendicant", "begging bowl, smart pet, reed flute, staff OR club"),
            ("Scribe", "mace, robes, runestones, oil-lamp, lard-pot, vellum, brush and ink"),
            ("Porter", "fists, club, auroch-hide armour, a porter's basket"),
            ("Timberfeller", "great-axe, knife, raspberry aquavit, sling, 50' rope"),
            ("Plumber", "gluepot, throwing hammer, weather-proof overalls"),
            ("Hayseed", "axe OR pitchfork OR threshing flail, dirk, harmonium OR great-kazoo, chewing weed, three torches"),
            ("House-guard", "shield, spear, misericorde, half-chain, club, 50' rope"),
            ("Fisher", "fishing pole and hook, gutting knife, 2 throwing spears, eel-hide armour, 3 torches, a smoked eel"),
            ("Barber", "bonesaw, steggar, clamps, bloody rags, leechjar OR pendulum"),
            ("Scroll-Runner", "running shoes, jerky, 50' rope, emberhorn, dagger, news-scroll, farseeing glass"),
            ("Paramour", "woodblock erotica OR book of poems, sword, perfume (as lamp-oil), locket OR prophylactics, bow and quiver"),
            ("Guild-Partisan", "great-weapon, mancatcher, dagger, hauberk with party armband, guild news-scroll, a set of trade tools (dyer, tanner, weaver, napier, builder, etc.)"),
            ("Bondsman", "waraxe OR crossbow and quiver and club, mail shirt, shield, saexe, gift-ring"),
            ("Apiarist", "chainmail, goggles, club, bellows, smokebomb, honeycomb"),
            ("Sailor", "axe OR cat, off-hand marlinspike, scrimshaw, shield OR leather armour, lodestone"),
            ("Bellman", "hookspear, chainmail shirt, shield, handbell, truncheon, 3 torches"),
            ("Smith", "warhammer OR sword, off-hand hammer, chainmail OR leather armour and shield, anvil, crucible"),
            ("Janissary", "harquebus, powderhorn, chainmail shirt, sword, shield, contract"),
            ("Seer", "silver dagger, cage of finches, brazier"),
            ("Ursar", "mancatcher, 20' chain, club, hide armour, hand drum"),
            ("Merchant", "fine clothes, guilder's chain, mace OR axe, a servant with a bale of trade goods"),
            ("Wolfs-head", "waraxe, caltrops, leather armour, crossbow, quiver, writ of blood price"),
            ("Therapist", "flail, shield, pendulum, meditation cushion, oil-lamp, oil-pot"),
            ("Skald", "harp OR scroll of epic poetry, off-hand dagger, sword OR bow and quiver, collection plate"),
            ("Drover", "studded leather, whip, club, brand, firehorn, heavy gloves, throwing axe"),
            ("Judicial Functionary", "great-weapon, leather jack, hooded cloak, hanging rope OR tongs, manacles and keys"),
            ("Wildling", "fists, moss and furs, 'lucky' stone, shillelagh"),
            ("Mercenary", "great-weapon OR waraxe and shield, dirk, ringed leathers, bow and quiver, totem"),
        background, equipment = random.choice(backgrounds)
        equipment = equipment.split(', ')

        bonus_equipment, silver = random.choice([
            (["fists", "a half-empty bottle", "a turnip"], lambda: dice.d(6)),
            (["nullwater", "a white conch"], lambda: dice.xdy(3, 6)),
            (["3 flasks of oil", "a hammer", "iron spikes"], lambda: 0),
            (["quill and ink", "incense"], lambda: 0),
            (["a hex scroll", "a pine sprig"], lambda: dice.d(6) * 10),
            (["sword and scabbard OR waraxe OR warhammer"], lambda: 0),
        equipment += bonus_equipment
        equipment.append("%d SP" % silver())

        # process the equipment list down to a finite list of stuff
        final_equipment = []
        for e in equipment:
            items = random.choice(e.split(' OR ')).split(' and ')

        return background, ", ".join(list(itertools.chain(*final_equipment)))
Beispiel #3
    def __init__(self, *args, **kwargs):
        super(Character, self).__init__(*args, **kwargs)

        # Attributes
        self.skill = dice.d(3) + 3
        self.stamina = dice.xdy(2, 6) + 12
        self.luck = dice.d(6) + 6
        self.appearance = self.get_appearance()

        # Pick a Background
        background = random.choice(self.BACKGROUNDS)

        self.background = background['name'][3:]
        self.description = background['description']
        self.special = background['special']

        # Pick one of the "ORs" for possessions when picking equipment = [
            random.choice(equipment.split(' OR '))
            for equipment in background['possessions']
        ] + [
            # Add default equipment
            'Lantern and a flask of oil',
            '6 provisions',
            '%d silver pennies' % dice.xdy(2,6),

        # Turn random spells into actual spells when picking skills
        self.skills = [
            skill.replace('Random (Table 5)', random.choice(self.MAGIC_SPELLS))
            for skill in background['skills']

        # Fix some gender issues
        if 'Female' in self.appearance and self.background == 'Lonesome King':
            self.background = 'Lonesome Queen'
        elif self.background == 'Rhino-Man':
            self.appearance = self.appearance.replace('Female, ', '')
            self.appearance = self.appearance.replace('Male, ', '')
        elif self.background == 'Parchment Witch':
            self.appearance = self.appearance.replace('Male', 'Female')
 def __init__(self):
     attributes = [6, 8, 10, 12]
     self.str = attributes[0]
     self.sta = attributes[1]
     self.agi = attributes[2] = attributes[3]
     self.calling = random.choice([DEFENDER, LEADER, SKIRMISHER])
     self.hp = self.str + self.sta
     if self.calling == DEFENDER:
         self.hp = self.hp + xdy(4,6) + 24
     elif self.calling in [LEADER, SKIRMISHER]:
         self.hp = self.hp + xdy(2,6) + 16
     self.vitality = random.choice([1, 2, 2, 3, 3, 4])
     self.theme = random.choice(THEME)
     self.subtheme = random.choice(self.theme['subtheme'])
     self.theme = self.theme['name']
     self.fighting_style = random.choice(FIGHTING_STYLE)
     self.background = random.choice(BACKGROUND)
 def get_equipment(self):
     We generate a more Gonzo list of starting equipment.
     weapon = "%s %s" % (random.choice(characterclass.GONZO.METERIAL),
                         random.choice(characterclass.GONZO.WEAPONS)) = [random.choice(characterclass.GONZO.ARMOUR), weapon] += random.sample(characterclass.GONZO.GEAR, 2) += random.sample(characterclass.GONZO.STRANGE, 1) += ["%s GP" % xdy(3,6)]
Beispiel #6
 def _get_number_appearing(self):
     roll = d(20)
     if roll <= 5:
         return d(2)
     elif roll <= 9:
         return d(3)
     elif roll <= 12:
         return d(4)
     elif roll <= 15:
         return d(6)
     elif roll <= 17:
         return d(8)
     elif roll <= 19:
         return d(10)
         return xdy(2,6)
Beispiel #7
    def __init__(self, classname=None, testing=False):
        self.attributes = [(attribute, xdy(3,6))
                           for attribute in characterclass.ATTRIBUTES]
        self.character_class = self.get_character_class(classname)
        self.class_name = self.character_class['name']
        self.personality = self.get_personality()
        if testing:
            return = self.get_equipment()
        self.hp = self.get_hp()
        if self.hp is not None and self.hp < 1:
            self.hp = 1 = self.get_ac()
        self.thac9 = self.get_thac9()
        self.to_hit = self.get_to_hit_table()
        self.saves = self.get_saves()
        self.languages = self.get_languages()
        self.spell = self.get_spell()
        self.notes = self.get_notes()
        self.skills = self.get_skills()

        # attribute map to ease display in template
        self.attr = dict((attr, self.with_bonus(attr, value))
                          for attr, value in self.attributes)
 def get_equipment(self):
     return characterclass.LOTFP['equipment'][self.class_name][xdy(3,6)-3]
 def get_equipment(self):
     return self.character_class['equipment'][xdy(3,6)-3]
Beispiel #10
def three_dee_six():
    roll = [dice.xdy(3,6) for _ in range(6)]
    return render_template("3d6.html", roll=roll)
Beispiel #11
 def roll_attribute_scores(self):
     Rolls the attribute scores: 3d6 in order, as one would expect.
     return [(attribute, xdy(3, 6)) for attribute in characterclass.ATTRIBUTES]
Beispiel #12
 def get_monster(self):
     numdie, dietype, monster, monsters = random.choice(Monster.MONSTERS)
     count = xdy(numdie, dietype)
     if count > 1:
         monster = monsters
     return count, monster