… | |
… | |
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); |
… | |
… | |
285 | * Unapplies up to number worth of items of type |
285 | * Unapplies up to number worth of items of type |
286 | */ |
286 | */ |
287 | static void |
287 | static void |
288 | stop_using_item (object *op, int type, int number) |
288 | stop_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 | */ |
305 | static void |
303 | static inline void |
306 | update_priest_flag (object *god, object *exp_ob, uint32 flag) |
304 | update_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 | */ |
333 | static int |
334 | static int |
334 | worship_forbids_use (object *op, object *exp_obj, uint32 flag, const char *string) |
335 | worship_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 | */ |
358 | void |
359 | void |
359 | become_follower (object *op, object *new_god) |
360 | object::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 | item->destroy (); |
389 | item->destroy (); |
384 | } |
390 | } |
385 | } |
391 | } |
386 | |
392 | |
387 | /* remove any godgiven items from the old god */ |
393 | /* remove any godgiven items from the old god */ |
388 | if (old_god) |
394 | if (old_god) |
389 | for (tr = old_god->randomitems->items; tr; tr = tr->next) |
395 | for (tr = old_god->randomitems->items; tr; tr = tr->next) |
390 | if (tr->item && QUERY_FLAG (tr->item, FLAG_STARTEQUIP)) |
396 | if (tr->item && tr->item->flag [FLAG_STARTEQUIP]) |
391 | follower_remove_similar_item (op, tr->item); |
397 | follower_remove_similar_item (this, tr->item); |
392 | |
398 | |
393 | if (!op || !new_god) |
399 | if (!new_god) |
394 | return; |
400 | return; |
395 | |
401 | |
396 | if (new_god->slaying && op->race.contains (new_god->slaying)) |
402 | if (new_god->slaying && new_god->slaying.contains (race)) |
397 | { |
403 | { |
398 | 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); |
399 | |
405 | |
400 | if (random_roll (0, op->level - 1, op, PREFER_LOW) - 5 > 0) |
406 | if (random_roll (0, level - 1, this, PREFER_LOW) - 5 > 0) |
401 | { |
407 | { |
402 | object *tmp = get_archetype (LOOSE_MANA); |
408 | object *tmp = get_archetype (LOOSE_MANA); |
403 | |
409 | |
404 | cast_magic_storm (op, tmp, new_god->level + 10); |
410 | cast_magic_storm (this, tmp, new_god->level + 10); |
405 | } |
411 | } |
406 | |
412 | |
407 | return; |
413 | return; |
408 | } |
414 | } |
409 | |
415 | |
410 | /* give the player any special god-characteristic-items. */ |
416 | /* give the player any special god-characteristic-items. */ |
411 | for (tr = new_god->randomitems->items; tr; tr = tr->next) |
417 | for (tr = new_god->randomitems->items; tr; tr = tr->next) |
412 | { |
|
|
413 | if (tr->item && tr->item->invisible && tr->item->type != SPELLBOOK |
418 | if (tr->item && tr->item->invisible && tr->item->type != SPELLBOOK |
414 | && tr->item->type != BOOK && tr->item->type != SPELL) |
419 | && tr->item->type != BOOK && tr->item->type != SPELL) |
415 | god_gives_present (op, new_god, tr); |
420 | god_gives_present (this, new_god, tr); |
416 | } |
|
|
417 | |
421 | |
418 | 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); |
419 | |
423 | |
420 | for (skop = op->inv; skop; skop = skop->below) |
424 | for (skop = inv; skop; skop = skop->below) |
421 | if (skop->type == SKILL && skop->subtype == SK_PRAYING) |
425 | if (skop->type == SKILL && skop->subtype == SK_PRAYING) |
422 | break; |
426 | break; |
423 | |
427 | |
424 | /* Player has no skill - give them the skill */ |
428 | /* Player has no skill - give them the skill */ |
425 | if (!skop) |
429 | if (!skop) |
426 | /* 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, |
427 | * things are really messed up anyways. |
431 | * things are really messed up anyways. |
428 | */ |
432 | */ |
429 | skop = give_skill_by_name (op, get_archetype_by_type_subtype (SKILL, SK_PRAYING)->skill); |
433 | skop = give_skill_by_name (this, shstr_praying); |
430 | |
434 | |
431 | sk_applied = QUERY_FLAG (skop, FLAG_APPLIED); /* save skill status */ |
435 | sk_applied = skop->flag [FLAG_APPLIED]; /* save skill status */ |
432 | |
436 | |
433 | /* 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, |
434 | * so I set undeadified for that. |
438 | * so I set undeadified for that. |
435 | * - gros, 21th July 2006. |
439 | * - gros, 21th July 2006. |
436 | */ |
440 | */ |
437 | if (old_god && QUERY_FLAG (old_god, FLAG_UNDEAD)) |
441 | if (old_god && old_god->flag [FLAG_UNDEAD]) |
438 | { |
442 | { |
439 | CLEAR_FLAG (skop, FLAG_UNDEAD); |
443 | skop->clr_flag (FLAG_UNDEAD); |
440 | undeadified = 1; |
444 | undeadified = 1; |
441 | } |
445 | } |
442 | |
446 | |
443 | if (skop->title) |
447 | if (skop->title) |
444 | { |
448 | { |
445 | /* get rid of old god */ |
449 | /* get rid of old god */ |
446 | 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); |
447 | |
451 | |
448 | /* 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 */ |
449 | if (sk_applied || undeadified) |
453 | if (sk_applied || undeadified) |
450 | { |
454 | { |
451 | CLEAR_FLAG (skop, FLAG_APPLIED); |
455 | skop->clr_flag (FLAG_APPLIED); |
452 | change_abil (op, skop); |
456 | change_abil (this, skop); |
453 | } |
457 | } |
454 | } |
458 | } |
455 | |
459 | |
456 | /* now change to the new gods attributes to exp_obj */ |
460 | /* now change to the new gods attributes to exp_obj */ |
457 | skop->title = new_god->name; |
461 | skop->title = new_god->name; |
… | |
… | |
481 | update_priest_flag (new_god, skop, FLAG_MAKE_INVIS); |
485 | update_priest_flag (new_god, skop, FLAG_MAKE_INVIS); |
482 | update_priest_flag (new_god, skop, FLAG_UNDEAD); |
486 | update_priest_flag (new_god, skop, FLAG_UNDEAD); |
483 | update_priest_flag (new_god, skop, FLAG_BLIND); |
487 | update_priest_flag (new_god, skop, FLAG_BLIND); |
484 | 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! */ |
485 | |
489 | |
486 | 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); |
487 | |
491 | |
488 | /* 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 |
489 | * 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 |
490 | * have used armour/weapons in the first place. |
494 | * have used armour/weapons in the first place. |
491 | * |
495 | * |
492 | * 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 |
493 | * 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. |
494 | */ |
498 | */ |
495 | if (!present_in_ob_by_name (FORCE, "no weapon force", op)) |
499 | if (!present_in_ob_by_name (FORCE, "no weapon force", this)) |
496 | update_priest_flag (new_god, skop, FLAG_USE_WEAPON); |
500 | update_priest_flag (new_god, skop, FLAG_USE_WEAPON); |
497 | |
501 | |
498 | update_priest_flag (new_god, skop, FLAG_USE_ARMOUR); |
502 | update_priest_flag (new_god, skop, FLAG_USE_ARMOUR); |
499 | |
503 | |
500 | if (worship_forbids_use (op, skop, FLAG_USE_WEAPON, "weapons")) |
504 | if (worship_forbids_use (this, skop, FLAG_USE_WEAPON, "weapons")) |
501 | stop_using_item (op, WEAPON, 2); |
505 | stop_using_item (this, WEAPON, 2); |
502 | |
506 | |
503 | if (worship_forbids_use (op, skop, FLAG_USE_ARMOUR, "armour")) |
507 | if (worship_forbids_use (this, skop, FLAG_USE_ARMOUR, "armour")) |
504 | { |
508 | { |
505 | stop_using_item (op, ARMOUR, 1); |
509 | stop_using_item (this, ARMOUR, 1); |
506 | stop_using_item (op, HELMET, 1); |
510 | stop_using_item (this, HELMET, 1); |
507 | stop_using_item (op, BOOTS, 1); |
511 | stop_using_item (this, BOOTS, 1); |
508 | stop_using_item (op, GLOVES, 1); |
512 | stop_using_item (this, GLOVES, 1); |
509 | stop_using_item (op, SHIELD, 1); |
513 | stop_using_item (this, SHIELD, 1); |
510 | } |
514 | } |
511 | |
515 | |
512 | SET_FLAG (skop, FLAG_APPLIED); |
516 | skop->set_flag (FLAG_APPLIED); |
513 | change_abil (op, skop); |
517 | change_abil (this, skop); |
514 | |
518 | |
515 | /* return to previous skill status */ |
519 | /* return to previous skill status */ |
516 | if (!sk_applied) |
520 | if (!sk_applied) |
517 | CLEAR_FLAG (skop, FLAG_APPLIED); |
521 | { |
|
|
522 | skop->clr_flag (FLAG_APPLIED); |
|
|
523 | contr->queue_stats_update (); |
|
|
524 | } |
518 | |
525 | |
519 | check_special_prayers (op, new_god); |
526 | check_special_prayers (this, new_god); |
520 | } |
527 | } |
521 | |
528 | |
522 | archetype * |
529 | archetype * |
523 | determine_holy_arch (object *god, shstr_cmp type) |
530 | determine_holy_arch (object *god, shstr_cmp type) |
524 | { |
531 | { |
… | |
… | |
555 | for (object *tmp = op->inv; tmp; tmp = tmp->below) |
562 | for (object *tmp = op->inv; tmp; tmp = tmp->below) |
556 | { |
563 | { |
557 | if (tmp->invisible) |
564 | if (tmp->invisible) |
558 | continue; |
565 | continue; |
559 | |
566 | |
560 | if (QUERY_FLAG (tmp, FLAG_DAMNED) && !remove_damnation) |
567 | if (tmp->flag [FLAG_DAMNED] && !remove_damnation) |
561 | continue; |
568 | continue; |
562 | |
569 | |
563 | if (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED)) |
570 | if (tmp->flag [FLAG_CURSED] || tmp->flag [FLAG_DAMNED]) |
564 | { |
571 | { |
565 | success = 1; |
572 | success = 1; |
566 | CLEAR_FLAG (tmp, FLAG_DAMNED); |
573 | tmp->clr_flag (FLAG_DAMNED); |
567 | CLEAR_FLAG (tmp, FLAG_CURSED); |
574 | tmp->clr_flag (FLAG_CURSED); |
568 | CLEAR_FLAG (tmp, FLAG_KNOWN_CURSED); |
575 | tmp->clr_flag (FLAG_KNOWN_CURSED); |
569 | |
576 | |
570 | if (object *pl = tmp->visible_to ()) |
577 | if (object *pl = tmp->visible_to ()) |
571 | esrv_update_item (UPD_FLAGS, pl, tmp); |
578 | esrv_update_item (UPD_FLAGS, pl, tmp); |
572 | } |
579 | } |
573 | } |
580 | } |
… | |
… | |
644 | * attacktype, slaying and such. |
651 | * attacktype, slaying and such. |
645 | */ |
652 | */ |
646 | static int |
653 | static int |
647 | god_enchants_weapon (object *op, object *god, object *tr, object *skill) |
654 | god_enchants_weapon (object *op, object *god, object *tr, object *skill) |
648 | { |
655 | { |
649 | object *weapon; |
656 | if (!op->contr) |
650 | uint32 attacktype; |
657 | return 0; |
651 | int tmp; |
|
|
652 | |
658 | |
653 | for (weapon = op->inv; weapon; weapon = weapon->below) |
659 | object *weapon = op->contr->combat_ob; |
654 | if ((weapon->type == WEAPON || weapon->type == BOW) && QUERY_FLAG (weapon, FLAG_APPLIED)) |
|
|
655 | break; |
|
|
656 | |
660 | |
|
|
661 | if (!weapon) |
|
|
662 | return 0; |
|
|
663 | |
|
|
664 | if (weapon->type != WEAPON && weapon->type != BOW) |
|
|
665 | return 0; |
|
|
666 | |
657 | if (!weapon || god_examines_item (god, weapon) <= 0) |
667 | if (god_examines_item (god, weapon) <= 0) |
658 | return 0; |
668 | return 0; |
659 | |
669 | |
660 | /* First give it a title, so other gods won't touch it */ |
670 | /* First give it a title, so other gods won't touch it */ |
661 | if (!weapon->title) |
671 | if (!weapon->title) |
662 | { |
672 | { |
… | |
… | |
675 | new_draw_info_format (NDI_UNIQUE, 0, op, "Your %s now hungers to slay enemies of your god!", &weapon->name); |
685 | new_draw_info_format (NDI_UNIQUE, 0, op, "Your %s now hungers to slay enemies of your god!", &weapon->name); |
676 | return 1; |
686 | return 1; |
677 | } |
687 | } |
678 | |
688 | |
679 | /* Add the gods attacktype */ |
689 | /* Add the gods attacktype */ |
680 | attacktype = (weapon->attacktype == 0) ? AT_PHYSICAL : weapon->attacktype; |
690 | uint32 attacktype = (weapon->attacktype == 0) ? AT_PHYSICAL : weapon->attacktype; |
|
|
691 | |
681 | if ((attacktype & god->attacktype) != god->attacktype) |
692 | if ((attacktype & god->attacktype) != god->attacktype) |
682 | { |
693 | { |
683 | new_draw_info (NDI_UNIQUE, 0, op, "Your weapon suddenly glows!"); |
694 | new_draw_info (NDI_UNIQUE, 0, op, "Your weapon suddenly glows!"); |
684 | weapon->attacktype = attacktype | god->attacktype; |
695 | weapon->attacktype = attacktype | god->attacktype; |
685 | return 1; |
696 | return 1; |
686 | } |
697 | } |
687 | |
698 | |
688 | /* Higher magic value */ |
699 | /* Higher magic value */ |
689 | tmp = follower_level_to_enchantments (skill->level, tr->level); |
700 | if (weapon->magic < follower_level_to_enchantments (skill->level, tr->level)) |
690 | if (weapon->magic < tmp) |
|
|
691 | { |
701 | { |
692 | new_draw_info (NDI_UNIQUE, 0, op, "A phosphorescent glow envelops your weapon!"); |
702 | new_draw_info (NDI_UNIQUE, 0, op, "A phosphorescent glow envelops your weapon!"); |
693 | weapon->magic++; |
703 | weapon->magic++; |
694 | |
704 | |
695 | if (object *pl = weapon->visible_to ()) |
705 | if (object *pl = weapon->visible_to ()) |
… | |
… | |
711 | { |
721 | { |
712 | int reaction = 1; |
722 | int reaction = 1; |
713 | object *item = NULL, *skop; |
723 | object *item = NULL, *skop; |
714 | |
724 | |
715 | for (item = op->inv; item; item = item->below) |
725 | for (item = op->inv; item; item = item->below) |
716 | if (QUERY_FLAG (item, FLAG_APPLIED)) |
726 | if (item->flag [FLAG_APPLIED]) |
717 | reaction += god_examines_item (god, item) * (item->magic ? abs (item->magic) : 1); |
727 | reaction += god_examines_item (god, item) * (item->magic ? abs (item->magic) : 1); |
718 | |
728 | |
719 | /* well, well. Looks like we screwed up. Time for god's revenge */ |
729 | /* well, well. Looks like we screwed up. Time for god's revenge */ |
720 | if (reaction < 0) |
730 | if (reaction < 0) |
721 | { |
731 | { |
… | |
… | |
727 | break; |
737 | break; |
728 | |
738 | |
729 | if (skop) |
739 | if (skop) |
730 | loss = 0.05f * skop->stats.exp; |
740 | loss = 0.05f * skop->stats.exp; |
731 | |
741 | |
732 | change_exp (op, -random_roll (0, loss * angry - 1, op, PREFER_LOW), skop ? &skop->skill : "none", SK_SUBTRACT_SKILL_EXP); |
742 | change_exp (op, -random_roll (0, loss * angry - 1, op, PREFER_LOW), skop ? skop->skill : shstr_none, SK_SUBTRACT_SKILL_EXP); |
733 | |
743 | |
734 | if (random_roll (0, angry, op, PREFER_LOW)) |
744 | if (random_roll (0, angry, op, PREFER_LOW)) |
735 | { |
745 | { |
736 | object *tmp = get_archetype (LOOSE_MANA); |
746 | object *tmp = get_archetype (LOOSE_MANA); |
737 | |
747 | |
… | |
… | |
979 | return; |
989 | return; |
980 | |
990 | |
981 | /* hmm. what happend depends on pl's current god, level, etc */ |
991 | /* hmm. what happend depends on pl's current god, level, etc */ |
982 | if (!pl_god) |
992 | if (!pl_god) |
983 | { /*new convert */ |
993 | { /*new convert */ |
984 | become_follower (pl, altar->other_arch); |
994 | pl->become_follower (altar->other_arch); |
985 | return; |
995 | return; |
986 | } |
996 | } |
987 | else if (pl_god->name == altar->other_arch->object::name) |
997 | else if (pl_god->name == altar->other_arch->object::name) |
988 | { |
998 | { |
989 | /* pray at your gods altar */ |
999 | /* pray at your gods altar */ |
… | |
… | |
1043 | * we lose experience from the clerical experience obj |
1053 | * we lose experience from the clerical experience obj |
1044 | */ |
1054 | */ |
1045 | |
1055 | |
1046 | loss = angry * (skill->stats.exp / 10); |
1056 | loss = angry * (skill->stats.exp / 10); |
1047 | if (loss) |
1057 | if (loss) |
1048 | change_exp (pl, -random_roll64 (0, loss, pl, PREFER_LOW), skill ? &skill->skill : "none", SK_SUBTRACT_SKILL_EXP); |
1058 | change_exp (pl, -random_roll64 (0, loss, pl, PREFER_LOW), skill ? skill->skill : shstr_none, SK_SUBTRACT_SKILL_EXP); |
1049 | |
1059 | |
1050 | /* May switch Gods, but its random chance based on our current level |
1060 | /* May switch Gods, but its random chance based on our current level |
1051 | * note it gets harder to swap gods the higher we get |
1061 | * note it gets harder to swap gods the higher we get |
1052 | */ |
1062 | */ |
1053 | if ((angry == 1) && !(random_roll (0, skill->level, pl, PREFER_LOW))) |
1063 | if ((angry == 1) && !(random_roll (0, skill->level, pl, PREFER_LOW))) |
1054 | become_follower (pl, altar->other_arch); |
1064 | pl->become_follower (altar->other_arch); |
1055 | else |
1065 | else |
1056 | { |
1066 | { |
1057 | /* toss this player off the altar. He can try again. */ |
1067 | /* toss this player off the altar. He can try again. */ |
1058 | new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, pl, "A divine force pushes you off the altar."); |
1068 | new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, pl, "A divine force pushes you off the altar."); |
1059 | pl->contr->fire_on = 0; |
1069 | pl->contr->fire_on = 0; |