… | |
… | |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team |
4 | * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team |
5 | * Copyright (©) 2003,2007 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2003,2007 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
7 | * |
7 | * |
8 | * Crossfire TRT is free software; you can redistribute it and/or modify it |
8 | * Crossfire TRT is free software: you can redistribute it and/or modify |
9 | * under the terms of the GNU General Public License as published by the Free |
9 | * it under the terms of the GNU General Public License as published by |
10 | * Software Foundation; either version 2 of the License, or (at your option) |
10 | * the Free Software Foundation, either version 3 of the License, or |
11 | * any later version. |
11 | * (at your option) any later version. |
12 | * |
12 | * |
13 | * This program is distributed in the hope that it will be useful, but |
13 | * This program is distributed in the hope that it will be useful, |
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | * for more details. |
16 | * GNU General Public License for more details. |
17 | * |
17 | * |
18 | * You should have received a copy of the GNU General Public License along |
18 | * You should have received a copy of the GNU General Public License |
19 | * with Crossfire TRT; if not, write to the Free Software Foundation, Inc. 51 |
19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 | * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
|
21 | * |
20 | * |
22 | * The authors can be reached via e-mail to <crossfire@schmorp.de> |
21 | * The authors can be reached via e-mail to <crossfire@schmorp.de> |
23 | */ |
22 | */ |
24 | |
23 | |
25 | #include <global.h> |
24 | #include <global.h> |
… | |
… | |
719 | /* do_skill_ident() - workhorse for skill_ident() -b.t. |
718 | /* do_skill_ident() - workhorse for skill_ident() -b.t. |
720 | */ |
719 | */ |
721 | static int |
720 | static int |
722 | do_skill_ident (object *pl, int obj_class, object *skill) |
721 | do_skill_ident (object *pl, int obj_class, object *skill) |
723 | { |
722 | { |
724 | object *tmp; |
|
|
725 | int success = 0; |
723 | int success = 0; |
726 | |
724 | |
727 | for (tmp = pl->inv; tmp; tmp = tmp->below) |
725 | for (object *tmp = pl->inv; tmp; tmp = tmp->below) |
728 | success += do_skill_ident2 (tmp, pl, obj_class, skill); |
726 | success += do_skill_ident2 (tmp, pl, obj_class, skill); |
729 | /* check the ground */ |
727 | /* check the ground */ |
730 | |
728 | |
731 | for (tmp = GET_MAP_OB (pl->map, pl->x, pl->y); tmp; tmp = tmp->above) |
729 | for (object *tmp = pl->ms ().bot; tmp; tmp = tmp->above) |
732 | success += do_skill_ident2 (tmp, pl, obj_class, skill); |
730 | success += do_skill_ident2 (tmp, pl, obj_class, skill); |
733 | |
731 | |
734 | return success; |
732 | return success; |
735 | } |
733 | } |
736 | |
734 | |
… | |
… | |
744 | |
742 | |
745 | new_draw_info (NDI_UNIQUE, 0, pl, "You look at the objects nearby..."); |
743 | new_draw_info (NDI_UNIQUE, 0, pl, "You look at the objects nearby..."); |
746 | |
744 | |
747 | switch (skill->subtype) |
745 | switch (skill->subtype) |
748 | { |
746 | { |
749 | case SK_SMITHERY: |
747 | case SK_SMITHERY: |
750 | success += do_skill_ident (pl, WEAPON, skill) + do_skill_ident (pl, ARMOUR, skill) |
748 | success += do_skill_ident (pl, WEAPON, skill) + do_skill_ident (pl, ARMOUR, skill) |
751 | + do_skill_ident (pl, BRACERS, skill) + do_skill_ident (pl, CLOAK, skill) |
749 | + do_skill_ident (pl, BRACERS, skill) + do_skill_ident (pl, CLOAK, skill) |
752 | + do_skill_ident (pl, BOOTS, skill) + do_skill_ident (pl, SHIELD, skill) |
750 | + do_skill_ident (pl, BOOTS, skill) + do_skill_ident (pl, SHIELD, skill) |
753 | + do_skill_ident (pl, GIRDLE, skill) + do_skill_ident (pl, HELMET, skill) + do_skill_ident (pl, GLOVES, skill); |
751 | + do_skill_ident (pl, GIRDLE, skill) + do_skill_ident (pl, HELMET, skill) + do_skill_ident (pl, GLOVES, skill); |
754 | break; |
752 | break; |
755 | |
753 | |
756 | case SK_BOWYER: |
754 | case SK_BOWYER: |
757 | success += do_skill_ident (pl, BOW, skill) + do_skill_ident (pl, ARROW, skill); |
755 | success += do_skill_ident (pl, BOW, skill) + do_skill_ident (pl, ARROW, skill); |
758 | break; |
756 | break; |
759 | |
757 | |
760 | case SK_ALCHEMY: |
758 | case SK_ALCHEMY: |
761 | success += do_skill_ident (pl, POTION, skill) + do_skill_ident (pl, POISON, skill) |
759 | success += do_skill_ident (pl, POTION, skill) + do_skill_ident (pl, POISON, skill) |
762 | + do_skill_ident (pl, CONTAINER, skill) + do_skill_ident (pl, DRINK, skill) + do_skill_ident (pl, INORGANIC, skill); |
760 | + do_skill_ident (pl, CONTAINER, skill) + do_skill_ident (pl, DRINK, skill) + do_skill_ident (pl, INORGANIC, skill); |
763 | break; |
761 | break; |
764 | |
762 | |
765 | case SK_WOODSMAN: |
763 | case SK_WOODSMAN: |
766 | success += do_skill_ident (pl, FOOD, skill) + do_skill_ident (pl, DRINK, skill) + do_skill_ident (pl, FLESH, skill); |
764 | success += do_skill_ident (pl, FOOD, skill) + do_skill_ident (pl, DRINK, skill) + do_skill_ident (pl, FLESH, skill); |
767 | break; |
765 | break; |
768 | |
766 | |
769 | case SK_JEWELER: |
767 | case SK_JEWELER: |
770 | success += do_skill_ident (pl, GEM, skill) + do_skill_ident (pl, RING, skill) + do_skill_ident (pl, AMULET, skill); |
768 | success += do_skill_ident (pl, GEM, skill) + do_skill_ident (pl, RING, skill) + do_skill_ident (pl, AMULET, skill); |
771 | break; |
769 | break; |
772 | |
770 | |
773 | case SK_LITERACY: |
771 | case SK_LITERACY: |
774 | success += do_skill_ident (pl, SPELLBOOK, skill) + do_skill_ident (pl, SCROLL, skill) + do_skill_ident (pl, BOOK, skill); |
772 | success += do_skill_ident (pl, SPELLBOOK, skill) + do_skill_ident (pl, SCROLL, skill) + do_skill_ident (pl, BOOK, skill); |
775 | break; |
773 | break; |
776 | |
774 | |
777 | case SK_THAUMATURGY: |
775 | case SK_THAUMATURGY: |
778 | success += do_skill_ident (pl, WAND, skill) + do_skill_ident (pl, ROD, skill) + do_skill_ident (pl, HORN, skill); |
776 | success += do_skill_ident (pl, WAND, skill) + do_skill_ident (pl, ROD, skill) + do_skill_ident (pl, HORN, skill); |
779 | break; |
777 | break; |
780 | |
778 | |
781 | case SK_DET_CURSE: |
779 | case SK_DET_CURSE: |
782 | success = do_skill_detect_curse (pl, skill); |
780 | success = do_skill_detect_curse (pl, skill); |
783 | if (success) |
781 | if (success) |
784 | new_draw_info (NDI_UNIQUE, 0, pl, "...and discover cursed items!"); |
782 | new_draw_info (NDI_UNIQUE, 0, pl, "...and discover cursed items!"); |
785 | break; |
783 | break; |
786 | |
784 | |
787 | case SK_DET_MAGIC: |
785 | case SK_DET_MAGIC: |
788 | success = do_skill_detect_magic (pl, skill); |
786 | success = do_skill_detect_magic (pl, skill); |
789 | if (success) |
787 | if (success) |
790 | new_draw_info (NDI_UNIQUE, 0, pl, "...and discover items imbued with mystic forces!"); |
788 | new_draw_info (NDI_UNIQUE, 0, pl, "...and discover items imbued with mystic forces!"); |
791 | break; |
789 | break; |
792 | |
790 | |
793 | default: |
791 | default: |
794 | LOG (llevError, "Error: bad call to skill_ident()\n"); |
792 | LOG (llevError, "Error: bad call to skill_ident()\n"); |
795 | return 0; |
793 | return 0; |
796 | break; |
794 | break; |
797 | } |
795 | } |
|
|
796 | |
798 | if (!success) |
797 | if (!success) |
799 | { |
|
|
800 | new_draw_info (NDI_UNIQUE, 0, pl, "...and learn nothing more."); |
798 | new_draw_info (NDI_UNIQUE, 0, pl, "...and learn nothing more."); |
801 | } |
799 | |
802 | return success; |
800 | return success; |
803 | } |
801 | } |
804 | |
802 | |
805 | /* players using this skill can 'charm' a monster -- |
803 | /* players using this skill can 'charm' a monster -- |
806 | * into working for them. It can only be used on |
804 | * into working for them. It can only be used on |