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 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 |
… | |
… | |
58 | } |
58 | } |
59 | |
59 | |
60 | int |
60 | int |
61 | recharge (object *op, object *caster, object *spell_ob) |
61 | recharge (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 | |
… | |
… | |
389 | |
389 | |
390 | /* Remove the switch with 90% duplicate code - just handle the differences with |
390 | /* Remove the switch with 90% duplicate code - just handle the differences with |
391 | * and if statement or two. |
391 | * and if statement or two. |
392 | */ |
392 | */ |
393 | op->invisible += spell_ob->duration + SP_level_duration_adjust (caster, spell_ob); |
393 | op->invisible += spell_ob->duration + SP_level_duration_adjust (caster, spell_ob); |
|
|
394 | |
394 | /* max duration */ |
395 | /* limit duration */ |
395 | if (op->invisible > 1000) |
396 | min_it (op->invisible, 1000); |
396 | op->invisible = 1000; |
|
|
397 | |
397 | |
398 | if (op->type == PLAYER) |
398 | if (op->type == PLAYER) |
399 | { |
399 | { |
400 | op->contr->invis_race = spell_ob->race; |
400 | op->contr->invis_race = spell_ob->race; |
401 | |
401 | |
… | |
… | |
461 | |
461 | |
462 | void |
462 | void |
463 | execute_word_of_recall (object *op) |
463 | execute_word_of_recall (object *op) |
464 | { |
464 | { |
465 | if (object *pl = op->in_player ()) |
465 | if (object *pl = op->in_player ()) |
466 | { |
|
|
467 | if (pl->ms ().flags () & P_NO_CLERIC && !pl->flag [FLAG_WIZCAST]) |
466 | 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."); |
467 | new_draw_info (NDI_UNIQUE, 0, pl, "You feel something fizzle inside you."); |
469 | else |
468 | else |
470 | pl->player_goto (op->slaying, op->stats.hp, op->stats.sp); |
469 | pl->player_goto (op->slaying, op->stats.hp, op->stats.sp); |
471 | } |
|
|
472 | |
470 | |
473 | op->destroy (); |
471 | op->destroy (); |
474 | } |
472 | } |
475 | |
473 | |
476 | /* Word of recall causes the player to return 'home'. |
474 | /* Word of recall causes the player to return 'home'. |
… | |
… | |
478 | * time delay effect. |
476 | * time delay effect. |
479 | */ |
477 | */ |
480 | int |
478 | int |
481 | cast_word_of_recall (object *op, object *caster, object *spell_ob) |
479 | cast_word_of_recall (object *op, object *caster, object *spell_ob) |
482 | { |
480 | { |
483 | object *dummy; |
481 | if (!op->is_player ()) |
484 | int time; |
|
|
485 | |
|
|
486 | if (op->type != PLAYER) |
|
|
487 | return 0; |
482 | return 0; |
488 | |
483 | |
489 | if (find_obj_by_type_subtype (op, SPELL_EFFECT, SP_WORD_OF_RECALL)) |
484 | if (find_obj_by_type_subtype (op, SPELL_EFFECT, SP_WORD_OF_RECALL)) |
490 | { |
485 | { |
491 | new_draw_info (NDI_UNIQUE, 0, op, "You feel a force starting to build up inside you."); |
486 | new_draw_info (NDI_UNIQUE, 0, op, "You feel a force starting to build up inside you."); |
492 | return 1; |
487 | return 1; |
493 | } |
488 | } |
494 | |
489 | |
495 | dummy = get_archetype (FORCE_NAME); |
490 | object *dummy = archetype::get (FORCE_NAME); |
496 | |
491 | |
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); |
492 | int time = max (1, spell_ob->duration - SP_level_duration_adjust (caster, spell_ob)); |
505 | if (time < 1) |
|
|
506 | time = 1; |
|
|
507 | |
493 | |
508 | /* value of speed really doesn't make much difference, as long as it is |
494 | /* 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 |
495 | * positive. Lower value may be useful so that the problem doesn't |
510 | * do anything really odd if it say a -1000 or something. |
496 | * do anything really odd if it say a -1000 or something. |
511 | */ |
497 | */ |
512 | dummy->set_speed (0.002); |
498 | dummy->set_speed (0.002); |
513 | dummy->speed_left = -dummy->speed * time; |
499 | dummy->speed_left = -dummy->speed * time; |
514 | dummy->type = SPELL_EFFECT; |
500 | dummy->type = SPELL_EFFECT; |
515 | dummy->subtype = SP_WORD_OF_RECALL; |
501 | dummy->subtype = SP_WORD_OF_RECALL; |
516 | |
502 | dummy->slaying = op->contr->savebed_map; |
517 | /* If we could take advantage of enter_player_savebed() here, it would be |
503 | dummy->stats.hp = op->contr->bed_x; |
518 | * nice, but until the map load fails, we can't. |
504 | 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 | |
505 | |
524 | op->insert (dummy); |
506 | op->insert (dummy); |
525 | |
507 | |
526 | new_draw_info (NDI_UNIQUE, 0, op, "You feel a force starting to build up inside you."); |
508 | new_draw_info (NDI_UNIQUE, 0, op, "You feel a force starting to build up inside you."); |
527 | |
509 | |
… | |
… | |
1090 | |
1072 | |
1091 | new_draw_info_format (NDI_UNIQUE, 0, op, |
1073 | 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.>", |
1074 | "You create an aura of magical force. H<The effect will last for about %.10g seconds.>", |
1093 | TICK2TIME (duration)); |
1075 | TICK2TIME (duration)); |
1094 | |
1076 | |
1095 | force = get_archetype (FORCE_NAME); |
1077 | force = archetype::get (FORCE_NAME); |
1096 | force->subtype = FORCE_CHANGE_ABILITY; |
1078 | force->subtype = FORCE_CHANGE_ABILITY; |
1097 | force->duration = duration; |
1079 | force->duration = duration; |
1098 | |
1080 | |
1099 | if (spell_ob->race) |
1081 | if (spell_ob->race) |
1100 | force->name = spell_ob->race; |
1082 | force->name = spell_ob->race; |
… | |
… | |
1107 | force->speed_left = -1.0; |
1089 | force->speed_left = -1.0; |
1108 | force->set_flag (FLAG_APPLIED); |
1090 | force->set_flag (FLAG_APPLIED); |
1109 | |
1091 | |
1110 | /* Now start processing the effects. First, protections */ |
1092 | /* Now start processing the effects. First, protections */ |
1111 | for (i = 0; i < NROFATTACKS; i++) |
1093 | for (i = 0; i < NROFATTACKS; i++) |
1112 | { |
|
|
1113 | if (spell_ob->resist[i]) |
1094 | if (spell_ob->resist[i]) |
1114 | { |
|
|
1115 | force->resist[i] = spell_ob->resist[i] + SP_level_dam_adjust (caster, spell_ob); |
1095 | 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 | |
1096 | |
1121 | if (spell_ob->stats.hp) |
1097 | if (spell_ob->stats.hp) |
1122 | force->stats.hp = spell_ob->stats.hp + SP_level_dam_adjust (caster, spell_ob); |
1098 | force->stats.hp = spell_ob->stats.hp + SP_level_dam_adjust (caster, spell_ob); |
1123 | |
1099 | |
1124 | if (tmp->type == PLAYER) |
1100 | if (tmp->type == PLAYER) |
… | |
… | |
1210 | } |
1186 | } |
1211 | } |
1187 | } |
1212 | |
1188 | |
1213 | if (force == NULL) |
1189 | if (force == NULL) |
1214 | { |
1190 | { |
1215 | force = get_archetype (FORCE_NAME); |
1191 | force = archetype::get (FORCE_NAME); |
1216 | force->subtype = FORCE_CHANGE_ABILITY; |
1192 | force->subtype = FORCE_CHANGE_ABILITY; |
1217 | if (spell_ob->race) |
1193 | if (spell_ob->race) |
1218 | force->name = spell_ob->race; |
1194 | force->name = spell_ob->race; |
1219 | else |
1195 | else |
1220 | force->name = spell_ob->name; |
1196 | force->name = spell_ob->name; |
… | |
… | |
1235 | { |
1211 | { |
1236 | new_draw_info (NDI_UNIQUE, 0, op, "Recasting the spell had no effect."); |
1212 | new_draw_info (NDI_UNIQUE, 0, op, "Recasting the spell had no effect."); |
1237 | } |
1213 | } |
1238 | return 0; |
1214 | return 0; |
1239 | } |
1215 | } |
|
|
1216 | |
1240 | force->duration = spell_ob->duration + SP_level_duration_adjust (caster, spell_ob) * 50; |
1217 | force->duration = spell_ob->duration + SP_level_duration_adjust (caster, spell_ob) * 50; |
1241 | force->speed = 1.0; |
1218 | force->speed = 1.0; |
1242 | force->speed_left = -1.0; |
1219 | force->speed_left = -1.0; |
1243 | force->set_flag (FLAG_APPLIED); |
1220 | force->set_flag (FLAG_APPLIED); |
1244 | |
1221 | |
… | |
… | |
1392 | } |
1369 | } |
1393 | |
1370 | |
1394 | value -= rndm (value >> 4); |
1371 | value -= rndm (value >> 4); |
1395 | value = min (value, value_max); |
1372 | value = min (value, value_max); |
1396 | |
1373 | |
1397 | for (int i = 0; i < sizeof (nugget) / sizeof (nugget [0]); ++i) |
1374 | for (int i = 0; i < array_length (nugget); ++i) |
1398 | if (int nrof = value / nugget [i]->value) |
1375 | if (int nrof = value / nugget [i]->value) |
1399 | { |
1376 | { |
1400 | value -= nrof * nugget[i]->value; |
1377 | value -= nrof * nugget[i]->value; |
1401 | |
1378 | |
1402 | object *tmp = nugget[i]->instance (); |
1379 | object *tmp = nugget[i]->instance (); |
… | |
… | |
1420 | int |
1397 | int |
1421 | remove_curse (object *op, object *caster, object *spell) |
1398 | remove_curse (object *op, object *caster, object *spell) |
1422 | { |
1399 | { |
1423 | int success = 0, was_one = 0; |
1400 | int success = 0, was_one = 0; |
1424 | |
1401 | |
|
|
1402 | int num_uncurse = max (1, spell->stats.dam + SP_level_dam_adjust (caster, spell)); |
|
|
1403 | |
|
|
1404 | op->splay_marked (); |
|
|
1405 | |
|
|
1406 | int typeflag = spell->last_sp ? FLAG_DAMNED : FLAG_CURSED; |
|
|
1407 | |
1425 | for (object *tmp = op->inv; tmp; tmp = tmp->below) |
1408 | for (object *tmp = op->inv; tmp && num_uncurse; tmp = tmp->below) |
1426 | if (tmp->flag [FLAG_APPLIED] && |
1409 | 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 | { |
1410 | { |
1430 | was_one++; |
1411 | ++was_one; |
1431 | |
1412 | |
1432 | if (tmp->level <= casting_level (caster, spell)) |
1413 | if (tmp->level <= casting_level (caster, spell)) |
1433 | { |
1414 | { |
1434 | success++; |
1415 | ++success; |
1435 | if (spell->flag [FLAG_DAMNED]) |
1416 | --num_uncurse; |
1436 | tmp->clr_flag (FLAG_DAMNED); |
|
|
1437 | |
1417 | |
|
|
1418 | tmp->clr_flag (typeflag); |
1438 | tmp->clr_flag (FLAG_CURSED); |
1419 | tmp->clr_flag (FLAG_CURSED); |
1439 | tmp->clr_flag (FLAG_KNOWN_CURSED); |
1420 | tmp->clr_flag (FLAG_KNOWN_CURSED); |
1440 | tmp->value = 0; /* Still can't sell it */ |
1421 | tmp->value = 0; /* Still can't sell it */ |
1441 | |
1422 | |
1442 | if (object *pl = tmp->visible_to ()) |
1423 | if (object *pl = tmp->visible_to ()) |
… | |
… | |
1445 | } |
1426 | } |
1446 | |
1427 | |
1447 | if (op->type == PLAYER) |
1428 | if (op->type == PLAYER) |
1448 | { |
1429 | { |
1449 | if (success) |
1430 | if (success) |
1450 | new_draw_info (NDI_UNIQUE, 0, op, "You feel like some of your items are looser now."); |
1431 | 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 |
1432 | else |
1452 | { |
1433 | { |
1453 | if (was_one) |
1434 | if (was_one) |
1454 | new_draw_info (NDI_UNIQUE, 0, op, "You failed to remove the curse."); |
1435 | new_draw_info (NDI_UNIQUE, 0, op, "You failed to remove any curse. H<The spell was not strong enough.>"); |
1455 | else |
1436 | else |
1456 | new_draw_info (NDI_UNIQUE, 0, op, "You are not using any cursed items."); |
1437 | new_draw_info (NDI_UNIQUE, 0, op, "You are not having any cursed items. H<Epic fail.>"); |
1457 | } |
1438 | } |
1458 | } |
1439 | } |
1459 | |
1440 | |
1460 | return success; |
1441 | return success; |
1461 | } |
1442 | } |
1462 | |
1443 | |
1463 | /* Identifies objects in the players inventory/on the ground */ |
1444 | /* Identifies objects in the players inventory/on the ground */ |
1464 | int |
1445 | int |
1465 | cast_identify (object *op, object *caster, object *spell) |
1446 | cast_identify (object *op, object *caster, object *spell) |
1466 | { |
1447 | { |
1467 | object *tmp; |
|
|
1468 | dynbuf_text &buf = msg_dynbuf; buf.clear (); |
1448 | dynbuf_text &buf = msg_dynbuf; buf.clear (); |
1469 | |
1449 | |
1470 | int num_ident = max (1, spell->stats.dam + SP_level_dam_adjust (caster, spell)); |
1450 | int num_ident = max (1, spell->stats.dam + SP_level_dam_adjust (caster, spell)); |
1471 | |
1451 | |
|
|
1452 | op->splay_marked (); |
|
|
1453 | |
1472 | for (tmp = op->inv; tmp; tmp = tmp->below) |
1454 | for (object *tmp = op->inv; tmp; tmp = tmp->below) |
1473 | { |
1455 | { |
1474 | if (!tmp->flag [FLAG_IDENTIFIED] && !tmp->invisible && need_identify (tmp)) |
1456 | if (!tmp->flag [FLAG_IDENTIFIED] && !tmp->invisible && tmp->need_identify ()) |
1475 | { |
1457 | { |
1476 | identify (tmp); |
1458 | identify (tmp); |
1477 | |
1459 | |
1478 | if (op->type == PLAYER) |
1460 | if (op->type == PLAYER) |
1479 | { |
1461 | { |
… | |
… | |
1492 | * stuff on the floor. Only identify stuff on the floor if the spell |
1474 | * stuff on the floor. Only identify stuff on the floor if the spell |
1493 | * was not fully used. |
1475 | * was not fully used. |
1494 | */ |
1476 | */ |
1495 | if (num_ident) |
1477 | if (num_ident) |
1496 | { |
1478 | { |
1497 | for (tmp = GET_MAP_OB (op->map, op->x, op->y); tmp; tmp = tmp->above) |
1479 | 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)) |
1480 | if (!tmp->flag [FLAG_IDENTIFIED] && !tmp->invisible && tmp->need_identify ()) |
1499 | { |
1481 | { |
1500 | identify (tmp); |
1482 | identify (tmp); |
1501 | |
1483 | |
1502 | if (object *pl = tmp->visible_to ()) |
1484 | if (object *pl = tmp->visible_to ()) |
1503 | { |
1485 | { |
… | |
… | |
1616 | * difficult to see what object is magical/cursed, so the |
1598 | * difficult to see what object is magical/cursed, so the |
1617 | * effect wouldn't be as apparent. |
1599 | * effect wouldn't be as apparent. |
1618 | */ |
1600 | */ |
1619 | |
1601 | |
1620 | /* detect magic */ |
1602 | /* detect magic */ |
1621 | if (spell->flag [FLAG_KNOWN_MAGICAL] && |
1603 | if (spell->flag [FLAG_KNOWN_MAGICAL] |
1622 | !tmp->flag [FLAG_KNOWN_MAGICAL] && !tmp->flag [FLAG_IDENTIFIED] && is_magical (tmp)) |
1604 | && !tmp->flag [FLAG_KNOWN_MAGICAL] |
|
|
1605 | && !tmp->flag [FLAG_IDENTIFIED] |
|
|
1606 | && tmp->need_identify () |
|
|
1607 | && is_magical (tmp)) |
1623 | { |
1608 | { |
1624 | tmp->set_flag (FLAG_KNOWN_MAGICAL); |
1609 | tmp->set_flag (FLAG_KNOWN_MAGICAL); |
1625 | /* make runes more visible */ |
1610 | /* make runes more visible */ |
1626 | if (tmp->type == RUNE && tmp->attacktype & AT_MAGIC) |
1611 | if (tmp->type == RUNE && tmp->attacktype & AT_MAGIC) |
1627 | tmp->stats.Cha /= 4; |
1612 | tmp->stats.Cha /= 4; |
… | |
… | |
1650 | |
1635 | |
1651 | if (!detect) |
1636 | if (!detect) |
1652 | detect = tmp; |
1637 | detect = tmp; |
1653 | } |
1638 | } |
1654 | |
1639 | |
1655 | if (spell->flag [FLAG_KNOWN_CURSED] && !tmp->flag [FLAG_KNOWN_CURSED] && |
1640 | if (spell->flag [FLAG_KNOWN_CURSED] |
|
|
1641 | && !tmp->flag [FLAG_KNOWN_CURSED] |
|
|
1642 | && tmp->need_identify () |
1656 | (tmp->flag [FLAG_CURSED] || tmp->flag [FLAG_DAMNED])) |
1643 | && (tmp->flag [FLAG_CURSED] || tmp->flag [FLAG_DAMNED])) |
1657 | { |
1644 | { |
1658 | tmp->set_flag (FLAG_KNOWN_CURSED); |
1645 | tmp->set_flag (FLAG_KNOWN_CURSED); |
1659 | done_one = 1; |
1646 | done_one = 1; |
1660 | } |
1647 | } |
1661 | |
1648 | |
… | |
… | |
1978 | * player checks. MSW 2003-01-06 |
1965 | * player checks. MSW 2003-01-06 |
1979 | */ |
1966 | */ |
1980 | int |
1967 | int |
1981 | animate_weapon (object *op, object *caster, object *spell, int dir) |
1968 | animate_weapon (object *op, object *caster, object *spell, int dir) |
1982 | { |
1969 | { |
1983 | object *weapon, *tmp; |
|
|
1984 | char buf[MAX_BUF]; |
1970 | char buf[MAX_BUF]; |
1985 | int a, i; |
1971 | int a, i; |
1986 | sint16 x, y; |
1972 | sint16 x, y; |
1987 | maptile *m; |
1973 | maptile *m; |
1988 | |
1974 | |
… | |
… | |
2018 | op->failmsg ("There is something in the way."); |
2004 | op->failmsg ("There is something in the way."); |
2019 | return 0; |
2005 | return 0; |
2020 | } |
2006 | } |
2021 | |
2007 | |
2022 | /* Use the weapon marked by the player. */ |
2008 | /* Use the weapon marked by the player. */ |
2023 | weapon = find_marked_object (op); |
2009 | object *weapon = op->mark (); |
2024 | |
2010 | |
2025 | if (!weapon) |
2011 | if (!weapon) |
2026 | { |
2012 | { |
2027 | op->failmsg ("You must mark a weapon to use with this spell!"); |
2013 | op->failmsg ("You must mark a weapon to use with this spell!"); |
2028 | return 0; |
2014 | return 0; |
… | |
… | |
2047 | } |
2033 | } |
2048 | |
2034 | |
2049 | weapon = weapon->split (); |
2035 | weapon = weapon->split (); |
2050 | |
2036 | |
2051 | /* create the golem object */ |
2037 | /* create the golem object */ |
2052 | tmp = spell->other_arch->instance (); |
2038 | object *tmp = spell->other_arch->instance (); |
2053 | |
2039 | |
2054 | /* if animated by a player, give the player control of the golem */ |
2040 | /* if animated by a player, give the player control of the golem */ |
2055 | tmp->clr_flag (FLAG_MONSTER); |
2041 | tmp->clr_flag (FLAG_MONSTER); |
2056 | tmp->stats.exp = 0; |
2042 | tmp->stats.exp = 0; |
2057 | add_friendly_object (tmp); |
2043 | add_friendly_object (tmp); |
… | |
… | |
2123 | /* Improve weapon's armour value according to best save vs. physical of its material */ |
2109 | /* Improve weapon's armour value according to best save vs. physical of its material */ |
2124 | |
2110 | |
2125 | if (a > 14) |
2111 | if (a > 14) |
2126 | a = 14; |
2112 | a = 14; |
2127 | |
2113 | |
2128 | tmp->resist[ATNR_PHYSICAL] = 100 - (int) ((100.0 - (float) tmp->resist[ATNR_PHYSICAL]) / (30.0 - 2.0 * a)); |
2114 | tmp->resist[ATNR_PHYSICAL] = 100 - (int) ((100.f - (float) tmp->resist[ATNR_PHYSICAL]) / (30.f - 2.f * a)); |
2129 | |
2115 | |
2130 | /* Determine golem's speed */ |
2116 | /* Determine golem's speed */ |
2131 | tmp->set_speed (min (3.33, 0.4 + 0.1 * SP_level_range_adjust (caster, spell))); |
2117 | tmp->set_speed (min (3.33f, 0.4f + 0.1f * SP_level_range_adjust (caster, spell))); |
2132 | |
2118 | |
2133 | if (!spell->race) |
2119 | if (!spell->race) |
2134 | { |
2120 | { |
2135 | sprintf (buf, "animated %s", &weapon->name); |
2121 | sprintf (buf, "animated %s", &weapon->name); |
2136 | tmp->name = buf; |
2122 | tmp->name = buf; |