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

Comparing deliantra/server/common/living.C (file contents):
Revision 1.82 by root, Mon Apr 21 23:35:24 2008 UTC vs.
Revision 1.83 by root, Fri May 2 20:16:24 2008 UTC

283{ 283{
284 int flag = QUERY_FLAG (tmp, FLAG_APPLIED) ? 1 : -1, success = 0; 284 int flag = QUERY_FLAG (tmp, FLAG_APPLIED) ? 1 : -1, success = 0;
285 char message[MAX_BUF]; 285 char message[MAX_BUF];
286 int potion_max = 0; 286 int potion_max = 0;
287 287
288 /* remember what object was like before it was changed. note that 288 object::flags_t prev_flag = op->flag;
289 * refop is a local copy of op only to be used for detecting changes 289 MoveType prev_move_type = op->move_type;
290 * found by update_stats. refop is not a real object 290 sint16 prev_resist [NROFATTACKS]; // clumsy
291 */ 291 assert (sizeof (prev_resist) == sizeof (op->resist));
292 object_copy refop = *op; 292 memcpy (prev_resist, op->resist, sizeof (prev_resist));
293 293
294 if (op->type == PLAYER) 294 if (op->type == PLAYER)
295 { 295 {
296 if (tmp->type == POTION) 296 if (tmp->type == POTION)
297 { 297 {
365 { 365 {
366 success = 1; 366 success = 1;
367 DIFF_MSG (flag, "Your hands begin to glow red.", "Your hands stop glowing red."); 367 DIFF_MSG (flag, "Your hands begin to glow red.", "Your hands stop glowing red.");
368 } 368 }
369 369
370 if (QUERY_FLAG (op, FLAG_LIFESAVE) != QUERY_FLAG (&refop, FLAG_LIFESAVE)) 370 if (op->flag [FLAG_LIFESAVE] != prev_flag [FLAG_LIFESAVE])
371 { 371 {
372 success = 1; 372 success = 1;
373 DIFF_MSG (flag, "You feel very protected.", "You don't feel protected anymore."); 373 DIFF_MSG (flag, "You feel very protected.", "You don't feel protected anymore.");
374 } 374 }
375 375
376 if (QUERY_FLAG (op, FLAG_REFL_MISSILE) != QUERY_FLAG (&refop, FLAG_REFL_MISSILE)) 376 if (op->flag [FLAG_REFL_MISSILE] != prev_flag [FLAG_REFL_MISSILE])
377 { 377 {
378 success = 1; 378 success = 1;
379 DIFF_MSG (flag, "A magic force shimmers around you.", "The magic force fades away."); 379 DIFF_MSG (flag, "A magic force shimmers around you.", "The magic force fades away.");
380 } 380 }
381 381
382 if (QUERY_FLAG (op, FLAG_REFL_SPELL) != QUERY_FLAG (&refop, FLAG_REFL_SPELL)) 382 if (op->flag [FLAG_REFL_SPELL] != prev_flag [FLAG_REFL_SPELL])
383 { 383 {
384 success = 1; 384 success = 1;
385 DIFF_MSG (flag, "You feel more safe now, somehow.", "Suddenly you feel less safe, somehow."); 385 DIFF_MSG (flag, "You feel more safe now, somehow.", "Suddenly you feel less safe, somehow.");
386 } 386 }
387 387
389 * user has multiple items giving the same type appled like we 389 * user has multiple items giving the same type appled like we
390 * used to - that is more work than what we gain, plus messages 390 * used to - that is more work than what we gain, plus messages
391 * can be misleading (a little higher could be miscontrued from 391 * can be misleading (a little higher could be miscontrued from
392 * from fly high) 392 * from fly high)
393 */ 393 */
394 if (tmp->move_type && op->move_type != refop.move_type) 394 if (tmp->move_type && op->move_type != prev_move_type)
395 { 395 {
396 success = 1; 396 success = 1;
397 397
398 /* MOVE_FLY_HIGH trumps MOVE_FLY_LOW - changing your move_fly_low 398 /* MOVE_FLY_HIGH trumps MOVE_FLY_LOW - changing your move_fly_low
399 * status doesn't make a difference if you are flying high 399 * status doesn't make a difference if you are flying high
420 } 420 }
421 421
422 /* becoming UNDEAD... a special treatment for this flag. Only those not 422 /* becoming UNDEAD... a special treatment for this flag. Only those not
423 * originally undead may change their status 423 * originally undead may change their status
424 */ 424 */
425 if (!QUERY_FLAG (op->arch, FLAG_UNDEAD)) 425 if (!op->arch->flag [FLAG_UNDEAD])
426 if (QUERY_FLAG (op, FLAG_UNDEAD) != QUERY_FLAG (&refop, FLAG_UNDEAD)) 426 if (op->flag [FLAG_UNDEAD] != prev_flag [FLAG_UNDEAD])
427 { 427 {
428 success = 1; 428 success = 1;
429 if (flag > 0) 429 if (flag > 0)
430 { 430 {
431 op->race = "undead"; 431 op->race = "undead";
436 op->race = op->arch->race; 436 op->race = op->arch->race;
437 new_draw_info (NDI_UNIQUE, 0, op, "Your lifeforce returns!"); 437 new_draw_info (NDI_UNIQUE, 0, op, "Your lifeforce returns!");
438 } 438 }
439 } 439 }
440 440
441 if (QUERY_FLAG (op, FLAG_STEALTH) != QUERY_FLAG (&refop, FLAG_STEALTH)) 441 if (op->flag [FLAG_STEALTH] != prev_flag [FLAG_STEALTH])
442 { 442 {
443 success = 1; 443 success = 1;
444 DIFF_MSG (flag, "You walk more quietly.", "You walk more noisily."); 444 DIFF_MSG (flag, "You walk more quietly.", "You walk more noisily.");
445 } 445 }
446 446
447 if (QUERY_FLAG (op, FLAG_MAKE_INVIS) != QUERY_FLAG (&refop, FLAG_MAKE_INVIS)) 447 if (op->flag [FLAG_MAKE_INVIS] != prev_flag [FLAG_MAKE_INVIS])
448 { 448 {
449 success = 1; 449 success = 1;
450 DIFF_MSG (flag, "You become transparent.", "You can see yourself."); 450 DIFF_MSG (flag, "You become transparent.", "You can see yourself.");
451 } 451 }
452 452
453 /* blinded you can tell if more blinded since blinded player has minimal 453 /* blinded you can tell if more blinded since blinded player has minimal
454 * vision 454 * vision
455 */ 455 */
456 if (QUERY_FLAG (tmp, FLAG_BLIND)) 456 if (tmp->flag [FLAG_BLIND])
457 { 457 {
458 success = 1; 458 success = 1;
459 if (flag > 0) 459 if (flag > 0)
460 { 460 {
461 if (QUERY_FLAG (op, FLAG_WIZ)) 461 if (op->flag [FLAG_WIZ])
462 new_draw_info (NDI_UNIQUE, 0, op, "Your mortal self is blinded."); 462 new_draw_info (NDI_UNIQUE, 0, op, "Your mortal self is blinded.");
463 else 463 else
464 { 464 {
465 new_draw_info (NDI_UNIQUE, 0, op, "You are blinded."); 465 new_draw_info (NDI_UNIQUE, 0, op, "You are blinded.");
466 SET_FLAG (op, FLAG_BLIND); 466 SET_FLAG (op, FLAG_BLIND);
468 op->contr->do_los = 1; 468 op->contr->do_los = 1;
469 } 469 }
470 } 470 }
471 else 471 else
472 { 472 {
473 if (QUERY_FLAG (op, FLAG_WIZ)) 473 if (op->flag [FLAG_WIZ])
474 new_draw_info (NDI_UNIQUE, 0, op, "Your mortal self can now see again."); 474 new_draw_info (NDI_UNIQUE, 0, op, "Your mortal self can now see again.");
475 else 475 else
476 { 476 {
477 new_draw_info (NDI_UNIQUE, 0, op, "Your vision returns."); 477 new_draw_info (NDI_UNIQUE, 0, op, "Your vision returns.");
478 CLEAR_FLAG (op, FLAG_BLIND); 478 CLEAR_FLAG (op, FLAG_BLIND);
480 op->contr->do_los = 1; 480 op->contr->do_los = 1;
481 } 481 }
482 } 482 }
483 } 483 }
484 484
485 if (QUERY_FLAG (op, FLAG_SEE_IN_DARK) != QUERY_FLAG (&refop, FLAG_SEE_IN_DARK)) 485 if (op->flag [FLAG_SEE_IN_DARK] != prev_flag [FLAG_SEE_IN_DARK])
486 { 486 {
487 success = 1; 487 success = 1;
488 if (op->type == PLAYER) 488 if (op->type == PLAYER)
489 op->contr->do_los = 1; 489 op->contr->do_los = 1;
490 DIFF_MSG (flag, "Your vision is better in the dark.", "You see less well in the dark."); 490 DIFF_MSG (flag, "Your vision is better in the dark.", "You see less well in the dark.");
491 } 491 }
492 492
493 if (QUERY_FLAG (op, FLAG_XRAYS) != QUERY_FLAG (&refop, FLAG_XRAYS)) 493 if (op->flag [FLAG_XRAYS] != prev_flag [FLAG_XRAYS])
494 { 494 {
495 success = 1; 495 success = 1;
496 if (flag > 0) 496 if (flag > 0)
497 { 497 {
498 if (QUERY_FLAG (op, FLAG_WIZ)) 498 if (op->flag [FLAG_WIZ])
499 new_draw_info (NDI_UNIQUE, 0, op, "Your vision becomes a little clearer."); 499 new_draw_info (NDI_UNIQUE, 0, op, "Your vision becomes a little clearer.");
500 else 500 else
501 { 501 {
502 new_draw_info (NDI_UNIQUE, 0, op, "Everything becomes transparent."); 502 new_draw_info (NDI_UNIQUE, 0, op, "Everything becomes transparent.");
503 if (op->type == PLAYER) 503 if (op->type == PLAYER)
504 op->contr->do_los = 1; 504 op->contr->do_los = 1;
505 } 505 }
506 } 506 }
507 else 507 else
508 { 508 {
509 if (QUERY_FLAG (op, FLAG_WIZ)) 509 if (op->flag [FLAG_WIZ])
510 new_draw_info (NDI_UNIQUE, 0, op, "Your vision becomes a bit out of focus."); 510 new_draw_info (NDI_UNIQUE, 0, op, "Your vision becomes a bit out of focus.");
511 else 511 else
512 { 512 {
513 new_draw_info (NDI_UNIQUE, 0, op, "Everything suddenly looks very solid."); 513 new_draw_info (NDI_UNIQUE, 0, op, "Everything suddenly looks very solid.");
514 if (op->type == PLAYER) 514 if (op->type == PLAYER)
552 for (int i = 0; i < NROFATTACKS; i++) 552 for (int i = 0; i < NROFATTACKS; i++)
553 { 553 {
554 if (i == ATNR_PHYSICAL) 554 if (i == ATNR_PHYSICAL)
555 continue; /* Don't display about armour */ 555 continue; /* Don't display about armour */
556 556
557 if (op->resist[i] != refop.resist[i]) 557 if (op->resist [i] != prev_resist [i])
558 { 558 {
559 success = 1; 559 success = 1;
560
560 if (op->resist[i] > refop.resist[i]) 561 if (op->resist [i] > prev_resist [i])
561 sprintf (message, "Your resistance to %s rises to %d%%.", change_resist_msg[i], op->resist[i]); 562 sprintf (message, "Your resistance to %s rises to %d%%.", change_resist_msg [i], op->resist [i]);
562 else 563 else
563 sprintf (message, "Your resistance to %s drops to %d%%.", change_resist_msg[i], op->resist[i]); 564 sprintf (message, "Your resistance to %s drops to %d%%.", change_resist_msg [i], op->resist [i]);
564 565
565 new_draw_info (NDI_UNIQUE | NDI_BLUE, 0, op, message); 566 new_draw_info (NDI_UNIQUE | NDI_BLUE, 0, op, message);
566 } 567 }
567 } 568 }
568 569

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines