ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/skills.C
(Generate patch)

Comparing deliantra/server/server/skills.C (file contents):
Revision 1.33 by root, Fri May 18 13:15:29 2007 UTC vs.
Revision 1.34 by root, Fri May 18 13:54:52 2007 UTC

808 * -b.t. (thomas@astro.psu.edu) 808 * -b.t. (thomas@astro.psu.edu)
809 */ 809 */
810int 810int
811use_oratory (object *pl, int dir, object *skill) 811use_oratory (object *pl, int dir, object *skill)
812{ 812{
813 sint16 x = pl->x + freearr_x[dir], y = pl->y + freearr_y[dir];
814 int mflags, chance;
815 object *tmp;
816 maptile *m;
817
818 if (pl->type != PLAYER) 813 if (pl->type != PLAYER)
819 return 0; /* only players use this skill */ 814 return 0; /* only players use this skill */
820 815
816 sint16 x = pl->x + freearr_x[dir],
817 y = pl->y + freearr_y[dir];
821 m = pl->map; 818 maptile *m = pl->map;
819
822 mflags = get_map_flags (m, &m, x, y, &x, &y); 820 int mflags = get_map_flags (m, &m, x, y, &x, &y);
823 if (mflags & P_OUT_OF_MAP) 821 if (mflags & P_OUT_OF_MAP)
824 return 0; 822 return 0;
825 823
826 /* Save some processing - we have the flag already anyways 824 /* Save some processing - we have the flag already anyways
827 */ 825 */
829 { 827 {
830 new_draw_info (NDI_UNIQUE, 0, pl, "There is nothing to orate to."); 828 new_draw_info (NDI_UNIQUE, 0, pl, "There is nothing to orate to.");
831 return 0; 829 return 0;
832 } 830 }
833 831
832 object *tmp;
834 for (tmp = GET_MAP_OB (m, x, y); tmp; tmp = tmp->above) 833 for (tmp = GET_MAP_OB (m, x, y); tmp; tmp = tmp->above)
835 { 834 {
836 /* can't persuade players - return because there is nothing else 835 /* can't persuade players - return because there is nothing else
837 * on that space to charm. Same for multi space monsters and 836 * on that space to charm. Same for multi space monsters and
838 * special monsters - we don't allow them to be charmed, and there 837 * special monsters - we don't allow them to be charmed, and there
864 new_draw_info_format (NDI_UNIQUE, 0, pl, "Too bad the %s isn't listening!\n", query_name (tmp)); 863 new_draw_info_format (NDI_UNIQUE, 0, pl, "Too bad the %s isn't listening!\n", query_name (tmp));
865 return 0; 864 return 0;
866 } 865 }
867 866
868 /* it's already allied! */ 867 /* it's already allied! */
869 if (QUERY_FLAG (tmp, FLAG_FRIENDLY) && (tmp->attack_movement == PETMOVE)) 868 if (QUERY_FLAG (tmp, FLAG_FRIENDLY) && tmp->attack_movement == PETMOVE)
870 { 869 {
871 if (tmp->owner == pl) 870 if (tmp->owner == pl)
872 { 871 {
873 new_draw_info (NDI_UNIQUE, 0, pl, "Your follower loves your speech.\n"); 872 new_draw_info (NDI_UNIQUE, 0, pl, "Your follower loves your speech.\n");
874 return 0; 873 return 0;
892 /* In this case, you can't steal it from the other player */ 891 /* In this case, you can't steal it from the other player */
893 return 0; 892 return 0;
894 } 893 }
895 } /* Creature was already a pet of someone */ 894 } /* Creature was already a pet of someone */
896 895
897 chance = skill->level * 2 + (pl->stats.Cha - 2 * tmp->stats.Int) / 2; 896 int level = skill->level + (pl->stats.Cha - tmp->stats.Int) / 2;
898 897
899 /* Ok, got a 'sucker' lets try to make them a follower */ 898 /* Ok, got a 'sucker' lets try to make them a follower */
900 if (chance > 0 && tmp->level < (random_roll (0, chance - 1, pl, PREFER_HIGH) - 1)) 899 if (level > 0 && tmp->level < (random_roll (0, level - 1, pl, PREFER_HIGH) - 1))
901 { 900 {
902 new_draw_info_format (NDI_UNIQUE, 0, pl, "You convince the %s to become your follower.\n", query_name (tmp)); 901 new_draw_info_format (NDI_UNIQUE, 0, pl, "You convince the %s to become your follower.\n", query_name (tmp));
903 902
904 tmp->set_owner (pl); 903 tmp->set_owner (pl);
905 tmp->skill = skill->skill; 904 tmp->skill = skill->skill;
932 * successfully pacified the creature gets Int=1. Thus, a player 931 * successfully pacified the creature gets Int=1. Thus, a player
933 * may only pacify a creature once. 932 * may only pacify a creature once.
934 * BTW, I appologize for the naming of the skill, I couldnt think 933 * BTW, I appologize for the naming of the skill, I couldnt think
935 * of anything better! -b.t. 934 * of anything better! -b.t.
936 */ 935 */
937
938int 936int
939singing (object *pl, int dir, object *skill) 937singing (object *pl, int dir, object *skill)
940{ 938{
941 int i, exp = 0, chance, mflags; 939 int i, exp = 0;
942 object *tmp; 940 object *tmp;
943 maptile *m; 941 maptile *m;
944 sint16 x, y; 942 sint16 x, y;
945 943
946 if (pl->type != PLAYER) 944 if (pl->type != PLAYER)
951 { 949 {
952 x = pl->x + freearr_x[i]; 950 x = pl->x + freearr_x[i];
953 y = pl->y + freearr_y[i]; 951 y = pl->y + freearr_y[i];
954 m = pl->map; 952 m = pl->map;
955 953
956 mflags = get_map_flags (m, &m, x, y, &x, &y); 954 int mflags = get_map_flags (m, &m, x, y, &x, &y);
957 if (mflags & P_OUT_OF_MAP) 955 if (mflags & P_OUT_OF_MAP)
958 continue; 956 continue;
959 if (!(mflags & P_IS_ALIVE)) 957 if (!(mflags & P_IS_ALIVE))
960 continue; 958 continue;
961 959
980 978
981 /* stealing isn't really related (although, maybe it should 979 /* stealing isn't really related (although, maybe it should
982 * be). This is mainly to prevent singing to the same monster 980 * be). This is mainly to prevent singing to the same monster
983 * over and over again and getting exp for it. 981 * over and over again and getting exp for it.
984 */ 982 */
985 chance = skill->level * 2 + (pl->stats.Cha - 5 - tmp->stats.Int) / 2; 983 int level = skill->level + (pl->stats.Cha - 5 - tmp->stats.Int) / 2;
984
986 if (chance && tmp->level * 2 < random_roll (0, chance - 1, pl, PREFER_HIGH)) 985 if (level && tmp->level < random_roll (0, level - 1, pl, PREFER_HIGH))
987 { 986 {
988 SET_FLAG (tmp, FLAG_UNAGGRESSIVE); 987 SET_FLAG (tmp, FLAG_UNAGGRESSIVE);
989 new_draw_info_format (NDI_UNIQUE, 0, pl, "You calm down the %s\n", query_name (tmp)); 988 new_draw_info_format (NDI_UNIQUE, 0, pl, "You calm down the %s\n", query_name (tmp));
990 /* Give exp only if they are not aware */ 989 /* Give exp only if they are not aware */
990
991 if (!QUERY_FLAG (tmp, FLAG_NO_STEAL)) 991 if (!QUERY_FLAG (tmp, FLAG_NO_STEAL))
992 exp += calc_skill_exp (pl, tmp, skill); 992 exp += calc_skill_exp (pl, tmp, skill);
993
993 SET_FLAG (tmp, FLAG_NO_STEAL); 994 SET_FLAG (tmp, FLAG_NO_STEAL);
994 } 995 }
995 else 996 else
996 { 997 {
997 new_draw_info_format (NDI_UNIQUE, 0, pl, "Too bad the %s isn't listening!\n", query_name (tmp)); 998 new_draw_info_format (NDI_UNIQUE, 0, pl, "Too bad the %s isn't listening!\n", query_name (tmp));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines