--- deliantra/server/server/spell_attack.C 2008/09/29 10:31:32 1.66 +++ deliantra/server/server/spell_attack.C 2008/12/04 01:07:35 1.69 @@ -353,7 +353,7 @@ if (--op->duration < 0) { - op->destroy (true); + op->destroy (); return; } @@ -398,7 +398,7 @@ if (!op->other_arch) { LOG (llevError, "BUG: explode_bullet(): op without other_arch\n"); - op->destroy (true); + op->destroy (); return; } @@ -409,7 +409,7 @@ if (!env->map || out_of_map (env->map, env->x, env->y)) { LOG (llevError, "BUG: explode_bullet(): env out of map\n"); - op->destroy (true); + op->destroy (); return; } @@ -418,7 +418,7 @@ else if (out_of_map (op->map, op->x, op->y)) { LOG (llevError, "BUG: explode_bullet(): op out of map\n"); - op->destroy (true); + op->destroy (); return; } @@ -427,7 +427,7 @@ // bad at the moment that might happen from this. if (get_map_flags (op->map, NULL, op->x, op->y, NULL, NULL) & P_SAFE) { - op->destroy (true); + op->destroy (); return; } @@ -452,7 +452,7 @@ && owner && !tailor_god_spell (tmp, owner)) { - op->destroy (true); + op->destroy (); return; } @@ -490,7 +490,7 @@ tmp->play_sound (tmp->sound); /* remove the firebullet */ - op->destroy (true); + op->destroy (); } /* checks to see what op should do, given the space it is on @@ -531,7 +531,7 @@ { if (!QUERY_FLAG (op, FLAG_REMOVED)) { - op->destroy (true); + op->destroy (); return; } } @@ -570,7 +570,7 @@ if (op->other_arch) explode_bullet (op); else - op->destroy (true); + op->destroy (); return; } @@ -582,7 +582,7 @@ if (mflags & P_OUT_OF_MAP) { - op->destroy (true); + op->destroy (); return; } @@ -591,7 +591,7 @@ if (op->other_arch) explode_bullet (op); else - op->destroy (true); + op->destroy (); return; } @@ -657,7 +657,7 @@ mflags = get_map_flags (tmp->map, &newmap, tmp->x, tmp->y, &tmp->x, &tmp->y); if (mflags & P_OUT_OF_MAP) { - tmp->destroy (true); + tmp->destroy (); return 0; } @@ -667,7 +667,7 @@ { if (!QUERY_FLAG (tmp, FLAG_REFLECTING)) { - tmp->destroy (true); + tmp->destroy (); return 0; } @@ -732,26 +732,31 @@ /* If no owner left, the spell dies out. */ if (op->owner == NULL) { - op->destroy (true); + op->destroy (); return; } #endif hit_map (op, 0, op->attacktype, 0); + if (!op->is_on_map ()) + return; + /* Check to see if we should push anything. * Spell objects with weight push whatever they encounter to some * degree. */ if (op->weight) - check_spell_knockback (op); + { + check_spell_knockback (op); - if (op->destroyed ()) - return; + if (!op->is_on_map ()) + return; + } if (op->duration-- < 0) { - op->destroy (true); + op->destroy (); return; } /* Object has hit maximum range, so don't have it move @@ -960,7 +965,7 @@ // as bombs can be carried. if (get_map_flags (op->map, NULL, op->x, op->y, NULL, NULL) & P_SAFE) { - op->destroy (true); + op->destroy (); return; } @@ -1152,7 +1157,7 @@ { new_draw_info_format (NDI_UNIQUE, 0, op, "The %s looks stronger!", query_name (target)); target->stats.hp = target->stats.maxhp * 2; - effect->destroy (true); + effect->destroy (); return 0; } } @@ -1194,7 +1199,7 @@ if (!pos.normalise ()) { - op->destroy (true); + op->destroy (); return; } @@ -1206,13 +1211,13 @@ /* Basically, missile only hits one thing then goes away. * we need to remove it if someone hasn't already done so. */ - op->destroy (true); + op->destroy (); return; } if (!op->direction) { - op->destroy (true); + op->destroy (); return; } @@ -1247,10 +1252,7 @@ tmp->speed = 0.01; tmp->stats.food = time; SET_FLAG (tmp, FLAG_IS_USED_UP); - tmp->glow_radius = radius; - if (tmp->glow_radius > MAX_LIGHT_RADII) - tmp->glow_radius = MAX_LIGHT_RADII; - + tmp->glow_radius = min (MAX_LIGHT_RADIUS, radius); tmp = insert_ob_in_ob (tmp, op); if (tmp->glow_radius > op->glow_radius) @@ -1739,7 +1741,7 @@ if (!owner) // MUST not happen, remove when true TODO { LOG (llevError, "swarm spell found outside inventory: %s\n", op->debug_desc ()); - op->destroy (true); + op->destroy (); return; } @@ -1887,43 +1889,40 @@ dam = spell->stats.dam + SP_level_dam_adjust (caster, spell); - if (!dir) + if (dir) { - new_draw_info (NDI_UNIQUE, 0, op, "In what direction?"); - return 0; - } - - x = op->x + freearr_x[dir]; - y = op->y + freearr_y[dir]; - m = op->map; + x = op->x + freearr_x[dir]; + y = op->y + freearr_y[dir]; + m = op->map; - mflags = get_map_flags (m, &m, x, y, &x, &y); + mflags = get_map_flags (m, &m, x, y, &x, &y); - if (mflags & P_OUT_OF_MAP) - { - new_draw_info (NDI_UNIQUE, 0, op, "Nothing is there."); - return 0; - } + if (mflags & P_OUT_OF_MAP) + { + new_draw_info (NDI_UNIQUE, 0, op, "Nothing is there."); + return 0; + } - if (mflags & P_IS_ALIVE && spell->attacktype) - { - for (target = GET_MAP_OB (m, x, y); target; target = target->above) - if (QUERY_FLAG (target, FLAG_MONSTER)) - { - /* oky doky. got a target monster. Lets make a blinding attack */ - if (target->head) - target = target->head; + if (mflags & P_IS_ALIVE && spell->attacktype) + { + for (target = GET_MAP_OB (m, x, y); target; target = target->above) + if (QUERY_FLAG (target, FLAG_MONSTER)) + { + /* oky doky. got a target monster. Lets make a blinding attack */ + if (target->head) + target = target->head; - hit_player (target, dam, op, spell->attacktype, 1); - return 1; /* one success only! */ - } - } + hit_player (target, dam, op, spell->attacktype, 1); + return 1; /* one success only! */ + } + } - /* no live target, perhaps a wall is in the way? */ - if (OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, x, y))) - { - new_draw_info (NDI_UNIQUE, 0, op, "Something is in the way."); - return 0; + /* no live target, perhaps a wall is in the way? */ + if (OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, x, y))) + { + new_draw_info (NDI_UNIQUE, 0, op, "Something is in the way."); + return 0; + } } /* ok, looks groovy to just insert a new light on the map */ @@ -1933,15 +1932,17 @@ LOG (llevError, "Error: spell arch for cast_light() missing.\n"); return 0; } + tmp->stats.food = spell->duration + SP_level_duration_adjust (caster, spell); + if (tmp->glow_radius) - { - tmp->glow_radius = spell->range + SP_level_range_adjust (caster, spell); - if (tmp->glow_radius > MAX_LIGHT_RADII) - tmp->glow_radius = MAX_LIGHT_RADII; - } + tmp->glow_radius = min (MAX_LIGHT_RADIUS, spell->range + SP_level_range_adjust (caster, spell)); + + if (dir) + m->insert (tmp, x, y, op); + else + caster->outer_env ()->insert (tmp); - m->insert (tmp, x, y, op); return 1; } @@ -2058,12 +2059,12 @@ { new_draw_info_format (NDI_UNIQUE, 0, op, "You inflict %s on %s!", &disease->name, &walk->name); - disease->destroy (true); /* don't need this one anymore */ + disease->destroy (); /* don't need this one anymore */ walk->map->insert (get_archetype ("detect_magic"), x, y, op); return 1; } - disease->destroy (true); + disease->destroy (); } } /* if living creature */ } /* for range of spaces */