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.44 by root, Tue May 15 16:45:23 2007 UTC vs.
Revision 1.45 by root, Thu May 17 00:33:29 2007 UTC

1081 * at least process that code. 1081 * at least process that code.
1082 */ 1082 */
1083 if (op->type == PLAYER && op == caster) 1083 if (op->type == PLAYER && op == caster)
1084 { 1084 {
1085 cast_level = caster_level (caster, spell_ob); 1085 cast_level = caster_level (caster, spell_ob);
1086
1086 if (spell_ob->skill) 1087 if (spell_ob->skill)
1087 { 1088 {
1088 skill = find_skill_by_name (op, spell_ob->skill); 1089 skill = find_skill_by_name (op, spell_ob->skill);
1090
1089 if (!skill) 1091 if (!skill)
1090 { 1092 {
1091 new_draw_info_format (NDI_UNIQUE, 0, op, "You need the skill %s to cast %s.", &spell_ob->skill, &spell_ob->name); 1093 new_draw_info_format (NDI_UNIQUE, 0, op, "You need the skill %s to cast %s.", &spell_ob->skill, &spell_ob->name);
1092 return 0; 1094 return 0;
1093 } 1095 }
1096
1094 if (min_casting_level (op, spell_ob) > cast_level && !QUERY_FLAG (op, FLAG_WIZ)) 1097 if (min_casting_level (op, spell_ob) > cast_level && !QUERY_FLAG (op, FLAG_WIZ))
1095 { 1098 {
1096 new_draw_info (NDI_UNIQUE, 0, op, "You lack enough skill to cast that spell."); 1099 new_draw_info (NDI_UNIQUE, 0, op, "You lack enough skill to cast that spell.");
1097 return 0; 1100 return 0;
1098 } 1101 }
1099 } 1102 }
1103
1100 /* If the caster is the wiz, they don't ever fail, and don't have 1104 /* If the caster is the wiz, they don't ever fail, and don't have
1101 * to have sufficient grace/mana. 1105 * to have sufficient grace/mana.
1102 */ 1106 */
1103 if (!QUERY_FLAG (op, FLAG_WIZ)) 1107 if (!QUERY_FLAG (op, FLAG_WIZ))
1104 { 1108 {
1204 op->spell = spell_ob; 1208 op->spell = spell_ob;
1205 /* put the stringarg into the object struct so that when the 1209 /* put the stringarg into the object struct so that when the
1206 * spell is actually cast, it knows about the stringarg. 1210 * spell is actually cast, it knows about the stringarg.
1207 * necessary for the invoke command spells. 1211 * necessary for the invoke command spells.
1208 */ 1212 */
1209 if (stringarg)
1210 {
1211 op->spellarg = strdup (stringarg); 1213 op->spellarg = stringarg ? strdup (stringarg) : 0;
1212 } 1214
1213 else
1214 op->spellarg = NULL;
1215 return 0; 1215 return 0;
1216 } 1216 }
1217 else if (op->casting_time != 0) 1217 else if (op->casting_time != 0)
1218 { 1218 {
1219 if (op->type == PLAYER) 1219 if (op->type == PLAYER)
1220 new_draw_info (NDI_UNIQUE, 0, op, "You are casting!"); 1220 new_draw_info (NDI_UNIQUE, 0, op, "You are casting!");
1221
1221 return 0; 1222 return 0;
1222 } 1223 }
1223 else 1224 else
1224 { /* casting_time == 0 */ 1225 { /* casting_time == 0 */
1225 op->casting_time = -1; 1226 op->casting_time = -1;
1245 */ 1246 */
1246 if ((spell_ob->casting_time > 0) && op->speed_left < -spell_ob->casting_time * PATH_TIME_MULT (op, spell_ob) * FABS (op->speed)) 1247 if ((spell_ob->casting_time > 0) && op->speed_left < -spell_ob->casting_time * PATH_TIME_MULT (op, spell_ob) * FABS (op->speed))
1247 op->speed_left = -spell_ob->casting_time * PATH_TIME_MULT (op, spell_ob) * FABS (op->speed); 1248 op->speed_left = -spell_ob->casting_time * PATH_TIME_MULT (op, spell_ob) * FABS (op->speed);
1248 } 1249 }
1249 else if (caster->type == WAND || caster->type == HORN || caster->type == ROD || caster->type == POTION || caster->type == SCROLL) 1250 else if (caster->type == WAND || caster->type == HORN || caster->type == ROD || caster->type == POTION || caster->type == SCROLL)
1250 {
1251 op->speed_left -= 2 * FABS (op->speed); 1251 op->speed_left -= 2 * FABS (op->speed);
1252 }
1253 } 1252 }
1254 1253
1255 if (op->type == PLAYER && op == caster) 1254 if (op->type == PLAYER && op == caster)
1256 { 1255 {
1257 op->stats.grace -= SP_level_spellpoint_cost (caster, spell_ob, SPELL_GRACE); 1256 op->stats.grace -= SP_level_spellpoint_cost (caster, spell_ob, SPELL_GRACE);
1268 if (!skill) 1267 if (!skill)
1269 { 1268 {
1270 new_draw_info_format (NDI_UNIQUE, 0, op, "You lack the skill %s to use the %s", &caster->skill, query_name (caster)); 1269 new_draw_info_format (NDI_UNIQUE, 0, op, "You lack the skill %s to use the %s", &caster->skill, query_name (caster));
1271 return 0; 1270 return 0;
1272 } 1271 }
1272
1273 change_skill (op, skill, 0); /* needed for proper exp credit */ 1273 change_skill (op, skill, 0); /* needed for proper exp credit */
1274 } 1274 }
1275 1275
1276 switch (spell_ob->subtype) 1276 switch (spell_ob->subtype)
1277 { 1277 {
1278 /* The order of case statements is same as the order they show up 1278 /* The order of case statements is same as the order they show up
1279 * in in spells.h. 1279 * in in spells.h.
1280 */ 1280 */
1281 case SP_RAISE_DEAD: 1281 case SP_RAISE_DEAD:
1282 success = cast_raise_dead_spell (op, caster, spell_ob, dir, stringarg); 1282 success = cast_raise_dead_spell (op, caster, spell_ob, dir, stringarg);
1283 break; 1283 break;
1284 1284
1285 case SP_RUNE: 1285 case SP_RUNE:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines