… | |
… | |
1549 | * For example, if an item is worth 110 gold, you will get |
1549 | * For example, if an item is worth 110 gold, you will get |
1550 | * 4 large nuggets, and from 0-10 small nuggets. |
1550 | * 4 large nuggets, and from 0-10 small nuggets. |
1551 | * |
1551 | * |
1552 | * There is also a chance (1:30) that you will get nothing at all |
1552 | * There is also a chance (1:30) that you will get nothing at all |
1553 | * for the object. There is also a maximum weight that will be |
1553 | * for the object. There is also a maximum weight that will be |
1554 | * alchemied. |
1554 | * alchemised. |
1555 | */ |
1555 | */ |
1556 | |
1556 | |
1557 | /* I didn't feel like passing these as arguements to the |
1557 | /* I didn't feel like passing these as argumeents to the |
1558 | * two functions that need them. Real values are put in them |
1558 | * two functions that need them. Real values are put in them |
1559 | * when the spell is cast, and these are freed when the spell |
1559 | * when the spell is cast, and these are freed when the spell |
1560 | * is finished. |
1560 | * is finished. |
1561 | */ |
1561 | */ |
1562 | static object *small, *large; |
1562 | static object *small, *large; |
… | |
… | |
1581 | else |
1581 | else |
1582 | value = (value * 9) / 10; |
1582 | value = (value * 9) / 10; |
1583 | |
1583 | |
1584 | value /= 4; // fix by GHJ, don't understand, pcg |
1584 | value /= 4; // fix by GHJ, don't understand, pcg |
1585 | |
1585 | |
1586 | if ((obj->value > 0) && rndm (0, 29)) |
1586 | if (obj->value > 0 && rndm (0, 29)) |
1587 | { |
1587 | { |
1588 | int count; |
1588 | int count; |
1589 | |
1589 | |
1590 | count = value / large->value; |
1590 | count = value / large->value; |
1591 | *large_nuggets += count; |
1591 | *large_nuggets += count; |
… | |
… | |
1604 | (*large_nuggets)++; |
1604 | (*large_nuggets)++; |
1605 | *small_nuggets -= large->value / small->value; |
1605 | *small_nuggets -= large->value / small->value; |
1606 | if (*small_nuggets && large->value % small->value) |
1606 | if (*small_nuggets && large->value % small->value) |
1607 | (*small_nuggets)--; |
1607 | (*small_nuggets)--; |
1608 | } |
1608 | } |
|
|
1609 | |
1609 | weight += obj->weight; |
1610 | weight += obj->weight; |
1610 | obj->destroy (); |
1611 | obj->destroy (); |
1611 | } |
1612 | } |
1612 | |
1613 | |
1613 | static void |
1614 | static void |
… | |
… | |
1678 | continue; |
1679 | continue; |
1679 | |
1680 | |
1680 | small_nuggets = 0; |
1681 | small_nuggets = 0; |
1681 | large_nuggets = 0; |
1682 | large_nuggets = 0; |
1682 | |
1683 | |
1683 | for (tmp = GET_MAP_OB (mp, nx, ny); tmp != NULL; tmp = next) |
1684 | for (tmp = mp->at (nx, ny).bot; tmp; tmp = next) |
1684 | { |
1685 | { |
1685 | next = tmp->above; |
1686 | next = tmp->above; |
|
|
1687 | |
1686 | if (tmp->weight > 0 && !QUERY_FLAG (tmp, FLAG_NO_PICK) && |
1688 | if (tmp->weight > 0 && !QUERY_FLAG (tmp, FLAG_NO_PICK) && |
1687 | !QUERY_FLAG (tmp, FLAG_ALIVE) && !QUERY_FLAG (tmp, FLAG_IS_CAULDRON)) |
1689 | !QUERY_FLAG (tmp, FLAG_ALIVE) && !QUERY_FLAG (tmp, FLAG_IS_CAULDRON)) |
1688 | { |
1690 | { |
1689 | |
|
|
1690 | if (tmp->inv) |
1691 | if (tmp->inv) |
1691 | { |
1692 | { |
1692 | object *next1, *tmp1; |
1693 | object *next1, *tmp1; |
1693 | |
1694 | |
1694 | for (tmp1 = tmp->inv; tmp1 != NULL; tmp1 = next1) |
1695 | for (tmp1 = tmp->inv; tmp1; tmp1 = next1) |
1695 | { |
1696 | { |
1696 | next1 = tmp1->below; |
1697 | next1 = tmp1->below; |
1697 | if (tmp1->weight > 0 && !QUERY_FLAG (tmp1, FLAG_NO_PICK) && |
1698 | if (tmp1->weight > 0 && !QUERY_FLAG (tmp1, FLAG_NO_PICK) && |
1698 | !QUERY_FLAG (tmp1, FLAG_ALIVE) && !QUERY_FLAG (tmp1, FLAG_IS_CAULDRON)) |
1699 | !QUERY_FLAG (tmp1, FLAG_ALIVE) && !QUERY_FLAG (tmp1, FLAG_IS_CAULDRON)) |
1699 | alchemy_object (tmp1, &small_nuggets, &large_nuggets, &weight); |
1700 | alchemy_object (tmp1, &small_nuggets, &large_nuggets, &weight); |
1700 | } |
1701 | } |
1701 | } |
1702 | } |
|
|
1703 | |
1702 | alchemy_object (tmp, &small_nuggets, &large_nuggets, &weight); |
1704 | alchemy_object (tmp, &small_nuggets, &large_nuggets, &weight); |
1703 | |
1705 | |
1704 | if (weight > weight_max) |
1706 | if (weight > weight_max) |
1705 | { |
1707 | { |
1706 | update_map (op, mp, small_nuggets, large_nuggets, nx, ny); |
1708 | update_map (op, mp, small_nuggets, large_nuggets, nx, ny); |