ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/spell_attack.C
(Generate patch)

Comparing deliantra/server/server/spell_attack.C (file contents):
Revision 1.49 by root, Thu Nov 8 19:43:28 2007 UTC vs.
Revision 1.54 by root, Wed Apr 30 10:31:04 2008 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002-2003,2007 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002-2003,2007 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992,2007 Frank Tore Johansen 6 * Copyright (©) 1992,2007 Frank Tore Johansen
7 * 7 *
8 * Deliantra is free software: you can redistribute it and/or modify 8 * Deliantra is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
405 return; 405 return;
406 } 406 }
407 407
408 if (op->env) 408 if (op->env)
409 { 409 {
410 object *env = object_get_env_recursive (op); 410 object *env = op->outer_env ();
411
411 if (env->map == NULL || out_of_map (env->map, env->x, env->y)) 412 if (!env->map || out_of_map (env->map, env->x, env->y))
412 { 413 {
413 LOG (llevError, "BUG: explode_bullet(): env out of map\n"); 414 LOG (llevError, "BUG: explode_bullet(): env out of map\n");
414 op->destroy (); 415 op->destroy ();
415 return; 416 return;
416 } 417 }
937 * op is the original bomb object. 938 * op is the original bomb object.
938 */ 939 */
939void 940void
940animate_bomb (object *op) 941animate_bomb (object *op)
941{ 942{
942 int i;
943 object *env, *tmp;
944
945 if (op->state != NUM_ANIMATIONS (op) - 1) 943 if (op->state != NUM_ANIMATIONS (op) - 1)
946 return; 944 return;
947 945
948 env = object_get_env_recursive (op); 946 object *env = op->outer_env ();
949 947
950 if (op->env) 948 if (op->env)
951 { 949 {
952 if (env->map == NULL) 950 if (env->map == NULL)
953 return; 951 return;
954
955 if (env->type == PLAYER)
956 esrv_del_item (env->contr, op->count);
957 952
958 if (!(op = op->insert_at (env, op))) 953 if (!(op = op->insert_at (env, op)))
959 return; 954 return;
960 } 955 }
961 956
972 * but using the cast_bullet isn't really feasible, 967 * but using the cast_bullet isn't really feasible,
973 * so just set up the appropriate values. 968 * so just set up the appropriate values.
974 */ 969 */
975 if (archetype *at = archetype::find (SPLINT)) 970 if (archetype *at = archetype::find (SPLINT))
976 { 971 {
977 for (i = 1; i < 9; i++) 972 for (int i = 1; i < 9; i++)
978 { 973 {
979 if (out_of_map (op->map, op->x + freearr_x[i], op->y + freearr_x[i])) 974 if (out_of_map (op->map, op->x + freearr_x[i], op->y + freearr_x[i]))
980 continue; 975 continue;
981 976
982 tmp = arch_to_object (at); 977 object *tmp = arch_to_object (at);
983 tmp->direction = i; 978 tmp->direction = i;
984 tmp->range = op->range; 979 tmp->range = op->range;
985 tmp->stats.dam = op->stats.dam; 980 tmp->stats.dam = op->stats.dam;
986 tmp->duration = op->duration; 981 tmp->duration = op->duration;
987 tmp->attacktype = op->attacktype; 982 tmp->attacktype = op->attacktype;
1001} 996}
1002 997
1003int 998int
1004create_bomb (object *op, object *caster, int dir, object *spell) 999create_bomb (object *op, object *caster, int dir, object *spell)
1005{ 1000{
1006
1007 object *tmp; 1001 object *tmp;
1008 int mflags; 1002 int mflags;
1009 sint16 dx = op->x + freearr_x[dir], dy = op->y + freearr_y[dir]; 1003 sint16 dx = op->x + freearr_x[dir], dy = op->y + freearr_y[dir];
1010 maptile *m; 1004 maptile *m;
1011 1005
1013 if ((mflags & P_OUT_OF_MAP) || (GET_MAP_MOVE_BLOCK (m, dx, dy) & MOVE_WALK)) 1007 if ((mflags & P_OUT_OF_MAP) || (GET_MAP_MOVE_BLOCK (m, dx, dy) & MOVE_WALK))
1014 { 1008 {
1015 new_draw_info (NDI_UNIQUE, 0, op, "There is something in the way."); 1009 new_draw_info (NDI_UNIQUE, 0, op, "There is something in the way.");
1016 return 0; 1010 return 0;
1017 } 1011 }
1012
1018 tmp = arch_to_object (spell->other_arch); 1013 tmp = arch_to_object (spell->other_arch);
1019 1014
1020 /* level dependencies for bomb */ 1015 /* level dependencies for bomb */
1021 tmp->range = spell->range + SP_level_range_adjust (caster, spell); 1016 tmp->range = spell->range + SP_level_range_adjust (caster, spell);
1022 tmp->stats.dam = spell->stats.dam + SP_level_dam_adjust (caster, spell); 1017 tmp->stats.dam = spell->stats.dam + SP_level_dam_adjust (caster, spell);
1603 } 1598 }
1604 1599
1605 /* charm */ 1600 /* charm */
1606 if (QUERY_FLAG (spell, FLAG_NO_ATTACK) && !QUERY_FLAG (head, FLAG_FRIENDLY)) 1601 if (QUERY_FLAG (spell, FLAG_NO_ATTACK) && !QUERY_FLAG (head, FLAG_FRIENDLY))
1607 { 1602 {
1603 INVOKE_OBJECT (KILL, head, ARG_OBJECT (caster));
1604
1608 /* Prevent uncontolled outbreaks of self replicating monsters. 1605 /* Prevent uncontrolled outbreaks of self replicating monsters.
1609 Typical use case is charm, go somwhere, use aggravation to make hostile. 1606 Typical use case is charm, go somwhere, use aggravation to make hostile.
1610 This could lead to fun stuff like mice outbreak in bigworld and server crawl. */ 1607 This could lead to fun stuff like mice outbreak in bigworld and server crawl. */
1611 CLEAR_FLAG (head, FLAG_GENERATOR); 1608 CLEAR_FLAG (head, FLAG_GENERATOR);
1612 head->set_owner (op); 1609 head->set_owner (op);
1613 set_spell_skill (op, caster, spell, head); 1610 set_spell_skill (op, caster, spell, head);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines