… | |
… | |
441 | |
441 | |
442 | if (ob->inv) |
442 | if (ob->inv) |
443 | LOG (llevError, "In generate treasure, created multiple objects.\n"); |
443 | LOG (llevError, "In generate treasure, created multiple objects.\n"); |
444 | |
444 | |
445 | ob->destroy (); |
445 | ob->destroy (); |
|
|
446 | |
446 | return tmp; |
447 | return tmp; |
447 | } |
448 | } |
448 | |
449 | |
449 | /* |
450 | /* |
450 | * This is a new way of calculating the chance for an item to have |
451 | * This is a new way of calculating the chance for an item to have |
… | |
… | |
965 | case AMULET: |
966 | case AMULET: |
966 | if (IS_ARCH (op->arch, amulet)) |
967 | if (IS_ARCH (op->arch, amulet)) |
967 | op->value *= 5; /* Since it's not just decoration */ |
968 | op->value *= 5; /* Since it's not just decoration */ |
968 | |
969 | |
969 | case RING: |
970 | case RING: |
970 | if (!op->arch) // wtf? schmorp |
|
|
971 | { |
|
|
972 | op->destroy (); |
|
|
973 | op = 0; |
|
|
974 | break; |
|
|
975 | } |
|
|
976 | |
|
|
977 | if (!IS_ARCH (op->arch, ring) && !IS_ARCH (op->arch, amulet)) /* It's a special artifact! */ |
971 | if (!IS_ARCH (op->arch, ring) && !IS_ARCH (op->arch, amulet)) /* It's a special artifact! */ |
978 | break; |
972 | break; |
979 | |
973 | |
980 | if (!(flags & GT_ONLY_GOOD) && !(rndm (3))) |
974 | if (!(flags & GT_ONLY_GOOD) && !(rndm (3))) |
981 | SET_FLAG (op, FLAG_CURSED); |
975 | SET_FLAG (op, FLAG_CURSED); |
… | |
… | |
1353 | * to cast. So convert that to into a spell and put it into |
1347 | * to cast. So convert that to into a spell and put it into |
1354 | * this object. |
1348 | * this object. |
1355 | */ |
1349 | */ |
1356 | if (op->type == HORN || op->type == POTION) |
1350 | if (op->type == HORN || op->type == POTION) |
1357 | { |
1351 | { |
1358 | object *tmp_obj; |
|
|
1359 | |
|
|
1360 | /* Remove any spells this object currently has in it */ |
1352 | /* Remove any spells this object currently has in it */ |
1361 | while (op->inv) |
|
|
1362 | op->inv->destroy (); |
1353 | op->destroy_inv (false); |
1363 | |
1354 | |
1364 | tmp_obj = arch_to_object (change->other_arch); |
1355 | object *tmp = arch_to_object (change->other_arch); |
1365 | insert_ob_in_ob (tmp_obj, op); |
1356 | insert_ob_in_ob (tmp, op); |
1366 | } |
1357 | } |
1367 | /* No harm setting this for potions/horns */ |
1358 | /* No harm setting this for potions/horns */ |
1368 | op->other_arch = change->other_arch; |
1359 | op->other_arch = change->other_arch; |
1369 | } |
1360 | } |
1370 | |
1361 | |
… | |
… | |
1575 | #if 1 |
1566 | #if 1 |
1576 | LOG (llevError, "Got null entry and non zero roll in generate_artifact, type %d\n", op->type); |
1567 | LOG (llevError, "Got null entry and non zero roll in generate_artifact, type %d\n", op->type); |
1577 | #endif |
1568 | #endif |
1578 | return; |
1569 | return; |
1579 | } |
1570 | } |
1580 | if (!strcmp (art->item->name, "NONE")) |
1571 | |
|
|
1572 | if (art->item->name == shstr_NONE) |
1581 | return; |
1573 | return; |
|
|
1574 | |
1582 | if (FABS (op->magic) < art->item->magic) |
1575 | if (fabs (op->magic) < art->item->magic) |
1583 | continue; /* Not magic enough to be this item */ |
1576 | continue; /* Not magic enough to be this item */ |
1584 | |
1577 | |
1585 | /* Map difficulty not high enough */ |
1578 | /* Map difficulty not high enough */ |
1586 | if (difficulty < art->difficulty) |
1579 | if (difficulty < art->difficulty) |
1587 | continue; |
1580 | continue; |
… | |
… | |
1638 | item->level = donor->level; |
1631 | item->level = donor->level; |
1639 | |
1632 | |
1640 | /* if donor has some attacktypes, the flesh is poisonous */ |
1633 | /* if donor has some attacktypes, the flesh is poisonous */ |
1641 | if (donor->attacktype & AT_POISON) |
1634 | if (donor->attacktype & AT_POISON) |
1642 | item->type = POISON; |
1635 | item->type = POISON; |
|
|
1636 | |
1643 | if (donor->attacktype & AT_ACID) |
1637 | if (donor->attacktype & AT_ACID) |
1644 | item->stats.hp = -1 * item->stats.food; |
1638 | item->stats.hp = -1 * item->stats.food; |
|
|
1639 | |
1645 | SET_FLAG (item, FLAG_NO_STEAL); |
1640 | SET_FLAG (item, FLAG_NO_STEAL); |
1646 | } |
1641 | } |
1647 | } |
1642 | } |
1648 | |
1643 | |
1649 | /* special_potion() - so that old potion code is still done right. */ |
1644 | /* special_potion() - so that old potion code is still done right. */ |
… | |
… | |
1686 | free_artifact (artifact *at) |
1681 | free_artifact (artifact *at) |
1687 | { |
1682 | { |
1688 | if (at->next) free_artifact (at->next); |
1683 | if (at->next) free_artifact (at->next); |
1689 | if (at->allowed) free_charlinks (at->allowed); |
1684 | if (at->allowed) free_charlinks (at->allowed); |
1690 | |
1685 | |
1691 | at->item->destroy (1); |
1686 | at->item->destroy (); |
1692 | |
1687 | |
1693 | sfree (at); |
1688 | sfree (at); |
1694 | } |
1689 | } |
1695 | |
1690 | |
1696 | void |
1691 | void |