… | |
… | |
74 | }; |
74 | }; |
75 | |
75 | |
76 | /* The following is a large table of item types, the fields are: |
76 | /* The following is a large table of item types, the fields are: |
77 | * item number, item name, item name (plural), and two numbers that are the skills |
77 | * item number, item name, item name (plural), and two numbers that are the skills |
78 | * used to identify them. Anytime a new item type is added or removed, this list |
78 | * used to identify them. Anytime a new item type is added or removed, this list |
79 | * should be altered to reflect that. The defines for the numerical values are in |
79 | * should be altered to reflect that. The defines for the numerical values are in |
80 | * define.h |
80 | * define.h |
81 | */ |
81 | */ |
82 | static const typedata item_types[] = { |
82 | static const typedata item_types[] = { |
83 | {PLAYER, "player", "players", 0, 0}, |
83 | {PLAYER, "player", "players", 0, 0}, |
84 | {ROD, "rod", "rods", SK_THAUMATURGY, 0}, |
84 | {ROD, "rod", "rods", SK_THAUMATURGY, 0}, |
85 | {TREASURE, "treasure", "treasure", 0, 0}, |
85 | {TREASURE, "treasure", "treasure", 0, 0}, |
… | |
… | |
280 | enc += op->stats.stat (i); |
280 | enc += op->stats.stat (i); |
281 | |
281 | |
282 | /* This protection logic is pretty flawed. 20% fire resistance |
282 | /* This protection logic is pretty flawed. 20% fire resistance |
283 | * is much more valuable than 20% confusion, or 20% slow, or |
283 | * is much more valuable than 20% confusion, or 20% slow, or |
284 | * several others. Start at 1 - ignore physical - all that normal |
284 | * several others. Start at 1 - ignore physical - all that normal |
285 | * armour shouldn't be counted against |
285 | * armour shouldn't be counted against |
286 | */ |
286 | */ |
287 | tmp = 0; |
287 | tmp = 0; |
288 | for (i = 1; i < NROFATTACKS; i++) |
288 | for (i = 1; i < NROFATTACKS; i++) |
289 | tmp += op->resist[i]; |
289 | tmp += op->resist[i]; |
290 | |
290 | |
… | |
… | |
358 | { |
358 | { |
359 | return data [itemtype]; |
359 | return data [itemtype]; |
360 | } |
360 | } |
361 | } get_typedata_; |
361 | } get_typedata_; |
362 | |
362 | |
363 | /* returns the typedata that has a number equal to itemtype, if there |
363 | /* returns the typedata that has a number equal to itemtype, if there |
364 | * isn't one, returns NULL */ |
364 | * isn't one, returns NULL */ |
365 | const typedata * |
365 | const typedata * |
366 | get_typedata (int itemtype) |
366 | get_typedata (int itemtype) |
367 | { |
367 | { |
368 | return get_typedata_ (itemtype); |
368 | return get_typedata_ (itemtype); |
369 | } |
369 | } |
370 | |
370 | |
371 | /* returns the typedata that has a name equal to itemtype, if there |
371 | /* returns the typedata that has a name equal to itemtype, if there |
372 | * isn't one, return the plural name that matches, if there still isn't |
372 | * isn't one, return the plural name that matches, if there still isn't |
373 | * one return NULL */ |
373 | * one return NULL */ |
374 | const typedata * |
374 | const typedata * |
375 | get_typedata_by_name (const char *name) |
375 | get_typedata_by_name (const char *name) |
376 | { |
376 | { |
… | |
… | |
514 | |
514 | |
515 | return buf; |
515 | return buf; |
516 | } |
516 | } |
517 | |
517 | |
518 | /* |
518 | /* |
519 | * query_short_name(object) is similar to query_name, but doesn't |
519 | * query_short_name(object) is similar to query_name, but doesn't |
520 | * contain any information about object status (worn/cursed/etc.) |
520 | * contain any information about object status (worn/cursed/etc.) |
521 | * |
521 | * |
522 | * It is sometimes used when printing messages, so should fit well into a sentence. |
522 | * It is sometimes used when printing messages, so should fit well into a sentence. |
523 | */ |
523 | */ |
524 | const char * |
524 | const char * |
… | |
… | |
1192 | |
1192 | |
1193 | if (more_info) |
1193 | if (more_info) |
1194 | { |
1194 | { |
1195 | if (op->stats.food) buf.printf ("(sustenance%+d)", op->stats.food); |
1195 | if (op->stats.food) buf.printf ("(sustenance%+d)", op->stats.food); |
1196 | if (op->stats.grace) buf.printf ("(grace%+d)", op->stats.grace); |
1196 | if (op->stats.grace) buf.printf ("(grace%+d)", op->stats.grace); |
1197 | if (op->stats.sp) buf.printf ("(magic%+d)", op->stats.sp); |
1197 | if (op->stats.sp) buf.printf ("(magic%+d)", op->stats.sp); |
1198 | if (op->stats.hp) buf.printf ("(regeneration%+d)", op->stats.hp); |
1198 | if (op->stats.hp) buf.printf ("(regeneration%+d)", op->stats.hp); |
1199 | } |
1199 | } |
1200 | |
1200 | |
1201 | if (op->stats.luck) |
1201 | if (op->stats.luck) |
1202 | buf.printf ("(luck%+d)", op->stats.luck); |
1202 | buf.printf ("(luck%+d)", op->stats.luck); |
… | |
… | |
1411 | op->contr->infobox (MSG_CHANNEL ("examine"), info.c_str ()); |
1411 | op->contr->infobox (MSG_CHANNEL ("examine"), info.c_str ()); |
1412 | } |
1412 | } |
1413 | |
1413 | |
1414 | /* |
1414 | /* |
1415 | * inventory prints object's inventory. If inv==NULL then print player's |
1415 | * inventory prints object's inventory. If inv==NULL then print player's |
1416 | * inventory. |
1416 | * inventory. |
1417 | * [ Only items which are applied are showed. Tero.Haatanen@lut.fi ] |
1417 | * [ Only items which are applied are showed. Tero.Haatanen@lut.fi ] |
1418 | */ |
1418 | */ |
1419 | const char * |
1419 | const char * |
1420 | object::query_inventory (object *who, const char *indent) |
1420 | object::query_inventory (object *who, const char *indent) |
1421 | { |
1421 | { |