Created
July 22, 2020 17:26
-
-
Save BNTFryingPan/86b645b1b39cd664be78c05aac9c818a to your computer and use it in GitHub Desktop.
botw dishes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
class ingredient(object): | |
'''An ingredient from Breath of the Wild | |
name = the name of the item | |
typ = the main category the item is in | |
subtype = the sub category the item is in | |
sideEffect = what bonus effect the ingredient gives when cooked | |
hpRestored = how much HP (1/4 hearts) this item restores when eaten raw''' | |
def __init__(self, name, typ, subtype, sideEffect, hpRestored): | |
self.name = name | |
self.typ = typ | |
self.subtype = subtype | |
self.sideEffect = sideEffect | |
self.hpRestored = hpRestored | |
def isCompatibleWith(self, ing): | |
'''If this ingredient has overlapping effects with ing, returns false, otherwise, true''' | |
#return ing.sideEffect == self.sideEffect or ing.sideEffect == None or self.sideEffect == None | |
if (self.sideEffect is None) or (ing.sideEffect is None) or (ing.sideEffect is self.sideEffect): | |
return True | |
else: | |
return False | |
class dish(object): | |
def __init__(self, ingredients=[]): | |
if len(ingredients) > 5: | |
self.ingredients = ingredients[:4] | |
else: | |
self.ingredients = ingredients | |
@property | |
def hasOverlappingEffects(self): | |
if len(self.ingredients) == 1: | |
return False | |
sideEffects = [ing.sideEffect for ing in self.ingredients if ing.sideEffect is not None] | |
hasOE = False | |
for i in range(len(sideEffects)): | |
if sideEffects[i] == None: | |
pass | |
elif sideEffects[i] is not sideEffects[i-1]: | |
hasOE = True | |
else: | |
pass | |
return hasOE | |
@property | |
def inGameName(self): | |
return "" | |
@property | |
def effect(self): | |
if self.hasOverlappingEffects: | |
return None | |
else: | |
for ing in self.ingredients: | |
if ing.sideEffect == None: | |
pass | |
else: | |
return ing.sideEffect | |
@property | |
def hpRestored(self): | |
'''The amount of HP (1/4 hearts) that will be restored when this dish is eaten | |
if there are no conflicting effects, and there is a hearty ingredient, this returns 120, the max HP Link can have''' | |
hp = 0 | |
if not self.hasOverlappingEffects: | |
for ing in self.ingredients: | |
if ing.sideEffect == 'hearty': | |
return 120 | |
else: | |
hp += ing.hpRestored | |
else: | |
for ing in self.ingredients: | |
hp += ing.hpRestored | |
return hp * 2 | |
if True: # ingredients | |
if True: #plants | |
if True: #fruit | |
apple = ingredient('Apple', 'fruit', None, None, 2) | |
fleetLotus = ingredient('Fleet-Lotus Seeds', 'fruit', None, 'hasty', 2) | |
durian = ingredient('Hearty Durian', 'fruit', None, 'hearty', 12) | |
hydromelon = ingredient('Hydromelon', 'fruit', None, 'cold', 2) | |
bannanas = ingredient('Mighty Bannanas', 'fruit', None, 'attack', 2) | |
palm = ingredient('Palm Fruit', 'fruit', None, None, 4) | |
pepper = ingredient('Spicy Pepper', 'fruit', None, 'warm', 2) | |
volt = ingredient('Volt Fruit', 'fruit', None, 'elec', 2) | |
wildberry = ingredient('Wildberry', 'fruit', None, None, 2) | |
if True: # mushrooms | |
zapshroom = ingredient('Zapshroom', 'mushroom', None, 'elec', 2) | |
chillshroom = ingredient('Chillshroom', 'mushroom', None, 'cold', 2) | |
sunshroom = ingredient('Sunshroom', 'mushroom', None, 'warm', 2) | |
staminaShroom = ingredient('Stamella Shroom', 'mushroom', None, 'stamina', 4) | |
rushroom = ingredient('Rushroom', 'mushroom', None, 'fast', 2) | |
silentShroom = ingredient('Silent Shroom', 'mushroom', None, 'sneak', 2) | |
razorshroom = ingredient('Razorshroom', 'mushroom', None, 'attack', 2) | |
ironshroom = ingredient('Ironshroom', 'mushroom', None, 'def', 2) | |
mushroom = ingredient('Hylian Shroom', 'mushroom', None, None, 2) | |
enduraShroom = ingredient('Endura Shroom', 'mushroom', None, 'stamina+', 4) | |
truffle = ingredient('Hearty Truffle', 'mushroom', 'truffle', 'hearty', 8) | |
bigTruffle = ingredient('Big Hearty Truffle', 'mushroom', 'truffle', 'hearty', 12) | |
if True: # veggies | |
bigRadish = ingredient('Big Hearty Radish', 'Vegetable', 'radish', 'hearty', 16) | |
staminaCarrot = ingredient('Endura Carrot', 'Vegetable', 'carrot', 'stamina+', 8) | |
pumpkin = ingredient('Fortified Pumpkin', 'Vegetable', None, 'def', 2) | |
radish = ingredient('Hearty Radish', 'Vegetable', 'radish', 'hearty', 10) | |
fastCarrot = ingredient('Swift Carrot', 'Vegetable', 'carrot', 'fast', 2) | |
if True:# meat | |
# not birds | |
meat = ingredient('Raw Meat', 'meat', 'meat', None, 4) | |
prime = ingredient('Raw Prime Meat', 'meat', 'meat', None, 6) | |
gourmet = ingredient('Raw Gourmet Meat', 'meat', 'meat', None, 9) | |
# birds | |
drumstick = ingredient('Raw Bird Drumstick', 'meat', 'bird', None, 4) | |
thigh = ingredient('Raw Bird Thigh', 'meat', 'bird', None, 4) | |
wholebird = ingredient('Raw Whole Bird', 'meat', 'bird', None, 4) | |
# seafood | |
if True: # carp | |
armorCarp = ingredient('Armored Carp', 'sea', 'fish', 'def', 2) | |
attackCarp = ingredient('Mighty Carp', 'sea', 'fish', 'attack', 4) | |
sankeCarp = ingredient('Sanke Carp', 'sea', 'fish', None, 4) | |
# porgy | |
armorPorgy = ingredient('Armored Porgy', 'sea', 'fish', 'def', 2) | |
attackPorgy = ingredient('Mighty Porgy', 'sea', 'fish', 'attack', 4) | |
# trout | |
coldTrout = ingredient('Chillfin Trout', 'sea', 'fish', 'cold', 4) | |
warmTrout = ingredient('Sizzlefin Trout', 'sea', 'fish', 'warm', 4) | |
sneakTrout = ingredient('Stealthfin Trout', 'sea', 'fish', 'sneak', 4) | |
elecTrout = ingredient('Voltfin Trout', 'sea', 'fish', 'elec', 4) | |
# bass | |
heartyBass = ingredient('Hearty Bass', 'sea', 'fish', 'hearty', 8) | |
bass = ingredient('Hyrule Bass', 'sea', 'fish', None, 4) | |
# salmon | |
salmon = ingredient('Hearty Salmon', 'sea', 'fish', 'hearty', 16) | |
# snails | |
blueshell = ingredient('Hearty Blueshell Snail', 'sea', 'snail', 'hearty', 12) | |
sneakyRiver = ingredient('Sneaky River Snail', 'sea', 'snail', 'sneak', 12) | |
# crabs | |
brightEyed = ingredient('Bright-Eyed Crab', 'sea', 'crab', 'stamina', 4) | |
ironshell = ingredient('Ironshell Crab', 'sea', 'crab', 'def', 4) | |
razorclaw = ingredient('Razorclaw Crab', 'sea', 'crab', 'attack', 4) | |
# herbs | |
herb = ingredient('Hyrule Herb', 'herb', None, None, 4) | |
nightshade = ingredient('Blue Nightshade', 'herb', None, 'sneak', 0) | |
coldSafflina = ingredient('Cool Safflina', 'herb', None, 'cold', 0) | |
warmSafflina = ingredient('Warm Safflina', 'herb', None, 'warm', 0) | |
elecSafflina = ingredient('Electric Safflina', 'herb', None, 'elec', 0) | |
armoranth = ingredient('Armoranth', 'herb', None, 'def', 0) | |
thistle = ingredient('Mighty Thistle', 'herb', None, 'attack', 0) | |
princess = ingredient('Silent Princess', 'herb', None, 'sneak', 0) | |
violet = ingredient('Swift Violet', 'herb', None, 'fast', 0) | |
# other | |
acorn = ingredient('Acorn', 'other', 'nut', None, 1) | |
egg = ingredient('Bird Egg', 'other', None, None, 4) | |
treeNut = ingredient('Chickaloo Tree Nut', 'other', 'nut', None, 1) | |
honey = ingredient('Courser Bee Honey', 'other', None, 'stamina', 8) | |
butter = ingredient('Goat Butter', 'other', None, None, 0) | |
rice = ingredient('Hylian Rice', 'other', None, None, 4) | |
goronSpice = ingredient('Goron Spice', 'other', None, None, 0) | |
wheat = ingredient('Tabantha Wheat', 'other', None, None, 4) | |
milk = ingredient('Fresh Milk', 'other', None, None, 2) | |
sugar = ingredient('Cane Sugar', 'other', None, None, 0) | |
# dragons | |
naydraClaw = ingredient('Naydra\'s Claw', 'dragon', None, None, 0) | |
naydraScale = ingredient('Naydra\'s Scale', 'dragon', None, None, 0) | |
naydraHorn = ingredient('Shard of Naydra\'s Horn', 'dragon', None, None, 0) | |
naydraFang = ingredient('Shard of Naydra\'s Fang', 'dragon', None, None, 0) | |
dinraalClaw = ingredient('Dinraal\'s Claw', 'dragon', None, None, 0) | |
dinraalScale = ingredient('Dinraal\'s Scale', 'dragon', None, None, 0) | |
dinraalHorn = ingredient('Shard of Dinraal\'s Horn', 'dragon', None, None, 0) | |
dinraalFang = ingredient('Shard of Dinraal\'s Fang', 'dragon', None, None, 0) | |
faroshClaw = ingredient('Farosh\'s Claw', 'dragon', None, None, 0) | |
faroshScale = ingredient('Farosh\'s Scale', 'dragon', None, None, 0) | |
faroshHorn = ingredient('Shard of Farosh\'s Horn', 'dragon', None, None, 0) | |
faroshFang = ingredient('Shard of Farosh\'s Fang', 'dragon', None, None, 0) | |
ingredients = [apple, acorn, armoranth, armorCarp, armorPorgy, attackCarp, attackPorgy, | |
bannanas, bass, bigRadish, bigTruffle, blueshell, brightEyed, butter, | |
chillshroom, coldSafflina, coldTrout, | |
drumstick, durian, | |
egg, elecSafflina, elecTrout, enduraShroom, | |
fastCarrot, fleetLotus, | |
goronSpice, gourmet, | |
heartyBass, honey, hydromelon, | |
ironshell, ironshroom, | |
meat, milk, mushroom, | |
nightshade, | |
palm, pepper, prime, princess, pumpkin, | |
radish, razorclaw, razorshroom, rice, rushroom, | |
salmon, sankeCarp, silentShroom, sneakTrout, sneakyRiver, staminaCarrot, staminaShroom, sugar, sunshroom, | |
thigh, thistle, treeNut, truffle, | |
violet, volt, | |
warmSafflina, warmTrout, wheat, wholebird, wildberry, | |
zapshroom] | |
dragonParts = [naydraClaw, naydraFang, naydraHorn, naydraScale, dinraalClaw, dinraalFang, dinraalHorn, dinraalScale, faroshClaw, faroshFang, faroshHorn, faroshScale] | |
def randomDish(includeDragons=True, allowOverlaps=False, ingredientCount=[1, 5]): | |
amnt = random.randint(ingredientCount[0], ingredientCount[1]) | |
ings = [] | |
allIngs = ingredients | |
if includeDragons: | |
allIngs = ingredients + dragonParts | |
if amnt == 1: | |
if includeDragons: | |
return dish([random.choice(allIngs)]) | |
return dish([random.choice(ingredients)]) | |
else: | |
ings.append(random.choice(ingredients)) | |
for i in range(1, amnt): | |
while True: | |
ing = random.choice(ingredients+dragonParts) | |
if not ing.isCompatibleWith(ings[i-1]) and allowOverlaps: | |
pass | |
else: | |
ings.append(ing) | |
break | |
dsh = dish(ings) | |
if dsh.hasOverlappingEffects: | |
return randomDish() | |
else: | |
return dsh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment