def on_start(self): if not self.sword: world = self.protagonist.players[0].world l = random.sample([ loc for loc in world.locations if self.protagonist.players[0].location != loc ], 1)[0] self.sword = item.Weapon(name="Magic Sword", description="The magic is in you", bonus={'STR': 1}, damage=6, dices=2, location=l) l.inventory.append(self.sword)
def addItem(invn): print("Type of item:\n1 - Clothing or Protective Gear\n2 - Weapon\n3 - Other (tools, expendable goods, etc.)") c = int(input("\nPlease choose the type of the item: ")) if c == 1: # clothing, items idNum = int(input("ID Number: ")) idYear = int(input("Last two digits of catalogue year: ")) article = str(input("Article of clothing ('Jacket', 'Lame, Foil', 'Knickers', etc.): ")) size = str(input("Size: ")) condition = str(input("Condition: ")) c = str(input("Are there additional traits that you would like to note (y/n)? ")) if c.lower() == "y": c = str(input("Is the " + article + " tailored for a specific gender (y/n)? ")) if c.lower() == "y": gender = str(input("Gender: ")) else: gender = None c = str(input("Is the " + article + " tailored for specific handedness (y/n)? ")) if c.lower() == "y": hand = str(input("Hand: ")) else: hand = None c = str(input("Is the " + article + " FIE quality (y/n)? ")) if c.lower() == "y": fie = True else: fie = False c = str(input("Is the " + article + " in use or reserved for a specific fencer (y/n)? ")) if c.lower() == "y": user = str(input("Fencer: ")) else: user = None c = str(input("Do you have additional comments for this " + article + " (y/n)? ")) if c.lower() == "y": comments = str(input("Comments: ")) else: comments = "" newI = item.Clothing(idNum, idYear, article, condition, size, gender, hand, fie, comments, user) else: newI = item.Clothing(idNum, idYear, article, condition, size) invn['items']['clothes'].append(newI) elif c == 2: # weapon, items idNum = int(input("ID Number: ")) idYear = int(input("Last two digits of catalogue year: ")) article = str(input("Type of weapon (Foil, Epee, Sabre): ")) condition = str(input("Condition: ")) hand = str(input("Handedness of the " + article + ": ")) bellCond = str(input("Bell Guard Condition: ")) grip = str(input("Grip: ")) if article.lower() != "sabre": wireCond = str(input("Condition of the wire(s): ")) else: wireCond = "N/A" c = str(input("Are there additional traits that you would like to note (y/n)? ")) if c.lower() == "y": c = str(input("Is the " + article + " FIE quality (y/n)? ")) if c.lower() == "y": fie = True else: fie = False c = str(input("Is the " + article + " in use or reserved for a specific fencer (y/n)? ")) if c.lower() == "y": user = str(input("Fencer: ")) else: user = None c = str(input("Do you have additional comments for this " + article + " (y/n)? ")) if c.lower() == "y": comments = str(input("Comments: ")) else: comments = "" newI = item.Weapon(idNum, idYear, article, condition, hand, bellCond, grip, wireCond, fie, comments, user) else: newI = item.Weapon(idNum, idYear, article, condition, hand, bellCond, grip, wireCond) invn['items']['weapons'].append(newI) elif c == 3: # miscItem, misc name = str(input("Name the item (wire, saw, etc.): ")) c = str(input("Are there more than 1 of this item or do you have comments for this item (y/n)? ")) if c.lower() == "y": quantity = int(input("Quantity of the item: ")) c = str(input("Do you have comments (y/n)? ")) if c.lower() == "y": comments = str(input("Comments: ")) else: comments = "" newM = item.MiscItem(name, quantity, comments) else: newM = item.MiscItem(name) invn['misc'].append(newM) else: pass # substitute with error or loop until proper choice is picked
backpack = item.Armor("Backpack", "Weatherproofed", weight=2.1) boots = item.Armor("Boots", "Combat boots", weight=0.7) gloves = item.Armor("Gloves", weight=0.1) bdupants = item.Armor("BDU Pants", "Standard battle dress uniform pants", weight=1.0) belt = item.Armor("Infantry Belt", "Pouched belt with holster", weight=0.6) bdushirt = item.Armor("BDU Shirt", "Standard battle dress uniform shirt", weight=1.0) p90 = item.Weapon( "FN P90", "5.7x28mm FMJ", weight=3.0, range=200, damage=12, proficiency="dexterity", cqcpenalty=1, ) m24 = item.Weapon( "M24", "7.62x51mm", weight=7.0, range=800, damage=20, proficiency="dexterity", cqcpenalty=3, ) zat = item.Weapon( "Zat'nik'tel",