… | |
… | |
1162 | { |
1162 | { |
1163 | has_unpaid = true; |
1163 | has_unpaid = true; |
1164 | break; |
1164 | break; |
1165 | } |
1165 | } |
1166 | |
1166 | |
1167 | if (op->type != PLAYER) |
1167 | if (!op->is_player ()) |
1168 | { |
1168 | { |
1169 | /* Remove all the unpaid objects that may be carried here. |
1169 | /* Remove all the unpaid objects that may be carried here. |
1170 | * This could be pets or monsters that are somehow in |
1170 | * This could be pets or monsters that are somehow in |
1171 | * the shop. |
1171 | * the shop. |
1172 | */ |
1172 | */ |
… | |
… | |
1176 | |
1176 | |
1177 | if (QUERY_FLAG (tmp, FLAG_UNPAID)) |
1177 | if (QUERY_FLAG (tmp, FLAG_UNPAID)) |
1178 | { |
1178 | { |
1179 | 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); |
1180 | |
1180 | |
|
|
1181 | if (i >= 0) |
1181 | tmp->remove (); |
1182 | tmp->move (i); |
1182 | |
|
|
1183 | if (i == -1) |
|
|
1184 | i = 0; |
|
|
1185 | |
|
|
1186 | tmp->map = op->map; |
|
|
1187 | tmp->x = op->x + freearr_x[i]; |
|
|
1188 | tmp->y = op->y + freearr_y[i]; |
|
|
1189 | insert_ob_in_map (tmp, op->map, op, 0); |
|
|
1190 | } |
1183 | } |
1191 | } |
1184 | } |
1192 | |
1185 | |
1193 | /* Don't teleport things like spell effects */ |
1186 | /* Don't teleport things like spell effects */ |
1194 | if (QUERY_FLAG (op, FLAG_NO_PICK)) |
1187 | if (QUERY_FLAG (op, FLAG_NO_PICK)) |
… | |
… | |
1205 | if (i != -1) |
1198 | if (i != -1) |
1206 | 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); |
1207 | |
1200 | |
1208 | return 0; |
1201 | return 0; |
1209 | } |
1202 | } |
|
|
1203 | |
1210 | /* Removed code that checked for multipart objects - it appears that |
1204 | /* Removed code that checked for multipart objects - it appears that |
1211 | * the teleport function should be able to handle this just fine. |
1205 | * the teleport function should be able to handle this just fine. |
1212 | */ |
1206 | */ |
1213 | rv = teleport (shop_mat, SHOP_MAT, op); |
1207 | rv = teleport (shop_mat, SHOP_MAT, op); |
1214 | } |
1208 | } |
… | |
… | |
1271 | static void |
1265 | static void |
1272 | apply_sign (object *op, object *sign, int autoapply) |
1266 | apply_sign (object *op, object *sign, int autoapply) |
1273 | { |
1267 | { |
1274 | if (sign->has_dialogue ()) |
1268 | if (sign->has_dialogue ()) |
1275 | { |
1269 | { |
1276 | 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)); |
1277 | return; |
1271 | return; |
1278 | } |
1272 | } |
1279 | |
1273 | |
1280 | if (!sign->msg) |
1274 | if (!sign->msg) |
1281 | { |
1275 | { |
1282 | 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 ")); |
1283 | return; |
1280 | return; |
1284 | } |
1281 | } |
1285 | |
1282 | |
1286 | if (sign->stats.food) |
1283 | if (sign->stats.food) |
1287 | { |
1284 | { |
1288 | if (sign->last_eat >= sign->stats.food) |
1285 | if (sign->last_eat >= sign->stats.food) |
1289 | { |
1286 | { |
1290 | if (!sign->move_on) |
1287 | if (!sign->move_on) |
1291 | op->statusmsg ("You cannot read it anymore."); |
1288 | op->failmsg ("You cannot read it anymore."); |
1292 | |
1289 | |
1293 | return; |
1290 | return; |
1294 | } |
1291 | } |
1295 | |
1292 | |
1296 | if (!QUERY_FLAG (op, FLAG_WIZPASS)) |
1293 | if (!QUERY_FLAG (op, FLAG_WIZPASS)) |
… | |
… | |
1314 | if (sign->sound) |
1311 | if (sign->sound) |
1315 | ns->play_sound (sign->sound); |
1312 | ns->play_sound (sign->sound); |
1316 | else if (autoapply) |
1313 | else if (autoapply) |
1317 | ns->play_sound (sound_find ("msg_voice")); |
1314 | ns->play_sound (sound_find ("msg_voice")); |
1318 | |
1315 | |
1319 | if (ns->can_msg) |
|
|
1320 | op->contr->infobox (MSG_CHANNEL ("examine"), format ("T<%s>\n\n%s", &sign->name, &sign->msg)); |
1316 | op->contr->infobox (MSG_CHANNEL ("examine"), format ("T<%s>\n\n%s", &sign->name, &sign->msg)); |
1321 | else |
|
|
1322 | { |
|
|
1323 | readable_message_type *msgType = get_readable_message_type (sign); |
|
|
1324 | const char *somemsg = format ("%u %s", autoapply ? 1 : 0, &sign->msg); |
|
|
1325 | draw_ext_info (NDI_UNIQUE | NDI_NAVY, 0, op, msgType->message_type, msgType->message_subtype, somemsg, &sign->msg); |
|
|
1326 | } |
|
|
1327 | } |
1317 | } |
1328 | } |
1318 | } |
1329 | |
1319 | |
1330 | static void |
1320 | static void |
1331 | move_apply_hole (object *trap, object *victim) |
1321 | move_apply_hole (object *trap, object *victim) |
… | |
… | |
1635 | |
1625 | |
1636 | readable_message_type *msgType = get_readable_message_type (tmp); |
1626 | readable_message_type *msgType = get_readable_message_type (tmp); |
1637 | |
1627 | |
1638 | if (player *pl = op->contr) |
1628 | if (player *pl = op->contr) |
1639 | if (client *ns = pl->ns) |
1629 | if (client *ns = pl->ns) |
1640 | if (ns->can_msg) |
|
|
1641 | pl->infobox (MSG_CHANNEL ("book"), format ("T<%s>\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)); |
1642 | else |
|
|
1643 | draw_ext_info_format (NDI_UNIQUE | NDI_NAVY, 0, op, |
|
|
1644 | msgType->message_type, msgType->message_subtype, |
|
|
1645 | "You open the %s and start reading.\n%s", (char *)"%s\n%s", |
|
|
1646 | long_desc (tmp, op), &tmp->msg); |
|
|
1647 | |
1631 | |
1648 | /* gain xp from reading */ |
1632 | /* gain xp from reading */ |
1649 | if (!QUERY_FLAG (tmp, FLAG_NO_SKILL_IDENT)) |
1633 | if (!QUERY_FLAG (tmp, FLAG_NO_SKILL_IDENT)) |
1650 | { /* only if not read before */ |
1634 | { /* only if not read before */ |
1651 | int exp_gain = calc_skill_exp (op, tmp, skill_ob); |
1635 | int exp_gain = calc_skill_exp (op, tmp, skill_ob); |
… | |
… | |
2179 | op->statusmsg (buf); |
2163 | op->statusmsg (buf); |
2180 | |
2164 | |
2181 | /* now choose a winner if we have any */ |
2165 | /* now choose a winner if we have any */ |
2182 | i = -1; |
2166 | i = -1; |
2183 | if (winners > 0) |
2167 | if (winners > 0) |
2184 | i = atnr_winner[RANDOM () % winners]; |
2168 | i = atnr_winner [rndm (winners)]; |
2185 | |
2169 | |
2186 | if (i >= 0 && i < NROFATTACKS && skin->resist[i] < 95) |
2170 | if (i >= 0 && i < NROFATTACKS && skin->resist[i] < 95) |
2187 | { |
2171 | { |
2188 | /* resistance increased! */ |
2172 | /* resistance increased! */ |
2189 | skin->resist[i]++; |
2173 | skin->resist[i]++; |
… | |
… | |
2669 | * person moving on it, also activate. Added code to make it |
2653 | * person moving on it, also activate. Added code to make it |
2670 | * 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 |
2671 | * the item needs. |
2655 | * the item needs. |
2672 | */ |
2656 | */ |
2673 | if (!tmp->invisible || (tmp->move_on & pl->move_type)) |
2657 | if (!tmp->invisible || (tmp->move_on & pl->move_type)) |
2674 | { |
|
|
2675 | if (player_apply (pl, tmp, 0, 1) == 1) |
2658 | if (player_apply (pl, tmp, 0, 1) == 1) |
2676 | return; |
2659 | return; |
2677 | } |
2660 | |
2678 | if (floors >= 2) |
2661 | if (floors >= 2) |
2679 | return; /* process at most two floor objects */ |
2662 | return; /* process at most two floor objects */ |
2680 | } |
2663 | } |
2681 | } |
2664 | } |
2682 | |
2665 | |
… | |
… | |
2776 | op->destroy (); |
2759 | op->destroy (); |
2777 | who->insert (tmp2); |
2760 | who->insert (tmp2); |
2778 | who->update_stats (); |
2761 | who->update_stats (); |
2779 | |
2762 | |
2780 | if (who->contr) |
2763 | if (who->contr) |
2781 | { |
|
|
2782 | if (QUERY_FLAG (op, FLAG_CURSED) || QUERY_FLAG (op, FLAG_DAMNED)) |
2764 | if (QUERY_FLAG (op, FLAG_CURSED) || QUERY_FLAG (op, FLAG_DAMNED)) |
2783 | { |
2765 | { |
2784 | who->failmsg ("Oops, it feels deadly cold!"); |
2766 | who->failmsg ("Oops, it feels deadly cold!"); |
2785 | SET_FLAG (tmp2, FLAG_KNOWN_CURSED); |
2767 | SET_FLAG (tmp2, FLAG_KNOWN_CURSED); |
2786 | } |
2768 | } |
2787 | } |
|
|
2788 | } |
2769 | } |
2789 | |
2770 | |
2790 | return 1; /* otherwise, an attempt to drop causes problems */ |
2771 | return 1; /* otherwise, an attempt to drop causes problems */ |
2791 | |
2772 | |
2792 | case BOW: |
2773 | case BOW: |
… | |
… | |
3314 | who->update_stats (); |
3295 | who->update_stats (); |
3315 | |
3296 | |
3316 | if (QUERY_FLAG (op, FLAG_CURSED) || QUERY_FLAG (op, FLAG_DAMNED)) |
3297 | if (QUERY_FLAG (op, FLAG_CURSED) || QUERY_FLAG (op, FLAG_DAMNED)) |
3317 | if (who->type == PLAYER) |
3298 | if (who->type == PLAYER) |
3318 | { |
3299 | { |
3319 | 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.>"); |
3320 | SET_FLAG (tmp2, FLAG_KNOWN_CURSED); |
3301 | SET_FLAG (tmp2, FLAG_KNOWN_CURSED); |
3321 | } |
3302 | } |
3322 | |
3303 | |
3323 | return 0; |
3304 | return 0; |
3324 | |
3305 | |
… | |
… | |
3502 | if (QUERY_FLAG (op, FLAG_CURSED) || QUERY_FLAG (op, FLAG_DAMNED)) |
3483 | if (QUERY_FLAG (op, FLAG_CURSED) || QUERY_FLAG (op, FLAG_DAMNED)) |
3503 | if (who->type == PLAYER) |
3484 | if (who->type == PLAYER) |
3504 | { |
3485 | { |
3505 | who->failmsg ( |
3486 | who->failmsg ( |
3506 | "Oops, it feels deadly cold! " |
3487 | "Oops, it feels deadly cold! " |
3507 | "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.>" |
3508 | ); |
3489 | ); |
3509 | SET_FLAG (op, FLAG_KNOWN_CURSED); |
3490 | SET_FLAG (op, FLAG_KNOWN_CURSED); |
3510 | } |
3491 | } |
3511 | |
3492 | |
3512 | if (object *pl = op->visible_to ()) |
3493 | if (object *pl = op->visible_to ()) |