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.127 by root, Wed Apr 14 02:31:24 2010 UTC vs.
Revision 1.145 by root, Wed Nov 16 23:42:03 2016 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992 Frank Tore Johansen 6 * Copyright (©) 1992 Frank Tore Johansen
7 * 7 *
8 * Deliantra is free software: you can redistribute it and/or modify it under 8 * Deliantra is free software: you can redistribute it and/or modify it under
9 * the terms of the Affero GNU General Public License as published by the 9 * the terms of the Affero GNU General Public License as published by the
10 * Free Software Foundation, either version 3 of the License, or (at your 10 * Free Software Foundation, either version 3 of the License, or (at your
11 * 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 Affero GNU General Public License 18 * You should have received a copy of the Affero GNU General Public License
19 * and the GNU General Public License along with this program. If not, see 19 * and the GNU General Public License along with this program. If not, see
20 * <http://www.gnu.org/licenses/>. 20 * <http://www.gnu.org/licenses/>.
21 * 21 *
22 * 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>
23 */ 23 */
24 24
25#include <global.h> 25#include <global.h>
26#include <object.h> 26#include <object.h>
58} 58}
59 59
60int 60int
61recharge (object *op, object *caster, object *spell_ob) 61recharge (object *op, object *caster, object *spell_ob)
62{ 62{
63 object *wand, *tmp;
64 int ncharges; 63 int ncharges;
65 64
66 wand = find_marked_object (op); 65 object *wand = op->mark ();
66
67 if (!wand || wand->type != WAND) 67 if (!wand || wand->type != WAND)
68 { 68 {
69 op->failmsg ("You need to mark the wand you want to recharge."); 69 op->failmsg ("You need to mark the wand you want to recharge.");
70 return 0; 70 return 0;
71 } 71 }
73 if (!(random_roll (0, 3, op, PREFER_HIGH))) 73 if (!(random_roll (0, 3, op, PREFER_HIGH)))
74 { 74 {
75 op->failmsgf ("The %s vibrates violently, then explodes!", query_name (wand)); 75 op->failmsgf ("The %s vibrates violently, then explodes!", query_name (wand));
76 op->play_sound (sound_find ("ob_explode")); 76 op->play_sound (sound_find ("ob_explode"));
77 wand->destroy (); 77 wand->destroy ();
78 tmp = get_archetype (shstr_fireball); 78 object *tmp = archetype::get (shstr_fireball);
79 tmp->stats.dam = (spell_ob->stats.dam + SP_level_dam_adjust (caster, spell_ob)) / 10; 79 tmp->stats.dam = (spell_ob->stats.dam + SP_level_dam_adjust (caster, spell_ob)) / 10;
80 80
81 if (!tmp->stats.dam) 81 if (!tmp->stats.dam)
82 tmp->stats.dam = 1; 82 tmp->stats.dam = 1;
83 83
196 /* Can't get any money for these objects */ 196 /* Can't get any money for these objects */
197 missile->value = 0; 197 missile->value = 0;
198 198
199 missile->set_flag (FLAG_IDENTIFIED); 199 missile->set_flag (FLAG_IDENTIFIED);
200 200
201 if (!cast_create_obj (op, caster, missile, dir) && op->type == PLAYER && !missile->destroyed ()) 201 cast_create_obj (op, caster, missile, dir);
202
203 if (!dir
204 && op->type == PLAYER
205 && !missile->destroyed ())
202 pick_up (op, missile); 206 pick_up (op, missile);
203 207
204 return 1; 208 return 1;
205} 209}
206
207 210
208/* allows the choice of what sort of food object to make. 211/* allows the choice of what sort of food object to make.
209 * If spellparam is NULL, it will create food dependent on level --PeterM*/ 212 * If spellparam is NULL, it will create food dependent on level --PeterM*/
210int 213int
211cast_create_food (object *op, object *caster, object *spell_ob, int dir, const char *spellparam) 214cast_create_food (object *op, object *caster, object *spell_ob, int dir, const char *spellparam)
389 392
390 /* Remove the switch with 90% duplicate code - just handle the differences with 393 /* Remove the switch with 90% duplicate code - just handle the differences with
391 * and if statement or two. 394 * and if statement or two.
392 */ 395 */
393 op->invisible += spell_ob->duration + SP_level_duration_adjust (caster, spell_ob); 396 op->invisible += spell_ob->duration + SP_level_duration_adjust (caster, spell_ob);
397
394 /* max duration */ 398 /* limit duration */
395 if (op->invisible > 1000) 399 min_it (op->invisible, 1000);
396 op->invisible = 1000;
397 400
398 if (op->type == PLAYER) 401 if (op->type == PLAYER)
399 { 402 {
400 op->contr->invis_race = spell_ob->race; 403 op->contr->invis_race = spell_ob->race;
401 404
402 if (spell_ob->flag [FLAG_MAKE_INVIS]) 405 if (spell_ob->flag [FLAG_MAKE_INVIS])
403 op->contr->tmp_invis = 0; 406 op->contr->tmp_invis = 0;
404 else 407 else
405 op->contr->tmp_invis = 1; 408 op->contr->tmp_invis = 1;
406
407 op->contr->hidden = 0;
408 } 409 }
409 410
410 if (makes_invisible_to (op, op)) 411 if (makes_invisible_to (op, op))
411 new_draw_info (NDI_UNIQUE, 0, op, "You can't see your hands!"); 412 new_draw_info (NDI_UNIQUE, 0, op, "You can't see your hands!");
412 else 413 else
461 462
462void 463void
463execute_word_of_recall (object *op) 464execute_word_of_recall (object *op)
464{ 465{
465 if (object *pl = op->in_player ()) 466 if (object *pl = op->in_player ())
466 {
467 if (pl->ms ().flags () & P_NO_CLERIC && !pl->flag [FLAG_WIZCAST]) 467 if (pl->ms ().flags () & P_NO_CLERIC && !pl->flag [FLAG_WIZCAST])
468 new_draw_info (NDI_UNIQUE, 0, pl, "You feel something fizzle inside you."); 468 new_draw_info (NDI_UNIQUE, 0, pl, "You feel something fizzle inside you.");
469 else 469 else
470 pl->player_goto (op->slaying, op->stats.hp, op->stats.sp); 470 pl->player_goto (op->slaying, op->stats.hp, op->stats.sp);
471 }
472 471
473 op->destroy (); 472 op->destroy ();
474} 473}
475 474
476/* Word of recall causes the player to return 'home'. 475/* Word of recall causes the player to return 'home'.
478 * time delay effect. 477 * time delay effect.
479 */ 478 */
480int 479int
481cast_word_of_recall (object *op, object *caster, object *spell_ob) 480cast_word_of_recall (object *op, object *caster, object *spell_ob)
482{ 481{
483 object *dummy; 482 if (!op->is_player ())
484 int time;
485
486 if (op->type != PLAYER)
487 return 0; 483 return 0;
488 484
489 if (find_obj_by_type_subtype (op, SPELL_EFFECT, SP_WORD_OF_RECALL)) 485 if (find_obj_by_type_subtype (op, SPELL_EFFECT, SP_WORD_OF_RECALL))
490 { 486 {
491 new_draw_info (NDI_UNIQUE, 0, op, "You feel a force starting to build up inside you."); 487 new_draw_info (NDI_UNIQUE, 0, op, "You feel a force starting to build up inside you.");
492 return 1; 488 return 1;
493 } 489 }
494 490
495 dummy = get_archetype (FORCE_NAME); 491 object *dummy = archetype::get (FORCE_NAME);
496 492
497 if (!dummy)
498 {
499 new_draw_info (NDI_UNIQUE, 0, op, "Oops, program error!");
500 LOG (llevError, "cast_word_of_recall: get_archetype(force) failed!\n");
501 return 0;
502 }
503
504 time = spell_ob->duration - SP_level_duration_adjust (caster, spell_ob); 493 int time = max (1, spell_ob->duration - SP_level_duration_adjust (caster, spell_ob));
505 if (time < 1)
506 time = 1;
507 494
508 /* value of speed really doesn't make much difference, as long as it is 495 /* value of speed really doesn't make much difference, as long as it is
509 * positive. Lower value may be useful so that the problem doesn't 496 * positive. Lower value may be useful so that the problem doesn't
510 * do anything really odd if it say a -1000 or something. 497 * do anything really odd if it say a -1000 or something.
511 */ 498 */
512 dummy->set_speed (0.002); 499 dummy->set_speed (0.002);
513 dummy->speed_left = -dummy->speed * time; 500 dummy->speed_left = -dummy->speed * time;
514 dummy->type = SPELL_EFFECT; 501 dummy->type = SPELL_EFFECT;
515 dummy->subtype = SP_WORD_OF_RECALL; 502 dummy->subtype = SP_WORD_OF_RECALL;
516 503 dummy->slaying = op->contr->savebed_map;
517 /* If we could take advantage of enter_player_savebed() here, it would be 504 dummy->stats.hp = op->contr->bed_x;
518 * nice, but until the map load fails, we can't. 505 dummy->stats.sp = op->contr->bed_y;
519 */
520 EXIT_PATH (dummy) = op->contr->savebed_map;
521 EXIT_X (dummy) = op->contr->bed_x;
522 EXIT_Y (dummy) = op->contr->bed_y;
523 506
524 op->insert (dummy); 507 op->insert (dummy);
525 508
526 new_draw_info (NDI_UNIQUE, 0, op, "You feel a force starting to build up inside you."); 509 new_draw_info (NDI_UNIQUE, 0, op, "You feel a force starting to build up inside you.");
527 510
1090 1073
1091 new_draw_info_format (NDI_UNIQUE, 0, op, 1074 new_draw_info_format (NDI_UNIQUE, 0, op,
1092 "You create an aura of magical force. H<The effect will last for about %.10g seconds.>", 1075 "You create an aura of magical force. H<The effect will last for about %.10g seconds.>",
1093 TICK2TIME (duration)); 1076 TICK2TIME (duration));
1094 1077
1095 force = get_archetype (FORCE_NAME); 1078 force = archetype::get (FORCE_NAME);
1096 force->subtype = FORCE_CHANGE_ABILITY; 1079 force->subtype = FORCE_CHANGE_ABILITY;
1097 force->duration = duration; 1080 force->duration = duration;
1098 1081
1099 if (spell_ob->race) 1082 if (spell_ob->race)
1100 force->name = spell_ob->race; 1083 force->name = spell_ob->race;
1107 force->speed_left = -1.0; 1090 force->speed_left = -1.0;
1108 force->set_flag (FLAG_APPLIED); 1091 force->set_flag (FLAG_APPLIED);
1109 1092
1110 /* Now start processing the effects. First, protections */ 1093 /* Now start processing the effects. First, protections */
1111 for (i = 0; i < NROFATTACKS; i++) 1094 for (i = 0; i < NROFATTACKS; i++)
1112 {
1113 if (spell_ob->resist[i]) 1095 if (spell_ob->resist[i])
1114 {
1115 force->resist[i] = spell_ob->resist[i] + SP_level_dam_adjust (caster, spell_ob); 1096 force->resist[i] = min (100, spell_ob->resist[i] + SP_level_dam_adjust (caster, spell_ob));
1116 if (force->resist[i] > 100)
1117 force->resist[i] = 100;
1118 }
1119 }
1120 1097
1121 if (spell_ob->stats.hp) 1098 if (spell_ob->stats.hp)
1122 force->stats.hp = spell_ob->stats.hp + SP_level_dam_adjust (caster, spell_ob); 1099 force->stats.hp = spell_ob->stats.hp + SP_level_dam_adjust (caster, spell_ob);
1123 1100
1124 if (tmp->type == PLAYER) 1101 if (tmp->type == PLAYER)
1210 } 1187 }
1211 } 1188 }
1212 1189
1213 if (force == NULL) 1190 if (force == NULL)
1214 { 1191 {
1215 force = get_archetype (FORCE_NAME); 1192 force = archetype::get (FORCE_NAME);
1216 force->subtype = FORCE_CHANGE_ABILITY; 1193 force->subtype = FORCE_CHANGE_ABILITY;
1217 if (spell_ob->race) 1194 if (spell_ob->race)
1218 force->name = spell_ob->race; 1195 force->name = spell_ob->race;
1219 else 1196 else
1220 force->name = spell_ob->name; 1197 force->name = spell_ob->name;
1235 { 1212 {
1236 new_draw_info (NDI_UNIQUE, 0, op, "Recasting the spell had no effect."); 1213 new_draw_info (NDI_UNIQUE, 0, op, "Recasting the spell had no effect.");
1237 } 1214 }
1238 return 0; 1215 return 0;
1239 } 1216 }
1217
1240 force->duration = spell_ob->duration + SP_level_duration_adjust (caster, spell_ob) * 50; 1218 force->duration = spell_ob->duration + SP_level_duration_adjust (caster, spell_ob) * 50;
1241 force->speed = 1.0; 1219 force->speed = 1.0;
1242 force->speed_left = -1.0; 1220 force->speed_left = -1.0;
1243 force->set_flag (FLAG_APPLIED); 1221 force->set_flag (FLAG_APPLIED);
1244 1222
1280 1258
1281/* Alchemy code by Mark Wedel 1259/* Alchemy code by Mark Wedel
1282 * 1260 *
1283 * This code adds a new spell, called alchemy. Alchemy will turn 1261 * This code adds a new spell, called alchemy. Alchemy will turn
1284 * objects to pyrite ("false gold"), henceforth called gold nuggets. 1262 * objects to pyrite ("false gold"), henceforth called gold nuggets.
1285 * 1263 *
1286 * The value of the gold nuggets being about 90% of that of the item 1264 * The value of the gold nuggets being about 90% of that of the item
1287 * itself. It uses the value of the object before charisma adjustments, 1265 * itself. It uses the value of the object before charisma adjustments,
1288 * because the nuggets themselves will be will be adjusted by charisma 1266 * because the nuggets themselves will be will be adjusted by charisma
1289 * when sold. 1267 * when sold.
1290 * 1268 *
1392 } 1370 }
1393 1371
1394 value -= rndm (value >> 4); 1372 value -= rndm (value >> 4);
1395 value = min (value, value_max); 1373 value = min (value, value_max);
1396 1374
1397 for (int i = 0; i < sizeof (nugget) / sizeof (nugget [0]); ++i) 1375 for (int i = 0; i < array_length (nugget); ++i)
1398 if (int nrof = value / nugget [i]->value) 1376 if (int nrof = value / nugget [i]->value)
1399 { 1377 {
1400 value -= nrof * nugget[i]->value; 1378 value -= nrof * nugget[i]->value;
1401 1379
1402 object *tmp = nugget[i]->instance (); 1380 object *tmp = nugget[i]->instance ();
1420int 1398int
1421remove_curse (object *op, object *caster, object *spell) 1399remove_curse (object *op, object *caster, object *spell)
1422{ 1400{
1423 int success = 0, was_one = 0; 1401 int success = 0, was_one = 0;
1424 1402
1403 int num_uncurse = max (1, spell->stats.dam + SP_level_dam_adjust (caster, spell));
1404
1405 op->splay_marked ();
1406
1407 int typeflag = spell->last_sp ? FLAG_DAMNED : FLAG_CURSED;
1408
1425 for (object *tmp = op->inv; tmp; tmp = tmp->below) 1409 for (object *tmp = op->inv; tmp && num_uncurse; tmp = tmp->below)
1426 if (tmp->flag [FLAG_APPLIED] && 1410 if (!tmp->invisible && tmp->flag [typeflag])
1427 ((tmp->flag [FLAG_CURSED] && spell->flag [FLAG_CURSED]) ||
1428 (tmp->flag [FLAG_DAMNED] && spell->flag [FLAG_DAMNED])))
1429 { 1411 {
1430 was_one++; 1412 ++was_one;
1431 1413
1432 if (tmp->level <= casting_level (caster, spell)) 1414 if (tmp->level <= casting_level (caster, spell))
1433 { 1415 {
1434 success++; 1416 ++success;
1435 if (spell->flag [FLAG_DAMNED]) 1417 --num_uncurse;
1436 tmp->clr_flag (FLAG_DAMNED);
1437 1418
1419 tmp->clr_flag (typeflag);
1438 tmp->clr_flag (FLAG_CURSED); 1420 tmp->clr_flag (FLAG_CURSED);
1439 tmp->clr_flag (FLAG_KNOWN_CURSED); 1421 tmp->clr_flag (FLAG_KNOWN_CURSED);
1440 tmp->value = 0; /* Still can't sell it */ 1422 tmp->value = 0; /* Still can't sell it */
1441 1423
1442 if (object *pl = tmp->visible_to ()) 1424 if (object *pl = tmp->visible_to ())
1445 } 1427 }
1446 1428
1447 if (op->type == PLAYER) 1429 if (op->type == PLAYER)
1448 { 1430 {
1449 if (success) 1431 if (success)
1450 new_draw_info (NDI_UNIQUE, 0, op, "You feel like some of your items are looser now."); 1432 new_draw_info (NDI_UNIQUE, 0, op, "You realise that some of your items look shinier now. H<You successfully removed some curses.>");
1451 else 1433 else
1452 { 1434 {
1453 if (was_one) 1435 if (was_one)
1454 new_draw_info (NDI_UNIQUE, 0, op, "You failed to remove the curse."); 1436 new_draw_info (NDI_UNIQUE, 0, op, "You failed to remove any curse. H<The spell was not strong enough.>");
1455 else 1437 else
1456 new_draw_info (NDI_UNIQUE, 0, op, "You are not using any cursed items."); 1438 new_draw_info (NDI_UNIQUE, 0, op, "You are not having any cursed items. H<Epic fail.>");
1457 } 1439 }
1458 } 1440 }
1459 1441
1460 return success; 1442 return success;
1461} 1443}
1462 1444
1463/* Identifies objects in the players inventory/on the ground */ 1445/* Identifies objects in the players inventory/on the ground */
1464int 1446int
1465cast_identify (object *op, object *caster, object *spell) 1447cast_identify (object *op, object *caster, object *spell)
1466{ 1448{
1467 object *tmp;
1468 dynbuf_text &buf = msg_dynbuf; buf.clear (); 1449 dynbuf_text &buf = msg_dynbuf; buf.clear ();
1469 1450
1470 int num_ident = max (1, spell->stats.dam + SP_level_dam_adjust (caster, spell)); 1451 int num_ident = max (1, spell->stats.dam + SP_level_dam_adjust (caster, spell));
1471 1452
1453 op->splay_marked ();
1454
1472 for (tmp = op->inv; tmp; tmp = tmp->below) 1455 for (object *tmp = op->inv; tmp; tmp = tmp->below)
1473 { 1456 {
1474 if (!tmp->flag [FLAG_IDENTIFIED] && !tmp->invisible && need_identify (tmp)) 1457 if (!tmp->flag [FLAG_IDENTIFIED] && !tmp->invisible && tmp->need_identify ())
1475 { 1458 {
1476 identify (tmp); 1459 identify (tmp);
1477 1460
1478 if (op->type == PLAYER) 1461 if (op->type == PLAYER)
1479 { 1462 {
1492 * stuff on the floor. Only identify stuff on the floor if the spell 1475 * stuff on the floor. Only identify stuff on the floor if the spell
1493 * was not fully used. 1476 * was not fully used.
1494 */ 1477 */
1495 if (num_ident) 1478 if (num_ident)
1496 { 1479 {
1497 for (tmp = GET_MAP_OB (op->map, op->x, op->y); tmp; tmp = tmp->above) 1480 for (object *tmp = GET_MAP_OB (op->map, op->x, op->y); tmp; tmp = tmp->above)
1498 if (!tmp->flag [FLAG_IDENTIFIED] && !tmp->invisible && need_identify (tmp)) 1481 if (!tmp->flag [FLAG_IDENTIFIED] && !tmp->invisible && tmp->need_identify ())
1499 { 1482 {
1500 identify (tmp); 1483 identify (tmp);
1501 1484
1502 if (object *pl = tmp->visible_to ()) 1485 if (object *pl = tmp->visible_to ())
1503 { 1486 {
1529 1512
1530int 1513int
1531cast_detection (object *op, object *caster, object *spell, object *skill) 1514cast_detection (object *op, object *caster, object *spell, object *skill)
1532{ 1515{
1533 object *tmp, *last, *god, *detect; 1516 object *tmp, *last, *god, *detect;
1534 int done_one, range, mflags, floor, level; 1517 int done_one, range, floor, level;
1535 sint16 x, y, nx, ny; 1518 sint16 x, y, nx, ny;
1536 maptile *m; 1519 maptile *m;
1537 1520
1538 /* We precompute some values here so that we don't have to keep 1521 /* We precompute some values here so that we don't have to keep
1539 * doing it over and over again. 1522 * doing it over and over again.
1616 * difficult to see what object is magical/cursed, so the 1599 * difficult to see what object is magical/cursed, so the
1617 * effect wouldn't be as apparent. 1600 * effect wouldn't be as apparent.
1618 */ 1601 */
1619 1602
1620 /* detect magic */ 1603 /* detect magic */
1621 if (spell->flag [FLAG_KNOWN_MAGICAL] && 1604 if (spell->flag [FLAG_KNOWN_MAGICAL]
1622 !tmp->flag [FLAG_KNOWN_MAGICAL] && !tmp->flag [FLAG_IDENTIFIED] && is_magical (tmp)) 1605 && !tmp->flag [FLAG_KNOWN_MAGICAL]
1606 && !tmp->flag [FLAG_IDENTIFIED]
1607 && tmp->need_identify ()
1608 && is_magical (tmp))
1623 { 1609 {
1624 tmp->set_flag (FLAG_KNOWN_MAGICAL); 1610 tmp->set_flag (FLAG_KNOWN_MAGICAL);
1625 /* make runes more visible */ 1611 /* make runes more visible */
1626 if (tmp->type == RUNE && tmp->attacktype & AT_MAGIC) 1612 if (tmp->type == RUNE && tmp->attacktype & AT_MAGIC)
1627 tmp->stats.Cha /= 4; 1613 tmp->stats.Cha /= 4;
1650 1636
1651 if (!detect) 1637 if (!detect)
1652 detect = tmp; 1638 detect = tmp;
1653 } 1639 }
1654 1640
1655 if (spell->flag [FLAG_KNOWN_CURSED] && !tmp->flag [FLAG_KNOWN_CURSED] && 1641 if (spell->flag [FLAG_KNOWN_CURSED]
1642 && !tmp->flag [FLAG_KNOWN_CURSED]
1643 && tmp->need_identify ()
1656 (tmp->flag [FLAG_CURSED] || tmp->flag [FLAG_DAMNED])) 1644 && (tmp->flag [FLAG_CURSED] || tmp->flag [FLAG_DAMNED]))
1657 { 1645 {
1658 tmp->set_flag (FLAG_KNOWN_CURSED); 1646 tmp->set_flag (FLAG_KNOWN_CURSED);
1659 done_one = 1; 1647 done_one = 1;
1660 } 1648 }
1661 1649
1978 * player checks. MSW 2003-01-06 1966 * player checks. MSW 2003-01-06
1979 */ 1967 */
1980int 1968int
1981animate_weapon (object *op, object *caster, object *spell, int dir) 1969animate_weapon (object *op, object *caster, object *spell, int dir)
1982{ 1970{
1983 object *weapon, *tmp;
1984 char buf[MAX_BUF]; 1971 char buf[MAX_BUF];
1985 int a, i; 1972 int a, i;
1986 sint16 x, y; 1973 sint16 x, y;
1987 maptile *m; 1974 maptile *m;
1988 1975
2018 op->failmsg ("There is something in the way."); 2005 op->failmsg ("There is something in the way.");
2019 return 0; 2006 return 0;
2020 } 2007 }
2021 2008
2022 /* Use the weapon marked by the player. */ 2009 /* Use the weapon marked by the player. */
2023 weapon = find_marked_object (op); 2010 object *weapon = op->mark ();
2024 2011
2025 if (!weapon) 2012 if (!weapon)
2026 { 2013 {
2027 op->failmsg ("You must mark a weapon to use with this spell!"); 2014 op->failmsg ("You must mark a weapon to use with this spell!");
2028 return 0; 2015 return 0;
2047 } 2034 }
2048 2035
2049 weapon = weapon->split (); 2036 weapon = weapon->split ();
2050 2037
2051 /* create the golem object */ 2038 /* create the golem object */
2052 tmp = spell->other_arch->instance (); 2039 object *tmp = spell->other_arch->instance ();
2053 2040
2054 /* if animated by a player, give the player control of the golem */ 2041 /* if animated by a player, give the player control of the golem */
2055 tmp->clr_flag (FLAG_MONSTER); 2042 tmp->clr_flag (FLAG_MONSTER);
2056 tmp->stats.exp = 0; 2043 tmp->stats.exp = 0;
2057 add_friendly_object (tmp); 2044 add_friendly_object (tmp);
2123 /* Improve weapon's armour value according to best save vs. physical of its material */ 2110 /* Improve weapon's armour value according to best save vs. physical of its material */
2124 2111
2125 if (a > 14) 2112 if (a > 14)
2126 a = 14; 2113 a = 14;
2127 2114
2128 tmp->resist[ATNR_PHYSICAL] = 100 - (int) ((100.0 - (float) tmp->resist[ATNR_PHYSICAL]) / (30.0 - 2.0 * a)); 2115 tmp->resist[ATNR_PHYSICAL] = 100 - (int) ((100.f - (float) tmp->resist[ATNR_PHYSICAL]) / (30.f - 2.f * a));
2129 2116
2130 /* Determine golem's speed */ 2117 /* Determine golem's speed */
2131 tmp->set_speed (min (3.33, 0.4 + 0.1 * SP_level_range_adjust (caster, spell))); 2118 tmp->set_speed (min (3.33f, 0.4f + 0.1f * SP_level_range_adjust (caster, spell)));
2132 2119
2133 if (!spell->race) 2120 if (!spell->race)
2134 { 2121 {
2135 sprintf (buf, "animated %s", &weapon->name); 2122 sprintf (buf, "animated %s", &weapon->name);
2136 tmp->name = buf; 2123 tmp->name = buf;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines