… | |
… | |
1054 | |
1054 | |
1055 | op->contr->last_used = 0; |
1055 | op->contr->last_used = 0; |
1056 | |
1056 | |
1057 | if (sack->env && sack->env != op) |
1057 | if (sack->env && sack->env != op) |
1058 | { |
1058 | { |
1059 | new_draw_info (NDI_UNIQUE, 0, op, "You must put it onto the floor or into your inventory first."); |
1059 | op->errormsg ("You must put it onto the floor or into your inventory first."); |
1060 | return 1; |
1060 | return 1; |
1061 | } |
1061 | } |
1062 | |
1062 | |
1063 | // already applied == open on ground, or open in inv, or active in inv |
1063 | // already applied == open on ground, or open in inv, or active in inv |
1064 | if (sack->flag [FLAG_APPLIED]) |
1064 | if (sack->flag [FLAG_APPLIED]) |
… | |
… | |
1070 | return 1; |
1070 | return 1; |
1071 | } |
1071 | } |
1072 | else if (!sack->env) |
1072 | else if (!sack->env) |
1073 | { |
1073 | { |
1074 | // active, but not ours: some other player has opened it |
1074 | // active, but not ours: some other player has opened it |
1075 | new_draw_info_format (NDI_UNIQUE, 0, op, "%s is already occupied.", query_name (sack)); |
1075 | op->errormsg (format ("Somebody else is using the %s already.", query_name (sack))); |
1076 | return 1; |
1076 | return 1; |
1077 | } |
1077 | } |
1078 | |
1078 | |
1079 | // fall through to opening it (active in inv) |
1079 | // fall through to opening it (active in inv) |
1080 | } |
1080 | } |
… | |
… | |
1082 | { |
1082 | { |
1083 | // it is in our env, so activate it, do not open yet |
1083 | // it is in our env, so activate it, do not open yet |
1084 | op->close_container (); |
1084 | op->close_container (); |
1085 | sack->flag [FLAG_APPLIED] = 1; |
1085 | sack->flag [FLAG_APPLIED] = 1; |
1086 | esrv_update_item (UPD_FLAGS, op, sack); |
1086 | esrv_update_item (UPD_FLAGS, op, sack); |
1087 | new_draw_info_format (NDI_UNIQUE, 0, op, "You ready %s.", query_name (sack)); |
1087 | op->statusmsg (format ("You ready %s.", query_name (sack))); |
1088 | return 1; |
1088 | return 1; |
1089 | } |
1089 | } |
1090 | |
1090 | |
1091 | // it's locked? |
1091 | // it's locked? |
1092 | if (sack->slaying) |
1092 | if (sack->slaying) |
1093 | { |
1093 | { |
1094 | if (object *tmp = find_key (op, op, sack)) |
1094 | if (object *tmp = find_key (op, op, sack)) |
1095 | new_draw_info_format (NDI_UNIQUE, 0, op, "You unlock %s with %s.", query_name (sack), query_name (tmp)); |
1095 | op->statusmsg (format ("You unlock %s with %s.", query_name (sack), query_name (tmp))); |
1096 | else |
1096 | else |
1097 | { |
1097 | { |
1098 | new_draw_info_format (NDI_UNIQUE, 0, op, "You don't have the key to unlock %s.", query_name (sack)); |
1098 | op->statusmsg (format ("You don't have the key to unlock %s.", query_name (sack))); |
1099 | return 1; |
1099 | return 1; |
1100 | } |
1100 | } |
1101 | } |
1101 | } |
1102 | |
1102 | |
1103 | op->open_container (sack); |
1103 | op->open_container (sack); |
… | |
… | |
1122 | * with an altar. We call it a Potion - altars are stationary - it |
1122 | * with an altar. We call it a Potion - altars are stationary - it |
1123 | * is up to map designers to use them properly. |
1123 | * is up to map designers to use them properly. |
1124 | */ |
1124 | */ |
1125 | if (altar->inv && altar->inv->type == SPELL) |
1125 | if (altar->inv && altar->inv->type == SPELL) |
1126 | { |
1126 | { |
1127 | new_draw_info_format (NDI_BLACK, 0, originator, "The altar casts %s.", &altar->inv->name); |
1127 | originator->statusmsg (format ("The altar casts %s.", &altar->inv->name)); |
1128 | cast_spell (originator, altar, 0, altar->inv, NULL); |
1128 | cast_spell (originator, altar, 0, altar->inv, NULL); |
1129 | /* If it is connected, push the button. Fixes some problems with |
1129 | /* If it is connected, push the button. Fixes some problems with |
1130 | * old maps. |
1130 | * old maps. |
1131 | */ |
1131 | */ |
1132 | |
1132 | |
1133 | /* push_button (altar);*/ |
1133 | /* push_button (altar);*/ |
1134 | } |
1134 | } |
… | |
… | |
1230 | op->contr->play_sound (sound_find ("shop_enter")); |
1230 | op->contr->play_sound (sound_find ("shop_enter")); |
1231 | else |
1231 | else |
1232 | op->contr->play_sound (sound_find ("shop_leave")); |
1232 | op->contr->play_sound (sound_find ("shop_leave")); |
1233 | |
1233 | |
1234 | if (shop_mat->msg) |
1234 | if (shop_mat->msg) |
1235 | new_draw_info (NDI_UNIQUE, 0, op, shop_mat->msg); |
1235 | op->statusmsg (shop_mat->msg); |
1236 | /* This check below is a bit simplistic - generally it should be correct, |
1236 | /* This check below is a bit simplistic - generally it should be correct, |
1237 | * but there is never a guarantee that the bottom space on the map is |
1237 | * but there is never a guarantee that the bottom space on the map is |
1238 | * actually the shop floor. |
1238 | * actually the shop floor. |
1239 | */ |
1239 | */ |
1240 | else if (!rv && !is_in_shop (op)) |
1240 | else if (!rv && !is_in_shop (op)) |
1241 | { |
1241 | { |
1242 | opinion = shopkeeper_approval (op->map, op); |
1242 | opinion = shopkeeper_approval (op->map, op); |
1243 | |
1243 | |
1244 | if (opinion > 0.9) |
1244 | op->statusmsg ( |
1245 | new_draw_info (NDI_UNIQUE, 0, op, "The shopkeeper gives you a friendly wave."); |
1245 | opinion >= 0.90 ? "The shopkeeper gives you a friendly wave." |
1246 | else if (opinion > 0.75) |
1246 | : opinion >= 0.75 ? "The shopkeeper waves to you." |
1247 | new_draw_info (NDI_UNIQUE, 0, op, "The shopkeeper waves to you."); |
1247 | : opinion >= 0.50 ? "The shopkeeper ignores you." |
1248 | else if (opinion > 0.5) |
1248 | : "The shopkeeper glares at you with contempt." |
1249 | new_draw_info (NDI_UNIQUE, 0, op, "The shopkeeper ignores you."); |
|
|
1250 | else |
1249 | ); |
1251 | new_draw_info (NDI_UNIQUE, 0, op, "The shopkeeper glares at you with contempt."); |
|
|
1252 | } |
1250 | } |
1253 | } |
1251 | } |
1254 | else |
1252 | else |
1255 | { |
1253 | { |
1256 | /* if we get here, a player tried to leave a shop but was not able |
1254 | /* if we get here, a player tried to leave a shop but was not able |
… | |
… | |
1280 | static void |
1278 | static void |
1281 | apply_sign (object *op, object *sign, int autoapply) |
1279 | apply_sign (object *op, object *sign, int autoapply) |
1282 | { |
1280 | { |
1283 | readable_message_type *msgType; |
1281 | readable_message_type *msgType; |
1284 | |
1282 | |
1285 | if (sign->msg == NULL) |
1283 | if (!sign->msg) |
1286 | { |
1284 | { |
1287 | new_draw_info (NDI_UNIQUE, 0, op, "Nothing is written on it."); |
1285 | op->statusmsg ("Nothing is written on it."); |
1288 | return; |
1286 | return; |
1289 | } |
1287 | } |
1290 | |
1288 | |
1291 | if (sign->stats.food) |
1289 | if (sign->stats.food) |
1292 | { |
1290 | { |
1293 | if (sign->last_eat >= sign->stats.food) |
1291 | if (sign->last_eat >= sign->stats.food) |
1294 | { |
1292 | { |
1295 | if (!sign->move_on) |
1293 | if (!sign->move_on) |
1296 | new_draw_info (NDI_UNIQUE, 0, op, "You cannot read it anymore."); |
1294 | op->statusmsg ("You cannot read it anymore."); |
1297 | |
1295 | |
1298 | return; |
1296 | return; |
1299 | } |
1297 | } |
1300 | |
1298 | |
1301 | if (!QUERY_FLAG (op, FLAG_WIZPASS)) |
1299 | if (!QUERY_FLAG (op, FLAG_WIZPASS)) |
… | |
… | |
1307 | * move_on is zero, it needs to be manually applied (doesn't talk |
1305 | * move_on is zero, it needs to be manually applied (doesn't talk |
1308 | * to us). |
1306 | * to us). |
1309 | */ |
1307 | */ |
1310 | if (QUERY_FLAG (op, FLAG_BLIND) && !QUERY_FLAG (op, FLAG_WIZ) && !sign->move_on) |
1308 | if (QUERY_FLAG (op, FLAG_BLIND) && !QUERY_FLAG (op, FLAG_WIZ) && !sign->move_on) |
1311 | { |
1309 | { |
1312 | new_draw_info (NDI_UNIQUE, 0, op, "You are unable to read while blind."); |
1310 | op->errormsg ("You are unable to read while blind!"); |
1313 | return; |
1311 | return; |
1314 | } |
1312 | } |
1315 | |
1313 | |
1316 | if (op->contr) |
1314 | if (op->contr) |
1317 | if (client *ns = op->contr->ns) |
1315 | if (client *ns = op->contr->ns) |
… | |
… | |
1469 | |
1467 | |
1470 | if ((ab->move_type && trap->move_on) || ab->move_type == 0) |
1468 | if ((ab->move_type && trap->move_on) || ab->move_type == 0) |
1471 | { |
1469 | { |
1472 | if (!sound_was_played) |
1470 | if (!sound_was_played) |
1473 | { |
1471 | { |
1474 | trap->play_sound (sound_find ("fall_hole")); |
1472 | trap->play_sound (trap->sound ? trap->sound : sound_find ("fall_hole")); |
1475 | sound_was_played = 1; |
1473 | sound_was_played = 1; |
1476 | } |
1474 | } |
1477 | |
1475 | |
1478 | new_draw_info (NDI_UNIQUE, 0, ab, "You fall into a trapdoor!"); |
1476 | ab->statusmsg ("You fall into a trapdoor!", NDI_RED); |
1479 | transfer_ob (ab, (int) EXIT_X (trap), (int) EXIT_Y (trap), 0, ab); |
1477 | transfer_ob (ab, EXIT_X (trap), EXIT_Y (trap), 0, ab); |
1480 | } |
1478 | } |
1481 | } |
1479 | } |
1482 | goto leave; |
1480 | goto leave; |
1483 | } |
1481 | } |
1484 | |
1482 | |
1485 | case CONVERTER: |
1483 | case CONVERTER: |
1486 | if (convert_item (victim, trap) < 0) |
1484 | if (convert_item (victim, trap) < 0) |
1487 | { |
1485 | { |
1488 | new_draw_info_format (NDI_UNIQUE, 0, originator, "The %s seems to be broken!", query_name (trap)); |
1486 | originator->errormsg (format ("The %s seems to be broken!", query_name (trap))); |
1489 | get_archetype ("burnout")->insert_at (trap, trap); |
1487 | get_archetype ("burnout")->insert_at (trap, trap); |
1490 | } |
1488 | } |
1491 | |
1489 | |
1492 | goto leave; |
1490 | goto leave; |
1493 | |
1491 | |
… | |
… | |
1514 | * Processing will happen if the head runs into the pit |
1512 | * Processing will happen if the head runs into the pit |
1515 | */ |
1513 | */ |
1516 | if (victim->head) |
1514 | if (victim->head) |
1517 | goto leave; |
1515 | goto leave; |
1518 | |
1516 | |
1519 | victim->play_sound (sound_find ("fall_hole")); |
1517 | victim->play_sound (trap->sound ? trap->sound : sound_find ("fall_hole")); |
1520 | new_draw_info (NDI_UNIQUE, 0, victim, "You fall through the hole!\n"); |
1518 | victim->statusmsg ("You fall through the hole!", NDI_RED); |
1521 | transfer_ob (victim, EXIT_X (trap), EXIT_Y (trap), 1, victim); |
1519 | transfer_ob (victim, EXIT_X (trap), EXIT_Y (trap), 1, victim); |
1522 | goto leave; |
1520 | goto leave; |
1523 | |
1521 | |
1524 | case EXIT: |
1522 | case EXIT: |
1525 | if (victim->type == PLAYER && EXIT_PATH (trap)) |
1523 | if (victim->type == PLAYER && EXIT_PATH (trap)) |
1526 | { |
1524 | { |
1527 | /* Basically, don't show exits leading to random maps the |
1525 | /* Basically, don't show exits leading to random maps the |
1528 | * players output. |
1526 | * players output. |
1529 | */ |
1527 | */ |
1530 | if (trap->msg && strncmp (EXIT_PATH (trap), "/!", 2)) |
1528 | if (trap->msg && strncmp (EXIT_PATH (trap), "/!", 2)) |
1531 | new_draw_info (NDI_NAVY, 0, victim, trap->msg); |
1529 | victim->statusmsg (trap->msg, NDI_NAVY); |
1532 | |
1530 | |
1533 | victim->enter_exit (trap); |
1531 | victim->enter_exit (trap); |
1534 | } |
1532 | } |
1535 | goto leave; |
1533 | goto leave; |
1536 | |
1534 | |
… | |
… | |
1585 | int lev_diff; |
1583 | int lev_diff; |
1586 | object *skill_ob; |
1584 | object *skill_ob; |
1587 | |
1585 | |
1588 | if (QUERY_FLAG (op, FLAG_BLIND) && !QUERY_FLAG (op, FLAG_WIZ)) |
1586 | if (QUERY_FLAG (op, FLAG_BLIND) && !QUERY_FLAG (op, FLAG_WIZ)) |
1589 | { |
1587 | { |
1590 | new_draw_info (NDI_UNIQUE, 0, op, "You are unable to read while blind."); |
1588 | op->errormsg ("You are unable to read while blind!"); |
1591 | return; |
1589 | return; |
1592 | } |
1590 | } |
1593 | |
1591 | |
1594 | if (!tmp->msg) |
1592 | if (!tmp->msg) |
1595 | { |
1593 | { |
1596 | new_draw_info_format (NDI_UNIQUE, 0, op, "You open the %s and find it empty.", &tmp->name); |
1594 | op->errormsg (format ("You open the %s and find it empty.", &tmp->name)); |
1597 | return; |
1595 | return; |
1598 | } |
1596 | } |
1599 | |
1597 | |
1600 | /* need a literacy skill to read stuff! */ |
1598 | /* need a literacy skill to read stuff! */ |
1601 | skill_ob = find_skill_by_name (op, tmp->skill); |
1599 | skill_ob = find_skill_by_name (op, tmp->skill); |
1602 | if (!skill_ob) |
1600 | if (!skill_ob) |
1603 | { |
1601 | { |
1604 | new_draw_info (NDI_UNIQUE, 0, op, "You are unable to decipher the strange symbols. H<You lack the skill to read this>"); |
1602 | op->errormsg (format ("You are unable to decipher the strange symbols. H<You lack the %s skill to read this.>", &tmp->skill)); |
1605 | return; |
1603 | return; |
1606 | } |
1604 | } |
1607 | |
1605 | |
1608 | lev_diff = tmp->level - (skill_ob->level + 5); |
1606 | lev_diff = tmp->level - (skill_ob->level + 5); |
1609 | if (!QUERY_FLAG (op, FLAG_WIZ) && lev_diff > 0) |
1607 | if (!QUERY_FLAG (op, FLAG_WIZ) && lev_diff > 0) |
1610 | { |
1608 | { |
1611 | if (lev_diff < 2) |
1609 | op->errormsg (lev_diff < 2 ? "This book is just barely beyond your comprehension." |
1612 | new_draw_info (NDI_UNIQUE, 0, op, "This book is just barely beyond your comprehension."); |
1610 | : lev_diff < 3 ? "This book is slightly beyond your comprehension." |
1613 | else if (lev_diff < 3) |
1611 | : lev_diff < 5 ? "This book is beyond your comprehension." |
1614 | new_draw_info (NDI_UNIQUE, 0, op, "This book is slightly beyond your comprehension."); |
1612 | : lev_diff < 8 ? "This book is quite a bit beyond your comprehension." |
1615 | else if (lev_diff < 5) |
1613 | : lev_diff < 15 ? "This book is way beyond your comprehension." |
1616 | new_draw_info (NDI_UNIQUE, 0, op, "This book is beyond your comprehension."); |
1614 | : "This book is totally beyond your comprehension."); |
1617 | else if (lev_diff < 8) |
|
|
1618 | new_draw_info (NDI_UNIQUE, 0, op, "This book is quite a bit beyond your comprehension."); |
|
|
1619 | else if (lev_diff < 15) |
|
|
1620 | new_draw_info (NDI_UNIQUE, 0, op, "This book is way beyond your comprehension."); |
|
|
1621 | else |
|
|
1622 | new_draw_info (NDI_UNIQUE, 0, op, "This book is totally beyond your comprehension."); |
|
|
1623 | return; |
1615 | return; |
1624 | } |
1616 | } |
1625 | |
1617 | |
1626 | readable_message_type *msgType = get_readable_message_type (tmp); |
1618 | readable_message_type *msgType = get_readable_message_type (tmp); |
1627 | |
1619 | |
… | |
… | |
1669 | * op is the person learning the skill, tmp is the skill scroll object |
1661 | * op is the person learning the skill, tmp is the skill scroll object |
1670 | */ |
1662 | */ |
1671 | static void |
1663 | static void |
1672 | apply_skillscroll (object *op, object *tmp) |
1664 | apply_skillscroll (object *op, object *tmp) |
1673 | { |
1665 | { |
1674 | switch ((int) learn_skill (op, tmp)) |
1666 | switch (learn_skill (op, tmp)) |
1675 | { |
1667 | { |
1676 | case 0: |
1668 | case 0: |
1677 | new_draw_info (NDI_UNIQUE, 0, op, "You already possess the knowledge "); |
1669 | op->play_sound (sound_find ("generic_fail")); |
1678 | new_draw_info_format (NDI_UNIQUE, 0, op, "held within the %s.\n", query_name (tmp)); |
1670 | op->errormsg (format ("You already possess the knowledge held within the %s.", query_name (tmp))); |
1679 | return; |
1671 | break; |
1680 | |
1672 | |
1681 | case 1: |
1673 | case 1: |
1682 | new_draw_info_format (NDI_UNIQUE, 0, op, "You succeed in learning %s", &tmp->skill); |
|
|
1683 | decrease_ob (tmp); |
1674 | decrease_ob (tmp); |
|
|
1675 | op->play_sound (sound_find ("skill_learn")); |
|
|
1676 | op->statusmsg (format ("You succeed in learning %s", &tmp->skill)); |
1684 | return; |
1677 | break; |
1685 | |
1678 | |
1686 | default: |
1679 | default: |
1687 | new_draw_info_format (NDI_UNIQUE, 0, op, "You fail to learn the knowledge of the %s.\n", query_name (tmp)); |
|
|
1688 | decrease_ob (tmp); |
1680 | decrease_ob (tmp); |
|
|
1681 | op->play_sound (sound_find ("generic_fail")); |
|
|
1682 | op->errormsg (format ("You fail to learn the knowledge of the %s.\n", query_name (tmp))); |
1689 | return; |
1683 | break; |
1690 | } |
1684 | } |
1691 | } |
1685 | } |
1692 | |
1686 | |
1693 | /** |
1687 | /** |
1694 | * Actually makes op learn spell. |
1688 | * Actually makes op learn spell. |
… | |
… | |
1762 | { |
1756 | { |
1763 | object *skop, *spell, *spell_skill; |
1757 | object *skop, *spell, *spell_skill; |
1764 | |
1758 | |
1765 | if (QUERY_FLAG (op, FLAG_BLIND) && !QUERY_FLAG (op, FLAG_WIZ)) |
1759 | if (QUERY_FLAG (op, FLAG_BLIND) && !QUERY_FLAG (op, FLAG_WIZ)) |
1766 | { |
1760 | { |
1767 | new_draw_info (NDI_UNIQUE, 0, op, "You are unable to read while blind."); |
1761 | op->errormsg ("You are unable to read while blind."); |
1768 | return; |
1762 | return; |
1769 | } |
1763 | } |
1770 | |
1764 | |
1771 | /* artifact_spellbooks have 'slaying' field point to a spell name, |
1765 | /* artifact_spellbooks have 'slaying' field point to a spell name, |
1772 | * instead of having their spell stored in stats.sp. These are |
1766 | * instead of having their spell stored in stats.sp. These are |
… | |
… | |
1775 | if (tmp->slaying) |
1769 | if (tmp->slaying) |
1776 | { |
1770 | { |
1777 | spell = arch_to_object (find_archetype_by_object_name (tmp->slaying)); |
1771 | spell = arch_to_object (find_archetype_by_object_name (tmp->slaying)); |
1778 | if (!spell) |
1772 | if (!spell) |
1779 | { |
1773 | { |
1780 | new_draw_info_format (NDI_UNIQUE, 0, op, "The book's formula for %s is incomplete", &tmp->slaying); |
1774 | op->errormsg (format ("The book's formula for %s is incomplete.", &tmp->slaying)); |
1781 | return; |
1775 | return; |
1782 | } |
1776 | } |
1783 | else |
1777 | else |
1784 | insert_ob_in_ob (spell, tmp); |
1778 | insert_ob_in_ob (spell, tmp); |
1785 | |
1779 | |
… | |
… | |
1790 | |
1784 | |
1791 | /* need a literacy skill to learn spells. Also, having a literacy level |
1785 | /* need a literacy skill to learn spells. Also, having a literacy level |
1792 | * lower than the spell will make learning the spell more difficult */ |
1786 | * lower than the spell will make learning the spell more difficult */ |
1793 | if (!skop) |
1787 | if (!skop) |
1794 | { |
1788 | { |
1795 | new_draw_info (NDI_UNIQUE, 0, op, "You can't read! Your attempt fails. H<You lack the literacy skill.>"); |
1789 | op->errormsg (format ("You can't read! Your attempt fails. H<You lack the %s skill.>", &tmp->skill)); |
1796 | return; |
1790 | return; |
1797 | } |
1791 | } |
1798 | |
1792 | |
1799 | spell = tmp->inv; |
1793 | spell = tmp->inv; |
1800 | |
1794 | |
1801 | if (!spell) |
1795 | if (!spell) |
1802 | { |
1796 | { |
1803 | LOG (llevError, "apply_spellbook: Book %s has no spell in it!\n", &tmp->name); |
1797 | LOG (llevError, "apply_spellbook: Book %s has no spell in it!\n", &tmp->name); |
1804 | new_draw_info (NDI_UNIQUE, 0, op, "The spellbook symbols make no sense. This is a bug, please report!"); |
1798 | op->errormsg ("The spellbook symbols make no sense. This is a bug, please report!"); |
1805 | return; |
1799 | return; |
1806 | } |
1800 | } |
1807 | |
1801 | |
1808 | if (skop->level < int (sqrtf (spell->level) * 1.5f)) |
1802 | if (skop->level < int (sqrtf (spell->level) * 1.5f)) |
1809 | { |
1803 | { |
1810 | new_draw_info (NDI_UNIQUE, 0, op, "You are unable to decipher the strange symbols. H<Your literacy level is too low.>"); |
1804 | op->errormsg (format ("You are unable to decipher the strange symbols. H<Your %s level is too low.>", &tmp->skill)); |
1811 | return; |
1805 | return; |
1812 | } |
1806 | } |
1813 | |
1807 | |
1814 | new_draw_info_format (NDI_UNIQUE, 0, op, "The spellbook contains the %s level spell %s.", get_levelnumber (spell->level), &spell->name); |
1808 | op->statusmsg (format ("The spellbook contains the %s level spell %s.", get_levelnumber (spell->level), &spell->name)); |
1815 | |
1809 | |
1816 | if (!QUERY_FLAG (tmp, FLAG_IDENTIFIED)) |
1810 | if (!QUERY_FLAG (tmp, FLAG_IDENTIFIED)) |
1817 | { |
1811 | { |
1818 | identify (tmp); |
1812 | identify (tmp); |
1819 | |
1813 | |
… | |
… | |
1828 | * if the player doesn't know the spell, doesn't make a lot of sense that |
1822 | * if the player doesn't know the spell, doesn't make a lot of sense that |
1829 | * they would have a special prayer mark. |
1823 | * they would have a special prayer mark. |
1830 | */ |
1824 | */ |
1831 | if (check_spell_known (op, spell->name)) |
1825 | if (check_spell_known (op, spell->name)) |
1832 | { |
1826 | { |
1833 | new_draw_info (NDI_UNIQUE, 0, op, "You already know that spell. H<It makes no sense to learn spells twice, and would only waste the spellbook.>\n"); |
1827 | op->statusmsg ("You already know that spell. H<It makes no sense to learn spells twice, and would only waste the spellbook.>\n"); |
1834 | return; |
1828 | return; |
1835 | } |
1829 | } |
1836 | |
1830 | |
1837 | if (spell->skill) |
1831 | if (spell->skill) |
1838 | { |
1832 | { |
1839 | spell_skill = find_skill_by_name (op, spell->skill); |
1833 | spell_skill = find_skill_by_name (op, spell->skill); |
1840 | |
1834 | |
1841 | if (!spell_skill) |
1835 | if (!spell_skill) |
1842 | { |
1836 | { |
1843 | new_draw_info_format (NDI_UNIQUE, 0, op, "You lack the skill %s to use this spell.", &spell->skill); |
1837 | op->errormsg (format ("You lack the skill %s to use this spell.", &spell->skill)); |
1844 | return; |
1838 | return; |
1845 | } |
1839 | } |
1846 | |
1840 | |
1847 | if (spell_skill->level < spell->level) |
1841 | if (spell_skill->level < spell->level) |
1848 | { |
1842 | { |
1849 | new_draw_info_format (NDI_UNIQUE, 0, op, "You need to be level %d in %s to learn this spell.", spell->level, &spell->skill); |
1843 | op->errormsg (format ("You need to be level %d in %s to learn this spell.", spell->level, &spell->skill)); |
1850 | return; |
1844 | return; |
1851 | } |
1845 | } |
1852 | } |
1846 | } |
1853 | |
1847 | |
1854 | /* Logic as follows |
1848 | /* Logic as follows |
… | |
… | |
1863 | * Overall, chances are the same but a player will find having a high |
1857 | * Overall, chances are the same but a player will find having a high |
1864 | * literacy rate very useful! -b.t. |
1858 | * literacy rate very useful! -b.t. |
1865 | */ |
1859 | */ |
1866 | if (QUERY_FLAG (op, FLAG_CONFUSED)) |
1860 | if (QUERY_FLAG (op, FLAG_CONFUSED)) |
1867 | { |
1861 | { |
1868 | new_draw_info (NDI_UNIQUE, 0, op, "In your confused state you flub the wording of the text!"); |
1862 | op->errormsg ("In your confused state you flub the wording of the text!"); |
1869 | scroll_failure (op, 0 - random_roll (0, spell->level, op, PREFER_LOW), MAX (spell->stats.sp, spell->stats.grace)); |
1863 | scroll_failure (op, 0 - random_roll (0, spell->level, op, PREFER_LOW), MAX (spell->stats.sp, spell->stats.grace)); |
1870 | } |
1864 | } |
1871 | else if (QUERY_FLAG (tmp, FLAG_STARTEQUIP) || |
1865 | else if (QUERY_FLAG (tmp, FLAG_STARTEQUIP) || |
1872 | (random_roll (0, 100, op, PREFER_LOW) - (5 * skop->level)) < learn_spell[spell->stats.grace ? op->stats.Wis : op->stats.Int]) |
1866 | (random_roll (0, 100, op, PREFER_LOW) - (5 * skop->level)) < learn_spell[spell->stats.grace ? op->stats.Wis : op->stats.Int]) |
1873 | { |
1867 | { |
1874 | |
1868 | op->statusmsg ("You succeed in learning the spell!", NDI_GREEN); |
1875 | new_draw_info (NDI_UNIQUE, 0, op, "You succeed in learning the spell!"); |
|
|
1876 | do_learn_spell (op, spell, 0); |
1869 | do_learn_spell (op, spell, 0); |
1877 | |
1870 | |
1878 | /* xp gain to literacy for spell learning */ |
1871 | /* xp gain to literacy for spell learning */ |
1879 | if (!QUERY_FLAG (tmp, FLAG_STARTEQUIP)) |
1872 | if (!QUERY_FLAG (tmp, FLAG_STARTEQUIP)) |
1880 | change_exp (op, calc_skill_exp (op, tmp, skop), skop->skill, 0); |
1873 | change_exp (op, calc_skill_exp (op, tmp, skop), skop->skill, 0); |
1881 | } |
1874 | } |
1882 | else |
1875 | else |
1883 | { |
1876 | { |
1884 | op->contr->play_sound (sound_find ("fumble_spell")); |
1877 | op->contr->play_sound (sound_find ("fumble_spell")); |
1885 | new_draw_info (NDI_UNIQUE, 0, op, "You fail to learn the spell. H<Wis (priests) or Int (wizards) governs the chance of learning a prayer or spell.>\n"); |
1878 | op->errormsg ("You fail to learn the spell. H<Wis (priests) or Int (wizards) governs the chance of learning a prayer or spell.>\n"); |
1886 | } |
1879 | } |
1887 | |
1880 | |
1888 | decrease_ob (tmp); |
1881 | decrease_ob (tmp); |
1889 | } |
1882 | } |
1890 | |
1883 | |
… | |
… | |
1896 | { |
1889 | { |
1897 | object *skop; |
1890 | object *skop; |
1898 | |
1891 | |
1899 | if (QUERY_FLAG (op, FLAG_BLIND) && !QUERY_FLAG (op, FLAG_WIZ)) |
1892 | if (QUERY_FLAG (op, FLAG_BLIND) && !QUERY_FLAG (op, FLAG_WIZ)) |
1900 | { |
1893 | { |
1901 | new_draw_info (NDI_UNIQUE, 0, op, "You are unable to read while blind."); |
1894 | op->errormsg ("You are unable to read while blind."); |
1902 | return; |
1895 | return; |
1903 | } |
1896 | } |
1904 | |
1897 | |
1905 | if (!tmp->inv || tmp->inv->type != SPELL) |
1898 | if (!tmp->inv || tmp->inv->type != SPELL) |
1906 | { |
1899 | { |
1907 | new_draw_info (NDI_UNIQUE, 0, op, "The scroll just doesn't make sense! H<...and never will make sense.>"); |
1900 | op->errormsg ("The scroll just doesn't make sense! H<...and never will make sense.>"); |
1908 | return; |
1901 | return; |
1909 | } |
1902 | } |
1910 | |
1903 | |
1911 | if (op->type == PLAYER) |
1904 | if (op->type == PLAYER) |
1912 | { |
1905 | { |
… | |
… | |
1918 | */ |
1911 | */ |
1919 | skop = find_skill_by_name (op, skill_names[SK_LITERACY]); |
1912 | skop = find_skill_by_name (op, skill_names[SK_LITERACY]); |
1920 | |
1913 | |
1921 | if (!skop) |
1914 | if (!skop) |
1922 | { |
1915 | { |
1923 | new_draw_info (NDI_UNIQUE, 0, op, "You are unable to decipher the strange symbols. H<You lack the literacy skill.>"); |
1916 | op->errormsg (format ("You are unable to decipher the strange symbols. H<You lack the %s skill.>", &skill_names[SK_LITERACY])); |
1924 | return; |
1917 | return; |
1925 | } |
1918 | } |
1926 | |
1919 | |
1927 | if ((exp_gain = calc_skill_exp (op, tmp, skop))) |
1920 | if ((exp_gain = calc_skill_exp (op, tmp, skop))) |
1928 | change_exp (op, exp_gain, skop->skill, 0); |
1921 | change_exp (op, exp_gain, skop->skill, 0); |
1929 | } |
1922 | } |
1930 | |
1923 | |
1931 | if (!QUERY_FLAG (tmp, FLAG_IDENTIFIED)) |
1924 | if (!QUERY_FLAG (tmp, FLAG_IDENTIFIED)) |
1932 | identify (tmp); |
1925 | identify (tmp); |
1933 | |
1926 | |
1934 | new_draw_info_format (NDI_BLACK, 0, op, "The scroll of %s turns to dust.", &tmp->inv->name); |
1927 | op->statusmsg (format ("The scroll of %s turns to dust.", &tmp->inv->name)); |
1935 | |
1928 | |
1936 | cast_spell (op, tmp, dir, tmp->inv, NULL); |
1929 | cast_spell (op, tmp, dir, tmp->inv, NULL); |
1937 | decrease_ob (tmp); |
1930 | decrease_ob (tmp); |
1938 | } |
1931 | } |
1939 | |
1932 | |
… | |
… | |
1943 | * chest. |
1936 | * chest. |
1944 | */ |
1937 | */ |
1945 | static void |
1938 | static void |
1946 | apply_treasure (object *op, object *tmp) |
1939 | apply_treasure (object *op, object *tmp) |
1947 | { |
1940 | { |
1948 | /* Nice side effect of new treasure creation method is that the treasure |
1941 | /* Nice side effect of this treasure creation method is that the treasure |
1949 | * for the chest is done when the chest is created, and put into the chest |
1942 | * for the chest is done when the chest is created, and put into the chest |
1950 | * inventory. So that when the chest burns up, the items still exist. Also |
1943 | * inventory. So that when the chest burns up, the items still exist. Also |
1951 | * prevents people fromt moving chests to more difficult maps to get better |
1944 | * prevents people from moving chests to more difficult maps to get better |
1952 | * treasure |
1945 | * treasure |
1953 | */ |
1946 | */ |
1954 | object *treas = tmp->inv; |
1947 | object *treas = tmp->inv; |
1955 | |
1948 | |
1956 | if (!treas) |
1949 | if (!treas) |
1957 | { |
1950 | { |
1958 | new_draw_info (NDI_UNIQUE, 0, op, "The chest was empty."); |
1951 | op->statusmsg ("The chest was empty."); |
1959 | decrease_ob (tmp); |
1952 | decrease_ob (tmp); |
1960 | return; |
1953 | return; |
1961 | } |
1954 | } |
1962 | |
1955 | |
1963 | while (tmp->inv) |
1956 | while (tmp->inv) |
1964 | { |
1957 | { |
1965 | treas = tmp->inv; |
1958 | treas = tmp->inv; |
1966 | |
|
|
1967 | treas->remove (); |
1959 | treas->remove (); |
1968 | new_draw_info_format (NDI_UNIQUE, 0, op, "You find %s in the chest.", query_name (treas)); |
|
|
1969 | |
1960 | |
1970 | treas->x = op->x; |
1961 | treas->x = op->x; |
1971 | treas->y = op->y; |
1962 | treas->y = op->y; |
1972 | treas = insert_ob_in_map (treas, op->map, op, INS_BELOW_ORIGINATOR); |
1963 | treas = insert_ob_in_map (treas, op->map, op, INS_BELOW_ORIGINATOR); |
1973 | |
1964 | |
1974 | if (treas && (treas->type == RUNE || treas->type == TRAP) && treas->level && QUERY_FLAG (op, FLAG_ALIVE)) |
1965 | if (treas && (treas->type == RUNE || treas->type == TRAP) && treas->level && QUERY_FLAG (op, FLAG_ALIVE)) |
1975 | spring_trap (treas, op); |
1966 | spring_trap (treas, op); |
1976 | |
1967 | |
1977 | /* If either player or container was destroyed, no need to do |
1968 | /* If either player or container was destroyed, no need to do |
1978 | * further processing. I think this should be enclused with |
1969 | * further processing. I think this should be enclused with |
1979 | * spring trap above, as I don't think there is otherwise |
1970 | * spring trap above, as I don't think there is otherwise |
1980 | * any way for the treasure chest or player to get killed |
1971 | * any way for the treasure chest or player to get killed. |
1981 | */ |
1972 | */ |
1982 | if (op->destroyed () || tmp->destroyed ()) |
1973 | if (op->destroyed () || tmp->destroyed ()) |
1983 | break; |
1974 | break; |
1984 | } |
1975 | } |
1985 | |
1976 | |
1986 | if (!tmp->destroyed () && tmp->inv == NULL) |
1977 | if (!tmp->destroyed () && !tmp->inv) |
1987 | decrease_ob (tmp); |
1978 | decrease_ob (tmp); |
1988 | |
|
|
1989 | } |
1979 | } |
1990 | |
1980 | |
1991 | /** |
1981 | /** |
1992 | * op eats food. |
1982 | * op eats food. |
1993 | * If player, takes care of messages and dragon special food. |
1983 | * If player, takes care of messages and dragon special food. |
… | |
… | |
2008 | { |
1998 | { |
2009 | /* usual case - no dragon meal: */ |
1999 | /* usual case - no dragon meal: */ |
2010 | if (op->stats.food + tmp->stats.food > 999) |
2000 | if (op->stats.food + tmp->stats.food > 999) |
2011 | { |
2001 | { |
2012 | if (tmp->type == FOOD || tmp->type == FLESH) |
2002 | if (tmp->type == FOOD || tmp->type == FLESH) |
2013 | new_draw_info (NDI_UNIQUE, 0, op, "You feel full, but what a waste of food!"); |
2003 | op->errormsg ("You feel full, but what a waste of food!"); |
2014 | else |
2004 | else |
2015 | new_draw_info (NDI_UNIQUE, 0, op, "Most of the drink goes down your face not your throat!"); |
2005 | op->statusmsg ("Most of the drink goes down your face not your throat!"); |
2016 | } |
2006 | } |
2017 | |
2007 | |
2018 | if (!QUERY_FLAG (tmp, FLAG_CURSED)) |
2008 | if (!QUERY_FLAG (tmp, FLAG_CURSED)) |
2019 | { |
2009 | { |
2020 | char buf[MAX_BUF]; |
2010 | const char *buf; |
2021 | |
2011 | |
2022 | if (!is_dragon_pl (op)) |
2012 | if (!is_dragon_pl (op)) |
2023 | { |
2013 | { |
2024 | /* eating message for normal players */ |
2014 | /* eating message for normal players */ |
2025 | if (tmp->type == DRINK) |
2015 | if (tmp->type == DRINK) |
2026 | sprintf (buf, "Ahhh...that %s tasted good.", &tmp->name); |
2016 | buf = format ("Ahhh...that %s tasted good.", &tmp->name); |
2027 | else |
2017 | else |
2028 | sprintf (buf, "The %s tasted %s", &tmp->name, tmp->type == FLESH ? "terrible!" : "good."); |
2018 | buf = format ("The %s tasted %s", &tmp->name, tmp->type == FLESH ? "terrible!" : "good."); |
2029 | } |
2019 | } |
2030 | else |
2020 | else |
2031 | { |
|
|
2032 | /* eating message for dragon players */ |
2021 | /* eating message for dragon players */ |
2033 | sprintf (buf, "The %s tasted terrible!", &tmp->name); |
2022 | buf = format ("The %s tasted terrible!", &tmp->name); |
2034 | } |
|
|
2035 | |
2023 | |
2036 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
2024 | op->statusmsg (buf); |
|
|
2025 | |
2037 | capacity_remaining = 999 - op->stats.food; |
2026 | capacity_remaining = 999 - op->stats.food; |
2038 | op->stats.food += tmp->stats.food; |
2027 | op->stats.food += tmp->stats.food; |
2039 | if (capacity_remaining < tmp->stats.food) |
2028 | if (capacity_remaining < tmp->stats.food) |
2040 | op->stats.hp += capacity_remaining / 50; |
2029 | op->stats.hp += capacity_remaining / 50; |
2041 | else |
2030 | else |
2042 | op->stats.hp += tmp->stats.food / 50; |
2031 | op->stats.hp += tmp->stats.food / 50; |
|
|
2032 | |
2043 | if (op->stats.hp > op->stats.maxhp) |
2033 | if (op->stats.hp > op->stats.maxhp) |
2044 | op->stats.hp = op->stats.maxhp; |
2034 | op->stats.hp = op->stats.maxhp; |
2045 | if (op->stats.food > 999) |
2035 | if (op->stats.food > 999) |
2046 | op->stats.food = 999; |
2036 | op->stats.food = 999; |
2047 | } |
2037 | } |
… | |
… | |
2071 | { |
2061 | { |
2072 | object *skin = NULL; /* pointer to dragon skin force */ |
2062 | object *skin = NULL; /* pointer to dragon skin force */ |
2073 | object *abil = NULL; /* pointer to dragon ability force */ |
2063 | object *abil = NULL; /* pointer to dragon ability force */ |
2074 | object *tmp = NULL; /* tmp. object */ |
2064 | object *tmp = NULL; /* tmp. object */ |
2075 | |
2065 | |
2076 | char buf[MAX_BUF]; /* tmp. string buffer */ |
|
|
2077 | double chance; /* improvement-chance of one resistance type */ |
2066 | double chance; /* improvement-chance of one resistance type */ |
2078 | double totalchance = 1; /* total chance of gaining one resistance */ |
2067 | double totalchance = 1; /* total chance of gaining one resistance */ |
2079 | double bonus = 0; /* level bonus (improvement is easier at lowlevel) */ |
2068 | double bonus = 0; /* level bonus (improvement is easier at lowlevel) */ |
2080 | double mbonus = 0; /* monster bonus */ |
2069 | double mbonus = 0; /* monster bonus */ |
2081 | int atnr_winner[NROFATTACKS]; /* winning candidates for resistance improvement */ |
2070 | int atnr_winner[NROFATTACKS]; /* winning candidates for resistance improvement */ |
… | |
… | |
2103 | /* now start by filling stomache and health, according to food-value */ |
2092 | /* now start by filling stomache and health, according to food-value */ |
2104 | if ((999 - op->stats.food) < meal->stats.food) |
2093 | if ((999 - op->stats.food) < meal->stats.food) |
2105 | op->stats.hp += (999 - op->stats.food) / 50; |
2094 | op->stats.hp += (999 - op->stats.food) / 50; |
2106 | else |
2095 | else |
2107 | op->stats.hp += meal->stats.food / 50; |
2096 | op->stats.hp += meal->stats.food / 50; |
|
|
2097 | |
2108 | if (op->stats.hp > op->stats.maxhp) |
2098 | if (op->stats.hp > op->stats.maxhp) |
2109 | op->stats.hp = op->stats.maxhp; |
2099 | op->stats.hp = op->stats.maxhp; |
2110 | |
2100 | |
2111 | op->stats.food = MIN (999, op->stats.food + meal->stats.food); |
2101 | op->stats.food = MIN (999, op->stats.food + meal->stats.food); |
2112 | |
2102 | |
… | |
… | |
2157 | } |
2147 | } |
2158 | } |
2148 | } |
2159 | |
2149 | |
2160 | /* inverse totalchance as until now we have the failure-chance */ |
2150 | /* inverse totalchance as until now we have the failure-chance */ |
2161 | totalchance = 100 - totalchance * 100; |
2151 | totalchance = 100 - totalchance * 100; |
|
|
2152 | |
2162 | /* print message according to totalchance */ |
2153 | /* print message according to totalchance */ |
|
|
2154 | const char *buf; |
2163 | if (totalchance > 50.) |
2155 | if (totalchance > 50.) |
2164 | sprintf (buf, "Hmm! The %s tasted delicious!", &meal->name); |
2156 | buf = format ("Hmm! The %s tasted delicious!", &meal->name); |
2165 | else if (totalchance > 10.) |
2157 | else if (totalchance > 10.) |
2166 | sprintf (buf, "The %s tasted very good.", &meal->name); |
2158 | buf = format ("The %s tasted very good.", &meal->name); |
2167 | else if (totalchance > 1.) |
2159 | else if (totalchance > 1.) |
2168 | sprintf (buf, "The %s tasted good.", &meal->name); |
2160 | buf = format ("The %s tasted good.", &meal->name); |
2169 | else if (totalchance > 0.1) |
2161 | else if (totalchance > 0.1) |
2170 | sprintf (buf, "The %s tasted bland.", &meal->name); |
2162 | buf = format ("The %s tasted bland.", &meal->name); |
2171 | else if (totalchance >= 0.01) |
2163 | else if (totalchance >= 0.01) |
2172 | sprintf (buf, "The %s had a boring taste.", &meal->name); |
2164 | buf = format ("The %s had a boring taste.", &meal->name); |
2173 | else if (meal->last_eat > 0 && atnr_is_dragon_enabled (meal->last_eat)) |
2165 | else if (meal->last_eat > 0 && atnr_is_dragon_enabled (meal->last_eat)) |
2174 | sprintf (buf, "The %s tasted strange.", &meal->name); |
2166 | buf = format ("The %s tasted strange.", &meal->name); |
2175 | else |
2167 | else |
2176 | sprintf (buf, "The %s had no taste.", &meal->name); |
2168 | buf = format ("The %s had no taste.", &meal->name); |
2177 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
2169 | |
|
|
2170 | op->statusmsg (buf); |
2178 | |
2171 | |
2179 | /* now choose a winner if we have any */ |
2172 | /* now choose a winner if we have any */ |
2180 | i = -1; |
2173 | i = -1; |
2181 | if (winners > 0) |
2174 | if (winners > 0) |
2182 | i = atnr_winner[RANDOM () % winners]; |
2175 | i = atnr_winner[RANDOM () % winners]; |
… | |
… | |
2185 | { |
2178 | { |
2186 | /* resistance increased! */ |
2179 | /* resistance increased! */ |
2187 | skin->resist[i]++; |
2180 | skin->resist[i]++; |
2188 | op->update_stats (); |
2181 | op->update_stats (); |
2189 | |
2182 | |
2190 | sprintf (buf, "Your skin is now more resistant to %s!", change_resist_msg[i]); |
2183 | op->statusmsg (format ("Your skin is now more resistant to %s!", change_resist_msg[i])); |
2191 | new_draw_info (NDI_UNIQUE | NDI_RED, 0, op, buf); |
|
|
2192 | } |
2184 | } |
2193 | |
2185 | |
2194 | /* if this flesh contains a new ability focus, we mark it |
2186 | /* if this flesh contains a new ability focus, we mark it |
2195 | into the ability_force and it will take effect on next level */ |
2187 | into the ability_force and it will take effect on next level */ |
2196 | if (meal->last_eat > 0 && atnr_is_dragon_enabled (meal->last_eat) && meal->last_eat != abil->last_eat) |
2188 | if (meal->last_eat > 0 && atnr_is_dragon_enabled (meal->last_eat) && meal->last_eat != abil->last_eat) |
2197 | { |
2189 | { |
2198 | abil->last_eat = meal->last_eat; /* write: last_eat <new attnr focus> */ |
2190 | abil->last_eat = meal->last_eat; /* write: last_eat <new attnr focus> */ |
2199 | |
2191 | |
2200 | if (meal->last_eat != abil->stats.exp) |
2192 | if (meal->last_eat != abil->stats.exp) |
|
|
2193 | op->statusmsg (format ( |
|
|
2194 | "Your metabolism prepares to focus on %s!\n" |
|
|
2195 | "The change will happen at level %d.", |
|
|
2196 | change_resist_msg[meal->last_eat], |
|
|
2197 | abil->level + 1 |
2201 | { |
2198 | )); |
2202 | sprintf (buf, "Your metabolism prepares to focus on %s!", change_resist_msg[meal->last_eat]); |
|
|
2203 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
|
|
2204 | sprintf (buf, "The change will happen at level %d", abil->level + 1); |
|
|
2205 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
|
|
2206 | } |
|
|
2207 | else |
2199 | else |
2208 | { |
2200 | { |
2209 | sprintf (buf, "Your metabolism will continue to focus on %s.", change_resist_msg[meal->last_eat]); |
2201 | op->statusmsg (format ("Your metabolism will continue to focus on %s.", change_resist_msg[meal->last_eat])); |
2210 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
|
|
2211 | abil->last_eat = 0; |
2202 | abil->last_eat = 0; |
2212 | } |
2203 | } |
2213 | } |
2204 | } |
|
|
2205 | |
2214 | return 1; |
2206 | return 1; |
2215 | } |
2207 | } |
2216 | |
2208 | |
2217 | /** |
2209 | /** |
2218 | * Handles applying an improve armor scroll. |
2210 | * Handles applying an improve armor scroll. |
… | |
… | |
2223 | { |
2215 | { |
2224 | object *armor; |
2216 | object *armor; |
2225 | |
2217 | |
2226 | if (!QUERY_FLAG (op, FLAG_WIZCAST) && (get_map_flags (op->map, 0, op->x, op->y, 0, 0) & P_NO_MAGIC)) |
2218 | if (!QUERY_FLAG (op, FLAG_WIZCAST) && (get_map_flags (op->map, 0, op->x, op->y, 0, 0) & P_NO_MAGIC)) |
2227 | { |
2219 | { |
2228 | new_draw_info (NDI_UNIQUE, 0, op, "Something blocks the magic of the scroll. H<The area prevents magic effects.>"); |
2220 | op->errormsg ("Something blocks the magic of the scroll. H<This area prevents magic effects.>"); |
2229 | return; |
2221 | return; |
2230 | } |
2222 | } |
2231 | |
2223 | |
2232 | armor = find_marked_object (op); |
2224 | armor = find_marked_object (op); |
2233 | |
2225 | |
2234 | if (!armor) |
2226 | if (!armor) |
2235 | { |
2227 | { |
2236 | new_draw_info (NDI_UNIQUE, 0, op, "You need to mark an armor object. Use the right mouse button popup or the mark command to do this."); |
2228 | op->errormsg ("You need to mark an armor object. Use the right mouse button popup or the mark command to do this."); |
2237 | return; |
2229 | return; |
2238 | } |
2230 | } |
2239 | |
2231 | |
2240 | if (armor->type != ARMOUR |
2232 | if (armor->type != ARMOUR |
2241 | && armor->type != CLOAK |
2233 | && armor->type != CLOAK |
2242 | && armor->type != BOOTS && armor->type != GLOVES && armor->type != BRACERS && armor->type != SHIELD && armor->type != HELMET) |
2234 | && armor->type != BOOTS && armor->type != GLOVES && armor->type != BRACERS && armor->type != SHIELD && armor->type != HELMET) |
2243 | { |
2235 | { |
2244 | new_draw_info (NDI_UNIQUE, 0, op, "Your marked item is not armour!\n"); |
2236 | op->errormsg ("Your marked item is not armour!\n"); |
2245 | return; |
2237 | return; |
2246 | } |
2238 | } |
2247 | |
2239 | |
2248 | new_draw_info (NDI_UNIQUE, 0, op, "Applying armour enchantment."); |
2240 | op->statusmsg ("Applying armour enchantment."); |
2249 | improve_armour (op, tmp, armor); |
2241 | improve_armour (op, tmp, armor); |
2250 | } |
2242 | } |
2251 | |
2243 | |
2252 | extern void |
2244 | extern void |
2253 | apply_poison (object *op, object *tmp) |
2245 | apply_poison (object *op, object *tmp) |
2254 | { |
2246 | { |
2255 | if (op->type == PLAYER) |
2247 | if (op->type == PLAYER) |
2256 | { |
2248 | { |
2257 | op->contr->play_sound (sound_find ("drink_poison")); |
2249 | op->contr->play_sound (sound_find ("drink_poison")); |
2258 | new_draw_info (NDI_UNIQUE, 0, op, "Yech! That tasted poisonous!"); |
2250 | op->errormsg ("Yech! That tasted poisonous!"); |
2259 | strcpy (op->contr->killer, "poisonous booze"); |
2251 | strcpy (op->contr->killer, "poisonous booze"); |
2260 | } |
2252 | } |
2261 | |
2253 | |
2262 | if (tmp->stats.hp > 0) |
2254 | if (tmp->stats.hp > 0) |
2263 | { |
2255 | { |
… | |
… | |
2382 | |
2374 | |
2383 | if (QUERY_FLAG (tmp, FLAG_UNPAID) && !QUERY_FLAG (tmp, FLAG_APPLIED)) |
2375 | if (QUERY_FLAG (tmp, FLAG_UNPAID) && !QUERY_FLAG (tmp, FLAG_APPLIED)) |
2384 | { |
2376 | { |
2385 | if (op->type == PLAYER) |
2377 | if (op->type == PLAYER) |
2386 | { |
2378 | { |
2387 | new_draw_info (NDI_UNIQUE, 0, op, "You should pay for it first. H<You cannot use items marked as unpaid.>"); |
2379 | op->errormsg ("You should pay for it first! H<You cannot use items marked as unpaid.>"); |
2388 | return 1; |
2380 | return 1; |
2389 | } |
2381 | } |
2390 | else |
2382 | else |
2391 | return 0; /* monsters just skip unpaid items */ |
2383 | return 0; /* monsters just skip unpaid items */ |
2392 | } |
2384 | } |
… | |
… | |
2395 | return RESULT_INT (0); |
2387 | return RESULT_INT (0); |
2396 | |
2388 | |
2397 | switch (tmp->type) |
2389 | switch (tmp->type) |
2398 | { |
2390 | { |
2399 | case CF_HANDLE: |
2391 | case CF_HANDLE: |
2400 | new_draw_info (NDI_UNIQUE, 0, op, "You turn the handle."); |
|
|
2401 | op->play_sound (sound_find ("turn_handle")); |
2392 | op->play_sound (sound_find ("turn_handle")); |
|
|
2393 | op->statusmsg ("You turn the handle."); |
2402 | tmp->value = tmp->value ? 0 : 1; |
2394 | tmp->value = tmp->value ? 0 : 1; |
2403 | SET_ANIMATION (tmp, tmp->value); |
2395 | SET_ANIMATION (tmp, tmp->value); |
2404 | update_object (tmp, UP_OBJ_FACE); |
2396 | update_object (tmp, UP_OBJ_FACE); |
2405 | push_button (tmp); |
2397 | push_button (tmp); |
2406 | return 1; |
2398 | return 1; |
2407 | |
2399 | |
2408 | case TRIGGER: |
2400 | case TRIGGER: |
2409 | if (check_trigger (tmp, op)) |
2401 | if (check_trigger (tmp, op)) |
2410 | { |
2402 | { |
2411 | new_draw_info (NDI_UNIQUE, 0, op, "You turn the handle."); |
2403 | op->statusmsg ("You turn the handle."); |
2412 | op->play_sound (sound_find ("turn_handle")); |
2404 | op->play_sound (sound_find ("turn_handle")); |
2413 | } |
2405 | } |
2414 | else |
2406 | else |
2415 | new_draw_info (NDI_UNIQUE, 0, op, "The handle doesn't move."); |
2407 | op->errormsg ("The handle doesn't move."); |
2416 | |
2408 | |
2417 | return 1; |
2409 | return 1; |
2418 | |
2410 | |
2419 | case EXIT: |
2411 | case EXIT: |
2420 | if (op->type != PLAYER) |
2412 | if (op->type != PLAYER) |
2421 | return 0; |
2413 | return 0; |
2422 | |
2414 | |
2423 | if (!EXIT_PATH (tmp) || !is_legal_2ways_exit (op, tmp)) |
2415 | if (!EXIT_PATH (tmp) || !is_legal_2ways_exit (op, tmp)) |
2424 | new_draw_info_format (NDI_UNIQUE, 0, op, "The %s is closed.", query_name (tmp)); |
2416 | op->errormsg (format ("The %s is closed.", query_name (tmp))); |
2425 | else |
2417 | else |
2426 | { |
2418 | { |
2427 | /* Don't display messages for random maps. */ |
2419 | /* Don't display messages for random maps. */ |
2428 | if (tmp->msg && strncmp (EXIT_PATH (tmp), "/!", 2)) |
2420 | if (tmp->msg && strncmp (EXIT_PATH (tmp), "/!", 2)) |
2429 | new_draw_info (NDI_NAVY, 0, op, tmp->msg); |
2421 | op->statusmsg (tmp->msg, NDI_NAVY); |
2430 | |
2422 | |
2431 | op->enter_exit (tmp); |
2423 | op->enter_exit (tmp); |
2432 | } |
2424 | } |
2433 | |
2425 | |
2434 | return 1; |
2426 | return 1; |
2435 | |
2427 | |
2436 | case INSCRIBABLE: |
2428 | case INSCRIBABLE: |
2437 | new_draw_info (NDI_UNIQUE, 0, op, tmp->msg); |
2429 | op->statusmsg (tmp->msg); |
2438 | // maybe show a spell menu to chose from or something like that |
2430 | // maybe show a spell menu to chose from or something like that |
2439 | return 1; |
2431 | return 1; |
2440 | |
2432 | |
2441 | case SIGN: |
2433 | case SIGN: |
2442 | apply_sign (op, tmp, 0); |
2434 | apply_sign (op, tmp, 0); |
… | |
… | |
2552 | { |
2544 | { |
2553 | char buf[MAX_BUF]; |
2545 | char buf[MAX_BUF]; |
2554 | timeofday_t tod; |
2546 | timeofday_t tod; |
2555 | |
2547 | |
2556 | get_tod (&tod); |
2548 | get_tod (&tod); |
2557 | sprintf (buf, "It is %d minute%s past %d o'clock %s", |
|
|
2558 | tod.minute + 1, ((tod.minute + 1 < 2) ? "" : "s"), |
|
|
2559 | ((tod.hour % 14 == 0) ? 14 : ((tod.hour) % 14)), ((tod.hour >= 14) ? "pm" : "am")); |
|
|
2560 | op->play_sound (sound_find ("sound_clock")); |
2549 | op->play_sound (sound_find ("sound_clock")); |
2561 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
2550 | op->statusmsg (format ( |
|
|
2551 | "It is %d minute%s past %d o'clock %s", |
|
|
2552 | tod.minute + 1, ((tod.minute + 1 < 2) ? "" : "s"), |
|
|
2553 | ((tod.hour % 14 == 0) ? 14 : ((tod.hour) % 14)), ((tod.hour >= 14) ? "pm" : "am") |
|
|
2554 | )); |
2562 | return 1; |
2555 | return 1; |
2563 | } |
2556 | } |
2564 | else |
2557 | else |
2565 | return 0; |
2558 | return 0; |
2566 | |
2559 | |
… | |
… | |
2610 | if (op->env && (pl->move_type & MOVE_FLYING)) |
2603 | if (op->env && (pl->move_type & MOVE_FLYING)) |
2611 | { |
2604 | { |
2612 | /* player is flying and applying object not in inventory */ |
2605 | /* player is flying and applying object not in inventory */ |
2613 | if (!QUERY_FLAG (pl, FLAG_WIZ) && !(op->move_type & MOVE_FLYING)) |
2606 | if (!QUERY_FLAG (pl, FLAG_WIZ) && !(op->move_type & MOVE_FLYING)) |
2614 | { |
2607 | { |
2615 | new_draw_info (NDI_UNIQUE, 0, pl, "But you are floating high above the ground! H<You have to stop levitating first, if you can.>"); |
2608 | op->errormsg ("But you are floating high above the ground! H<You have to stop levitating first, if you can.>"); |
2616 | return 0; |
2609 | return 0; |
2617 | } |
2610 | } |
2618 | } |
2611 | } |
2619 | |
2612 | |
2620 | pl->contr->last_used = op; |
2613 | pl->contr->last_used = op; |
2621 | |
2614 | |
2622 | tmp = manual_apply (pl, op, aflag); |
2615 | tmp = manual_apply (pl, op, aflag); |
2623 | if (!quiet) |
2616 | if (!quiet) |
2624 | { |
2617 | { |
2625 | if (tmp == 0) |
2618 | if (tmp == 0) |
2626 | new_draw_info_format (NDI_UNIQUE, 0, pl, "I don't know how to apply the %s.", query_name (op)); |
2619 | op->statusmsg (format ("I don't know how to apply the %s.", query_name (op))); |
2627 | else if (tmp == 2) |
2620 | else if (tmp == 2) |
2628 | new_draw_info_format (NDI_UNIQUE, 0, pl, "You must get it first!\n"); |
2621 | op->errormsg ("You must get it first!\n"); |
2629 | } |
2622 | } |
2630 | |
2623 | |
2631 | return tmp; |
2624 | return tmp; |
2632 | } |
2625 | } |
2633 | |
2626 | |
… | |
… | |
2710 | { |
2703 | { |
2711 | pl->combat_ob = 0; |
2704 | pl->combat_ob = 0; |
2712 | who->change_weapon (pl->ranged_ob); |
2705 | who->change_weapon (pl->ranged_ob); |
2713 | } |
2706 | } |
2714 | |
2707 | |
2715 | new_draw_info_format (NDI_UNIQUE, 0, who, "You unwield %s.", query_name (op)); |
2708 | who->statusmsg (format ("You unwield %s.", query_name (op))); |
2716 | |
2709 | |
2717 | change_abil (who, op); |
2710 | change_abil (who, op); |
2718 | CLEAR_FLAG (who, FLAG_READY_WEAPON); |
2711 | CLEAR_FLAG (who, FLAG_READY_WEAPON); |
2719 | break; |
2712 | break; |
2720 | |
2713 | |
2721 | case SKILL: |
2714 | case SKILL: |
2722 | if (who->contr) |
2715 | if (who->contr) |
2723 | { |
2716 | { |
2724 | if (!op->invisible) |
2717 | if (!op->invisible) |
2725 | new_draw_info_format (NDI_UNIQUE, 0, who, "You stop using the %s.", query_name (op)); |
2718 | who->statusmsg (format ("You stop using the %s.", query_name (op))); |
2726 | else |
2719 | else |
2727 | new_draw_info_format (NDI_UNIQUE, 0, who, "You can no longer use the skill: %s.", &op->skill); |
2720 | who->statusmsg (format ("You can no longer use the skill: %s.", &op->skill)); |
2728 | } |
2721 | } |
2729 | |
2722 | |
2730 | change_abil (who, op); |
2723 | change_abil (who, op); |
2731 | CLEAR_FLAG (who, FLAG_READY_SKILL); |
2724 | CLEAR_FLAG (who, FLAG_READY_SKILL); |
2732 | break; |
2725 | break; |
… | |
… | |
2739 | case GLOVES: |
2732 | case GLOVES: |
2740 | case AMULET: |
2733 | case AMULET: |
2741 | case GIRDLE: |
2734 | case GIRDLE: |
2742 | case BRACERS: |
2735 | case BRACERS: |
2743 | case CLOAK: |
2736 | case CLOAK: |
2744 | new_draw_info_format (NDI_UNIQUE, 0, who, "You unwear %s.", query_name (op)); |
2737 | who->statusmsg (format ("You unwear %s.", query_name (op))); |
2745 | change_abil (who, op); |
2738 | change_abil (who, op); |
2746 | break; |
2739 | break; |
2747 | |
2740 | |
2748 | case LAMP: |
2741 | case LAMP: |
2749 | { |
2742 | { |
2750 | new_draw_info_format (NDI_UNIQUE, 0, who, "You turn off your %s.", &op->name); |
2743 | who->statusmsg (format ("You turn off your %s.", &op->name)); |
2751 | |
2744 | |
2752 | object *tmp2 = arch_to_object (op->other_arch); |
2745 | object *tmp2 = arch_to_object (op->other_arch); |
2753 | tmp2->x = op->x; |
2746 | tmp2->x = op->x; |
2754 | tmp2->y = op->y; |
2747 | tmp2->y = op->y; |
2755 | tmp2->map = op->map; |
2748 | tmp2->map = op->map; |
… | |
… | |
2770 | |
2763 | |
2771 | if (QUERY_FLAG (op, FLAG_CURSED) || QUERY_FLAG (op, FLAG_DAMNED)) |
2764 | if (QUERY_FLAG (op, FLAG_CURSED) || QUERY_FLAG (op, FLAG_DAMNED)) |
2772 | { |
2765 | { |
2773 | if (who->contr) |
2766 | if (who->contr) |
2774 | { |
2767 | { |
2775 | new_draw_info (NDI_UNIQUE, 0, who, "Oops, it feels deadly cold!"); |
2768 | who->errormsg ("Oops, it feels deadly cold!"); |
2776 | SET_FLAG (tmp2, FLAG_KNOWN_CURSED); |
2769 | SET_FLAG (tmp2, FLAG_KNOWN_CURSED); |
2777 | } |
2770 | } |
2778 | } |
2771 | } |
2779 | |
2772 | |
2780 | if (who->contr) |
2773 | if (who->contr) |
… | |
… | |
2793 | { |
2786 | { |
2794 | pl->ranged_ob = 0; |
2787 | pl->ranged_ob = 0; |
2795 | who->change_weapon (pl->combat_ob); |
2788 | who->change_weapon (pl->combat_ob); |
2796 | } |
2789 | } |
2797 | |
2790 | |
2798 | new_draw_info_format (NDI_UNIQUE, 0, who, "You unready %s.", query_name (op)); |
2791 | who->statusmsg (format ("You unready %s.", query_name (op))); |
2799 | } |
2792 | } |
2800 | else |
2793 | else |
2801 | { |
2794 | { |
2802 | who->change_skill (0); |
2795 | who->change_skill (0); |
2803 | |
2796 | |
… | |
… | |
2809 | |
2802 | |
2810 | break; |
2803 | break; |
2811 | |
2804 | |
2812 | case BUILDER: |
2805 | case BUILDER: |
2813 | if (who->contr) |
2806 | if (who->contr) |
2814 | new_draw_info_format (NDI_UNIQUE, 0, who, "You unready %s.", query_name (op)); |
2807 | who->statusmsg (format ("You unready %s.", query_name (op))); |
2815 | break; |
2808 | break; |
2816 | |
2809 | |
2817 | default: |
2810 | default: |
2818 | new_draw_info_format (NDI_UNIQUE, 0, who, "You unapply %s.", query_name (op)); |
2811 | who->statusmsg (format ("You unapply %s.", query_name (op))); |
2819 | break; |
2812 | break; |
2820 | } |
2813 | } |
2821 | |
2814 | |
2822 | who->update_stats (); |
2815 | who->update_stats (); |
2823 | |
2816 | |