--- deliantra/server/server/spell_attack.C 2008/05/17 15:25:19 1.59 +++ deliantra/server/server/spell_attack.C 2008/09/29 10:20:49 1.65 @@ -150,6 +150,7 @@ new_bolt->stats.dam++; tmp->stats.dam /= 2; /* reduce father bolt damage */ tmp->stats.dam++; + if ((new_bolt = m->insert (new_bolt, sx, sy, op))) update_turn_face (new_bolt); } @@ -166,7 +167,8 @@ if (--op->duration < 0) { - op->destroy (); + op->destroy_inv (true); // be explicit about dropping + op->destroy (true); return; } @@ -308,7 +310,8 @@ 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_inv (true); // be explicit about dropping + tmp->destroy (true); return 0; } @@ -318,7 +321,8 @@ { if (!QUERY_FLAG (tmp, FLAG_REFLECTING)) { - tmp->destroy (); + tmp->destroy_inv (true); // be explicit about dropping + tmp->destroy (true); return 0; } @@ -352,7 +356,7 @@ if (--op->duration < 0) { - op->destroy (); + op->destroy (true); return; } @@ -394,10 +398,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; } @@ -408,7 +412,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; } @@ -417,7 +421,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; } @@ -426,7 +430,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; } @@ -446,9 +450,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; } @@ -486,7 +493,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 @@ -522,11 +529,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; } } @@ -565,7 +573,7 @@ if (op->other_arch) explode_bullet (op); else - op->destroy (); + op->destroy (true); return; } @@ -577,7 +585,7 @@ if (mflags & P_OUT_OF_MAP) { - op->destroy (); + op->destroy (true); return; } @@ -586,7 +594,7 @@ if (op->other_arch) explode_bullet (op); else - op->destroy (); + op->destroy (true); return; } @@ -652,7 +660,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; } @@ -662,7 +670,7 @@ { if (!QUERY_FLAG (tmp, FLAG_REFLECTING)) { - tmp->destroy (); + tmp->destroy (true); return 0; } @@ -727,7 +735,7 @@ /* If no owner left, the spell dies out. */ if (op->owner == NULL) { - op->destroy (); + op->destroy (true); return; } #endif @@ -744,9 +752,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 @@ -861,7 +869,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 */ @@ -955,7 +963,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; } @@ -1113,7 +1121,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)) { @@ -1147,7 +1155,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; } } @@ -1180,7 +1188,8 @@ { if (op->range-- <= 0) { - op->destroy (); + op->destroy_inv (true); // be explicit about dropping + op->destroy (true); return; } @@ -1189,7 +1198,7 @@ if (!pos.normalise ()) { - op->destroy (); + op->destroy (true); return; } @@ -1201,13 +1210,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; } @@ -1452,7 +1461,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_... @@ -1612,7 +1621,6 @@ * op is the spell effect. * note that duration is handled by process_object() in time.c */ - void move_ball_spell (object *op) { @@ -1735,13 +1743,14 @@ 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->destroy_inv (true); // be explicit about dropping + op->destroy (true); return; } @@ -1749,8 +1758,11 @@ int basedir = op->direction; if (!basedir) - /* spray in all directions! 8) */ - basedir = (op->facing += op->state) % 8 + 1; + { + /* spray in all directions! 8) */ + op->facing = (op->facing + op->state) & 7; + basedir = op->facing + 1; + } #if 0 // this is bogus: it causes wrong places to be checked below @@ -1842,8 +1854,9 @@ return 0; 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; @@ -1996,7 +2009,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) @@ -2050,12 +2063,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 */