1# Artifacts
2
3## Introduction
4
5An "artifact" is a special game item with unique "magic" effects.  It uses a base item id and enhances it with further abilities.
6
7## Generation
8
9The procedural generation of artifacts is defined in Json. The object looks like the following:
10```json
11{
12    "type": "relic_procgen_data",
13    "id": "cult",
14    "charge_types": [
15      {
16        "weight": 100,
17        "charges": { "range": [ 0, 3 ], "power": 25 },
18        "charges_per_use":{ "range": [ 1, 1 ], "power": 25 },
19        "max_charges": { "range": [ 1, 3 ], "power": 25 },
20        "recharge_type": "periodic",
21        "time": [ "3 h", "6 h" ]
22      }
23    ],
24    "active_procgen_values": [ { "weight": 100, "spell_id": "AEA_PAIN" } ],
25    "passive_add_procgen_values": [
26        {
27            "weight": 100,
28            "min_value": -1,
29            "max_value": 1,
30            "type": "STRENGTH",
31            "increment": 1,
32            "power_per_increment": 250
33        }
34    ],
35    "passive_mult_procgen_values": [
36        {
37            "weight": 100,
38            "min_value": -1.5,
39            "max_value": 1.5,
40            "type": "STRENGTH",
41            "increment": 0.1,
42            "power_per_increment": 250
43        }
44    ],
45    "type_weights": [ { "weight": 100, "value": "passive_enchantment_add" } ],
46    "items": [ { "weight": 100, "item": "spoon" } ]
47  }
48```
49
50### charge_types
51
52The various ways this artifact can charge and use charges.
53
54- **charges** the number of charges this artifact starts with - a random value between the two ones in 'range' are picked, and power is the power value.
55- **charges_per_use** how many charges you spend with each use of this artifact - a random value between the two ones in 'range' are picked, and power is the power value.
56- **max_charges** The maximum number of charges this artifact can have. - a random value between the two ones in 'range' are picked, and power is the power value.
57- **recharge_type** How this artifact recharges
58- **time** The amount of time this artifact takes to recharge - a random value between the two ones provided is picked.
59
60#### recharge_types
61
62- **none** This artifact does not recharge
63- **periodic** This artifact takes 'time' amount of time to recharge
64
65### passive_add_procgen_values and passive_mult_procgen_values
66
67As the names suggest, these are *passive* benefits/penalties to having the artifact (ie. always present without activating the artifact's abilities).  **Add** values add or subtract from existing scores, and **mult** values multiply them.  These are entered as a list of possible 'abilities' the artifact could get. It does not by default get all these abilities, rather when it spawns it selects from the list provided.
68
69- **weight:** the weight of this value in the list, to be chosen randomly
70- **min_value:** the minimum possible value for this value type. for add must be an integer, for mult it can be a float
71- **max_value:** the maximum possible value for this value type. for add must be an integer, for mult it can be a float
72- **type:** the type of enchantment value. see MAGIC.md for detailed documentation on enchantment values
73- **increment:** the increment that is used for the power multiplier
74- **power_per_increment:** the power value per increment
75
76### type_weights
77This determines the relative weight of the 'add' and 'mult' types.  When generated, an artifact first decides if it is going to apply an 'add' or a 'mult' ability based on the type_weights of each.  Then it uses the weights of the entries under the selected type to pick an ability.  This continues cycling until the artifact reaches the defined power level.  Possible values right now that are functional are:
78- passive_enchantment_add
79- passive_enchantment_mult
80
81This must be included in a dataset or it could cause a crash.
82
83### items
84This provides a list of possible items that this artifact can spawn as, if it appears randomly in a hard-coded map extra.
85
86## Power Level
87An artifact's power level is a summation of its attributes. For example, each point of strength addition in the above object, the artifact is a +250 power, so an artifact with +2 strength would have a power level of 500. similarly, if an artifact had a strength multiplier of 0.8, it would have a power level of -500.
88