1 | /* |
1 | /* |
2 | * static char *rcsid_player_c = |
2 | * static char *rcsid_player_c = |
3 | * "$Id: player.c,v 1.3 2006/02/08 04:32:19 root Exp $"; |
3 | * "$Id: player.c,v 1.4 2006/02/09 02:11:26 root Exp $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | /* |
6 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
7 | CrossFire, A Multiplayer game for X-windows |
8 | |
8 | |
… | |
… | |
38 | #include <object.h> |
38 | #include <object.h> |
39 | #include <spells.h> |
39 | #include <spells.h> |
40 | #include <skills.h> |
40 | #include <skills.h> |
41 | #include <newclient.h> |
41 | #include <newclient.h> |
42 | |
42 | |
|
|
43 | #ifdef COZY_SERVER |
43 | extern int same_party (partylist *a, partylist *b); |
44 | extern int same_party (partylist *a, partylist *b); |
|
|
45 | #endif |
44 | |
46 | |
45 | player *find_player(const char *plname) |
47 | player *find_player(const char *plname) |
46 | { |
48 | { |
47 | player *pl; |
49 | player *pl; |
48 | for(pl=first_player;pl!=NULL;pl=pl->next) |
50 | for(pl=first_player;pl!=NULL;pl=pl->next) |
… | |
… | |
2055 | /* If the creature is a pet, push it even if the player is not |
2057 | /* If the creature is a pet, push it even if the player is not |
2056 | * peaceful. Our assumption is the creature is a pet if the |
2058 | * peaceful. Our assumption is the creature is a pet if the |
2057 | * player owns it and it is either friendly or unagressive. |
2059 | * player owns it and it is either friendly or unagressive. |
2058 | */ |
2060 | */ |
2059 | if ((op->type==PLAYER) |
2061 | if ((op->type==PLAYER) |
|
|
2062 | #if COZY_SERVER |
2060 | && |
2063 | && |
2061 | ( |
2064 | ( |
2062 | (get_owner(mon) && get_owner(mon)->contr |
2065 | (get_owner(mon) && get_owner(mon)->contr |
2063 | && same_party (get_owner(mon)->contr->party, op->contr->party)) |
2066 | && same_party (get_owner(mon)->contr->party, op->contr->party)) |
2064 | || get_owner(mon) == op |
2067 | || get_owner(mon) == op |
2065 | ) |
2068 | ) |
|
|
2069 | #else |
|
|
2070 | && get_owner(mon)==op |
|
|
2071 | #endif |
2066 | && (QUERY_FLAG(mon,FLAG_UNAGGRESSIVE) || QUERY_FLAG(mon, FLAG_FRIENDLY))) |
2072 | && (QUERY_FLAG(mon,FLAG_UNAGGRESSIVE) || QUERY_FLAG(mon, FLAG_FRIENDLY))) |
2067 | { |
2073 | { |
2068 | /* If we're braced, we don't want to switch places with it */ |
2074 | /* If we're braced, we don't want to switch places with it */ |
2069 | if (op->contr->braced) return; |
2075 | if (op->contr->braced) return; |
2070 | play_sound_map(op->map, op->x, op->y, SOUND_PUSH_PLAYER); |
2076 | play_sound_map(op->map, op->x, op->y, SOUND_PUSH_PLAYER); |
… | |
… | |
2471 | } |
2477 | } |
2472 | } |
2478 | } |
2473 | |
2479 | |
2474 | /* Digestion */ |
2480 | /* Digestion */ |
2475 | if(--op->last_eat<0) { |
2481 | if(--op->last_eat<0) { |
|
|
2482 | #ifdef COZY_SERVER |
2476 | int dg = op->contr->digestion>=0 && op->contr->digestion<2 ? 2 : op->contr->digestion; |
2483 | int dg = op->contr->digestion>=0 && op->contr->digestion<2 ? 2 : op->contr->digestion; |
2477 | int bonus=dg>0?dg:0, |
2484 | int bonus=dg>0?dg:0, |
2478 | penalty=dg<0?-dg:0; |
2485 | penalty=dg<0?-dg:0; |
|
|
2486 | #else |
|
|
2487 | int bonus=op->contr->digestion>0?op->contr->digestion:0, |
|
|
2488 | penalty=op->contr->digestion<0?-op->contr->digestion:0; |
|
|
2489 | #endif |
|
|
2490 | |
2479 | if(op->contr->gen_hp > 0) |
2491 | if(op->contr->gen_hp > 0) |
2480 | op->last_eat=25*(1+bonus)/(op->contr->gen_hp+penalty+1); |
2492 | op->last_eat=25*(1+bonus)/(op->contr->gen_hp+penalty+1); |
2481 | else |
2493 | else |
2482 | op->last_eat=25*(1+bonus)/(penalty +1); |
2494 | op->last_eat=25*(1+bonus)/(penalty +1); |
2483 | /* dms do not consume food */ |
2495 | /* dms do not consume food */ |
… | |
… | |
2633 | |
2645 | |
2634 | /* Basically two ways to go - remove a stat permanently, or just |
2646 | /* Basically two ways to go - remove a stat permanently, or just |
2635 | * make it depletion. This bunch of code deals with that aspect |
2647 | * make it depletion. This bunch of code deals with that aspect |
2636 | * of death. |
2648 | * of death. |
2637 | */ |
2649 | */ |
2638 | #if 0 |
2650 | #ifndef COZY_SERVER |
2639 | if (settings.balanced_stat_loss) { |
2651 | if (settings.balanced_stat_loss) { |
2640 | /* If stat loss is permanent, lose one stat only. */ |
2652 | /* If stat loss is permanent, lose one stat only. */ |
2641 | /* Lower level chars don't lose as many stats because they suffer |
2653 | /* Lower level chars don't lose as many stats because they suffer |
2642 | more if they do. */ |
2654 | more if they do. */ |
2643 | /* Higher level characters can afford things such as potions of |
2655 | /* Higher level characters can afford things such as potions of |