version 1.133 | | version 1.134 |
---|
| | |
/* | | /* |
* static char *rcsid_player_c = | | * static char *rcsid_player_c = |
* "$Id: player.c,v 1.133 2003/09/14 07:07:14 mwedel Exp $"; | | * "$Id: player.c,v 1.134 2003/10/07 07:02:02 mwedel Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
/* this must before then initial items are given */ | | /* this must before then initial items are given */ |
esrv_new_player(op->contr, op->weight+op->carrying); | | esrv_new_player(op->contr, op->weight+op->carrying); |
create_treasure(find_treasurelist("starting_wealth"),op, 0, 0, 0); | | create_treasure(find_treasurelist("starting_wealth"),op, 0, 0, 0); |
| | |
/* GROS : Here we handle the BORN global event */ | | /* GROS : Here we handle the BORN global event */ |
evtid = EVENT_BORN; | | evtid = EVENT_BORN; |
CFP.Value[0] = (void *)(&evtid); | | CFP.Value[0] = (void *)(&evtid); |
| | |
give_initial_items(op,op->randomitems); | | give_initial_items(op,op->randomitems); |
link_player_skills(op); | | link_player_skills(op); |
esrv_send_inventory(op, op); | | esrv_send_inventory(op, op); |
| | fix_player(op); |
return 0; | | return 0; |
} | | } |
| | |
| | |
void move_player_attack(object *op, int dir) | | void move_player_attack(object *op, int dir) |
{ | | { |
object *tmp, *mon; | | object *tmp, *mon; |
int nx=freearr_x[dir]+op->x,ny=freearr_y[dir]+op->y; | | int nx=freearr_x[dir]+op->x,ny=freearr_y[dir]+op->y, on_battleground; |
mapstruct *m; | | mapstruct *m; |
| | |
| | on_battleground = op_on_battleground(op, NULL, NULL); |
| | |
/* If braced, or can't move to the square, and it is not out of the | | /* If braced, or can't move to the square, and it is not out of the |
* map, attack it. Note order of if statement is important - don't | | * map, attack it. Note order of if statement is important - don't |
* want to be calling move_ob if braced, because move_ob will move the | | * want to be calling move_ob if braced, because move_ob will move the |
| | |
*/ | | */ |
if ((mon->type==PLAYER || mon->enemy != op) && | | if ((mon->type==PLAYER || mon->enemy != op) && |
(mon->type==PLAYER || QUERY_FLAG(mon,FLAG_UNAGGRESSIVE) || QUERY_FLAG(mon, FLAG_FRIENDLY)) && | | (mon->type==PLAYER || QUERY_FLAG(mon,FLAG_UNAGGRESSIVE) || QUERY_FLAG(mon, FLAG_FRIENDLY)) && |
(op->contr->peaceful && !op_on_battleground(op, NULL, NULL))) { | | (op->contr->peaceful && !on_battleground)) { |
if (!op->contr->braced) { | | if (!op->contr->braced) { |
play_sound_map(op->map, op->x, op->y, SOUND_PUSH_PLAYER); | | play_sound_map(op->map, op->x, op->y, SOUND_PUSH_PLAYER); |
(void) push_ob(mon,dir,op); | | (void) push_ob(mon,dir,op); |
| | |
op->contr->has_hit = 1; /* The last action was to hit, so use weapon_sp */ | | op->contr->has_hit = 1; /* The last action was to hit, so use weapon_sp */ |
| | |
skill_attack(mon, op, 0, NULL, NULL); | | skill_attack(mon, op, 0, NULL, NULL); |
| | |
/* If attacking another player, that player gets automatic | | /* If attacking another player, that player gets automatic |
* hitback, and doesn't loose luck either. | | * hitback, and doesn't loose luck either. |
| | * Disable hitback on the battleground or if the target is |
| | * the wiz. |
*/ | | */ |
if (mon->type == PLAYER && mon->stats.hp >= 0 && !mon->contr->has_hit) { | | if (mon->type == PLAYER && mon->stats.hp >= 0 && !mon->contr->has_hit && |
| | !on_battleGround && !QUERY_FLAG(mon, FLAG_WIZ)) { |
short luck = mon->stats.luck; | | short luck = mon->stats.luck; |
mon->contr->has_hit = 1; | | mon->contr->has_hit = 1; |
skill_attack(op, mon, 0, NULL, NULL); | | skill_attack(op, mon, 0, NULL, NULL); |