1 /* omega copyright (C) by Laurence Raphael Brothers, 1987,1988,1989 */
2 /* guild2.c */
3 /* L_ functions  */
4 
5 /* These functions implement the various guilds. */
6 /* They are all l_ functions since they are basically activated*/
7 /* at some site or other. */
8 
9 #include "glob.h"
10 
11 
l_thieves_guild()12 void l_thieves_guild()
13 {
14   int fee,count,i,number,done=FALSE,dues=1000;
15   char c,action;
16   pob lockpick;
17   print1("You have penetrated to the Lair of the Thieves' Guild.");
18   if (! nighttime())
19     print2("There aren't any thieves around in the daytime.");
20   else {
21     if ((Player.rank[THIEVES]==TMASTER) &&
22 	(Player.level > Shadowlordlevel) &&
23 	find_and_remove_item(THINGID+16,-1)) {
24       print2("You nicked the Justiciar's Badge!");
25       morewait();
26       print1("The Badge is put in a place of honor in the Guild Hall.");
27       print2("You are now the Shadowlord of the Thieves' Guild!");
28       morewait();
29       print1("Who says there's no honor among thieves?");
30       strcpy(Shadowlord,Player.name);
31       Shadowlordlevel = Player.level;
32       morewait();
33       Shadowlordbehavior = fixnpc(4);
34       save_hiscore_npc(7);
35       clearmsg();
36       print1("You learn the Spell of Shadowform.");
37       Spells[S_SHADOWFORM].known = TRUE;
38       morewait();
39       clearmsg();
40       Player.rank[THIEVES]=SHADOWLORD;
41       Player.maxagi += 2;
42       Player.maxdex += 2;
43       Player.agi += 2;
44       Player.dex += 2;
45     }
46     while (! done) {
47       menuclear();
48       if (Player.rank[THIEVES] == 0)
49 	menuprint("a: Join the Thieves' Guild.\n");
50       else
51 	menuprint("b: Raise your Guild rank.\n");
52       menuprint("c: Get an item identified.\n");
53       if (Player.rank[THIEVES] > 0)
54 	menuprint("d: Fence an item.\n");
55       menuprint("ESCAPE: Leave this Den of Iniquity.");
56       showmenu();
57       action = mgetc();
58       if (action == ESCAPE) done = TRUE;
59       else if (action == 'a') {
60 	done = TRUE;
61 	if (Player.rank[THIEVES]> 0)
62 	  print2("You are already a member!");
63 	else if (Player.alignment > 10)
64 	  print2("You are too lawful to be a thief!");
65 	else {
66 	  dues += dues*(12-Player.dex)/9;
67 	  dues += Player.alignment*5;
68 	  dues = max(100,dues);
69 	  clearmsg();
70 	  mprint("Dues are");
71 	  mnumprint(dues);
72 	  mprint(" Au. Pay it? [yn] ");
73 	  if (ynq1() =='y') {
74 	    if (Player.cash < dues) {
75 	      print1("You can't cheat the Thieves' Guild!");
76 	      print2("... but the Thieves' Guild can cheat you....");
77 	      Player.cash = 0;
78 	    }
79 	    else {
80 	      print1("Shadowlord ");
81 	      nprint1(Shadowlord);
82 	      print2("enters your name into the roll of the Guild.");
83 	      morewait();
84 	      clearmsg();
85 	      print1("As a special bonus, you get a free lockpick.");
86 	      print2("You are taught the spell of Object Detection.");
87 	      morewait();
88 	      Spells[S_OBJ_DET].known = TRUE;
89 	      lockpick = ((pob) checkmalloc(sizeof(objtype)));
90 	      *lockpick = Objects[THINGID+2]; /* lock pick */
91 	      gain_item(lockpick);
92 	      Player.cash -= dues;
93 	      dataprint();
94 	      Player.guildxp[THIEVES]=1;
95 	      Player.rank[THIEVES]=TMEMBER;
96 	      Player.maxdex++;Player.dex++;Player.agi++;Player.maxagi++;
97 	    }
98 	  }
99 	}
100       }
101       else if (action == 'b') {
102 	if (Player.rank[THIEVES]==0)
103 	  print2("You are not even a member!");
104 	else if (Player.rank[THIEVES]==SHADOWLORD)
105 	  print2("You can't get any higher than this!");
106 	else if (Player.rank[THIEVES]==TMASTER) {
107 	  if (Player.level <= Shadowlordlevel)
108 	    print2("You are not experienced enough to advance.");
109 	  else print2("You must bring back the Justiciar's Badge!");
110 	}
111 	else if (Player.rank[THIEVES]==THIEF) {
112 	  if (Player.guildxp[THIEVES] < 4000)
113 	    print2("You are not experienced enough to advance.");
114 	  else  {
115 	    print1("You are now a Master Thief of the Guild!");
116 	    print2("You are taught the Spell of Apportation.");
117 	    morewait();
118 	    print1("To advance to the next level you must return with");
119 	    print2("the badge of the Justiciar (cursed be his name).");
120 	    morewait();
121 	    clearmsg();
122 	    print1("The Justiciar's office is just south of the gaol.");
123 	    Spells[S_APPORT].known = TRUE;
124 	    Player.rank[THIEVES]=TMASTER;
125 	    Player.maxagi++;
126 	    Player.maxdex++;
127 	    Player.agi++;
128 	    Player.dex++;
129 	  }
130 	}
131 	else if (Player.rank[THIEVES]==ATHIEF) {
132 	  if (Player.guildxp[THIEVES] < 1500)
133 	    print2("You are not experienced enough to advance.");
134 	  else  {
135 	    print1("You are now a ranking Thief of the Guild!");
136 	    print2("You learn the Spell of Invisibility.");
137 	    Spells[S_INVISIBLE].known = TRUE;
138 	    Player.rank[THIEVES]=THIEF;
139 	    Player.agi++;
140 	    Player.maxagi++;
141 	  }
142 	}
143 	else if (Player.rank[THIEVES]==TMEMBER) {
144 	  if (Player.guildxp[THIEVES] < 400)
145 	    print2("You are not experienced enough to advance.");
146 	  else {
147 	    print1("You are now an Apprentice Thief!");
148 	    print2("You are taught the Spell of Levitation.");
149 	    Spells[S_LEVITATE].known = TRUE;
150 	    Player.rank[THIEVES]=ATHIEF;
151 	    Player.dex++;
152 	    Player.maxdex++;
153 	  }
154 	}
155       }
156       else if (action == 'c') {
157 	if (Player.rank[THIEVES]==0) {
158 	  print1("RTG, Inc, Appraisers. Identification Fee: 50Au/item.");
159 	  fee = 50;
160 	}
161 	else {
162 	  fee = 5;
163 	  print1("The fee is 5Au per item.");
164 	}
165 	print2("Identify one item, or all possessions? [ip] ");
166 	if ((char) mcigetc()=='i') {
167 	  if (Player.cash < fee)
168 	    print2("Try again when you have the cash.");
169 	  else {
170 	    Player.cash -= fee;
171 	    dataprint();
172 	    identify(0);
173 	  }
174 	}
175 	else {
176 	  count = 0;
177 	  for(i=1;i<MAXITEMS;i++)
178 	    if (Player.possessions[i] != NULL)
179 	      if (Player.possessions[i]->known < 2)
180 		count++;
181 	  for(i=0;i<Player.packptr;i++)
182 	    if (Player.pack[i] != NULL)
183 	      if (Player.pack[i]->known < 2)
184 		count++;
185 	  clearmsg();
186 	  print1("The fee will be: ");
187 	  mnumprint(max(count*fee,fee));
188 	  nprint1("Au. Pay it? [yn] ");
189 	  if (ynq1()=='y')
190 	  if (Player.cash < max(count*fee,fee))
191 	    print2("Try again when you have the cash.");
192 	  else {
193 	    Player.cash -= max(count*fee,fee);
194 	    dataprint();
195 	    identify(1);
196 	  }
197 	}
198       }
199       else if (action == 'd') {
200 	if (Player.rank[THIEVES]==0)
201 	  print2("Fence? Who said anything about a fence?");
202 	else {
203 	  print1("Fence one item or go through pack? [ip] ");
204 	  if ((char) mcigetc()=='i') {
205 	    i = getitem(NULL_ITEM);
206 	    if ((i==ABORT) || (Player.possessions[i] == NULL))
207 	      print2("Huh, Is this some kind of set-up?");
208 	    else if (Player.possessions[i]->blessing < 0)
209 	      print2("I don't want to buy a cursed item!");
210 	    else {
211 	      clearmsg();
212 	      print1("I'll give you ");
213 	      mlongprint(2 * item_value(Player.possessions[i]) / 3);
214 	      nprint1("Au each. OK? [yn] ");
215 	      if (ynq1() == 'y') {
216 		number = getnumber(Player.possessions[i]->number);
217 		if ((number >= Player.possessions[i]->number) &&
218 		    Player.possessions[i]->used) {
219 		  Player.possessions[i]->used = FALSE;
220 		  item_use(Player.possessions[i]);
221 		}
222 		Player.cash += number*2*item_value(Player.possessions[i])/3;
223 		/* Fenced artifacts could turn up anywhere, really... */
224 		if (Objects[Player.possessions[i]->id].uniqueness >
225 		    UNIQUE_UNMADE)
226 		  Objects[Player.possessions[i]->id].uniqueness = UNIQUE_UNMADE;
227 		dispose_lost_objects(number,Player.possessions[i]);
228 		dataprint();
229 	      }
230 	      else print2("Hey, gimme a break, it was a fair price!");
231 	    }
232 	  }
233 	  else {
234 	    for(i=0;i<Player.packptr;i++) {
235 	      if (Player.pack[i]->blessing > -1) {
236 		clearmsg();
237 		print1("Sell ");
238 		nprint1(itemid(Player.pack[i]));
239 		nprint1(" for ");
240 		mlongprint(2*item_value(Player.pack[i])/3);
241 		nprint1("Au each? [ynq] ");
242 		if ((c=ynq1())=='y') {
243 		  number = getnumber(Player.pack[i]->number);
244 		  Player.cash += 2*number * item_value(Player.pack[i]) / 3;
245 		  Player.pack[i]->number -= number;
246 		  if (Player.pack[i]->number < 1) {
247                     /* Fenced an artifact?  You just might see it again. */
248  		    if (Objects[Player.pack[i]->id].uniqueness > UNIQUE_UNMADE)
249  		      Objects[Player.pack[i]->id].uniqueness = UNIQUE_UNMADE;
250 		    free((char *)Player.pack[i]);
251 		    Player.pack[i] = NULL;
252 		  }
253 		  dataprint();
254 		}
255 		else if (c=='q') break;
256 	      }
257 	    }
258 	    fixpack();
259 	  }
260 	}
261       }
262     }
263   }
264   xredraw();
265 }
266 
l_college()267 void l_college()
268 {
269   char action;
270   int done=FALSE,enrolled = FALSE;
271   print1("The Collegium Magii. Founded 16937, AOF.");
272   if (nighttime())
273     print2("The Registration desk is closed at night....");
274   else {
275     while (! done) {
276       if ((Player.rank[COLLEGE]==MAGE) &&
277 	  (Player.level > Archmagelevel) &&
278 	  find_and_remove_item(CORPSEID,EATER)) {
279 	print1("You brought back the heart of the Eater of Magic!");
280 	morewait();
281 	print1("The Heart is sent to the labs for analysis.");
282 	print2("The Board of Trustees appoints you Archmage!");
283 	morewait();
284 	clearmsg();
285 	strcpy(Archmage,Player.name);
286 	Archmagelevel = Player.level;
287 	Player.rank[COLLEGE] = ARCHMAGE;
288 	Player.maxiq += 5;
289 	Player.iq += 5;
290 	Player.maxpow += 5;
291 	Player.pow += 5;
292 	morewait();
293 	Archmagebehavior = fixnpc(4);
294 	save_hiscore_npc(9);
295       }
296       menuclear();
297       menuprint("May we help you?\n\n");
298       menuprint("a: Enroll in the College.\n");
299       menuprint("b: Raise your College rank.\n");
300       menuprint("c: Do spell research.\n");
301       menuprint("ESCAPE: Leave these hallowed halls.\n");
302       showmenu();
303       action = mgetc();
304       if (action == ESCAPE) done = TRUE;
305       else if (action == 'a') {
306 	if (Player.rank[COLLEGE] > 0)
307 	  print2("You are already enrolled!");
308 	else if (Player.iq < 13)
309 	  print2("Your low IQ renders you incapable of being educated.");
310 	else if (Player.rank[CIRCLE] > 0)
311 	  print2("Sorcery and our Magic are rather incompatable, no?");
312 	else {
313 	  if (Player.iq > 17) {
314 	    print2("You are given a scholarship!");
315 	    morewait();
316 	    enrolled=TRUE;
317 	  }
318 	  else {
319 	    print1("Tuition is 1000Au. ");
320 	    nprint1("Pay it? [yn] ");
321 	    if (ynq1() =='y') {
322 	      if (Player.cash < 1000)
323 		print2("You don't have the funds!");
324 	      else {
325 		Player.cash -= 1000;
326 		enrolled = TRUE;
327 		dataprint();
328 	      }
329 	    }
330 	  }
331 	  if (enrolled) {
332 	    print1("Archmage ");
333 	    nprint1(Archmage);
334 	    nprint1(" greets you and congratulates you on your acceptance.");
335 	    print2("You are now enrolled in the Collegium Magii!");
336 	    morewait();
337 	    print1("You are now a Novice.");
338 	    print2("You may research 1 spell, for your intro class.");
339 	    Spellsleft = 1;
340 	    Player.rank[COLLEGE] = INITIATE;
341 	    Player.guildxp[COLLEGE] = 1;
342 	    Player.maxiq += 1;
343 	    Player.iq += 1;
344 	    Player.maxpow += 1;
345 	    Player.pow += 1;
346 	  }
347 	}
348       }
349       else if (action == 'b') {
350 	if (Player.rank[COLLEGE] == 0)
351 	  print2("You have not even been initiated, yet!");
352 	else if (Player.rank[COLLEGE]==ARCHMAGE)
353 	  print2("You are at the pinnacle of mastery in the Collegium.");
354 	else if (Player.rank[COLLEGE]==MAGE) {
355 	  if (Player.level <= Archmagelevel)
356 	    print2("You are not experienced enough to advance.");
357 	  else
358 	    print2("You must return with the heart of the Eater of Magic!");
359 	}
360 	else if (Player.rank[COLLEGE]==PRECEPTOR) {
361 	  if (Player.guildxp[COLLEGE] < 4000)
362 	    print2("You are not experienced enough to advance.");
363 	  else  {
364 	    print1("You are now a Mage of the Collegium Magii!");
365 	    print2("You may research 6 spells for postdoctoral research.");
366 	    Spellsleft += 6;
367 	    morewait();
368 	    print1("To become Archmage, you must return with the");
369 	    print2("heart of the Eater of Magic");
370 	    morewait();
371 	    clearmsg();
372 	    print1("The Eater may be found on a desert isle somewhere.");
373 	    Player.rank[COLLEGE] = MAGE;
374 	    Player.maxiq += 2;
375 	    Player.iq += 2;
376 	    Player.maxpow += 2;
377 	    Player.pow += 2;
378 	  }
379 	}
380 	else if (Player.rank[COLLEGE]==STUDENT) {
381 	  if (Player.guildxp[COLLEGE] < 1500)
382 	    print2("You are not experienced enough to advance.");
383 	  else  {
384 	    print1("You are now a Preceptor of the Collegium Magii!");
385 	    print2("You are taught the basics of ritual magic.");
386 	    morewait();
387 	    clearmsg();
388 	    print1("Your position allows you to research 4 spells.");
389 	    Spellsleft +=4;
390 	    Spells[S_RITUAL].known = TRUE;
391 	    Player.rank[COLLEGE] = PRECEPTOR;
392 	    Player.maxiq += 1;
393 	    Player.iq += 1;
394 	    Player.maxpow += 1;
395 	    Player.pow += 1;
396 	  }
397 	}
398 	else if (Player.rank[COLLEGE]==NOVICE) {
399 	  if (Player.guildxp[COLLEGE] < 400)
400 	    print2("You are not experienced enough to advance.");
401 	  else  {
402 	    print1("You are now a Student at the Collegium Magii!");
403 	    print2("You are taught the spell of identification.");
404 	    morewait();
405 	    clearmsg();
406 	    print1("Thesis research credit is 2 spells.");
407 	    Spellsleft+=2;
408 	    Spells[S_IDENTIFY].known = TRUE;
409 	    Player.rank[COLLEGE] = STUDENT;
410 	    Player.maxiq += 1;
411 	    Player.iq += 1;
412 	    Player.maxpow += 1;
413 	    Player.pow += 1;
414 	  }
415 	}
416       }
417       else if (action == 'c') {
418 	clearmsg();
419 	if (Spellsleft > 0) {
420 	  print1("Research permitted: ");
421 	  mnumprint(Spellsleft);
422 	  nprint1(" Spells.");
423 	  morewait();
424 	}
425 	if (Spellsleft < 1) {
426 	  print1("Extracurricular Lab fee: 2000 Au. ");
427 	  nprint1("Pay it? [yn] ");
428 	  if (ynq1()=='y') {
429 	    if (Player.cash < 2000)
430 	      print1("Try again when you have the cash.");
431 	    else {
432 	      Player.cash -= 2000;
433 	      dataprint();
434 	      Spellsleft = 1;
435 	    }
436 	  }
437 	}
438 	if (Spellsleft > 0) {
439 	  learnspell(0);
440 	  Spellsleft--;
441 	}
442       }
443     }
444   }
445   xredraw();
446 }
447 
448 
449 
l_sorcerors()450 void l_sorcerors()
451 {
452   char action;
453   int done=FALSE,fee=3000;
454   long total;
455   print1("The Circle of Sorcerors.");
456   if (Player.rank[CIRCLE] == -1) {
457     print2("Fool! Didn't we tell you to go away?");
458     Player.mana = 0;
459     dataprint();
460   }
461   else  while (! done) {
462     if ((Player.rank[CIRCLE]==HIGHSORCEROR) &&
463 	(Player.level > Primelevel) &&
464 	find_and_remove_item(CORPSEID,LAWBRINGER)) {
465       print2("You obtained the Crown of the Lawgiver!");
466       morewait();
467       print1("The Crown is ritually sacrificed to the Lords of Chaos.");
468       print2("You are now the Prime Sorceror of the Inner Circle!");
469       strcpy(Prime,Player.name);
470       Primelevel = Player.level;
471       morewait();
472       Primebehavior = fixnpc(4);
473       save_hiscore_npc(10);
474       clearmsg();
475       print1("You learn the Spell of Disintegration!");
476       morewait();
477       clearmsg();
478       Spells[S_DISINTEGRATE].known = TRUE;
479       Player.rank[CIRCLE] = PRIME;
480       Player.maxpow += 10;
481       Player.pow += 10;
482     }
483     menuclear();
484     menuprint("May we help you?\n\n");
485     menuprint("a: Become an Initiate of the Circle.\n");
486     menuprint("b: Raise your rank in the Circle.\n");
487     menuprint("c: Restore mana points\n");
488     menuprint("ESCAPE: Leave these Chambers of Power.\n");
489     showmenu();
490     action = mgetc();
491     if (action == ESCAPE) done = TRUE;
492     else if (action == 'a') {
493       if (Player.rank[CIRCLE] > 0)
494 	  print2("You are already an initiate!");
495       else if (Player.alignment > 0)
496 	print2("You may not join -- you reek of Law!");
497       else if (Player.rank[COLLEGE] != 0)
498 	print2("Foolish Mage!  You don't have the right attitude to Power!");
499       else {
500 	fee += Player.alignment*100;
501 	fee += fee*(12 - Player.pow)/9;
502 	fee = max(100,fee);
503 	clearmsg();
504 	mprint("For you, there is an initiation fee of");
505 	mnumprint(fee);
506 	mprint(" Au.");
507 	print2("Pay it? [yn] ");
508 	if (ynq2() =='y') {
509 	  if (Player.cash < fee)
510 	    print3("Try again when you have the cash!");
511 	  else {
512 	    print1("Prime Sorceror ");
513 	    nprint1(Prime);
514 	    print2("conducts your initiation into the circle of novices.");
515 	    morewait();
516 	    clearmsg();
517 	    print1("You learn the Spell of Magic Missiles.");
518 	    Spells[S_MISSILE].known = TRUE;
519 	    Player.cash -= fee;
520 	    dataprint();
521 	    Player.rank[CIRCLE] = INITIATE;
522 	    Player.guildxp[CIRCLE] = 1;
523 	    Player.maxpow++;
524 	    Player.pow++;
525 	  }
526 	}
527       }
528     }
529     else if (action == 'b') {
530       if (Player.rank[CIRCLE] == 0)
531 	print2("You have not even been initiated, yet!");
532       else if (Player.alignment > -1) {
533 	print1("Ahh! You have grown too lawful!!!");
534 	print2("You are hereby blackballed from the Circle!");
535 	Player.rank[CIRCLE] = -1;
536 	morewait();
537 	clearmsg();
538 	print1("A pox upon thee!");
539 	if (! Player.immunity[INFECTION])
540 	  Player.status[DISEASED]+=100;
541 	print2("And a curse on your possessions!");
542 	morewait();
543 	clearmsg();
544 	acquire(-1);
545 	clearmsg();
546 	enchant(-1);
547 	bless(-1);
548 	print3("Die, false sorceror!");
549 	p_damage(25,UNSTOPPABLE,"a sorceror's curse");
550  	done = TRUE;
551       }
552       else if (Player.rank[CIRCLE]==PRIME)
553 	print2("You are at the pinnacle of mastery in the Circle.");
554       else if (Player.rank[CIRCLE]==HIGHSORCEROR) {
555 	if (Player.level <= Primelevel)
556 	  print2("You are not experienced enough to advance.");
557 	else
558 	  print2("You must return with the Crown of the LawBringer!");
559       }
560       else if (Player.rank[CIRCLE]==SORCEROR) {
561 	if (Player.guildxp[CIRCLE] < 4000)
562 	  print2("You are not experienced enough to advance.");
563 	else  {
564 	  print1("You are now a High Sorceror of the Inner Circle!");
565 	  print2("You learn the Spell of Disruption!");
566 	  morewait();
567 	  clearmsg();
568 	  print1("To advance you must return with the LawBringer's Crown!");
569 	  print2("The LawBringer resides on Star Peak.");
570 	  Spells[S_DISRUPT].known = TRUE;
571 	  Player.rank[CIRCLE] = HIGHSORCEROR;
572 	  Player.maxpow += 5;
573 	  Player.pow += 5;
574 	}
575       }
576       else if (Player.rank[CIRCLE]==ENCHANTER) {
577 	if (Player.guildxp[CIRCLE] < 1500)
578 	  print2("You are not experienced enough to advance.");
579 	else  {
580 	  print1("You are now a member of the Circle of Sorcerors!");
581 	  print2("You learn the Spell of Ball Lightning!");
582 	  Spells[S_LBALL].known = TRUE;
583 	  Player.rank[CIRCLE] = SORCEROR;
584 	  Player.maxpow += 2;
585 	  Player.pow+=2;
586 	}
587       }
588       else if (Player.rank[CIRCLE]==INITIATE) {
589 	if (Player.guildxp[CIRCLE] < 400)
590 	  print2("You are not experienced enough to advance.");
591 	else  {
592 	  print1("You are now a member of the Circle of Enchanters!");
593 	  print2("You learn the Spell of Firebolts.");
594 	  Spells[S_FIREBOLT].known = TRUE;
595 	  Player.rank[CIRCLE] = ENCHANTER;
596 	  Player.maxpow+=2;
597 	  Player.pow+=2;
598 	}
599       }
600     }
601     else if (action == 'c') {
602       done = TRUE;
603       fee = Player.level*100;
604       if (Player.rank[CIRCLE]) fee = fee / 2;
605       clearmsg();
606       print1("That will be: ");
607       mnumprint(fee);
608       nprint1("Au. Pay it? [yn] ");
609       if (ynq1()=='y') {
610 	if (Player.cash < fee)
611 	  print2("Begone, deadbeat, or face the wrath of the Circle!");
612 	else {
613 	  Player.cash -= fee;
614 	  total = calcmana();
615 	  while (Player.mana < total) {
616 	    Player.mana++;
617 	    dataprint();
618 	  }
619 	  print2("Have a sorcerous day, now!");
620 	}
621       }
622       else print2("Be seeing you!");
623     }
624   }
625   xredraw();
626 }
627 
628 
629 
630 
l_order()631 void l_order()
632 {
633   pob newitem;
634   pml ml;
635   print1("The Headquarters of the Order of Paladins.");
636   morewait();
637   if ((Player.rank[ORDER]==PALADIN) &&
638       (Player.level > Justiciarlevel) &&
639       gamestatusp(GAVE_STARGEM) &&
640       Player.alignment > 300) {
641     print1("You have succeeded in your quest!");
642     morewait();
643     print1("The previous Justiciar steps down in your favor.");
644     print2("You are now the Justiciar of Rampart and the Order!");
645     strcpy(Justiciar,Player.name);
646     for (ml = Level->mlist; ml && (ml->m->id != HISCORE_NPC ||
647 	ml->m->aux2 != 15); ml = ml->next)
648       /* just scan for current Justicar */;
649     if (ml) {
650       Level->site[ml->m->x][ml->m->y].creature = NULL;
651       erase_monster(ml->m);
652       ml->m->hp = -1; /* signals "death" -- no credit to player, though */
653     }
654     Justiciarlevel = Player.level;
655     morewait();
656     Justiciarbehavior = fixnpc(4);
657     save_hiscore_npc(15);
658     clearmsg();
659     print1("You are awarded a blessed shield of deflection!");
660     morewait();
661     newitem = ((pob) checkmalloc(sizeof(objtype)));
662     *newitem = Objects[SHIELDID+7]; /* shield of deflection */
663     newitem->blessing = 9;
664     gain_item(newitem);
665     morewait();
666     Player.rank[ORDER] = JUSTICIAR;
667     Player.maxstr += 5;
668     Player.str += 5;
669     Player.maxpow += 5;
670     Player.pow += 5;
671   }
672   if (Player.alignment < 1) {
673     if (Player.rank[ORDER] > 0) {
674       print1("You have been tainted by chaos!");
675       print2("You are stripped of your rank in the Order!");
676       morewait();
677       Player.rank[ORDER]= -1;
678       send_to_jail();
679     }
680     else
681       print1("Get thee hence, minion of chaos!");
682   }
683   else if (Player.rank[ORDER] == -1)
684     print1("Thee again?  Get thee hence, minion of chaos!");
685   else if (Player.rank[ORDER] == 0) {
686     if (Player.rank[ARENA] != 0)
687       print1("We do not accept bloodstained gladiators into our Order.");
688     else if (Player.rank[LEGION] != 0)
689       print1("Go back to your barracks, mercenary!");
690     else {
691       print1("Dost thou wish to join our Order? [yn] ");
692       if (ynq1()=='y') {
693 	print1("Justiciar ");
694 	nprint1(Justiciar);
695 	nprint1(" welcomes you to the Order.");
696 	print2("'Mayest thou always follow the sublime path of Law.'");
697 	morewait();
698 	print1("You are now a Gallant in the Order.");
699 	print2("You are given a horse and a blessed spear.");
700 	morewait();
701 	Player.rank[ORDER] = GALLANT;
702 	Player.guildxp[ORDER] = 1;
703 	setgamestatus(MOUNTED);
704 	newitem = ((pob) checkmalloc(sizeof(objtype)));
705 	*newitem = Objects[WEAPONID+19]; /* spear */
706 	newitem->blessing = 9;
707 	newitem->plus = 1;
708 	newitem->known = 2;
709 	gain_item(newitem);
710       }
711     }
712   } else {
713       print1("'Welcome back, Paladin.'");
714       if (!gamestatusp(MOUNTED)) {
715 	print2("You are given a new steed.");
716 	setgamestatus(MOUNTED);
717       }
718       morewait();
719       clearmsg();
720       if ((Player.hp < Player.maxhp) || (Player.status[DISEASED]) ||
721 	(Player.status[POISONED]))
722 	print1("Your wounds are treated by a medic.");
723       cleanse(0);
724       Player.hp = Player.maxhp;
725       Player.food = 40;
726       print2("You get a hot meal from the refectory.");
727       morewait();
728       clearmsg();
729       if (Player.rank[ORDER]==PALADIN) {
730 	if (Player.level <= Justiciarlevel)
731 	  print2("You are not experienced enough to advance.");
732 	else if (Player.alignment < 300)
733 	  print2("You are not sufficiently Lawful as yet to advance.");
734 	else print2("You must give the Star Gem to the LawBringer.");
735       }
736       else if (Player.rank[ORDER]==CHEVALIER) {
737 	if (Player.guildxp[ORDER] < 4000)
738 	  print2("You are not experienced enough to advance.");
739 	else if (Player.alignment < 200)
740 	  print2("You are not sufficiently Lawful as yet to advance.");
741 	else {
742 	  print1("You are made a Paladin of the Order!");
743 	  print2("You learn the Spell of Heroism and get Mithril Plate!");
744 	  morewait();
745 	  newitem = ((pob) checkmalloc(sizeof(objtype)));
746 	  *newitem = Objects[ARMORID+11]; /* mithril plate armor */
747 	  newitem->blessing = 9;
748 	  newitem->known = 2;
749 	  gain_item(newitem);
750 	  morewait();
751 	  clearmsg();
752 	  print1("To advance you must rescue the Star Gem and return it");
753 	  print2("to its owner, the LawBringer, who resides on Star Peak.");
754 	  morewait();
755 	  print1("The Star Gem was stolen by the cursed Prime Sorceror,");
756 	  print2("whose headquarters may be found beyond the Astral Plane.");
757 	  morewait();
758 	  print1("The Oracle will send you to the Astral Plane if you");
759 	  print2("prove yourself worthy to her.");
760 	  morewait();
761 	  Spells[S_HERO].known = TRUE;
762 	  Player.rank[ORDER] = PALADIN;
763 	}
764       }
765       else if (Player.rank[ORDER]==GUARDIAN) {
766 	if (Player.guildxp[ORDER] < 1500)
767 	  print2("You are not experienced enough to advance.");
768 	else if (Player.alignment < 125)
769 	  print2("You are not yet sufficiently Lawful to advance.");
770 	else {
771 	  Player.rank[ORDER] = CHEVALIER;
772 	  print1("You are made a Chevalier of the Order!");
773 	  print2("You are given a Mace of Disruption!");
774 	  morewait();
775 	  clearmsg();
776 	  newitem = ((pob) checkmalloc(sizeof(objtype)));
777 	  *newitem = Objects[WEAPONID+25]; /* mace of disruption */
778 	  newitem->known = 2;
779 	  gain_item(newitem);
780 	}
781       }
782       else if (Player.rank[ORDER]==GALLANT) {
783 	if (Player.guildxp[ORDER] < 400)
784 	  print2("You are not experienced enough to advance.");
785 	else if (Player.alignment < 50)
786 	  print2("You are not Lawful enough to advance.");
787 	else  {
788 	  print1("You are made a Guardian of the Order of Paladins!");
789 	  print2("You are given a Holy Hand Grenade (of Antioch).");
790 	  morewait();
791 	  print1("You hear a nasal monotone in the distance....");
792 	  print2("'...and the number of thy counting shall be 3...'");
793 	  morewait();
794 	  clearmsg();
795 	  Player.rank[ORDER] = GUARDIAN;
796 	  newitem = ((pob) checkmalloc(sizeof(objtype)));
797 	  *newitem = Objects[ARTIFACTID+7]; /* holy hand grenade. */
798 	  newitem->known = 2;
799 	  gain_item(newitem);
800 	}
801       }
802   }
803 }
804