version 1.70 | | version 1.71 |
---|
| | |
/* | | /* |
* static char *rcsid_apply_c = | | * static char *rcsid_apply_c = |
* "$Id: apply.c,v 1.70 2002/11/30 04:17:41 mwedel Exp $"; | | * "$Id: apply.c,v 1.71 2002/12/01 03:46:25 mwedel Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
if (armour->magic >= (op->level / 10 + 1) | | if (armour->magic >= (op->level / 10 + 1) |
|| new_armour > op->level) | | || new_armour > op->level) |
{ | | { |
new_draw_info(NDI_UNIQUE, 0,op,"You are not yet powerfull enough"); | | int i; |
| | |
| | i = armour->magic * op->level; |
| | if (i > new_armour) new_armour=i; |
| | |
| | new_draw_info_format(NDI_UNIQUE, 0,op,"You need to be level %d", new_armour); |
new_draw_info(NDI_UNIQUE, 0,op,"to improve this armour."); | | new_draw_info(NDI_UNIQUE, 0,op,"to improve this armour."); |
return 0; | | return 0; |
} | | } |
| | |
} | | } |
| | |
/* | | /* |
* Eneq(@csd.uu.se): Handle apply on containers. | | * Eneq(@csd.uu.se): Handle apply on containers. This is for containers |
| | * the player has in their inventory, eg, sacks, luggages, etc. |
| | * |
* Moved to own function and added many features [Tero.Haatanen@lut.fi] | | * Moved to own function and added many features [Tero.Haatanen@lut.fi] |
* This version is for client/server mode. | | * This version is for client/server mode. |
* op is the player, sack is the container the player is opening or closing. | | * op is the player, sack is the container the player is opening or closing. |
| | |
} | | } |
} | | } |
| | |
| | /* Applies a treasure object - by default, chest. op |
| | * is the person doing the applying, tmp is the treasure |
| | * chest. |
| | */ |
static void apply_treasure (object *op, object *tmp) | | static void apply_treasure (object *op, object *tmp) |
{ | | { |
object *treas; | | object *treas; |
tag_t tmp_tag = tmp->count, op_tag = op->count; | | tag_t tmp_tag = tmp->count, op_tag = op->count; |
| | |
| | |
/* Nice side effect of new treasure creation method is that the treasure | | /* Nice side effect of new treasure creation method is that the treasure |
for the chest is done when the chest is created, and put into the chest | | * for the chest is done when the chest is created, and put into the chest |
inventory. So that when the chest burns up, the items still exist. Also | | * inventory. So that when the chest burns up, the items still exist. Also |
prevents people fromt moving chests to more difficult maps to get better | | * prevents people fromt moving chests to more difficult maps to get better |
treasure | | * treasure |
*/ | | */ |
| | |
treas = tmp->inv; | | treas = tmp->inv; |
if(treas==NULL) { | | if(treas==NULL) { |
new_draw_info(NDI_UNIQUE, 0,op,"The chest was empty."); | | new_draw_info(NDI_UNIQUE, 0,op,"The chest was empty."); |
decrease_ob(tmp); | | decrease_ob(tmp); |
return; | | return; |
} | | } |
do { | | while (tmp->inv) { |
| | treas = tmp->inv; |
| | |
remove_ob(treas); | | remove_ob(treas); |
new_draw_info_format(NDI_UNIQUE, 0, op, "You find %s in the chest.", | | new_draw_info_format(NDI_UNIQUE, 0, op, "You find %s in the chest.", |
query_name(treas)); | | query_name(treas)); |
treas->x=op->x,treas->y=op->y; | | |
treas = insert_ob_in_map (treas, op->map, op,0); | | treas->x=op->x; |
| | treas->y=op->y; |
| | treas = insert_ob_in_map (treas, op->map, op,INS_BELOW_ORIGINATOR); |
| | |
if (treas && treas->type == RUNE && treas->level | | if (treas && treas->type == RUNE && treas->level |
&& QUERY_FLAG (op, FLAG_ALIVE)) | | && QUERY_FLAG (op, FLAG_ALIVE)) |
spring_trap (treas, op); | | spring_trap (treas, op); |
| | /* If either player or container was destroyed, no need to do |
| | * further processing. I think this should be enclused with |
| | * spring trap above, as I don't think there is otherwise |
| | * any way for the treasure chest or player to get killed |
| | */ |
if (was_destroyed (op, op_tag) || was_destroyed (tmp, tmp_tag)) | | if (was_destroyed (op, op_tag) || was_destroyed (tmp, tmp_tag)) |
break; | | break; |
} while ((treas=tmp->inv)!=NULL); | | } |
| | |
if ( ! was_destroyed (tmp, tmp_tag) && tmp->inv == NULL) | | if ( ! was_destroyed (tmp, tmp_tag) && tmp->inv == NULL) |
decrease_ob (tmp); | | decrease_ob (tmp); |