… | |
… | |
264 | |
264 | |
265 | new_draw_info (NDI_UNIQUE, 0, ob, "Welcome Back!"); |
265 | new_draw_info (NDI_UNIQUE, 0, ob, "Welcome Back!"); |
266 | |
266 | |
267 | esrv_new_player (this, ob->weight + ob->carrying); |
267 | esrv_new_player (this, ob->weight + ob->carrying); |
268 | |
268 | |
|
|
269 | ob->flag [FLAG_READY_WEAPON] = false; |
|
|
270 | ob->flag [FLAG_READY_SKILL] = false; |
|
|
271 | ob->flag [FLAG_READY_BOW] = false; |
|
|
272 | |
269 | for (object *op = ob->inv; op; op = op->below) |
273 | for (object *op = ob->inv; op; op = op->below) |
270 | if (op->flag [FLAG_APPLIED]) |
274 | if (op->flag [FLAG_APPLIED]) |
271 | switch (op->type) |
275 | switch (op->type) |
272 | { |
276 | { |
273 | case WAND: |
277 | case WAND: |
274 | case ROD: |
278 | case ROD: |
275 | case HORN: |
279 | case HORN: |
276 | case BOW: |
280 | case BOW: |
277 | case SKILL: |
|
|
278 | case SKILL_TOOL: |
281 | case SKILL_TOOL: |
279 | case WEAPON: |
282 | case WEAPON: |
280 | apply_special (ob, op, AP_UNAPPLY); |
283 | op->flag [FLAG_APPLIED] = false; |
281 | apply_special (ob, op, AP_APPLY); |
284 | apply_special (ob, op, AP_APPLY); |
282 | break; |
285 | break; |
283 | } |
|
|
284 | |
286 | |
|
|
287 | case SKILL: |
|
|
288 | op->flag [FLAG_APPLIED] = false; |
|
|
289 | break; |
|
|
290 | } |
|
|
291 | |
|
|
292 | ob->change_weapon (combat_ob ? combat_ob : ranged_ob); |
285 | ob->update_stats (); |
293 | ob->update_stats (); |
|
|
294 | |
286 | ns->floorbox_update (); |
295 | ns->floorbox_update (); |
287 | |
|
|
288 | esrv_send_inventory (ob, ob); |
296 | esrv_send_inventory (ob, ob); |
289 | esrv_add_spells (this, 0); |
297 | esrv_add_spells (this, 0); |
290 | |
298 | |
291 | activate (); |
299 | activate (); |
292 | |
300 | |
… | |
… | |
2104 | |
2112 | |
2105 | /* If the creature is a pet, push it even if the player is not |
2113 | /* 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 |
2114 | * peaceful. Our assumption is the creature is a pet if the |
2107 | * player owns it and it is either friendly or unagressive. |
2115 | * player owns it and it is either friendly or unagressive. |
2108 | */ |
2116 | */ |
2109 | if ((op->type == PLAYER) |
2117 | if (op->type == PLAYER |
2110 | #if COZY_SERVER |
|
|
2111 | && |
|
|
2112 | ((mon->owner && mon->owner->contr |
2118 | && ((mon->owner && mon->owner->contr |
2113 | && same_party (mon->owner->contr->party, op->contr->party)) || mon->owner == op) |
2119 | && same_party (mon->owner->contr->party, op->contr->party)) |
2114 | #else |
|
|
2115 | && mon->owner == op |
2120 | || mon->owner == op) |
2116 | #endif |
|
|
2117 | && (QUERY_FLAG (mon, FLAG_UNAGGRESSIVE) || QUERY_FLAG (mon, FLAG_FRIENDLY))) |
2121 | && (QUERY_FLAG (mon, FLAG_UNAGGRESSIVE) || QUERY_FLAG (mon, FLAG_FRIENDLY))) |
2118 | { |
2122 | { |
2119 | /* If we're braced, we don't want to switch places with it */ |
2123 | /* If we're braced, we don't want to switch places with it */ |
2120 | if (op->contr->braced) |
2124 | if (op->contr->braced) |
2121 | return; |
2125 | return; |
… | |
… | |
2131 | /* in certain circumstances, you shouldn't attack friendly |
2135 | /* in certain circumstances, you shouldn't attack friendly |
2132 | * creatures. Note that if you are braced, you can't push |
2136 | * creatures. Note that if you are braced, you can't push |
2133 | * someone, but put it inside this loop so that you won't |
2137 | * someone, but put it inside this loop so that you won't |
2134 | * attack them either. |
2138 | * attack them either. |
2135 | */ |
2139 | */ |
2136 | if ((mon->type == PLAYER || mon->enemy != op) && |
2140 | if ((mon->type == PLAYER || mon->enemy != op) |
2137 | (mon->type == PLAYER || QUERY_FLAG (mon, FLAG_UNAGGRESSIVE) || QUERY_FLAG (mon, FLAG_FRIENDLY)) && ( |
2141 | && (mon->type == PLAYER || QUERY_FLAG (mon, FLAG_UNAGGRESSIVE) || QUERY_FLAG (mon, FLAG_FRIENDLY)) |
2138 | #ifdef PROHIBIT_PLAYERKILL |
|
|
2139 | (op->contr->peaceful |
2142 | && ((op->contr->peaceful |
2140 | || (mon->type == PLAYER |
2143 | || (mon->type == PLAYER && mon->contr->peaceful)) |
2141 | && mon->contr-> |
|
|
2142 | peaceful)) && |
|
|
2143 | #else |
|
|
2144 | op->contr->peaceful && |
|
|
2145 | #endif |
|
|
2146 | !on_battleground)) |
2144 | && !on_battleground)) |
2147 | { |
2145 | { |
2148 | if (!op->contr->braced) |
2146 | if (!op->contr->braced) |
2149 | { |
2147 | { |
2150 | play_sound_map (op->map, op->x, op->y, SOUND_PUSH_PLAYER); |
2148 | play_sound_map (op->map, op->x, op->y, SOUND_PUSH_PLAYER); |
2151 | push_ob (mon, dir, op); |
2149 | push_ob (mon, dir, op); |
… | |
… | |
2574 | } |
2572 | } |
2575 | |
2573 | |
2576 | /* Digestion */ |
2574 | /* Digestion */ |
2577 | if (--op->last_eat < 0) |
2575 | if (--op->last_eat < 0) |
2578 | { |
2576 | { |
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; |
2577 | int bonus = op->contr->digestion > 0 ? op->contr->digestion : 0, penalty = op->contr->digestion < 0 ? -op->contr->digestion : 0; |
2584 | #endif |
|
|
2585 | |
2578 | |
2586 | if (op->contr->gen_hp > 0) |
2579 | if (op->contr->gen_hp > 0) |
2587 | op->last_eat = 25 * (1 + bonus) / (op->contr->gen_hp + penalty + 1); |
2580 | op->last_eat = 25 * (1 + bonus) / (op->contr->gen_hp + penalty + 1); |
2588 | else |
2581 | else |
2589 | op->last_eat = 25 * (1 + bonus) / (penalty + 1); |
2582 | op->last_eat = 25 * (1 + bonus) / (penalty + 1); |