… | |
… | |
183 | min_casting_level (object *caster, object *spell) |
183 | min_casting_level (object *caster, object *spell) |
184 | { |
184 | { |
185 | int new_level; |
185 | int new_level; |
186 | |
186 | |
187 | if (caster->path_denied & spell->path_attuned) |
187 | if (caster->path_denied & spell->path_attuned) |
188 | { |
|
|
189 | /* This case is not a bug, just the fact that this function is |
|
|
190 | * usually called BEFORE checking for path_deny. -AV |
|
|
191 | */ |
|
|
192 | #if 0 |
|
|
193 | LOG (llevError, "BUG: path_level_mod (arch %s, name %s): casting denied " "spell\n", caster->arch->name, caster->name); |
|
|
194 | #endif |
|
|
195 | return 1; |
188 | return 1; |
196 | } |
189 | |
197 | new_level = spell->level |
190 | new_level = spell->level |
198 | + ((caster->path_repelled & spell->path_attuned) ? +2 : 0) + ((caster->path_attuned & spell->path_attuned) ? -2 : 0); |
191 | + ((caster->path_repelled & spell->path_attuned) ? +2 : 0) + ((caster->path_attuned & spell->path_attuned) ? -2 : 0); |
|
|
192 | |
199 | return (new_level < 1) ? 1 : new_level; |
193 | return (new_level < 1) ? 1 : new_level; |
200 | } |
194 | } |
201 | |
195 | |
202 | |
196 | |
203 | /* This function returns the effective level the spell |
197 | /* This function returns the effective level the spell |
… | |
… | |
212 | { |
206 | { |
213 | int level = caster->level; |
207 | int level = caster->level; |
214 | |
208 | |
215 | /* If this is a player, try to find the matching skill */ |
209 | /* If this is a player, try to find the matching skill */ |
216 | if (caster->type == PLAYER && spell->skill) |
210 | if (caster->type == PLAYER && spell->skill) |
217 | { |
|
|
218 | int i; |
|
|
219 | |
|
|
220 | for (i = 0; i < NUM_SKILLS; i++) |
211 | for (int i = 0; i < NUM_SKILLS; i++) |
221 | if (caster->contr->last_skill_ob[i] && caster->contr->last_skill_ob[i]->skill == spell->skill) |
212 | if (caster->contr->last_skill_ob[i] && caster->contr->last_skill_ob[i]->skill == spell->skill) |
222 | { |
213 | { |
223 | level = caster->contr->last_skill_ob[i]->level; |
214 | level = caster->contr->last_skill_ob[i]->level; |
224 | break; |
215 | break; |
225 | } |
216 | } |
226 | } |
|
|
227 | |
217 | |
228 | /* if a rod is fired by a player, take the use_magic_item skill in consideration. */ |
218 | /* if a rod is fired by a player, take the use_magic_item skill in consideration. */ |
229 | if (caster->type == ROD && caster->env && caster->env->type == PLAYER) |
219 | if (caster->type == ROD && caster->env && caster->env->type == PLAYER) |
230 | { |
220 | { |
231 | object *skill = find_skill_by_number (caster->env, SK_USE_MAGIC_ITEM); |
221 | object *skill = find_skill_by_number (caster->env, SK_USE_MAGIC_ITEM); |
… | |
… | |
240 | /* Always make this at least 1. If this is zero, we get divide by zero |
230 | /* Always make this at least 1. If this is zero, we get divide by zero |
241 | * errors in various places. |
231 | * errors in various places. |
242 | */ |
232 | */ |
243 | if (level < 1) |
233 | if (level < 1) |
244 | level = 1; |
234 | level = 1; |
|
|
235 | |
245 | return level; |
236 | return level; |
246 | } |
237 | } |
247 | |
238 | |
248 | /* The following function scales the spellpoint cost of |
239 | /* The following function scales the spellpoint cost of |
249 | * a spell by it's increased effectiveness. Some of the |
240 | * a spell by it's increased effectiveness. Some of the |
… | |
… | |
1143 | } |
1134 | } |
1144 | |
1135 | |
1145 | /* if caster is a spell casting object, this normally shouldn't be |
1136 | /* if caster is a spell casting object, this normally shouldn't be |
1146 | * an issue, because they don't have any spellpaths set up. |
1137 | * an issue, because they don't have any spellpaths set up. |
1147 | */ |
1138 | */ |
1148 | if (caster->path_denied & spell_ob->path_attuned) |
1139 | if (caster->path_denied & spell_ob->path_attuned && !QUERY_FLAG (caster, FLAG_WIZCAST)) |
1149 | { |
1140 | { |
1150 | new_draw_info (NDI_UNIQUE, 0, op, "That spell path is denied to you."); |
1141 | new_draw_info (NDI_UNIQUE, 0, op, "That spell path is denied to you."); |
1151 | return 0; |
1142 | return 0; |
1152 | } |
1143 | } |
1153 | |
1144 | |