version 1.111 | | version 1.112 |
---|
| | |
/* | | /* |
* static char *rcsid_player_c = | | * static char *rcsid_player_c = |
* "$Id: player.c,v 1.111 2002/12/13 07:23:00 garbled Exp $"; | | * "$Id: player.c,v 1.112 2002/12/25 06:45:46 garbled Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
p->gen_sp_armour=10; | | p->gen_sp_armour=10; |
p->last_speed= -1; | | p->last_speed= -1; |
p->shoottype=range_none; | | p->shoottype=range_none; |
| | p->bowtype=bow_normal; |
| | p->petmode=pet_normal; |
p->listening=9; | | p->listening=9; |
p->last_weapon_sp= -1; | | p->last_weapon_sp= -1; |
p->peaceful=1; /* default peaceful */ | | p->peaceful=1; /* default peaceful */ |
| | |
{ | | { |
object *arrow = NULL, *left, *bow; | | object *arrow = NULL, *left, *bow; |
tag_t left_tag, tag; | | tag_t left_tag, tag; |
| | int numtofire, i, wcmod; |
| | int ff[3]; |
| | |
if (!dir) { | | if (!dir) { |
new_draw_info(NDI_UNIQUE, 0,op, "You can't shoot yourself!"); | | new_draw_info(NDI_UNIQUE, 0,op, "You can't shoot yourself!"); |
| | |
new_draw_info_format(NDI_UNIQUE, 0,op, "Your %s is broken.", bow->name); | | new_draw_info_format(NDI_UNIQUE, 0,op, "Your %s is broken.", bow->name); |
return 0; | | return 0; |
} | | } |
if ((arrow=find_arrow(op, bow->race)) == NULL) { | | |
if (op->type == PLAYER) | | if (op->type == PLAYER && op->contr->bowtype >= bow_n && |
new_draw_info_format(NDI_UNIQUE, 0,op,"You have no %s left.", bow->race); | | op->contr->bowtype <= bow_nw) { |
/* FLAG_READY_BOW will get reset if the monsters picks up some arrows */ | | if (!similar_direction(dir, op->contr->bowtype-2)) |
else CLEAR_FLAG(op, FLAG_READY_BOW); | | wcmod -= 1; |
return 0; | | dir = op->contr->bowtype-2; |
} | | } |
| | |
if(wall(op->map,op->x+freearr_x[dir],op->y+freearr_y[dir])) { | | if(wall(op->map,op->x+freearr_x[dir],op->y+freearr_y[dir])) { |
new_draw_info(NDI_UNIQUE, 0,op,"Something is in the way."); | | new_draw_info(NDI_UNIQUE, 0,op,"Something is in the way."); |
return 0; | | return 0; |
} | | } |
| | numtofire = 1; |
| | wcmod = 0; |
| | if (op->type == PLAYER) { |
| | if (op->contr->bowtype == bow_threewide) |
| | numtofire = 3; |
| | if (op->contr->bowtype == bow_spreadshot) { |
| | numtofire = 3; |
| | ff[0] = dir; |
| | ff[1] = dir-1; |
| | ff[2] = dir+1; |
| | for (i=1; i<3; i++) { |
| | if (ff[i] < 1) |
| | ff[i] = 8; |
| | if (ff[i] > 8) |
| | ff[i] = 1; |
| | } |
| | } |
| | } |
| | for (i=0; i < numtofire; i++) { |
| | if (op->type == PLAYER && op->contr->bowtype != bow_normal) { |
| | if (op->contr->bowtype == bow_threewide && i==1 && |
| | (out_of_map(op->map, op->x+rightof_x[dir], op->y+rightof_y[dir]) || |
| | wall(op->map, op->x+rightof_x[dir], op->y+rightof_y[dir]))) |
| | continue; |
| | else if (op->contr->bowtype == bow_threewide && i==2 && |
| | (out_of_map(op->map, op->x+leftof_x[dir], op->y+leftof_y[dir]) || |
| | wall(op->map, op->x+leftof_x[dir], op->y+leftof_y[dir]))) |
| | continue; |
| | else if (op->contr->bowtype == bow_spreadshot && |
| | (out_of_map(op->map, op->x+freearr_x[ff[i]], op->x+freearr_y[ff[i]]) || |
| | wall(op->map, op->x+freearr_x[ff[i]], op->x+freearr_y[ff[i]]))) |
| | continue; |
| | } |
| | if ((arrow=find_arrow(op, bow->race)) == NULL) { |
| | if (op->type == PLAYER) |
| | new_draw_info_format(NDI_UNIQUE, 0, op, |
| | "You have no %s left.", bow->race); |
| | /* FLAG_READY_BOW will get reset if the monsters picks up some arrows */ |
| | else |
| | CLEAR_FLAG(op, FLAG_READY_BOW); |
| | return 0; |
| | } |
/* this should not happen, but sometimes does */ | | /* this should not happen, but sometimes does */ |
if (arrow->nrof==0) { | | if (arrow->nrof==0) { |
remove_ob(arrow); | | remove_ob(arrow); |
| | |
left = arrow; /* these are arrows left to the player */ | | left = arrow; /* these are arrows left to the player */ |
left_tag = left->count; | | left_tag = left->count; |
arrow = get_split_ob(arrow, 1); | | arrow = get_split_ob(arrow, 1); |
| | if (arrow == NULL) { |
| | new_draw_info_format(NDI_UNIQUE, 0, op, "You have no %s left.", |
| | bow->race); |
| | continue; |
| | } |
set_owner(arrow,op); | | set_owner(arrow,op); |
| | if (op->type == PLAYER && op->contr->bowtype > bow_normal && |
| | op->contr->bowtype < bow_n) { |
| | if (op->contr->bowtype == bow_threewide) { |
| | arrow->direction=dir; |
| | if (i==1) { |
| | arrow->x = part->x + rightof_x[dir]; |
| | arrow->y = part->y + rightof_y[dir]; |
| | } else if (i==2) { |
| | arrow->x = part->x + leftof_x[dir]; |
| | arrow->y = part->y + leftof_y[dir]; |
| | } else if (i==0) { |
| | arrow->x = part->x; |
| | arrow->y = part->y; |
| | } |
| | } else if (op->contr->bowtype == bow_spreadshot) { |
| | arrow->direction=ff[i]; |
| | arrow->x = part->x; |
| | arrow->y = part->y; |
| | if (i>0) |
| | wcmod = -5; |
| | } |
| | } else { |
arrow->direction=dir; | | arrow->direction=dir; |
arrow->x = part->x; | | arrow->x = part->x; |
arrow->y = part->y; | | arrow->y = part->y; |
arrow->speed = 1; | | } |
if (op->type == PLAYER) { | | if (op->type == PLAYER) { |
op->speed_left = 0.01 - (float) FABS(op->speed) * 100 / bow->stats.sp; | | op->speed_left = 0.01 - (float)FABS(op->speed) * 100 / |
| | bow->stats.sp; |
fix_player(op); | | fix_player(op); |
} | | } |
update_ob_speed(arrow); | | SET_ANIMATION(arrow, arrow->direction); |
arrow->speed_left = 0; | | |
SET_ANIMATION(arrow,dir); | | |
arrow->stats.sp = arrow->stats.wc; /* save original wc and dam */ | | arrow->stats.sp = arrow->stats.wc; /* save original wc and dam */ |
arrow->stats.hp = arrow->stats.dam; | | arrow->stats.hp = arrow->stats.dam; |
arrow->stats.grace = arrow->attacktype; | | arrow->stats.grace = arrow->attacktype; |
| | |
arrow->stats.dam += (QUERY_FLAG(bow, FLAG_NO_STRENGTH) ? | | arrow->stats.dam += (QUERY_FLAG(bow, FLAG_NO_STRENGTH) ? |
0 : dam_bonus[op->stats.Str]) + | | 0 : dam_bonus[op->stats.Str]) + |
bow->stats.dam + bow->magic + arrow->magic; | | bow->stats.dam + bow->magic + arrow->magic; |
| | |
| | /* update the speed */ |
| | arrow->speed = (float)((QUERY_FLAG(bow, FLAG_NO_STRENGTH) ? |
| | 0 : dam_bonus[op->stats.Str]) + |
| | bow->magic + arrow->magic) / 5.0 + |
| | (float)bow->stats.dam / 7.0; |
| | if (arrow->speed < 1.0) |
| | arrow->speed = 1.0; |
| | update_ob_speed(arrow); |
| | arrow->speed_left = 0; |
| | |
if (op->type == PLAYER) { | | if (op->type == PLAYER) { |
arrow->stats.wc = 20 - bow->magic - arrow->magic - SK_level(op) - | | arrow->stats.wc = 20 - bow->magic - arrow->magic - SK_level(op) - |
dex_bonus[op->stats.Dex] - thaco_bonus[op->stats.Str] - arrow->stats.wc - | | dex_bonus[op->stats.Dex] - thaco_bonus[op->stats.Str] - |
bow->stats.wc; | | arrow->stats.wc - bow->stats.wc - wcmod; |
arrow->level = SK_level (op); | | arrow->level = SK_level (op); |
if (arrow->attacktype == AT_PHYSICAL) | | if (arrow->attacktype == AT_PHYSICAL) |
arrow->attacktype |= bow->attacktype; | | arrow->attacktype |= bow->attacktype; |
| | |
if (bow->slaying != NULL) | | if (bow->slaying != NULL) |
arrow->slaying = strdup(bow->slaying); | | arrow->slaying = strdup(bow->slaying); |
} | | } |
| | |
arrow->map = op->map; | | arrow->map = op->map; |
SET_FLAG(arrow, FLAG_FLYING); | | SET_FLAG(arrow, FLAG_FLYING); |
SET_FLAG(arrow, FLAG_FLY_ON); | | SET_FLAG(arrow, FLAG_FLY_ON); |
| | |
else | | else |
esrv_send_item(op, left); | | esrv_send_item(op, left); |
} | | } |
| | } |
return 1; | | return 1; |
} | | } |
| | |