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)) |
… | |
… | |
1208 | |
1206 | |
1209 | { |
1207 | { |
1210 | if (!strcmp (f.get_str (), "all")) |
1208 | if (!strcmp (f.get_str (), "all")) |
1211 | break; |
1209 | break; |
1212 | |
1210 | |
1213 | char *next, *cp = f.get_str (); |
1211 | const char *cp = f.get_str (); |
1214 | |
1212 | char *next; |
1215 | do |
1213 | do |
1216 | { |
1214 | { |
1217 | if ((next = strchr (cp, ','))) |
1215 | if ((next = strchr (cp, ','))) |
1218 | *next++ = '\0'; |
1216 | *next++ = '\0'; |
1219 | |
1217 | |