ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/spell_util.C
(Generate patch)

Comparing deliantra/server/server/spell_util.C (file contents):
Revision 1.29 by root, Tue Dec 26 20:04:09 2006 UTC vs.
Revision 1.30 by root, Sun Dec 31 19:02:24 2006 UTC

160 160
161/* 161/*
162 * This function takes a caster and spell and presents the 162 * This function takes a caster and spell and presents the
163 * effective level the caster needs to be to cast the spell. 163 * effective level the caster needs to be to cast the spell.
164 * basically, it just adjusts the spell->level with attuned/repelled 164 * basically, it just adjusts the spell->level with attuned/repelled
165 * spellpaths. Was called path_level_mod 165 * spellpaths. Was called path_level_mod.
166 * 166 *
167 * caster is person casting hte spell. 167 * caster is person casting the spell.
168 * spell is the spell object. 168 * spell is the spell object.
169 * Returns modified level. 169 * Returns modified level.
170 */ 170 */
171int 171int
172min_casting_level (object *caster, object *spell) 172min_casting_level (object *caster, object *spell)
175 175
176 if (caster->path_denied & spell->path_attuned) 176 if (caster->path_denied & spell->path_attuned)
177 return 1; 177 return 1;
178 178
179 new_level = spell->level 179 new_level = spell->level
180 + ((caster->path_repelled & spell->path_attuned) ? +2 : 0) + ((caster->path_attuned & spell->path_attuned) ? -2 : 0); 180 + (caster->path_repelled & spell->path_attuned ? +2 : 0)
181 + (caster->path_attuned & spell->path_attuned ? -2 : 0);
181 182
182 return (new_level < 1) ? 1 : new_level; 183 return max (1, new_level);
183} 184}
184
185 185
186/* This function returns the effective level the spell 186/* This function returns the effective level the spell
187 * is being cast at. 187 * is being cast at.
188 * Note that I changed the repelled/attuned bonus to 2 from 5. 188 * Note that I changed the repelled/attuned bonus to 2 from 5.
189 * This is because the new code compares casting_level against 189 * This is because the new code compares casting_level against
1148 SP_level_spellpoint_cost (caster, spell_ob, SPELL_MANA) > op->stats.sp) 1148 SP_level_spellpoint_cost (caster, spell_ob, SPELL_MANA) > op->stats.sp)
1149 { 1149 {
1150 new_draw_info (NDI_UNIQUE, 0, op, "You don't have enough mana."); 1150 new_draw_info (NDI_UNIQUE, 0, op, "You don't have enough mana.");
1151 return 0; 1151 return 0;
1152 } 1152 }
1153
1153 if (SP_level_spellpoint_cost (caster, spell_ob, SPELL_GRACE) && 1154 if (SP_level_spellpoint_cost (caster, spell_ob, SPELL_GRACE) &&
1154 SP_level_spellpoint_cost (caster, spell_ob, SPELL_GRACE) > op->stats.grace) 1155 SP_level_spellpoint_cost (caster, spell_ob, SPELL_GRACE) > op->stats.grace)
1155 { 1156 {
1156 if (random_roll (0, op->stats.Wis - 1, op, PREFER_HIGH) + op->stats.grace - 1157 if (random_roll (0, op->stats.Wis - 1, op, PREFER_HIGH) + op->stats.grace -
1157 10 * SP_level_spellpoint_cost (caster, spell_ob, SPELL_GRACE) / op->stats.maxgrace > 0) 1158 10 * SP_level_spellpoint_cost (caster, spell_ob, SPELL_GRACE) / op->stats.maxgrace > 0)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines