--- deliantra/server/server/spell_attack.C 2008/05/18 19:53:07 1.61 +++ deliantra/server/server/spell_attack.C 2008/09/29 10:31:32 1.66 @@ -167,7 +167,7 @@ if (--op->duration < 0) { - op->destroy (); + op->drop_and_destroy (); return; } @@ -309,7 +309,7 @@ mflags = get_map_flags (tmp->map, &newmap, tmp->x, tmp->y, &tmp->x, &tmp->y); if (mflags & P_OUT_OF_MAP) { - tmp->destroy (); + tmp->drop_and_destroy (); return 0; } @@ -319,7 +319,7 @@ { if (!QUERY_FLAG (tmp, FLAG_REFLECTING)) { - tmp->destroy (); + tmp->drop_and_destroy (); return 0; } @@ -353,7 +353,7 @@ if (--op->duration < 0) { - op->destroy (); + op->destroy (true); return; } @@ -395,10 +395,10 @@ { object *tmp, *owner; - if (op->other_arch == NULL) + if (!op->other_arch) { LOG (llevError, "BUG: explode_bullet(): op without other_arch\n"); - op->destroy (); + op->destroy (true); 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 (); + op->destroy (true); 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 (); + op->destroy (true); 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 (); + op->destroy (true); return; } @@ -447,9 +447,12 @@ owner = op->owner; - if ((tmp->attacktype & AT_HOLYWORD || tmp->attacktype & AT_GODPOWER) && owner && !tailor_god_spell (tmp, owner)) + if ((tmp->attacktype & AT_HOLYWORD + || tmp->attacktype & AT_GODPOWER) + && owner + && !tailor_god_spell (tmp, owner)) { - op->destroy (); + op->destroy (true); return; } @@ -487,7 +490,7 @@ tmp->play_sound (tmp->sound); /* remove the firebullet */ - op->destroy (); + op->destroy (true); } /* checks to see what op should do, given the space it is on @@ -523,11 +526,12 @@ { dam = hit_player (tmp, op->stats.dam, op, op->attacktype, 1); + // TODO: can't understand the following if's if (op->destroyed () || !tmp->destroyed () || (op->stats.dam -= dam) < 0) { if (!QUERY_FLAG (op, FLAG_REMOVED)) { - op->destroy (); + op->destroy (true); return; } } @@ -566,7 +570,7 @@ if (op->other_arch) explode_bullet (op); else - op->destroy (); + op->destroy (true); return; } @@ -578,7 +582,7 @@ if (mflags & P_OUT_OF_MAP) { - op->destroy (); + op->destroy (true); return; } @@ -587,7 +591,7 @@ if (op->other_arch) explode_bullet (op); else - op->destroy (); + op->destroy (true); return; } @@ -653,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 (); + tmp->destroy (true); return 0; } @@ -663,7 +667,7 @@ { if (!QUERY_FLAG (tmp, FLAG_REFLECTING)) { - tmp->destroy (); + tmp->destroy (true); return 0; } @@ -728,7 +732,7 @@ /* If no owner left, the spell dies out. */ if (op->owner == NULL) { - op->destroy (); + op->destroy (true); return; } #endif @@ -745,9 +749,9 @@ if (op->destroyed ()) return; - if ((op->duration--) < 0) + if (op->duration-- < 0) { - op->destroy (); + op->destroy (true); return; } /* Object has hit maximum range, so don't have it move @@ -862,7 +866,7 @@ tmp = arch_to_object (spell->other_arch); tmp->set_owner (op); set_spell_skill (op, caster, spell, tmp); - tmp->level = caster_level (caster, spell); + tmp->level = casting_level (caster, spell); tmp->attacktype = spell->attacktype; /* holy word stuff */ @@ -956,7 +960,7 @@ // as bombs can be carried. if (get_map_flags (op->map, NULL, op->x, op->y, NULL, NULL) & P_SAFE) { - op->destroy (); + op->destroy (true); return; } @@ -1114,7 +1118,7 @@ return 0; /* tailor the effect by priest level and worshipped God */ - effect->level = caster_level (caster, spell); + effect->level = casting_level (caster, spell); effect->attacktype = spell->attacktype; if (effect->attacktype & (AT_HOLYWORD | AT_GODPOWER)) { @@ -1148,7 +1152,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 (); + effect->destroy (true); return 0; } } @@ -1181,7 +1185,7 @@ { if (op->range-- <= 0) { - op->destroy (); + op->drop_and_destroy (); return; } @@ -1190,7 +1194,7 @@ if (!pos.normalise ()) { - op->destroy (); + op->destroy (true); return; } @@ -1202,13 +1206,13 @@ /* Basically, missile only hits one thing then goes away. * we need to remove it if someone hasn't already done so. */ - op->destroy (); + op->destroy (true); return; } if (!op->direction) { - op->destroy (); + op->destroy (true); return; } @@ -1453,7 +1457,7 @@ * doing it over and over again. */ god = find_god (determine_god (op)); - level = caster_level (caster, spell); + level = casting_level (caster, spell); range = spell->range + SP_level_range_adjust (caster, spell); /* On the bright side, no monster should ever have a race of GOD_... @@ -1735,13 +1739,13 @@ if (!owner) // MUST not happen, remove when true TODO { LOG (llevError, "swarm spell found outside inventory: %s\n", op->debug_desc ()); - op->destroy (); + op->destroy (true); return; } if (!op->duration || !owner->is_on_map ()) { - op->destroy (); + op->drop_and_destroy (); return; } @@ -1847,7 +1851,7 @@ object *tmp = archetype::get (SWARM_SPELL); set_spell_skill (op, caster, spell, tmp); - tmp->level = caster_level (caster, spell); /* needed later, to get level dep. right. */ + tmp->level = casting_level (caster, spell); /* needed later, to get level dep. right. */ tmp->spell = spell->other_arch->instance (); tmp->attacktype = tmp->spell->attacktype; @@ -2000,7 +2004,7 @@ disease->set_owner (op); set_spell_skill (op, caster, spell, disease); disease->stats.exp = 0; - disease->level = caster_level (caster, spell); + disease->level = casting_level (caster, spell); /* do level adjustments */ if (disease->stats.wc) @@ -2054,12 +2058,12 @@ { new_draw_info_format (NDI_UNIQUE, 0, op, "You inflict %s on %s!", &disease->name, &walk->name); - disease->destroy (); /* don't need this one anymore */ + disease->destroy (true); /* don't need this one anymore */ walk->map->insert (get_archetype ("detect_magic"), x, y, op); return 1; } - disease->destroy (); + disease->destroy (true); } } /* if living creature */ } /* for range of spaces */