MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame^] | 1 | // MorgenGrauen MUDlib |
| 2 | // |
| 3 | // armour/container_description.c -- armour_container description handling |
| 4 | // |
| 5 | // $Id: container_description.c 6306 2007-05-20 11:32:03Z Zesstra $ |
| 6 | |
| 7 | #pragma strict_types |
| 8 | #pragma save_types |
| 9 | #pragma pedantic |
| 10 | #pragma range_check |
| 11 | #pragma no_clone |
| 12 | |
| 13 | inherit "/std/clothing/container_description"; |
| 14 | |
| 15 | #define NEED_PROTOTYPES |
| 16 | |
| 17 | #include <thing/properties.h> |
| 18 | #include <thing/description.h> |
| 19 | #include <thing/language.h> |
| 20 | #include <container.h> |
| 21 | #include <combat.h> |
| 22 | #include <thing/material.h> |
| 23 | #include <defines.h> |
| 24 | #include <wizlevels.h> |
| 25 | #include <player/base.h> |
| 26 | |
| 27 | string dam_descr() { |
| 28 | string re; |
| 29 | mixed desc; |
| 30 | int maximum,dam,pos; |
| 31 | |
| 32 | if (!QueryProp(P_NAME) || !QueryProp(P_DAMAGED) || !QueryProp(P_SHORT) || |
| 33 | !(desc=QueryProp(P_DAM_DESC)) || (!stringp(desc) && !pointerp(desc))) |
| 34 | return ""; |
| 35 | re = capitalize(name(WER,2))+" "; |
| 36 | maximum = QueryProp(P_AC)+(dam=QueryProp(P_DAMAGED)); |
| 37 | if (stringp(desc)) |
| 38 | return (dam>(maximum/2))?(re+desc+".\n"):""; |
| 39 | pos = (sizeof(desc)*dam/maximum); |
| 40 | if (stringp(desc[pos])) |
| 41 | return (re+desc[pos]+".\n"); |
| 42 | return ""; |
| 43 | } |
| 44 | |
| 45 | mapping _query_material() { |
| 46 | mixed res,at; |
| 47 | |
| 48 | if (mappingp(res=Query(P_MATERIAL))) |
| 49 | return res; |
| 50 | at=QueryProp(P_ARMOUR_TYPE); |
| 51 | switch(at) { |
| 52 | case AT_ARMOUR: |
| 53 | case AT_HELMET: |
| 54 | case AT_RING: |
| 55 | case AT_AMULET: |
| 56 | case AT_SHIELD: |
| 57 | return ([MAT_MISC_METAL:100]); |
| 58 | case AT_CLOAK: |
| 59 | case AT_TROUSERS: |
| 60 | return ([MAT_CLOTH:100]); |
| 61 | case AT_GLOVE: |
| 62 | case AT_BOOT: |
| 63 | return ([MAT_LEATHER:100]); |
| 64 | } |
| 65 | return ([MAT_LEATHER:100]); |
| 66 | } |
| 67 | |