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

Comparing deliantra/server/server/skill_util.C (file contents):
Revision 1.13 by root, Sat Sep 16 22:24:13 2006 UTC vs.
Revision 1.15 by root, Mon Dec 4 20:39:32 2006 UTC

691 691
692 /* player already knows it */ 692 /* player already knows it */
693 if (tmp && QUERY_FLAG (tmp, FLAG_CAN_USE_SKILL)) 693 if (tmp && QUERY_FLAG (tmp, FLAG_CAN_USE_SKILL))
694 return 0; 694 return 0;
695 695
696
697
698 /* now a random change to learn, based on player Int. 696 /* now a random change to learn, based on player Int.
699 * give bonus based on level - otherwise stupid characters 697 * give bonus based on level - otherwise stupid characters
700 * might never be able to learn anything. 698 * might never be able to learn anything.
701 */ 699 */
702 if (random_roll (0, 99, pl, PREFER_LOW) > (learn_spell[pl->stats.Int] + (pl->level / 5))) 700 if (random_roll (0, 99, pl, PREFER_LOW) > (learn_spell[pl->stats.Int] + (pl->level / 5)))
875 if (do_skill (op, op, skop, op->facing, string)) 873 if (do_skill (op, op, skop, op->facing, string))
876 return 1; 874 return 1;
877 875
878 return 0; 876 return 0;
879} 877}
880
881
882 878
883/* This finds the best unarmed skill the player has, and returns 879/* This finds the best unarmed skill the player has, and returns
884 * it. Best can vary a little - we consider clawing to always 880 * it. Best can vary a little - we consider clawing to always
885 * be the best for dragons. 881 * be the best for dragons.
886 * This could be more intelligent, eg, look at the skill level 882 * This could be more intelligent, eg, look at the skill level
909 905
910 /* The order in the array is preferred order. So basically, 906 /* The order in the array is preferred order. So basically,
911 * we just cut down the number to search - eg, if we find a skill 907 * we just cut down the number to search - eg, if we find a skill
912 * early on in flame touch, then we only need to look into the unarmed_array 908 * early on in flame touch, then we only need to look into the unarmed_array
913 * to the entry before flame touch - don't care about the entries afterward, 909 * to the entry before flame touch - don't care about the entries afterward,
914 * because they are infrerior skills. 910 * because they are inferior skills.
915 * if we end up finding the best skill (i==0) might as well return
916 * right away - can't get any better than that.
917 */ 911 */
918 for (i = 0; i < last_skill; i++) 912 for (i = 0; i < last_skill; i++)
919 {
920 if (tmp->subtype == unarmed_skills[i] && QUERY_FLAG (tmp, FLAG_CAN_USE_SKILL)) 913 if (tmp->subtype == unarmed_skills[i] && QUERY_FLAG (tmp, FLAG_CAN_USE_SKILL))
921 { 914 {
922 best_skill = tmp; 915 best_skill = tmp;
923 last_skill = i; 916 last_skill = i;
924 if (i == 0)
925 return best_skill;
926 } 917 }
927 } 918 }
928 }
929 } 919 }
920
930 return best_skill; 921 return best_skill;
931} 922}
932 923
933/* do_skill_attack() - We have got an appropriate opponent from either 924/* do_skill_attack() - We have got an appropriate opponent from either
934 * move_player_attack() or skill_attack(). In this part we get on with 925 * move_player_attack() or skill_attack(). In this part we get on with

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines