| 1 | /** |
| 2 | * @file |
| 3 | * Defines and variables used by the artifact generation routines. |
| 4 | */ |
| 5 | |
| 6 | #ifndef TREASURE_H |
| 7 | #define TREASURE_H |
| 8 | |
| 9 | /** Chance an item becomes an artifact if not magic is 1 in this value. */ |
| 10 | #define CHANCE_FOR_ARTIFACT 20 |
| 11 | |
| 12 | /** Maximum magic for difficulty/magic mapping. */ |
| 13 | #define MAXMAGIC 4 |
| 14 | |
| 15 | /** Maximum difficulty for difficulty/magic mapping. */ |
| 16 | #define DIFFLEVELS 201 |
| 17 | |
| 18 | /** Highest level of rods/staves/scrolls to generate. */ |
| 19 | #define MAX_SPELLITEM_LEVEL 110 |
| 20 | |
| 21 | /** |
| 22 | * Flags to generate_treasures(): |
| 23 | * |
| 24 | * @todo |
| 25 | * document some flags. |
| 26 | * |
| 27 | * @anchor GT_xxx |
| 28 | */ |
| 29 | |
| 30 | enum { |
| 31 | GT_ENVIRONMENT = 0x0001, /**< ? */ |
| 32 | GT_INVISIBLE = 0x0002, /**< Unused? */ |
| 33 | GT_STARTEQUIP = 0x0004, /**< Generated items have the ::FLAG_STARTEQUIP. */ |
| 34 | GT_ONLY_GOOD = 0x0008, /**< Don't generate bad/cursed items. Used for new player's equipment. */ |
| 35 | GT_UPDATE_INV = 0x0010, /**< When object has been generated, send its information to player. */ |
| 36 | GT_MINIMAL = 0x0020 /**< Do minimal adjustments, don't make artifacts, and so on. */ |
| 37 | }; |
| 38 | |
| 39 | /** |
| 40 | * when a treasure got cloned from archlist, we want perhaps change some default |
| 41 | * values. All values in this structure will override the default arch. |
| 42 | * TODO: It is a bad way to implement this with a special structure. |
| 43 | * Because the real arch list is a at runtime not changed, we can grap for example |
| 44 | * here a clone of the arch, store it in the treasure list and then run the original |
| 45 | * arch parser over this clone, using the treasure list as script until an END comes. |
| 46 | * This will allow ANY changes which is possible and we use ony one parser. |
| 47 | * |
| 48 | * @todo |
| 49 | * is this still used somewhere in the maps/code?? |
| 50 | */ |
| 51 | typedef struct _change_arch { |
| 52 | const char *name; /**< is != NULL, copy this over the original arch name */ |
| 53 | const char *title; /**< is != NULL, copy this over the original arch name */ |
| 54 | const char *slaying; /**< is != NULL, copy this over the original arch name */ |
| 55 | } _change_arch; |
| 56 | |
| 57 | /** |
| 58 | * treasure is one element in a linked list, which together consist of a |
| 59 | * complete treasure-list. Any arch can point to a treasure-list |
| 60 | * to get generated standard treasure when an archetype of that type |
| 61 | * is generated (from a generator) |
| 62 | */ |
| 63 | typedef struct treasurestruct { |
| 64 | struct archt *item; /**< Which item this link can be */ |
| 65 | const char *name; /**< If non null, name of list to use instead */ |
| 66 | struct treasurestruct *next; /**< Next treasure-item in a linked list */ |
| 67 | struct treasurestruct *next_yes; /**< If this item was generated, use this link instead of ->next */ |
| 68 | struct treasurestruct *next_no; /**< If this item was not generated, then continue here */ |
| 69 | struct _change_arch change_arch; /**< Override default arch values if set in treasure list */ |
| 70 | uint8_t chance; /**< Percent chance for this item */ |
| 71 | uint8_t magic; /**< Max magic bonus to item |
| 72 | * If the entry is a list transition, |
| 73 | * 'magic' contains the difficulty |
| 74 | * required to go to the new list |
| 75 | */ |
| 76 | uint16_t nrof; /**< random 1 to nrof items are generated */ |
| 77 | } treasure; |
| 78 | |
| 79 | /** |
| 80 | * treasureliststruct represents one logical group of items to be generated together. |
| 81 | */ |
| 82 | typedef struct treasureliststruct { |
| 83 | const char *name; /**< Usually monster-name/combination */ |
| 84 | int16_t total_chance; /**< If non-zero, only 1 item on this |
| 85 | * list should be generated. The |
| 86 | * total_chance contains the sum of |
| 87 | * the chance for this list. |
| 88 | */ |
| 89 | struct treasureliststruct *next; /**< Next treasure-item in linked list */ |
| 90 | struct treasurestruct *items; /**< Items in this list, linked */ |
| 91 | } treasurelist; |
| 92 | |
| 93 | #endif /* TREASURE_H */ |