version 1.116 | | version 1.117 |
---|
| | |
/* | | /* |
* static char *rcsid_attack_c = | | * static char *rcsid_attack_c = |
* "$Id: attack.c,v 1.116 2005/10/28 19:08:53 akirschbaum Exp $"; | | * "$Id: attack.c,v 1.117 2005/11/16 08:16:08 mwedel Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
if ((tmp = present_arch(at,op->map,op->x,op->y)) == NULL) { | | if ((tmp = present_arch(at,op->map,op->x,op->y)) == NULL) { |
tmp = arch_to_object(at); | | tmp = arch_to_object(at); |
tmp->x=op->x,tmp->y=op->y; | | tmp->x=op->x,tmp->y=op->y; |
SET_SLOW_PENALTY(tmp, 0); | | /* This was in the old (pre new movement code) - |
| | * icecubes have slow_move set to 1 - don't want |
| | * that for ones we create. |
| | */ |
| | tmp->move_slow_penalty=0; |
| | tmp->move_slow=0; |
insert_ob_in_map(tmp,op->map,originator,0); | | insert_ob_in_map(tmp,op->map,originator,0); |
} | | } |
if ( ! QUERY_FLAG (op, FLAG_REMOVED)) | | if ( ! QUERY_FLAG (op, FLAG_REMOVED)) |
| | |
/* Here we are potentially destroying an object. If the object has | | /* Here we are potentially destroying an object. If the object has |
* NO_PASS set, it is also immune - you can't destroy walls. Note | | * NO_PASS set, it is also immune - you can't destroy walls. Note |
* that weak walls have is_alive set, which prevent objects from | | * that weak walls have is_alive set, which prevent objects from |
* passing over/through them. | | * passing over/through them. We don't care what type of movement |
| | * the wall blocks - if it blocks any type of movement, can't be |
| | * destroyed right now. |
*/ | | */ |
else if ((tmp->material || tmp->materialname) && op->stats.dam > 0 && | | else if ((tmp->material || tmp->materialname) && op->stats.dam > 0 && |
!QUERY_FLAG(tmp, FLAG_NO_PASS)) { | | tmp->move_block) { |
save_throw_object(tmp,type,op); | | save_throw_object(tmp,type,op); |
if (was_destroyed (op, op_tag)) | | if (was_destroyed (op, op_tag)) |
break; | | break; |
| | |
&& stick_arrow (hitter, victim)) | | && stick_arrow (hitter, victim)) |
return NULL; | | return NULL; |
| | |
/* Else try to put arrow on victim's map square */ | | /* Else try to put arrow on victim's map square |
if ((victim_x != hitter->x || victim_y != hitter->y) | | * remove check for P_WALL here. If the arrow got to this |
&& !(get_map_flags(hitter->map, NULL, victim_x, victim_y, NULL, NULL) & P_WALL)) | | * space, that is good enough - with the new movement code, |
{ | | * there is now the potential for lots of spaces where something |
| | * can fly over but not otherwise move over. What is the correct |
| | * way to handle those otherwise? |
| | */ |
| | if (victim_x != hitter->x || victim_y != hitter->y) { |
remove_ob (hitter); | | remove_ob (hitter); |
hitter->x = victim_x; | | hitter->x = victim_x; |
hitter->y = victim_y; | | hitter->y = victim_y; |
| | |
} else { /* The last face was not blank, leave an image */ | | } else { /* The last face was not blank, leave an image */ |
CLEAR_FLAG(op, FLAG_BLOCKSVIEW); | | CLEAR_FLAG(op, FLAG_BLOCKSVIEW); |
update_all_los(op->map, op->x, op->y); | | update_all_los(op->map, op->x, op->y); |
CLEAR_FLAG(op, FLAG_NO_PASS); | | op->move_block = 0; |
CLEAR_FLAG(op, FLAG_ALIVE); | | CLEAR_FLAG(op, FLAG_ALIVE); |
} | | } |
} | | } |
| | |
} | | } |
if (unaggressive) | | if (unaggressive) |
SET_FLAG(tmp, FLAG_UNAGGRESSIVE); | | SET_FLAG(tmp, FLAG_UNAGGRESSIVE); |
j=find_first_free_spot(tmp->arch,op->map,op->x,op->y); | | j=find_first_free_spot(tmp,op->map,op->x,op->y); |
if (j==-1) /* No spot to put this monster */ | | if (j==-1) /* No spot to put this monster */ |
free_object(tmp); | | free_object(tmp); |
else { | | else { |
| | |
adjust -= 3; | | adjust -= 3; |
| | |
/* if we attack at a different 'altitude' its harder */ | | /* if we attack at a different 'altitude' its harder */ |
if(QUERY_FLAG(attacker,FLAG_FLYING)!=QUERY_FLAG(target,FLAG_FLYING)) | | if((attacker->move_type & target->move_type)==0) |
adjust -= 2; | | adjust -= 2; |
| | |
#if 0 | | #if 0 |
| | |
/* I broke what used to be one big if into a few nested | | /* I broke what used to be one big if into a few nested |
* ones so that figuring out the logic is at least possible. | | * ones so that figuring out the logic is at least possible. |
*/ | | */ |
if (op && QUERY_FLAG(op,FLAG_FLYING)) { | | if (op && (op->move_type & MOVE_FLYING)) { |
if (op->type==ARROW || op->type==THROWN_OBJ) | | if (op->type==ARROW || op->type==THROWN_OBJ) |
return 1; | | return 1; |
else if (op->type==SPELL_EFFECT && (op->subtype == SP_BULLET || | | else if (op->type==SPELL_EFFECT && (op->subtype == SP_BULLET || |