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.63 by root, Thu Apr 15 00:36:51 2010 UTC vs.
Revision 1.67 by root, Sun Aug 22 20:11:04 2010 UTC

397 follower_remove_similar_item (this, tr->item); 397 follower_remove_similar_item (this, tr->item);
398 398
399 if (!new_god) 399 if (!new_god)
400 return; 400 return;
401 401
402 if (new_god->slaying && race.contains (new_god->slaying)) 402 if (new_god->slaying && new_god->slaying.contains (race))
403 { 403 {
404 failmsgf ("Fool! %s detests your kind! H<This god does not accept followers of your race.>", &new_god->name); 404 failmsgf ("Fool! %s detests your kind! H<This god does not accept followers of your race.>", &new_god->name);
405 405
406 if (random_roll (0, level - 1, this, PREFER_LOW) - 5 > 0) 406 if (random_roll (0, level - 1, this, PREFER_LOW) - 5 > 0)
407 { 407 {
651 * attacktype, slaying and such. 651 * attacktype, slaying and such.
652 */ 652 */
653static int 653static int
654god_enchants_weapon (object *op, object *god, object *tr, object *skill) 654god_enchants_weapon (object *op, object *god, object *tr, object *skill)
655{ 655{
656 object *weapon; 656 if (!op->contr)
657 uint32 attacktype; 657 return 0;
658 int tmp;
659 658
660 for (weapon = op->inv; weapon; weapon = weapon->below) 659 object *weapon = op->contr->combat_ob;
661 if ((weapon->type == WEAPON || weapon->type == BOW) && weapon->flag [FLAG_APPLIED])
662 break;
663 660
661 if (!weapon)
662 return 0;
663
664 if (weapon->type != WEAPON && weapon->type != BOW)
665 return 0;
666
664 if (!weapon || god_examines_item (god, weapon) <= 0) 667 if (god_examines_item (god, weapon) <= 0)
665 return 0; 668 return 0;
666 669
667 /* 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 */
668 if (!weapon->title) 671 if (!weapon->title)
669 { 672 {
682 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);
683 return 1; 686 return 1;
684 } 687 }
685 688
686 /* Add the gods attacktype */ 689 /* Add the gods attacktype */
687 attacktype = (weapon->attacktype == 0) ? AT_PHYSICAL : weapon->attacktype; 690 uint32 attacktype = (weapon->attacktype == 0) ? AT_PHYSICAL : weapon->attacktype;
691
688 if ((attacktype & god->attacktype) != god->attacktype) 692 if ((attacktype & god->attacktype) != god->attacktype)
689 { 693 {
690 new_draw_info (NDI_UNIQUE, 0, op, "Your weapon suddenly glows!"); 694 new_draw_info (NDI_UNIQUE, 0, op, "Your weapon suddenly glows!");
691 weapon->attacktype = attacktype | god->attacktype; 695 weapon->attacktype = attacktype | god->attacktype;
692 return 1; 696 return 1;
693 } 697 }
694 698
695 /* Higher magic value */ 699 /* Higher magic value */
696 tmp = follower_level_to_enchantments (skill->level, tr->level); 700 if (weapon->magic < follower_level_to_enchantments (skill->level, tr->level))
697 if (weapon->magic < tmp)
698 { 701 {
699 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!");
700 weapon->magic++; 703 weapon->magic++;
701 704
702 if (object *pl = weapon->visible_to ()) 705 if (object *pl = weapon->visible_to ())
734 break; 737 break;
735 738
736 if (skop) 739 if (skop)
737 loss = 0.05f * skop->stats.exp; 740 loss = 0.05f * skop->stats.exp;
738 741
739 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);
740 743
741 if (random_roll (0, angry, op, PREFER_LOW)) 744 if (random_roll (0, angry, op, PREFER_LOW))
742 { 745 {
743 object *tmp = get_archetype (LOOSE_MANA); 746 object *tmp = get_archetype (LOOSE_MANA);
744 747
1050 * we lose experience from the clerical experience obj 1053 * we lose experience from the clerical experience obj
1051 */ 1054 */
1052 1055
1053 loss = angry * (skill->stats.exp / 10); 1056 loss = angry * (skill->stats.exp / 10);
1054 if (loss) 1057 if (loss)
1055 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);
1056 1059
1057 /* 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
1058 * note it gets harder to swap gods the higher we get 1061 * note it gets harder to swap gods the higher we get
1059 */ 1062 */
1060 if ((angry == 1) && !(random_roll (0, skill->level, pl, PREFER_LOW))) 1063 if ((angry == 1) && !(random_roll (0, skill->level, pl, PREFER_LOW)))

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines