blob: aad2938c60fd97851ab11682af804c1bd2d79479 [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001// MorgenGrauen MUDlib
2//
3// weapon/description.c -- weapon description handling
4//
5// $Id: description.c 6475 2007-09-19 20:56:40Z Zesstra $
6
7#pragma strict_types
8#pragma save_types
9#pragma no_clone
10#pragma pedantic
11#pragma range_check
12
13//#define NEED_PROTOTYPES
14
15#include <thing/properties.h>
16#include <thing/description.h>
17#include <properties.h>
18#include <combat.h>
19#include <thing/material.h>
20
21inherit "/std/thing/description";
22
23void create()
24{
25 ::create();
26 SetProp(P_DAM_DESC,DFLT_DAM_DESC);
27}
28
29string dam_descr()
30{ string re;
31 mixed desc;
32 int max,dam,pos;
33
34 if (!QueryProp(P_NAME) || !QueryProp(P_DAMAGED) || !QueryProp(P_SHORT) ||
35 !(desc=QueryProp(P_DAM_DESC)) || (!stringp(desc) && !pointerp(desc)))
36 return "";
37 re = capitalize(name(WER,2))+" ";
38 max = QueryProp(P_WC)+(dam=QueryProp(P_DAMAGED));
39 // Bei reinen Parierwaffen den AC als max nehmen!
40 if (QueryProp(P_PARRY)==PARRY_ONLY)
41 {
42 max=QueryProp(P_AC)+dam;
43 }
44 if (stringp(desc))
45 return (dam>(max/2))?(re+desc+".\n"):"";
46 pos = (sizeof(desc)*dam/max);
47 // Sonst koennen Parierwaffen, die Schrott sind, buggen
48 if (pos==sizeof(desc)) pos--;
49 if (stringp(desc[pos]))
50 return (re+desc[pos]+".\n");
51 return "";
52}
53
54string short()
55{ string s;
56
57 if (!(s=QueryProp(P_SHORT)))
58 return 0;
59 return s + (QueryProp(P_WIELDED)?" (gezueckt).\n":".\n");
60}
61
62varargs string long()
63{
64 return (process_string(QueryProp(P_LONG)||"") + (dam_descr()||""));
65}
66
67mixed _query_size() {
68 mixed res, wt;
69 if (intp(res=Query(P_SIZE)) && (res>0))
70 return res;
71 wt=QueryProp(P_WEAPON_TYPE);
72 switch (wt) {
73 case WT_SWORD : return 100; // default: Langschwert
74 case WT_AXE : return 80;
75 case WT_CLUB : return 80;
76 case WT_SPEAR : return 180;
77 case WT_KNIFE : return 20;
78 case WT_WHIP : return 200;
79 case WT_STAFF : return 150;
80 }
81 return 10; // alles andere
82}
83
84mapping _query_material() {
85 mixed res,wt;
86
87 if (mappingp(res=Query(P_MATERIAL)))
88 return res;
89 wt=QueryProp(P_WEAPON_TYPE);
90 switch(wt) {
91 case WT_SWORD:
92 return ([MAT_MISC_METAL:100]);
93 case WT_KNIFE:
94 return ([MAT_MISC_METAL:80,MAT_MISC_WOOD:20]);
95 case WT_AXE:
96 return ([MAT_MISC_METAL:50,MAT_MISC_WOOD:50]);
97 case WT_SPEAR:
98 return ([MAT_MISC_METAL:20,MAT_MISC_WOOD:80]);
99 case WT_STAFF:
100 case WT_CLUB:
101 return ([MAT_MISC_WOOD:100]);
102 }
103 return ([MAT_MISC_METAL:100]);
104}
105
106// P_BALANCED_WEAPON und P_TECHNIQUE sind mangels umgesetztem Konzept durch
107// EM-Beschluss fuer obsolet erklaert worden. Zesstra. 26.06.2007
108