… | |
… | |
113 | { |
113 | { |
114 | if (operate_altar (altar, &money)) |
114 | if (operate_altar (altar, &money)) |
115 | { |
115 | { |
116 | identify (marked); |
116 | identify (marked); |
117 | |
117 | |
118 | buf.printf ("You have %s.\n\n", long_desc (marked, pl)); |
118 | buf.printf ("You have %s.\r", long_desc (marked, pl)); |
119 | if (marked->msg) |
119 | if (marked->msg) |
120 | buf << "The item has a story:\n\n" << marked->msg << "\n\n"; |
120 | buf << "The item has a story:\r" << marked->msg << "\n\n"; |
121 | |
121 | |
122 | return !money; |
122 | return !money; |
123 | } |
123 | } |
124 | } |
124 | } |
125 | |
125 | |
… | |
… | |
129 | { |
129 | { |
130 | if (operate_altar (altar, &money)) |
130 | if (operate_altar (altar, &money)) |
131 | { |
131 | { |
132 | identify (id); |
132 | identify (id); |
133 | |
133 | |
134 | buf.printf ("You have %s.\n\n", long_desc (id, pl)); |
134 | buf.printf ("You have %s.\r", long_desc (id, pl)); |
135 | if (id->msg) |
135 | if (id->msg) |
136 | buf << "The item has a story:\n\n" << id->msg << "\n\n"; |
136 | buf << "The item has a story:\r" << id->msg << "\n\n"; |
137 | |
137 | |
138 | /* If no more money, might as well quit now */ |
138 | /* If no more money, might as well quit now */ |
139 | if (!money || !check_altar_sacrifice (altar, money)) |
139 | if (!money || !check_altar_sacrifice (altar, money)) |
140 | break; |
140 | break; |
141 | } |
141 | } |
… | |
… | |
995 | item->nrof = give; |
995 | item->nrof = give; |
996 | |
996 | |
997 | if (nr) |
997 | if (nr) |
998 | item->nrof *= nr; |
998 | item->nrof *= nr; |
999 | |
999 | |
1000 | if (is_in_shop (converter)) |
1000 | if (converter->flag [FLAG_PRECIOUS]) |
1001 | SET_FLAG (item, FLAG_UNPAID); |
1001 | SET_FLAG (item, FLAG_UNPAID); |
|
|
1002 | |
|
|
1003 | if (is_in_shop (converter)) |
|
|
1004 | { |
|
|
1005 | // converters on shop floors don't work anymore, bug lets check for it |
|
|
1006 | // and report in case someone still does it. |
|
|
1007 | LOG (llevDebug, "ITEMBUG: broken converter, converters on shop floor don't work: %s\n", |
|
|
1008 | converter->debug_desc ()); |
|
|
1009 | SET_FLAG (item, FLAG_UNPAID); |
|
|
1010 | } |
1002 | else if (price_in < sint64 (item->nrof) * item->value) |
1011 | else if (price_in < sint64 (item->nrof) * item->value) |
1003 | { |
1012 | { |
1004 | LOG (llevDebug, "converter output price higher than input: %s at %s (%d, %d) in value %d, out value %d for %s\n", |
1013 | LOG (llevDebug, "converter output price higher than input: %s at %s (%d, %d) in value %d, out value %d for %s\n", |
1005 | &converter->name, &converter->map->path, converter->x, converter->y, price_in, item->nrof * item->value, &item->name); |
1014 | &converter->name, &converter->map->path, converter->x, converter->y, price_in, item->nrof * item->value, &item->name); |
1006 | /** |
1015 | /** |
… | |
… | |
1153 | { |
1162 | { |
1154 | has_unpaid = true; |
1163 | has_unpaid = true; |
1155 | break; |
1164 | break; |
1156 | } |
1165 | } |
1157 | |
1166 | |
1158 | if (op->type != PLAYER) |
1167 | if (!op->is_player ()) |
1159 | { |
1168 | { |
1160 | /* Remove all the unpaid objects that may be carried here. |
1169 | /* Remove all the unpaid objects that may be carried here. |
1161 | * This could be pets or monsters that are somehow in |
1170 | * This could be pets or monsters that are somehow in |
1162 | * the shop. |
1171 | * the shop. |
1163 | */ |
1172 | */ |
… | |
… | |
1167 | |
1176 | |
1168 | if (QUERY_FLAG (tmp, FLAG_UNPAID)) |
1177 | if (QUERY_FLAG (tmp, FLAG_UNPAID)) |
1169 | { |
1178 | { |
1170 | int i = find_free_spot (tmp, op->map, op->x, op->y, 1, 9); |
1179 | int i = find_free_spot (tmp, op->map, op->x, op->y, 1, 9); |
1171 | |
1180 | |
|
|
1181 | if (i >= 0) |
1172 | tmp->remove (); |
1182 | tmp->move (i); |
1173 | |
|
|
1174 | if (i == -1) |
|
|
1175 | i = 0; |
|
|
1176 | |
|
|
1177 | tmp->map = op->map; |
|
|
1178 | tmp->x = op->x + freearr_x[i]; |
|
|
1179 | tmp->y = op->y + freearr_y[i]; |
|
|
1180 | insert_ob_in_map (tmp, op->map, op, 0); |
|
|
1181 | } |
1183 | } |
1182 | } |
1184 | } |
1183 | |
1185 | |
1184 | /* Don't teleport things like spell effects */ |
1186 | /* Don't teleport things like spell effects */ |
1185 | if (QUERY_FLAG (op, FLAG_NO_PICK)) |
1187 | if (QUERY_FLAG (op, FLAG_NO_PICK)) |
… | |
… | |
1196 | if (i != -1) |
1198 | if (i != -1) |
1197 | rv = transfer_ob (op, op->x + freearr_x[i], op->y + freearr_y[i], 0, shop_mat); |
1199 | rv = transfer_ob (op, op->x + freearr_x[i], op->y + freearr_y[i], 0, shop_mat); |
1198 | |
1200 | |
1199 | return 0; |
1201 | return 0; |
1200 | } |
1202 | } |
|
|
1203 | |
1201 | /* Removed code that checked for multipart objects - it appears that |
1204 | /* Removed code that checked for multipart objects - it appears that |
1202 | * the teleport function should be able to handle this just fine. |
1205 | * the teleport function should be able to handle this just fine. |
1203 | */ |
1206 | */ |
1204 | rv = teleport (shop_mat, SHOP_MAT, op); |
1207 | rv = teleport (shop_mat, SHOP_MAT, op); |
1205 | } |
1208 | } |
… | |
… | |
1262 | static void |
1265 | static void |
1263 | apply_sign (object *op, object *sign, int autoapply) |
1266 | apply_sign (object *op, object *sign, int autoapply) |
1264 | { |
1267 | { |
1265 | if (sign->has_dialogue ()) |
1268 | if (sign->has_dialogue ()) |
1266 | { |
1269 | { |
1267 | op->statusmsg (form ("Maybe you should I<talk> to the %s instead?", &sign->name)); |
1270 | op->statusmsg (format ("Maybe you should I<talk> to the %s instead?", &sign->name)); |
1268 | return; |
1271 | return; |
1269 | } |
1272 | } |
1270 | |
1273 | |
1271 | if (!sign->msg) |
1274 | if (!sign->msg) |
1272 | { |
1275 | { |
1273 | op->statusmsg ("Nothing is written on it."); |
1276 | op->contr->infobox (MSG_CHANNEL ("examine"), |
|
|
1277 | format ("T<%s>\n\n Nothing %sis written on it.", |
|
|
1278 | &sign->name, |
|
|
1279 | sign->name == sign->arch->name ? "" : "else ")); |
1274 | return; |
1280 | return; |
1275 | } |
1281 | } |
1276 | |
1282 | |
1277 | if (sign->stats.food) |
1283 | if (sign->stats.food) |
1278 | { |
1284 | { |
1279 | if (sign->last_eat >= sign->stats.food) |
1285 | if (sign->last_eat >= sign->stats.food) |
1280 | { |
1286 | { |
1281 | if (!sign->move_on) |
1287 | if (!sign->move_on) |
1282 | op->statusmsg ("You cannot read it anymore."); |
1288 | op->failmsg ("You cannot read it anymore."); |
1283 | |
1289 | |
1284 | return; |
1290 | return; |
1285 | } |
1291 | } |
1286 | |
1292 | |
1287 | if (!QUERY_FLAG (op, FLAG_WIZPASS)) |
1293 | if (!QUERY_FLAG (op, FLAG_WIZPASS)) |
… | |
… | |
1305 | if (sign->sound) |
1311 | if (sign->sound) |
1306 | ns->play_sound (sign->sound); |
1312 | ns->play_sound (sign->sound); |
1307 | else if (autoapply) |
1313 | else if (autoapply) |
1308 | ns->play_sound (sound_find ("msg_voice")); |
1314 | ns->play_sound (sound_find ("msg_voice")); |
1309 | |
1315 | |
1310 | if (ns->can_msg) |
|
|
1311 | op->contr->infobox (MSG_CHANNEL ("examine"), format ("T<%s>\n\n\n\n%s", &sign->name, &sign->msg)); |
1316 | op->contr->infobox (MSG_CHANNEL ("examine"), format ("T<%s>\n\n%s", &sign->name, &sign->msg)); |
1312 | else |
|
|
1313 | { |
|
|
1314 | readable_message_type *msgType = get_readable_message_type (sign); |
|
|
1315 | const char *somemsg = format ("%u %s", autoapply ? 1 : 0, &sign->msg); |
|
|
1316 | draw_ext_info (NDI_UNIQUE | NDI_NAVY, 0, op, msgType->message_type, msgType->message_subtype, somemsg, &sign->msg); |
|
|
1317 | } |
|
|
1318 | } |
1317 | } |
1319 | } |
1318 | } |
1320 | |
1319 | |
1321 | static void |
1320 | static void |
1322 | move_apply_hole (object *trap, object *victim) |
1321 | move_apply_hole (object *trap, object *victim) |
… | |
… | |
1329 | * Processing will happen if the head runs into the pit |
1328 | * Processing will happen if the head runs into the pit |
1330 | */ |
1329 | */ |
1331 | if (victim->head) |
1330 | if (victim->head) |
1332 | return; |
1331 | return; |
1333 | |
1332 | |
1334 | fprintf (stderr, "range %d\n", trap->range);//D |
|
|
1335 | // now find all possible locations and randomly pick one |
1333 | // now find all possible locations and randomly pick one |
1336 | int dir = find_free_spot (victim, trap->map, EXIT_X (trap), EXIT_Y (trap), 0, |
1334 | int dir = find_free_spot (victim, trap->map, EXIT_X (trap), EXIT_Y (trap), 0, |
1337 | trap->range >= 3 ? SIZEOFFREE3 |
1335 | trap->range >= 3 ? SIZEOFFREE3 + 1 |
1338 | : trap->range >= 2 ? SIZEOFFREE2 |
1336 | : trap->range >= 2 ? SIZEOFFREE2 + 1 |
1339 | : trap->range >= 1 ? SIZEOFFREE1 |
1337 | : trap->range >= 1 ? SIZEOFFREE1 + 1 |
1340 | : 0); |
1338 | : SIZEOFFREE0 + 1); |
1341 | |
1339 | |
1342 | if (dir < 0) |
1340 | if (dir < 0) |
1343 | return; |
1341 | return; |
1344 | |
1342 | |
1345 | victim->play_sound (trap->sound ? trap->sound : sound_find ("fall_hole")); |
1343 | victim->play_sound (trap->sound ? trap->sound : sound_find ("fall_hole")); |
… | |
… | |
1627 | |
1625 | |
1628 | readable_message_type *msgType = get_readable_message_type (tmp); |
1626 | readable_message_type *msgType = get_readable_message_type (tmp); |
1629 | |
1627 | |
1630 | if (player *pl = op->contr) |
1628 | if (player *pl = op->contr) |
1631 | if (client *ns = pl->ns) |
1629 | if (client *ns = pl->ns) |
1632 | if (ns->can_msg) |
|
|
1633 | pl->infobox (MSG_CHANNEL ("book"), format ("T<%s>\n\n\n\n%s", (char *)long_desc (tmp, op), &tmp->msg)); |
1630 | pl->infobox (MSG_CHANNEL ("book"), format ("T<%s>\n\n%s", (char *)long_desc (tmp, op), &tmp->msg)); |
1634 | else |
|
|
1635 | draw_ext_info_format (NDI_UNIQUE | NDI_NAVY, 0, op, |
|
|
1636 | msgType->message_type, msgType->message_subtype, |
|
|
1637 | "You open the %s and start reading.\n%s", (char *)"%s\n%s", |
|
|
1638 | long_desc (tmp, op), &tmp->msg); |
|
|
1639 | |
1631 | |
1640 | /* gain xp from reading */ |
1632 | /* gain xp from reading */ |
1641 | if (!QUERY_FLAG (tmp, FLAG_NO_SKILL_IDENT)) |
1633 | if (!QUERY_FLAG (tmp, FLAG_NO_SKILL_IDENT)) |
1642 | { /* only if not read before */ |
1634 | { /* only if not read before */ |
1643 | int exp_gain = calc_skill_exp (op, tmp, skill_ob); |
1635 | int exp_gain = calc_skill_exp (op, tmp, skill_ob); |
… | |
… | |
1966 | if (op->destroyed () || tmp->destroyed ()) |
1958 | if (op->destroyed () || tmp->destroyed ()) |
1967 | break; |
1959 | break; |
1968 | } |
1960 | } |
1969 | |
1961 | |
1970 | if (!tmp->destroyed () && !tmp->inv) |
1962 | if (!tmp->destroyed () && !tmp->inv) |
1971 | tmp->decrease (); |
1963 | tmp->decrease (true); |
1972 | } |
1964 | } |
1973 | |
1965 | |
1974 | /** |
1966 | /** |
1975 | * op eats food. |
1967 | * op eats food. |
1976 | * If player, takes care of messages and dragon special food. |
1968 | * If player, takes care of messages and dragon special food. |
… | |
… | |
2171 | op->statusmsg (buf); |
2163 | op->statusmsg (buf); |
2172 | |
2164 | |
2173 | /* now choose a winner if we have any */ |
2165 | /* now choose a winner if we have any */ |
2174 | i = -1; |
2166 | i = -1; |
2175 | if (winners > 0) |
2167 | if (winners > 0) |
2176 | i = atnr_winner[RANDOM () % winners]; |
2168 | i = atnr_winner [rndm (winners)]; |
2177 | |
2169 | |
2178 | if (i >= 0 && i < NROFATTACKS && skin->resist[i] < 95) |
2170 | if (i >= 0 && i < NROFATTACKS && skin->resist[i] < 95) |
2179 | { |
2171 | { |
2180 | /* resistance increased! */ |
2172 | /* resistance increased! */ |
2181 | skin->resist[i]++; |
2173 | skin->resist[i]++; |
… | |
… | |
2661 | * person moving on it, also activate. Added code to make it |
2653 | * person moving on it, also activate. Added code to make it |
2662 | * so that at least one of players movement types be that which |
2654 | * so that at least one of players movement types be that which |
2663 | * the item needs. |
2655 | * the item needs. |
2664 | */ |
2656 | */ |
2665 | if (!tmp->invisible || (tmp->move_on & pl->move_type)) |
2657 | if (!tmp->invisible || (tmp->move_on & pl->move_type)) |
2666 | { |
|
|
2667 | if (player_apply (pl, tmp, 0, 1) == 1) |
2658 | if (player_apply (pl, tmp, 0, 1) == 1) |
2668 | return; |
2659 | return; |
2669 | } |
2660 | |
2670 | if (floors >= 2) |
2661 | if (floors >= 2) |
2671 | return; /* process at most two floor objects */ |
2662 | return; /* process at most two floor objects */ |
2672 | } |
2663 | } |
2673 | } |
2664 | } |
2674 | |
2665 | |
… | |
… | |
2768 | op->destroy (); |
2759 | op->destroy (); |
2769 | who->insert (tmp2); |
2760 | who->insert (tmp2); |
2770 | who->update_stats (); |
2761 | who->update_stats (); |
2771 | |
2762 | |
2772 | if (who->contr) |
2763 | if (who->contr) |
2773 | { |
|
|
2774 | if (QUERY_FLAG (op, FLAG_CURSED) || QUERY_FLAG (op, FLAG_DAMNED)) |
2764 | if (QUERY_FLAG (op, FLAG_CURSED) || QUERY_FLAG (op, FLAG_DAMNED)) |
2775 | { |
2765 | { |
2776 | who->failmsg ("Oops, it feels deadly cold!"); |
2766 | who->failmsg ("Oops, it feels deadly cold!"); |
2777 | SET_FLAG (tmp2, FLAG_KNOWN_CURSED); |
2767 | SET_FLAG (tmp2, FLAG_KNOWN_CURSED); |
2778 | } |
2768 | } |
2779 | } |
|
|
2780 | } |
2769 | } |
2781 | |
2770 | |
2782 | return 1; /* otherwise, an attempt to drop causes problems */ |
2771 | return 1; /* otherwise, an attempt to drop causes problems */ |
2783 | |
2772 | |
2784 | case BOW: |
2773 | case BOW: |
… | |
… | |
3306 | who->update_stats (); |
3295 | who->update_stats (); |
3307 | |
3296 | |
3308 | if (QUERY_FLAG (op, FLAG_CURSED) || QUERY_FLAG (op, FLAG_DAMNED)) |
3297 | if (QUERY_FLAG (op, FLAG_CURSED) || QUERY_FLAG (op, FLAG_DAMNED)) |
3309 | if (who->type == PLAYER) |
3298 | if (who->type == PLAYER) |
3310 | { |
3299 | { |
3311 | who->failmsg ("Oops, it feels deadly cold! H<Maybe it wasn't such a bright idea to apply this cursed/damned item.>"); |
3300 | who->failmsg ("Oops, it feels deadly cold! H<Maybe it wasn't such a bright (hrhrhr) idea to apply this cursed or damned item.>"); |
3312 | SET_FLAG (tmp2, FLAG_KNOWN_CURSED); |
3301 | SET_FLAG (tmp2, FLAG_KNOWN_CURSED); |
3313 | } |
3302 | } |
3314 | |
3303 | |
3315 | return 0; |
3304 | return 0; |
3316 | |
3305 | |
… | |
… | |
3494 | if (QUERY_FLAG (op, FLAG_CURSED) || QUERY_FLAG (op, FLAG_DAMNED)) |
3483 | if (QUERY_FLAG (op, FLAG_CURSED) || QUERY_FLAG (op, FLAG_DAMNED)) |
3495 | if (who->type == PLAYER) |
3484 | if (who->type == PLAYER) |
3496 | { |
3485 | { |
3497 | who->failmsg ( |
3486 | who->failmsg ( |
3498 | "Oops, it feels deadly cold! " |
3487 | "Oops, it feels deadly cold! " |
3499 | "H<Maybe it wasn't such a bright idea to apply this cursed/damned item.>" |
3488 | "H<Maybe it wasn't such a bright idea to apply this cursed or damned item.>" |
3500 | ); |
3489 | ); |
3501 | SET_FLAG (op, FLAG_KNOWN_CURSED); |
3490 | SET_FLAG (op, FLAG_KNOWN_CURSED); |
3502 | } |
3491 | } |
3503 | |
3492 | |
3504 | if (object *pl = op->visible_to ()) |
3493 | if (object *pl = op->visible_to ()) |
… | |
… | |
3573 | /* If we generated an object and put it in this object inventory, |
3562 | /* If we generated an object and put it in this object inventory, |
3574 | * move it to the parent object as the current object is about |
3563 | * move it to the parent object as the current object is about |
3575 | * to disappear. An example of this item is the random_* stuff |
3564 | * to disappear. An example of this item is the random_* stuff |
3576 | * that is put inside other objects. |
3565 | * that is put inside other objects. |
3577 | */ |
3566 | */ |
3578 | for (tmp = op->inv; tmp; tmp = tmp2) |
|
|
3579 | { |
|
|
3580 | tmp2 = tmp->below; |
|
|
3581 | tmp->remove (); |
|
|
3582 | |
|
|
3583 | if (op->env) |
3567 | if (op->env) |
3584 | insert_ob_in_ob (tmp, op->env); |
3568 | while (op->inv) |
3585 | else |
3569 | op->env->insert (op->inv); |
3586 | tmp->destroy (); |
|
|
3587 | } |
|
|
3588 | |
3570 | |
3589 | op->destroy (); |
3571 | op->destroy (); |
3590 | break; |
3572 | break; |
3591 | } |
3573 | } |
3592 | |
3574 | |