evennia.contrib.game_systems.crafting.example_recipes

How to make a sword - example crafting tree for the crafting system.

See the SwordSmithingBaseRecipe in this module for an example of extendng the recipe with a mocked ‘skill’ system (just random chance in our case). The skill system used is game-specific but likely to be needed for most ‘real’ crafting systems.

Note that ‘tools’ are references to the tools used - they don’t need to be in the inventory of the crafter. So when ‘blast furnace’ is given below, it is a reference to a blast furnace used, not suggesting the crafter is carrying it around with them.

Sword crafting tree

# base materials (consumables)

iron ore, ash, sand, coal, oak wood, water, fur

# base tools (marked with [T] for clarity and assumed to already exist)

blast furnace[T], furnace[T], crucible[T], anvil[T],
hammer[T], knife[T], cauldron[T]

# recipes for making a sword

pig iron = iron ore + 2xcoal + blast furnace[T]
crucible_steel = pig iron + ash + sand + 2xcoal + crucible[T]
sword blade = crucible steel + hammer[T] + anvil[T] + furnace[T]
sword pommel = crucible steel + hammer[T] + anvil[T] + furnace[T]
sword guard = crucible steel + hammer[T] + anvil[T] + furnace[T]

rawhide = fur + knife[T]
oak bark + cleaned oak wood = oak wood + knife[T]
leather = rawhide + oak bark + water + cauldron[T]

sword handle = cleaned oak wood + knife[T]

sword = sword blade + sword guard + sword pommel
        + sword handle + leather + knife[T] + hammer[T] + furnace[T]

Recipes used for spell casting

This is a simple example modifying the base Recipe to use as a way to describe magical spells instead. It combines tools with a skill (an attribute on the caster) in order to produce a magical effect.

The example CmdCast command can be added to the CharacterCmdset in mygame/commands/default_cmdsets to test it out. The ‘effects’ are just mocked for the example.

::

# base tools (assumed to already exist)

spellbook[T], wand[T]

# skill (stored as Attribute on caster)

firemagic skill level10+

# recipe for fireball

fireball = spellbook[T] + wand[T] + [firemagic skill lvl10+]


evennia.contrib.game_systems.crafting.example_recipes.random() → x in the interval [0, 1).
class evennia.contrib.game_systems.crafting.example_recipes.PigIronRecipe(crafter, *inputs, **kwargs)[source]

Bases: evennia.contrib.game_systems.crafting.crafting.CraftingRecipe

Pig iron is a high-carbon result of melting iron in a blast furnace.

name = 'pig iron'
tool_tags = ['blast furnace']
consumable_tags = ['iron ore', 'coal', 'coal']
output_prototypes = [{'key': 'Pig Iron ingot', 'desc': 'An ingot of crude pig iron.', 'tags': [('pig iron', 'crafting_material')]}]
class evennia.contrib.game_systems.crafting.example_recipes.CrucibleSteelRecipe(crafter, *inputs, **kwargs)[source]

Bases: evennia.contrib.game_systems.crafting.crafting.CraftingRecipe

Mixing pig iron with impurities like ash and sand and melting it in a crucible produces a medieval level of steel (like damascus steel).

name = 'crucible steel'
tool_tags = ['crucible']
consumable_tags = ['pig iron', 'ash', 'sand', 'coal', 'coal']
output_prototypes = [{'key': 'Crucible steel ingot', 'desc': 'An ingot of multi-colored crucible steel.', 'tags': [('crucible steel', 'crafting_material')]}]
class evennia.contrib.game_systems.crafting.example_recipes.SwordBladeRecipe(crafter, *inputs, **kwargs)[source]

Bases: evennia.contrib.game_systems.crafting.example_recipes._SwordSmithingBaseRecipe

A [sword]blade requires hammering the steel out into shape using heat and force. This also includes the tang, which is the base for the hilt (the part of the sword you hold on to).

name = 'sword blade'
tool_tags = ['hammer', 'anvil', 'furnace']
consumable_tags = ['crucible steel']
output_prototypes = [{'key': 'Sword blade', 'desc': 'A long blade that may one day become a sword.', 'tags': [('sword blade', 'crafting_material')]}]
class evennia.contrib.game_systems.crafting.example_recipes.SwordPommelRecipe(crafter, *inputs, **kwargs)[source]

Bases: evennia.contrib.game_systems.crafting.example_recipes._SwordSmithingBaseRecipe

The pommel is the ‘button’ or ‘ball’ etc the end of the sword hilt, holding it together.

name = 'sword pommel'
tool_tags = ['hammer', 'anvil', 'furnace']
consumable_tags = ['crucible steel']
output_prototypes = [{'key': 'Sword pommel', 'desc': 'The pommel for a future sword.', 'tags': [('sword pommel', 'crafting_material')]}]
class evennia.contrib.game_systems.crafting.example_recipes.SwordGuardRecipe(crafter, *inputs, **kwargs)[source]

Bases: evennia.contrib.game_systems.crafting.example_recipes._SwordSmithingBaseRecipe

The guard stops the hand from accidentally sliding off the hilt onto the sword’s blade and also protects the hand when parrying.

name = 'sword guard'
tool_tags = ['hammer', 'anvil', 'furnace']
consumable_tags = ['crucible steel']
output_prototypes = [{'key': 'Sword guard', 'desc': 'The cross-guard for a future sword.', 'tags': [('sword guard', 'crafting_material')]}]
class evennia.contrib.game_systems.crafting.example_recipes.RawhideRecipe(crafter, *inputs, **kwargs)[source]

