version 1.166 | | version 1.167 |
---|
| | |
/* | | /* |
* static char *rcsid_apply_c = | | * static char *rcsid_apply_c = |
* "$Id: apply.c,v 1.166 2006/04/06 21:18:35 tchize Exp $"; | | * "$Id: apply.c,v 1.167 2006/05/05 09:26:34 ryo_saeba Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
/* need math lib for double-precision and pow() in dragon_eat_flesh() */ | | /* need math lib for double-precision and pow() in dragon_eat_flesh() */ |
#include <math.h> | | #include <math.h> |
| | |
| | static int dragon_eat_flesh(object *op, object *meal); |
| | static void apply_item_transformer(object *pl, object *transformer); |
| | static void apply_lighter(object *who, object *lighter); |
| | static void scroll_failure(object *op, int failure, int power); |
| | |
/** Can transport hold object op? | | /** Can transport hold object op? |
* This is a pretty trivial function, | | * This is a pretty trivial function, |
* but in the future, possible transport may have more restrictions | | * but in the future, possible transport may have more restrictions |
| | |
/** | | /** |
* Actually improves the weapon, and tells user. | | * Actually improves the weapon, and tells user. |
*/ | | */ |
int improve_weapon_stat(object *op,object *improver,object *weapon, | | static int improve_weapon_stat(object *op,object *improver,object *weapon, |
signed char *stat,int sacrifice_count,const char *statname) | | signed char *stat,int sacrifice_count,const char *statname) |
{ | | { |
| | |
| | |
* Checks for sacrifice, and so on. | | * Checks for sacrifice, and so on. |
*/ | | */ |
| | |
int prepare_weapon(object *op, object *improver, object *weapon) | | static int prepare_weapon(object *op, object *improver, object *weapon) |
{ | | { |
int sacrifice_count,i; | | int sacrifice_count,i; |
char buf[MAX_BUF]; | | char buf[MAX_BUF]; |
| | |
* last_eat numbers for an object. Hopefully this won't break anything ?? | | * last_eat numbers for an object. Hopefully this won't break anything ?? |
* level == max improve last_eat == current improve | | * level == max improve last_eat == current improve |
*/ | | */ |
int improve_weapon(object *op,object *improver,object *weapon) | | static int improve_weapon(object *op,object *improver,object *weapon) |
{ | | { |
int sacrifice_count, sacrifice_needed=0; | | int sacrifice_count, sacrifice_needed=0; |
| | |
| | |
* Checks a few things (not on a non-magic square, marked weapon, ...), | | * Checks a few things (not on a non-magic square, marked weapon, ...), |
* then calls improve_weapon to do the dirty work. | | * then calls improve_weapon to do the dirty work. |
*/ | | */ |
int check_improve_weapon (object *op, object *tmp) | | static int check_improve_weapon (object *op, object *tmp) |
{ | | { |
object *otmp; | | object *otmp; |
| | |
| | |
* Modified by MSW for partial resistance. Only support | | * Modified by MSW for partial resistance. Only support |
* changing of physical area right now. | | * changing of physical area right now. |
*/ | | */ |
int improve_armour(object *op, object *improver, object *armour) | | static int improve_armour(object *op, object *improver, object *armour) |
{ | | { |
object *tmp; | | object *tmp; |
| | |
| | |
* item is the object that triggered the converter - if it is not | | * item is the object that triggered the converter - if it is not |
* what the converter wants, this will not do anything. | | * what the converter wants, this will not do anything. |
*/ | | */ |
int convert_item(object *item, object *converter) { | | static int convert_item(object *item, object *converter) { |
int nr=0; | | int nr=0; |
object *tmp; | | object *tmp; |
int is_in_shop; | | int is_in_shop; |
| | |
* added the alchemical cauldron to the code -b.t. | | * added the alchemical cauldron to the code -b.t. |
*/ | | */ |
| | |
int apply_container (object *op, object *sack) | | static int apply_container (object *op, object *sack) |
{ | | { |
char buf[MAX_BUF]; | | char buf[MAX_BUF]; |
object *tmp; | | object *tmp; |
| | |
* return: | | * return: |
* int 1 if eating successful, 0 if it doesn't work | | * int 1 if eating successful, 0 if it doesn't work |
*/ | | */ |
int dragon_eat_flesh(object *op, object *meal) { | | static int dragon_eat_flesh(object *op, object *meal) { |
object *skin = NULL; /* pointer to dragon skin force*/ | | object *skin = NULL; /* pointer to dragon skin force*/ |
object *abil = NULL; /* pointer to dragon ability force*/ | | object *abil = NULL; /* pointer to dragon ability force*/ |
object *tmp = NULL; /* tmp. object */ | | object *tmp = NULL; /* tmp. object */ |
| | |
* in the field exit->name cause the field exit->owner doesn't | | * in the field exit->name cause the field exit->owner doesn't |
* survive in the swapping (in fact the whole exit doesn't survive). | | * survive in the swapping (in fact the whole exit doesn't survive). |
*/ | | */ |
int is_legal_2ways_exit (object* op, object *exit) | | static int is_legal_2ways_exit (object* op, object *exit) |
{ | | { |
object * tmp; | | object * tmp; |
object * exit_owner; | | object * exit_owner; |
| | |
* invisible other objects that use | | * invisible other objects that use |
* up body locations can be used as restrictions. | | * up body locations can be used as restrictions. |
*/ | | */ |
object *get_item_from_body_location(object *start, int loc) | | static object *get_item_from_body_location(object *start, int loc) |
{ | | { |
object *tmp; | | object *tmp; |
| | |
| | |
* instead of doing it. This is a lot less code than having | | * instead of doing it. This is a lot less code than having |
* another function that does just that. | | * another function that does just that. |
*/ | | */ |
int unapply_for_ob(object *who, object *op, int aflags) | | static int unapply_for_ob(object *who, object *op, int aflags) |
{ | | { |
int i; | | int i; |
object *tmp=NULL, *last; | | object *tmp=NULL, *last; |
| | |
} | | } |
| | |
| | |
int monster_apply_special (object *who, object *op, int aflags) | | static int monster_apply_special (object *who, object *op, int aflags) |
{ | | { |
if (QUERY_FLAG (op, FLAG_UNPAID) && ! QUERY_FLAG (op, FLAG_APPLIED)) | | if (QUERY_FLAG (op, FLAG_UNPAID) && ! QUERY_FLAG (op, FLAG_APPLIED)) |
return 1; | | return 1; |
| | |
* the selected object to "burn". -b.t. | | * the selected object to "burn". -b.t. |
*/ | | */ |
| | |
void apply_lighter(object *who, object *lighter) { | | static void apply_lighter(object *who, object *lighter) { |
object *item; | | object *item; |
int is_player_env=0; | | int is_player_env=0; |
uint32 nrof; | | uint32 nrof; |
| | |
* op made some mistake with a scroll, this takes care of punishment. | | * op made some mistake with a scroll, this takes care of punishment. |
* scroll_failure()- hacked directly from spell_failure | | * scroll_failure()- hacked directly from spell_failure |
*/ | | */ |
void scroll_failure(object *op, int failure, int power) | | static void scroll_failure(object *op, int failure, int power) |
{ | | { |
if(abs(failure/4)>power) power=abs(failure/4); /* set minimum effect */ | | if(abs(failure/4)>power) power=abs(failure/4); /* set minimum effect */ |
| | |
| | |
* This way an item can be transformed in many things, and/or many objects. | | * This way an item can be transformed in many things, and/or many objects. |
* The 'slaying' field for transformer is used as verb for the action. | | * The 'slaying' field for transformer is used as verb for the action. |
*/ | | */ |
void apply_item_transformer( object* pl, object* transformer ) | | static void apply_item_transformer( object* pl, object* transformer ) |
{ | | { |
object* marked; | | object* marked; |
object* new_item; | | object* new_item; |