… | |
… | |
277 | int mflags; |
277 | int mflags; |
278 | |
278 | |
279 | if (!spob->other_arch) |
279 | if (!spob->other_arch) |
280 | return 0; |
280 | return 0; |
281 | |
281 | |
282 | tmp = arch_to_object (spob->other_arch); |
282 | tmp = spob->other_arch->instance (); |
283 | if (tmp == NULL) |
283 | if (tmp == NULL) |
284 | return 0; |
284 | return 0; |
285 | |
285 | |
286 | /* peterm: level dependency for bolts */ |
286 | /* peterm: level dependency for bolts */ |
287 | tmp->stats.dam = spob->stats.dam + SP_level_dam_adjust (caster, spob); |
287 | tmp->stats.dam = spob->stats.dam + SP_level_dam_adjust (caster, spob); |
… | |
… | |
439 | if (op->destroyed ()) |
439 | if (op->destroyed ()) |
440 | return; |
440 | return; |
441 | } |
441 | } |
442 | |
442 | |
443 | /* other_arch contains what this explodes into */ |
443 | /* other_arch contains what this explodes into */ |
444 | tmp = arch_to_object (op->other_arch); |
444 | tmp = op->other_arch->instance (); |
445 | |
445 | |
446 | tmp->set_owner (op); |
446 | tmp->set_owner (op); |
447 | tmp->skill = op->skill; |
447 | tmp->skill = op->skill; |
448 | |
448 | |
449 | owner = op->owner; |
449 | owner = op->owner; |
… | |
… | |
690 | |
690 | |
691 | /* drops an object based on what is in the cone's "other_arch" */ |
691 | /* drops an object based on what is in the cone's "other_arch" */ |
692 | static void |
692 | static void |
693 | cone_drop (object *op) |
693 | cone_drop (object *op) |
694 | { |
694 | { |
695 | object *new_ob = arch_to_object (op->other_arch); |
695 | object *new_ob = op->other_arch->instance (); |
696 | |
696 | |
697 | new_ob->level = op->level; |
697 | new_ob->level = op->level; |
698 | new_ob->set_owner (op->owner); |
698 | new_ob->set_owner (op->owner); |
699 | |
699 | |
700 | /* preserve skill ownership */ |
700 | /* preserve skill ownership */ |
… | |
… | |
861 | |
861 | |
862 | if ((movetype & GET_MAP_MOVE_BLOCK (m, sx, sy)) == movetype) |
862 | if ((movetype & GET_MAP_MOVE_BLOCK (m, sx, sy)) == movetype) |
863 | continue; |
863 | continue; |
864 | |
864 | |
865 | success = 1; |
865 | success = 1; |
866 | tmp = arch_to_object (spell->other_arch); |
866 | tmp = spell->other_arch->instance (); |
867 | tmp->set_owner (op); |
867 | tmp->set_owner (op); |
868 | set_spell_skill (op, caster, spell, tmp); |
868 | set_spell_skill (op, caster, spell, tmp); |
869 | tmp->level = casting_level (caster, spell); |
869 | tmp->level = casting_level (caster, spell); |
870 | tmp->attacktype = spell->attacktype; |
870 | tmp->attacktype = spell->attacktype; |
871 | |
871 | |
… | |
… | |
973 | for (int i = 1; i < 9; i++) |
973 | for (int i = 1; i < 9; i++) |
974 | { |
974 | { |
975 | if (out_of_map (op->map, op->x + freearr_x[i], op->y + freearr_x[i])) |
975 | if (out_of_map (op->map, op->x + freearr_x[i], op->y + freearr_x[i])) |
976 | continue; |
976 | continue; |
977 | |
977 | |
978 | object *tmp = arch_to_object (at); |
978 | object *tmp = at->instance (); |
979 | tmp->direction = i; |
979 | tmp->direction = i; |
980 | tmp->range = op->range; |
980 | tmp->range = op->range; |
981 | tmp->stats.dam = op->stats.dam; |
981 | tmp->stats.dam = op->stats.dam; |
982 | tmp->duration = op->duration; |
982 | tmp->duration = op->duration; |
983 | tmp->attacktype = op->attacktype; |
983 | tmp->attacktype = op->attacktype; |
… | |
… | |
1017 | new_draw_info (NDI_UNIQUE, 0, op, "There is something in the way."); |
1017 | new_draw_info (NDI_UNIQUE, 0, op, "There is something in the way."); |
1018 | return 0; |
1018 | return 0; |
1019 | } |
1019 | } |
1020 | } |
1020 | } |
1021 | |
1021 | |
1022 | tmp = arch_to_object (spell->other_arch); |
1022 | tmp = spell->other_arch->instance (); |
1023 | |
1023 | |
1024 | /* level dependencies for bomb */ |
1024 | /* level dependencies for bomb */ |
1025 | tmp->range = spell->range + SP_level_range_adjust (caster, spell); |
1025 | tmp->range = spell->range + SP_level_range_adjust (caster, spell); |
1026 | tmp->stats.dam = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
1026 | tmp->stats.dam = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
1027 | tmp->duration = spell->duration + SP_level_duration_adjust (caster, spell); |
1027 | tmp->duration = spell->duration + SP_level_duration_adjust (caster, spell); |
… | |
… | |
1121 | new_draw_info (NDI_UNIQUE, 0, op, "Your request is unheeded."); |
1121 | new_draw_info (NDI_UNIQUE, 0, op, "Your request is unheeded."); |
1122 | return 0; |
1122 | return 0; |
1123 | } |
1123 | } |
1124 | |
1124 | |
1125 | if (spell->other_arch) |
1125 | if (spell->other_arch) |
1126 | effect = arch_to_object (spell->other_arch); |
1126 | effect = spell->other_arch->instance (); |
1127 | else |
1127 | else |
1128 | return 0; |
1128 | return 0; |
1129 | |
1129 | |
1130 | /* tailor the effect by priest level and worshipped God */ |
1130 | /* tailor the effect by priest level and worshipped God */ |
1131 | effect->level = casting_level (caster, spell); |
1131 | effect->level = casting_level (caster, spell); |
… | |
… | |
1292 | unordered_mapwalk (op, -range, -range, range, range) |
1292 | unordered_mapwalk (op, -range, -range, range, range) |
1293 | { |
1293 | { |
1294 | mapspace &ms = m->at (nx, ny); |
1294 | mapspace &ms = m->at (nx, ny); |
1295 | |
1295 | |
1296 | if (ms.flags () & P_IS_ALIVE) |
1296 | if (ms.flags () & P_IS_ALIVE) |
1297 | for (object *tmp = ms.bot; tmp; tmp = tmp->above) |
1297 | for (object *next, *tmp = ms.bot; tmp; tmp = next) |
|
|
1298 | { |
|
|
1299 | next = tmp->above; |
|
|
1300 | |
1298 | if (tmp->flag [FLAG_ALIVE] || tmp->is_player ()) |
1301 | if (tmp->flag [FLAG_ALIVE] || tmp->is_player ()) |
1299 | { |
1302 | { |
1300 | tmp = tmp->head_ (); |
1303 | tmp = tmp->head_ (); |
1301 | |
1304 | |
1302 | if ((friendly && !tmp->flag [FLAG_FRIENDLY] && !tmp->is_player ()) |
1305 | if ((friendly && !tmp->flag [FLAG_FRIENDLY] && !tmp->is_player ()) |
1303 | || (!friendly && (tmp->flag [FLAG_FRIENDLY] || tmp->is_player ()))) |
1306 | || (!friendly && (tmp->flag [FLAG_FRIENDLY] || tmp->is_player ()))) |
1304 | { |
1307 | { |
1305 | if (spell_ob->subtype == SP_DESTRUCTION) |
1308 | if (spell_ob->subtype == SP_DESTRUCTION) |
1306 | { |
1309 | { |
1307 | hit_player (tmp, dam, op, spell_ob->attacktype, 0); |
1310 | hit_player (tmp, dam, op, spell_ob->attacktype, 0); |
1308 | |
1311 | |
1309 | if (spell_ob->other_arch) |
1312 | if (spell_ob->other_arch) |
1310 | m->insert (arch_to_object (spell_ob->other_arch), nx, ny, op); |
1313 | m->insert (spell_ob->other_arch->instance (), nx, ny, op); |
1311 | } |
1314 | } |
1312 | else if (spell_ob->subtype == SP_FAERY_FIRE && tmp->resist [ATNR_MAGIC] != 100) |
1315 | else if (spell_ob->subtype == SP_FAERY_FIRE && tmp->resist [ATNR_MAGIC] != 100) |
1313 | { |
1316 | { |
1314 | if (make_object_glow (tmp, 1, dur) && spell_ob->other_arch) |
1317 | if (make_object_glow (tmp, 1, dur) && spell_ob->other_arch) |
1315 | m->insert (arch_to_object (spell_ob->other_arch), nx, ny, op); |
1318 | m->insert (spell_ob->other_arch->instance (), nx, ny, op); |
1316 | } |
1319 | } |
1317 | } |
1320 | } |
1318 | } |
1321 | } |
|
|
1322 | } |
1319 | } |
1323 | } |
1320 | |
1324 | |
1321 | op->skill = skill; |
1325 | op->skill = skill; |
1322 | return 1; |
1326 | return 1; |
1323 | } |
1327 | } |
… | |
… | |
1325 | /*************************************************************************** |
1329 | /*************************************************************************** |
1326 | * |
1330 | * |
1327 | * CURSE |
1331 | * CURSE |
1328 | * |
1332 | * |
1329 | ***************************************************************************/ |
1333 | ***************************************************************************/ |
1330 | |
|
|
1331 | int |
1334 | int |
1332 | cast_curse (object *op, object *caster, object *spell_ob, int dir) |
1335 | cast_curse (object *op, object *caster, object *spell_ob, int dir) |
1333 | { |
1336 | { |
1334 | object *god = find_god (determine_god (op)); |
1337 | object *god = find_god (determine_god (op)); |
1335 | object *tmp, *force; |
1338 | object *tmp, *force; |
… | |
… | |
1413 | force->stats.wc = spell_ob->stats.wc; |
1416 | force->stats.wc = spell_ob->stats.wc; |
1414 | |
1417 | |
1415 | change_abil (tmp, force); /* Mostly to display any messages */ |
1418 | change_abil (tmp, force); /* Mostly to display any messages */ |
1416 | insert_ob_in_ob (force, tmp); |
1419 | insert_ob_in_ob (force, tmp); |
1417 | tmp->update_stats (); |
1420 | tmp->update_stats (); |
|
|
1421 | |
1418 | return 1; |
1422 | return 1; |
1419 | |
|
|
1420 | } |
1423 | } |
1421 | |
1424 | |
1422 | /********************************************************************** |
1425 | /********************************************************************** |
1423 | * mood change |
1426 | * mood change |
1424 | * Arguably, this may or may not be an attack spell. But since it |
1427 | * Arguably, this may or may not be an attack spell. But since it |
… | |
… | |
1525 | Ryo, august 14th |
1528 | Ryo, august 14th |
1526 | */ |
1529 | */ |
1527 | if (head->level > level) |
1530 | if (head->level > level) |
1528 | continue; |
1531 | continue; |
1529 | |
1532 | |
1530 | if (random_roll (0, 100, caster, PREFER_LOW) >= (20 + MIN (50, 2 * (level - head->level)))) |
1533 | if (random_roll (0, 100, caster, PREFER_LOW) >= (20 + min (50, 2 * (level - head->level)))) |
1531 | /* Failed, no effect */ |
1534 | /* Failed, no effect */ |
1532 | continue; |
1535 | continue; |
1533 | } |
1536 | } |
1534 | |
1537 | |
1535 | /* Done with saving throw. Now start affecting the monster */ |
1538 | /* Done with saving throw. Now start affecting the monster */ |
… | |
… | |
1577 | head->stats.exp = 0; |
1580 | head->stats.exp = 0; |
1578 | } |
1581 | } |
1579 | |
1582 | |
1580 | /* If a monster was effected, put an effect in */ |
1583 | /* If a monster was effected, put an effect in */ |
1581 | if (done_one && spell->other_arch) |
1584 | if (done_one && spell->other_arch) |
1582 | m->insert (arch_to_object (spell->other_arch), nx, ny, op); |
1585 | m->insert (spell->other_arch->instance (), nx, ny, op); |
1583 | } |
1586 | } |
1584 | |
1587 | |
1585 | return 1; |
1588 | return 1; |
1586 | } |
1589 | } |
1587 | |
1590 | |
… | |
… | |
1670 | hit_map (op, j, op->attacktype, 1); |
1673 | hit_map (op, j, op->attacktype, 1); |
1671 | } |
1674 | } |
1672 | |
1675 | |
1673 | /* insert the other arch */ |
1676 | /* insert the other arch */ |
1674 | if (op->other_arch && !(OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, hx, hy)))) |
1677 | if (op->other_arch && !(OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, hx, hy)))) |
1675 | m->insert (arch_to_object (op->other_arch), hx, hy, op); |
1678 | m->insert (op->other_arch->instance (), hx, hy, op); |
1676 | } |
1679 | } |
1677 | |
1680 | |
1678 | /* restore to the center location and damage */ |
1681 | /* restore to the center location and damage */ |
1679 | op->stats.dam = dam_save; |
1682 | op->stats.dam = dam_save; |
1680 | |
1683 | |
… | |
… | |
1896 | return 0; |
1899 | return 0; |
1897 | } |
1900 | } |
1898 | } |
1901 | } |
1899 | |
1902 | |
1900 | /* ok, looks groovy to just insert a new light on the map */ |
1903 | /* ok, looks groovy to just insert a new light on the map */ |
1901 | tmp = arch_to_object (spell->other_arch); |
1904 | tmp = spell->other_arch->instance (); |
1902 | if (!tmp) |
1905 | if (!tmp) |
1903 | { |
1906 | { |
1904 | LOG (llevError, "Error: spell arch for cast_light() missing.\n"); |
1907 | LOG (llevError, "Error: spell arch for cast_light() missing.\n"); |
1905 | return 0; |
1908 | return 0; |
1906 | } |
1909 | } |
… | |
… | |
1972 | { |
1975 | { |
1973 | /* search this square for a victim */ |
1976 | /* search this square for a victim */ |
1974 | for (walk = GET_MAP_OB (m, x, y); walk; walk = walk->above) |
1977 | for (walk = GET_MAP_OB (m, x, y); walk; walk = walk->above) |
1975 | if (QUERY_FLAG (walk, FLAG_MONSTER) || (walk->type == PLAYER)) |
1978 | if (QUERY_FLAG (walk, FLAG_MONSTER) || (walk->type == PLAYER)) |
1976 | { /* found a victim */ |
1979 | { /* found a victim */ |
1977 | object *disease = arch_to_object (spell->other_arch); |
1980 | object *disease = spell->other_arch->instance (); |
1978 | |
1981 | |
1979 | disease->set_owner (op); |
1982 | disease->set_owner (op); |
1980 | set_spell_skill (op, caster, spell, disease); |
1983 | set_spell_skill (op, caster, spell, disease); |
1981 | disease->stats.exp = 0; |
1984 | disease->stats.exp = 0; |
1982 | disease->level = casting_level (caster, spell); |
1985 | disease->level = casting_level (caster, spell); |
… | |
… | |
2032 | if (infect_object (walk, disease, 1)) |
2035 | if (infect_object (walk, disease, 1)) |
2033 | { |
2036 | { |
2034 | new_draw_info_format (NDI_UNIQUE, 0, op, "You inflict %s on %s!", &disease->name, &walk->name); |
2037 | new_draw_info_format (NDI_UNIQUE, 0, op, "You inflict %s on %s!", &disease->name, &walk->name); |
2035 | |
2038 | |
2036 | disease->destroy (); /* don't need this one anymore */ |
2039 | disease->destroy (); /* don't need this one anymore */ |
2037 | walk->map->insert (get_archetype ("detect_magic"), x, y, op); |
2040 | walk->map->insert (get_archetype (shstr_detect_magic), x, y, op); |
2038 | return 1; |
2041 | return 1; |
2039 | } |
2042 | } |
2040 | |
2043 | |
2041 | disease->destroy (); |
2044 | disease->destroy (); |
2042 | } |
2045 | } |