Bases: evennia.contrib.game_systems.crafting.crafting.CraftingRecipe

Rawhide is animal skin cleaned and stripped of hair.

name = 'rawhide'
tool_tags = ['knife']
consumable_tags = ['fur']
output_prototypes = [{'key': 'Rawhide', 'desc': 'Animal skin, cleaned and with hair removed.', 'tags': [('rawhide', 'crafting_material')]}]
class evennia.contrib.game_systems.crafting.example_recipes.OakBarkRecipe(crafter, *inputs, **kwargs)[source]

Bases: evennia.contrib.game_systems.crafting.crafting.CraftingRecipe

The actual thing needed for tanning leather is Tannin, but we skip the step of refining tannin from the bark and use the bark as-is.

This produces two outputs - the bark and the cleaned wood.

name = 'oak bark'
tool_tags = ['knife']
consumable_tags = ['oak wood']
output_prototypes = [{'key': 'Oak bark', 'desc': 'Bark of oak, stripped from the core wood.', 'tags': [('oak bark', 'crafting_material')]}, {'key': 'Oak Wood (cleaned)', 'desc': 'Oakwood core, stripped of bark.', 'tags': [('cleaned oak wood', 'crafting_material')]}]
class evennia.contrib.game_systems.crafting.example_recipes.LeatherRecipe(crafter, *inputs, **kwargs)[source]

Bases: evennia.contrib.game_systems.crafting.crafting.CraftingRecipe

Leather is produced by tanning rawhide in a process traditionally involving the chemical Tannin. Here we abbreviate this process a bit. Maybe a ‘tanning rack’ tool should be required too …

name = 'leather'
tool_tags = ['cauldron']
consumable_tags = ['rawhide', 'oak bark', 'water']
output_prototypes = [{'key': 'Piece of Leather', 'desc': 'A piece of leather.', 'tags': [('leather', 'crafting_material')]}]
class evennia.contrib.game_systems.crafting.example_recipes.SwordHandleRecipe(crafter, *inputs, **kwargs)[source]

Bases: evennia.contrib.game_systems.crafting.crafting.CraftingRecipe

The handle is the part of the hilt between the guard and the pommel where you hold the sword. It consists of wooden pieces around the steel tang. It is wrapped in leather, but that will be added at the end.

name = 'sword handle'
tool_tags = ['knife']
consumable_tags = ['cleaned oak wood']
output_prototypes = [{'key': 'Sword handle', 'desc': "Two pieces of wood to be be fitted onto a sword's tang as its handle.", 'tags': [('sword handle', 'crafting_material')]}]
class evennia.contrib.game_systems.crafting.example_recipes.SwordRecipe(crafter, *inputs, **kwargs)[source]

Bases: evennia.contrib.game_systems.crafting.example_recipes._SwordSmithingBaseRecipe

A finished sword consists of a Blade ending in a non-sharp part called the Tang. The cross Guard is put over the tang against the edge of the blade. The Handle is put over the tang to give something easier to hold. The Pommel locks everything in place. The handle is wrapped in leather strips for better grip.

This covers only a single ‘sword’ type.

name = 'sword'
tool_tags = ['hammer', 'furnace', 'knife']
consumable_tags = ['sword blade', 'sword guard', 'sword pommel', 'sword handle', 'leather']
output_prototypes = [{'key': 'Sword', 'desc': 'A bladed weapon.', 'tags': [('sword', 'crafting_material')]}]
exact_consumable_order = True
class evennia.contrib.game_systems.crafting.example_recipes.FireballRecipe(crafter, *inputs, **kwargs)[source]

Bases: evennia.contrib.game_systems.crafting.example_recipes._MagicRecipe

A Fireball is a magical effect that can be thrown at a target to cause damage.

Note that the magic-effects are just examples, an actual rule system would need to be created to understand what they mean when used.

name = 'fireball'
skill_requirements = [('firemagic', 10)]
skill_roll = 'firemagic'
success_message = 'A ball of flame appears!'
desired_effects = [('target_fire_damage', 25), ('ranged_attack', -2), ('mana_cost', 12)]
failure_effects = [('self_fire_damage', 5), ('mana_cost', 5)]
class evennia.contrib.game_systems.crafting.example_recipes.HealingRecipe(crafter, *inputs, **kwargs)[source]

Bases: evennia.contrib.game_systems.crafting.example_recipes._MagicRecipe

Healing magic will restore a certain amount of health to the target over time.

Note that the magic-effects are just examples, an actual rule system would need to be created to understand what they mean.

name = 'heal'
skill_requirements = [('bodymagic', 5), ('empathy', 10)]
skill_roll = 'bodymagic'
success_message = 'You successfully extend your healing aura.'
desired_effects = [('healing', 15), ('mana_cost', 5)]
failure_effects = []
class evennia.contrib.game_systems.crafting.example_recipes.CmdCast(**kwargs)[source]

Bases: evennia.commands.command.Command

Cast a magical spell.

Usage:

cast <spell> <target>

key = 'cast'
parse()[source]

Simple parser, assuming spellname doesn’t have spaces. Stores result in self.target and self.spellname.

func()[source]

This is the actual executing part of the command. It is called directly after self.parse(). See the docstring of this module for which object properties are available (beyond those set in self.parse())

aliases = []
help_category = 'general'
lock_storage = 'cmd:all();'
search_index_entry = {'aliases': '', 'category': 'general', 'key': 'cast', 'no_prefix': ' ', 'tags': '', 'text': '\n Cast a magical spell.\n\n Usage:\n cast <spell> <target>\n\n '}