… | |
… | |
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 | memcpy (body_used, body_info, sizeof (body_info)); |
867 | |
858 | |
868 | slaying = 0; |
859 | slaying = 0; |
… | |
… | |
979 | || (tmp->type == SKILL |
970 | || (tmp->type == SKILL |
980 | && tmp->subtype == SK_PRAYING)) |
971 | && tmp->subtype == SK_PRAYING)) |
981 | { |
972 | { |
982 | if (type == PLAYER) |
973 | if (type == PLAYER) |
983 | { |
974 | { |
984 | if (tmp->type == BOW) |
|
|
985 | contr->ranges[range_bow] = tmp; |
|
|
986 | |
|
|
987 | if (tmp->type == WAND || tmp->type == ROD || tmp->type == HORN) |
|
|
988 | contr->ranges[range_misc] = tmp; |
|
|
989 | |
|
|
990 | for (i = 0; i < NUM_STATS; i++) |
975 | for (i = 0; i < NUM_STATS; i++) |
991 | change_attr_value (&stats, i, get_attr_value (&tmp->stats, i)); |
976 | change_attr_value (&stats, i, get_attr_value (&tmp->stats, i)); |
992 | |
977 | |
993 | /* these are the items that currently can change digestion, regeneration, |
978 | /* these are the items that currently can change digestion, regeneration, |
994 | * spell point recovery and mana point recovery. Seems sort of an arbitary |
979 | * spell point recovery and mana point recovery. Seems sort of an arbitary |
… | |
… | |
1050 | vuln[i] += ((100 - vuln[i]) * -tmp->resist[i]) / 100; |
1035 | vuln[i] += ((100 - vuln[i]) * -tmp->resist[i]) / 100; |
1051 | } |
1036 | } |
1052 | } |
1037 | } |
1053 | |
1038 | |
1054 | /* There may be other things that should not adjust the attacktype */ |
1039 | /* There may be other things that should not adjust the attacktype */ |
1055 | if (tmp->type != SYMPTOM) |
1040 | if (tmp->type != BOW && tmp->type != SYMPTOM) |
1056 | attacktype |= tmp->attacktype; |
1041 | attacktype |= tmp->attacktype; |
1057 | |
1042 | |
1058 | path_attuned |= tmp->path_attuned; |
1043 | path_attuned |= tmp->path_attuned; |
1059 | path_repelled |= tmp->path_repelled; |
1044 | path_repelled |= tmp->path_repelled; |
1060 | path_denied |= tmp->path_denied; |
1045 | path_denied |= tmp->path_denied; |
… | |
… | |
1081 | if (tmp->stats.exp && tmp->type != SKILL) |
1066 | if (tmp->stats.exp && tmp->type != SKILL) |
1082 | { |
1067 | { |
1083 | if (tmp->stats.exp > 0) |
1068 | if (tmp->stats.exp > 0) |
1084 | { |
1069 | { |
1085 | added_speed += tmp->stats.exp / 3.f; |
1070 | added_speed += tmp->stats.exp / 3.f; |
1086 | bonus_speed += 1.f + tmp->stats.exp / 3.f; |
1071 | bonus_speed += tmp->stats.exp / 3.f + 1.f; |
1087 | } |
1072 | } |
1088 | else |
1073 | else |
1089 | added_speed += tmp->stats.exp; |
1074 | added_speed += tmp->stats.exp; |
1090 | } |
1075 | } |
1091 | |
1076 | |
1092 | switch (tmp->type) |
1077 | switch (tmp->type) |
1093 | { |
1078 | { |
|
|
1079 | case WAND: |
|
|
1080 | case ROD: |
|
|
1081 | case HORN: |
|
|
1082 | if (type == PLAYER) |
|
|
1083 | { |
|
|
1084 | contr->ranged_skill = this; |
|
|
1085 | contr->ranged_ob = tmp; |
|
|
1086 | } |
|
|
1087 | break; |
|
|
1088 | |
1094 | /* skills modifying the character -b.t. */ |
1089 | /* skills modifying the character -b.t. */ |
1095 | /* for all skills and skill granting objects */ |
1090 | /* for all skills and skill granting objects */ |
1096 | case SKILL: |
1091 | case SKILL: |
1097 | if (!QUERY_FLAG (tmp, FLAG_APPLIED)) |
1092 | if (!QUERY_FLAG (tmp, FLAG_APPLIED)) |
1098 | break; |
1093 | break; |
… | |
… | |
1119 | if (tmp->magic) |
1114 | if (tmp->magic) |
1120 | stats.dam += tmp->magic; |
1115 | stats.dam += tmp->magic; |
1121 | } |
1116 | } |
1122 | |
1117 | |
1123 | if (tmp->stats.wc) |
1118 | if (tmp->stats.wc) |
1124 | wc -= (tmp->stats.wc + tmp->magic); |
1119 | wc -= tmp->stats.wc + tmp->magic; |
1125 | |
1120 | |
1126 | if (tmp->slaying != NULL) |
1121 | if (tmp->slaying) |
1127 | slaying = tmp->slaying; |
1122 | slaying = tmp->slaying; |
1128 | |
1123 | |
1129 | if (tmp->stats.ac) |
1124 | if (tmp->stats.ac) |
1130 | ac -= (tmp->stats.ac + tmp->magic); |
1125 | ac -= tmp->stats.ac + tmp->magic; |
1131 | |
1126 | |
1132 | if (settings.spell_encumbrance == TRUE && type == PLAYER) |
1127 | if (settings.spell_encumbrance == TRUE && type == PLAYER) |
1133 | contr->encumbrance += (int) 3 *tmp->weight / 1000; |
1128 | contr->encumbrance += (int) 3 *tmp->weight / 1000; |
1134 | |
1129 | |
1135 | if (type == PLAYER) |
1130 | if (type == PLAYER) |
|
|
1131 | { |
1136 | contr->ranges[range_skill] = this; |
1132 | contr->ranged_skill = this; |
|
|
1133 | contr->ranged_ob = tmp; |
|
|
1134 | } |
1137 | |
1135 | |
1138 | break; |
1136 | break; |
1139 | |
1137 | |
1140 | case SKILL_TOOL: |
1138 | case SKILL_TOOL: |
1141 | if (chosen_skill) |
1139 | if (chosen_skill) |
1142 | LOG (llevDebug, "fix_player, op %s has multiple skills applied\n", &name); |
1140 | LOG (llevDebug, "fix_player, op %s has multiple skills applied\n", &name); |
1143 | |
1141 | |
1144 | chosen_skill = tmp; |
1142 | chosen_skill = tmp; |
1145 | |
1143 | |
1146 | if (type == PLAYER) |
1144 | if (type == PLAYER) |
|
|
1145 | { |
1147 | contr->ranges[range_skill] = this; |
1146 | contr->ranged_skill = this; |
|
|
1147 | contr->ranged_ob = tmp; |
|
|
1148 | } |
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; |
… | |
… | |
1168 | |
1169 | |
1169 | break; |
1170 | break; |
1170 | |
1171 | |
1171 | case BOW: |
1172 | case BOW: |
1172 | case WEAPON: |
1173 | case WEAPON: |
|
|
1174 | if (type != PLAYER |
|
|
1175 | || (contr->combat_skill && contr->combat_skill->type == SKILL && (skill_flags [contr->combat_skill->subtype] & SF_NEED_BOW ) && tmp->type == BOW ) |
|
|
1176 | || (contr->combat_skill && contr->combat_skill->type == SKILL && (skill_flags [contr->combat_skill->subtype] & SF_NEED_WEAPON) && tmp->type == WEAPON)) |
|
|
1177 | { |
1173 | wc -= tmp->stats.wc + tmp->magic; |
1178 | wc -= tmp->stats.wc + tmp->magic; |
1174 | |
1179 | |
1175 | if (tmp->stats.ac && tmp->stats.ac + tmp->magic > 0) |
1180 | if (tmp->stats.ac && tmp->stats.ac + tmp->magic > 0) |
1176 | ac -= tmp->stats.ac + tmp->magic; |
1181 | ac -= tmp->stats.ac + tmp->magic; |
1177 | |
1182 | |
1178 | stats.dam += tmp->stats.dam + tmp->magic; |
1183 | stats.dam += tmp->stats.dam + tmp->magic; |
1179 | weapon_weight = tmp->weight; |
1184 | weapon_weight = tmp->weight; |
1180 | weapon_speed = ((int) WEAPON_SPEED (tmp) * 2 - tmp->magic) / 2; |
1185 | weapon_speed = (WEAPON_SPEED (tmp) * 2 - tmp->magic) / 2; |
1181 | |
1186 | |
1182 | if (weapon_speed < 0) |
1187 | if (weapon_speed < 0) |
1183 | weapon_speed = 0; |
1188 | weapon_speed = 0; |
1184 | |
1189 | |
1185 | slaying = tmp->slaying; |
1190 | slaying = tmp->slaying; |
1186 | |
1191 | |
1187 | /* If there is desire that two handed weapons should do |
1192 | /* If there is desire that two handed weapons should do |
1188 | * extra strength damage, this is where the code should |
1193 | * extra strength damage, this is where the code should |
1189 | * go. |
1194 | * go. |
1190 | */ |
1195 | */ |
1191 | |
1196 | |
1192 | current_weapon = tmp; |
1197 | current_weapon = tmp; |
|
|
1198 | |
|
|
1199 | if (type == PLAYER) |
|
|
1200 | { |
|
|
1201 | contr->combat_ob = tmp; |
|
|
1202 | |
1193 | if (type == PLAYER && settings.spell_encumbrance) |
1203 | if (settings.spell_encumbrance) |
1194 | contr->encumbrance += tmp->weight * 3 / 1000; |
1204 | contr->encumbrance += tmp->weight * 3 / 1000; |
|
|
1205 | } |
|
|
1206 | } |
1195 | |
1207 | |
1196 | break; |
1208 | break; |
1197 | |
1209 | |
1198 | case ARMOUR: /* Only the best of these three are used: */ |
1210 | case ARMOUR: /* Only the best of these three are used: */ |
1199 | if (settings.spell_encumbrance == TRUE && type == PLAYER) |
1211 | if (settings.spell_encumbrance == TRUE && type == PLAYER) |