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