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.104 by root, Sat Jun 27 03:51:05 2009 UTC vs.
Revision 1.117 by root, Sat Jan 30 23:30:26 2010 UTC

3 * 3 *
4 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992,2007 Frank Tore Johansen 6 * Copyright (©) 1992,2007 Frank Tore Johansen
7 * 7 *
8 * Deliantra is free software: you can redistribute it and/or modify 8 * Deliantra is free software: you can redistribute it and/or modify it under
9 * it under the terms of the GNU General Public License as published by 9 * the terms of the Affero GNU General Public License as published by the
10 * the Free Software Foundation, either version 3 of the License, or 10 * Free Software Foundation, either version 3 of the License, or (at your
11 * (at your option) any later version. 11 * option) any later version.
12 * 12 *
13 * This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the Affero GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. 19 * and the GNU General Public License along with this program. If not, see
20 * <http://www.gnu.org/licenses/>.
20 * 21 *
21 * The authors can be reached via e-mail to <support@deliantra.net> 22 * The authors can be reached via e-mail to <support@deliantra.net>
22 */ 23 */
23 24
24#include <global.h> 25#include <global.h>
71 if (!(random_roll (0, 3, op, PREFER_HIGH))) 72 if (!(random_roll (0, 3, op, PREFER_HIGH)))
72 { 73 {
73 new_draw_info_format (NDI_UNIQUE, 0, op, "The %s vibrates violently, then explodes!", query_name (wand)); 74 new_draw_info_format (NDI_UNIQUE, 0, op, "The %s vibrates violently, then explodes!", query_name (wand));
74 op->play_sound (sound_find ("ob_explode")); 75 op->play_sound (sound_find ("ob_explode"));
75 wand->destroy (); 76 wand->destroy ();
76 tmp = get_archetype ("fireball"); 77 tmp = get_archetype (shstr_fireball);
77 tmp->stats.dam = (spell_ob->stats.dam + SP_level_dam_adjust (caster, spell_ob)) / 10; 78 tmp->stats.dam = (spell_ob->stats.dam + SP_level_dam_adjust (caster, spell_ob)) / 10;
78 79
79 if (!tmp->stats.dam) 80 if (!tmp->stats.dam)
80 tmp->stats.dam = 1; 81 tmp->stats.dam = 1;
81 82
261 new_draw_info (NDI_UNIQUE, 0, op, "You don't have enough experience to create any food."); 262 new_draw_info (NDI_UNIQUE, 0, op, "You don't have enough experience to create any food.");
262 return 0; 263 return 0;
263 } 264 }
264 265
265 food_value /= at->stats.food; 266 food_value /= at->stats.food;
266 new_op = arch_to_object (at); 267 new_op = at->instance ();
267 new_op->nrof = food_value; 268 new_op->nrof = food_value;
268 269
269 new_op->value = 0; 270 new_op->value = 0;
270 if (new_op->nrof < 1) 271 if (new_op->nrof < 1)
271 new_op->nrof = 1; 272 new_op->nrof = 1;
564 565
565int 566int
566perceive_self (object *op) 567perceive_self (object *op)
567{ 568{
568 const char *cp = describe_item (op, op); 569 const char *cp = describe_item (op, op);
569 archetype *at = archetype::find (ARCH_DEPLETION); 570 archetype *at = archetype::find (shstr_depletion);
570 571
571 dynbuf_text &buf = msg_dynbuf; buf.clear (); 572 dynbuf_text &buf = msg_dynbuf; buf.clear ();
572 573
573 if (!op->is_player ()) 574 if (!op->is_player ())
574 return 0; 575 return 0;
593 for (int i = 0; i < NUM_STATS; i++) 594 for (int i = 0; i < NUM_STATS; i++)
594 if (tmp->stats.stat (i) < 0) 595 if (tmp->stats.stat (i) < 0)
595 buf.printf (" - Your %s is depleted by %d.\n", statname[i], -tmp->stats.stat (i)); 596 buf.printf (" - Your %s is depleted by %d.\n", statname[i], -tmp->stats.stat (i));
596 } 597 }
597 598
598 if (is_dragon_pl (op)) 599 if (op->is_dragon ())
599 /* now grab the 'dragon_ability'-force from the player's inventory */ 600 /* now grab the 'dragon_ability'-force from the player's inventory */
600 for (tmp = op->inv; tmp; tmp = tmp->below) 601 for (tmp = op->inv; tmp; tmp = tmp->below)
601 { 602 {
602 if (tmp->type == FORCE && tmp->arch->archname == shstr_dragon_ability_force) 603 if (tmp->type == FORCE && tmp->arch->archname == shstr_dragon_ability_force)
603 { 604 {
649 new_draw_info (NDI_UNIQUE, 0, op, "Something is in the way."); 650 new_draw_info (NDI_UNIQUE, 0, op, "Something is in the way.");
650 return 0; 651 return 0;
651 } 652 }
652 653
653 if (spell_ob->other_arch) 654 if (spell_ob->other_arch)
654 tmp = arch_to_object (spell_ob->other_arch); 655 tmp = spell_ob->other_arch->instance ();
655 else if (spell_ob->race) 656 else if (spell_ob->race)
656 { 657 {
657 char buf1[MAX_BUF]; 658 char buf1[MAX_BUF];
658 659
659 sprintf (buf1, spell_ob->race, dir); 660 sprintf (buf1, spell_ob->race, dir);
663 LOG (llevError, "summon_wall: Unable to find archetype %s\n", buf1); 664 LOG (llevError, "summon_wall: Unable to find archetype %s\n", buf1);
664 new_draw_info (NDI_UNIQUE, 0, op, "This spell is broken."); 665 new_draw_info (NDI_UNIQUE, 0, op, "This spell is broken.");
665 return 0; 666 return 0;
666 } 667 }
667 668
668 tmp = arch_to_object (at); 669 tmp = at->instance ();
669 } 670 }
670 else 671 else
671 { 672 {
672 LOG (llevError, "magic_wall: spell %s lacks other_arch\n", &spell_ob->name); 673 LOG (llevError, "magic_wall: spell %s lacks other_arch\n", &spell_ob->name);
673 return 0; 674 return 0;
717 return 0; 718 return 0;
718 } 719 }
719 720
720 /* If this is a spellcasting wall, need to insert the spell object */ 721 /* If this is a spellcasting wall, need to insert the spell object */
721 if (tmp->other_arch && tmp->other_arch->type == SPELL) 722 if (tmp->other_arch && tmp->other_arch->type == SPELL)
722 insert_ob_in_ob (arch_to_object (tmp->other_arch), tmp); 723 insert_ob_in_ob (tmp->other_arch->instance (), tmp);
723 724
724 /* This code causes the wall to extend some distance in 725 /* This code causes the wall to extend some distance in
725 * each direction, or until an obstruction is encountered. 726 * each direction, or until an obstruction is encountered.
726 * posblocked and negblocked help determine how far the 727 * posblocked and negblocked help determine how far the
727 * created wall can extend, it won't go extend through 728 * created wall can extend, it won't go extend through
747 object *tmp2 = tmp->clone (); 748 object *tmp2 = tmp->clone ();
748 m->insert (tmp2, x, y, op); 749 m->insert (tmp2, x, y, op);
749 750
750 /* If this is a spellcasting wall, need to insert the spell object */ 751 /* If this is a spellcasting wall, need to insert the spell object */
751 if (tmp2->other_arch && tmp2->other_arch->type == SPELL) 752 if (tmp2->other_arch && tmp2->other_arch->type == SPELL)
752 tmp2->insert (arch_to_object (tmp2->other_arch)); 753 tmp2->insert (tmp2->other_arch->instance ());
753 754
754 } 755 }
755 else 756 else
756 posblocked = 1; 757 posblocked = 1;
757 758
764 { 765 {
765 object *tmp2 = tmp->clone (); 766 object *tmp2 = tmp->clone ();
766 m->insert (tmp2, x, y, op); 767 m->insert (tmp2, x, y, op);
767 768
768 if (tmp2->other_arch && tmp2->other_arch->type == SPELL) 769 if (tmp2->other_arch && tmp2->other_arch->type == SPELL)
769 tmp2->insert (arch_to_object (tmp2->other_arch)); 770 tmp2->insert (tmp2->other_arch->instance ());
770 } 771 }
771 else 772 else
772 negblocked = 1; 773 negblocked = 1;
773 } 774 }
774 775
884 885
885 /* Actually move the player now */ 886 /* Actually move the player now */
886 if (!(op = op->map->insert (op, op->x + freearr_x[dir] * dist, op->y + freearr_y[dir] * dist, op))) 887 if (!(op = op->map->insert (op, op->x + freearr_x[dir] * dist, op->y + freearr_y[dir] * dist, op)))
887 return 1; 888 return 1;
888 889
889 op->speed_left = -FABS (op->speed) * 5; /* Freeze them for a short while */ 890 op->speed_left = -5. * op->speed; /* Freeze them for a short while */
891
890 return 1; 892 return 1;
891} 893}
892 894
893/* cast_heal: Heals something. 895/* cast_heal: Heals something.
894 * op is the caster. 896 * op is the caster.
949 if (cure_disease (tmp, op, spell)) 951 if (cure_disease (tmp, op, spell))
950 success = 1; 952 success = 1;
951 953
952 if (spell->attacktype & AT_POISON) 954 if (spell->attacktype & AT_POISON)
953 { 955 {
954 at = archetype::find ("poisoning"); 956 at = archetype::find (shstr_poisoning);
955 poison = present_arch_in_ob (at, tmp); 957 poison = present_arch_in_ob (at, tmp);
956 if (poison) 958 if (poison)
957 { 959 {
958 success = 1; 960 success = 1;
959 new_draw_info (NDI_UNIQUE, 0, tmp, "Your body feels cleansed"); 961 new_draw_info (NDI_UNIQUE, 0, tmp, "Your body feels cleansed");
961 } 963 }
962 } 964 }
963 965
964 if (spell->attacktype & AT_CONFUSION) 966 if (spell->attacktype & AT_CONFUSION)
965 { 967 {
966 poison = present_in_ob_by_name (FORCE, "confusion", tmp); 968 poison = present_in_ob_by_name (FORCE, shstr_confusion, tmp);
967 if (poison) 969 if (poison)
968 { 970 {
969 success = 1; 971 success = 1;
970 new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer"); 972 new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer");
971 poison->duration = 1; 973 poison->duration = 1;
972 } 974 }
973 } 975 }
974 976
975 if (spell->attacktype & AT_BLIND) 977 if (spell->attacktype & AT_BLIND)
976 { 978 {
977 at = archetype::find ("blindness"); 979 at = archetype::find (shstr_blindness);
978 poison = present_arch_in_ob (at, tmp); 980 poison = present_arch_in_ob (at, tmp);
979 if (poison) 981 if (poison)
980 { 982 {
981 success = 1; 983 success = 1;
982 new_draw_info (NDI_UNIQUE, 0, tmp, "Your vision begins to return."); 984 new_draw_info (NDI_UNIQUE, 0, tmp, "Your vision begins to return.");
1030 "You don't feel any more powerful." 1032 "You don't feel any more powerful."
1031 "You are no easier to look at.", 1033 "You are no easier to look at.",
1032}; 1034};
1033 1035
1034int 1036int
1037change_ability_duration (object *spell, object *caster)
1038{
1039 return spell->duration + SP_level_duration_adjust (caster, spell) * 50;
1040}
1041
1042int
1035cast_change_ability (object *op, object *caster, object *spell_ob, int dir, int silent) 1043cast_change_ability (object *op, object *caster, object *spell_ob, int dir, int silent)
1036{ 1044{
1037 object *force = 0; 1045 object *force = 0;
1038 int i; 1046 int i;
1039 1047
1056 break; 1064 break;
1057 } 1065 }
1058 else if (spell_ob->race && spell_ob->race == tmp2->name) 1066 else if (spell_ob->race && spell_ob->race == tmp2->name)
1059 { 1067 {
1060 if (!silent) 1068 if (!silent)
1061 new_draw_info_format (NDI_UNIQUE, 0, op, "You can not cast %s while %s is in effect", &spell_ob->name, &tmp2->name_pl); 1069 new_draw_info_format (NDI_UNIQUE, 0, op,
1070 "You can not cast %s while %s is in effect",
1071 &spell_ob->name, &tmp2->name_pl);
1062 1072
1063 return 0; 1073 return 0;
1064 } 1074 }
1065 } 1075 }
1066 } 1076 }
1067 1077
1078 int duration = change_ability_duration (spell_ob, caster);
1079
1068 if (!force) 1080 if (force)
1069 {
1070 force = get_archetype (FORCE_NAME);
1071 force->subtype = FORCE_CHANGE_ABILITY;
1072
1073 if (spell_ob->race)
1074 force->name = spell_ob->race;
1075 else
1076 force->name = spell_ob->name;
1077
1078 force->name_pl = spell_ob->name;
1079 new_draw_info (NDI_UNIQUE, 0, op, "You create an aura of magical force.");
1080
1081 } 1081 {
1082 else
1083 {
1084 int duration;
1085
1086 duration = spell_ob->duration + SP_level_duration_adjust (caster, spell_ob) * 50;
1087 if (duration > force->duration) 1082 if (duration > force->duration)
1088 { 1083 {
1089 force->duration = duration; 1084 force->duration = duration;
1090 new_draw_info (NDI_UNIQUE, 0, op, "You recast the spell while in effect."); 1085 new_draw_info (NDI_UNIQUE, 0, op, "You recast the spell while in effect.");
1091 } 1086 }
1093 new_draw_info (NDI_UNIQUE, 0, op, "Recasting the spell had no effect."); 1088 new_draw_info (NDI_UNIQUE, 0, op, "Recasting the spell had no effect.");
1094 1089
1095 return 1; 1090 return 1;
1096 } 1091 }
1097 1092
1098 force->duration = spell_ob->duration + SP_level_duration_adjust (caster, spell_ob) * 50; 1093 new_draw_info_format (NDI_UNIQUE, 0, op,
1094 "You create an aura of magical force. H<The effect will last for about %.10g seconds.>",
1095 TICK2TIME (duration));
1096
1097 force = get_archetype (FORCE_NAME);
1098 force->subtype = FORCE_CHANGE_ABILITY;
1099 force->duration = duration;
1100
1101 if (spell_ob->race)
1102 force->name = spell_ob->race;
1103 else
1104 force->name = spell_ob->name;
1105
1106 force->name_pl = spell_ob->name;
1107
1099 force->speed = 1.0; 1108 force->speed = 1.0;
1100 force->speed_left = -1.0; 1109 force->speed_left = -1.0;
1101 SET_FLAG (force, FLAG_APPLIED); 1110 SET_FLAG (force, FLAG_APPLIED);
1102 1111
1103 /* Now start processing the effects. First, protections */ 1112 /* Now start processing the effects. First, protections */
1241 } 1250 }
1242 else 1251 else
1243 { 1252 {
1244 /* Only give out good benefits, and put a max on it */ 1253 /* Only give out good benefits, and put a max on it */
1245 for (i = 0; i < NROFATTACKS; i++) 1254 for (i = 0; i < NROFATTACKS; i++)
1246 {
1247 if (god->resist[i] > 0) 1255 if (god->resist[i] > 0)
1248 {
1249 force->resist[i] = MIN (god->resist[i], spell_ob->resist[ATNR_GODPOWER]); 1256 force->resist[i] = min (god->resist[i], spell_ob->resist[ATNR_GODPOWER]);
1250 } 1257
1251 }
1252 force->path_attuned |= god->path_attuned; 1258 force->path_attuned |= god->path_attuned;
1253 1259
1254 if (spell_ob->attacktype) 1260 if (spell_ob->attacktype)
1255 force->slaying = god->slaying; 1261 force->slaying = god->slaying;
1256 1262
1321 if (op->type != PLAYER) 1327 if (op->type != PLAYER)
1322 return 0; 1328 return 0;
1323 1329
1324 archetype *nugget[3]; 1330 archetype *nugget[3];
1325 1331
1326 nugget[0] = archetype::find ("pyrite3"); 1332 nugget[0] = archetype::find (shstr_pyrite3);
1327 nugget[1] = archetype::find ("pyrite2"); 1333 nugget[1] = archetype::find (shstr_pyrite2);
1328 nugget[2] = archetype::find ("pyrite"); 1334 nugget[2] = archetype::find (shstr_pyrite);
1329 1335
1330 /* Put a maximum weight of items that can be alchemised. Limits the power 1336 /* Put a maximum weight of items that can be alchemised. Limits the power
1331 * some, and also prevents people from alchemising every table/chair/clock 1337 * some, and also prevents people from alchemising every table/chair/clock
1332 * in sight 1338 * in sight
1333 */ 1339 */
1393 for (int i = 0; i < sizeof (nugget) / sizeof (nugget [0]); ++i) 1399 for (int i = 0; i < sizeof (nugget) / sizeof (nugget [0]); ++i)
1394 if (int nrof = value / nugget [i]->value) 1400 if (int nrof = value / nugget [i]->value)
1395 { 1401 {
1396 value -= nrof * nugget[i]->value; 1402 value -= nrof * nugget[i]->value;
1397 1403
1398 object *tmp = arch_to_object (nugget[i]); 1404 object *tmp = nugget[i]->instance ();
1399 tmp->nrof = nrof; 1405 tmp->nrof = nrof;
1400 tmp->flag [FLAG_IDENTIFIED] = true; 1406 tmp->flag [FLAG_IDENTIFIED] = true;
1401 op->map->insert (tmp, x, y, op, 0); 1407 op->map->insert (tmp, x, y, op, 0);
1402 } 1408 }
1403 1409
1414 * items. 1420 * items.
1415 */ 1421 */
1416int 1422int
1417remove_curse (object *op, object *caster, object *spell) 1423remove_curse (object *op, object *caster, object *spell)
1418{ 1424{
1419 object *tmp;
1420 int success = 0, was_one = 0; 1425 int success = 0, was_one = 0;
1421 1426
1422 for (tmp = op->inv; tmp; tmp = tmp->below) 1427 for (object *tmp = op->inv; tmp; tmp = tmp->below)
1423 if (QUERY_FLAG (tmp, FLAG_APPLIED) && 1428 if (QUERY_FLAG (tmp, FLAG_APPLIED) &&
1424 ((QUERY_FLAG (tmp, FLAG_CURSED) && QUERY_FLAG (spell, FLAG_CURSED)) || 1429 ((QUERY_FLAG (tmp, FLAG_CURSED) && QUERY_FLAG (spell, FLAG_CURSED)) ||
1425 (QUERY_FLAG (tmp, FLAG_DAMNED) && QUERY_FLAG (spell, FLAG_DAMNED)))) 1430 (QUERY_FLAG (tmp, FLAG_DAMNED) && QUERY_FLAG (spell, FLAG_DAMNED))))
1426 { 1431 {
1427 was_one++; 1432 was_one++;
1567 /* show invisible */ 1572 /* show invisible */
1568 if (QUERY_FLAG (spell, FLAG_MAKE_INVIS) && 1573 if (QUERY_FLAG (spell, FLAG_MAKE_INVIS) &&
1569 /* Might there be other objects that we can make visible? */ 1574 /* Might there be other objects that we can make visible? */
1570 (tmp->invisible && (QUERY_FLAG (tmp, FLAG_MONSTER) 1575 (tmp->invisible && (QUERY_FLAG (tmp, FLAG_MONSTER)
1571 || (tmp->type == PLAYER && !QUERY_FLAG (tmp, FLAG_WIZ)) 1576 || (tmp->type == PLAYER && !QUERY_FLAG (tmp, FLAG_WIZ))
1572 || tmp->type == CF_HANDLE 1577 || tmp->type == T_HANDLE
1573 || tmp->type == TRAPDOOR 1578 || tmp->type == TRAPDOOR
1574 || tmp->type == EXIT 1579 || tmp->type == EXIT
1575 || tmp->type == HOLE 1580 || tmp->type == HOLE
1576 || tmp->type == BUTTON 1581 || tmp->type == BUTTON
1577 || tmp->type == TELEPORTER 1582 || tmp->type == TELEPORTER
1658 /* Code here puts an effect of the spell on the space, so you can see 1663 /* Code here puts an effect of the spell on the space, so you can see
1659 * where the magic is. 1664 * where the magic is.
1660 */ 1665 */
1661 if (done_one) 1666 if (done_one)
1662 { 1667 {
1663 object *detect_ob = arch_to_object (spell->other_arch); 1668 object *detect_ob = spell->other_arch->instance ();
1664 1669
1665 /* if this is set, we want to copy the face */ 1670 /* if this is set, we want to copy the face */
1666 if (done_one == 2 && detect) 1671 if (done_one == 2 && detect)
1667 { 1672 {
1668 detect_ob->face = detect->face; 1673 detect_ob->face = detect->face;
2025 } 2030 }
2026 2031
2027 weapon = weapon->split (); 2032 weapon = weapon->split ();
2028 2033
2029 /* create the golem object */ 2034 /* create the golem object */
2030 tmp = arch_to_object (spell->other_arch); 2035 tmp = spell->other_arch->instance ();
2031 2036
2032 /* if animated by a player, give the player control of the golem */ 2037 /* if animated by a player, give the player control of the golem */
2033 CLEAR_FLAG (tmp, FLAG_MONSTER); 2038 CLEAR_FLAG (tmp, FLAG_MONSTER);
2034 tmp->stats.exp = 0; 2039 tmp->stats.exp = 0;
2035 add_friendly_object (tmp); 2040 add_friendly_object (tmp);
2080 2085
2081 /* attacktype */ 2086 /* attacktype */
2082 if (!tmp->attacktype) 2087 if (!tmp->attacktype)
2083 tmp->attacktype = AT_PHYSICAL; 2088 tmp->attacktype = AT_PHYSICAL;
2084 2089
2085 if (materialtype_t *mt = name_to_material (op->materialname))
2086 {
2087 for (i = 0; i < NROFATTACKS; i++) 2090 for (i = 0; i < NROFATTACKS; i++)
2088 tmp->resist[i] = 50 - (mt->save[i] * 5); 2091 tmp->resist[i] = 50 - (op->material->save[i] * 5);
2089 a = mt->save[0]; 2092
2090 } 2093 a = op->material->save[0];
2091 else
2092 {
2093 for (i = 0; i < NROFATTACKS; i++)
2094 tmp->resist[i] = 5;
2095 a = 10;
2096 }
2097 2094
2098 /* Set weapon's immunity */ 2095 /* Set weapon's immunity */
2099 tmp->resist[ATNR_CONFUSION] = 100; 2096 tmp->resist[ATNR_CONFUSION] = 100;
2100 tmp->resist[ATNR_POISON] = 100; 2097 tmp->resist[ATNR_POISON] = 100;
2101 tmp->resist[ATNR_SLOW] = 100; 2098 tmp->resist[ATNR_SLOW] = 100;
2128 tmp->state = weapon->state; 2125 tmp->state = weapon->state;
2129 tmp->flag [FLAG_ANIMATE] = weapon->flag [FLAG_ANIMATE]; 2126 tmp->flag [FLAG_ANIMATE] = weapon->flag [FLAG_ANIMATE];
2130 } 2127 }
2131 2128
2132 /* make experience increase in proportion to the strength of the summoned creature. */ 2129 /* make experience increase in proportion to the strength of the summoned creature. */
2133 tmp->stats.exp *= 1 + (MAX (spell->stats.maxgrace, spell->stats.sp) / casting_level (caster, spell)); 2130 tmp->stats.exp *= 1 + (max (spell->stats.maxgrace, spell->stats.sp) / casting_level (caster, spell));
2134 2131
2135 tmp->speed_left = -1; 2132 tmp->speed_left = -1;
2136 tmp->direction = dir; 2133 tmp->direction = dir;
2137 2134
2138 m->insert (tmp, x, y, op); 2135 m->insert (tmp, x, y, op);
2177 2174
2178 new_aura = present_arch_in_ob (spell->other_arch, op); 2175 new_aura = present_arch_in_ob (spell->other_arch, op);
2179 if (new_aura) 2176 if (new_aura)
2180 refresh = 1; 2177 refresh = 1;
2181 else 2178 else
2182 new_aura = arch_to_object (spell->other_arch); 2179 new_aura = spell->other_arch->instance ();
2183 2180
2184 new_aura->duration = spell->duration + 10 * SP_level_duration_adjust (caster, spell); 2181 new_aura->duration = spell->duration + 10 * SP_level_duration_adjust (caster, spell);
2185 2182
2186 new_aura->stats.dam = spell->stats.dam + SP_level_dam_adjust (caster, spell); 2183 new_aura->stats.dam = spell->stats.dam + SP_level_dam_adjust (caster, spell);
2187 2184
2252 if (pos.normalise () && !(OB_TYPE_MOVE_BLOCK (env, pos->move_block))) 2249 if (pos.normalise () && !(OB_TYPE_MOVE_BLOCK (env, pos->move_block)))
2253 { 2250 {
2254 hit_map (aura, i, aura->attacktype, 0); 2251 hit_map (aura, i, aura->attacktype, 0);
2255 2252
2256 if (aura->other_arch) 2253 if (aura->other_arch)
2257 pos.insert (arch_to_object (aura->other_arch), aura); 2254 pos.insert (aura->other_arch->instance (), aura);
2258 } 2255 }
2259 } 2256 }
2260 2257
2261 /* put the aura back in the player's inventory */ 2258 /* put the aura back in the player's inventory */
2262 env->insert (aura); 2259 env->insert (aura);
2281 continue; 2278 continue;
2282 2279
2283 if (victim->stats.exp == 0) 2280 if (victim->stats.exp == 0)
2284 continue; 2281 continue;
2285 2282
2286 def_lev = MAX (1, victim->level); 2283 def_lev = max (1, victim->level);
2287 atk_lev = MAX (1, op->level); 2284 atk_lev = max (1, op->level);
2288 2285
2289 if (rndm (0, atk_lev - 1) > def_lev) 2286 if (rndm (0, atk_lev - 1) > def_lev)
2290 { 2287 {
2291 /* make this sucker peaceful. */ 2288 /* make this sucker peaceful. */
2292 2289
2324 { 2321 {
2325 new_draw_info (NDI_UNIQUE, 0, op, "Write what?"); 2322 new_draw_info (NDI_UNIQUE, 0, op, "Write what?");
2326 return 0; 2323 return 0;
2327 } 2324 }
2328 2325
2329 if (strcasestr_local (msg, "endmsg")) 2326 if (!msg_is_safe (msg))
2330 { 2327 {
2331 new_draw_info (NDI_UNIQUE, 0, op, "Trying to cheat are we?"); 2328 new_draw_info (NDI_UNIQUE, 0, op, "Trying to cheat are we?");
2332 LOG (llevInfo, "write_rune: player %s tried to write bogus rune %s\n", &op->name, msg); 2329 LOG (llevInfo, "write_mark: player %s tried to write bogus rune %s\n", &op->name, msg);
2333 return 0; 2330 return 0;
2334 } 2331 }
2335 2332
2336 if (!spell->other_arch) 2333 if (!spell->other_arch)
2337 return 0; 2334 return 0;
2338 2335
2339 object *tmp = arch_to_object (spell->other_arch); 2336 object *tmp = spell->other_arch->instance ();
2340 2337
2341 tmp->race = op->name; /*Save the owner of the rune */ 2338 tmp->race = op->name; /*Save the owner of the rune */
2342 tmp->msg = msg; 2339 tmp->msg = msg;
2343 2340
2344 tmp->insert_at (op, op, INS_BELOW_ORIGINATOR); 2341 tmp->insert_at (op, op, INS_BELOW_ORIGINATOR);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines