1 | /* |
1 | /* |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008,2009 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
7 | * |
7 | * |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * the terms of the Affero GNU General Public License as published by the |
9 | * the terms of the Affero GNU General Public License as published by the |
… | |
… | |
834 | create_treasure (op->randomitems, op, flags & ~GT_ENVIRONMENT, difficulty, 0); |
834 | create_treasure (op->randomitems, op, flags & ~GT_ENVIRONMENT, difficulty, 0); |
835 | /* So the treasure doesn't get created again */ |
835 | /* So the treasure doesn't get created again */ |
836 | op->randomitems = 0; |
836 | op->randomitems = 0; |
837 | } |
837 | } |
838 | |
838 | |
839 | if (difficulty < 1) |
839 | max_it (difficulty, 1); |
840 | difficulty = 1; |
|
|
841 | |
840 | |
842 | if (INVOKE_OBJECT (ADD_BONUS, op, |
841 | if (INVOKE_OBJECT (ADD_BONUS, op, |
843 | ARG_OBJECT (creator != op ? creator : 0), |
842 | ARG_OBJECT (creator != op ? creator : 0), |
844 | ARG_INT (difficulty), ARG_INT (max_magic), |
843 | ARG_INT (difficulty), ARG_INT (max_magic), |
845 | ARG_INT (flags))) |
844 | ARG_INT (flags))) |
… | |
… | |
945 | int too_many_tries = 0, is_special = 0; |
944 | int too_many_tries = 0, is_special = 0; |
946 | |
945 | |
947 | /* Handle healing and magic power potions */ |
946 | /* Handle healing and magic power potions */ |
948 | if (op->stats.sp && !op->randomitems) |
947 | if (op->stats.sp && !op->randomitems) |
949 | { |
948 | { |
950 | object *tmp; |
|
|
951 | |
|
|
952 | tmp = get_archetype (spell_mapping[op->stats.sp]); |
949 | object *tmp = get_archetype (spell_mapping[op->stats.sp]); |
953 | insert_ob_in_ob (tmp, op); |
950 | insert_ob_in_ob (tmp, op); |
954 | op->stats.sp = 0; |
951 | op->stats.sp = 0; |
955 | } |
952 | } |
956 | |
953 | |
957 | while (!(is_special = special_potion (op)) && !op->inv) |
954 | while (!(is_special = special_potion (op)) && !op->inv) |
… | |
… | |
965 | * since the value set on those is already correct. |
962 | * since the value set on those is already correct. |
966 | */ |
963 | */ |
967 | if (op->inv && op->randomitems) |
964 | if (op->inv && op->randomitems) |
968 | { |
965 | { |
969 | /* value multiplier is same as for scrolls */ |
966 | /* value multiplier is same as for scrolls */ |
970 | op->value = (op->value * op->inv->value); |
967 | op->value *= op->inv->value; |
971 | op->level = op->inv->level / 2 + rndm (difficulty) + rndm (difficulty); |
968 | op->level = op->inv->level / 2 + rndm (difficulty) + rndm (difficulty); |
972 | } |
969 | } |
973 | else |
970 | else |
974 | { |
971 | { |
975 | op->name = "potion"; |
972 | op->name = "potion"; |
976 | op->name_pl = "potions"; |
973 | op->name_pl = "potions"; |
977 | } |
974 | } |
978 | |
975 | |
979 | if (!(flags & GT_ONLY_GOOD) && rndm (2)) |
976 | if (!(flags & GT_ONLY_GOOD) && rndm (2)) |
980 | SET_FLAG (op, FLAG_CURSED); |
977 | SET_FLAG (op, FLAG_CURSED); |
|
|
978 | |
981 | break; |
979 | break; |
982 | } |
980 | } |
983 | |
981 | |
984 | case AMULET: |
982 | case AMULET: |
985 | if (IS_ARCH (op->arch, amulet)) |
983 | if (IS_ARCH (op->arch, amulet)) |
… | |
… | |
1146 | |
1144 | |
1147 | /* |
1145 | /* |
1148 | * Allocate and return the pointer to an empty artifactlist structure. |
1146 | * Allocate and return the pointer to an empty artifactlist structure. |
1149 | */ |
1147 | */ |
1150 | static artifactlist * |
1148 | static artifactlist * |
1151 | get_empty_artifactlist (void) |
1149 | get_empty_artifactlist () |
1152 | { |
1150 | { |
1153 | return salloc0<artifactlist> (); |
1151 | return salloc0<artifactlist> (); |
1154 | } |
1152 | } |
1155 | |
1153 | |
1156 | /* |
1154 | /* |
1157 | * Allocate and return the pointer to an empty artifact structure. |
1155 | * Allocate and return the pointer to an empty artifact structure. |
1158 | */ |
1156 | */ |
1159 | static artifact * |
1157 | static artifact * |
1160 | get_empty_artifact (void) |
1158 | get_empty_artifact () |
1161 | { |
1159 | { |
1162 | return salloc0<artifact> (); |
1160 | return salloc0<artifact> (); |
1163 | } |
1161 | } |
1164 | |
1162 | |
1165 | /* |
1163 | /* |
… | |
… | |
1178 | |
1176 | |
1179 | /* |
1177 | /* |
1180 | * Builds up the lists of artifacts from the file in the libdir. |
1178 | * Builds up the lists of artifacts from the file in the libdir. |
1181 | */ |
1179 | */ |
1182 | void |
1180 | void |
1183 | init_artifacts (void) |
1181 | init_artifacts () |
1184 | { |
1182 | { |
1185 | static int has_been_inited = 0; |
1183 | static int has_been_inited = 0; |
1186 | char filename[MAX_BUF]; |
1184 | char filename[MAX_BUF]; |
1187 | artifact *art = NULL; |
1185 | artifact *art = NULL; |
1188 | artifactlist *al; |
1186 | artifactlist *al; |