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

Comparing deliantra/server/server/spell_effect.C (file contents):
Revision 1.57 by root, Mon Jun 4 13:04:01 2007 UTC vs.
Revision 1.60 by root, Sun Jun 24 01:09:28 2007 UTC

240 * We don't use flesh types because the weight values of those need 240 * We don't use flesh types because the weight values of those need
241 * to be altered from the donor. 241 * to be altered from the donor.
242 */ 242 */
243 243
244 /* We assume the food items don't have multiple parts */ 244 /* We assume the food items don't have multiple parts */
245 for_all_archetypes (at) 245 for_all_archetypes (at_tmp)
246 { 246 {
247 if (at_tmp->type == FOOD || at_tmp->type == DRINK) 247 if (at_tmp->type == FOOD || at_tmp->type == DRINK)
248 { 248 {
249 /* Basically, if the food value is something that is creatable 249 /* Basically, if the food value is something that is creatable
250 * under the limits of the spell and it is higher than 250 * under the limits of the spell and it is higher than
251 * the item we have now, take it instead. 251 * the item we have now, take it instead.
252 */ 252 */
253 if (at_tmp->stats.food <= food_value && (!at || at_tmp->stats.food > at->stats.food)) 253 if (at_tmp->stats.food <= food_value
254 && (!at
255 || at_tmp->stats.food > at->stats.food
256 || (at_tmp->stats.food == at->stats.food
257 && at_tmp->weight < at->weight)))
254 at = at_tmp; 258 at = at_tmp;
255 } 259 }
256 } 260 }
257 } 261 }
258 /* Pretty unlikely (there are some very low food items), but you never 262 /* Pretty unlikely (there are some very low food items), but you never
565} 569}
566 570
567int 571int
568perceive_self (object *op) 572perceive_self (object *op)
569{ 573{
570 char buf[MAX_BUF];
571 const char *cp = describe_item (op, op); 574 const char *cp = describe_item (op, op);
572 archetype *at = archetype::find (ARCH_DEPLETION); 575 archetype *at = archetype::find (ARCH_DEPLETION);
573 object *tmp;
574 int i;
575 576
577 dynbuf_text buf;
578
579 if (player *pl = op->contr)
580 if (object *race = archetype::find (op->race))
581 buf << "You are a " << (pl->gender ? "female" : "male") << " " << &race->name << ".\n";
582
576 tmp = find_god (determine_god (op)); 583 if (object *god = find_god (determine_god (op)))
577 if (tmp) 584 buf << "You worship " << &god->name << ".\n";
578 new_draw_info_format (NDI_UNIQUE, 0, op, "You worship %s", &tmp->name);
579 else 585 else
580 new_draw_info (NDI_UNIQUE, 0, op, "You worship no god"); 586 buf << "You worship no god.\n";
581 587
582 tmp = present_arch_in_ob (at, op); 588 object *tmp = present_arch_in_ob (at, op);
583 589
584 if (*cp == '\0' && tmp == NULL) 590 if (*cp == '\0' && tmp == NULL)
585 new_draw_info (NDI_UNIQUE, 0, op, "You feel very mundane"); 591 buf << "You feel very mundane. ";
586 else 592 else
587 { 593 {
588 new_draw_info (NDI_UNIQUE, 0, op, "You have:"); 594 buf << "You have: " << cp << ".\n";
589 new_draw_info (NDI_UNIQUE, 0, op, cp);
590 595
591 if (tmp) 596 if (tmp)
592 for (i = 0; i < NUM_STATS; i++) 597 for (int i = 0; i < NUM_STATS; i++)
593 if (tmp->stats.stat (i) < 0) 598 if (tmp->stats.stat (i) < 0)
594 new_draw_info_format (NDI_UNIQUE, 0, op, "Your %s is depleted by %d", statname[i], -tmp->stats.stat (i)); 599 buf.printf ("Your %s is depleted by %d.\n", statname[i], -tmp->stats.stat (i));
595 } 600 }
596 601
597 if (is_dragon_pl (op)) 602 if (is_dragon_pl (op))
598 {
599 /* now grab the 'dragon_ability'-force from the player's inventory */ 603 /* now grab the 'dragon_ability'-force from the player's inventory */
600 for (tmp = op->inv; tmp != NULL; tmp = tmp->below) 604 for (tmp = op->inv; tmp; tmp = tmp->below)
601 { 605 {
602 if (tmp->type == FORCE && !strcmp (tmp->arch->archname, "dragon_ability_force")) 606 if (tmp->type == FORCE && !strcmp (tmp->arch->archname, "dragon_ability_force"))
603 { 607 {
604 if (tmp->stats.exp == 0) 608 if (tmp->stats.exp == 0)
605 sprintf (buf, "Your metabolism isn't focused on anything."); 609 buf << "Your metabolism isn't focused on anything.\n";
606 else 610 else
607 sprintf (buf, "Your metabolism is focused on %s.", change_resist_msg[tmp->stats.exp]); 611 buf << "Your metabolism is focused on " << change_resist_msg[tmp->stats.exp] << ".\n";
608 612
609 new_draw_info (NDI_UNIQUE, 0, op, buf);
610 break; 613 break;
611 } 614 }
612 } 615 }
613 } 616
617 new_draw_info (NDI_UNIQUE, 0, op, buf.linearise ());
614 618
615 return 1; 619 return 1;
616} 620}
617 621
618/* This creates magic walls. Really, it can create most any object, 622/* This creates magic walls. Really, it can create most any object,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines