… | |
… | |
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. |
… | |
… | |
248 | * by another object. |
249 | * by another object. |
249 | */ |
250 | */ |
250 | //TODO: flag such as objects... as such (no drop, anybody?) |
251 | //TODO: flag such as objects... as such (no drop, anybody?) |
251 | if (op->type == SPELL) |
252 | if (op->type == SPELL) |
252 | { |
253 | { |
253 | op->destroy (true); |
254 | op->destroy (); |
254 | return; |
255 | return; |
255 | } |
256 | } |
256 | |
257 | |
257 | op->expand_tail (); |
258 | op->expand_tail (); |
258 | |
259 | |
259 | if (!creator->is_on_map () || op->blocked (creator->map, creator->x, creator->y)) |
260 | if (!creator->is_on_map () || op->blocked (creator->map, creator->x, creator->y)) |
260 | op->destroy (true); |
261 | op->destroy (); |
261 | else |
262 | else |
262 | { |
263 | { |
263 | SET_FLAG (op, FLAG_OBJ_ORIGINAL); |
264 | SET_FLAG (op, FLAG_OBJ_ORIGINAL); |
264 | op->insert_at (creator, creator, INS_NO_MERGE | INS_NO_WALK_ON); |
265 | op->insert_at (creator, creator, INS_NO_MERGE | INS_NO_WALK_ON); |
265 | } |
266 | } |
… | |
… | |
440 | tmp->remove (); |
441 | tmp->remove (); |
441 | |
442 | |
442 | if (ob->inv) |
443 | if (ob->inv) |
443 | LOG (llevError, "In generate treasure, created multiple objects.\n"); |
444 | LOG (llevError, "In generate treasure, created multiple objects.\n"); |
444 | |
445 | |
445 | ob->destroy (true); |
446 | ob->destroy (); |
446 | |
447 | |
447 | return tmp; |
448 | return tmp; |
448 | } |
449 | } |
449 | |
450 | |
450 | /* |
451 | /* |
… | |
… | |
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· |
… | |
… | |
1566 | #if 1 |
1567 | #if 1 |
1567 | LOG (llevError, "Got null entry and non zero roll in generate_artifact, type %d\n", op->type); |
1568 | LOG (llevError, "Got null entry and non zero roll in generate_artifact, type %d\n", op->type); |
1568 | #endif |
1569 | #endif |
1569 | return; |
1570 | return; |
1570 | } |
1571 | } |
1571 | if (!strcmp (art->item->name, "NONE")) |
1572 | |
|
|
1573 | if (art->item->name == shstr_NONE) |
1572 | return; |
1574 | return; |
|
|
1575 | |
1573 | if (FABS (op->magic) < art->item->magic) |
1576 | if (fabs (op->magic) < art->item->magic) |
1574 | continue; /* Not magic enough to be this item */ |
1577 | continue; /* Not magic enough to be this item */ |
1575 | |
1578 | |
1576 | /* Map difficulty not high enough */ |
1579 | /* Map difficulty not high enough */ |
1577 | if (difficulty < art->difficulty) |
1580 | if (difficulty < art->difficulty) |
1578 | continue; |
1581 | continue; |
… | |
… | |
1629 | item->level = donor->level; |
1632 | item->level = donor->level; |
1630 | |
1633 | |
1631 | /* if donor has some attacktypes, the flesh is poisonous */ |
1634 | /* if donor has some attacktypes, the flesh is poisonous */ |
1632 | if (donor->attacktype & AT_POISON) |
1635 | if (donor->attacktype & AT_POISON) |
1633 | item->type = POISON; |
1636 | item->type = POISON; |
|
|
1637 | |
1634 | if (donor->attacktype & AT_ACID) |
1638 | if (donor->attacktype & AT_ACID) |
1635 | item->stats.hp = -1 * item->stats.food; |
1639 | item->stats.hp = -1 * item->stats.food; |
|
|
1640 | |
1636 | SET_FLAG (item, FLAG_NO_STEAL); |
1641 | SET_FLAG (item, FLAG_NO_STEAL); |
1637 | } |
1642 | } |
1638 | } |
1643 | } |
1639 | |
1644 | |
1640 | /* special_potion() - so that old potion code is still done right. */ |
1645 | /* special_potion() - so that old potion code is still done right. */ |
… | |
… | |
1677 | free_artifact (artifact *at) |
1682 | free_artifact (artifact *at) |
1678 | { |
1683 | { |
1679 | if (at->next) free_artifact (at->next); |
1684 | if (at->next) free_artifact (at->next); |
1680 | if (at->allowed) free_charlinks (at->allowed); |
1685 | if (at->allowed) free_charlinks (at->allowed); |
1681 | |
1686 | |
1682 | at->item->destroy (true); |
1687 | at->item->destroy (); |
1683 | |
1688 | |
1684 | sfree (at); |
1689 | sfree (at); |
1685 | } |
1690 | } |
1686 | |
1691 | |
1687 | void |
1692 | void |