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.21 by root, Tue Dec 19 05:41:22 2006 UTC vs.
Revision 1.25 by root, Sat Dec 23 09:58:23 2006 UTC

302 new_draw_info (NDI_UNIQUE, 0, op, "Something blocks your magic."); 302 new_draw_info (NDI_UNIQUE, 0, op, "Something blocks your magic.");
303 return 0; 303 return 0;
304 } 304 }
305 if (mflags & P_IS_ALIVE) 305 if (mflags & P_IS_ALIVE)
306 { 306 {
307 for (tmp = get_map_ob (m, x, y); tmp != NULL; tmp = tmp->above) 307 for (tmp = GET_MAP_OB (m, x, y); tmp != NULL; tmp = tmp->above)
308 if (QUERY_FLAG (tmp, FLAG_ALIVE) && (tmp->type == PLAYER || QUERY_FLAG (tmp, FLAG_MONSTER))) 308 if (QUERY_FLAG (tmp, FLAG_ALIVE) && (tmp->type == PLAYER || QUERY_FLAG (tmp, FLAG_MONSTER)))
309 { 309 {
310 new_draw_info (NDI_UNIQUE, 0, op, "You detect something."); 310 new_draw_info (NDI_UNIQUE, 0, op, "You detect something.");
311 if (tmp->head != NULL) 311 if (tmp->head != NULL)
312 tmp = tmp->head; 312 tmp = tmp->head;
440 440
441 if (mflags & P_OUT_OF_MAP) 441 if (mflags & P_OUT_OF_MAP)
442 continue; 442 continue;
443 443
444 // earth to dust tears down everything that can be teared down 444 // earth to dust tears down everything that can be teared down
445 for (tmp = get_map_ob (m, sx, sy); tmp != NULL; tmp = next) 445 for (tmp = GET_MAP_OB (m, sx, sy); tmp != NULL; tmp = next)
446 { 446 {
447 next = tmp->above; 447 next = tmp->above;
448 if (QUERY_FLAG (tmp, FLAG_TEAR_DOWN)) 448 if (QUERY_FLAG (tmp, FLAG_TEAR_DOWN))
449 hit_player (tmp, 9998, op, AT_PHYSICAL, 0); 449 hit_player (tmp, 9998, op, AT_PHYSICAL, 0);
450 } 450 }
555 } 555 }
556 return cast_spell (op, caster, dir, newspell, NULL); 556 return cast_spell (op, caster, dir, newspell, NULL);
557 } 557 }
558 return 1; 558 return 1;
559} 559}
560
561 560
562int 561int
563perceive_self (object *op) 562perceive_self (object *op)
564{ 563{
565 char *cp = describe_item (op, op), buf[MAX_BUF]; 564 char *cp = describe_item (op, op), buf[MAX_BUF];
641 char portal_name[1024], portal_message[1024]; 640 char portal_name[1024], portal_message[1024];
642 sint16 exitx, exity; 641 sint16 exitx, exity;
643 maptile *exitmap; 642 maptile *exitmap;
644 int op_level; 643 int op_level;
645 644
646
647 /* Check to see if the map the player is currently on is a per player unique 645 /* Check to see if the map the player is currently on is a per player unique
648 * map. This can be determined in that per player unique maps have the 646 * map. This can be determined in that per player unique maps have the
649 * full pathname listed. 647 * full pathname listed.
650 */ 648 */
651 if (!strncmp (op->map->path, settings.localdir, strlen (settings.localdir)) && settings.create_home_portals != TRUE) 649 if (!strncmp (op->map->path, settings.localdir, strlen (settings.localdir)) && settings.create_home_portals != TRUE)
876 force->destroy (); 874 force->destroy ();
877 875
878 return 1; 876 return 1;
879} 877}
880 878
881
882/* This creates magic walls. Really, it can create most any object, 879/* This creates magic walls. Really, it can create most any object,
883 * within some reason. 880 * within some reason.
884 */ 881 */
885
886int 882int
887magic_wall (object *op, object *caster, int dir, object *spell_ob) 883magic_wall (object *op, object *caster, int dir, object *spell_ob)
888{ 884{
889 object *tmp, *tmp2; 885 object *tmp, *tmp2;
890 int i, posblocked, negblocked, maxrange; 886 int i, posblocked, negblocked, maxrange;
902 else 898 else
903 { 899 {
904 x = op->x + freearr_x[dir]; 900 x = op->x + freearr_x[dir];
905 y = op->y + freearr_y[dir]; 901 y = op->y + freearr_y[dir];
906 } 902 }
903
907 m = op->map; 904 m = op->map;
908 905
909 if ((spell_ob->move_block || x != op->x || y != op->y) && 906 if ((spell_ob->move_block || x != op->x || y != op->y) &&
910 (get_map_flags (m, &m, x, y, &x, &y) & (P_OUT_OF_MAP | P_IS_ALIVE) || 907 (get_map_flags (m, &m, x, y, &x, &y) & (P_OUT_OF_MAP | P_IS_ALIVE) ||
911 ((spell_ob->move_block & GET_MAP_MOVE_BLOCK (m, x, y)) == spell_ob->move_block))) 908 ((spell_ob->move_block & GET_MAP_MOVE_BLOCK (m, x, y)) == spell_ob->move_block)))
912 { 909 {
913 new_draw_info (NDI_UNIQUE, 0, op, "Something is in the way."); 910 new_draw_info (NDI_UNIQUE, 0, op, "Something is in the way.");
914 return 0; 911 return 0;
915 } 912 }
913
916 if (spell_ob->other_arch) 914 if (spell_ob->other_arch)
917 {
918 tmp = arch_to_object (spell_ob->other_arch); 915 tmp = arch_to_object (spell_ob->other_arch);
919 }
920 else if (spell_ob->race) 916 else if (spell_ob->race)
921 { 917 {
922 char buf1[MAX_BUF]; 918 char buf1[MAX_BUF];
923 919
924 sprintf (buf1, spell_ob->race, dir); 920 sprintf (buf1, spell_ob->race, dir);
946 } 942 }
947 else if (QUERY_FLAG (tmp, FLAG_ALIVE)) 943 else if (QUERY_FLAG (tmp, FLAG_ALIVE))
948 { 944 {
949 tmp->stats.hp = spell_ob->duration + SP_level_duration_adjust (caster, spell_ob); 945 tmp->stats.hp = spell_ob->duration + SP_level_duration_adjust (caster, spell_ob);
950 tmp->stats.maxhp = tmp->stats.hp; 946 tmp->stats.maxhp = tmp->stats.hp;
951 tmp->set_owner (op);
952 set_spell_skill (op, caster, spell_ob, tmp);
953 } 947 }
948
954 if (QUERY_FLAG (spell_ob, FLAG_IS_USED_UP) || QUERY_FLAG (tmp, FLAG_IS_USED_UP)) 949 if (QUERY_FLAG (spell_ob, FLAG_IS_USED_UP) || QUERY_FLAG (tmp, FLAG_IS_USED_UP))
955 { 950 {
956 tmp->stats.food = spell_ob->duration + SP_level_duration_adjust (caster, spell_ob); 951 tmp->stats.food = spell_ob->duration + SP_level_duration_adjust (caster, spell_ob);
957 SET_FLAG (tmp, FLAG_IS_USED_UP); 952 SET_FLAG (tmp, FLAG_IS_USED_UP);
958 } 953 }
954
959 if (QUERY_FLAG (spell_ob, FLAG_TEAR_DOWN)) 955 if (QUERY_FLAG (spell_ob, FLAG_TEAR_DOWN))
960 { 956 {
961 tmp->stats.hp = spell_ob->stats.dam + SP_level_dam_adjust (caster, spell_ob); 957 tmp->stats.hp = spell_ob->stats.dam + SP_level_dam_adjust (caster, spell_ob);
962 tmp->stats.maxhp = tmp->stats.hp; 958 tmp->stats.maxhp = tmp->stats.hp;
963 SET_FLAG (tmp, FLAG_TEAR_DOWN); 959 SET_FLAG (tmp, FLAG_TEAR_DOWN);
964 SET_FLAG (tmp, FLAG_ALIVE); 960 SET_FLAG (tmp, FLAG_ALIVE);
965 } 961 }
966 962
967 /* This can't really hurt - if the object doesn't kill anything, 963 /* This can't really hurt - if the object doesn't kill anything,
968 * these fields just won't be used. 964 * these fields just won't be used. Do not set the owner for
965 * earthwalls, though, so they survive restarts.
969 */ 966 */
967 if (tmp->type != EARTHWALL) //TODO
970 tmp->set_owner (op); 968 tmp->set_owner (op);
969
971 set_spell_skill (op, caster, spell_ob, tmp); 970 set_spell_skill (op, caster, spell_ob, tmp);
972 tmp->x = x; 971 tmp->x = x;
973 tmp->y = y; 972 tmp->y = y;
974 tmp->level = caster_level (caster, spell_ob) / 2; 973 tmp->level = caster_level (caster, spell_ob) / 2;
975 974
977 if ((tmp = insert_ob_in_map (tmp, m, op, 0)) == NULL) 976 if ((tmp = insert_ob_in_map (tmp, m, op, 0)) == NULL)
978 { 977 {
979 new_draw_info_format (NDI_UNIQUE, 0, op, "Something destroys your %s", name); 978 new_draw_info_format (NDI_UNIQUE, 0, op, "Something destroys your %s", name);
980 return 0; 979 return 0;
981 } 980 }
981
982 /* If this is a spellcasting wall, need to insert the spell object */ 982 /* If this is a spellcasting wall, need to insert the spell object */
983 if (tmp->other_arch && tmp->other_arch->clone.type == SPELL) 983 if (tmp->other_arch && tmp->other_arch->clone.type == SPELL)
984 insert_ob_in_ob (arch_to_object (tmp->other_arch), tmp); 984 insert_ob_in_ob (arch_to_object (tmp->other_arch), tmp);
985 985
986 /* This code causes the wall to extend some distance in 986 /* This code causes the wall to extend some distance in
1432 force->stats.ac = spell_ob->stats.ac; 1432 force->stats.ac = spell_ob->stats.ac;
1433 force->attacktype = spell_ob->attacktype; 1433 force->attacktype = spell_ob->attacktype;
1434 1434
1435 insert_ob_in_ob (force, tmp); 1435 insert_ob_in_ob (force, tmp);
1436 change_abil (tmp, force); /* Mostly to display any messages */ 1436 change_abil (tmp, force); /* Mostly to display any messages */
1437 fix_player (tmp); 1437 tmp->update_stats ();
1438 return 1; 1438 return 1;
1439} 1439}
1440 1440
1441/* This used to be part of cast_change_ability, but it really didn't make 1441/* This used to be part of cast_change_ability, but it really didn't make
1442 * a lot of sense, since most of the values it derives are from the god 1442 * a lot of sense, since most of the values it derives are from the god
1541 force->stats.wc = spell_ob->stats.wc; 1541 force->stats.wc = spell_ob->stats.wc;
1542 force->stats.ac = spell_ob->stats.ac; 1542 force->stats.ac = spell_ob->stats.ac;
1543 1543
1544 change_abil (tmp, force); /* Mostly to display any messages */ 1544 change_abil (tmp, force); /* Mostly to display any messages */
1545 insert_ob_in_ob (force, tmp); 1545 insert_ob_in_ob (force, tmp);
1546 fix_player (tmp); 1546 tmp->update_stats ();
1547 return 1; 1547 return 1;
1548} 1548}
1549 1549
1550 1550
1551 1551
1698 continue; 1698 continue;
1699 1699
1700 small_nuggets = 0; 1700 small_nuggets = 0;
1701 large_nuggets = 0; 1701 large_nuggets = 0;
1702 1702
1703 for (tmp = get_map_ob (mp, nx, ny); tmp != NULL; tmp = next) 1703 for (tmp = GET_MAP_OB (mp, nx, ny); tmp != NULL; tmp = next)
1704 { 1704 {
1705 next = tmp->above; 1705 next = tmp->above;
1706 if (tmp->weight > 0 && !QUERY_FLAG (tmp, FLAG_NO_PICK) && 1706 if (tmp->weight > 0 && !QUERY_FLAG (tmp, FLAG_NO_PICK) &&
1707 !QUERY_FLAG (tmp, FLAG_ALIVE) && !QUERY_FLAG (tmp, FLAG_IS_CAULDRON)) 1707 !QUERY_FLAG (tmp, FLAG_ALIVE) && !QUERY_FLAG (tmp, FLAG_IS_CAULDRON))
1708 { 1708 {
1742 large->destroy (); 1742 large->destroy ();
1743 small->destroy (); 1743 small->destroy ();
1744 /* reset this so that if player standing on a big pile of stuff, 1744 /* reset this so that if player standing on a big pile of stuff,
1745 * it is redrawn properly. 1745 * it is redrawn properly.
1746 */ 1746 */
1747 op->contr->socket->look_position = 0; 1747 op->contr->ns->look_position = 0;
1748 return 1; 1748 return 1;
1749} 1749}
1750 1750
1751 1751
1752/* This function removes the cursed/damned status on equipped 1752/* This function removes the cursed/damned status on equipped
1837 * stuff on the floor. Only identify stuff on the floor if the spell 1837 * stuff on the floor. Only identify stuff on the floor if the spell
1838 * was not fully used. 1838 * was not fully used.
1839 */ 1839 */
1840 if (num_ident) 1840 if (num_ident)
1841 { 1841 {
1842 for (tmp = get_map_ob (op->map, op->x, op->y); tmp != NULL; tmp = tmp->above) 1842 for (tmp = GET_MAP_OB (op->map, op->x, op->y); tmp != NULL; tmp = tmp->above)
1843 if (!QUERY_FLAG (tmp, FLAG_IDENTIFIED) && !tmp->invisible && need_identify (tmp)) 1843 if (!QUERY_FLAG (tmp, FLAG_IDENTIFIED) && !tmp->invisible && need_identify (tmp))
1844 { 1844 {
1845 identify (tmp); 1845 identify (tmp);
1846 1846
1847 if (op->type == PLAYER) 1847 if (op->type == PLAYER)
1902 * floor. But this is not true for show invisible. 1902 * floor. But this is not true for show invisible.
1903 * Basically, we just go and find the top object and work 1903 * Basically, we just go and find the top object and work
1904 * down - that is easier than working up. 1904 * down - that is easier than working up.
1905 */ 1905 */
1906 1906
1907 for (last = NULL, tmp = get_map_ob (m, nx, ny); tmp; tmp = tmp->above) 1907 for (last = NULL, tmp = GET_MAP_OB (m, nx, ny); tmp; tmp = tmp->above)
1908 last = tmp; 1908 last = tmp;
1909 1909
1910 /* Shouldn't happen, but if there are no objects on a space, this 1910 /* Shouldn't happen, but if there are no objects on a space, this
1911 * would happen. 1911 * would happen.
1912 */ 1912 */
2115 2115
2116 mflags = get_map_flags (m, &m, x, y, &x, &y); 2116 mflags = get_map_flags (m, &m, x, y, &x, &y);
2117 2117
2118 if (!(mflags & P_OUT_OF_MAP) && mflags & P_IS_ALIVE) 2118 if (!(mflags & P_OUT_OF_MAP) && mflags & P_IS_ALIVE)
2119 { 2119 {
2120 for (plyr = get_map_ob (m, x, y); plyr != NULL; plyr = plyr->above) 2120 for (plyr = GET_MAP_OB (m, x, y); plyr != NULL; plyr = plyr->above)
2121 if (plyr != op && QUERY_FLAG (plyr, FLAG_ALIVE)) 2121 if (plyr != op && QUERY_FLAG (plyr, FLAG_ALIVE))
2122 break; 2122 break;
2123 } 2123 }
2124 2124
2125 2125
2126 /* If we did not find a player in the specified direction, transfer 2126 /* If we did not find a player in the specified direction, transfer
2127 * to anyone on top of us. This is used for the rune of transference mostly. 2127 * to anyone on top of us. This is used for the rune of transference mostly.
2128 */ 2128 */
2129 if (plyr == NULL) 2129 if (plyr == NULL)
2130 for (plyr = get_map_ob (op->map, op->x, op->y); plyr != NULL; plyr = plyr->above) 2130 for (plyr = GET_MAP_OB (op->map, op->x, op->y); plyr != NULL; plyr = plyr->above)
2131 if (plyr != op && QUERY_FLAG (plyr, FLAG_ALIVE)) 2131 if (plyr != op && QUERY_FLAG (plyr, FLAG_ALIVE))
2132 break; 2132 break;
2133 2133
2134 if (!plyr) 2134 if (!plyr)
2135 { 2135 {
2190 m = op->map; 2190 m = op->map;
2191 mflags = get_map_flags (m, &m, sx, sy, &sx, &sy); 2191 mflags = get_map_flags (m, &m, sx, sy, &sx, &sy);
2192 if (mflags & P_OUT_OF_MAP) 2192 if (mflags & P_OUT_OF_MAP)
2193 return; 2193 return;
2194 2194
2195 for (tmp = get_map_ob (m, sx, sy); tmp != NULL; tmp = next) 2195 for (tmp = GET_MAP_OB (m, sx, sy); tmp != NULL; tmp = next)
2196 { 2196 {
2197 next = tmp->above; 2197 next = tmp->above;
2198 2198
2199 /* Need to look at the head object - otherwise, if tmp 2199 /* Need to look at the head object - otherwise, if tmp
2200 * points to a monster, we don't have all the necessary 2200 * points to a monster, we don't have all the necessary
2398 * so instead, just set it as equipped (otherwise, we need to update 2398 * so instead, just set it as equipped (otherwise, we need to update
2399 * body_info, skills, etc) 2399 * body_info, skills, etc)
2400 */ 2400 */
2401 SET_FLAG (tmp, FLAG_USE_WEAPON); 2401 SET_FLAG (tmp, FLAG_USE_WEAPON);
2402 SET_FLAG (weapon, FLAG_APPLIED); 2402 SET_FLAG (weapon, FLAG_APPLIED);
2403 fix_player (tmp); 2403 tmp->update_stats ();
2404 2404
2405 /* There used to be 'odd' code that basically seemed to take the absolute 2405 /* There used to be 'odd' code that basically seemed to take the absolute
2406 * value of the weapon->magic an use that. IMO, that doesn't make sense - 2406 * value of the weapon->magic an use that. IMO, that doesn't make sense -
2407 * if you're using a crappy weapon, it shouldn't be as good. 2407 * if you're using a crappy weapon, it shouldn't be as good.
2408 */ 2408 */
2647void 2647void
2648move_peacemaker (object *op) 2648move_peacemaker (object *op)
2649{ 2649{
2650 object *tmp; 2650 object *tmp;
2651 2651
2652 for (tmp = get_map_ob (op->map, op->x, op->y); tmp != NULL; tmp = tmp->above) 2652 for (tmp = GET_MAP_OB (op->map, op->x, op->y); tmp != NULL; tmp = tmp->above)
2653 { 2653 {
2654 int atk_lev, def_lev; 2654 int atk_lev, def_lev;
2655 object *victim = tmp; 2655 object *victim = tmp;
2656 2656
2657 if (tmp->head) 2657 if (tmp->head)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines