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.45 by root, Thu May 17 00:33:29 2007 UTC vs.
Revision 1.46 by root, Thu May 17 14:14:55 2007 UTC

1134 (spell_ob->level / (float) MAX (1, op->level) * cleric_chance[op->stats.Wis])) 1134 (spell_ob->level / (float) MAX (1, op->level) * cleric_chance[op->stats.Wis]))
1135 { 1135 {
1136 play_sound_player_only (op->contr, SOUND_FUMBLE_SPELL, 0, 0); 1136 play_sound_player_only (op->contr, SOUND_FUMBLE_SPELL, 0, 0);
1137 new_draw_info (NDI_UNIQUE, 0, op, "You fumble the spell."); 1137 new_draw_info (NDI_UNIQUE, 0, op, "You fumble the spell.");
1138 1138
1139 if (settings.casting_time == TRUE)
1140 op->casting_time = -1;
1141
1142 op->stats.grace -= random_roll (1, SP_level_spellpoint_cost (caster, spell_ob, SPELL_GRACE), op, PREFER_LOW); 1139 op->stats.grace -= random_roll (1, SP_level_spellpoint_cost (caster, spell_ob, SPELL_GRACE), op, PREFER_LOW);
1143 return 0; 1140 return 0;
1144 } 1141 }
1145 else if (spell_ob->stats.sp) 1142 else if (spell_ob->stats.sp)
1146 { 1143 {
1198 new_draw_info (NDI_UNIQUE, 0, op, "Something blocks the spell!"); 1195 new_draw_info (NDI_UNIQUE, 0, op, "Something blocks the spell!");
1199 1196
1200 return 0; 1197 return 0;
1201 } 1198 }
1202 1199
1203 if (caster == op && settings.casting_time == TRUE && spell_ob->type == SPELL)
1204 {
1205 if (op->casting_time == -1)
1206 { /* begin the casting */
1207 op->casting_time = (sint16) (spell_ob->casting_time * PATH_TIME_MULT (op, spell_ob));
1208 op->spell = spell_ob;
1209 /* put the stringarg into the object struct so that when the
1210 * spell is actually cast, it knows about the stringarg.
1211 * necessary for the invoke command spells.
1212 */
1213 op->spellarg = stringarg ? strdup (stringarg) : 0;
1214
1215 return 0;
1216 }
1217 else if (op->casting_time != 0)
1218 {
1219 if (op->type == PLAYER)
1220 new_draw_info (NDI_UNIQUE, 0, op, "You are casting!");
1221
1222 return 0;
1223 }
1224 else
1225 { /* casting_time == 0 */
1226 op->casting_time = -1;
1227 spell_ob = op->spell;
1228 stringarg = op->spellarg;
1229 }
1230 }
1231 else
1232 {
1233 /* Take into account how long it takes to cast the spell. 1200 /* Take into account how long it takes to cast the spell.
1234 * if the player is casting it, then we use the time in 1201 * if the player is casting it, then we use the time in
1235 * the spell object. If it is a spell object, have it 1202 * the spell object. If it is a spell object, have it
1236 * take two ticks. Things that cast spells on the players 1203 * take two ticks. Things that cast spells on the players
1237 * behalf (eg, altars, and whatever else) shouldn't cost 1204 * behalf (eg, altars, and whatever else) shouldn't cost
1238 * the player any time. 1205 * the player any time.
1239 * Ignore casting time for firewalls 1206 * Ignore casting time for firewalls
1207 */
1208 if (caster == op && caster->type != FIREWALL)
1209 {
1210 op->speed_left -= spell_ob->casting_time * PATH_TIME_MULT (op, spell_ob) * FABS (op->speed);
1211 /* Other portions of the code may also decrement the speed of the player, so
1212 * put a lower limit so that the player isn't stuck here too long
1240 */ 1213 */
1241 if (caster == op && caster->type != FIREWALL)
1242 {
1243 op->speed_left -= spell_ob->casting_time * PATH_TIME_MULT (op, spell_ob) * FABS (op->speed);
1244 /* Other portions of the code may also decrement the speed of the player, so
1245 * put a lower limit so that the player isn't stuck here too long
1246 */
1247 if ((spell_ob->casting_time > 0) && op->speed_left < -spell_ob->casting_time * PATH_TIME_MULT (op, spell_ob) * FABS (op->speed)) 1214 if ((spell_ob->casting_time > 0) && 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); 1215 op->speed_left = -spell_ob->casting_time * PATH_TIME_MULT (op, spell_ob) * FABS (op->speed);
1249 } 1216 }
1250 else if (caster->type == WAND || caster->type == HORN || caster->type == ROD || caster->type == POTION || caster->type == SCROLL) 1217 else if (caster->type == WAND || caster->type == HORN || caster->type == ROD || caster->type == POTION || caster->type == SCROLL)
1251 op->speed_left -= 2 * FABS (op->speed); 1218 op->speed_left -= 2 * FABS (op->speed);
1252 }
1253 1219
1254 if (op->type == PLAYER && op == caster) 1220 if (op->type == PLAYER && op == caster)
1255 { 1221 {
1256 op->stats.grace -= SP_level_spellpoint_cost (caster, spell_ob, SPELL_GRACE); 1222 op->stats.grace -= SP_level_spellpoint_cost (caster, spell_ob, SPELL_GRACE);
1257 op->stats.sp -= SP_level_spellpoint_cost (caster, spell_ob, SPELL_MANA); 1223 op->stats.sp -= SP_level_spellpoint_cost (caster, spell_ob, SPELL_MANA);
1500 /* FIXME - we need some better sound suppport */ 1466 /* FIXME - we need some better sound suppport */
1501 // yes, for example, augment map info with the spell effect 1467 // yes, for example, augment map info with the spell effect
1502 // so clients can calculate the sounds themselves 1468 // so clients can calculate the sounds themselves
1503 //play_sound_map(op->map, op->x, op->y, SOUND_CAST_SPELL_0 + spell_ob->subtype); 1469 //play_sound_map(op->map, op->x, op->y, SOUND_CAST_SPELL_0 + spell_ob->subtype);
1504 1470
1505 /* free the spell arg */
1506 if (settings.casting_time == TRUE && stringarg)
1507 {
1508 free (stringarg);
1509 stringarg = 0;
1510 }
1511
1512 return success; 1471 return success;
1513} 1472}
1514 1473
1515 1474
1516/* This is called from time.c/process_object(). That function 1475/* This is called from time.c/process_object(). That function

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines