ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/gods.C
(Generate patch)

Comparing deliantra/server/server/gods.C (file contents):
Revision 1.50 by root, Fri Nov 6 12:27:06 2009 UTC vs.
Revision 1.65 by root, Thu Jun 10 06:03:18 2010 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992,2007 Frank Tore Johansen 6 * Copyright (©) 1992 Frank Tore Johansen
7 * 7 *
8 * Deliantra is free software: you can redistribute it and/or modify it under 8 * Deliantra is free software: you can redistribute it and/or modify it under
9 * the terms of the Affero GNU General Public License as published by the 9 * the terms of the Affero GNU General Public License as published by the
10 * Free Software Foundation, either version 3 of the License, or (at your 10 * Free Software Foundation, either version 3 of the License, or (at your
11 * option) any later version. 11 * option) any later version.
36#include <sproto.h> 36#include <sproto.h>
37 37
38/** 38/**
39 * Returns the id of specified god. 39 * Returns the id of specified god.
40 */ 40 */
41int 41static int
42lookup_god_by_name (shstr_cmp name) 42lookup_god_by_name (shstr_cmp name)
43{ 43{
44 if (name) 44 if (name)
45 for (godlink *gl = first_god; gl; gl = gl->next) 45 for (godlink *gl = first_god; gl; gl = gl->next)
46 if (gl->name == name) 46 if (gl->name == name)
214 return 0; 214 return 0;
215 215
216 if (follower_has_similar_item (op, tr->item)) 216 if (follower_has_similar_item (op, tr->item))
217 return 0; 217 return 0;
218 218
219 object *tmp = arch_to_object (tr->item); 219 object *tmp = tr->item->instance ();
220 new_draw_info_format (NDI_UNIQUE, 0, op, "%s lets %s appear in your hands.", &god->name, query_short_name (tmp)); 220 new_draw_info_format (NDI_UNIQUE, 0, op, "%s lets %s appear in your hands.", &god->name, query_short_name (tmp));
221 op->insert (tmp); 221 op->insert (tmp);
222 222
223 return 1; 223 return 1;
224} 224}
242 next_tmp = tmp->below; 242 next_tmp = tmp->below;
243 243
244 /* we mark special prayers with the STARTEQUIP flag, so if it isn't 244 /* we mark special prayers with the STARTEQUIP flag, so if it isn't
245 * in that category, not something we need to worry about. 245 * in that category, not something we need to worry about.
246 */ 246 */
247 if (tmp->type != SPELL || !QUERY_FLAG (tmp, FLAG_STARTEQUIP)) 247 if (tmp->type != SPELL || !tmp->flag [FLAG_STARTEQUIP])
248 continue; 248 continue;
249 249
250 if (god->randomitems == NULL) 250 if (god->randomitems == NULL)
251 { 251 {
252 LOG (llevError, "BUG: check_special_prayers(): god %s without randomitems\n", &god->name); 252 LOG (llevError, "BUG: check_special_prayers(): god %s without randomitems\n", &god->name);
282} 282}
283 283
284/** 284/**
285 * Unapplies up to number worth of items of type 285 * Unapplies up to number worth of items of type
286 */ 286 */
287void 287static void
288stop_using_item (object *op, int type, int number) 288stop_using_item (object *op, int type, int number)
289{ 289{
290 object *tmp;
291
292 for (tmp = op->inv; tmp && number; tmp = tmp->below) 290 for (object *tmp = op->inv; tmp && number; tmp = tmp->below)
293 if (tmp->type == type && QUERY_FLAG (tmp, FLAG_APPLIED)) 291 if (tmp->type == type && tmp->flag [FLAG_APPLIED])
294 { 292 {
295 apply_special (op, tmp, AP_UNAPPLY | AP_IGNORE_CURSE); 293 op->apply (tmp, AP_UNAPPLY | AP_IGNORE_CURSE);
296 number--; 294 --number;
297 } 295 }
298} 296}
299 297
300/** 298/**
301 * If the god does/doesnt have this flag, we 299 * If the god does/doesnt have this flag, we
302 * give/remove it from the experience object if it doesnt/does 300 * give/remove it from the experience object if it doesnt/does
303 * already exist. For players only! 301 * already exist. For players only!
304 */ 302 */
305static void 303static inline void
306update_priest_flag (object *god, object *exp_ob, uint32 flag) 304update_priest_flag (object *god, object *exp_ob, uint32 flag)
307{ 305{
308 if (QUERY_FLAG (god, flag) && !QUERY_FLAG (exp_ob, flag)) 306 exp_ob->flag [flag] = god->flag [flag];
309 SET_FLAG (exp_ob, flag); 307 return;
310 else if (QUERY_FLAG (exp_ob, flag) && !QUERY_FLAG (god, flag)) 308
309 // old code follows for reference...
310 if (god->flag [flag] && !exp_ob->flag [flag])
311 exp_ob->set_flag (flag);
312 else if (exp_ob->flag [flag] && !god->flag [flag])
311 { 313 {
312 /* When this is called with the exp_ob set to the player, 314 /* When this is called with the exp_ob set to the player,
313 * this check is broken, because most all players arch 315 * this check is broken, because most all players arch
314 * allow use of weapons. I'm not actually sure why this 316 * allow use of weapons. I'm not actually sure why this
315 * check is here - I guess if you had a case where the 317 * check is here - I guess if you had a case where the
316 * value in the archetype (wisdom) should over ride the restrictions 318 * value in the archetype (wisdom) should over ride the restrictions
317 * the god places on it, this may make sense. But I don't think 319 * the god places on it, this may make sense. But I don't think
318 * there is any case like that. 320 * there is any case like that.
319 */ 321 */
320
321/* if (!(QUERY_FLAG(&(exp_ob->arch->clone),flag)))*/ 322/* if (!(QUERY_FLAG(&(exp_ob->arch->clone),flag)))*/
322 CLEAR_FLAG (exp_ob, flag); 323 exp_ob->clr_flag (flag);
323 }; 324 };
324} 325}
325 326
326/** 327/**
327 * Forbids or let player use something item type. 328 * Forbids or let player use something item type.
331 * string is the string to print out. 332 * string is the string to print out.
332 */ 333 */
333static int 334static int
334worship_forbids_use (object *op, object *exp_obj, uint32 flag, const char *string) 335worship_forbids_use (object *op, object *exp_obj, uint32 flag, const char *string)
335{ 336{
336 if (QUERY_FLAG (op->arch, flag)) 337 if (op->arch->flag [flag])
337 if (QUERY_FLAG (op, flag) != QUERY_FLAG (exp_obj, flag)) 338 if (op->flag [flag] != exp_obj->flag [flag])
338 { 339 {
339 update_priest_flag (exp_obj, op, flag); 340 update_priest_flag (exp_obj, op, flag);
340 if (QUERY_FLAG (op, flag)) 341 if (op->flag [flag])
341 new_draw_info_format (NDI_UNIQUE, 0, op, "You may use %s again.", string); 342 new_draw_info_format (NDI_UNIQUE, 0, op, "You may use %s again.", string);
342 else 343 else
343 { 344 {
344 new_draw_info_format (NDI_UNIQUE, 0, op, "You are forbidden to use %s.", string); 345 new_draw_info_format (NDI_UNIQUE, 0, op, "You are forbidden to use %s.", string);
345 return 1; 346 return 1;
354 * switched to a new god. It handles basically all the stat changes 355 * switched to a new god. It handles basically all the stat changes
355 * that happen to the player, including the removal of godgiven 356 * that happen to the player, including the removal of godgiven
356 * items (from the former cult). 357 * items (from the former cult).
357 */ 358 */
358void 359void
359become_follower (object *op, object *new_god) 360object::become_follower (object *new_god)
360{ 361{
361 object *old_god = NULL; /* old god */ 362 object *old_god = 0; /* old god */
362 treasure *tr; 363 treasure *tr;
363 object *item, *skop, *next; 364 object *item, *skop, *next;
364 int i, sk_applied, undeadified = 0; /* Turns to true if changing god can changes the undead status of the player. */ 365 int i, sk_applied, undeadified = 0; /* Turns to true if changing god can changes the undead status of the player. */
365 366
367 if (!contr)
368 return;
369
370 contr->queue_stats_update ();
371
366 old_god = find_god (determine_god (op)); 372 old_god = find_god (determine_god (this));
367 373
368 /* take away any special god-characteristic items. */ 374 /* take away any special god-characteristic items. */
369 for (item = op->inv; item; item = next) 375 for (item = inv; item; item = next)
370 { 376 {
371 next = item->below; 377 next = item->below;
372 378
373 // remove all invisible startequip items which are not skill, exp or force 379 // remove all invisible startequip items which are not skill, exp or force
374 if (QUERY_FLAG (item, FLAG_STARTEQUIP) && item->invisible && 380 if (item->flag [FLAG_STARTEQUIP] && item->invisible
375 (item->type != SKILL) && (item->type != FORCE)) 381 && item->type != SKILL && item->type != FORCE)
376 { 382 {
377 if (item->type == SPELL) 383 if (item->type == SPELL)
378 { 384 {
379 new_draw_info_format (NDI_UNIQUE | NDI_NAVY, 0, op, "You lose knowledge of %s.", &item->name); 385 new_draw_info_format (NDI_UNIQUE | NDI_NAVY, 0, this, "You lose knowledge of %s.", &item->name);
380 esrv_remove_spell (op->contr, item); 386 esrv_remove_spell (contr, item);
381 } 387 }
382 388
383 player_unready_range_ob (op->contr, item);
384 item->destroy (); 389 item->destroy ();
385 } 390 }
386 } 391 }
387 392
388 /* remove any godgiven items from the old god */ 393 /* remove any godgiven items from the old god */
389 if (old_god) 394 if (old_god)
390 for (tr = old_god->randomitems->items; tr; tr = tr->next) 395 for (tr = old_god->randomitems->items; tr; tr = tr->next)
391 if (tr->item && QUERY_FLAG (tr->item, FLAG_STARTEQUIP)) 396 if (tr->item && tr->item->flag [FLAG_STARTEQUIP])
392 follower_remove_similar_item (op, tr->item); 397 follower_remove_similar_item (this, tr->item);
393 398
394 if (!op || !new_god) 399 if (!new_god)
395 return; 400 return;
396 401
397 if (new_god->slaying && op->race.contains (new_god->slaying)) 402 if (new_god->slaying && race.contains (new_god->slaying))
398 { 403 {
399 new_draw_info_format (NDI_UNIQUE | NDI_NAVY, 0, op, "Fool! %s detests your kind!", &new_god->name); 404 failmsgf ("Fool! %s detests your kind! H<This god does not accept followers of your race.>", &new_god->name);
400 405
401 if (random_roll (0, op->level - 1, op, PREFER_LOW) - 5 > 0) 406 if (random_roll (0, level - 1, this, PREFER_LOW) - 5 > 0)
402 { 407 {
403 object *tmp = get_archetype (LOOSE_MANA); 408 object *tmp = get_archetype (LOOSE_MANA);
404 409
405 cast_magic_storm (op, tmp, new_god->level + 10); 410 cast_magic_storm (this, tmp, new_god->level + 10);
406 } 411 }
407 412
408 return; 413 return;
409 } 414 }
410 415
411 /* give the player any special god-characteristic-items. */ 416 /* give the player any special god-characteristic-items. */
412 for (tr = new_god->randomitems->items; tr; tr = tr->next) 417 for (tr = new_god->randomitems->items; tr; tr = tr->next)
413 {
414 if (tr->item && tr->item->invisible && tr->item->type != SPELLBOOK 418 if (tr->item && tr->item->invisible && tr->item->type != SPELLBOOK
415 && tr->item->type != BOOK && tr->item->type != SPELL) 419 && tr->item->type != BOOK && tr->item->type != SPELL)
416 god_gives_present (op, new_god, tr); 420 god_gives_present (this, new_god, tr);
417 }
418 421
419 new_draw_info_format (NDI_UNIQUE | NDI_NAVY, 0, op, "You become a follower of %s!", &new_god->name); 422 new_draw_info_format (NDI_UNIQUE | NDI_NAVY, 0, this, "You become a follower of %s!", &new_god->name);
420 423
421 for (skop = op->inv; skop; skop = skop->below) 424 for (skop = inv; skop; skop = skop->below)
422 if (skop->type == SKILL && skop->subtype == SK_PRAYING) 425 if (skop->type == SKILL && skop->subtype == SK_PRAYING)
423 break; 426 break;
424 427
425 /* Player has no skill - give them the skill */ 428 /* Player has no skill - give them the skill */
426 if (!skop) 429 if (!skop)
427 /* The archetype should always be defined - if we crash here because it doesn't, 430 /* The archetype should always be defined - if we crash here because it doesn't,
428 * things are really messed up anyways. 431 * things are really messed up anyways.
429 */ 432 */
430 skop = give_skill_by_name (op, get_archetype_by_type_subtype (SKILL, SK_PRAYING)->skill); 433 skop = give_skill_by_name (this, shstr_praying);
431 434
432 sk_applied = QUERY_FLAG (skop, FLAG_APPLIED); /* save skill status */ 435 sk_applied = skop->flag [FLAG_APPLIED]; /* save skill status */
433 436
434 /* Clear the "undead" status. We also need to force a call to change_abil, 437 /* Clear the "undead" status. We also need to force a call to change_abil,
435 * so I set undeadified for that. 438 * so I set undeadified for that.
436 * - gros, 21th July 2006. 439 * - gros, 21th July 2006.
437 */ 440 */
438 if (old_god && QUERY_FLAG (old_god, FLAG_UNDEAD)) 441 if (old_god && old_god->flag [FLAG_UNDEAD])
439 { 442 {
440 CLEAR_FLAG (skop, FLAG_UNDEAD); 443 skop->clr_flag (FLAG_UNDEAD);
441 undeadified = 1; 444 undeadified = 1;
442 } 445 }
443 446
444 if (skop->title) 447 if (skop->title)
445 { 448 {
446 /* get rid of old god */ 449 /* get rid of old god */
447 new_draw_info_format (NDI_UNIQUE, 0, op, "%s's blessing is withdrawn from you.", &skop->title); 450 new_draw_info_format (NDI_UNIQUE, 0, this, "%s's blessing is withdrawn from you.", &skop->title);
448 451
449 /* The point of this is to really show what abilities the player just lost */ 452 /* The point of this is to really show what abilities the player just lost */
450 if (sk_applied || undeadified) 453 if (sk_applied || undeadified)
451 { 454 {
452 CLEAR_FLAG (skop, FLAG_APPLIED); 455 skop->clr_flag (FLAG_APPLIED);
453 change_abil (op, skop); 456 change_abil (this, skop);
454 } 457 }
455 } 458 }
456 459
457 /* now change to the new gods attributes to exp_obj */ 460 /* now change to the new gods attributes to exp_obj */
458 skop->title = new_god->name; 461 skop->title = new_god->name;
482 update_priest_flag (new_god, skop, FLAG_MAKE_INVIS); 485 update_priest_flag (new_god, skop, FLAG_MAKE_INVIS);
483 update_priest_flag (new_god, skop, FLAG_UNDEAD); 486 update_priest_flag (new_god, skop, FLAG_UNDEAD);
484 update_priest_flag (new_god, skop, FLAG_BLIND); 487 update_priest_flag (new_god, skop, FLAG_BLIND);
485 update_priest_flag (new_god, skop, FLAG_XRAYS); /* better have this if blind! */ 488 update_priest_flag (new_god, skop, FLAG_XRAYS); /* better have this if blind! */
486 489
487 new_draw_info_format (NDI_UNIQUE, 0, op, "You are bathed in %s's aura.", &new_god->name); 490 new_draw_info_format (NDI_UNIQUE, 0, this, "You are bathed in %s's aura.", &new_god->name);
488 491
489 /* Weapon/armour use are special...handle flag toggles here as this can 492 /* Weapon/armour use are special...handle flag toggles here as this can
490 * only happen when gods are worshipped and if the new priest could 493 * only happen when gods are worshipped and if the new priest could
491 * have used armour/weapons in the first place. 494 * have used armour/weapons in the first place.
492 * 495 *
493 * This also can happen for monks which cannot use weapons. In this case 496 * This also can happen for monks which cannot use weapons. In this case
494 * do not allow to use weapons even if the god otherwise would allow it. 497 * do not allow to use weapons even if the god otherwise would allow it.
495 */ 498 */
496 if (!present_in_ob_by_name (FORCE, "no weapon force", op)) 499 if (!present_in_ob_by_name (FORCE, "no weapon force", this))
497 update_priest_flag (new_god, skop, FLAG_USE_WEAPON); 500 update_priest_flag (new_god, skop, FLAG_USE_WEAPON);
498 501
499 update_priest_flag (new_god, skop, FLAG_USE_ARMOUR); 502 update_priest_flag (new_god, skop, FLAG_USE_ARMOUR);
500 503
501 if (worship_forbids_use (op, skop, FLAG_USE_WEAPON, "weapons")) 504 if (worship_forbids_use (this, skop, FLAG_USE_WEAPON, "weapons"))
502 stop_using_item (op, WEAPON, 2); 505 stop_using_item (this, WEAPON, 2);
503 506
504 if (worship_forbids_use (op, skop, FLAG_USE_ARMOUR, "armour")) 507 if (worship_forbids_use (this, skop, FLAG_USE_ARMOUR, "armour"))
505 { 508 {
506 stop_using_item (op, ARMOUR, 1); 509 stop_using_item (this, ARMOUR, 1);
507 stop_using_item (op, HELMET, 1); 510 stop_using_item (this, HELMET, 1);
508 stop_using_item (op, BOOTS, 1); 511 stop_using_item (this, BOOTS, 1);
509 stop_using_item (op, GLOVES, 1); 512 stop_using_item (this, GLOVES, 1);
510 stop_using_item (op, SHIELD, 1); 513 stop_using_item (this, SHIELD, 1);
511 } 514 }
512 515
513 SET_FLAG (skop, FLAG_APPLIED); 516 skop->set_flag (FLAG_APPLIED);
514 (void) change_abil (op, skop); 517 change_abil (this, skop);
515 518
516 /* return to previous skill status */ 519 /* return to previous skill status */
517 if (!sk_applied) 520 if (!sk_applied)
518 CLEAR_FLAG (skop, FLAG_APPLIED); 521 {
522 skop->clr_flag (FLAG_APPLIED);
523 contr->queue_stats_update ();
524 }
519 525
520 check_special_prayers (op, new_god); 526 check_special_prayers (this, new_god);
521} 527}
522 528
523archetype * 529archetype *
524determine_holy_arch (object *god, shstr_cmp type) 530determine_holy_arch (object *god, shstr_cmp type)
525{ 531{
556 for (object *tmp = op->inv; tmp; tmp = tmp->below) 562 for (object *tmp = op->inv; tmp; tmp = tmp->below)
557 { 563 {
558 if (tmp->invisible) 564 if (tmp->invisible)
559 continue; 565 continue;
560 566
561 if (QUERY_FLAG (tmp, FLAG_DAMNED) && !remove_damnation) 567 if (tmp->flag [FLAG_DAMNED] && !remove_damnation)
562 continue; 568 continue;
563 569
564 if (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED)) 570 if (tmp->flag [FLAG_CURSED] || tmp->flag [FLAG_DAMNED])
565 { 571 {
566 success = 1; 572 success = 1;
567 CLEAR_FLAG (tmp, FLAG_DAMNED); 573 tmp->clr_flag (FLAG_DAMNED);
568 CLEAR_FLAG (tmp, FLAG_CURSED); 574 tmp->clr_flag (FLAG_CURSED);
569 CLEAR_FLAG (tmp, FLAG_KNOWN_CURSED); 575 tmp->clr_flag (FLAG_KNOWN_CURSED);
570 576
571 if (object *pl = tmp->visible_to ()) 577 if (object *pl = tmp->visible_to ())
572 esrv_update_item (UPD_FLAGS, pl, tmp); 578 esrv_update_item (UPD_FLAGS, pl, tmp);
573 } 579 }
574 } 580 }
645 * attacktype, slaying and such. 651 * attacktype, slaying and such.
646 */ 652 */
647static int 653static int
648god_enchants_weapon (object *op, object *god, object *tr, object *skill) 654god_enchants_weapon (object *op, object *god, object *tr, object *skill)
649{ 655{
650 object *weapon; 656 if (!op->contr)
651 uint32 attacktype; 657 return 0;
652 int tmp;
653 658
654 for (weapon = op->inv; weapon; weapon = weapon->below) 659 object *weapon = op->contr->combat_ob;
655 if ((weapon->type == WEAPON || weapon->type == BOW) && QUERY_FLAG (weapon, FLAG_APPLIED))
656 break;
657 660
661 if (weapon->type != WEAPON && weapon->type != BOW)
662 return 0;
663
658 if (!weapon || god_examines_item (god, weapon) <= 0) 664 if (god_examines_item (god, weapon) <= 0)
659 return 0; 665 return 0;
660 666
661 /* First give it a title, so other gods won't touch it */ 667 /* First give it a title, so other gods won't touch it */
662 if (!weapon->title) 668 if (!weapon->title)
663 { 669 {
676 new_draw_info_format (NDI_UNIQUE, 0, op, "Your %s now hungers to slay enemies of your god!", &weapon->name); 682 new_draw_info_format (NDI_UNIQUE, 0, op, "Your %s now hungers to slay enemies of your god!", &weapon->name);
677 return 1; 683 return 1;
678 } 684 }
679 685
680 /* Add the gods attacktype */ 686 /* Add the gods attacktype */
681 attacktype = (weapon->attacktype == 0) ? AT_PHYSICAL : weapon->attacktype; 687 uint32 attacktype = (weapon->attacktype == 0) ? AT_PHYSICAL : weapon->attacktype;
688
682 if ((attacktype & god->attacktype) != god->attacktype) 689 if ((attacktype & god->attacktype) != god->attacktype)
683 { 690 {
684 new_draw_info (NDI_UNIQUE, 0, op, "Your weapon suddenly glows!"); 691 new_draw_info (NDI_UNIQUE, 0, op, "Your weapon suddenly glows!");
685 weapon->attacktype = attacktype | god->attacktype; 692 weapon->attacktype = attacktype | god->attacktype;
686 return 1; 693 return 1;
687 } 694 }
688 695
689 /* Higher magic value */ 696 /* Higher magic value */
690 tmp = follower_level_to_enchantments (skill->level, tr->level); 697 if (weapon->magic < follower_level_to_enchantments (skill->level, tr->level))
691 if (weapon->magic < tmp)
692 { 698 {
693 new_draw_info (NDI_UNIQUE, 0, op, "A phosphorescent glow envelops your weapon!"); 699 new_draw_info (NDI_UNIQUE, 0, op, "A phosphorescent glow envelops your weapon!");
694 weapon->magic++; 700 weapon->magic++;
695 701
696 if (object *pl = weapon->visible_to ()) 702 if (object *pl = weapon->visible_to ())
712{ 718{
713 int reaction = 1; 719 int reaction = 1;
714 object *item = NULL, *skop; 720 object *item = NULL, *skop;
715 721
716 for (item = op->inv; item; item = item->below) 722 for (item = op->inv; item; item = item->below)
717 if (QUERY_FLAG (item, FLAG_APPLIED)) 723 if (item->flag [FLAG_APPLIED])
718 reaction += god_examines_item (god, item) * (item->magic ? abs (item->magic) : 1); 724 reaction += god_examines_item (god, item) * (item->magic ? abs (item->magic) : 1);
719 725
720 /* well, well. Looks like we screwed up. Time for god's revenge */ 726 /* well, well. Looks like we screwed up. Time for god's revenge */
721 if (reaction < 0) 727 if (reaction < 0)
722 { 728 {
728 break; 734 break;
729 735
730 if (skop) 736 if (skop)
731 loss = 0.05f * skop->stats.exp; 737 loss = 0.05f * skop->stats.exp;
732 738
733 change_exp (op, -random_roll (0, loss * angry - 1, op, PREFER_LOW), skop ? &skop->skill : "none", SK_SUBTRACT_SKILL_EXP); 739 change_exp (op, -random_roll (0, loss * angry - 1, op, PREFER_LOW), skop ? skop->skill : shstr_none, SK_SUBTRACT_SKILL_EXP);
734 740
735 if (random_roll (0, angry, op, PREFER_LOW)) 741 if (random_roll (0, angry, op, PREFER_LOW))
736 { 742 {
737 object *tmp = get_archetype (LOOSE_MANA); 743 object *tmp = get_archetype (LOOSE_MANA);
738 744
887 { 893 {
888 object *depl; 894 object *depl;
889 archetype *at; 895 archetype *at;
890 int i; 896 int i;
891 897
892 if ((at = archetype::find (ARCH_DEPLETION)) == NULL) 898 if ((at = archetype::find (shstr_depletion)) == NULL)
893 { 899 {
894 LOG (llevError, "Could not find archetype depletion.\n"); 900 LOG (llevError, "Could not find archetype depletion.\n");
895 continue; 901 continue;
896 } 902 }
897 903
980 return; 986 return;
981 987
982 /* hmm. what happend depends on pl's current god, level, etc */ 988 /* hmm. what happend depends on pl's current god, level, etc */
983 if (!pl_god) 989 if (!pl_god)
984 { /*new convert */ 990 { /*new convert */
985 become_follower (pl, altar->other_arch); 991 pl->become_follower (altar->other_arch);
986 return; 992 return;
987 } 993 }
988 else if (pl_god->name == altar->other_arch->object::name) 994 else if (pl_god->name == altar->other_arch->object::name)
989 { 995 {
990 /* pray at your gods altar */ 996 /* pray at your gods altar */
1044 * we lose experience from the clerical experience obj 1050 * we lose experience from the clerical experience obj
1045 */ 1051 */
1046 1052
1047 loss = angry * (skill->stats.exp / 10); 1053 loss = angry * (skill->stats.exp / 10);
1048 if (loss) 1054 if (loss)
1049 change_exp (pl, -random_roll64 (0, loss, pl, PREFER_LOW), skill ? &skill->skill : "none", SK_SUBTRACT_SKILL_EXP); 1055 change_exp (pl, -random_roll64 (0, loss, pl, PREFER_LOW), skill ? skill->skill : shstr_none, SK_SUBTRACT_SKILL_EXP);
1050 1056
1051 /* May switch Gods, but its random chance based on our current level 1057 /* May switch Gods, but its random chance based on our current level
1052 * note it gets harder to swap gods the higher we get 1058 * note it gets harder to swap gods the higher we get
1053 */ 1059 */
1054 if ((angry == 1) && !(random_roll (0, skill->level, pl, PREFER_LOW))) 1060 if ((angry == 1) && !(random_roll (0, skill->level, pl, PREFER_LOW)))
1055 become_follower (pl, altar->other_arch); 1061 pl->become_follower (altar->other_arch);
1056 else 1062 else
1057 { 1063 {
1058 /* toss this player off the altar. He can try again. */ 1064 /* toss this player off the altar. He can try again. */
1059 new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, pl, "A divine force pushes you off the altar."); 1065 new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, pl, "A divine force pushes you off the altar.");
1060 pl->contr->fire_on = 0; 1066 pl->contr->fire_on = 0;
1061 pl->speed_left = 1.f; 1067 pl->speed_left = 1.f;
1062 move_player (pl, absdir (pl->facing + 4)); /* back him off the way he came. */ 1068 move_player (pl, absdir (pl->facing + 4)); /* back him off the way he came. */
1063 } 1069 }
1064 } 1070 }
1065}
1066
1067/**
1068 * Returns priest's god's id.
1069 * Straight calls lookup_god_by_name
1070 */
1071int
1072get_god (object *priest)
1073{
1074 return lookup_god_by_name (determine_god (priest));
1075} 1071}
1076 1072
1077/** 1073/**
1078 * Changes the attributes of cone, smite, and ball spells as needed by the code. 1074 * Changes the attributes of cone, smite, and ball spells as needed by the code.
1079 * Returns false if there was no race to assign to the slaying field of the spell, but 1075 * Returns false if there was no race to assign to the slaying field of the spell, but

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines