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.68 by root, Sat Oct 17 21:40:38 2009 UTC vs.
Revision 1.72 by root, Sat Nov 7 18:30:06 2009 UTC

49 return -1; 49 return -1;
50 } 50 }
51 51
52 /* ADJUSTMENTS */ 52 /* ADJUSTMENTS */
53 53
54 /* Its harder to steal from hostile beings! */ 54 /* It's harder to steal from hostile beings! */
55 if (!QUERY_FLAG (victim, FLAG_UNAGGRESSIVE)) 55 if (!QUERY_FLAG (victim, FLAG_UNAGGRESSIVE))
56 roll = roll / 2; 56 roll = roll / 2;
57 57
58 /* Easier to steal from sleeping beings, or if the thief is 58 /* Easier to steal from sleeping beings, or if the thief is
59 * unseen */ 59 * unseen */
315 // reduce monster experience by experience we gained, as to 315 // reduce monster experience by experience we gained, as to
316 // limit the amount of exp that can be gained by stealing from monsters 316 // limit the amount of exp that can be gained by stealing from monsters
317 // (jessies gave ~20,000,000 exp otherwise. 317 // (jessies gave ~20,000,000 exp otherwise.
318 int exp = calc_skill_exp (op, tmp, skill); 318 int exp = calc_skill_exp (op, tmp, skill);
319 319
320 exp = MIN (tmp->stats.exp, exp); 320 exp = min (tmp->stats.exp, exp);
321 tmp->stats.exp -= exp; 321 tmp->stats.exp -= exp;
322 return exp; 322 return exp;
323 } 323 }
324 } 324 }
325 return 0; 325 return 0;
659} 659}
660 660
661/* Helper function for do_skill_ident, so that we can loop 661/* Helper function for do_skill_ident, so that we can loop
662 * over inventory AND objects on the ground conveniently. 662 * over inventory AND objects on the ground conveniently.
663 */ 663 */
664int 664static int
665do_skill_ident2 (object *tmp, object *pl, int obj_class, object *skill) 665do_skill_ident2 (object *tmp, object *pl, int obj_class, object *skill)
666{ 666{
667 int success = 0, chance; 667 int success = 0, chance;
668 int skill_value = skill->level * pl->stats.Int ? pl->stats.Int : 10; 668 int skill_value = skill->level * pl->stats.Int ? pl->stats.Int : 10;
669 669
925 925
926 if (pl->type != PLAYER) 926 if (pl->type != PLAYER)
927 return 0; /* only players use this skill */ 927 return 0; /* only players use this skill */
928 928
929 new_draw_info_format (NDI_UNIQUE, 0, pl, "You sing."); 929 new_draw_info_format (NDI_UNIQUE, 0, pl, "You sing.");
930 for (i = 0; i < MIN (skill->level, SIZEOFFREE); i++) 930 for (i = 0; i < min (skill->level, SIZEOFFREE); i++)
931 { 931 {
932 x = pl->x + freearr_x[i]; 932 x = pl->x + freearr_x[i];
933 y = pl->y + freearr_y[i]; 933 y = pl->y + freearr_y[i];
934 m = pl->map; 934 m = pl->map;
935 935
1072 mflags = get_map_flags (m, &m, x, y, &x, &y); 1072 mflags = get_map_flags (m, &m, x, y, &x, &y);
1073 if (mflags & P_OUT_OF_MAP) 1073 if (mflags & P_OUT_OF_MAP)
1074 continue; 1074 continue;
1075 1075
1076 /* Check everything in the square for trapness */ 1076 /* Check everything in the square for trapness */
1077 for (tmp = GET_MAP_OB (m, x, y); tmp != NULL; tmp = tmp->above) 1077 for (tmp = GET_MAP_OB (m, x, y); tmp; tmp = tmp->above)
1078 { 1078 {
1079 /* And now we'd better do an inventory traversal of each 1079 /* And now we'd better do an inventory traversal of each
1080 * of these objects inventory. Like above, only 1080 * of these objects inventory. Like above, only
1081 * do this for interesting objects. 1081 * do this for interesting objects.
1082 */ 1082 */
1083 1083
1084 if (tmp->type != PLAYER && !QUERY_FLAG (tmp, FLAG_MONSTER)) 1084 if (tmp->type != PLAYER && !QUERY_FLAG (tmp, FLAG_MONSTER))
1085 { 1085 {
1086 for (tmp2 = tmp->inv; tmp2 != NULL; tmp2 = tmp2->below) 1086 for (tmp2 = tmp->inv; tmp2; tmp2 = tmp2->below)
1087 if ((tmp2->type == RUNE || tmp2->type == TRAP) && tmp2->stats.Cha <= 1) 1087 if ((tmp2->type == RUNE || tmp2->type == TRAP) && tmp2->stats.Cha <= 1)
1088 { 1088 {
1089 trap_show (tmp2, tmp); 1089 trap_show (tmp2, tmp);
1090
1090 if (trap_disarm (op, tmp2, 1, skill) && (!tmp2->owner || tmp2->owner->type != PLAYER)) 1091 if (trap_disarm (op, tmp2, 1, skill) && (!tmp2->owner || tmp2->owner->type != PLAYER))
1091 { 1092 {
1092 tmp->stats.exp = tmp->stats.Cha * tmp->level; 1093 tmp->stats.exp = tmp->stats.Cha * tmp->level;
1093 success += calc_skill_exp (op, tmp2, skill); 1094 success += calc_skill_exp (op, tmp2, skill);
1094 } 1095 }
1095 } 1096 }
1096 } 1097 }
1098
1097 if ((tmp->type == RUNE || tmp->type == TRAP) && tmp->stats.Cha <= 1) 1099 if ((tmp->type == RUNE || tmp->type == TRAP) && tmp->stats.Cha <= 1)
1098 { 1100 {
1099 trap_show (tmp, tmp); 1101 trap_show (tmp, tmp);
1100 1102
1101 if (trap_disarm (op, tmp, 1, skill) && (!tmp->owner || tmp->owner->type != PLAYER)) 1103 if (trap_disarm (op, tmp, 1, skill) && (!tmp->owner || tmp->owner->type != PLAYER))
1312 1314
1313 pl->contr->play_sound (sound_find ("inscribe_success")); 1315 pl->contr->play_sound (sound_find ("inscribe_success"));
1314 1316
1315 if (!confused) 1317 if (!confused)
1316 { 1318 {
1317 newscroll->level = MAX (skill->level, chosen_spell->level); 1319 newscroll->level = max (skill->level, chosen_spell->level);
1318 newscroll->flag [FLAG_IDENTIFIED] = true; 1320 newscroll->flag [FLAG_IDENTIFIED] = true;
1319 new_draw_info (NDI_UNIQUE, 0, pl, "You succeed in writing the spell."); 1321 new_draw_info (NDI_UNIQUE, 0, pl, "You succeed in writing the spell.");
1320 } 1322 }
1321 else 1323 else
1322 { 1324 {
1323 chosen_spell = find_random_spell_in_ob (pl, NULL); 1325 chosen_spell = find_random_spell_in_ob (pl, NULL);
1324 if (!chosen_spell) 1326 if (!chosen_spell)
1325 return 0; 1327 return 0;
1326 1328
1327 newscroll->level = MAX (skill->level, chosen_spell->level); 1329 newscroll->level = max (skill->level, chosen_spell->level);
1328 new_draw_info (NDI_UNIQUE, 0, pl, "In your confused state, you write down some odd spell."); 1330 new_draw_info (NDI_UNIQUE, 0, pl, "In your confused state, you write down some odd spell.");
1329 } 1331 }
1330 1332
1331 object *tmp = chosen_spell->clone (); 1333 object *tmp = chosen_spell->clone ();
1332 insert_ob_in_ob (tmp, newscroll); 1334 insert_ob_in_ob (tmp, newscroll);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines