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

Comparing deliantra/server/server/apply.C (file contents):
Revision 1.124 by root, Thu Aug 16 11:01:10 2007 UTC vs.
Revision 1.127 by root, Fri Aug 17 21:18:01 2007 UTC

94static int 94static int
95apply_id_altar (object *money, object *altar, object *pl) 95apply_id_altar (object *money, object *altar, object *pl)
96{ 96{
97 dynbuf_text buf; 97 dynbuf_text buf;
98 98
99 object *id, *marked;
100
101 if (pl == NULL || pl->type != PLAYER) 99 if (!pl || pl->type != PLAYER)
102 return 0; 100 return 0;
103 101
104 /* Check for MONEY type is a special hack - it prevents 'nothing needs 102 /* Check for MONEY type is a special hack - it prevents 'nothing needs
105 * identifying' from being printed out more than it needs to be. 103 * identifying' from being printed out more than it needs to be.
106 */ 104 */
107 if (!check_altar_sacrifice (altar, money) || money->type != MONEY) 105 if (!check_altar_sacrifice (altar, money) || money->type != MONEY)
108 return 0; 106 return 0;
109 107
110 marked = find_marked_object (pl);
111 /* if the player has a marked item, identify that if it needs to be 108 /* if the player has a marked item, identify that if it needs to be
112 * identified. If it doesn't, then go through the player inventory. 109 * identified. If it doesn't, then go through the player inventory.
113 */ 110 */
111 if (object *marked = find_marked_object (pl))
114 if (marked && !QUERY_FLAG (marked, FLAG_IDENTIFIED) && need_identify (marked)) 112 if (!QUERY_FLAG (marked, FLAG_IDENTIFIED) && need_identify (marked))
115 { 113 {
116 if (operate_altar (altar, &money)) 114 if (operate_altar (altar, &money))
117 { 115 {
118 identify (marked); 116 identify (marked);
119 117
120 buf.printf ("You have %s.", long_desc (marked, pl)); 118 buf.printf ("You have %s.", long_desc (marked, pl));
121 if (marked->msg) 119 if (marked->msg)
122 buf << "The item has a story:\n" << marked->msg; 120 buf << "The item has a story:\n" << marked->msg;
123 121
124 return money == NULL; 122 return !money;
125 } 123 }
126 } 124 }
127 125
128 for (id = pl->inv; id; id = id->below) 126 for (object *id = pl->inv; id; id = id->below)
129 { 127 {
130 if (!QUERY_FLAG (id, FLAG_IDENTIFIED) && !id->invisible && need_identify (id)) 128 if (!QUERY_FLAG (id, FLAG_IDENTIFIED) && !id->invisible && need_identify (id))
131 { 129 {
132 if (operate_altar (altar, &money)) 130 if (operate_altar (altar, &money))
133 { 131 {
134 identify (id); 132 identify (id);
135 133
136 buf.printf ("You have %s.", long_desc (id, pl)); 134 buf.printf ("You have %s.", long_desc (id, pl));
137 if (marked->msg) 135 if (id->msg)
138 buf << "The item has a story:\n" << marked->msg; 136 buf << "The item has a story:\n" << id->msg;
139 137
140 /* If no more money, might as well quit now */ 138 /* If no more money, might as well quit now */
141 if (money == NULL || !check_altar_sacrifice (altar, money)) 139 if (!money || !check_altar_sacrifice (altar, money))
142 break; 140 break;
143 } 141 }
144 else 142 else
145 { 143 {
146 LOG (llevError, "check_id_altar: Couldn't do sacrifice when we should have been able to\n"); 144 LOG (llevError, "check_id_altar: Couldn't do sacrifice when we should have been able to\n");
150 } 148 }
151 149
152 if (buf.empty ()) 150 if (buf.empty ())
153 buf << ("You have nothing that needs identifying"); 151 buf << ("You have nothing that needs identifying");
154 152
155 pl->contr->infobox (buf); 153 pl->contr->infobox ("Identify", buf);
156 154
157 return !money; 155 return !money;
158} 156}
159 157
160/** 158/**
197 195
198 floor = GET_MAP_OB (op->map, op->x, op->y); 196 floor = GET_MAP_OB (op->map, op->x, op->y);
199 197
200 if (get_map_flags (op->map, NULL, op->x, op->y, NULL, NULL) & P_SAFE) 198 if (get_map_flags (op->map, NULL, op->x, op->y, NULL, NULL) & P_SAFE)
201 { 199 {
202 op->errormsg ("Gods prevent you from using this here, it's sacred ground!"); 200 op->failmsg ("Gods prevent you from using this here, it's sacred ground!");
203 201
204 CLEAR_FLAG (tmp, FLAG_APPLIED); 202 CLEAR_FLAG (tmp, FLAG_APPLIED);
205 return 0; 203 return 0;
206 } 204 }
207 205
314 else 312 else
315 { /* cursed potion */ 313 { /* cursed potion */
316 if (got_one) 314 if (got_one)
317 { 315 {
318 op->update_stats (); 316 op->update_stats ();
319 op->errormsg ("The Gods are angry and punish you."); 317 op->failmsg ("The Gods are angry and punish you.");
320 } 318 }
321 else 319 else
322 op->statusmsg ("You are fortunate that you are so pathetic.", NDI_DK_ORANGE); 320 op->statusmsg ("You are fortunate that you are so pathetic.", NDI_DK_ORANGE);
323 } 321 }
324 322
336 { 334 {
337 if (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED)) 335 if (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED))
338 { 336 {
339 object *fball; 337 object *fball;
340 338
341 op->errormsg ("Yech! Your lungs are on fire!"); 339 op->failmsg ("Yech! Your lungs are on fire!");
342 340
343 /* Explodes a fireball centered at player */ 341 /* Explodes a fireball centered at player */
344 fball = get_archetype (EXPLODING_FIREBALL); 342 fball = get_archetype (EXPLODING_FIREBALL);
345 fball->dam_modifier = random_roll (1, op->level, op, PREFER_LOW) / 5 + 1; 343 fball->dam_modifier = random_roll (1, op->level, op, PREFER_LOW) / 5 + 1;
346 fball->stats.maxhp = random_roll (1, op->level, op, PREFER_LOW) / 10 + 2; 344 fball->stats.maxhp = random_roll (1, op->level, op, PREFER_LOW) / 10 + 2;
552 if (improver->slaying) 550 if (improver->slaying)
553 { 551 {
554 count = check_item (op, improver->slaying); 552 count = check_item (op, improver->slaying);
555 if (count < 1) 553 if (count < 1)
556 { 554 {
557 op->errormsg (format ("The gods want more %ss", &improver->slaying)); 555 op->failmsg (format ("The gods want more %ss", &improver->slaying));
558 return 0; 556 return 0;
559 } 557 }
560 } 558 }
561 else 559 else
562 count = 1; 560 count = 1;
576 574
577 /* So it updates the players stats and the window */ 575 /* So it updates the players stats and the window */
578 op->update_stats (); 576 op->update_stats ();
579 577
580 op->statusmsg (format ( 578 op->statusmsg (format (
581 "Your sacrifice was accepted.\n" 579 "Your sacrifice was accepted.\n"
582 "Weapon's bonus to %s improved by %d.", 580 "Weapon's bonus to %s improved by %d.",
583 statname, sacrifice_count 581 statname, sacrifice_count
584 )); 582 ));
585 583
586 return 1; 584 return 1;
587} 585}
588 586
609 int sacrifice_count, i; 607 int sacrifice_count, i;
610 char buf[MAX_BUF]; 608 char buf[MAX_BUF];
611 609
612 if (weapon->level != 0) 610 if (weapon->level != 0)
613 { 611 {
614 op->errormsg ("Weapon is already prepared!"); 612 op->failmsg ("Weapon is already prepared!");
615 return 0; 613 return 0;
616 } 614 }
617 615
618 for (i = 0; i < NROFATTACKS; i++) 616 for (i = 0; i < NROFATTACKS; i++)
619 if (weapon->resist[i]) 617 if (weapon->resist[i])
625 if (i < NROFATTACKS || weapon->stats.hp || /* regeneration */ 623 if (i < NROFATTACKS || weapon->stats.hp || /* regeneration */
626 (weapon->stats.sp && weapon->type == WEAPON) || /* sp regeneration */ 624 (weapon->stats.sp && weapon->type == WEAPON) || /* sp regeneration */
627 weapon->stats.exp || /* speed */ 625 weapon->stats.exp || /* speed */
628 weapon->stats.ac) /* AC - only taifu's I think */ 626 weapon->stats.ac) /* AC - only taifu's I think */
629 { 627 {
630 op->errormsg ("You cannot prepare magic weapons."); 628 op->failmsg ("You cannot prepare magic weapons.");
631 return 0; 629 return 0;
632 } 630 }
633 631
634 sacrifice_count = check_sacrifice (op, improver); 632 sacrifice_count = check_sacrifice (op, improver);
635 if (sacrifice_count <= 0) 633 if (sacrifice_count <= 0)
637 635
638 weapon->level = isqrt (sacrifice_count); 636 weapon->level = isqrt (sacrifice_count);
639 eat_item (op, improver->slaying, sacrifice_count); 637 eat_item (op, improver->slaying, sacrifice_count);
640 638
641 op->statusmsg (format ( 639 op->statusmsg (format (
642 "Your sacrifice was accepted." 640 "Your sacrifice was accepted."
643 "Your *%s may be improved %d times.", 641 "Your *%s may be improved %d times.",
644 &weapon->name, weapon->level 642 &weapon->name, weapon->level
645 )); 643 ));
646 644
647 sprintf (buf, "%s's %s", &op->name, &weapon->name); 645 sprintf (buf, "%s's %s", &op->name, &weapon->name);
648 weapon->name = weapon->name_pl = buf; 646 weapon->name = weapon->name_pl = buf;
649 weapon->nrof = 0; /* prevents preparing n weapons in the same 647 weapon->nrof = 0; /* prevents preparing n weapons in the same
673 if (improver->stats.sp == IMPROVE_PREPARE) 671 if (improver->stats.sp == IMPROVE_PREPARE)
674 return prepare_weapon (op, improver, weapon); 672 return prepare_weapon (op, improver, weapon);
675 673
676 if (weapon->level == 0) 674 if (weapon->level == 0)
677 { 675 {
678 op->errormsg ("This weapon has not been prepared. H<You first ahve to prepare a weapon with a prepare weapon scroll.>"); 676 op->failmsg ("This weapon has not been prepared. H<You first ahve to prepare a weapon with a prepare weapon scroll.>");
679 return 0; 677 return 0;
680 } 678 }
681 679
682 if (weapon->level == weapon->last_eat && weapon->item_power >= 100) 680 if (weapon->level == weapon->last_eat && weapon->item_power >= 100)
683 { 681 {
684 op->errormsg ("This weapon cannot be improved any more."); 682 op->failmsg ("This weapon cannot be improved any more.");
685 return 0; 683 return 0;
686 } 684 }
687 685
688 if (QUERY_FLAG (weapon, FLAG_APPLIED) && !check_weapon_power (op, weapon->last_eat + 1)) 686 if (QUERY_FLAG (weapon, FLAG_APPLIED) && !check_weapon_power (op, weapon->last_eat + 1))
689 { 687 {
690 op->errormsg ("Improving the weapon will make it too " 688 op->failmsg ("Improving the weapon will make it too "
691 "powerful for you to use. Unready it if you " 689 "powerful for you to use. Unready it if you "
692 "really want to improve it."); 690 "really want to improve it.");
693 return 0; 691 return 0;
694 } 692 }
695 693
741 sacrifice_needed *= 2; 739 sacrifice_needed *= 2;
742 740
743 sacrifice_count = check_sacrifice (op, improver); 741 sacrifice_count = check_sacrifice (op, improver);
744 if (sacrifice_count < sacrifice_needed) 742 if (sacrifice_count < sacrifice_needed)
745 { 743 {
746 op->errormsg (format ("You need at least %d %s.", sacrifice_needed, &improver->slaying)); 744 op->failmsg (format ("You need at least %d %s.", sacrifice_needed, &improver->slaying));
747 return 0; 745 return 0;
748 } 746 }
749 747
750 eat_item (op, improver->slaying, sacrifice_needed); 748 eat_item (op, improver->slaying, sacrifice_needed);
751 weapon->item_power++; 749 weapon->item_power++;
758 case IMPROVE_WIS: return improve_weapon_stat (op, improver, weapon, weapon->stats.Wis, 1, "wisdom"); 756 case IMPROVE_WIS: return improve_weapon_stat (op, improver, weapon, weapon->stats.Wis, 1, "wisdom");
759 case IMPROVE_CHA: return improve_weapon_stat (op, improver, weapon, weapon->stats.Cha, 1, "charisma"); 757 case IMPROVE_CHA: return improve_weapon_stat (op, improver, weapon, weapon->stats.Cha, 1, "charisma");
760 case IMPROVE_INT: return improve_weapon_stat (op, improver, weapon, weapon->stats.Int, 1, "intelligence"); 758 case IMPROVE_INT: return improve_weapon_stat (op, improver, weapon, weapon->stats.Int, 1, "intelligence");
761 case IMPROVE_POW: return improve_weapon_stat (op, improver, weapon, weapon->stats.Pow, 1, "power"); 759 case IMPROVE_POW: return improve_weapon_stat (op, improver, weapon, weapon->stats.Pow, 1, "power");
762 default: 760 default:
763 op->errormsg ("Unknown improvement type."); 761 op->failmsg ("Unknown improvement type.");
764 } 762 }
765 763
766 LOG (llevError, "improve_weapon: Got to end of function\n"); 764 LOG (llevError, "improve_weapon: Got to end of function\n");
767 return 0; 765 return 0;
768} 766}
780 if (op->type != PLAYER) 778 if (op->type != PLAYER)
781 return 0; 779 return 0;
782 780
783 if (!QUERY_FLAG (op, FLAG_WIZCAST) && (get_map_flags (op->map, NULL, op->x, op->y, NULL, NULL) & P_NO_MAGIC)) 781 if (!QUERY_FLAG (op, FLAG_WIZCAST) && (get_map_flags (op->map, NULL, op->x, op->y, NULL, NULL) & P_NO_MAGIC))
784 { 782 {
785 op->errormsg ("Something blocks the magic of the scroll!"); 783 op->failmsg ("Something blocks the magic of the scroll!");
786 return 0; 784 return 0;
787 } 785 }
788 786
789 otmp = find_marked_object (op); 787 otmp = find_marked_object (op);
790 if (!otmp) 788 if (!otmp)
791 { 789 {
792 op->errormsg ("You need to mark a weapon object. H<Use the mark command or the mark option from the item popup menu.>"); 790 op->failmsg ("You need to mark a weapon object. H<Use the mark command or the mark option from the item popup menu.>");
793 return 0; 791 return 0;
794 } 792 }
795 793
796 if (otmp->type != WEAPON && otmp->type != BOW) 794 if (otmp->type != WEAPON && otmp->type != BOW)
797 { 795 {
798 op->errormsg ("Marked item is not a weapon or bow!"); 796 op->failmsg ("Marked item is not a weapon or bow!");
799 return 0; 797 return 0;
800 } 798 }
801 799
802 op->statusmsg ("Applied weapon builder."); 800 op->statusmsg ("Applied weapon builder.");
803 801
833{ 831{
834 object *tmp; 832 object *tmp;
835 833
836 if (armour->magic >= settings.armor_max_enchant) 834 if (armour->magic >= settings.armor_max_enchant)
837 { 835 {
838 op->errormsg ("This armour can not be enchanted any further!"); 836 op->failmsg ("This armour can not be enchanted any further!");
839 return 0; 837 return 0;
840 } 838 }
841 /* Dealing with random artifact armor is a lot trickier (in terms of value, weight, 839 /* Dealing with random artifact armor is a lot trickier (in terms of value, weight,
842 * etc), so take the easy way out and don't worry about it. 840 * etc), so take the easy way out and don't worry about it.
843 * Note - maybe add scrolls which make the random artifact versions (eg, armour 841 * Note - maybe add scrolls which make the random artifact versions (eg, armour
844 * of gnarg and what not?) 842 * of gnarg and what not?)
845 */ 843 */
846 if (armour->title) 844 if (armour->title)
847 { 845 {
848 op->errormsg ("This armour will not accept further enchantment."); 846 op->failmsg ("This armour will not accept further enchantment.");
849 return 0; 847 return 0;
850 } 848 }
851 849
852 /* Split objects if needed. Can't insert tmp until the 850 /* Split objects if needed. Can't insert tmp until the
853 * end of this function - otherwise it will just re-merge. 851 * end of this function - otherwise it will just re-merge.
1054 1052
1055 op->contr->last_used = 0; 1053 op->contr->last_used = 0;
1056 1054
1057 if (sack->env && sack->env != op) 1055 if (sack->env && sack->env != op)
1058 { 1056 {
1059 op->errormsg ("You must put it onto the floor or into your inventory first."); 1057 op->failmsg ("You must put it onto the floor or into your inventory first.");
1060 return 1; 1058 return 1;
1061 } 1059 }
1062 1060
1063 // already applied == open on ground, or open in inv, or active in inv 1061 // already applied == open on ground, or open in inv, or active in inv
1064 if (sack->flag [FLAG_APPLIED]) 1062 if (sack->flag [FLAG_APPLIED])
1070 return 1; 1068 return 1;
1071 } 1069 }
1072 else if (!sack->env) 1070 else if (!sack->env)
1073 { 1071 {
1074 // active, but not ours: some other player has opened it 1072 // active, but not ours: some other player has opened it
1075 op->errormsg (format ("Somebody else is using the %s already.", query_name (sack))); 1073 op->failmsg (format ("Somebody else is using the %s already.", query_name (sack)));
1076 return 1; 1074 return 1;
1077 } 1075 }
1078 1076
1079 // fall through to opening it (active in inv) 1077 // fall through to opening it (active in inv)
1080 } 1078 }
1305 * move_on is zero, it needs to be manually applied (doesn't talk 1303 * move_on is zero, it needs to be manually applied (doesn't talk
1306 * to us). 1304 * to us).
1307 */ 1305 */
1308 if (QUERY_FLAG (op, FLAG_BLIND) && !QUERY_FLAG (op, FLAG_WIZ) && !sign->move_on) 1306 if (QUERY_FLAG (op, FLAG_BLIND) && !QUERY_FLAG (op, FLAG_WIZ) && !sign->move_on)
1309 { 1307 {
1310 op->errormsg ("You are unable to read while blind!"); 1308 op->failmsg ("You are unable to read while blind!");
1311 return; 1309 return;
1312 } 1310 }
1313 1311
1314 if (op->contr) 1312 if (op->contr)
1315 if (client *ns = op->contr->ns) 1313 if (client *ns = op->contr->ns)
1481 } 1479 }
1482 1480
1483 case CONVERTER: 1481 case CONVERTER:
1484 if (convert_item (victim, trap) < 0) 1482 if (convert_item (victim, trap) < 0)
1485 { 1483 {
1486 originator->errormsg (format ("The %s seems to be broken!", query_name (trap))); 1484 originator->failmsg (format ("The %s seems to be broken!", query_name (trap)));
1487 get_archetype ("burnout")->insert_at (trap, trap); 1485 get_archetype ("burnout")->insert_at (trap, trap);
1488 } 1486 }
1489 1487
1490 goto leave; 1488 goto leave;
1491 1489
1557 goto leave; 1555 goto leave;
1558 1556
1559 case RUNE: 1557 case RUNE:
1560 case TRAP: 1558 case TRAP:
1561 if (trap->level && QUERY_FLAG (victim, FLAG_ALIVE)) 1559 if (trap->level && QUERY_FLAG (victim, FLAG_ALIVE))
1562 {
1563 spring_trap (trap, victim); 1560 spring_trap (trap, victim);
1564 }
1565 goto leave; 1561 goto leave;
1566 1562
1567 default: 1563 default:
1568 LOG (llevDebug, "name %s, arch %s, type %d with fly/walk on/off not " 1564 LOG (llevDebug, "name %s, arch %s, type %d with fly/walk on/off not "
1569 "handled in move_apply()\n", &trap->name, &trap->arch->archname, trap->type); 1565 "handled in move_apply()\n", &trap->name, &trap->arch->archname, trap->type);
1583 int lev_diff; 1579 int lev_diff;
1584 object *skill_ob; 1580 object *skill_ob;
1585 1581
1586 if (QUERY_FLAG (op, FLAG_BLIND) && !QUERY_FLAG (op, FLAG_WIZ)) 1582 if (QUERY_FLAG (op, FLAG_BLIND) && !QUERY_FLAG (op, FLAG_WIZ))
1587 { 1583 {
1588 op->errormsg ("You are unable to read while blind!"); 1584 op->failmsg ("You are unable to read while blind!");
1589 return; 1585 return;
1590 } 1586 }
1591 1587
1592 if (!tmp->msg) 1588 if (!tmp->msg)
1593 { 1589 {
1594 op->errormsg (format ("You open the %s and find it empty.", &tmp->name)); 1590 op->failmsg (format ("You open the %s and find it empty.", &tmp->name));
1595 return; 1591 return;
1596 } 1592 }
1597 1593
1598 /* need a literacy skill to read stuff! */ 1594 /* need a literacy skill to read stuff! */
1599 skill_ob = find_skill_by_name (op, tmp->skill); 1595 skill_ob = find_skill_by_name (op, tmp->skill);
1600 if (!skill_ob) 1596 if (!skill_ob)
1601 { 1597 {
1602 op->errormsg (format ("You are unable to decipher the strange symbols. H<You lack the %s skill to read this.>", &tmp->skill)); 1598 op->failmsg (format ("You are unable to decipher the strange symbols. H<You lack the %s skill to read this.>", &tmp->skill));
1603 return; 1599 return;
1604 } 1600 }
1605 1601
1606 lev_diff = tmp->level - (skill_ob->level + 5); 1602 lev_diff = tmp->level - (skill_ob->level + 5);
1607 if (!QUERY_FLAG (op, FLAG_WIZ) && lev_diff > 0) 1603 if (!QUERY_FLAG (op, FLAG_WIZ) && lev_diff > 0)
1608 { 1604 {
1609 op->errormsg (lev_diff < 2 ? "This book is just barely beyond your comprehension." 1605 op->failmsg (lev_diff < 2 ? "This book is just barely beyond your comprehension."
1610 : lev_diff < 3 ? "This book is slightly beyond your comprehension." 1606 : lev_diff < 3 ? "This book is slightly beyond your comprehension."
1611 : lev_diff < 5 ? "This book is beyond your comprehension." 1607 : lev_diff < 5 ? "This book is beyond your comprehension."
1612 : lev_diff < 8 ? "This book is quite a bit beyond your comprehension." 1608 : lev_diff < 8 ? "This book is quite a bit beyond your comprehension."
1613 : lev_diff < 15 ? "This book is way beyond your comprehension." 1609 : lev_diff < 15 ? "This book is way beyond your comprehension."
1614 : "This book is totally beyond your comprehension."); 1610 : "This book is totally beyond your comprehension.");
1665{ 1661{
1666 switch (learn_skill (op, tmp)) 1662 switch (learn_skill (op, tmp))
1667 { 1663 {
1668 case 0: 1664 case 0:
1669 op->play_sound (sound_find ("generic_fail")); 1665 op->play_sound (sound_find ("generic_fail"));
1670 op->errormsg (format ("You already possess the knowledge held within the %s.", query_name (tmp))); 1666 op->failmsg (format ("You already possess the knowledge held within the %s.", query_name (tmp)));
1671 break; 1667 break;
1672 1668
1673 case 1: 1669 case 1:
1674 decrease_ob (tmp); 1670 decrease_ob (tmp);
1675 op->play_sound (sound_find ("skill_learn")); 1671 op->play_sound (sound_find ("skill_learn"));
1677 break; 1673 break;
1678 1674
1679 default: 1675 default:
1680 decrease_ob (tmp); 1676 decrease_ob (tmp);
1681 op->play_sound (sound_find ("generic_fail")); 1677 op->play_sound (sound_find ("generic_fail"));
1682 op->errormsg (format ("You fail to learn the knowledge of the %s.\n", query_name (tmp))); 1678 op->failmsg (format ("You fail to learn the knowledge of the %s.\n", query_name (tmp)));
1683 break; 1679 break;
1684 } 1680 }
1685} 1681}
1686 1682
1687/** 1683/**
1738 { 1734 {
1739 LOG (llevError, "BUG: do_forget_spell(): spell not known\n"); 1735 LOG (llevError, "BUG: do_forget_spell(): spell not known\n");
1740 return; 1736 return;
1741 } 1737 }
1742 1738
1743 new_draw_info_format (NDI_UNIQUE | NDI_NAVY, 0, op, "You lose knowledge of %s.", spell); 1739 op->failmsg (format ("You lose knowledge of %s.", spell));
1744 player_unready_range_ob (op->contr, spob); 1740 player_unready_range_ob (op->contr, spob);
1745 esrv_remove_spell (op->contr, spob); 1741 esrv_remove_spell (op->contr, spob);
1746 spob->destroy (); 1742 spob->destroy ();
1747} 1743}
1748 1744
1756{ 1752{
1757 object *skop, *spell, *spell_skill; 1753 object *skop, *spell, *spell_skill;
1758 1754
1759 if (QUERY_FLAG (op, FLAG_BLIND) && !QUERY_FLAG (op, FLAG_WIZ)) 1755 if (QUERY_FLAG (op, FLAG_BLIND) && !QUERY_FLAG (op, FLAG_WIZ))
1760 { 1756 {
1761 op->errormsg ("You are unable to read while blind."); 1757 op->failmsg ("You are unable to read while blind.");
1762 return; 1758 return;
1763 } 1759 }
1764 1760
1765 /* artifact_spellbooks have 'slaying' field point to a spell name, 1761 /* artifact_spellbooks have 'slaying' field point to a spell name,
1766 * instead of having their spell stored in stats.sp. These are 1762 * instead of having their spell stored in stats.sp. These are
1769 if (tmp->slaying) 1765 if (tmp->slaying)
1770 { 1766 {
1771 spell = arch_to_object (find_archetype_by_object_name (tmp->slaying)); 1767 spell = arch_to_object (find_archetype_by_object_name (tmp->slaying));
1772 if (!spell) 1768 if (!spell)
1773 { 1769 {
1774 op->errormsg (format ("The book's formula for %s is incomplete.", &tmp->slaying)); 1770 op->failmsg (format ("The book's formula for %s is incomplete.", &tmp->slaying));
1775 return; 1771 return;
1776 } 1772 }
1777 else 1773 else
1778 insert_ob_in_ob (spell, tmp); 1774 insert_ob_in_ob (spell, tmp);
1779 1775
1784 1780
1785 /* need a literacy skill to learn spells. Also, having a literacy level 1781 /* need a literacy skill to learn spells. Also, having a literacy level
1786 * lower than the spell will make learning the spell more difficult */ 1782 * lower than the spell will make learning the spell more difficult */
1787 if (!skop) 1783 if (!skop)
1788 { 1784 {
1789 op->errormsg (format ("You can't read! Your attempt fails. H<You lack the %s skill.>", &tmp->skill)); 1785 op->failmsg (format ("You can't read! Your attempt fails. H<You lack the %s skill.>", &tmp->skill));
1790 return; 1786 return;
1791 } 1787 }
1792 1788
1793 spell = tmp->inv; 1789 spell = tmp->inv;
1794 1790
1795 if (!spell) 1791 if (!spell)
1796 { 1792 {
1797 LOG (llevError, "apply_spellbook: Book %s has no spell in it!\n", &tmp->name); 1793 LOG (llevError, "apply_spellbook: Book %s has no spell in it!\n", &tmp->name);
1798 op->errormsg ("The spellbook symbols make no sense. This is a bug, please report!"); 1794 op->failmsg ("The spellbook symbols make no sense. This is a bug, please report!");
1799 return; 1795 return;
1800 } 1796 }
1801 1797
1802 if (skop->level < int (sqrtf (spell->level) * 1.5f)) 1798 if (skop->level < int (sqrtf (spell->level) * 1.5f))
1803 { 1799 {
1804 op->errormsg (format ("You are unable to decipher the strange symbols. H<Your %s level is too low.>", &tmp->skill)); 1800 op->failmsg (format ("You are unable to decipher the strange symbols. H<Your %s level is too low.>", &tmp->skill));
1805 return; 1801 return;
1806 } 1802 }
1807 1803
1808 op->statusmsg (format ("The spellbook contains the %s level spell %s.", get_levelnumber (spell->level), &spell->name)); 1804 op->statusmsg (format ("The spellbook contains the %s level spell %s.", get_levelnumber (spell->level), &spell->name));
1809 1805
1832 { 1828 {
1833 spell_skill = find_skill_by_name (op, spell->skill); 1829 spell_skill = find_skill_by_name (op, spell->skill);
1834 1830
1835 if (!spell_skill) 1831 if (!spell_skill)
1836 { 1832 {
1837 op->errormsg (format ("You lack the skill %s to use this spell.", &spell->skill)); 1833 op->failmsg (format ("You lack the skill %s to use this spell.", &spell->skill));
1838 return; 1834 return;
1839 } 1835 }
1840 1836
1841 if (spell_skill->level < spell->level) 1837 if (spell_skill->level < spell->level)
1842 { 1838 {
1843 op->errormsg (format ("You need to be level %d in %s to learn this spell.", spell->level, &spell->skill)); 1839 op->failmsg (format ("You need to be level %d in %s to learn this spell.", spell->level, &spell->skill));
1844 return; 1840 return;
1845 } 1841 }
1846 } 1842 }
1847 1843
1848 /* Logic as follows 1844 /* Logic as follows
1857 * Overall, chances are the same but a player will find having a high 1853 * Overall, chances are the same but a player will find having a high
1858 * literacy rate very useful! -b.t. 1854 * literacy rate very useful! -b.t.
1859 */ 1855 */
1860 if (QUERY_FLAG (op, FLAG_CONFUSED)) 1856 if (QUERY_FLAG (op, FLAG_CONFUSED))
1861 { 1857 {
1862 op->errormsg ("In your confused state you flub the wording of the text!"); 1858 op->failmsg ("In your confused state you flub the wording of the text!");
1863 scroll_failure (op, 0 - random_roll (0, spell->level, op, PREFER_LOW), MAX (spell->stats.sp, spell->stats.grace)); 1859 scroll_failure (op, 0 - random_roll (0, spell->level, op, PREFER_LOW), MAX (spell->stats.sp, spell->stats.grace));
1864 } 1860 }
1865 else if (QUERY_FLAG (tmp, FLAG_STARTEQUIP) || 1861 else if (QUERY_FLAG (tmp, FLAG_STARTEQUIP) ||
1866 (random_roll (0, 100, op, PREFER_LOW) - (5 * skop->level)) < learn_spell[spell->stats.grace ? op->stats.Wis : op->stats.Int]) 1862 (random_roll (0, 100, op, PREFER_LOW) - (5 * skop->level)) < learn_spell[spell->stats.grace ? op->stats.Wis : op->stats.Int])
1867 { 1863 {
1873 change_exp (op, calc_skill_exp (op, tmp, skop), skop->skill, 0); 1869 change_exp (op, calc_skill_exp (op, tmp, skop), skop->skill, 0);
1874 } 1870 }
1875 else 1871 else
1876 { 1872 {
1877 op->contr->play_sound (sound_find ("fumble_spell")); 1873 op->contr->play_sound (sound_find ("fumble_spell"));
1878 op->errormsg ("You fail to learn the spell. H<Wis (priests) or Int (wizards) governs the chance of learning a prayer or spell.>\n"); 1874 op->failmsg ("You fail to learn the spell. H<Wis (priests) or Int (wizards) governs the chance of learning a prayer or spell.>\n");
1879 } 1875 }
1880 1876
1881 decrease_ob (tmp); 1877 decrease_ob (tmp);
1882} 1878}
1883 1879
1889{ 1885{
1890 object *skop; 1886 object *skop;
1891 1887
1892 if (QUERY_FLAG (op, FLAG_BLIND) && !QUERY_FLAG (op, FLAG_WIZ)) 1888 if (QUERY_FLAG (op, FLAG_BLIND) && !QUERY_FLAG (op, FLAG_WIZ))
1893 { 1889 {
1894 op->errormsg ("You are unable to read while blind."); 1890 op->failmsg ("You are unable to read while blind.");
1895 return; 1891 return;
1896 } 1892 }
1897 1893
1898 if (!tmp->inv || tmp->inv->type != SPELL) 1894 if (!tmp->inv || tmp->inv->type != SPELL)
1899 { 1895 {
1900 op->errormsg ("The scroll just doesn't make sense! H<...and never will make sense.>"); 1896 op->failmsg ("The scroll just doesn't make sense! H<...and never will make sense.>");
1901 return; 1897 return;
1902 } 1898 }
1903 1899
1904 if (op->type == PLAYER) 1900 if (op->type == PLAYER)
1905 { 1901 {
1911 */ 1907 */
1912 skop = find_skill_by_name (op, skill_names[SK_LITERACY]); 1908 skop = find_skill_by_name (op, skill_names[SK_LITERACY]);
1913 1909
1914 if (!skop) 1910 if (!skop)
1915 { 1911 {
1916 op->errormsg (format ("You are unable to decipher the strange symbols. H<You lack the %s skill.>", &skill_names[SK_LITERACY])); 1912 op->failmsg (format ("You are unable to decipher the strange symbols. H<You lack the %s skill.>", &skill_names[SK_LITERACY]));
1917 return; 1913 return;
1918 } 1914 }
1919 1915
1920 if ((exp_gain = calc_skill_exp (op, tmp, skop))) 1916 if ((exp_gain = calc_skill_exp (op, tmp, skop)))
1921 change_exp (op, exp_gain, skop->skill, 0); 1917 change_exp (op, exp_gain, skop->skill, 0);
1998 { 1994 {
1999 /* usual case - no dragon meal: */ 1995 /* usual case - no dragon meal: */
2000 if (op->stats.food + tmp->stats.food > 999) 1996 if (op->stats.food + tmp->stats.food > 999)
2001 { 1997 {
2002 if (tmp->type == FOOD || tmp->type == FLESH) 1998 if (tmp->type == FOOD || tmp->type == FLESH)
2003 op->errormsg ("You feel full, but what a waste of food!"); 1999 op->failmsg ("You feel full, but what a waste of food!");
2004 else 2000 else
2005 op->statusmsg ("Most of the drink goes down your face not your throat!"); 2001 op->statusmsg ("Most of the drink goes down your face not your throat!");
2006 } 2002 }
2007 2003
2008 if (!QUERY_FLAG (tmp, FLAG_CURSED)) 2004 if (!QUERY_FLAG (tmp, FLAG_CURSED))
2189 { 2185 {
2190 abil->last_eat = meal->last_eat; /* write: last_eat <new attnr focus> */ 2186 abil->last_eat = meal->last_eat; /* write: last_eat <new attnr focus> */
2191 2187
2192 if (meal->last_eat != abil->stats.exp) 2188 if (meal->last_eat != abil->stats.exp)
2193 op->statusmsg (format ( 2189 op->statusmsg (format (
2194 "Your metabolism prepares to focus on %s!\n" 2190 "Your metabolism prepares to focus on %s!\n"
2195 "The change will happen at level %d.", 2191 "The change will happen at level %d.",
2196 change_resist_msg[meal->last_eat], 2192 change_resist_msg[meal->last_eat],
2197 abil->level + 1 2193 abil->level + 1
2198 )); 2194 ));
2199 else 2195 else
2200 { 2196 {
2201 op->statusmsg (format ("Your metabolism will continue to focus on %s.", change_resist_msg[meal->last_eat])); 2197 op->statusmsg (format ("Your metabolism will continue to focus on %s.", change_resist_msg[meal->last_eat]));
2202 abil->last_eat = 0; 2198 abil->last_eat = 0;
2215{ 2211{
2216 object *armor; 2212 object *armor;
2217 2213
2218 if (!QUERY_FLAG (op, FLAG_WIZCAST) && (get_map_flags (op->map, 0, op->x, op->y, 0, 0) & P_NO_MAGIC)) 2214 if (!QUERY_FLAG (op, FLAG_WIZCAST) && (get_map_flags (op->map, 0, op->x, op->y, 0, 0) & P_NO_MAGIC))
2219 { 2215 {
2220 op->errormsg ("Something blocks the magic of the scroll. H<This area prevents magic effects.>"); 2216 op->failmsg ("Something blocks the magic of the scroll. H<This area prevents magic effects.>");
2221 return; 2217 return;
2222 } 2218 }
2223 2219
2224 armor = find_marked_object (op); 2220 armor = find_marked_object (op);
2225 2221
2226 if (!armor) 2222 if (!armor)
2227 { 2223 {
2228 op->errormsg ("You need to mark an armor object. Use the right mouse button popup or the mark command to do this."); 2224 op->failmsg ("You need to mark an armor object. Use the right mouse button popup or the mark command to do this.");
2229 return; 2225 return;
2230 } 2226 }
2231 2227
2232 if (armor->type != ARMOUR 2228 if (armor->type != ARMOUR
2233 && armor->type != CLOAK 2229 && armor->type != CLOAK
2234 && armor->type != BOOTS && armor->type != GLOVES && armor->type != BRACERS && armor->type != SHIELD && armor->type != HELMET) 2230 && armor->type != BOOTS && armor->type != GLOVES && armor->type != BRACERS && armor->type != SHIELD && armor->type != HELMET)
2235 { 2231 {
2236 op->errormsg ("Your marked item is not armour!\n"); 2232 op->failmsg ("Your marked item is not armour!\n");
2237 return; 2233 return;
2238 } 2234 }
2239 2235
2240 op->statusmsg ("Applying armour enchantment."); 2236 op->statusmsg ("Applying armour enchantment.");
2241 improve_armour (op, tmp, armor); 2237 improve_armour (op, tmp, armor);
2245apply_poison (object *op, object *tmp) 2241apply_poison (object *op, object *tmp)
2246{ 2242{
2247 if (op->type == PLAYER) 2243 if (op->type == PLAYER)
2248 { 2244 {
2249 op->contr->play_sound (sound_find ("drink_poison")); 2245 op->contr->play_sound (sound_find ("drink_poison"));
2250 op->errormsg ("Yech! That tasted poisonous!"); 2246 op->failmsg ("Yech! That tasted poisonous!");
2251 strcpy (op->contr->killer, "poisonous booze"); 2247 strcpy (op->contr->killer, "poisonous booze");
2252 } 2248 }
2253 2249
2254 if (tmp->stats.hp > 0) 2250 if (tmp->stats.hp > 0)
2255 { 2251 {
2374 2370
2375 if (QUERY_FLAG (tmp, FLAG_UNPAID) && !QUERY_FLAG (tmp, FLAG_APPLIED)) 2371 if (QUERY_FLAG (tmp, FLAG_UNPAID) && !QUERY_FLAG (tmp, FLAG_APPLIED))
2376 { 2372 {
2377 if (op->type == PLAYER) 2373 if (op->type == PLAYER)
2378 { 2374 {
2379 op->errormsg ("You should pay for it first! H<You cannot use items marked as unpaid.>"); 2375 op->failmsg ("You should pay for it first! H<You cannot use items marked as unpaid.>");
2380 return 1; 2376 return 1;
2381 } 2377 }
2382 else 2378 else
2383 return 0; /* monsters just skip unpaid items */ 2379 return 0; /* monsters just skip unpaid items */
2384 } 2380 }
2402 { 2398 {
2403 op->statusmsg ("You turn the handle."); 2399 op->statusmsg ("You turn the handle.");
2404 op->play_sound (sound_find ("turn_handle")); 2400 op->play_sound (sound_find ("turn_handle"));
2405 } 2401 }
2406 else 2402 else
2407 op->errormsg ("The handle doesn't move."); 2403 op->failmsg ("The handle doesn't move.");
2408 2404
2409 return 1; 2405 return 1;
2410 2406
2411 case EXIT: 2407 case EXIT:
2412 if (op->type != PLAYER) 2408 if (op->type != PLAYER)
2413 return 0; 2409 return 0;
2414 2410
2415 if (!EXIT_PATH (tmp) || !is_legal_2ways_exit (op, tmp)) 2411 if (!EXIT_PATH (tmp) || !is_legal_2ways_exit (op, tmp))
2416 op->errormsg (format ("The %s is closed.", query_name (tmp))); 2412 op->failmsg (format ("The %s is closed.", query_name (tmp)));
2417 else 2413 else
2418 { 2414 {
2419 /* Don't display messages for random maps. */ 2415 /* Don't display messages for random maps. */
2420 if (tmp->msg && strncmp (EXIT_PATH (tmp), "/!", 2)) 2416 if (tmp->msg && strncmp (EXIT_PATH (tmp), "/!", 2))
2421 op->statusmsg (tmp->msg, NDI_NAVY); 2417 op->statusmsg (tmp->msg, NDI_NAVY);
2546 timeofday_t tod; 2542 timeofday_t tod;
2547 2543
2548 get_tod (&tod); 2544 get_tod (&tod);
2549 op->play_sound (sound_find ("sound_clock")); 2545 op->play_sound (sound_find ("sound_clock"));
2550 op->statusmsg (format ( 2546 op->statusmsg (format (
2551 "It is %d minute%s past %d o'clock %s", 2547 "It is %d minute%s past %d o'clock %s",
2552 tod.minute + 1, ((tod.minute + 1 < 2) ? "" : "s"), 2548 tod.minute + 1, ((tod.minute + 1 < 2) ? "" : "s"),
2553 ((tod.hour % 14 == 0) ? 14 : ((tod.hour) % 14)), ((tod.hour >= 14) ? "pm" : "am") 2549 ((tod.hour % 14 == 0) ? 14 : ((tod.hour) % 14)), ((tod.hour >= 14) ? "pm" : "am")
2554 )); 2550 ));
2555 return 1; 2551 return 1;
2556 } 2552 }
2557 else 2553 else
2558 return 0; 2554 return 0;
2603 if (op->env && (pl->move_type & MOVE_FLYING)) 2599 if (op->env && (pl->move_type & MOVE_FLYING))
2604 { 2600 {
2605 /* player is flying and applying object not in inventory */ 2601 /* player is flying and applying object not in inventory */
2606 if (!QUERY_FLAG (pl, FLAG_WIZ) && !(op->move_type & MOVE_FLYING)) 2602 if (!QUERY_FLAG (pl, FLAG_WIZ) && !(op->move_type & MOVE_FLYING))
2607 { 2603 {
2608 op->errormsg ("But you are floating high above the ground! H<You have to stop levitating first, if you can.>"); 2604 op->failmsg ("But you are floating high above the ground! H<You have to stop levitating first, if you can.>");
2609 return 0; 2605 return 0;
2610 } 2606 }
2611 } 2607 }
2612 2608
2613 pl->contr->last_used = op; 2609 pl->contr->last_used = op;
2616 if (!quiet) 2612 if (!quiet)
2617 { 2613 {
2618 if (tmp == 0) 2614 if (tmp == 0)
2619 op->statusmsg (format ("I don't know how to apply the %s.", query_name (op))); 2615 op->statusmsg (format ("I don't know how to apply the %s.", query_name (op)));
2620 else if (tmp == 2) 2616 else if (tmp == 2)
2621 op->errormsg ("You must get it first!\n"); 2617 op->failmsg ("You must get it first!\n");
2622 } 2618 }
2623 2619
2624 return tmp; 2620 return tmp;
2625} 2621}
2626 2622
2763 2759
2764 if (QUERY_FLAG (op, FLAG_CURSED) || QUERY_FLAG (op, FLAG_DAMNED)) 2760 if (QUERY_FLAG (op, FLAG_CURSED) || QUERY_FLAG (op, FLAG_DAMNED))
2765 { 2761 {
2766 if (who->contr) 2762 if (who->contr)
2767 { 2763 {
2768 who->errormsg ("Oops, it feels deadly cold!"); 2764 who->failmsg ("Oops, it feels deadly cold!");
2769 SET_FLAG (tmp2, FLAG_KNOWN_CURSED); 2765 SET_FLAG (tmp2, FLAG_KNOWN_CURSED);
2770 } 2766 }
2771 } 2767 }
2772 2768
2773 if (who->contr) 2769 if (who->contr)
2883 for (object *tmp = who->inv; tmp; tmp = tmp->below) 2879 for (object *tmp = who->inv; tmp; tmp = tmp->below)
2884 if (QUERY_FLAG (tmp, FLAG_APPLIED) && tmp->is_range ()) 2880 if (QUERY_FLAG (tmp, FLAG_APPLIED) && tmp->is_range ())
2885 if ((aflags & AP_IGNORE_CURSE) || (aflags & AP_PRINT) || (!QUERY_FLAG (tmp, FLAG_CURSED) && !QUERY_FLAG (tmp, FLAG_DAMNED))) 2881 if ((aflags & AP_IGNORE_CURSE) || (aflags & AP_PRINT) || (!QUERY_FLAG (tmp, FLAG_CURSED) && !QUERY_FLAG (tmp, FLAG_DAMNED)))
2886 { 2882 {
2887 if (aflags & AP_PRINT) 2883 if (aflags & AP_PRINT)
2888 new_draw_info (NDI_UNIQUE, 0, who, query_name (tmp)); 2884 who->failmsg (query_name (tmp));
2889 else 2885 else
2890 unapply_special (who, tmp, aflags); 2886 unapply_special (who, tmp, aflags);
2891 } 2887 }
2892 else 2888 else
2893 { 2889 {
2894 /* In this case, we want to try and remove a cursed item. 2890 /* In this case, we want to try and remove a cursed item.
2895 * While we know it won't work, we want unapply_special to 2891 * While we know it won't work, we want unapply_special to
2896 * at least generate the message. 2892 * at least generate the message.
2897 */ 2893 */
2898 new_draw_info_format (NDI_UNIQUE, 0, who, 2894 who->failmsg (format ("No matter how hard you try, you just can't remove the %s." CANNOT_REMOVE_CURSED, query_name (tmp)));
2899 "No matter how hard you try, you just can't remove the %s." CANNOT_REMOVE_CURSED,
2900 query_name (tmp));
2901 return 1; 2895 return 1;
2902 } 2896 }
2903 2897
2904 for (int i = 0; i < NUM_BODY_LOCATIONS; i++) 2898 for (int i = 0; i < NUM_BODY_LOCATIONS; i++)
2905 { 2899 {
2928 2922
2929 /* If we are just printing, we don't care about cursed status */ 2923 /* If we are just printing, we don't care about cursed status */
2930 if ((aflags & AP_IGNORE_CURSE) || (aflags & AP_PRINT) || (!(QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED)))) 2924 if ((aflags & AP_IGNORE_CURSE) || (aflags & AP_PRINT) || (!(QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED))))
2931 { 2925 {
2932 if (aflags & AP_PRINT) 2926 if (aflags & AP_PRINT)
2933 new_draw_info (NDI_UNIQUE, 0, who, query_name (tmp)); 2927 who->failmsg (query_name (tmp));
2934 else 2928 else
2935 unapply_special (who, tmp, aflags); 2929 unapply_special (who, tmp, aflags);
2936 } 2930 }
2937 else 2931 else
2938 { 2932 {
2939 /* Cursed item that we can't unequip - tell the player. 2933 /* Cursed item that we can't unequip - tell the player.
2940 * Note this could be annoying if this is just one of a few, 2934 * Note this could be annoying if this is just one of a few,
2941 * so it may not be critical (eg, putting on a ring and you have 2935 * so it may not be critical (eg, putting on a ring and you have
2942 * one cursed ring.) 2936 * one cursed ring.)
2943 */ 2937 */
2944 new_draw_info_format (NDI_UNIQUE, 0, who, "The %s just won't come off." CANNOT_REMOVE_CURSED, query_name (tmp)); 2938 who->failmsg (format ("The %s just won't come off." CANNOT_REMOVE_CURSED, query_name (tmp)));
2945 } 2939 }
2946 2940
2947 last = tmp->below; 2941 last = tmp->below;
2948 } 2942 }
2949 /* if we got here, this slot is freed up - otherwise, if it wasn't freed up, the 2943 /* if we got here, this slot is freed up - otherwise, if it wasn't freed up, the
3130 if (basic_flag == AP_APPLY) 3124 if (basic_flag == AP_APPLY)
3131 return 0; 3125 return 0;
3132 3126
3133 if (!(aflags & AP_IGNORE_CURSE) && (QUERY_FLAG (op, FLAG_CURSED) || QUERY_FLAG (op, FLAG_DAMNED))) 3127 if (!(aflags & AP_IGNORE_CURSE) && (QUERY_FLAG (op, FLAG_CURSED) || QUERY_FLAG (op, FLAG_DAMNED)))
3134 { 3128 {
3135 new_draw_info_format (NDI_UNIQUE, 0, who, 3129 who->failmsg (format ("No matter how hard you try, you just can't remove %s." CANNOT_REMOVE_CURSED, query_name (op)));
3136 "No matter how hard you try, you just can't remove %s." CANNOT_REMOVE_CURSED,
3137 query_name (op));
3138 return 1; 3130 return 1;
3139 } 3131 }
3140 3132
3141 return unapply_special (who, op, aflags); 3133 return unapply_special (who, op, aflags);
3142 } 3134 }
3158 /* Can't just apply this object. Lets see what not and what to do */ 3150 /* Can't just apply this object. Lets see what not and what to do */
3159 if (int i = can_apply_object (who, op)) 3151 if (int i = can_apply_object (who, op))
3160 { 3152 {
3161 if (i & CAN_APPLY_NEVER) 3153 if (i & CAN_APPLY_NEVER)
3162 { 3154 {
3163 new_draw_info_format (NDI_UNIQUE, 0, who, 3155 who->failmsg (format ("You don't have the body to use a %s. H<You can never apply this item.>", query_name (op)));
3164 "You don't have the body to use a %s. H<You can never apply this item.>",
3165 query_name (op));
3166 return 1; 3156 return 1;
3167 } 3157 }
3168 else if (i & CAN_APPLY_RESTRICTION) 3158 else if (i & CAN_APPLY_RESTRICTION)
3169 { 3159 {
3170 new_draw_info_format (NDI_UNIQUE, 0, who, 3160 who->failmsg (format (
3171 "You have a prohibition against using a %s. " 3161 "You have a prohibition against using a %s. "
3172 "H<Your belief, profession or class prevents you from applying this item.>", 3162 "H<Your belief, profession or class prevents you from applying this item.>",
3173 query_name (op)); 3163 query_name (op)
3164 ));
3174 return 1; 3165 return 1;
3175 } 3166 }
3176 3167
3177 if (who->type != PLAYER) 3168 if (who->type != PLAYER)
3178 { 3169 {
3182 } 3173 }
3183 else 3174 else
3184 { 3175 {
3185 if (who->contr->unapply == unapply_never || (i & CAN_APPLY_UNAPPLY_CHOICE && who->contr->unapply == unapply_nochoice)) 3176 if (who->contr->unapply == unapply_never || (i & CAN_APPLY_UNAPPLY_CHOICE && who->contr->unapply == unapply_nochoice))
3186 { 3177 {
3187 new_draw_info (NDI_UNIQUE, 0, who, "You need to unapply some of the following item(s) or change your applymode:"); 3178 who->failmsg ("You need to unapply some of the following item(s) or change your applymode:");
3188 unapply_for_ob (who, op, AP_PRINT); 3179 unapply_for_ob (who, op, AP_PRINT);
3189 return 1; 3180 return 1;
3190 } 3181 }
3191 else if (who->contr->unapply == unapply_always || !(i & CAN_APPLY_UNAPPLY_CHOICE)) 3182 else if (who->contr->unapply == unapply_always || !(i & CAN_APPLY_UNAPPLY_CHOICE))
3192 if (unapply_for_ob (who, op, aflags)) 3183 if (unapply_for_ob (who, op, aflags))
3198 { 3189 {
3199 skop = find_skill_by_name (who, op->skill); 3190 skop = find_skill_by_name (who, op->skill);
3200 3191
3201 if (!skop) 3192 if (!skop)
3202 { 3193 {
3203 new_draw_info_format (NDI_UNIQUE, 0, who, "You need the %s skill to use this item!", &op->skill); 3194 who->failmsg (format ("You need the %s skill to use this item!", &op->skill));
3204 return 1; 3195 return 1;
3205 } 3196 }
3206 else 3197 else
3207 /* While experience will be credited properly, we want to change the 3198 /* While experience will be credited properly, we want to change the
3208 * skill so that the dam and wc get updated 3199 * skill so that the dam and wc get updated
3212 3203
3213 if (who->type == PLAYER 3204 if (who->type == PLAYER
3214 && op->item_power 3205 && op->item_power
3215 && op->item_power + who->contr->item_power > settings.item_power_factor * who->level) 3206 && op->item_power + who->contr->item_power > settings.item_power_factor * who->level)
3216 { 3207 {
3217 new_draw_info (NDI_UNIQUE, 0, who,
3218 "Equipping that combined with other items would consume your soul!" LACK_ITEM_POWER); 3208 who->failmsg ("Equipping that combined with other items would consume your soul!" LACK_ITEM_POWER);
3219 return 1; 3209 return 1;
3220 } 3210 }
3221 3211
3222 /* Ok. We are now at the state where we can apply the new object. 3212 /* Ok. We are now at the state where we can apply the new object.
3223 * Note that we don't have the checks for can_use_... 3213 * Note that we don't have the checks for can_use_...
3234 switch (op->type) 3224 switch (op->type)
3235 { 3225 {
3236 case WEAPON: 3226 case WEAPON:
3237 if (!check_weapon_power (who, op->last_eat)) 3227 if (!check_weapon_power (who, op->last_eat))
3238 { 3228 {
3239 new_draw_info (NDI_UNIQUE, 0, who, "This weapon is too powerful for you to use. " 3229 op->failmsg ("This weapon is too powerful for you to use. It would consume your soul!." LACK_ITEM_POWER);
3240 "It would consume your soul!." LACK_ITEM_POWER);
3241 3230
3242 if (tmp) 3231 if (tmp)
3243 insert_ob_in_ob (tmp, who); 3232 insert_ob_in_ob (tmp, who);
3244 3233
3245 return 1; 3234 return 1;
3249 // i.e. "R" can use Ragnarok's sword. 3238 // i.e. "R" can use Ragnarok's sword.
3250 if (op->level && (strncmp (op->name, who->name, strlen (who->name)))) 3239 if (op->level && (strncmp (op->name, who->name, strlen (who->name))))
3251 { 3240 {
3252 /* if the weapon does not have the name as the character, can't use it. */ 3241 /* if the weapon does not have the name as the character, can't use it. */
3253 /* (Ragnarok's sword attempted to be used by Foo: won't work) */ 3242 /* (Ragnarok's sword attempted to be used by Foo: won't work) */
3254 new_draw_info (NDI_UNIQUE, 0, who, 3243 who->failmsg ("The weapon does not recognize you as its owner. H<Its name indicates that it belongs to somebody else.>");
3255 "The weapon does not recognize you as its owner. "
3256 "H<Its name indicates that it belongs to somebody else.>");
3257 3244
3258 if (tmp) 3245 if (tmp)
3259 insert_ob_in_ob (tmp, who); 3246 insert_ob_in_ob (tmp, who);
3260 3247
3261 return 1; 3248 return 1;
3262 } 3249 }
3263 3250
3264 if (!skop) 3251 if (!skop)
3265 { 3252 {
3266 new_draw_info_format (NDI_UNIQUE, 0, who, "The %s is broken, please report this to the dungeon master!", query_name (op));//TODO 3253 who->failmsg (format ("The %s is broken, please report this to the dungeon master!", query_name (op)));//TODO
3267 return 1; 3254 return 1;
3268 } 3255 }
3269 3256
3270 SET_FLAG (op, FLAG_APPLIED); 3257 SET_FLAG (op, FLAG_APPLIED);
3271 who->change_skill (skop); 3258 who->change_skill (skop);
3272 3259
3273 if (who->contr) 3260 if (who->contr)
3274 who->change_weapon (who->contr->combat_ob = op); 3261 who->change_weapon (who->contr->combat_ob = op);
3275 3262
3276 new_draw_info_format (NDI_UNIQUE, 0, who, "You wield %s.", query_name (op)); 3263 who->statusmsg (format ("You wield %s.", query_name (op)));
3277 3264
3278 SET_FLAG (who, FLAG_READY_WEAPON); 3265 SET_FLAG (who, FLAG_READY_WEAPON);
3279 change_abil (who, op); 3266 change_abil (who, op);
3280 break; 3267 break;
3281 3268
3288 case BRACERS: 3275 case BRACERS:
3289 case CLOAK: 3276 case CLOAK:
3290 case RING: 3277 case RING:
3291 case AMULET: 3278 case AMULET:
3292 SET_FLAG (op, FLAG_APPLIED); 3279 SET_FLAG (op, FLAG_APPLIED);
3293 new_draw_info_format (NDI_UNIQUE, 0, who, "You wear %s.", query_name (op)); 3280 who->statusmsg (format ("You wear %s.", query_name (op)));
3294 change_abil (who, op); 3281 change_abil (who, op);
3295 break; 3282 break;
3296 3283
3297 case LAMP: 3284 case LAMP:
3298 if (op->stats.food < 1) 3285 if (op->stats.food < 1)
3299 { 3286 {
3300 new_draw_info_format (NDI_UNIQUE, 0, who, 3287 who->failmsg (format (
3301 "Your %s is out of fuel! " 3288 "Your %s is out of fuel! "
3302 "H<Lamps and similar items need fuel. They cannot be refilled.>", &op->name); 3289 "H<Lamps and similar items need fuel. They cannot be refilled.>",
3290 &op->name
3291 ));
3303 return 1; 3292 return 1;
3304 } 3293 }
3305 3294
3306 new_draw_info_format (NDI_UNIQUE, 0, who, "You turn on your %s.", &op->name); 3295 who->statusmsg (format ("You turn on your %s.", &op->name));
3296
3307 tmp2 = arch_to_object (op->other_arch); 3297 tmp2 = arch_to_object (op->other_arch);
3308 tmp2->stats.food = op->stats.food; 3298 tmp2->stats.food = op->stats.food;
3309 SET_FLAG (tmp2, FLAG_APPLIED); 3299 SET_FLAG (tmp2, FLAG_APPLIED);
3310 3300
3311 if (QUERY_FLAG (op, FLAG_INV_LOCKED)) 3301 if (QUERY_FLAG (op, FLAG_INV_LOCKED))
3330 who->update_stats (); 3320 who->update_stats ();
3331 3321
3332 if (QUERY_FLAG (op, FLAG_CURSED) || QUERY_FLAG (op, FLAG_DAMNED)) 3322 if (QUERY_FLAG (op, FLAG_CURSED) || QUERY_FLAG (op, FLAG_DAMNED))
3333 if (who->type == PLAYER) 3323 if (who->type == PLAYER)
3334 { 3324 {
3335 new_draw_info (NDI_UNIQUE, 0, who,
3336 "Oops, it feels deadly cold! "
3337 "H<Maybe it wasn't such a bright idea to apply this cursed/damned item.>"); 3325 who->failmsg ("Oops, it feels deadly cold! H<Maybe it wasn't such a bright idea to apply this cursed/damned item.>");
3338 SET_FLAG (tmp2, FLAG_KNOWN_CURSED); 3326 SET_FLAG (tmp2, FLAG_KNOWN_CURSED);
3339 } 3327 }
3340 3328
3341 if (who->type == PLAYER) 3329 if (who->type == PLAYER)
3342 esrv_send_item (who, tmp2); 3330 esrv_send_item (who, tmp2);
3370 who->change_weapon (pl->combat_ob = item); 3358 who->change_weapon (pl->combat_ob = item);
3371 goto found_weapon; 3359 goto found_weapon;
3372 } 3360 }
3373 } 3361 }
3374 3362
3375 new_draw_info_format (NDI_UNIQUE, 0, who, 3363 who->failmsg (format (
3376 "You need to apply a '%s' melee weapon before readying this skill. " 3364 "You need to apply a '%s' melee weapon before readying this skill. "
3377 "H<Some skills need an item, in this case a melee weapon, to function.>", 3365 "H<Some skills need an item, in this case a melee weapon, to function.>",
3378 &op->skill); 3366 &op->skill
3367 ));
3379 return 1; 3368 return 1;
3380 3369
3381 found_weapon:; 3370 found_weapon:;
3382 } 3371 }
3383 else 3372 else
3393 //TODO: bows should/must all have skill missile weapon right now 3382 //TODO: bows should/must all have skill missile weapon right now
3394 who->change_weapon (pl->ranged_ob = item); 3383 who->change_weapon (pl->ranged_ob = item);
3395 goto found_bow; 3384 goto found_bow;
3396 } 3385 }
3397 3386
3398 new_draw_info (NDI_UNIQUE, 0, who, 3387 who->failmsg (
3399 "You need to apply a missile weapon before readying this skill. " 3388 "You need to apply a missile weapon before readying this skill. "
3400 "H<Some skills need an item, in this case a missile weapon, to function.>"); 3389 "H<Some skills need an item, in this case a missile weapon, to function.>"
3390 );
3401 return 1; 3391 return 1;
3402 3392
3403 found_bow:; 3393 found_bow:;
3404 } 3394 }
3405 else 3395 else
3406 who->change_weapon (pl->ranged_ob = op); 3396 who->change_weapon (pl->ranged_ob = op);
3407 } 3397 }
3408 3398
3409 if (!op->invisible) 3399 if (!op->invisible)
3410 { 3400 {
3411 new_draw_info_format (NDI_UNIQUE, 0, who, "You ready %s.", query_name (op)); 3401 who->statusmsg (format (
3412 new_draw_info_format (NDI_UNIQUE, 0, who, "You can now use the skill: %s.", &op->skill); 3402 "You ready %s."
3403 "You can now use the skill: %s.",
3404 query_name (op),
3405 &op->skill
3406 ));
3413 } 3407 }
3414 else 3408 else
3415 new_draw_info_format (NDI_UNIQUE, 0, who, "Readied skill: %s.", op->skill ? &op->skill : &op->name); 3409 who->statusmsg (format ("Readied skill: %s.", op->skill ? &op->skill : &op->name));
3416 } 3410 }
3417 else 3411 else
3418 { 3412 {
3419 SET_FLAG (op, FLAG_APPLIED); 3413 SET_FLAG (op, FLAG_APPLIED);
3420 change_abil (who, op); 3414 change_abil (who, op);
3425 break; 3419 break;
3426 3420
3427 case BOW: 3421 case BOW:
3428 if (!check_weapon_power (who, op->last_eat)) 3422 if (!check_weapon_power (who, op->last_eat))
3429 { 3423 {
3430 new_draw_info (NDI_UNIQUE, 0, who,
3431 "That weapon is too powerful for you to use. It would consume your soul!" LACK_ITEM_POWER); 3424 who->failmsg ("That weapon is too powerful for you to use. It would consume your soul!" LACK_ITEM_POWER);
3432 3425
3433 if (tmp) 3426 if (tmp)
3434 insert_ob_in_ob (tmp, who); 3427 insert_ob_in_ob (tmp, who);
3435 3428
3436 return 1; 3429 return 1;
3437 } 3430 }
3438 3431
3439 if (op->level && (strncmp (op->name, who->name, strlen (who->name)))) 3432 if (op->level && (strncmp (op->name, who->name, strlen (who->name))))
3440 { 3433 {
3441 new_draw_info (NDI_UNIQUE, 0, who,
3442 "The weapon does not recognize you as its owner. " 3434 who->failmsg ("The weapon does not recognize you as its owner. "
3443 "H<Its name indicates that it belongs to somebody else.>"); 3435 "H<Its name indicates that it belongs to somebody else.>");
3444 if (tmp) 3436 if (tmp)
3445 insert_ob_in_ob (tmp, who); 3437 insert_ob_in_ob (tmp, who);
3446 3438
3447 return 1; 3439 return 1;
3453 case HORN: 3445 case HORN:
3454 /* check for skill, alter player status */ 3446 /* check for skill, alter player status */
3455 3447
3456 if (!skop) 3448 if (!skop)
3457 { 3449 {
3458 new_draw_info_format (NDI_UNIQUE, 0, who, "The %s is broken, please report this to the dungeon master!", query_name (op));//TODO 3450 who->failmsg (format ("The %s is broken, please report this to the dungeon master!", query_name (op)));//TODO
3459 return 1; 3451 return 1;
3460 } 3452 }
3461 3453
3462 SET_FLAG (op, FLAG_APPLIED); 3454 SET_FLAG (op, FLAG_APPLIED);
3463 who->change_skill (skop); 3455 who->change_skill (skop);
3464 3456
3465 if (who->contr) 3457 if (who->contr)
3466 { 3458 {
3467 who->contr->ranged_ob = op; 3459 who->contr->ranged_ob = op;
3468 3460
3469 new_draw_info_format (NDI_UNIQUE, 0, who, "You ready %s.", query_name (op)); 3461 who->statusmsg (format ("You ready %s.", query_name (op)));
3470 3462
3471 if (op->type == BOW) 3463 if (op->type == BOW)
3472 { 3464 {
3473 who->current_weapon = op; 3465 who->current_weapon = op;
3474 change_abil (who, op); 3466 change_abil (who, op);
3475 new_draw_info_format (NDI_UNIQUE, 0, who,
3476 "You will now fire %s with %s.", op->race ? &op->race : "nothing", query_name (op)); 3467 who->statusmsg (format ("You will now fire %s with %s.", op->race ? &op->race : "nothing", query_name (op)));
3477 } 3468 }
3478 } 3469 }
3479 else 3470 else
3480 { 3471 {
3481 if (op->type == BOW) 3472 if (op->type == BOW)
3491 { 3482 {
3492 //TODO: wtf does this do? shouldn't this be managed automatically (slots?) 3483 //TODO: wtf does this do? shouldn't this be managed automatically (slots?)
3493 if (who->contr->ranged_ob && who->contr->ranged_ob->type == BUILDER) 3484 if (who->contr->ranged_ob && who->contr->ranged_ob->type == BUILDER)
3494 unapply_special (who, who->contr->ranged_ob, 0); 3485 unapply_special (who, who->contr->ranged_ob, 0);
3495 3486
3496 new_draw_info_format (NDI_UNIQUE, 0, who, "You ready your %s.", query_name (op)); 3487 who->statusmsg (format ("You ready your %s.", query_name (op)));
3497 3488
3498 who->contr->ranged_ob = op; 3489 who->contr->ranged_ob = op;
3499 } 3490 }
3500 break; 3491 break;
3501 3492
3502 default: 3493 default:
3503 new_draw_info_format (NDI_UNIQUE, 0, who, "You apply %s.", query_name (op)); 3494 who->statusmsg (format ("You apply %s.", query_name (op)));
3504 } /* end of switch op->type */ 3495 }
3505 3496
3506 SET_FLAG (op, FLAG_APPLIED); 3497 SET_FLAG (op, FLAG_APPLIED);
3507 3498
3508 if (tmp) 3499 if (tmp)
3509 tmp = insert_ob_in_ob (tmp, who); 3500 tmp = insert_ob_in_ob (tmp, who);
3518 SET_FLAG (op, FLAG_BEEN_APPLIED); 3509 SET_FLAG (op, FLAG_BEEN_APPLIED);
3519 3510
3520 if (QUERY_FLAG (op, FLAG_CURSED) || QUERY_FLAG (op, FLAG_DAMNED)) 3511 if (QUERY_FLAG (op, FLAG_CURSED) || QUERY_FLAG (op, FLAG_DAMNED))
3521 if (who->type == PLAYER) 3512 if (who->type == PLAYER)
3522 { 3513 {
3523 new_draw_info (NDI_UNIQUE, 0, who, 3514 who->failmsg (
3524 "Oops, it feels deadly cold! " 3515 "Oops, it feels deadly cold! "
3525 "H<Maybe it wasn't such a bright idea to apply this cursed/damned item.>"); 3516 "H<Maybe it wasn't such a bright idea to apply this cursed/damned item.>"
3517 );
3526 SET_FLAG (op, FLAG_KNOWN_CURSED); 3518 SET_FLAG (op, FLAG_KNOWN_CURSED);
3527 } 3519 }
3528 3520
3529 if (who->type == PLAYER) 3521 if (who->type == PLAYER)
3530 { 3522 {
3768 { 3760 {
3769 if (QUERY_FLAG (food, FLAG_CURSED)) 3761 if (QUERY_FLAG (food, FLAG_CURSED))
3770 { 3762 {
3771 assign (who->contr->killer, food->name); 3763 assign (who->contr->killer, food->name);
3772 hit_player (who, food->stats.hp, food, AT_POISON, 1); 3764 hit_player (who, food->stats.hp, food, AT_POISON, 1);
3773 new_draw_info (NDI_UNIQUE, 0, who, "Eck!...that was poisonous!"); 3765 who->failmsg ("Eck!...that was poisonous!");
3774 } 3766 }
3775 else 3767 else
3776 { 3768 {
3777 if (food->stats.hp > 0) 3769 if (food->stats.hp > 0)
3778 new_draw_info (NDI_UNIQUE, 0, who, "You begin to feel better."); 3770 who->statusmsg ("You begin to feel better.");
3779 else 3771 else
3780 new_draw_info (NDI_UNIQUE, 0, who, "Eck!...that was poisonous!"); 3772 who->failmsg ("Eck!...that was poisonous!");
3773
3781 who->stats.hp += food->stats.hp; 3774 who->stats.hp += food->stats.hp;
3782 } 3775 }
3783 } 3776 }
3784 if (food->stats.sp != 0) 3777 if (food->stats.sp != 0)
3785 { 3778 {
3786 if (QUERY_FLAG (food, FLAG_CURSED)) 3779 if (QUERY_FLAG (food, FLAG_CURSED))
3787 { 3780 {
3788 new_draw_info (NDI_UNIQUE, 0, who, "You are drained of mana!"); 3781 who->failmsg ("You are drained of mana!");
3789 who->stats.sp -= food->stats.sp; 3782 who->stats.sp -= food->stats.sp;
3790 if (who->stats.sp < 0) 3783 if (who->stats.sp < 0)
3791 who->stats.sp = 0; 3784 who->stats.sp = 0;
3792 } 3785 }
3793 else 3786 else
3794 { 3787 {
3795 new_draw_info (NDI_UNIQUE, 0, who, "You feel a rush of magical energy!"); 3788 who->statusmsg ("You feel a rush of magical energy!");
3796 who->stats.sp += food->stats.sp; 3789 who->stats.sp += food->stats.sp;
3797 /* place limit on max sp from food? */ 3790 /* place limit on max sp from food? */
3798 } 3791 }
3799 } 3792 }
3793
3800 who->update_stats (); 3794 who->update_stats ();
3801} 3795}
3802 3796
3803/** 3797/**
3804 * Designed primarily to light torches/lanterns/etc. 3798 * Designed primarily to light torches/lanterns/etc.
3831 } 3825 }
3832 else 3826 else
3833 lighter->stats.food--; 3827 lighter->stats.food--;
3834 } 3828 }
3835 else if (lighter->last_eat) 3829 else if (lighter->last_eat)
3830 {
3836 { /* no charges left in lighter */ 3831 /* no charges left in lighter */
3837 new_draw_info_format (NDI_UNIQUE, 0, who, "You attempt to light the %s with a used up %s.", &item->name, &lighter->name); 3832 who->failmsg (format ("You attempt to light the %s with a used up %s.", &item->name, &lighter->name));
3838 return; 3833 return;
3839 } 3834 }
3840 3835
3841 /* Perhaps we should split what we are trying to light on fire? 3836 /* Perhaps we should split what we are trying to light on fire?
3842 * I can't see many times when you would want to light multiple 3837 * I can't see many times when you would want to light multiple
3848 3843
3849 save_throw_object (item, AT_FIRE, who); 3844 save_throw_object (item, AT_FIRE, who);
3850 3845
3851 if (item->destroyed ()) 3846 if (item->destroyed ())
3852 { 3847 {
3853 new_draw_info_format (NDI_UNIQUE, 0, who, "You light the %s with the %s.", &item->name, &lighter->name); 3848 who->statusmsg (format ("You light the %s with the %s.", &item->name, &lighter->name));
3854 /* Need to update the player so that the players glow radius 3849 /* Need to update the player so that the players glow radius
3855 * gets changed. 3850 * gets changed.
3856 */ 3851 */
3857 if (is_player_env) 3852 if (is_player_env)
3858 who->update_stats (); 3853 who->update_stats ();
3859 } 3854 }
3860 else 3855 else
3861 new_draw_info_format (NDI_UNIQUE, 0, who, "You attempt to light the %s with the %s and fail.", &item->name, &lighter->name); 3856 who->failmsg (format ("You attempt to light the %s with the %s and fail.", &item->name, &lighter->name));
3862 } 3857 }
3863 else /* nothing to light */ 3858 else
3864 new_draw_info (NDI_UNIQUE, 0, who, "You need to mark a lightable object."); 3859 who->failmsg ("You need to mark a lightable object.");
3865
3866} 3860}
3867 3861
3868/** 3862/**
3869 * op made some mistake with a scroll, this takes care of punishment. 3863 * op made some mistake with a scroll, this takes care of punishment.
3870 * scroll_failure()- hacked directly from spell_failure 3864 * scroll_failure()- hacked directly from spell_failure
3877 3871
3878 if (failure <= -1 && failure > -15) 3872 if (failure <= -1 && failure > -15)
3879 { /* wonder */ 3873 { /* wonder */
3880 object *tmp; 3874 object *tmp;
3881 3875
3882 new_draw_info (NDI_UNIQUE, 0, op, "Your spell warps!"); 3876 op->failmsg ("Your spell warps!");
3883 tmp = get_archetype (SPELL_WONDER); 3877 tmp = get_archetype (SPELL_WONDER);
3884 cast_wonder (op, op, 0, tmp); 3878 cast_wonder (op, op, 0, tmp);
3885 tmp->destroy (); 3879 tmp->destroy ();
3886 } 3880 }
3887 else if (failure <= -15 && failure > -35) 3881 else if (failure <= -15 && failure > -35)
3888 { /* drain mana */ 3882 { /* drain mana */
3889 new_draw_info (NDI_UNIQUE, 0, op, "Your mana is drained!."); 3883 op->failmsg ("Your mana is drained!");
3890 op->stats.sp -= random_roll (0, power - 1, op, PREFER_LOW); 3884 op->stats.sp -= random_roll (0, power - 1, op, PREFER_LOW);
3891 if (op->stats.sp < 0) 3885 if (op->stats.sp < 0)
3892 op->stats.sp = 0; 3886 op->stats.sp = 0;
3893 } 3887 }
3894 else if (settings.spell_failure_effects == TRUE) 3888 else if (settings.spell_failure_effects == TRUE)
3895 { 3889 {
3896 if (failure <= -35 && failure > -60) 3890 if (failure <= -35 && failure > -60)
3897 { /* confusion */ 3891 { /* confusion */
3898 new_draw_info (NDI_UNIQUE, 0, op, "The magic recoils on you!"); 3892 op->failmsg ("The magic recoils on you!");
3899 confuse_player (op, op, power); 3893 confuse_player (op, op, power);
3900 } 3894 }
3901 else if (failure <= -60 && failure > -70) 3895 else if (failure <= -60 && failure > -70)
3902 { /* paralysis */ 3896 { /* paralysis */
3903 new_draw_info (NDI_UNIQUE, 0, op, "The magic recoils and paralyzes " "you!"); 3897 op->failmsg ("The magic recoils and paralyzes you!");
3904 paralyze_player (op, op, power); 3898 paralyze_player (op, op, power);
3905 } 3899 }
3906 else if (failure <= -70 && failure > -80) 3900 else if (failure <= -70 && failure > -80)
3907 { /* blind */ 3901 { /* blind */
3908 new_draw_info (NDI_UNIQUE, 0, op, "The magic recoils on you!"); 3902 op->failmsg ("The magic recoils on you!");
3909 blind_player (op, op, power); 3903 blind_player (op, op, power);
3910 } 3904 }
3911 else if (failure <= -80) 3905 else if (failure <= -80)
3912 { /* blast the immediate area */ 3906 { /* blast the immediate area */
3913 object *tmp = get_archetype (LOOSE_MANA); 3907 object *tmp = get_archetype (LOOSE_MANA);
3914 cast_magic_storm (op, tmp, power); 3908 cast_magic_storm (op, tmp, power);
3915 new_draw_info (NDI_UNIQUE, 0, op, "You unleash uncontrolled mana!"); 3909 op->failmsg ("You unleash uncontrolled mana!");
3916 tmp->destroy (); 3910 tmp->destroy ();
3917 } 3911 }
3918 } 3912 }
3919} 3913}
3920 3914
4032 4026
4033 marked = find_marked_object (pl); 4027 marked = find_marked_object (pl);
4034 4028
4035 if (!marked) 4029 if (!marked)
4036 { 4030 {
4037 new_draw_info_format (NDI_UNIQUE, 0, pl, "Use the %s with what item?", query_name (transformer)); 4031 pl->failmsg (format ("Use the %s with what item?", query_name (transformer)));
4038 return; 4032 return;
4039 } 4033 }
4040 4034
4041 if (!marked->slaying) 4035 if (!marked->slaying)
4042 { 4036 {
4043 new_draw_info_format (NDI_UNIQUE, 0, pl, "You can't use the %s with your %s!", query_name (transformer), query_name (marked)); 4037 pl->failmsg (format ("You can't use the %s with your %s!", query_name (transformer), query_name (marked)));
4044 return; 4038 return;
4045 } 4039 }
4046 4040
4047 /* check whether they are compatible or not */ 4041 /* check whether they are compatible or not */
4048 find = strstr (marked->slaying, transformer->arch->archname); 4042 find = strstr (marked->slaying, transformer->arch->archname);
4049 if (!find || (*(find + strlen (transformer->arch->archname)) != ':')) 4043 if (!find || (*(find + strlen (transformer->arch->archname)) != ':'))
4050 { 4044 {
4051 new_draw_info_format (NDI_UNIQUE, 0, pl, "You can't use the %s with your %s!", query_name (transformer), query_name (marked)); 4045 pl->failmsg (format ("You can't use the %s with your %s!", query_name (transformer), query_name (marked)));
4052 return; 4046 return;
4053 } 4047 }
4054 4048
4055 find += strlen (transformer->arch->archname) + 1; 4049 find += strlen (transformer->arch->archname) + 1;
4056 /* Item can be used, now find how many and what it yields */ 4050 /* Item can be used, now find how many and what it yields */
4066 else 4060 else
4067 yield = 1; 4061 yield = 1;
4068 4062
4069 while (isdigit (*find)) 4063 while (isdigit (*find))
4070 find++; 4064 find++;
4065
4071 while (*find == ' ') 4066 while (*find == ' ')
4072 find++; 4067 find++;
4073 4068
4074 memset (got, 0, MAX_BUF); 4069 memset (got, 0, MAX_BUF);
4075 4070
4086 4081
4087 /* Now create new item, remove used ones when required. */ 4082 /* Now create new item, remove used ones when required. */
4088 new_item = get_archetype (got); 4083 new_item = get_archetype (got);
4089 if (!new_item) 4084 if (!new_item)
4090 { 4085 {
4091 pl->errormsg (format ("This %s is strange, better to not use it.", query_base_name (marked, 0))); 4086 pl->failmsg (format ("This %s is strange, better to not use it.", query_base_name (marked, 0)));
4092 return; 4087 return;
4093 } 4088 }
4094 4089
4095 new_item->nrof = yield; 4090 new_item->nrof = yield;
4096 4091

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines