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.48 by root, Fri May 11 19:41:05 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}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines