blob: 45e37fb14660d0fbd65786c21b8bdab5123dbfc3 [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001// MorgenGrauen MUDlib
2//
3// shells/darkelf.c -- Darkelf Shell
4//
5// $Id: darkelf.c 8675 2014-02-18 20:39:54Z Zesstra $
6
7#pragma strong_types,save_types
8
9inherit "/std/player/base";
10
11#include <properties.h>
12#include <attributes.h>
13#include <wizlevels.h>
14#include <health.h>
15#include <new_skills.h>
16#include <language.h>
17#include <defines.h>
18#include <combat.h>
19#include <defuel.h>
20#include <errord.h>
21
22
23protected void create()
24{
25 if (!clonep() || object_name(this_object()) == __FILE__[0..<3]) {
26 set_next_reset(-1);
27 return;
28 }
29 base::create();
30 SetDefaultHome("/gilden/dunkelelfen");
31 SetDefaultPrayRoom("/d/unterwelt/cadra/room/town/templemain");
32 SetProp(P_AVERAGE_SIZE,175);
33 SetProp(P_AVERAGE_WEIGHT,70000);
34 SetProp(P_ALIGN, -500);
35 SetProp(P_SKILL_ATTRIBUTE_OFFSETS,([SA_ENEMY_SAVE:110]));
36 SetProp(P_ATTRIBUTES_OFFSETS,([A_INT:4,A_DEX:2]));
37 SetProp(P_MATERIAL_KNOWLEDGE,([MATGROUP_UNHOLY: 100,
38 MATGROUP_MAGIC: 70,
39 MATGROUP_DEAD: 50,
40 MATGROUP_METAL: 30]) );
41 SetProp(P_RESISTANCE_STRENGTHS,
42 ([ DT_HOLY : 0.25,
43 DT_UNHOLY : -0.15,
44 DT_TERROR : -0.05 ]));
45 SetProp(P_MAX_FOOD,80);
46 SetProp(P_MAX_DRINK,150);
47 SetProp(P_MAX_ALCOHOL,70);
48
49 SetProp(P_SP_DELAY, HEAL_DELAY-2); // dafuer regeneriert man im freien
50 SetProp(P_HP_DELAY, HEAL_DELAY-1); // wirklich _nichts_
51 SetProp(P_FOOD_DELAY,FOOD_DELAY+1);
52 SetProp(P_DRINK_DELAY,DRINK_DELAY-2);
53 SetProp(P_ALCOHOL_DELAY,ALCOHOL_DELAY+1);
54
55 SetProp(P_MAGIC_RESISTANCE_OFFSET,
56 ([ MT_ILLUSION : 200,
57 MT_ANGRIFF : 500,
58 MT_BEHERRSCHUNG: 500,
59 MT_PSYCHO : 800 ]));
60
61 /* Groesse wird nur einmal gesetzt */
62 if(!QueryProp(P_SIZE)) {
63 SetProp(P_SIZE,150+random(50));
64 Set(P_SIZE,SAVE,F_MODE_AS);
65 }
66
67 /* Dito Gewicht */
68 if(!QueryProp(P_WEIGHT) || (QueryProp(P_WEIGHT) == 75000)){
69 SetProp(P_WEIGHT,60000+random(20001));
70 if(QueryProp(P_GENDER)==FEMALE)
71 SetProp(P_WEIGHT,QueryProp(P_WEIGHT)-5000);
72 Set(P_WEIGHT,SAVE,F_MODE_AS);
73 }
74 SetProp(P_DEFUEL_LIMIT_FOOD,40);
75 SetProp(P_DEFUEL_LIMIT_DRINK,30);
76 SetProp(P_DEFUEL_TIME_FOOD,400);
77 SetProp(P_DEFUEL_TIME_DRINK,250);
78 SetProp(P_DEFUEL_AMOUNT_FOOD,0.45);
79 SetProp(P_DEFUEL_AMOUNT_DRINK,0.4);
80}
81
82static void FinalSetup()
83{
84 if (!QuerySkill(SK_NIGHTVISION))
85 ModifySkill(SK_NIGHTVISION, 5000, 0, "ANY");
86}
87
88string _query_race()
89// nicht static, da sie manchmal auch so aufgerufen wird...
90{
91 return "Dunkelelf";
92}
93
94string _query_real_race()
95{
96 return "Dunkelelf";
97}
98
99static string _query_racedescr()
100{
101 return
102"\
103Das Volk der Dunkelelfen lebt in einer grossen Hoehlenstadt gut versteckt\n\
104hinter einem Wasserfall. Ueber kaum ein anderes Volk gibt es soviele\n\
105Vorurteile wie ueber die Dunkelelfen, und so werden sie von allen misstrauisch\n\
106beaeugt oder sogar bekaempft. In diesem Kampf, insbesondere gegen die Elfen,\n\
107sind sie voellig auf sich allein gestellt, und so hat sich eine mehr oder\n\
108minder autarke Gesellschaft entwickelt. Die Dunkelelfen haben eine eigene\n\
109Kultur und eine eigene Goettin, der sie huldigen. Wie auch die Elfen\n\
110verfuegen sie ueber ausserordenlich grosse magische Faehigkeiten, auch wenn\n\
111sie sich mehr auf die schwarze Seite der Magie spezialisiert haben.\n";
112}
113
114// int QueryAllowSelect() { return 0; }
115// Aktiviert am 28.07.03, Ark.
116int QueryAllowSelect() { return 1; }
117
118string *_query_racestring()
119{
120 if (QueryProp(P_GENDER)==2)
121 return ({"Dunkelelfe","Dunkelelfe","Dunkelelfe","Dunkelelfe"});
122 return ({"Dunkelelf","Dunkelelfen","Dunkelelf","Dunkelelf"});
123}
124
125static string _query_default_guild()
126{
127 return "dunkelelfen";
128}
129
130static int sun_in_room(object room)
131{
132 if (!room) return 0;
133 closure qp=symbol_function("QueryProp", room);
134 int lt=funcall(qp, P_LIGHT_TYPE);
135 // (lt & LT_SUN) ist hier zunaechst _testweise_ drin. Die Rasse wurde
136 // anders genehmigt. Sollte das im MG ueberhand nehmen und jeder Keller
137 // nun sonnendurchflutet sein, dann wird das wieder ausgebaut!
138 // 27.06.04 Padreic
139 return ( (funcall(qp, P_INT_LIGHT)>0) &&
140 ((lt & LT_SUN) || ((lt==LT_MISC) && !funcall(qp, P_INDOORS))));
141}
142
143protected void heart_beat()
144{
145 ::heart_beat();
146 if (sun_in_room(environment()) &&
147 QueryProp("Dunkelelfen:Outdoor")<random(100) && !QueryProp(P_GHOST)) {
148 int hp;
149 hp=QueryProp(P_HP)-1;
150 SetProp(P_HP, hp);
151 if (hp<0) {
152 tell_object(ME,
153 "Das war wohl zuviel fuer Dich. Das naechste mal solltest Du Dich "
154 +"wohl besser\ngegen die Sonne schuetzen.\n");
155 SetProp(P_KILL_NAME,"Zuviel Sonne");
156 do_damage(999,ME);
157 SetProp(P_KILL_NAME,0);
158 }
159 else tell_object(ME, /* die Info musste irgendwie in eine Zeile */
160 "Die Sonne scheint gnadenlos auf Dein Haupt und schwaecht Dich.\n");
161 }
162}
163
164static int _query_no_regeneration()
165{
166 if (sun_in_room(environment()))
167 return NO_REG;
168 return Query(P_NO_REGENERATION);
169}
170
171int StdSkill_Nightvision(object me, string sname, mixed sinfo)
172{
173 int last, light;
174
175 if (!sinfo || !environment()) return 0;
176 if (intp(sinfo)) sinfo=([SI_SKILLABILITY:sinfo]);
177 if (!mappingp(sinfo)) return 0;
178 light=(QueryProp(P_PLAYER_LIGHT)<=0 ? -1 : 1);
179 if (last=sinfo[SI_USR]) { // letztes Lichtlevel != 0
180 if (light==last) {
181 if (sinfo[SI_LASTLIGHT]<=time())
182 return sinfo[SI_SKILLABILITY]+1;
183 return -1;
184 }
185 else {
186 last=( MAX_ABILITY - sinfo[SI_SKILLABILITY] );
187 last=(last/1000) + (last%1000 > random(1001) ? 1 : 0);
188 if (light<0) last/=2; // an Dunkelkeit schneller gewoehnen...
189 if(!this_interactive() || this_interactive()==this_object())
190 {
191 ModifySkill(sname, ([SI_USR: light, SI_LASTLIGHT: time()+last]),
192 0, sinfo[SI_GUILD]);
193 }
194 if (last<=0)
195 return sinfo[SI_SKILLABILITY]+1;
196 return -1;
197 }
198 }
199 else { // Startwert...
200 if(!this_interactive() || this_interactive()==this_object())
201 {
202 ModifySkill(sname, ([SI_USR: light, SI_LASTLIGHT: 0]), 0, sinfo[SI_GUILD]);
203 }
204 return sinfo[SI_SKILLABILITY]+1;
205 }
206 return 0;
207}
208
209varargs int CannotSee(int silent)
210{
211 string is_blind;
212
213 if ( is_blind = QueryProp( P_BLIND ) ) {
214 if (!silent) {
215 if (stringp(is_blind)) write(is_blind);
216 else write("Du bist blind!\n");
217 }
218 return 1;
219 }
220 if (environment() && (!IS_LEARNER(ME) || !Query(P_WANTS_TO_LEARN))) {
221 if (QueryProp(P_GHOST)) {
222 if (StdSkill_Nightvision(ME, SK_NIGHTVISION, QuerySkill(SK_NIGHTVISION))>0)
223 return 0;
224 }
225 else if (UseSkill(SK_NIGHTVISION)>0) return 0;
226 if (!silent) {
227 if (QueryProp(P_PLAYER_LIGHT)<=0)
228 write("Du kannst nichts sehen, da sich Deine Augen noch nicht an die Dunkelheit\n"
229 +"gewoehnt haben!\n");
230 else write("Du bist von dem hellen Licht total geblendet und Du musst Dich erst langsam\n"
231 +"daran gewoehnen.\n");
232 }
233 return 1;
234 }
235 return 0;
236}
237
238
239/*
240 * 2003-11-05, Zook:
241 *
242 * Temporaere Funktion, die den Delfen es ermoeglicht, einen
243 * moeglicherweise falschen Raum (Indoor/Outdoor) zu melden.
244 *
245 */
246
247static int _indoorbug(string key)
248{
249 if (!stringp(key))
250 key= "";
251
252 ERRORD->LogReportedError(
253 ([ F_PROG: "unbekannt",
254 F_LINE: 0,
255 F_MSG: "Sonnenfehler: " + key,
256 F_OBJ: environment(this_object())
257 ])
258 );
259
260 write("Du hast einen fehlerhaften Innen-/Aussen-/Sonnenlichtraum gemeldet.\n");
261
262 return 1;
263}
264
265static mixed _query_localcmds()
266{
267 return ({ ({"sonnenfehler", "_indoorbug", 0, 0 }) })
268 + base::_query_localcmds();
269}
270