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.79 by root, Mon Apr 21 07:01:40 2008 UTC vs.
Revision 1.80 by root, Tue Apr 22 07:01:47 2008 UTC

70 } 70 }
71 if (!(random_roll (0, 3, op, PREFER_HIGH))) 71 if (!(random_roll (0, 3, op, PREFER_HIGH)))
72 { 72 {
73 new_draw_info_format (NDI_UNIQUE, 0, op, "The %s vibrates violently, then explodes!", query_name (wand)); 73 new_draw_info_format (NDI_UNIQUE, 0, op, "The %s vibrates violently, then explodes!", query_name (wand));
74 op->play_sound (sound_find ("ob_explode")); 74 op->play_sound (sound_find ("ob_explode"));
75 esrv_del_item (op->contr, wand->count);
76 wand->destroy (); 75 wand->destroy ();
77 tmp = get_archetype ("fireball"); 76 tmp = get_archetype ("fireball");
78 tmp->stats.dam = (spell_ob->stats.dam + SP_level_dam_adjust (caster, spell_ob)) / 10; 77 tmp->stats.dam = (spell_ob->stats.dam + SP_level_dam_adjust (caster, spell_ob)) / 10;
79 78
80 if (!tmp->stats.dam) 79 if (!tmp->stats.dam)
1411 1410
1412bailout: 1411bailout:
1413 return 1; 1412 return 1;
1414} 1413}
1415 1414
1416
1417/* This function removes the cursed/damned status on equipped 1415/* This function removes the cursed/damned status on equipped
1418 * items. 1416 * items.
1419 */ 1417 */
1420int 1418int
1421remove_curse (object *op, object *caster, object *spell) 1419remove_curse (object *op, object *caster, object *spell)
1427 if (QUERY_FLAG (tmp, FLAG_APPLIED) && 1425 if (QUERY_FLAG (tmp, FLAG_APPLIED) &&
1428 ((QUERY_FLAG (tmp, FLAG_CURSED) && QUERY_FLAG (spell, FLAG_CURSED)) || 1426 ((QUERY_FLAG (tmp, FLAG_CURSED) && QUERY_FLAG (spell, FLAG_CURSED)) ||
1429 (QUERY_FLAG (tmp, FLAG_DAMNED) && QUERY_FLAG (spell, FLAG_DAMNED)))) 1427 (QUERY_FLAG (tmp, FLAG_DAMNED) && QUERY_FLAG (spell, FLAG_DAMNED))))
1430 { 1428 {
1431 was_one++; 1429 was_one++;
1430
1432 if (tmp->level <= caster_level (caster, spell)) 1431 if (tmp->level <= caster_level (caster, spell))
1433 { 1432 {
1434 success++; 1433 success++;
1435 if (QUERY_FLAG (spell, FLAG_DAMNED)) 1434 if (QUERY_FLAG (spell, FLAG_DAMNED))
1436 CLEAR_FLAG (tmp, FLAG_DAMNED); 1435 CLEAR_FLAG (tmp, FLAG_DAMNED);
1437 1436
1438 CLEAR_FLAG (tmp, FLAG_CURSED); 1437 CLEAR_FLAG (tmp, FLAG_CURSED);
1439 CLEAR_FLAG (tmp, FLAG_KNOWN_CURSED); 1438 CLEAR_FLAG (tmp, FLAG_KNOWN_CURSED);
1440 tmp->value = 0; /* Still can't sell it */ 1439 tmp->value = 0; /* Still can't sell it */
1441 if (op->type == PLAYER) 1440
1441 if (object *pl = tmp->visible_to ())
1442 esrv_send_item (op, tmp); 1442 esrv_update_item (UPD_FLAGS, pl, tmp);
1443 } 1443 }
1444 } 1444 }
1445 1445
1446 if (op->type == PLAYER) 1446 if (op->type == PLAYER)
1447 { 1447 {
1500 for (tmp = GET_MAP_OB (op->map, op->x, op->y); tmp; tmp = tmp->above) 1500 for (tmp = GET_MAP_OB (op->map, op->x, op->y); tmp; tmp = tmp->above)
1501 if (!QUERY_FLAG (tmp, FLAG_IDENTIFIED) && !tmp->invisible && need_identify (tmp)) 1501 if (!QUERY_FLAG (tmp, FLAG_IDENTIFIED) && !tmp->invisible && need_identify (tmp))
1502 { 1502 {
1503 identify (tmp); 1503 identify (tmp);
1504 1504
1505 if (op->type == PLAYER) 1505 if (object *pl = tmp->visible_to ())
1506 { 1506 {
1507 buf.printf ("On the ground you identified: %s.\n\n", long_desc (tmp, op)); 1507 buf.printf ("On the ground you identified: %s.\n\n", long_desc (tmp, op));
1508 1508
1509 if (tmp->msg) 1509 if (tmp->msg)
1510 buf << "The item has a story:\n\n" << tmp->msg << "\n\n"; 1510 buf << "The item has a story:\n\n" << tmp->msg << "\n\n";
1511
1512 esrv_send_item (op, tmp);
1513 } 1511 }
1514 1512
1515 num_ident--; 1513 num_ident--;
1516 if (!num_ident) 1514 if (!num_ident)
1517 break; 1515 break;
1680 1678
1681 /* Now process objects in the players inventory if detect curse or magic */ 1679 /* Now process objects in the players inventory if detect curse or magic */
1682 if (QUERY_FLAG (spell, FLAG_KNOWN_CURSED) || QUERY_FLAG (spell, FLAG_KNOWN_MAGICAL)) 1680 if (QUERY_FLAG (spell, FLAG_KNOWN_CURSED) || QUERY_FLAG (spell, FLAG_KNOWN_MAGICAL))
1683 { 1681 {
1684 done_one = 0; 1682 done_one = 0;
1683
1685 for (tmp = op->inv; tmp; tmp = tmp->below) 1684 for (tmp = op->inv; tmp; tmp = tmp->below)
1686 { 1685 {
1687 if (!tmp->invisible && !QUERY_FLAG (tmp, FLAG_IDENTIFIED)) 1686 if (!tmp->invisible && !QUERY_FLAG (tmp, FLAG_IDENTIFIED))
1688 { 1687 {
1689 if (QUERY_FLAG (spell, FLAG_KNOWN_MAGICAL) && is_magical (tmp) && !QUERY_FLAG (tmp, FLAG_KNOWN_MAGICAL)) 1688 if (QUERY_FLAG (spell, FLAG_KNOWN_MAGICAL) && is_magical (tmp) && !QUERY_FLAG (tmp, FLAG_KNOWN_MAGICAL))
1690 { 1689 {
1691 SET_FLAG (tmp, FLAG_KNOWN_MAGICAL); 1690 SET_FLAG (tmp, FLAG_KNOWN_MAGICAL);
1692 if (op->type == PLAYER) 1691
1692 if (object *pl = tmp->visible_to ())
1693 esrv_send_item (op, tmp); 1693 esrv_update_item (UPD_FLAGS, pl, tmp);
1694 } 1694 }
1695
1695 if (QUERY_FLAG (spell, FLAG_KNOWN_CURSED) && !QUERY_FLAG (tmp, FLAG_KNOWN_CURSED) && 1696 if (QUERY_FLAG (spell, FLAG_KNOWN_CURSED) && !QUERY_FLAG (tmp, FLAG_KNOWN_CURSED) &&
1696 (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED))) 1697 (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED)))
1697 { 1698 {
1698 SET_FLAG (tmp, FLAG_KNOWN_CURSED); 1699 SET_FLAG (tmp, FLAG_KNOWN_CURSED);
1699 if (op->type == PLAYER) 1700
1701 if (object *pl = tmp->visible_to ())
1700 esrv_send_item (op, tmp); 1702 esrv_update_item (UPD_FLAGS, pl, tmp);
1701 } 1703 }
1702 } /* if item is not identified */ 1704 } /* if item is not identified */
1703 } /* for the players inventory */ 1705 } /* for the players inventory */
1704 } /* if detect magic/curse and object is a player */ 1706 } /* if detect magic/curse and object is a player */
1707
1705 return 1; 1708 return 1;
1706} 1709}
1707 1710
1708 1711
1709/** 1712/**
1899 break; 1902 break;
1900 } 1903 }
1901 } 1904 }
1902} 1905}
1903 1906
1904
1905
1906/* cast_consecrate() - a spell to make an altar your god's */ 1907/* cast_consecrate() - a spell to make an altar your god's */
1907int 1908int
1908cast_consecrate (object *op, object *caster, object *spell) 1909cast_consecrate (object *op, object *caster, object *spell)
1909{ 1910{
1910 char buf[MAX_BUF]; 1911 char buf[MAX_BUF];
1934 /* If we got here, we are consecrating an altar */ 1935 /* If we got here, we are consecrating an altar */
1935 sprintf (buf, "Altar of %s", &god->name); 1936 sprintf (buf, "Altar of %s", &god->name);
1936 tmp->name = buf; 1937 tmp->name = buf;
1937 tmp->level = caster_level (caster, spell); 1938 tmp->level = caster_level (caster, spell);
1938 tmp->other_arch = god->arch; 1939 tmp->other_arch = god->arch;
1940
1939 if (op->type == PLAYER) 1941 if (op->type == PLAYER)
1940 esrv_update_item (UPD_NAME, op, tmp); 1942 esrv_update_item (UPD_NAME, op, tmp);
1943
1941 new_draw_info_format (NDI_UNIQUE, 0, op, "You consecrated the altar to %s!", &god->name); 1944 new_draw_info_format (NDI_UNIQUE, 0, op, "You consecrated the altar to %s!", &god->name);
1942 return 1; 1945 return 1;
1943 } 1946 }
1944 } 1947 }
1945 } 1948 }
2021 { 2024 {
2022 new_draw_info_format (NDI_BLACK, 0, op, "You need to unequip %s before using it in this spell", query_name (weapon)); 2025 new_draw_info_format (NDI_BLACK, 0, op, "You need to unequip %s before using it in this spell", query_name (weapon));
2023 return 0; 2026 return 0;
2024 } 2027 }
2025 2028
2026 if (weapon->nrof > 1)
2027 {
2028 tmp = weapon->split (); 2029 weapon = weapon->split ();
2029 esrv_send_item (op, weapon);
2030 weapon = tmp;
2031 }
2032 2030
2033 /* create the golem object */ 2031 /* create the golem object */
2034 tmp = arch_to_object (spell->other_arch); 2032 tmp = arch_to_object (spell->other_arch);
2035 2033
2036 /* if animated by a player, give the player control of the golem */ 2034 /* if animated by a player, give the player control of the golem */
2047 * used above. 2045 * used above.
2048 */ 2046 */
2049 if (!QUERY_FLAG (weapon, FLAG_REMOVED)) 2047 if (!QUERY_FLAG (weapon, FLAG_REMOVED))
2050 weapon->remove (); 2048 weapon->remove ();
2051 2049
2052 insert_ob_in_ob (weapon, tmp); 2050 tmp->insert (weapon);
2053 esrv_send_item (op, weapon); 2051
2054 /* To do everything necessary to let a golem use the weapon is a pain, 2052 /* To do everything necessary to let a golem use the weapon is a pain,
2055 * so instead, just set it as equipped (otherwise, we need to update 2053 * so instead, just set it as equipped (otherwise, we need to update
2056 * body_info, skills, etc) 2054 * body_info, skills, etc)
2057 */ 2055 */
2058 SET_FLAG (tmp, FLAG_USE_WEAPON); 2056 SET_FLAG (tmp, FLAG_USE_WEAPON);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines