1 | /* |
1 | /* |
2 | * static char *rcsid_spell_effect_c = |
2 | * static char *rcsid_spell_effect_c = |
3 | * "$Id: spell_effect.c,v 1.1.1.1 2006/02/03 07:14:40 root Exp $"; |
3 | * "$Id: spell_effect.c,v 1.1.1.2 2006/02/22 18:03:26 elmex Exp $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | |
6 | |
7 | /* |
7 | /* |
8 | CrossFire, A Multiplayer game for X-windows |
8 | CrossFire, A Multiplayer game for X-windows |
… | |
… | |
505 | |
505 | |
506 | food_value=spell_ob->stats.food + |
506 | food_value=spell_ob->stats.food + |
507 | + 50 * SP_level_duration_adjust(caster,spell_ob); |
507 | + 50 * SP_level_duration_adjust(caster,spell_ob); |
508 | |
508 | |
509 | if(stringarg) { |
509 | if(stringarg) { |
510 | at=find_archetype_by_object_name(stringarg); |
510 | at = find_archetype_by_object_type_name(FOOD, stringarg); |
511 | if (at==NULL || ((at->clone.type != FOOD && at->clone.type != DRINK) |
511 | if (at == NULL) |
|
|
512 | at = find_archetype_by_object_type_name(DRINK, stringarg); |
512 | || (at->clone.stats.food > food_value))) |
513 | if (at == NULL || at->clone.stats.food > food_value) |
513 | stringarg = NULL; |
514 | stringarg = NULL; |
514 | } |
515 | } |
515 | |
516 | |
516 | if(!stringarg) { |
517 | if(!stringarg) { |
517 | archetype *at_tmp; |
518 | archetype *at_tmp; |
518 | |
519 | |
… | |
… | |
1295 | * by such squares). Also, there are probably treasure rooms and |
1296 | * by such squares). Also, there are probably treasure rooms and |
1296 | * lots of other maps that protect areas with no magic, but the |
1297 | * lots of other maps that protect areas with no magic, but the |
1297 | * areas themselves don't contain no magic spaces. |
1298 | * areas themselves don't contain no magic spaces. |
1298 | */ |
1299 | */ |
1299 | /* This call here is really just to normalize the coordinates */ |
1300 | /* This call here is really just to normalize the coordinates */ |
1300 | get_map_flags(op->map, &m,op->x+freearr_x[dir]*dist, op->y+freearr_y[dir]*dist, |
1301 | mflags = get_map_flags(op->map, &m,op->x+freearr_x[dir]*dist, op->y+freearr_y[dir]*dist, |
1301 | &sx, &sy); |
1302 | &sx, &sy); |
1302 | if (OB_TYPE_MOVE_BLOCK(op, GET_MAP_MOVE_BLOCK(m, sx, sy))) { |
1303 | if (mflags&P_IS_ALIVE || OB_TYPE_MOVE_BLOCK(op, GET_MAP_MOVE_BLOCK(m, sx, sy))) { |
1303 | new_draw_info(NDI_UNIQUE, 0,op,"You cast your spell, but nothing happens.\n"); |
1304 | new_draw_info(NDI_UNIQUE, 0,op,"You cast your spell, but nothing happens.\n"); |
1304 | return 1; /* Maybe the penalty should be more severe... */ |
1305 | return 1; /* Maybe the penalty should be more severe... */ |
1305 | } |
1306 | } |
1306 | } else { |
1307 | } else { |
1307 | /* Player didn't specify a distance, so lets see how far |
1308 | /* Player didn't specify a distance, so lets see how far |
… | |
… | |
1325 | /* If the destination is blocked, keep backing up until we |
1326 | /* If the destination is blocked, keep backing up until we |
1326 | * find a place for the player. |
1327 | * find a place for the player. |
1327 | */ |
1328 | */ |
1328 | for(;dist>0; dist--) { |
1329 | for(;dist>0; dist--) { |
1329 | if (get_map_flags(op->map, &m,op->x+freearr_x[dir]*dist, op->y+freearr_y[dir]*dist, |
1330 | if (get_map_flags(op->map, &m,op->x+freearr_x[dir]*dist, op->y+freearr_y[dir]*dist, |
1330 | &sx, &sy) & P_OUT_OF_MAP) continue; |
1331 | &sx, &sy) & (P_OUT_OF_MAP|P_IS_ALIVE)) continue; |
1331 | |
1332 | |
1332 | |
1333 | |
1333 | if (!OB_TYPE_MOVE_BLOCK(op, GET_MAP_MOVE_BLOCK(m, sx, sy))) break; |
1334 | if (!OB_TYPE_MOVE_BLOCK(op, GET_MAP_MOVE_BLOCK(m, sx, sy))) break; |
1334 | |
1335 | |
1335 | } |
1336 | } |
… | |
… | |
1458 | |
1459 | |
1459 | /* This is used for the spells that gain stats. There are no spells |
1460 | /* This is used for the spells that gain stats. There are no spells |
1460 | * right now that icnrease wis/int/pow on a temp basis, so no |
1461 | * right now that icnrease wis/int/pow on a temp basis, so no |
1461 | * good comments for those. |
1462 | * good comments for those. |
1462 | */ |
1463 | */ |
1463 | static char *no_gain_msgs[NUM_STATS] = { |
1464 | static const char* const no_gain_msgs[NUM_STATS] = { |
1464 | "You grow no stronger.", |
1465 | "You grow no stronger.", |
1465 | "You grow no more agile.", |
1466 | "You grow no more agile.", |
1466 | "You don't feel any healthier.", |
1467 | "You don't feel any healthier.", |
1467 | "no wis", |
1468 | "no wis", |
1468 | "You are no easier to look at.", |
1469 | "You are no easier to look at.", |