--- deliantra/server/server/spell_attack.C 2007/06/07 18:58:30 1.40
+++ deliantra/server/server/spell_attack.C 2008/04/20 23:25:43 1.51
@@ -1,25 +1,24 @@
/*
- * This file is part of Crossfire TRT, the Roguelike Realtime MORPG.
+ * This file is part of Deliantra, the Roguelike Realtime MMORPG.
*
- * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team
+ * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
* Copyright (©) 2002-2003,2007 Mark Wedel & Crossfire Development Team
* Copyright (©) 1992,2007 Frank Tore Johansen
*
- * Crossfire TRT is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
+ * Deliantra is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along
- * with Crossfire TRT; if not, write to the Free Software Foundation, Inc. 51
- * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*
- * The authors can be reached via e-mail to
+ * The authors can be reached via e-mail to
*/
/* This file contains all the spell attack code. Grouping this code
@@ -339,8 +338,6 @@
return 1;
}
-
-
/***************************************************************************
*
* BULLET/BALL CODE
@@ -348,7 +345,7 @@
***************************************************************************/
/* expands an explosion. op is a piece of the
- * explosion - this expans it in the different directions.
+ * explosion - this expands it in the different directions.
* At least that is what I think this does.
*/
void
@@ -392,7 +389,6 @@
}
}
-
/* Causes an object to explode, eg, a firebullet,
* poison cloud ball, etc. op is the object to
* explode.
@@ -411,8 +407,9 @@
if (op->env)
{
- object *env = object_get_env_recursive (op);
- if (env->map == NULL || out_of_map (env->map, env->x, env->y))
+ object *env = op->outer_env ();
+
+ if (!env->map || out_of_map (env->map, env->x, env->y))
{
LOG (llevError, "BUG: explode_bullet(): env out of map\n");
op->destroy ();
@@ -489,6 +486,8 @@
op->move_on = 0;
tmp->insert_at (op, op);
+ tmp->play_sound (tmp->sound);
+
/* remove the firebullet */
op->destroy ();
}
@@ -614,7 +613,6 @@
* This function sets up the appropriate owner and skill
* pointers.
*/
-
int
fire_bullet (object *op, object *caster, int dir, object *spob)
{
@@ -936,20 +934,16 @@
*
****************************************************************************/
-
/* This handles an exploding bomb.
* op is the original bomb object.
*/
void
animate_bomb (object *op)
{
- int i;
- object *env, *tmp;
-
if (op->state != NUM_ANIMATIONS (op) - 1)
return;
- env = object_get_env_recursive (op);
+ object *env = op->outer_env ();
if (op->env)
{
@@ -978,12 +972,12 @@
*/
if (archetype *at = archetype::find (SPLINT))
{
- for (i = 1; i < 9; i++)
+ for (int i = 1; i < 9; i++)
{
if (out_of_map (op->map, op->x + freearr_x[i], op->y + freearr_x[i]))
continue;
- tmp = arch_to_object (at);
+ object *tmp = arch_to_object (at);
tmp->direction = i;
tmp->range = op->range;
tmp->stats.dam = op->stats.dam;
@@ -1007,7 +1001,6 @@
int
create_bomb (object *op, object *caster, int dir, object *spell)
{
-
object *tmp;
int mflags;
sint16 dx = op->x + freearr_x[dir], dy = op->y + freearr_y[dir];
@@ -1019,6 +1012,7 @@
new_draw_info (NDI_UNIQUE, 0, op, "There is something in the way.");
return 0;
}
+
tmp = arch_to_object (spell->other_arch);
/* level dependencies for bomb */
@@ -1049,7 +1043,6 @@
* type is the type of spell - either SPELL_MANA or SPELL_GRACE.
* this info is used for blocked magic/unholy spaces.
*/
-
object *
get_pointed_target (object *op, int dir, int range, int type)
{
@@ -1078,20 +1071,14 @@
return NULL;
if (mflags & P_IS_ALIVE)
- {
- for (target = GET_MAP_OB (mp, x, y); target; target = target->above)
- {
- if (QUERY_FLAG (target->head ? target->head : target, FLAG_MONSTER))
- {
- return target;
- }
- }
- }
+ for (target = GET_MAP_OB (mp, x, y); target; target = target->above)
+ if (QUERY_FLAG (target, FLAG_MONSTER))
+ return target;
}
+
return NULL;
}
-
/* cast_smite_arch() - the priest points to a creature and causes
* a 'godly curse' to decend.
* usual params -
@@ -1100,7 +1087,6 @@
* dir = direction being cast
* spell = spell object
*/
-
int
cast_smite_spell (object *op, object *caster, int dir, object *spell)
{
@@ -1188,7 +1174,6 @@
return 1;
}
-
/****************************************************************************
*
* MAGIC MISSILE code.
@@ -1268,17 +1253,14 @@
* make this work for non-living objects, we would have to
* give them the capability to have an inventory. b.t.
*/
-
int
make_object_glow (object *op, int radius, int time)
{
- object *tmp;
-
/* some things are unaffected... */
if (op->path_denied & PATH_LIGHT)
return 0;
- tmp = get_archetype (FORCE_NAME);
+ object *tmp = get_archetype (FORCE_NAME);
tmp->speed = 0.01;
tmp->stats.food = time;
SET_FLAG (tmp, FLAG_IS_USED_UP);
@@ -1286,19 +1268,11 @@
if (tmp->glow_radius > MAX_LIGHT_RADII)
tmp->glow_radius = MAX_LIGHT_RADII;
- tmp->x = op->x;
- tmp->y = op->y;
- if (tmp->speed < MIN_ACTIVE_SPEED)
- tmp->speed = MIN_ACTIVE_SPEED; /* safety */
tmp = insert_ob_in_ob (tmp, op);
+
if (tmp->glow_radius > op->glow_radius)
op->glow_radius = tmp->glow_radius;
- if (!tmp->env || op != tmp->env)
- {
- LOG (llevError, "make_object_glow() failed to insert glowing force in %s\n", &op->name);
- return 0;
- }
return 1;
}
@@ -1399,8 +1373,10 @@
return 0;
}
+ tmp = tmp->head_ ();
+
/* If we've already got a force of this type, don't add a new one. */
- for (force = tmp->inv; force != NULL; force = force->below)
+ for (force = tmp->inv; force; force = force->below)
{
if (force->type == FORCE && force->subtype == FORCE_CHANGE_ABILITY)
{
@@ -1416,10 +1392,11 @@
}
}
- if (force == NULL)
+ if (!force)
{
force = get_archetype (FORCE_NAME);
force->subtype = FORCE_CHANGE_ABILITY;
+
if (spell_ob->race)
force->name = spell_ob->race;
else
@@ -1439,11 +1416,11 @@
new_draw_info (NDI_UNIQUE, 0, op, "You recast the spell while in effect.");
}
else
- {
- new_draw_info (NDI_UNIQUE, 0, op, "Recasting the spell had no effect.");
- }
+ new_draw_info (NDI_UNIQUE, 0, op, "Recasting the spell had no effect.");
+
return 1;
}
+
force->duration = spell_ob->duration + SP_level_duration_adjust (caster, spell_ob) * 50;
force->speed = 1.f;
force->speed_left = -1.f;
@@ -1984,16 +1961,12 @@
return 1;
}
-
-
-
/* cast_cause_disease: this spell looks along from the
* player and infects someone.
* op is the player/monster, caster is the object, dir is the direction
* to cast, disease_arch is the specific disease, and type is the spell number
* perhaps this should actually be in disease.c?
*/
-
int
cast_cause_disease (object *op, object *caster, object *spell, int dir)
{
@@ -2010,6 +1983,7 @@
*/
if (!dir)
dir = op->facing;
+
if (!dir)
return 0; /* won't find anything if casting on ourself, so just return */
@@ -2053,7 +2027,7 @@
disease->stats.wc += dur_mod / 2;
if (disease->magic > 0)
- disease->magic += dur_mod / 4;
+ disease->magic += dur_mod / 8;
if (disease->stats.maxhp > 0)
disease->stats.maxhp += dur_mod;