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.46 by root, Tue May 1 05:48:19 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}
852 contr->gen_grace = 0; 850 contr->gen_grace = 0;
853 contr->gen_sp_armour = 10; 851 contr->gen_sp_armour = 10;
854 contr->item_power = 0; 852 contr->item_power = 0;
855 } 853 }
856 854
857 memcpy (body_used, body_info, sizeof (body_info)); 855 for (int i = NUM_BODY_LOCATIONS; i--; )
856 slot[i].used = slot[i].info;
858 857
859 slaying = 0; 858 slaying = 0;
860 859
861 if (!QUERY_FLAG (this, FLAG_WIZ)) 860 if (!QUERY_FLAG (this, FLAG_WIZ))
862 { 861 {
963 * in the praying skill, and the player should always get those. 962 * in the praying skill, and the player should always get those.
964 * 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,
965 * because the skill shouldn't count against body positions being used 964 * because the skill shouldn't count against body positions being used
966 * up, etc. 965 * up, etc.
967 */ 966 */
968 if ((QUERY_FLAG (tmp, FLAG_APPLIED) 967 if ((tmp->flag [FLAG_APPLIED]
969 && tmp->type != CONTAINER 968 && tmp->type != CONTAINER
970 && tmp->type != CLOSE_CON) 969 && tmp->type != CLOSE_CON)
971 || (tmp->type == SKILL 970 || (tmp->type == SKILL
972 && tmp->subtype == SK_PRAYING)) 971 && tmp->subtype == SK_PRAYING))
973 { 972 {
974 if (type == PLAYER) 973 if (type == PLAYER)
975 { 974 {
976 if ((tmp->type == WEAPON || tmp->type == BOW) 975 if (tmp == contr->combat_ob || tmp == contr->ranged_ob)
977 && tmp != current_weapon) 976 if (tmp != current_weapon && (tmp->type != SKILL || tmp->subtype != SK_PRAYING))
978 continue; 977 continue;
979 978
980 for (i = 0; i < NUM_STATS; i++) 979 for (i = 0; i < NUM_STATS; i++)
981 change_attr_value (&stats, i, get_attr_value (&tmp->stats, i)); 980 change_attr_value (&stats, i, get_attr_value (&tmp->stats, i));
982 981
983 /* these are the items that currently can change digestion, regeneration, 982 /* these are the items that currently can change digestion, regeneration,
984 * 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
985 * list, but other items store other info into stats array. 984 * list, but other items store other info into stats array.
986 */ 985 */
987 if ((tmp->type == WEAPON) || (tmp->type == BOW) || 986 if (tmp->type == WEAPON || tmp->type == BOW ||
988 (tmp->type == ARMOUR) || (tmp->type == HELMET) || 987 tmp->type == ARMOUR || tmp->type == HELMET ||
989 (tmp->type == SHIELD) || (tmp->type == RING) || 988 tmp->type == SHIELD || tmp->type == RING ||
990 (tmp->type == BOOTS) || (tmp->type == GLOVES) || 989 tmp->type == BOOTS || tmp->type == GLOVES ||
991 (tmp->type == AMULET) || (tmp->type == GIRDLE) || 990 tmp->type == AMULET || tmp->type == GIRDLE ||
992 (tmp->type == BRACERS) || (tmp->type == CLOAK) || 991 tmp->type == BRACERS || tmp->type == CLOAK ||
993 (tmp->type == DISEASE) || (tmp->type == FORCE) || 992 tmp->type == DISEASE || tmp->type == FORCE ||
994 (tmp->type == SKILL)) 993 tmp->type == SKILL)
995 { 994 {
996 contr->digestion += tmp->stats.food; 995 contr->digestion += tmp->stats.food;
997 contr->gen_hp += tmp->stats.hp; 996 contr->gen_hp += tmp->stats.hp;
998 contr->gen_sp += tmp->stats.sp; 997 contr->gen_sp += tmp->stats.sp;
999 contr->gen_grace += tmp->stats.grace; 998 contr->gen_grace += tmp->stats.grace;
1008 } 1007 }
1009 1008
1010 /* Update slots used for items */ 1009 /* Update slots used for items */
1011 if (QUERY_FLAG (tmp, FLAG_APPLIED)) 1010 if (QUERY_FLAG (tmp, FLAG_APPLIED))
1012 for (i = 0; i < NUM_BODY_LOCATIONS; i++) 1011 for (i = 0; i < NUM_BODY_LOCATIONS; i++)
1013 body_used[i] += tmp->body_info[i]; 1012 slot[i].used += tmp->slot[i].info;
1014 1013
1015 if (tmp->type == SYMPTOM) 1014 if (tmp->type == SYMPTOM)
1016 { 1015 {
1017 speed_reduce_from_disease = tmp->last_sp / 100.f; 1016 speed_reduce_from_disease = tmp->last_sp / 100.f;
1018 1017

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines