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))) |
… | |
… | |
904 | * again below */ |
903 | * again below */ |
905 | } |
904 | } |
906 | } |
905 | } |
907 | |
906 | |
908 | /* materialtype modifications. Note we allow this on artifacts. */ |
907 | /* materialtype modifications. Note we allow this on artifacts. */ |
909 | set_materialname (op, difficulty, NULL); |
908 | select_material (op, difficulty); |
910 | |
909 | |
911 | if (flags & GT_MINIMAL) |
910 | if (flags & GT_MINIMAL) |
912 | { |
911 | { |
913 | if (op->type == POTION) |
912 | if (op->type == POTION) |
914 | /* Handle healing and magic power potions */ |
913 | /* Handle healing and magic power potions */ |
… | |
… | |
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)) |
… | |
… | |
1097 | * 10 time multiplier). This way, the value are a bit more reasonable. |
1095 | * 10 time multiplier). This way, the value are a bit more reasonable. |
1098 | */ |
1096 | */ |
1099 | op->value = op->value * op->inv->value * (op->level + 50) / (op->inv->level + 50); |
1097 | op->value = op->value * op->inv->value * (op->level + 50) / (op->inv->level + 50); |
1100 | /* maxhp is used to denote how many 'charges' the rod holds before */ |
1098 | /* maxhp is used to denote how many 'charges' the rod holds before */ |
1101 | if (op->stats.maxhp) |
1099 | if (op->stats.maxhp) |
1102 | op->stats.maxhp *= MAX (op->inv->stats.sp, op->inv->stats.grace); |
1100 | op->stats.maxhp *= max (op->inv->stats.sp, op->inv->stats.grace); |
1103 | else |
1101 | else |
1104 | op->stats.maxhp = 2 * MAX (op->inv->stats.sp, op->inv->stats.grace); |
1102 | op->stats.maxhp = 2 * max (op->inv->stats.sp, op->inv->stats.grace); |
1105 | |
1103 | |
1106 | op->stats.hp = op->stats.maxhp; |
1104 | op->stats.hp = op->stats.maxhp; |
1107 | break; |
1105 | break; |
1108 | |
1106 | |
1109 | case SCROLL: |
1107 | case SCROLL: |
… | |
… | |
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 | |
… | |
… | |
1465 | op->value *= change->value; |
1463 | op->value *= change->value; |
1466 | |
1464 | |
1467 | if (change->materials) |
1465 | if (change->materials) |
1468 | op->materials = change->materials; |
1466 | op->materials = change->materials; |
1469 | |
1467 | |
1470 | if (change->materialname) |
1468 | if (change->material != MATERIAL_NULL) |
1471 | op->materialname = change->materialname; |
1469 | op->material = change->material; |
1472 | |
1470 | |
1473 | if (change->slaying) |
1471 | if (change->slaying) |
1474 | op->slaying = change->slaying; |
1472 | op->slaying = change->slaying; |
1475 | |
1473 | |
1476 | if (change->race) |
1474 | if (change->race) |