--- deliantra/server/server/spell_attack.C 2008/05/17 15:25:19 1.59 +++ deliantra/server/server/spell_attack.C 2009/09/01 22:40:26 1.85 @@ -1,7 +1,7 @@ /* * This file is part of Deliantra, the Roguelike Realtime MMORPG. * - * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team + * Copyright (©) 2005,2006,2007,2008,2009 Marc Alexander Lehmann / Robin Redeker / the Deliantra team * Copyright (©) 2002-2003,2007 Mark Wedel & Crossfire Development Team * Copyright (©) 1992,2007 Frank Tore Johansen * @@ -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,7 @@ if (--op->duration < 0) { - op->destroy (); + op->drop_and_destroy (); return; } @@ -308,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; } @@ -318,7 +319,7 @@ { if (!QUERY_FLAG (tmp, FLAG_REFLECTING)) { - tmp->destroy (); + tmp->drop_and_destroy (); return 0; } @@ -394,7 +395,7 @@ { object *tmp, *owner; - if (op->other_arch == NULL) + if (!op->other_arch) { LOG (llevError, "BUG: explode_bullet(): op without other_arch\n"); op->destroy (); @@ -446,7 +447,10 @@ 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 (); return; @@ -522,6 +526,7 @@ { 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)) @@ -734,17 +739,22 @@ 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) + if (op->duration-- < 0) { op->destroy (); return; @@ -820,18 +830,14 @@ for (i = range_min; i <= range_max; i++) { - sint16 x, y, d; + sint16 x, y; /* We can't use absdir here, because it never returns - * 0. If this is a rune, we want to hit the person on top + * 0. If this is a rune, we want to hit the person on top * of the trap (d==0). If it is not a rune, then we don't want * to hit that person. */ - d = dir + i; - while (d < 0) - d += 8; - while (d > 8) - d -= 8; + int d = dir ? absdir (dir + i) : i; /* If it's not a rune, we don't want to blast the caster. * In that case, we have to see - if dir is specified, @@ -861,7 +867,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 */ @@ -943,7 +949,7 @@ if (op->env) { - if (env->map == NULL) + if (!env->map) return; if (!(op = op->insert_at (env, op))) @@ -953,7 +959,7 @@ // elmex Tue Aug 15 17:46:51 CEST 2006: Prevent bomb from exploding // on a safe map. I don't like this special casing, but it seems to be neccessary // as bombs can be carried. - if (get_map_flags (op->map, NULL, op->x, op->y, NULL, NULL) & P_SAFE) + if (op->ms ().flags () & P_SAFE) { op->destroy (); return; @@ -1000,10 +1006,18 @@ maptile *m; mflags = get_map_flags (op->map, &m, dx, dy, &dx, &dy); - if ((mflags & P_OUT_OF_MAP) || (GET_MAP_MOVE_BLOCK (m, dx, dy) & MOVE_WALK)) + + // when creating a bomb below ourself it should always work, even + // when movement is blocked (somehow we got here, somehow we are here, + // so we should also be able to make a bomb here). (originally added + // to fix create bomb traps in doors, which cast with dir=0). + if (dir) { - new_draw_info (NDI_UNIQUE, 0, op, "There is something in the way."); - return 0; + if ((mflags & P_OUT_OF_MAP) || (GET_MAP_MOVE_BLOCK (m, dx, dy) & MOVE_WALK)) + { + new_draw_info (NDI_UNIQUE, 0, op, "There is something in the way."); + return 0; + } } tmp = arch_to_object (spell->other_arch); @@ -1099,9 +1113,11 @@ * can't be friendly to your god. */ - if (!target || QUERY_FLAG (target, FLAG_REFL_SPELL) + if (!target + || target->flag [FLAG_REFL_SPELL] || (!god && spell->stats.grace) - || (target->title && god && !strcmp (target->title, god->name)) || (target->race && god && strstr (target->race, god->race))) + || (god && target->title == god->name) + || (god && target->race.contains (god->race))) { new_draw_info (NDI_UNIQUE, 0, op, "Your request is unheeded."); return 0; @@ -1113,12 +1129,12 @@ 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)) { if (tailor_god_spell (effect, op)) - new_draw_info_format (NDI_UNIQUE, 0, op, "%s answers your call!", determine_god (op)); + new_draw_info_format (NDI_UNIQUE, 0, op, "%s answers your call!", (const char *)determine_god (op)); else { new_draw_info (NDI_UNIQUE, 0, op, "Your request is ignored."); @@ -1180,7 +1196,7 @@ { if (op->range-- <= 0) { - op->destroy (); + op->drop_and_destroy (); return; } @@ -1242,14 +1258,11 @@ 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->set_glow_radius (min (MAX_LIGHT_RADIUS, radius)); tmp = insert_ob_in_ob (tmp, op); if (tmp->glow_radius > op->glow_radius) - op->glow_radius = tmp->glow_radius; + op->set_glow_radius (tmp->glow_radius); return 1; } @@ -1257,76 +1270,53 @@ int cast_destruction (object *op, object *caster, object *spell_ob) { - int i, j, range, mflags, friendly = 0, dam, dur; - sint16 sx, sy; - maptile *m; - object *tmp; - const char *skill; + int range = spell_ob->range + SP_level_range_adjust (caster, spell_ob); + int dam = spell_ob->stats.dam + SP_level_dam_adjust (caster, spell_ob); + int dur = spell_ob->duration + SP_level_duration_adjust (caster, spell_ob); - range = spell_ob->range + SP_level_range_adjust (caster, spell_ob); - dam = spell_ob->stats.dam + SP_level_dam_adjust (caster, spell_ob); - dur = spell_ob->duration + SP_level_duration_adjust (caster, spell_ob); - if (QUERY_FLAG (op, FLAG_FRIENDLY) || op->type == PLAYER) - friendly = 1; + bool friendly = op->flag [FLAG_FRIENDLY] || op->is_player (); /* destruction doesn't use another spell object, so we need * update op's skill pointer so that exp is properly awarded. - * We do some shortcuts here - since this is just temporary - * and we'll reset the values back, we don't need to go through - * the full share string/free_string route. */ - skill = op->skill; + const shstr skill = op->skill; + if (caster == op) op->skill = spell_ob->skill; else if (caster->skill) op->skill = caster->skill; else - op->skill = NULL; + op->skill = 0; op->change_skill (find_skill_by_name (op, op->skill)); - for (i = -range; i <= range; i++) + unordered_mapwalk (op, -range, -range, range, range) { - for (j = -range; j <= range; j++) - { - m = op->map; - sx = op->x + i; - sy = op->y + j; + mapspace &ms = m->at (nx, ny); - mflags = get_map_flags (m, &m, sx, sy, &sx, &sy); - if (mflags & P_OUT_OF_MAP) - continue; - - if (mflags & P_IS_ALIVE) + if (ms.flags () & P_IS_ALIVE) + for (object *tmp = ms.bot; tmp; tmp = tmp->above) + if (tmp->flag [FLAG_ALIVE] || tmp->is_player ()) { - for (tmp = GET_MAP_OB (m, sx, sy); tmp; tmp = tmp->above) - if (QUERY_FLAG (tmp, FLAG_ALIVE) || tmp->type == PLAYER) - break; + tmp = tmp->head_ (); - if (tmp) + if ((friendly && !tmp->flag [FLAG_FRIENDLY] && !tmp->is_player ()) + || (!friendly && (tmp->flag [FLAG_FRIENDLY] || tmp->is_player ()))) { - if (tmp->head) - tmp = tmp->head; + if (spell_ob->subtype == SP_DESTRUCTION) + { + hit_player (tmp, dam, op, spell_ob->attacktype, 0); - if ((friendly && !QUERY_FLAG (tmp, FLAG_FRIENDLY) && tmp->type != PLAYER) || - (!friendly && (QUERY_FLAG (tmp, FLAG_FRIENDLY) || tmp->type == PLAYER))) + if (spell_ob->other_arch) + m->insert (arch_to_object (spell_ob->other_arch), nx, ny, op); + } + else if (spell_ob->subtype == SP_FAERY_FIRE && tmp->resist [ATNR_MAGIC] != 100) { - if (spell_ob->subtype == SP_DESTRUCTION) - { - hit_player (tmp, dam, op, spell_ob->attacktype, 0); - - if (spell_ob->other_arch) - m->insert (arch_to_object (spell_ob->other_arch), sx, sy, op); - } - else if (spell_ob->subtype == SP_FAERY_FIRE && tmp->resist[ATNR_MAGIC] != 100) - { - if (make_object_glow (tmp, 1, dur) && spell_ob->other_arch) - m->insert (arch_to_object (spell_ob->other_arch), sx, sy, op); - } + if (make_object_glow (tmp, 1, dur) && spell_ob->other_arch) + m->insert (arch_to_object (spell_ob->other_arch), nx, ny, op); } } } - } } op->skill = skill; @@ -1443,16 +1433,14 @@ mood_change (object *op, object *caster, object *spell) { object *tmp, *god, *head; - int done_one, range, mflags, level, at, best_at; - sint16 x, y, nx, ny; - maptile *m; + int done_one, range, level, at, best_at; const char *race; /* We precompute some values here so that we don't have to keep * 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_... @@ -1461,158 +1449,149 @@ */ if (!spell->race) race = NULL; - else if (god && !strcmp (spell->race, "GOD_SLAYING")) + else if (god && spell->race == shstr_GOD_SLAYING) race = god->slaying; - else if (god && !strcmp (spell->race, "GOD_FRIEND")) + else if (god && spell->race == shstr_GOD_FRIEND) race = god->race; else race = spell->race; - for (x = op->x - range; x <= op->x + range; x++) - for (y = op->y - range; y <= op->y + range; y++) - { - done_one = 0; - m = op->map; - nx = x; - ny = y; - mflags = get_map_flags (m, &m, x, y, &nx, &ny); - if (mflags & P_OUT_OF_MAP) - continue; - - /* If there is nothing living on this space, no need to go further */ - if (!(mflags & P_IS_ALIVE)) - continue; - - // players can only affect spaces that they can actually see - if (caster && caster->contr - && caster->contr->visibility_at (m, nx, ny) < 70) - continue; - - for (tmp = GET_MAP_TOP (m, nx, ny); tmp; tmp = tmp->below) - if (QUERY_FLAG (tmp, FLAG_MONSTER)) - break; - - /* There can be living objects that are not monsters */ - if (!tmp || tmp->type == PLAYER) - continue; - - /* Only the head has meaningful data, so resolve to that */ - if (tmp->head) - head = tmp->head; - else - head = tmp; - - /* Make sure the race is OK. Likewise, only effect undead if spell specifically allows it */ - if (race && head->race && !strstr (race, head->race)) - continue; - - if (QUERY_FLAG (head, FLAG_UNDEAD) && !QUERY_FLAG (spell, FLAG_UNDEAD)) - continue; - - /* Now do a bunch of stuff related to saving throws */ - best_at = -1; - if (spell->attacktype) - { - for (at = 0; at < NROFATTACKS; at++) - if (spell->attacktype & (1 << at)) - if (best_at == -1 || head->resist[at] > head->resist[best_at]) - best_at = at; - - if (best_at == -1) - at = 0; - else - { - if (head->resist[best_at] == 100) - continue; - else - at = head->resist[best_at] / 5; - } - at -= level / 5; - if (did_make_save (head, head->level, at)) - continue; - } - else /* spell->attacktype */ - { - /* - Spell has no attacktype (charm & such), so we'll have a specific saving: - * if spell level < monster level, no go - * else, chance of effect = 20 + min( 50, 2 * ( spell level - monster level ) ) - - The chance will then be in the range [20-70] percent, not too bad. - - This is required to fix the 'charm monster' abuse, where a player level 1 can - charm a level 125 monster... - - Ryo, august 14th - */ - if (head->level > level) - continue; - - if (random_roll (0, 100, caster, PREFER_LOW) >= (20 + MIN (50, 2 * (level - head->level)))) - /* Failed, no effect */ - continue; - } - - /* Done with saving throw. Now start affecting the monster */ - - /* aggravation */ - if (QUERY_FLAG (spell, FLAG_MONSTER)) - { - CLEAR_FLAG (head, FLAG_SLEEP); - remove_friendly_object (head); - done_one = 1; - head->enemy = op; - } - - /* calm monsters */ - if (QUERY_FLAG (spell, FLAG_UNAGGRESSIVE) && !QUERY_FLAG (head, FLAG_UNAGGRESSIVE)) - { - SET_FLAG (head, FLAG_UNAGGRESSIVE); - head->enemy = NULL; - done_one = 1; - } - - /* berserk monsters */ - if (QUERY_FLAG (spell, FLAG_BERSERK) && !QUERY_FLAG (head, FLAG_BERSERK)) - { - SET_FLAG (head, FLAG_BERSERK); - done_one = 1; - } - - /* charm */ - if (QUERY_FLAG (spell, FLAG_NO_ATTACK) && !QUERY_FLAG (head, FLAG_FRIENDLY)) - { - INVOKE_OBJECT (KILL, head, ARG_OBJECT (caster)); - - /* Prevent uncontrolled outbreaks of self replicating monsters. - Typical use case is charm, go somwhere, use aggravation to make hostile. - This could lead to fun stuff like mice outbreak in bigworld and server crawl. */ - CLEAR_FLAG (head, FLAG_GENERATOR); - head->set_owner (op); - set_spell_skill (op, caster, spell, head); - add_friendly_object (head); - head->attack_movement = PETMOVE; - done_one = 1; - change_exp (op, head->stats.exp / 2, head->skill, SK_EXP_ADD_SKILL); - head->stats.exp = 0; - } - - /* If a monster was effected, put an effect in */ - if (done_one && spell->other_arch) - m->insert (arch_to_object (spell->other_arch), nx, ny, op); - } /* for y */ + unordered_mapwalk (op, -range, -range, range, range) + { + mapspace &ms = m->at (nx, ny); + + /* If there is nothing living on this space, no need to go further */ + if (!ms.flags () & P_IS_ALIVE) + continue; + + // players can only affect spaces that they can actually see + if (caster + && caster->contr + && caster->contr->darkness_at (m, nx, ny) == LOS_BLOCKED) + continue; + + for (tmp = ms.top; tmp; tmp = tmp->below) + if (tmp->flag [FLAG_MONSTER]) + break; + + /* There can be living objects that are not monsters */ + if (!tmp) + continue; + + /* Only the head has meaningful data, so resolve to that */ + head = tmp->head_ (); + + /* Make sure the race is OK. Likewise, only effect undead if spell specifically allows it */ + if (race && head->race && !strstr (race, head->race)) + continue; + + if (QUERY_FLAG (head, FLAG_UNDEAD) && !QUERY_FLAG (spell, FLAG_UNDEAD)) + continue; + + /* Now do a bunch of stuff related to saving throws */ + best_at = -1; + if (spell->attacktype) + { + for (at = 0; at < NROFATTACKS; at++) + if (spell->attacktype & (1 << at)) + if (best_at == -1 || head->resist[at] > head->resist[best_at]) + best_at = at; + + if (best_at == -1) + at = 0; + else + { + if (head->resist[best_at] == 100) + continue; + else + at = head->resist[best_at] / 5; + } + + at -= level / 5; + if (did_make_save (head, head->level, at)) + continue; + } + else /* spell->attacktype */ + { + /* + Spell has no attacktype (charm & such), so we'll have a specific saving: + * if spell level < monster level, no go + * else, chance of effect = 20 + min( 50, 2 * ( spell level - monster level ) ) + + The chance will then be in the range [20-70] percent, not too bad. + + This is required to fix the 'charm monster' abuse, where a player level 1 can + charm a level 125 monster... + + Ryo, august 14th + */ + if (head->level > level) + continue; + + if (random_roll (0, 100, caster, PREFER_LOW) >= (20 + MIN (50, 2 * (level - head->level)))) + /* Failed, no effect */ + continue; + } + + /* Done with saving throw. Now start affecting the monster */ + done_one = 0; + + /* aggravation */ + if (QUERY_FLAG (spell, FLAG_MONSTER)) + { + CLEAR_FLAG (head, FLAG_SLEEP); + remove_friendly_object (head); + done_one = 1; + head->enemy = op; + } + + /* calm monsters */ + if (QUERY_FLAG (spell, FLAG_UNAGGRESSIVE) && !QUERY_FLAG (head, FLAG_UNAGGRESSIVE)) + { + SET_FLAG (head, FLAG_UNAGGRESSIVE); + head->enemy = NULL; + done_one = 1; + } + + /* berserk monsters */ + if (QUERY_FLAG (spell, FLAG_BERSERK) && !QUERY_FLAG (head, FLAG_BERSERK)) + { + SET_FLAG (head, FLAG_BERSERK); + done_one = 1; + } + + /* charm */ + if (QUERY_FLAG (spell, FLAG_NO_ATTACK) && !QUERY_FLAG (head, FLAG_FRIENDLY)) + { + INVOKE_OBJECT (KILL, head, ARG_OBJECT (caster)); + + /* Prevent uncontrolled outbreaks of self replicating monsters. + Typical use case is charm, go somwhere, use aggravation to make hostile. + This could lead to fun stuff like mice outbreak in bigworld and server crawl. */ + CLEAR_FLAG (head, FLAG_GENERATOR); + head->set_owner (op); + set_spell_skill (op, caster, spell, head); + add_friendly_object (head); + head->attack_movement = PETMOVE; + done_one = 1; + change_exp (op, head->stats.exp / 2, head->skill, SK_EXP_ADD_SKILL); + head->stats.exp = 0; + } + + /* If a monster was effected, put an effect in */ + if (done_one && spell->other_arch) + m->insert (arch_to_object (spell->other_arch), nx, ny, op); + } return 1; } - /* Move_ball_spell: This handles ball type spells that just sort of wander * about. was called move_ball_lightning, but since more than the ball * lightning spell used it, that seemed misnamed. * op is the spell effect. * note that duration is handled by process_object() in time.c */ - void move_ball_spell (object *op) { @@ -1641,7 +1620,6 @@ /* i bit 0: alters sign of offset * other bits (i / 2): absolute value of offset */ - int offset = ((i ^ j) & 1) ? (i / 2) : -(i / 2); int tmpdir = absdir (op->direction + offset); @@ -1653,6 +1631,7 @@ break; } } + if (dir == 0) { nx = op->x; @@ -1741,7 +1720,7 @@ if (!op->duration || !owner->is_on_map ()) { - op->destroy (); + op->drop_and_destroy (); return; } @@ -1749,8 +1728,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 +1824,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; @@ -1879,43 +1862,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 */ @@ -1925,15 +1905,19 @@ 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->set_glow_radius ( + clamp (spell->range + SP_level_range_adjust (caster, spell), 1, MAX_LIGHT_RADIUS) + ); + + if (dir) + m->insert (tmp, x, y, op); + else + caster->outer_env ()->insert (tmp); - m->insert (tmp, x, y, op); return 1; } @@ -1996,7 +1980,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)