ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/player.C
(Generate patch)

Comparing deliantra/server/server/player.C (file contents):
Revision 1.136 by root, Wed May 16 11:10:01 2007 UTC vs.
Revision 1.140 by root, Fri May 18 13:15:29 2007 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines