1 | /* |
1 | /* |
2 | * CrossFire, A Multiplayer game for X-windows |
2 | * CrossFire, A Multiplayer game |
3 | * |
3 | * |
4 | * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
4 | * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
5 | * Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
5 | * Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
6 | * Copyright (C) 1992 Frank Tore Johansen |
6 | * Copyright (C) 1992 Frank Tore Johansen |
7 | * |
7 | * |
… | |
… | |
250 | }; |
250 | }; |
251 | |
251 | |
252 | int |
252 | int |
253 | get_power_from_ench (int ench) |
253 | get_power_from_ench (int ench) |
254 | { |
254 | { |
255 | if (ench < 0) |
255 | if (ench < 0) ench = 0; |
256 | ench = 0; |
256 | if (ench > 20) ench = 20; |
257 | if (ench > 20) |
257 | |
258 | ench = 20; |
|
|
259 | return enc_to_item_power[ench]; |
258 | return enc_to_item_power[ench]; |
260 | } |
259 | } |
261 | |
260 | |
262 | /* This takes an object 'op' and figures out what its item_power |
261 | /* This takes an object 'op' and figures out what its item_power |
263 | * rating should be. This should only really be used by the treasure |
262 | * rating should be. This should only really be used by the treasure |
… | |
… | |
342 | enc += 1; |
341 | enc += 1; |
343 | if (QUERY_FLAG (op, FLAG_MAKE_INVIS)) |
342 | if (QUERY_FLAG (op, FLAG_MAKE_INVIS)) |
344 | enc += 1; |
343 | enc += 1; |
345 | |
344 | |
346 | return get_power_from_ench (enc); |
345 | return get_power_from_ench (enc); |
347 | |
|
|
348 | } |
346 | } |
349 | |
347 | |
350 | /* returns the typedata that has a number equal to itemtype, if there |
348 | /* returns the typedata that has a number equal to itemtype, if there |
351 | * isn't one, returns NULL */ |
349 | * isn't one, returns NULL */ |
352 | |
|
|
353 | const typedata * |
350 | const typedata * |
354 | get_typedata (int itemtype) |
351 | get_typedata (int itemtype) |
355 | { |
352 | { |
356 | int i; |
353 | int i; |
357 | |
354 | |
… | |
… | |
362 | } |
359 | } |
363 | |
360 | |
364 | /* returns the typedata that has a name equal to itemtype, if there |
361 | /* returns the typedata that has a name equal to itemtype, if there |
365 | * isn't one, return the plural name that matches, if there still isn't |
362 | * isn't one, return the plural name that matches, if there still isn't |
366 | * one return NULL */ |
363 | * one return NULL */ |
367 | |
|
|
368 | const typedata * |
364 | const typedata * |
369 | get_typedata_by_name (const char *name) |
365 | get_typedata_by_name (const char *name) |
370 | { |
366 | { |
371 | int i; |
367 | int i; |
372 | |
368 | |
… | |
… | |
509 | if ((val = get_attr_value (&(op->stats), attr)) != 0) |
505 | if ((val = get_attr_value (&(op->stats), attr)) != 0) |
510 | { |
506 | { |
511 | sprintf (buf + strlen (buf), "(%s%+d)", short_stat_name[attr], val); |
507 | sprintf (buf + strlen (buf), "(%s%+d)", short_stat_name[attr], val); |
512 | } |
508 | } |
513 | } |
509 | } |
|
|
510 | |
514 | if (op->stats.exp) |
511 | if (op->stats.exp) |
515 | sprintf (buf + strlen (buf), "(speed %+lld)", (long long) op->stats.exp); |
512 | sprintf (buf + strlen (buf), "(speed %+lld)", (long long) op->stats.exp); |
516 | if (op->stats.wc) |
513 | if (op->stats.wc) |
517 | sprintf (buf + strlen (buf), "(wc%+d)", op->stats.wc); |
514 | sprintf (buf + strlen (buf), "(wc%+d)", op->stats.wc); |
518 | if (op->stats.dam) |
515 | if (op->stats.dam) |
… | |
… | |
540 | strcat (buf, "(reflect spells)"); |
537 | strcat (buf, "(reflect spells)"); |
541 | if (QUERY_FLAG (op, FLAG_REFL_MISSILE)) |
538 | if (QUERY_FLAG (op, FLAG_REFL_MISSILE)) |
542 | strcat (buf, "(reflect missiles)"); |
539 | strcat (buf, "(reflect missiles)"); |
543 | if (QUERY_FLAG (op, FLAG_STEALTH)) |
540 | if (QUERY_FLAG (op, FLAG_STEALTH)) |
544 | strcat (buf, "(stealth)"); |
541 | strcat (buf, "(stealth)"); |
|
|
542 | |
545 | /* Shorten some of the names, so they appear better in the windows */ |
543 | /* Shorten some of the names, so they appear better in the windows */ |
546 | len = strlen (buf); |
544 | len = strlen (buf); |
547 | DESCRIBE_PATH_SAFE (buf, op->path_attuned, "Attuned", &len, VERY_BIG_BUF); |
545 | DESCRIBE_PATH_SAFE (buf, op->path_attuned, "Attuned", &len, VERY_BIG_BUF); |
548 | DESCRIBE_PATH_SAFE (buf, op->path_repelled, "Repelled", &len, VERY_BIG_BUF); |
546 | DESCRIBE_PATH_SAFE (buf, op->path_repelled, "Repelled", &len, VERY_BIG_BUF); |
549 | DESCRIBE_PATH_SAFE (buf, op->path_denied, "Denied", &len, VERY_BIG_BUF); |
547 | DESCRIBE_PATH_SAFE (buf, op->path_denied, "Denied", &len, VERY_BIG_BUF); |