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.114 by root, Sun Mar 28 18:44:21 2010 UTC vs.
Revision 1.115 by root, Fri Apr 2 03:41:24 2010 UTC

810 path_repelled = arch->path_repelled; 810 path_repelled = arch->path_repelled;
811 path_denied = arch->path_denied; 811 path_denied = arch->path_denied;
812 glow_radius = arch->glow_radius; 812 glow_radius = arch->glow_radius;
813 move_type = arch->move_type; 813 move_type = arch->move_type;
814 814
815 object *chosen_skill = 0;
816
817 /* initializing resistances from the values in player/monster's 815 /* initializing resistances from the values in player/monster's
818 * archetype clone 816 * archetype clone
819 */ 817 */
820 memcpy (&resist, &arch->resist, sizeof (resist)); 818 memcpy (&resist, &arch->resist, sizeof (resist));
821 819
847 else 845 else
848 ac = arch->stats.ac; 846 ac = arch->stats.ac;
849 847
850 stats.luck = arch->stats.luck; 848 stats.luck = arch->stats.luck;
851 speed = arch->speed; 849 speed = arch->speed;
850
851 chosen_skill = 0;
852 852
853 /* OK - we've reset most all the objects attributes to sane values. 853 /* OK - we've reset most all the objects attributes to sane values.
854 * now go through and make adjustments for what the player has equipped. 854 * now go through and make adjustments for what the player has equipped.
855 */ 855 */
856 for (tmp = inv; tmp; tmp = tmp->below) 856 for (tmp = inv; tmp; tmp = tmp->below)
900 || (tmp->type == SKILL && tmp->subtype == SK_PRAYING)) 900 || (tmp->type == SKILL && tmp->subtype == SK_PRAYING))
901 { 901 {
902 if (type == PLAYER) 902 if (type == PLAYER)
903 { 903 {
904 contr->item_power += tmp->item_power; 904 contr->item_power += tmp->item_power;
905
906 if (tmp == contr->combat_ob || tmp == contr->ranged_ob)
907 if (tmp != current_weapon
908 && (tmp->type != SKILL || tmp->subtype != SK_PRAYING)
909 && !tmp->flag [FLAG_CURSED]
910 && !tmp->flag [FLAG_DAMNED])
911 continue;
912 905
913 for (int i = 0; i < NUM_STATS; i++) 906 for (int i = 0; i < NUM_STATS; i++)
914 stat_sum [i] += tmp->stats.stat (i); 907 stat_sum [i] += tmp->stats.stat (i);
915 908
916 if (digest_types [tmp->type]) 909 if (digest_types [tmp->type])
928 if (tmp->type == WEAPON) 921 if (tmp->type == WEAPON)
929 current_weapon = tmp; 922 current_weapon = tmp;
930 } 923 }
931 924
932 /* Update slots used for items */ 925 /* Update slots used for items */
933 if (tmp->flag [FLAG_APPLIED]) 926 if (tmp->flag [FLAG_APPLIED]) // exclude praying...
934 for (int i = 0; i < NUM_BODY_LOCATIONS; i++) 927 for (int i = 0; i < NUM_BODY_LOCATIONS; i++)
935 slot[i].used += tmp->slot[i].info; 928 slot[i].used += tmp->slot[i].info;
936 929
937 if (tmp->type == SYMPTOM) 930 if (tmp->type == SYMPTOM)
938 min_it (speed_reduce_from_disease, tmp->last_sp ? tmp->last_sp / 100.f : 1.f); 931 min_it (speed_reduce_from_disease, tmp->last_sp ? tmp->last_sp / 100.f : 1.f);
966 flag |= tmp->flag & copy_flags; 959 flag |= tmp->flag & copy_flags;
967 960
968 if (QUERY_FLAG (tmp, FLAG_UNDEAD) && !QUERY_FLAG (arch, FLAG_UNDEAD)) 961 if (QUERY_FLAG (tmp, FLAG_UNDEAD) && !QUERY_FLAG (arch, FLAG_UNDEAD))
969 SET_FLAG (this, FLAG_UNDEAD); 962 SET_FLAG (this, FLAG_UNDEAD);
970 963
964 //TODO: copy_flags?
971 if (QUERY_FLAG (tmp, FLAG_MAKE_INVIS)) 965 if (QUERY_FLAG (tmp, FLAG_MAKE_INVIS))
972 { 966 {
973 SET_FLAG (this, FLAG_MAKE_INVIS); 967 SET_FLAG (this, FLAG_MAKE_INVIS);
974 invisible = 1; 968 invisible = 1;
975 } 969 }
985 added_speed += tmp->stats.exp; 979 added_speed += tmp->stats.exp;
986 } 980 }
987 981
988 switch (tmp->type) 982 switch (tmp->type)
989 { 983 {
990 /* skills modifying the character -b.t. */
991 /* for all skills and skill granting objects */
992 case SKILL: 984 case SKILL:
993 { 985 {
986 // some skills will end up here without counting as "applied"
994 if (!QUERY_FLAG (tmp, FLAG_APPLIED) || skill_flags [tmp->subtype] & SF_APPLY) 987 if (!tmp->flag [FLAG_APPLIED] || skill_flags [tmp->subtype] & SF_APPLY)
995 break; 988 break;
996 989
997 if (chosen_skill) 990 if (chosen_skill)
998 { 991 {
999 LOG (llevDebug, "fix_player, op %s has multiple skills applied (%s and %s)\n", 992 LOG (llevDebug, "fix_player, op %s has multiple skills applied (%s and %s)\n",
1001 994
1002 tmp->flag [FLAG_APPLIED] = false; 995 tmp->flag [FLAG_APPLIED] = false;
1003 update_stats (); 996 update_stats ();
1004 return; 997 return;
1005 } 998 }
1006 else 999
1007 chosen_skill = tmp; 1000 chosen_skill = tmp;
1008 1001
1009 if (tmp->stats.dam > 0) 1002 if (tmp->stats.dam > 0)
1010 { /* skill is a 'weapon' */ 1003 { /* skill is a 'weapon' */
1011 if (!QUERY_FLAG (this, FLAG_READY_WEAPON)) 1004 if (!QUERY_FLAG (this, FLAG_READY_WEAPON))
1012 weapon_speed = WEAPON_SPEED (tmp); 1005 weapon_speed = max (0, WEAPON_SPEED (tmp));
1013
1014 if (weapon_speed < 0)
1015 weapon_speed = 0;
1016 1006
1017 weapon_weight = tmp->weight; 1007 weapon_weight = tmp->weight;
1018 stats.dam += 1 + chosen_skill->level * tmp->stats.dam / 9; 1008 stats.dam += 1 + chosen_skill->level * tmp->stats.dam / 9;
1019 1009
1020 if (tmp->magic) 1010 if (tmp->magic)
1059 break; 1049 break;
1060 1050
1061 case WAND: 1051 case WAND:
1062 case ROD: 1052 case ROD:
1063 case HORN: 1053 case HORN:
1064 case SKILL_TOOL:
1065 if (type != PLAYER)
1066 chosen_skill = find_skill_by_name (this, tmp->skill);
1067 break; 1054 break;
1068 1055
1069 case BOW: 1056 case BOW:
1070 case WEAPON: 1057 case WEAPON:
1071 if (type != PLAYER || current_weapon == tmp)
1072 {
1073 chosen_skill = find_skill_by_name (this, tmp->skill);
1074
1075 wc -= tmp->stats.wc + tmp->magic; 1058 wc -= tmp->stats.wc + tmp->magic;
1076 1059
1077 if (tmp->stats.ac && tmp->stats.ac + tmp->magic > 0) 1060 if (tmp->stats.ac && tmp->stats.ac + tmp->magic > 0)
1078 ac -= tmp->stats.ac + tmp->magic; 1061 ac -= tmp->stats.ac + tmp->magic;
1079 1062
1080 stats.dam += tmp->stats.dam + tmp->magic; 1063 stats.dam += tmp->stats.dam + tmp->magic;
1081 weapon_weight = tmp->weight; 1064 weapon_weight = tmp->weight;
1082 weapon_speed = (WEAPON_SPEED (tmp) * 2 - tmp->magic) / 2; 1065 weapon_speed = (WEAPON_SPEED (tmp) * 2 - tmp->magic) / 2;
1083 1066
1084 if (weapon_speed < 0) 1067 if (weapon_speed < 0)
1085 weapon_speed = 0; 1068 weapon_speed = 0;
1086 1069
1087 slaying = tmp->slaying; 1070 slaying = tmp->slaying;
1088 1071
1089 /* If there is desire that two handed weapons should do 1072 /* If there is desire that two handed weapons should do
1090 * extra strength damage, this is where the code should 1073 * extra strength damage, this is where the code should
1091 * go. 1074 * go.
1092 */ 1075 */
1093 1076
1094 if (type == PLAYER) 1077 if (type == PLAYER)
1095 if (settings.spell_encumbrance) 1078 if (settings.spell_encumbrance)
1096 contr->encumbrance += tmp->weight * 3 / 1000; 1079 contr->encumbrance += tmp->weight * 3 / 1000;
1097 }
1098 1080
1099 break; 1081 break;
1100 1082
1101 case ARMOUR: /* Only the best of these three are used: */ 1083 case ARMOUR: /* Only the best of these three are used: */
1102 if (settings.spell_encumbrance == TRUE && type == PLAYER) 1084 if (settings.spell_encumbrance == TRUE && type == PLAYER)
1137 1119
1138 break; 1120 break;
1139 } /* switch tmp->type */ 1121 } /* switch tmp->type */
1140 } /* item is equipped */ 1122 } /* item is equipped */
1141 } /* for loop of items */ 1123 } /* for loop of items */
1142
1143 if (type != PLAYER)
1144 this->chosen_skill = chosen_skill;
1145 1124
1146 min_it (glow_radius, MAX_LIGHT_RADIUS); 1125 min_it (glow_radius, MAX_LIGHT_RADIUS);
1147 1126
1148 /* We've gone through all the objects the player has equipped. For many things, we 1127 /* We've gone through all the objects the player has equipped. For many things, we
1149 * have generated intermediate values which we now need to assign. 1128 * have generated intermediate values which we now need to assign.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines