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.42 by root, Sun Apr 29 18:32:18 2007 UTC vs.
Revision 1.47 by root, Mon May 7 03:05:57 2007 UTC

850 contr->gen_hp = 0; 850 contr->gen_hp = 0;
851 contr->gen_sp = 0; 851 contr->gen_sp = 0;
852 contr->gen_grace = 0; 852 contr->gen_grace = 0;
853 contr->gen_sp_armour = 10; 853 contr->gen_sp_armour = 10;
854 contr->item_power = 0; 854 contr->item_power = 0;
855
856 /* Don't clobber all the range_ values. range_golem otherwise
857 * gets reset for no good reason, and we don't want to reset
858 * range_magic (what spell is readied). These three below
859 * well get filled in based on what the player has equipped.
860 */
861 contr->ranges[range_bow] = 0;
862 contr->ranges[range_misc] = 0;
863 contr->ranges[range_skill] = 0;
864 } 855 }
865 856
866 memcpy (body_used, body_info, sizeof (body_info)); 857 for (int i = NUM_BODY_LOCATIONS; i--; )
858 slot[i].used = slot[i].info;
867 859
868 slaying = 0; 860 slaying = 0;
869 861
870 if (!QUERY_FLAG (this, FLAG_WIZ)) 862 if (!QUERY_FLAG (this, FLAG_WIZ))
871 { 863 {
886 path_repelled = arch->clone.path_repelled; 878 path_repelled = arch->clone.path_repelled;
887 path_denied = arch->clone.path_denied; 879 path_denied = arch->clone.path_denied;
888 glow_radius = arch->clone.glow_radius; 880 glow_radius = arch->clone.glow_radius;
889 move_type = arch->clone.move_type; 881 move_type = arch->clone.move_type;
890 882
891 chosen_skill = NULL; 883 chosen_skill = 0;
892 884
893 /* initializing resistances from the values in player/monster's 885 /* initializing resistances from the values in player/monster's
894 * archetype clone 886 * archetype clone
895 */ 887 */
896 memcpy (&resist, &arch->clone.resist, sizeof (resist)); 888 memcpy (&resist, &arch->clone.resist, sizeof (resist));
899 { 891 {
900 if (resist[i] > 0) 892 if (resist[i] > 0)
901 prot[i] = resist[i], vuln[i] = 0; 893 prot[i] = resist[i], vuln[i] = 0;
902 else 894 else
903 vuln[i] = -(resist[i]), prot[i] = 0; 895 vuln[i] = -(resist[i]), prot[i] = 0;
896
904 potion_resist[i] = 0; 897 potion_resist[i] = 0;
905 } 898 }
906 899
907 wc = arch->clone.stats.wc; 900 wc = arch->clone.stats.wc;
908 stats.dam = arch->clone.stats.dam; 901 stats.dam = arch->clone.stats.dam;
979 || (tmp->type == SKILL 972 || (tmp->type == SKILL
980 && tmp->subtype == SK_PRAYING)) 973 && tmp->subtype == SK_PRAYING))
981 { 974 {
982 if (type == PLAYER) 975 if (type == PLAYER)
983 { 976 {
984 if (tmp->type == BOW)
985 contr->ranges[range_bow] = tmp;
986
987 if (tmp->type == WAND || tmp->type == ROD || tmp->type == HORN) 977 if ((tmp->type == WEAPON || tmp->type == BOW)
988 contr->ranges[range_misc] = tmp; 978 && tmp != current_weapon)
979 continue;
989 980
990 for (i = 0; i < NUM_STATS; i++) 981 for (i = 0; i < NUM_STATS; i++)
991 change_attr_value (&stats, i, get_attr_value (&tmp->stats, i)); 982 change_attr_value (&stats, i, get_attr_value (&tmp->stats, i));
992 983
993 /* these are the items that currently can change digestion, regeneration, 984 /* these are the items that currently can change digestion, regeneration,
1009 contr->gen_grace += tmp->stats.grace; 1000 contr->gen_grace += tmp->stats.grace;
1010 contr->gen_sp_armour += tmp->gen_sp_armour; 1001 contr->gen_sp_armour += tmp->gen_sp_armour;
1011 contr->item_power += tmp->item_power; 1002 contr->item_power += tmp->item_power;
1012 } 1003 }
1013 } /* if this is a player */ 1004 } /* if this is a player */
1005 else
1006 {
1007 if (tmp->type == WEAPON)
1008 current_weapon = tmp;
1009 }
1014 1010
1015 /* Update slots used for items */ 1011 /* Update slots used for items */
1016 if (QUERY_FLAG (tmp, FLAG_APPLIED)) 1012 if (QUERY_FLAG (tmp, FLAG_APPLIED))
1017 for (i = 0; i < NUM_BODY_LOCATIONS; i++) 1013 for (i = 0; i < NUM_BODY_LOCATIONS; i++)
1018 body_used[i] += tmp->body_info[i]; 1014 slot[i].used += tmp->slot[i].info;
1019 1015
1020 if (tmp->type == SYMPTOM) 1016 if (tmp->type == SYMPTOM)
1021 { 1017 {
1022 speed_reduce_from_disease = tmp->last_sp / 100.f; 1018 speed_reduce_from_disease = tmp->last_sp / 100.f;
1023 1019
1050 vuln[i] += ((100 - vuln[i]) * -tmp->resist[i]) / 100; 1046 vuln[i] += ((100 - vuln[i]) * -tmp->resist[i]) / 100;
1051 } 1047 }
1052 } 1048 }
1053 1049
1054 /* There may be other things that should not adjust the attacktype */ 1050 /* There may be other things that should not adjust the attacktype */
1055 if (tmp>-type != BOW && tmp->type != SYMPTOM) 1051 if ((tmp->type != WEAPON && tmp->type != BOW && tmp->type != SYMPTOM)
1052 || current_weapon == tmp)
1053 {
1056 attacktype |= tmp->attacktype; 1054 attacktype |= tmp->attacktype;
1057
1058 path_attuned |= tmp->path_attuned; 1055 path_attuned |= tmp->path_attuned;
1059 path_repelled |= tmp->path_repelled; 1056 path_repelled |= tmp->path_repelled;
1060 path_denied |= tmp->path_denied; 1057 path_denied |= tmp->path_denied;
1061 move_type |= tmp->move_type; 1058 move_type |= tmp->move_type;
1062 stats.luck += tmp->stats.luck; 1059 stats.luck += tmp->stats.luck;
1060 }
1063 1061
1064 if (QUERY_FLAG (tmp, FLAG_LIFESAVE )) SET_FLAG (this, FLAG_LIFESAVE); 1062 if (QUERY_FLAG (tmp, FLAG_LIFESAVE )) SET_FLAG (this, FLAG_LIFESAVE);
1065 if (QUERY_FLAG (tmp, FLAG_REFL_SPELL )) SET_FLAG (this, FLAG_REFL_SPELL); 1063 if (QUERY_FLAG (tmp, FLAG_REFL_SPELL )) SET_FLAG (this, FLAG_REFL_SPELL);
1066 if (QUERY_FLAG (tmp, FLAG_REFL_MISSILE)) SET_FLAG (this, FLAG_REFL_MISSILE); 1064 if (QUERY_FLAG (tmp, FLAG_REFL_MISSILE)) SET_FLAG (this, FLAG_REFL_MISSILE);
1067 if (QUERY_FLAG (tmp, FLAG_STEALTH )) SET_FLAG (this, FLAG_STEALTH); 1065 if (QUERY_FLAG (tmp, FLAG_STEALTH )) SET_FLAG (this, FLAG_STEALTH);
1081 if (tmp->stats.exp && tmp->type != SKILL) 1079 if (tmp->stats.exp && tmp->type != SKILL)
1082 { 1080 {
1083 if (tmp->stats.exp > 0) 1081 if (tmp->stats.exp > 0)
1084 { 1082 {
1085 added_speed += tmp->stats.exp / 3.f; 1083 added_speed += tmp->stats.exp / 3.f;
1086 bonus_speed += 1.f + tmp->stats.exp / 3.f; 1084 bonus_speed += tmp->stats.exp / 3.f + 1.f;
1087 } 1085 }
1088 else 1086 else
1089 added_speed += tmp->stats.exp; 1087 added_speed += tmp->stats.exp;
1090 } 1088 }
1091 1089
1092 switch (tmp->type) 1090 switch (tmp->type)
1093 { 1091 {
1092#if 0
1093 case WAND:
1094 case ROD:
1095 case HORN:
1096 if (type != PLAYER || current_weapon == tmp)
1097 chosen_skill = tmp;
1098 break;
1099#endif
1100
1094 /* skills modifying the character -b.t. */ 1101 /* skills modifying the character -b.t. */
1095 /* for all skills and skill granting objects */ 1102 /* for all skills and skill granting objects */
1096 case SKILL: 1103 case SKILL:
1097 if (!QUERY_FLAG (tmp, FLAG_APPLIED)) 1104 if (!QUERY_FLAG (tmp, FLAG_APPLIED))
1098 break; 1105 break;
1119 if (tmp->magic) 1126 if (tmp->magic)
1120 stats.dam += tmp->magic; 1127 stats.dam += tmp->magic;
1121 } 1128 }
1122 1129
1123 if (tmp->stats.wc) 1130 if (tmp->stats.wc)
1124 wc -= (tmp->stats.wc + tmp->magic); 1131 wc -= tmp->stats.wc + tmp->magic;
1125 1132
1126 if (tmp->slaying) 1133 if (tmp->slaying)
1127 slaying = tmp->slaying; 1134 slaying = tmp->slaying;
1128 1135
1129 if (tmp->stats.ac) 1136 if (tmp->stats.ac)
1130 ac -= (tmp->stats.ac + tmp->magic); 1137 ac -= tmp->stats.ac + tmp->magic;
1131 1138
1132 if (settings.spell_encumbrance == TRUE && type == PLAYER) 1139 if (settings.spell_encumbrance == TRUE && type == PLAYER)
1133 contr->encumbrance += (int) 3 *tmp->weight / 1000; 1140 contr->encumbrance += (int) 3 *tmp->weight / 1000;
1134
1135 if (type == PLAYER)
1136 contr->ranges[range_skill] = this;
1137 1141
1138 break; 1142 break;
1139 1143
1140 case SKILL_TOOL: 1144 case SKILL_TOOL:
1141 if (chosen_skill) 1145 if (chosen_skill)
1142 LOG (llevDebug, "fix_player, op %s has multiple skills applied\n", &name); 1146 LOG (llevDebug, "fix_player, op %s has multiple skills applied\n", &name);
1143 1147
1144 chosen_skill = tmp; 1148 chosen_skill = tmp;
1145
1146 if (type == PLAYER)
1147 contr->ranges[range_skill] = this;
1148 break; 1149 break;
1149 1150
1150 case SHIELD: 1151 case SHIELD:
1151 if (settings.spell_encumbrance == TRUE && type == PLAYER) 1152 if (settings.spell_encumbrance == TRUE && type == PLAYER)
1152 contr->encumbrance += (int) tmp->weight / 2000; 1153 contr->encumbrance += (int) tmp->weight / 2000;
1166 if (tmp->stats.ac) 1167 if (tmp->stats.ac)
1167 ac -= tmp->stats.ac + tmp->magic; 1168 ac -= tmp->stats.ac + tmp->magic;
1168 1169
1169 break; 1170 break;
1170 1171
1172 case BOW:
1171 case WEAPON: 1173 case WEAPON:
1174 if (type != PLAYER || current_weapon == tmp)
1175 {
1172 wc -= tmp->stats.wc + tmp->magic; 1176 wc -= tmp->stats.wc + tmp->magic;
1173 1177
1174 if (tmp->stats.ac && tmp->stats.ac + tmp->magic > 0) 1178 if (tmp->stats.ac && tmp->stats.ac + tmp->magic > 0)
1175 ac -= tmp->stats.ac + tmp->magic; 1179 ac -= tmp->stats.ac + tmp->magic;
1176 1180
1177 stats.dam += tmp->stats.dam + tmp->magic; 1181 stats.dam += tmp->stats.dam + tmp->magic;
1178 weapon_weight = tmp->weight; 1182 weapon_weight = tmp->weight;
1179 weapon_speed = (WEAPON_SPEED (tmp) * 2 - tmp->magic) / 2; 1183 weapon_speed = (WEAPON_SPEED (tmp) * 2 - tmp->magic) / 2;
1180 1184
1181 if (weapon_speed < 0) 1185 if (weapon_speed < 0)
1182 weapon_speed = 0; 1186 weapon_speed = 0;
1183 1187
1184 slaying = tmp->slaying; 1188 slaying = tmp->slaying;
1185 1189
1186 /* If there is desire that two handed weapons should do 1190 /* If there is desire that two handed weapons should do
1187 * extra strength damage, this is where the code should 1191 * extra strength damage, this is where the code should
1188 * go. 1192 * go.
1189 */ 1193 */
1190 1194
1191 current_weapon = tmp; 1195 if (type == PLAYER)
1192 if (type == PLAYER && settings.spell_encumbrance) 1196 if (settings.spell_encumbrance)
1193 contr->encumbrance += tmp->weight * 3 / 1000; 1197 contr->encumbrance += tmp->weight * 3 / 1000;
1198 }
1194 1199
1195 break; 1200 break;
1196 1201
1197 case ARMOUR: /* Only the best of these three are used: */ 1202 case ARMOUR: /* Only the best of these three are used: */
1198 if (settings.spell_encumbrance == TRUE && type == PLAYER) 1203 if (settings.spell_encumbrance == TRUE && type == PLAYER)
1823 sint64 limit, exp_to_add; 1828 sint64 limit, exp_to_add;
1824 int i; 1829 int i;
1825 1830
1826 /* prevents some forms of abuse. */ 1831 /* prevents some forms of abuse. */
1827 if (op->contr->braced) 1832 if (op->contr->braced)
1828 exp = exp / 5; 1833 exp /= 5;
1829 1834
1830 /* Try to find the matching skill. 1835 /* Try to find the matching skill.
1831 * We do a shortcut/time saving mechanism first - see if it matches 1836 * We do a shortcut/time saving mechanism first - see if it matches
1832 * chosen_skill. This means we don't need to search through 1837 * chosen_skill. This means we don't need to search through
1833 * the players inventory. 1838 * the players inventory.
1834 */ 1839 */
1835 if (skill_name) 1840 if (skill_name)
1836 { 1841 {
1837 if (op->chosen_skill && op->chosen_skill->type == SKILL && !strcmp (skill_name, op->chosen_skill->skill)) 1842 if (op->chosen_skill && op->chosen_skill->type == SKILL && !strcmp (skill_name, op->chosen_skill->skill))

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines