… | |
… | |
2104 | |
2104 | |
2105 | /* If the creature is a pet, push it even if the player is not |
2105 | /* If the creature is a pet, push it even if the player is not |
2106 | * peaceful. Our assumption is the creature is a pet if the |
2106 | * peaceful. Our assumption is the creature is a pet if the |
2107 | * player owns it and it is either friendly or unagressive. |
2107 | * player owns it and it is either friendly or unagressive. |
2108 | */ |
2108 | */ |
2109 | if ((op->type == PLAYER) |
2109 | if (op->type == PLAYER |
2110 | #if COZY_SERVER |
|
|
2111 | && |
|
|
2112 | ((mon->owner && mon->owner->contr |
2110 | && ((mon->owner && mon->owner->contr |
2113 | && same_party (mon->owner->contr->party, op->contr->party)) || mon->owner == op) |
2111 | && same_party (mon->owner->contr->party, op->contr->party)) |
2114 | #else |
|
|
2115 | && mon->owner == op |
2112 | || mon->owner == op) |
2116 | #endif |
|
|
2117 | && (QUERY_FLAG (mon, FLAG_UNAGGRESSIVE) || QUERY_FLAG (mon, FLAG_FRIENDLY))) |
2113 | && (QUERY_FLAG (mon, FLAG_UNAGGRESSIVE) || QUERY_FLAG (mon, FLAG_FRIENDLY))) |
2118 | { |
2114 | { |
2119 | /* If we're braced, we don't want to switch places with it */ |
2115 | /* If we're braced, we don't want to switch places with it */ |
2120 | if (op->contr->braced) |
2116 | if (op->contr->braced) |
2121 | return; |
2117 | return; |
… | |
… | |
2131 | /* in certain circumstances, you shouldn't attack friendly |
2127 | /* in certain circumstances, you shouldn't attack friendly |
2132 | * creatures. Note that if you are braced, you can't push |
2128 | * creatures. Note that if you are braced, you can't push |
2133 | * someone, but put it inside this loop so that you won't |
2129 | * someone, but put it inside this loop so that you won't |
2134 | * attack them either. |
2130 | * attack them either. |
2135 | */ |
2131 | */ |
2136 | if ((mon->type == PLAYER || mon->enemy != op) && |
2132 | if ((mon->type == PLAYER || mon->enemy != op) |
2137 | (mon->type == PLAYER || QUERY_FLAG (mon, FLAG_UNAGGRESSIVE) || QUERY_FLAG (mon, FLAG_FRIENDLY)) && ( |
2133 | && (mon->type == PLAYER || QUERY_FLAG (mon, FLAG_UNAGGRESSIVE) || QUERY_FLAG (mon, FLAG_FRIENDLY)) |
2138 | #ifdef PROHIBIT_PLAYERKILL |
|
|
2139 | (op->contr->peaceful |
2134 | && ((op->contr->peaceful |
2140 | || (mon->type == PLAYER |
2135 | || (mon->type == PLAYER && mon->contr->peaceful)) |
2141 | && mon->contr-> |
|
|
2142 | peaceful)) && |
|
|
2143 | #else |
|
|
2144 | op->contr->peaceful && |
|
|
2145 | #endif |
|
|
2146 | !on_battleground)) |
2136 | && !on_battleground)) |
2147 | { |
2137 | { |
2148 | if (!op->contr->braced) |
2138 | if (!op->contr->braced) |
2149 | { |
2139 | { |
2150 | play_sound_map (op->map, op->x, op->y, SOUND_PUSH_PLAYER); |
2140 | play_sound_map (op->map, op->x, op->y, SOUND_PUSH_PLAYER); |
2151 | push_ob (mon, dir, op); |
2141 | push_ob (mon, dir, op); |
… | |
… | |
2574 | } |
2564 | } |
2575 | |
2565 | |
2576 | /* Digestion */ |
2566 | /* Digestion */ |
2577 | if (--op->last_eat < 0) |
2567 | if (--op->last_eat < 0) |
2578 | { |
2568 | { |
2579 | #ifdef COZY_SERVER |
|
|
2580 | int dg = op->contr->digestion >= 0 && op->contr->digestion < 2 ? 2 : op->contr->digestion; |
|
|
2581 | int bonus = dg > 0 ? dg : 0, penalty = dg < 0 ? -dg : 0; |
|
|
2582 | #else |
|
|
2583 | int bonus = op->contr->digestion > 0 ? op->contr->digestion : 0, penalty = op->contr->digestion < 0 ? -op->contr->digestion : 0; |
2569 | int bonus = op->contr->digestion > 0 ? op->contr->digestion : 0, penalty = op->contr->digestion < 0 ? -op->contr->digestion : 0; |
2584 | #endif |
|
|
2585 | |
2570 | |
2586 | if (op->contr->gen_hp > 0) |
2571 | if (op->contr->gen_hp > 0) |
2587 | op->last_eat = 25 * (1 + bonus) / (op->contr->gen_hp + penalty + 1); |
2572 | op->last_eat = 25 * (1 + bonus) / (op->contr->gen_hp + penalty + 1); |
2588 | else |
2573 | else |
2589 | op->last_eat = 25 * (1 + bonus) / (penalty + 1); |
2574 | op->last_eat = 25 * (1 + bonus) / (penalty + 1); |