… | |
… | |
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 = get_archetype (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 | |
… | |
… | |
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 = get_archetype (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 | |
… | |
… | |
1469 | |
1451 | |
1470 | int num_ident = max (1, spell->stats.dam + SP_level_dam_adjust (caster, spell)); |
1452 | int num_ident = max (1, spell->stats.dam + SP_level_dam_adjust (caster, spell)); |
1471 | |
1453 | |
1472 | for (tmp = op->inv; tmp; tmp = tmp->below) |
1454 | for (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 | { |
… | |
… | |
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 (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 | { |
… | |
… | |
1581 | || tmp->type == TELEPORTER |
1563 | || tmp->type == TELEPORTER |
1582 | || tmp->type == GATE |
1564 | || tmp->type == GATE |
1583 | || tmp->type == LOCKED_DOOR |
1565 | || tmp->type == LOCKED_DOOR |
1584 | || tmp->type == WEAPON |
1566 | || tmp->type == WEAPON |
1585 | || tmp->type == ALTAR |
1567 | || tmp->type == ALTAR |
1586 | || tmp->type == SIGN |
1568 | || (tmp->type == SIGN && tmp->face != magicmouth_face) |
1587 | || tmp->type == TRIGGER_PEDESTAL |
1569 | || tmp->type == TRIGGER_PEDESTAL |
1588 | || tmp->type == SPECIAL_KEY |
1570 | || tmp->type == SPECIAL_KEY |
1589 | || tmp->type == TREASURE |
1571 | || tmp->type == TREASURE |
1590 | || tmp->type == BOOK |
1572 | || tmp->type == BOOK |
1591 | || tmp->type == HOLY_ALTAR |
1573 | || tmp->type == HOLY_ALTAR |
1592 | || tmp->type == CONTAINER))) |
1574 | || tmp->type == CONTAINER))) |
1593 | { |
1575 | { |
|
|
1576 | printf ("show inv %s\n", tmp->debug_desc());//D |
1594 | if (random_roll (0, skill->level - 1, op, PREFER_HIGH) > level / 4) |
1577 | if (random_roll (0, skill->level - 1, op, PREFER_HIGH) > level / 4) |
1595 | { |
1578 | { |
1596 | tmp->invisible = 0; |
1579 | tmp->invisible = 0; |
1597 | done_one = 1; |
1580 | done_one = 1; |
1598 | } |
1581 | } |
… | |
… | |
1615 | * difficult to see what object is magical/cursed, so the |
1598 | * difficult to see what object is magical/cursed, so the |
1616 | * effect wouldn't be as apparent. |
1599 | * effect wouldn't be as apparent. |
1617 | */ |
1600 | */ |
1618 | |
1601 | |
1619 | /* detect magic */ |
1602 | /* detect magic */ |
1620 | if (spell->flag [FLAG_KNOWN_MAGICAL] && |
1603 | if (spell->flag [FLAG_KNOWN_MAGICAL] |
1621 | !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)) |
1622 | { |
1608 | { |
1623 | tmp->set_flag (FLAG_KNOWN_MAGICAL); |
1609 | tmp->set_flag (FLAG_KNOWN_MAGICAL); |
1624 | /* make runes more visible */ |
1610 | /* make runes more visible */ |
1625 | if (tmp->type == RUNE && tmp->attacktype & AT_MAGIC) |
1611 | if (tmp->type == RUNE && tmp->attacktype & AT_MAGIC) |
1626 | tmp->stats.Cha /= 4; |
1612 | tmp->stats.Cha /= 4; |
… | |
… | |
1649 | |
1635 | |
1650 | if (!detect) |
1636 | if (!detect) |
1651 | detect = tmp; |
1637 | detect = tmp; |
1652 | } |
1638 | } |
1653 | |
1639 | |
1654 | 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 () |
1655 | (tmp->flag [FLAG_CURSED] || tmp->flag [FLAG_DAMNED])) |
1643 | && (tmp->flag [FLAG_CURSED] || tmp->flag [FLAG_DAMNED])) |
1656 | { |
1644 | { |
1657 | tmp->set_flag (FLAG_KNOWN_CURSED); |
1645 | tmp->set_flag (FLAG_KNOWN_CURSED); |
1658 | done_one = 1; |
1646 | done_one = 1; |
1659 | } |
1647 | } |
1660 | |
1648 | |
… | |
… | |
1977 | * player checks. MSW 2003-01-06 |
1965 | * player checks. MSW 2003-01-06 |
1978 | */ |
1966 | */ |
1979 | int |
1967 | int |
1980 | animate_weapon (object *op, object *caster, object *spell, int dir) |
1968 | animate_weapon (object *op, object *caster, object *spell, int dir) |
1981 | { |
1969 | { |
1982 | object *weapon, *tmp; |
|
|
1983 | char buf[MAX_BUF]; |
1970 | char buf[MAX_BUF]; |
1984 | int a, i; |
1971 | int a, i; |
1985 | sint16 x, y; |
1972 | sint16 x, y; |
1986 | maptile *m; |
1973 | maptile *m; |
1987 | |
1974 | |
… | |
… | |
2017 | op->failmsg ("There is something in the way."); |
2004 | op->failmsg ("There is something in the way."); |
2018 | return 0; |
2005 | return 0; |
2019 | } |
2006 | } |
2020 | |
2007 | |
2021 | /* Use the weapon marked by the player. */ |
2008 | /* Use the weapon marked by the player. */ |
2022 | weapon = find_marked_object (op); |
2009 | object *weapon = op->mark (); |
2023 | |
2010 | |
2024 | if (!weapon) |
2011 | if (!weapon) |
2025 | { |
2012 | { |
2026 | 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!"); |
2027 | return 0; |
2014 | return 0; |
… | |
… | |
2046 | } |
2033 | } |
2047 | |
2034 | |
2048 | weapon = weapon->split (); |
2035 | weapon = weapon->split (); |
2049 | |
2036 | |
2050 | /* create the golem object */ |
2037 | /* create the golem object */ |
2051 | tmp = spell->other_arch->instance (); |
2038 | object *tmp = spell->other_arch->instance (); |
2052 | |
2039 | |
2053 | /* 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 */ |
2054 | tmp->clr_flag (FLAG_MONSTER); |
2041 | tmp->clr_flag (FLAG_MONSTER); |
2055 | tmp->stats.exp = 0; |
2042 | tmp->stats.exp = 0; |
2056 | add_friendly_object (tmp); |
2043 | add_friendly_object (tmp); |