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.128 by root, Wed Apr 14 21:36:32 2010 UTC vs.
Revision 1.131 by root, Fri Apr 23 04:32:47 2010 UTC

461 461
462void 462void
463execute_word_of_recall (object *op) 463execute_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 */
480int 478int
481cast_word_of_recall (object *op, object *caster, object *spell_ob) 479cast_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 {
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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines