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.65 by root, Thu Jun 10 06:03:18 2010 UTC

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->type != WEAPON && weapon->type != BOW)
662 return 0;
663
664 if (!weapon || god_examines_item (god, weapon) <= 0) 664 if (god_examines_item (god, weapon) <= 0)
665 return 0; 665 return 0;
666 666
667 /* 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 */
668 if (!weapon->title) 668 if (!weapon->title)
669 { 669 {
682 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);
683 return 1; 683 return 1;
684 } 684 }
685 685
686 /* Add the gods attacktype */ 686 /* Add the gods attacktype */
687 attacktype = (weapon->attacktype == 0) ? AT_PHYSICAL : weapon->attacktype; 687 uint32 attacktype = (weapon->attacktype == 0) ? AT_PHYSICAL : weapon->attacktype;
688
688 if ((attacktype & god->attacktype) != god->attacktype) 689 if ((attacktype & god->attacktype) != god->attacktype)
689 { 690 {
690 new_draw_info (NDI_UNIQUE, 0, op, "Your weapon suddenly glows!"); 691 new_draw_info (NDI_UNIQUE, 0, op, "Your weapon suddenly glows!");
691 weapon->attacktype = attacktype | god->attacktype; 692 weapon->attacktype = attacktype | god->attacktype;
692 return 1; 693 return 1;
693 } 694 }
694 695
695 /* Higher magic value */ 696 /* Higher magic value */
696 tmp = follower_level_to_enchantments (skill->level, tr->level); 697 if (weapon->magic < follower_level_to_enchantments (skill->level, tr->level))
697 if (weapon->magic < tmp)
698 { 698 {
699 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!");
700 weapon->magic++; 700 weapon->magic++;
701 701
702 if (object *pl = weapon->visible_to ()) 702 if (object *pl = weapon->visible_to ())
734 break; 734 break;
735 735
736 if (skop) 736 if (skop)
737 loss = 0.05f * skop->stats.exp; 737 loss = 0.05f * skop->stats.exp;
738 738
739 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);
740 740
741 if (random_roll (0, angry, op, PREFER_LOW)) 741 if (random_roll (0, angry, op, PREFER_LOW))
742 { 742 {
743 object *tmp = get_archetype (LOOSE_MANA); 743 object *tmp = get_archetype (LOOSE_MANA);
744 744
1050 * we lose experience from the clerical experience obj 1050 * we lose experience from the clerical experience obj
1051 */ 1051 */
1052 1052
1053 loss = angry * (skill->stats.exp / 10); 1053 loss = angry * (skill->stats.exp / 10);
1054 if (loss) 1054 if (loss)
1055 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);
1056 1056
1057 /* 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
1058 * note it gets harder to swap gods the higher we get 1058 * note it gets harder to swap gods the higher we get
1059 */ 1059 */
1060 if ((angry == 1) && !(random_roll (0, skill->level, pl, PREFER_LOW))) 1060 if ((angry == 1) && !(random_roll (0, skill->level, pl, PREFER_LOW)))

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines