… | |
… | |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008 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 |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * it under the terms of the GNU General Public License as published by |
9 | * the terms of the Affero GNU General Public License as published by the |
10 | * the Free Software Foundation, either version 3 of the License, or |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
11 | * (at your option) any later version. |
11 | * option) any later version. |
12 | * |
12 | * |
13 | * This program is distributed in the hope that it will be useful, |
13 | * This program is distributed in the hope that it will be useful, |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | * GNU General Public License for more details. |
16 | * GNU General Public License for more details. |
17 | * |
17 | * |
18 | * You should have received a copy of the GNU General Public License |
18 | * You should have received a copy of the Affero GNU General Public License |
19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | * and the GNU General Public License along with this program. If not, see |
|
|
20 | * <http://www.gnu.org/licenses/>. |
20 | * |
21 | * |
21 | * The authors can be reached via e-mail to <support@deliantra.net> |
22 | * The authors can be reached via e-mail to <support@deliantra.net> |
22 | */ |
23 | */ |
23 | |
24 | |
24 | /* TREASURE_DEBUG does some checking on the treasurelists after loading. |
25 | /* TREASURE_DEBUG does some checking on the treasurelists after loading. |
… | |
… | |
996 | op->value *= 5; |
997 | op->value *= 5; |
997 | set_ring_bonus (op, d); |
998 | set_ring_bonus (op, d); |
998 | } |
999 | } |
999 | } |
1000 | } |
1000 | |
1001 | |
1001 | if (GET_ANIM_ID (op)) |
1002 | if (op->animation_id) |
1002 | SET_ANIMATION (op, rndm (NUM_ANIMATIONS (op))); |
1003 | op->set_anim_frame (rndm (op->anim_frames ())); |
1003 | |
1004 | |
1004 | break; |
1005 | break; |
1005 | |
1006 | |
1006 | case BOOK: |
1007 | case BOOK: |
1007 | /* Is it an empty book?, if yes lets make a special· |
1008 | /* Is it an empty book?, if yes lets make a special· |
… | |
… | |
1022 | op->level = rndm (creator->level); |
1023 | op->level = rndm (creator->level); |
1023 | |
1024 | |
1024 | tailor_readable_ob (op, (creator && creator->stats.sp) ? creator->stats.sp : -1); |
1025 | tailor_readable_ob (op, (creator && creator->stats.sp) ? creator->stats.sp : -1); |
1025 | /* books w/ info are worth more! */ |
1026 | /* books w/ info are worth more! */ |
1026 | op->value *= ((op->level > 10 ? op->level : (op->level + 1) / 2) * ((strlen (op->msg) / 250) + 1)); |
1027 | op->value *= ((op->level > 10 ? op->level : (op->level + 1) / 2) * ((strlen (op->msg) / 250) + 1)); |
1027 | /* creator related stuff */ |
|
|
1028 | |
|
|
1029 | /* for library, chained books. Note that some monsters have no_pick |
|
|
1030 | * set - we don't want to set no pick in that case. |
|
|
1031 | */ |
|
|
1032 | if (QUERY_FLAG (creator, FLAG_NO_PICK) && !QUERY_FLAG (creator, FLAG_MONSTER)) |
|
|
1033 | SET_FLAG (op, FLAG_NO_PICK); |
|
|
1034 | if (creator->slaying && !op->slaying) /* for check_inv floors */ |
|
|
1035 | op->slaying = creator->slaying; |
|
|
1036 | |
1028 | |
1037 | /* add exp so reading it gives xp (once) */ |
1029 | /* add exp so reading it gives xp (once) */ |
1038 | op->stats.exp = op->value > 10000 ? op->value / 5 : op->value / 10; |
1030 | op->stats.exp = op->value > 10000 ? op->value / 5 : op->value / 10; |
1039 | } |
1031 | } |
|
|
1032 | |
|
|
1033 | /* creator related stuff */ |
|
|
1034 | |
|
|
1035 | /* for library, chained books. Note that some monsters have no_pick |
|
|
1036 | * set - we don't want to set no pick in that case. |
|
|
1037 | */ |
|
|
1038 | if (QUERY_FLAG (creator, FLAG_NO_PICK) && !QUERY_FLAG (creator, FLAG_MONSTER)) |
|
|
1039 | SET_FLAG (op, FLAG_NO_PICK); |
|
|
1040 | if (creator->slaying && !op->slaying) /* for check_inv floors */ |
|
|
1041 | op->slaying = creator->slaying; |
1040 | break; |
1042 | break; |
1041 | |
1043 | |
1042 | case SPELLBOOK: |
1044 | case SPELLBOOK: |
1043 | op->value = op->value * op->inv->value; |
1045 | op->value = op->value * op->inv->value; |
1044 | /* add exp so learning gives xp */ |
1046 | /* add exp so learning gives xp */ |