… | |
… | |
235 | * God gives an item to the player. |
235 | * God gives an item to the player. |
236 | */ |
236 | */ |
237 | static int |
237 | static int |
238 | god_gives_present (object *op, object *god, treasure *tr) |
238 | god_gives_present (object *op, object *god, treasure *tr) |
239 | { |
239 | { |
240 | object *tmp; |
|
|
241 | |
|
|
242 | if (!tr->item) |
240 | if (!tr->item) |
243 | return 0; |
241 | return 0; |
244 | |
242 | |
245 | if (follower_has_similar_item (op, tr->item)) |
243 | if (follower_has_similar_item (op, tr->item)) |
246 | return 0; |
244 | return 0; |
247 | |
245 | |
248 | tmp = arch_to_object (tr->item); |
246 | object *tmp = arch_to_object (tr->item); |
249 | new_draw_info_format (NDI_UNIQUE, 0, op, "%s lets %s appear in your hands.", &god->name, query_short_name (tmp)); |
247 | new_draw_info_format (NDI_UNIQUE, 0, op, "%s lets %s appear in your hands.", &god->name, query_short_name (tmp)); |
250 | tmp = insert_ob_in_ob (tmp, op); |
248 | op->insert (tmp); |
251 | if (op->type == PLAYER) |
|
|
252 | esrv_send_item (op, tmp); |
|
|
253 | |
249 | |
254 | return 1; |
250 | return 1; |
255 | } |
251 | } |
256 | |
252 | |
257 | /** |
253 | /** |
… | |
… | |
691 | * God helps player by removing curse and/or damnation. |
687 | * God helps player by removing curse and/or damnation. |
692 | */ |
688 | */ |
693 | static int |
689 | static int |
694 | god_removes_curse (object *op, int remove_damnation) |
690 | god_removes_curse (object *op, int remove_damnation) |
695 | { |
691 | { |
696 | object *tmp; |
|
|
697 | int success = 0; |
692 | int success = 0; |
698 | |
693 | |
699 | for (tmp = op->inv; tmp; tmp = tmp->below) |
694 | for (object *tmp = op->inv; tmp; tmp = tmp->below) |
700 | { |
695 | { |
701 | if (tmp->invisible) |
696 | if (tmp->invisible) |
702 | continue; |
697 | continue; |
|
|
698 | |
703 | if (QUERY_FLAG (tmp, FLAG_DAMNED) && !remove_damnation) |
699 | if (QUERY_FLAG (tmp, FLAG_DAMNED) && !remove_damnation) |
704 | continue; |
700 | continue; |
|
|
701 | |
705 | if (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED)) |
702 | if (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED)) |
706 | { |
703 | { |
707 | success = 1; |
704 | success = 1; |
708 | CLEAR_FLAG (tmp, FLAG_DAMNED); |
705 | CLEAR_FLAG (tmp, FLAG_DAMNED); |
709 | CLEAR_FLAG (tmp, FLAG_CURSED); |
706 | CLEAR_FLAG (tmp, FLAG_CURSED); |
710 | CLEAR_FLAG (tmp, FLAG_KNOWN_CURSED); |
707 | CLEAR_FLAG (tmp, FLAG_KNOWN_CURSED); |
711 | if (op->type == PLAYER) |
708 | |
|
|
709 | if (object *pl = tmp->visible_to ()) |
712 | esrv_send_item (op, tmp); |
710 | esrv_update_item (UPD_FLAGS, pl, tmp); |
713 | } |
711 | } |
714 | } |
712 | } |
715 | |
713 | |
716 | if (success) |
714 | if (success) |
717 | new_draw_info (NDI_UNIQUE, 0, op, "You feel like someone is helping you."); |
715 | new_draw_info (NDI_UNIQUE, 0, op, "You feel like someone is helping you."); |
|
|
716 | |
718 | return success; |
717 | return success; |
719 | } |
718 | } |
720 | |
719 | |
721 | static int |
720 | static int |
722 | follower_level_to_enchantments (int level, int difficulty) |
721 | follower_level_to_enchantments (int level, int difficulty) |
… | |
… | |
759 | /* First give it a title, so other gods won't touch it */ |
758 | /* First give it a title, so other gods won't touch it */ |
760 | if (!weapon->title) |
759 | if (!weapon->title) |
761 | { |
760 | { |
762 | sprintf (buf, "of %s", &god->name); |
761 | sprintf (buf, "of %s", &god->name); |
763 | weapon->title = buf; |
762 | weapon->title = buf; |
764 | if (op->type == PLAYER) |
763 | |
|
|
764 | if (object *pl = weapon->visible_to ()) |
765 | esrv_update_item (UPD_NAME, op, weapon); |
765 | esrv_update_item (UPD_NAME, pl, weapon); |
|
|
766 | |
766 | new_draw_info (NDI_UNIQUE, 0, op, "Your weapon quivers as if struck!"); |
767 | new_draw_info (NDI_UNIQUE, 0, op, "Your weapon quivers as if struck!"); |
767 | } |
768 | } |
768 | |
769 | |
769 | /* Allow the weapon to slay enemies */ |
770 | /* Allow the weapon to slay enemies */ |
770 | if (!weapon->slaying && god->slaying) |
771 | if (!weapon->slaying && god->slaying) |
… | |
… | |
787 | tmp = follower_level_to_enchantments (skill->level, tr->level); |
788 | tmp = follower_level_to_enchantments (skill->level, tr->level); |
788 | if (weapon->magic < tmp) |
789 | if (weapon->magic < tmp) |
789 | { |
790 | { |
790 | new_draw_info (NDI_UNIQUE, 0, op, "A phosphorescent glow envelops your weapon!"); |
791 | new_draw_info (NDI_UNIQUE, 0, op, "A phosphorescent glow envelops your weapon!"); |
791 | weapon->magic++; |
792 | weapon->magic++; |
792 | if (op->type == PLAYER) |
793 | |
|
|
794 | if (object *pl = weapon->visible_to ()) |
793 | esrv_update_item (UPD_NAME, op, weapon); |
795 | esrv_update_item (UPD_NAME, pl, weapon); |
|
|
796 | |
794 | return 1; |
797 | return 1; |
795 | } |
798 | } |
796 | |
799 | |
797 | return 0; |
800 | return 0; |
798 | } |
801 | } |
… | |
… | |
838 | if (tl == NULL) |
841 | if (tl == NULL) |
839 | continue; |
842 | continue; |
840 | |
843 | |
841 | new_draw_info (NDI_UNIQUE, 0, op, "Something appears before your eyes. You catch it before it falls to the ground."); |
844 | new_draw_info (NDI_UNIQUE, 0, op, "Something appears before your eyes. You catch it before it falls to the ground."); |
842 | |
845 | |
843 | create_treasure (tl, op, GT_STARTEQUIP | GT_ONLY_GOOD | GT_UPDATE_INV, skill->level, 0); |
846 | create_treasure (tl, op, GT_STARTEQUIP | GT_ONLY_GOOD, skill->level, 0); |
844 | return; |
847 | return; |
845 | } |
848 | } |
846 | |
849 | |
847 | if (!tr->item) |
850 | if (!tr->item) |
848 | continue; |
851 | continue; |