コード例 #1
0
ファイル: create-magic-item.py プロジェクト: Ryu13/DND
def getType():
    magic_item_type = raw_input("Type of magic item (e.g. Armor, Weapon, Wondrous item): ")
    return {
        "magic_item_type": magic_item_type,
        "magic_item_subtypes_included": utils.getListOfItems("Included " + magic_item_type + " subtype ", True, None),
        "magic_item_subtypes_excluded": utils.getListOfItems("Excluded " + magic_item_type + " subtype ", True, None)
    }
コード例 #2
0
def getArmor():
	ac = raw_input("Armor Class: ")
	armor_types = utils.getListOfItems("Armor Type", True, None)
	armor = {
		"AC": ac,
		"ARMOR_TYPE": armor_types
	}

	armor_prone = raw_input("Armor while prone: ")
	if armor_prone != "":
		armor["AC_PRONE"] = armor_prone + " while prone"

	return armor
コード例 #3
0
ファイル: create-magic-item.py プロジェクト: Ryu13/DND
def getRarity():
    def unMapRarity(rarity):
        if rarity == "u" or rarity == "U":
            return "uncommon"
        elif rarity == "r" or rarity == "R":
            return "rare"
        elif rarity == "v" or rarity == "V":
            return "very rare"
        elif rarity == "l" or rarity == "L":
            return "legendary"
        else:
            print "------Rarity: " + rarity + " is not mapped-----"
            return rarity
    return utils.getListOfItems("Rarity ", True, unMapRarity)
コード例 #4
0
def getRace(): #testRaceCallback
	return utils.getListOfItems("Race", True, None)
コード例 #5
0
def getDamageResistances():
	return utils.getListOfItems("Damage Resistance", False, checkBPS)
コード例 #6
0
def getDamageVulnerabilities():
	return utils.getListOfItems("Damage Vulnerability", False, None)
コード例 #7
0
ファイル: create-magic-item.py プロジェクト: Ryu13/DND
def getDescription():
    descriptions = []
    print "1. Paragraph header (header)"
    print "2. Paragraph (para or paragraph)"
    print "3. Table (table)"
    print "4. List (list)"
    print "5. Set of stats (stats)"
    print "6. Associated creature template (creature)"
    print "7. Extra (extra)"
    description_itr = raw_input("Enter description option: ")
    while utils.validAnswer(description_itr):
        itrNum = str(len(descriptions) + 1)
        descBase = "Description " + itrNum + " "
        description = {}
        if description_itr == "header":
            description['header'] = raw_input(descBase + "paragraph header: ")
            description['paragraph'] = raw_input(descBase + "paragraph: ")
        elif description_itr == "para" or description_itr == "paragraph" or description_itr == "desc":
            description['paragraph'] = raw_input(descBase + "paragraph: ")
        elif description_itr  == "table":
            tableHeader = raw_input("Table header: ")
            #table headers
            tableColumnHeaders = []
            tableItrNum = str(len(tableColumnHeaders) + 1)
            tableHeader = raw_input("Column " + tableItrNum + " header: ")
            while utils.validAnswer(tableHeader):
                tableColumnHeaders.append(tableHeader)
                tableItrNum = str(len(tableColumnHeaders) + 1)
                tableHeader = raw_input("Column " + tableItrNum + " header: ")

            #table rows
            breakWhile = False
            tableRows = []
            while breakWhile is False:
                rowItems = []
                for header in tableColumnHeaders:
                    rowItem = raw_input("Row " + str(len(tableRows) + 1) + " -" + header + "- value: ")
                    if utils.validAnswer(rowItem):
                        rowItems.append(rowItem)
                    else:
                        breakWhile = True
                        break
                print ""
                if breakWhile is False:
                    tableRows.append(rowItems)

            tableFooter = raw_input("Table footer: ")
            description['table'] = {
                "headers": tableColumnHeaders,
                "rows": tableRows,
                "footer": tableFooter,
                "header": tableHeader
            }
        elif description_itr == "list":
            description['list'] = utils.getListOfItems("List item", False, None)
        elif description_itr == "stats":
            stats = []
            stat_header = raw_input("Stat" + str(len(stats) + 1) + ": ")
            while utils.validAnswer(stat_header):
                stat_value = raw_input(stat_header + " value: ")

                stats.append({
                    "stat_header": stat_header,
                    "stat_value": stat_value
                })

                stat_header = raw_input("Stat " + str(len(stats) + 1) + ": ")

            description['stats'] = stats
        elif description_itr == "creature":
            description['creature'] = raw_input("Associatd creature name: ")

        elif description_itr == "extra":
            extraHeader = raw_input("Extra header: ")
            extraDescriptions = utils.getListOfItems("Extra description", False, None)
            description['extra'] = {
                "header": extraHeader,
                "descriptions": extraDescriptions
            }
        else:
            print description_itr + " option not supported"

        if not description == {}:
            descriptions.append(description)

        print "1. Paragraph header (header)"
        print "2. Paragraph (para or paragraph)"
        print "3. Table (table)"
        print "4. List (list)"
        print "5. Set of stats (stats)"
        print "6. Associated creature template (creature)"
        print "7. Extra (extra)"
        description_itr = raw_input("Enter description option: ")

    return descriptions