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

Comparing deliantra/server/common/living.C (file contents):
Revision 1.47 by root, Mon May 7 03:05:57 2007 UTC vs.
Revision 1.49 by root, Sat May 12 17:26:51 2007 UTC

357/* flag is set to 1 if we are applying the object, -1 if we are removing 357/* flag is set to 1 if we are applying the object, -1 if we are removing
358 * the object. 358 * the object.
359 * It is the calling functions responsibilty to check to see if the object 359 * It is the calling functions responsibilty to check to see if the object
360 * can be applied or not. 360 * can be applied or not.
361 * The main purpose of calling this function is the messages that are 361 * The main purpose of calling this function is the messages that are
362 * displayed - fix_player should really always be called after this when 362 * displayed - update_stats should really always be called after this when
363 * removing an object - that is because it is impossible to know if some object 363 * removing an object - that is because it is impossible to know if some object
364 * is the only source of an attacktype or spell attunement, so this function 364 * is the only source of an attacktype or spell attunement, so this function
365 * will clear the bits, but the player may still have some other object 365 * will clear the bits, but the player may still have some other object
366 * that gives them that ability. 366 * that gives them that ability.
367 */ 367 */
398 * that adjust that stat by more than one point, so we need 398 * that adjust that stat by more than one point, so we need
399 * to allow for that. 399 * to allow for that.
400 */ 400 */
401 if (nstat < 1 && i * flag < 0) 401 if (nstat < 1 && i * flag < 0)
402 nstat = 1; 402 nstat = 1;
403 else if (nstat > 20 + get_attr_value (&(op->arch->clone.stats), j)) 403 else if (nstat > 20 + get_attr_value (&op->arch->clone.stats, j))
404 {
405 nstat = 20 + get_attr_value (&(op->arch->clone.stats), j); 404 nstat = 20 + get_attr_value (&op->arch->clone.stats, j);
406 }
407 405
408 if (nstat != ostat) 406 if (nstat != ostat)
409 { 407 {
410 set_attr_value (&(op->contr->orig_stats), j, nstat); 408 set_attr_value (&op->contr->orig_stats, j, nstat);
411 potion_max = 0; 409 potion_max = 0;
412 } 410 }
413 else if (i) 411 else if (i)
414 { 412 {
415 /* potion is useless - player has already hit the natural maximum */ 413 /* potion is useless - player has already hit the natural maximum */
420 /* This section of code ups the characters normal stats also. I am not 418 /* This section of code ups the characters normal stats also. I am not
421 * sure if this is strictly necessary, being that fix_player probably 419 * sure if this is strictly necessary, being that fix_player probably
422 * recalculates this anyway. 420 * recalculates this anyway.
423 */ 421 */
424 for (j = 0; j < NUM_STATS; j++) 422 for (j = 0; j < NUM_STATS; j++)
425 change_attr_value (&(op->stats), j, flag * get_attr_value (&(tmp->stats), j)); 423 change_attr_value (&op->stats, j, flag * get_attr_value (&tmp->stats, j));
426 424
427 check_stat_bounds (&(op->stats)); 425 check_stat_bounds (&op->stats);
428 } /* end of potion handling code */ 426 } /* end of potion handling code */
429 } 427 }
430 428
431 /* reset attributes that fix_player doesn't reset since it doesn't search 429 /* reset attributes that fix_player doesn't reset since it doesn't search
432 * everything to set 430 * everything to set
433 */ 431 */
434 if (flag == -1) 432 if (flag == -1)
435 { 433 {
436 op->attacktype &= ~tmp->attacktype; 434 op->attacktype &= ~tmp->attacktype;
437 op->path_attuned &= ~tmp->path_attuned; 435 op->path_attuned &= ~tmp->path_attuned;
438 op->path_repelled &= ~tmp->path_repelled; 436 op->path_repelled &= ~tmp->path_repelled;
439 op->path_denied &= ~tmp->path_denied; 437 op->path_denied &= ~tmp->path_denied;
440 /* Presuming here that creatures only have move_type, 438 /* Presuming here that creatures only have move_type,
441 * and not the other move_ fields. 439 * and not the other move_ fields.
442 */ 440 */
443 op->move_type &= ~tmp->move_type; 441 op->move_type &= ~tmp->move_type;
444 } 442 }
445 443
446 /* call fix_player since op object could have whatever attribute due 444 /* call fix_player since op object could have whatever attribute due
447 * to multiple items. if fix_player always has to be called after 445 * to multiple items. if fix_player always has to be called after
448 * change_ability then might as well call it from here 446 * change_ability then might as well call it from here
449 */ 447 */
450 op->update_stats (); 448 op->update_stats ();
451 449
452 /* Fix player won't add the bows ability to the player, so don't 450 /* Fix player won't add the bows ability to the player, so don't
500 * in that case, you don't actually land 498 * in that case, you don't actually land
501 */ 499 */
502 DIFF_MSG (flag, "You soar into the air air!.", 500 DIFF_MSG (flag, "You soar into the air air!.",
503 (op->move_type & MOVE_FLY_LOW ? "You fly lower in the air" : "You float down to the ground.")); 501 (op->move_type & MOVE_FLY_LOW ? "You fly lower in the air" : "You float down to the ground."));
504 } 502 }
503
505 if (tmp->move_type & MOVE_SWIM) 504 if (tmp->move_type & MOVE_SWIM)
506 DIFF_MSG (flag, "You feel ready for a swim", "You no longer feel like swimming"); 505 DIFF_MSG (flag, "You feel ready for a swim", "You no longer feel like swimming");
507 506
508 /* Changing move status may mean you are affected by things you weren't before */ 507 /* Changing move status may mean you are affected by things you weren't before */
509 check_move_on (op, op); 508 check_move_on (op, op);
673 672
674/* 673/*
675 * Stat draining by Vick 930307 674 * Stat draining by Vick 930307
676 * (Feeling evil, I made it work as well now. -Frank 8) 675 * (Feeling evil, I made it work as well now. -Frank 8)
677 */ 676 */
678
679void 677void
680object::drain_stat () 678object::drain_stat ()
681{ 679{
682 drain_specific_stat (rndm (NUM_STATS)); 680 drain_specific_stat (rndm (NUM_STATS));
683} 681}
964 * in the praying skill, and the player should always get those. 962 * in the praying skill, and the player should always get those.
965 * It also means we need to put in additional checks for applied below, 963 * It also means we need to put in additional checks for applied below,
966 * because the skill shouldn't count against body positions being used 964 * because the skill shouldn't count against body positions being used
967 * up, etc. 965 * up, etc.
968 */ 966 */
969 if ((QUERY_FLAG (tmp, FLAG_APPLIED) 967 if ((tmp->flag [FLAG_APPLIED]
970 && tmp->type != CONTAINER 968 && tmp->type != CONTAINER
971 && tmp->type != CLOSE_CON) 969 && tmp->type != CLOSE_CON)
972 || (tmp->type == SKILL 970 || (tmp->type == SKILL
973 && tmp->subtype == SK_PRAYING)) 971 && tmp->subtype == SK_PRAYING))
974 { 972 {
975 if (type == PLAYER) 973 if (type == PLAYER)
976 { 974 {
977 if ((tmp->type == WEAPON || tmp->type == BOW) 975 if (tmp == contr->combat_ob || tmp == contr->ranged_ob)
978 && tmp != current_weapon) 976 if (tmp != current_weapon && (tmp->type != SKILL || tmp->subtype != SK_PRAYING))
979 continue; 977 continue;
980 978
981 for (i = 0; i < NUM_STATS; i++) 979 for (i = 0; i < NUM_STATS; i++)
982 change_attr_value (&stats, i, get_attr_value (&tmp->stats, i)); 980 change_attr_value (&stats, i, get_attr_value (&tmp->stats, i));
983 981
984 /* these are the items that currently can change digestion, regeneration, 982 /* these are the items that currently can change digestion, regeneration,
985 * spell point recovery and mana point recovery. Seems sort of an arbitary 983 * spell point recovery and mana point recovery. Seems sort of an arbitary
986 * list, but other items store other info into stats array. 984 * list, but other items store other info into stats array.
987 */ 985 */
988 if ((tmp->type == WEAPON) || (tmp->type == BOW) || 986 if (tmp->type == WEAPON || tmp->type == BOW ||
989 (tmp->type == ARMOUR) || (tmp->type == HELMET) || 987 tmp->type == ARMOUR || tmp->type == HELMET ||
990 (tmp->type == SHIELD) || (tmp->type == RING) || 988 tmp->type == SHIELD || tmp->type == RING ||
991 (tmp->type == BOOTS) || (tmp->type == GLOVES) || 989 tmp->type == BOOTS || tmp->type == GLOVES ||
992 (tmp->type == AMULET) || (tmp->type == GIRDLE) || 990 tmp->type == AMULET || tmp->type == GIRDLE ||
993 (tmp->type == BRACERS) || (tmp->type == CLOAK) || 991 tmp->type == BRACERS || tmp->type == CLOAK ||
994 (tmp->type == DISEASE) || (tmp->type == FORCE) || 992 tmp->type == DISEASE || tmp->type == FORCE ||
995 (tmp->type == SKILL)) 993 tmp->type == SKILL)
996 { 994 {
997 contr->digestion += tmp->stats.food; 995 contr->digestion += tmp->stats.food;
998 contr->gen_hp += tmp->stats.hp; 996 contr->gen_hp += tmp->stats.hp;
999 contr->gen_sp += tmp->stats.sp; 997 contr->gen_sp += tmp->stats.sp;
1000 contr->gen_grace += tmp->stats.grace; 998 contr->gen_grace += tmp->stats.grace;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines