… | |
… | |
162 | * Returns modified level. |
162 | * Returns modified level. |
163 | */ |
163 | */ |
164 | int |
164 | int |
165 | min_casting_level (object *caster, object *spell) |
165 | min_casting_level (object *caster, object *spell) |
166 | { |
166 | { |
167 | int new_level; |
|
|
168 | |
|
|
169 | if (caster->path_denied & spell->path_attuned) |
167 | if (caster->path_denied & spell->path_attuned) |
170 | return 1; |
168 | return 1; |
171 | |
169 | |
172 | new_level = spell->level |
170 | int new_level = spell->level |
173 | + (caster->path_repelled & spell->path_attuned ? +2 : 0) |
171 | + (caster->path_repelled & spell->path_attuned ? +8 : 0) |
174 | + (caster->path_attuned & spell->path_attuned ? -2 : 0); |
172 | + (caster->path_attuned & spell->path_attuned ? -8 : 0); |
175 | |
173 | |
176 | return max (1, new_level); |
174 | return max (1, new_level); |
177 | } |
175 | } |
178 | |
176 | |
179 | /* This function returns the effective level the spell |
177 | /* This function returns the effective level the spell |
… | |
… | |
204 | |
202 | |
205 | level = MIN (level, sk_level + level / 10 + 1); |
203 | level = MIN (level, sk_level + level / 10 + 1); |
206 | } |
204 | } |
207 | |
205 | |
208 | /* Got valid caster level. Now adjust for attunement */ |
206 | /* Got valid caster level. Now adjust for attunement */ |
209 | level += caster->path_repelled & spell->path_attuned ? -2 : 0; |
207 | level += caster->path_repelled & spell->path_attuned ? -8 : 0; |
210 | level += caster->path_attuned & spell->path_attuned ? +2 : 0; |
208 | level += caster->path_attuned & spell->path_attuned ? +8 : 0; |
211 | |
209 | |
212 | /* Always make this at least 1. If this is zero, we get divide by zero |
210 | /* Always make this at least 1. If this is zero, we get divide by zero |
213 | * errors in various places. |
211 | * errors in various places. |
214 | */ |
212 | */ |
215 | return max (level, 1); |
213 | return max (level, 1); |