summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-20 10:07:45 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-20 10:07:45 +0000
commit82abef2e72f839e3d3b75ec771cdfe8219761b20 (patch)
tree242d406f409e94f250fc2f3af1d60e9599dd7268 /crawl-ref
parentd7f1dd21aacab1548caf9315b035a5cedab29c5f (diff)
downloadcrawl-ref-82abef2e72f839e3d3b75ec771cdfe8219761b20.tar.gz
crawl-ref-82abef2e72f839e3d3b75ec771cdfe8219761b20.zip
Fix monsters capable of LOS attack behind glass walls being ignored.
Fix monsters behind glass walls being autotargetted for spells that need a path. Fix spacing in spl-data.h, and add some comments about commenting to coding_conventions.txt. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5148 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/docs/coding_conventions.txt158
-rw-r--r--crawl-ref/docs/options_guide.txt8
-rw-r--r--crawl-ref/source/directn.cc90
-rw-r--r--crawl-ref/source/misc.cc3
-rw-r--r--crawl-ref/source/mon-util.cc39
-rw-r--r--crawl-ref/source/mon-util.h24
-rw-r--r--crawl-ref/source/monstuff.cc46
-rw-r--r--crawl-ref/source/spl-cast.cc12
-rw-r--r--crawl-ref/source/spl-data.h674
-rw-r--r--crawl-ref/source/spl-util.cc30
10 files changed, 580 insertions, 504 deletions
diff --git a/crawl-ref/docs/coding_conventions.txt b/crawl-ref/docs/coding_conventions.txt
index bba1136611..2ffc15452d 100644
--- a/crawl-ref/docs/coding_conventions.txt
+++ b/crawl-ref/docs/coding_conventions.txt
@@ -2,7 +2,7 @@ Crawl coding conventions
========================
Introduction
-------------
+============
This file documents the style conventions currently in use in the crawl
codebase, as well as the conventions that new and/or modified code should
@@ -11,23 +11,26 @@ effectively" treatise. That is something best left to books and websites
and experience.
Conventions
------------
+===========
A) Indenting
+------------
Generally, use 4 spaces to indent, and indent with spaces only (no tabs).
+Empty lines don't need any spacing at all.
-Also, empty lines don't need any spacing at all.
+Methods
+-------
If the parameter list of a function runs longer than a line length (80 columns),
-the remaining parameters are indented in the lines below.
+the remaining parameters are usually indented in the lines below.
-static void replace_area( int sx, int sy, int ex, int ey,
- dungeon_feature_type replace,
- dungeon_feature_type feature, unsigned mapmask)
-{
-[...]
-}
+ static void replace_area( int sx, int sy, int ex, int ey,
+ dungeon_feature_type replace,
+ dungeon_feature_type feature, unsigned mapmask)
+ {
+ [...]
+ }
The same is true when a function is called:
@@ -41,6 +44,9 @@ There are cases where this is not possible because the parameters themselves
are too long for that, or because the function is already heavily indented,
but otherwise, this convention should be followed.
+Conditionals
+------------
+
In a switch conditional, the case listings don't have to be indented, though
the conditional statements should be.
@@ -61,62 +67,75 @@ the conditional statements should be.
break;
}
+Comparisons using the ? shortcut may be indented ...
+
+ mpr( forget_spell() ? "You have forgotten a spell!"
+ : "You get a splitting headache." );
+
+... but really short ones don't have to be.
+
+ beam.thrower = (cause) ? KILL_MISC : KILL_YOU;
+
+
B) Variable naming
+------------------
When naming variables, use underscores_as_spaces instead of mixedCase. Other
-conventions are pointed out by example, below:
+conventions are pointed out by example, below.
+Global variables are capitalized and underscored.
+Warning: there are currently many globals which don't do this.
-// - Global variables are capitalized and underscored.
-// Warning: there are currently many globals which don't do this.
-int Some_Global_Variable;
+ int Some_Global_Variable;
+Internal functions are prefixed with underscores.
+Warning: This is a new convention, so much code doesn't follow it.
-// - Internal functions are prefixed with underscores.
-// Warning: This is a new convention, so much code doesn't follow it.
-static void _remove_from_inventory(item_def* item);
+ static void _remove_from_inventory(item_def* item);
+Functions use underscores_as_spaces, but there are currently a lot of
+mixedCase functions.
-// - Functions use underscores_as_spaces, but there are currently
-// a lot of mixedCase functions.
-void destroy_item(item_def* item)
-{
- // - Variables use underscores too.
- int item_weight = /* ... */;
+ void destroy_item(item_def* item)
+ {
+ // - Variables use underscores too.
+ int item_weight = /* ... */;
+ }
-}
+There's no convention for class/struct names (yet?)
+ class TextDB
+ {
+ public:
+ // - No rules for static member functions; they're not used often anyway.
+ static void whatever();
-// - There's no convention for class/struct names (yet?)
-class TextDB
-{
- public:
- // - No rules for static member functions; they're not used often anyway.
- static void whatever();
+ // - Public member functions: named like functions.
+ void* get_value();
- // - Public member functions: named like functions.
- void* get_value();
+ private:
+ // - Internal member functions: also named like functions.
+ void _parse_text_file(const char*);
- private:
- // - Internal member functions: also named like functions.
- void _parse_text_file(const char*);
+ // - Member variables get a prefix.
+ DB* m_db;
- // - Member variables get a prefix.
- DB* m_db;
+ // - Static member variables get a prefix, too.
+ std::vector<DB*> sm_all_dbs;
+ };
- // - Static member variables get a prefix, too.
- std::vector<DB*> sm_all_dbs;
-};
+But structures tend to use underscores
+
+ struct coord_def
+ {
+ // - Simple structures don't need the "m_" prefixes
+ int x, y;
+ };
-// - But structures tend to use underscores
-struct coord_def
-{
- // - Simple structures don't need the "m_" prefixes
- int x, y;
-};
C) Braces
+---------
Braces are always put on their own lines.
@@ -161,7 +180,7 @@ Otherwise, place braces.
Also place braces if this is only the case because of one or more comment lines.
for (j = 0; j < num_to_make; j++)
- {
+ {
// places items (eg darts), which will automatically stack
itrap(beam, i);
}
@@ -196,7 +215,7 @@ may be omitted.
{
if (coinflip()) // neutrals speak half as often
return false;
-
+
prefixes.push_back("neutral");
}
else if (mons_friendly(monster))
@@ -248,3 +267,46 @@ leave a free line between them.
return coord_def(0, 0);
+
+D) Commenting
+-------------
+
+If you feel that a method is complicated enough to be difficult to understand,
+or has restrictions or effects that might not be obvious, add explanatory
+comments before it. You may sign your comments if you wish to.
+
+ // note that this function *completely* blocks messaging for monsters
+ // distant or invisible to the player ... look elsewhere for a function
+ // permitting output of "It" messages for the invisible {dlb}
+ // Intentionally avoids info and str_pass now. -- bwr
+ bool simple_monster_message(const monsters *monster, const char *event,
+ msg_channel_type channel, int param,
+ description_level_type descrip)
+ [...]
+
+Adding explanatory comments to somewhat complicated, already existing methods
+is very much welcome, as long as said comments are correct. :)
+
+Suboptimal code should be marked for later revision using the keywords "XXX",
+"FIXME" or "TODO", so that other coders can easily find it by searching the
+source. Also, some editors will highlight such keywords. Don't forget to add
+a comment about what should be changed, or to remove said comment if you fix
+the issue.
+
+ // XXX Unbelievably hacky. And to think that my goal was to clean up the code.
+ // Identical to find_square, except that input (tx, ty) and output
+ // (mfp) are in grid coordinates rather than view coordinates.
+ static char find_square_wrapper( int tx, int ty,
+ [...]
+
+
+ if (death_type == KILLED_BY_LEAVING
+ || death_type == KILLED_BY_WINNING)
+ {
+ // TODO: strcat "after reaching level %d"; for LEAVING
+ [...]
+
+
+ // FIXME: implement this for tiles
+ void update_monster_pane() {}
+
diff --git a/crawl-ref/docs/options_guide.txt b/crawl-ref/docs/options_guide.txt
index bc71862bed..85be2119a1 100644
--- a/crawl-ref/docs/options_guide.txt
+++ b/crawl-ref/docs/options_guide.txt
@@ -441,9 +441,11 @@ default_friendly_pickup = (none | friend | all)
when you start a new game, or when you enter a level for the first
time.
- Note that monsters have their own reasonings for which items they
- may need, and when they feel safe enough to pick them up. Except
- for "none", these options won't let you override this behaviour.
+ Note that this only works for permanent allies (such as you can
+ get when worshipping Beogh or the Shining One), and that monsters
+ have their own reasonings for which items they may need, and when
+ they feel safe enough to pick them up. Except for "none", these
+ options won't let you override these restrictions.
Also, friendly jellies won't ever eat any items, regardless of
this option.
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc
index 3d544e6ba7..1c14c2e8f6 100644
--- a/crawl-ref/source/directn.cc
+++ b/crawl-ref/source/directn.cc
@@ -86,23 +86,22 @@ enum LOSSelect
static void describe_feature(int mx, int my, bool oos);
static void describe_cell(int mx, int my);
-static bool find_object( int x, int y, int mode, int range );
-static bool find_monster( int x, int y, int mode, int range );
-static bool find_feature( int x, int y, int mode, int range );
+static bool find_object( int x, int y, int mode, bool need_path, int range );
+static bool find_monster( int x, int y, int mode, bool need_path, int range );
+static bool find_feature( int x, int y, int mode, bool need_path, int range );
static char find_square_wrapper( int tx, int ty,
FixedVector<char, 2> &mfp, char direction,
- bool (*targ)(int, int, int, int),
- int mode = TARG_ANY, int range = -1,
- bool wrap = false,
+ bool (*targ)(int, int, int, bool, int),
+ bool need_path = false, int mode = TARG_ANY,
+ int range = -1, bool wrap = false,
int los = LOS_ANY);
static char find_square( int xps, int yps,
FixedVector<char, 2> &mfp, int direction,
- bool (*targ)(int, int, int, int),
- int mode = TARG_ANY, int range = -1,
- bool wrap = false,
- int los = LOS_ANY);
+ bool (*targ)(int, int, int, bool, int),
+ bool need_path, int mode = TARG_ANY, int range = -1,
+ bool wrap = false, int los = LOS_ANY);
static int targeting_cmd_to_compass( command_type command );
static void describe_oos_square(int x, int y);
@@ -457,7 +456,7 @@ void direction(dist& moves, targeting_type restricts,
// NOTE: Even if just_looking is set, moves is still interesting,
// because we can travel there!
- if ( restricts == DIR_DIR )
+ if (restricts == DIR_DIR)
{
direction_choose_compass( moves, beh );
return;
@@ -478,7 +477,7 @@ void direction(dist& moves, targeting_type restricts,
moves.ty = you.y_pos;
// If we show the beam on startup, we have to initialise it.
- if ( show_beam )
+ if (show_beam)
find_ray(you.x_pos, you.y_pos, moves.tx, moves.ty, true, ray);
bool skip_iter = false;
@@ -629,7 +628,7 @@ void direction(dist& moves, targeting_type restricts,
case CMD_TARGET_DIR_UP_RIGHT:
i = targeting_cmd_to_compass(key_command);
- if ( restricts != DIR_TARGET )
+ if (restricts != DIR_TARGET)
{
// A direction is allowed, and we've selected it.
moves.dx = Compass[i].x;
@@ -704,9 +703,9 @@ void direction(dist& moves, targeting_type restricts,
{
const int thing_to_find = targeting_cmd_to_feature(key_command);
if (find_square_wrapper(moves.tx, moves.ty, objfind_pos, 1,
- find_feature, thing_to_find, range, true,
- Options.target_los_first ?
- LOS_FLIPVH : LOS_ANY))
+ find_feature, needs_path, thing_to_find,
+ range, true, Options.target_los_first ?
+ LOS_FLIPVH : LOS_ANY))
{
moves.tx = objfind_pos[0];
moves.ty = objfind_pos[1];
@@ -798,10 +797,10 @@ void direction(dist& moves, targeting_type restricts,
case CMD_TARGET_OBJ_CYCLE_FORWARD:
dir = (key_command == CMD_TARGET_OBJ_CYCLE_BACK) ? -1 : 1;
if (find_square_wrapper( moves.tx, moves.ty, objfind_pos, dir,
- find_object, 0, range, true,
- Options.target_los_first
- ? (dir == 1? LOS_FLIPVH : LOS_FLIPHV)
- : LOS_ANY))
+ find_object, needs_path, TARG_ANY, range,
+ true, Options.target_los_first ?
+ (dir == 1? LOS_FLIPVH : LOS_FLIPHV)
+ : LOS_ANY))
{
moves.tx = objfind_pos[0];
moves.ty = objfind_pos[1];
@@ -815,7 +814,7 @@ void direction(dist& moves, targeting_type restricts,
case CMD_TARGET_CYCLE_BACK:
dir = (key_command == CMD_TARGET_CYCLE_BACK) ? -1 : 1;
if (find_square_wrapper( moves.tx, moves.ty, monsfind_pos, dir,
- find_monster, mode, range,
+ find_monster, needs_path, mode, range,
Options.target_wrap))
{
moves.tx = monsfind_pos[0];
@@ -1141,7 +1140,8 @@ bool in_los(int x, int y)
return (in_vlos(grid2view(coord_def(x, y))));
}
-static bool find_monster( int x, int y, int mode, int range = -1)
+static bool find_monster( int x, int y, int mode, bool need_path,
+ int range = -1)
{
// target the player for friendly and general spells
if ((mode == TARG_FRIEND || mode == TARG_ANY)
@@ -1160,6 +1160,10 @@ static bool find_monster( int x, int y, int mode, int range = -1)
if (targ_mon == NON_MONSTER || !in_los(x,y))
return (false);
+ // Monster in LOS but only via glass walls, so no direct path.
+ if (need_path && !see_grid_no_trans(x,y))
+ return (false);
+
monsters *mon = &menv[targ_mon];
// Unknown mimics don't count as monsters, either.
@@ -1197,7 +1201,8 @@ static bool find_monster( int x, int y, int mode, int range = -1)
|| !mons_class_flag( menv[targ_mon].type, M_NO_EXP_GAIN ));
}
-static bool find_feature( int x, int y, int mode, int /* range */)
+static bool find_feature( int x, int y, int mode,
+ bool /* need_path */, int /* range */)
{
// The stair need not be in LOS if the square is mapped.
if (!in_los(x, y) && (!Options.target_oos || !is_terrain_seen(x, y)))
@@ -1206,7 +1211,8 @@ static bool find_feature( int x, int y, int mode, int /* range */)
return is_feature(mode, x, y);
}
-static bool find_object(int x, int y, int mode, int /* range */)
+static bool find_object(int x, int y, int mode,
+ bool /* need_path */, int /* range */)
{
// First, check for mimics.
bool is_mimic = false;
@@ -1299,8 +1305,10 @@ bool in_los_bounds(int x, int y)
//---------------------------------------------------------------
static char find_square( int xps, int yps,
FixedVector<char, 2> &mfp, int direction,
- bool (*find_targ)( int x, int y, int mode, int range ),
- int mode, int range, bool wrap, int los )
+ bool (*find_targ)( int x, int y, int mode,
+ bool need_path, int range ),
+ bool need_path, int mode, int range, bool wrap,
+ int los )
{
// the day will come when [unsigned] chars will be consigned to
// the fires of Gehenna. Not quite yet, though.
@@ -1364,19 +1372,21 @@ static char find_square( int xps, int yps,
{
if (direction == 1 && temp_xps == minx && temp_yps == maxy)
{
- if (find_targ(you.x_pos, you.y_pos, mode, range))
+ if (find_targ(you.x_pos, you.y_pos, mode, need_path, range))
{
mfp[0] = ctrx;
mfp[1] = ctry;
return (1);
}
- return find_square(ctrx, ctry, mfp, direction, find_targ, mode,
- range, false, next_los(direction, los, wrap));
+ return find_square(ctrx, ctry, mfp, direction, find_targ,
+ need_path, mode, range, false,
+ next_los(direction, los, wrap));
}
if (direction == -1 && temp_xps == ctrx && temp_yps == ctry)
{
- return find_square(minx, maxy, mfp, direction, find_targ, mode,
- range, false, next_los(direction, los, wrap));
+ return find_square(minx, maxy, mfp, direction, find_targ,
+ need_path, mode, range, false,
+ next_los(direction, los, wrap));
}
if (direction == 1)
@@ -1500,7 +1510,7 @@ static char find_square( int xps, int yps,
if ((onlyVis || onlyHidden) && onlyVis != in_los(targ_x, targ_y))
continue;
- if (find_targ(targ_x, targ_y, mode, range))
+ if (find_targ(targ_x, targ_y, mode, need_path, range))
{
mfp[0] = temp_xps;
mfp[1] = temp_yps;
@@ -1509,10 +1519,10 @@ static char find_square( int xps, int yps,
}
return (direction == 1?
- find_square(ctrx, ctry, mfp, direction, find_targ, mode, range, false,
- next_los(direction, los, wrap))
- : find_square(minx, maxy, mfp, direction, find_targ, mode, range, false,
- next_los(direction, los, wrap)));
+ find_square(ctrx, ctry, mfp, direction, find_targ, need_path, mode,
+ range, false, next_los(direction, los, wrap))
+ : find_square(minx, maxy, mfp, direction, find_targ, need_path, mode,
+ range, false, next_los(direction, los, wrap)));
}
// XXX Unbelievably hacky. And to think that my goal was to clean up the code.
@@ -1521,11 +1531,13 @@ static char find_square( int xps, int yps,
static char find_square_wrapper( int tx, int ty,
FixedVector<char, 2> &mfp, char direction,
bool (*find_targ)( int x, int y, int mode,
- int range ),
- int mode, int range, bool wrap, int los )
+ bool need_path, int range ),
+ bool need_path, int mode, int range, bool wrap,
+ int los )
{
const char r = find_square(grid2viewX(tx), grid2viewY(ty), mfp,
- direction, find_targ, mode, range, wrap, los);
+ direction, find_targ, need_path, mode, range,
+ wrap, los);
mfp[0] = view2gridX(mfp[0]);
mfp[1] = view2gridY(mfp[1]);
return r;
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index a3e8006ab6..f96865f093 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -2584,7 +2584,8 @@ bool mons_is_safe(const struct monsters *mon, bool want_move)
|| mons_class_flag(mon->type, M_NO_EXP_GAIN)
// only seen through glass walls
|| !see_grid_no_trans(mon->x, mon->y)
- && !mons_has_ranged_spell(mon));
+ && !mons_has_ranged_spell(mon)
+ && !mons_has_los_ability(mon->type));
#ifdef CLUA_BINDINGS
bool moving = (!you.delay_queue.empty()
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 0906dbd7e9..df192c7a9b 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -2075,18 +2075,6 @@ bool mons_should_fire(struct bolt &beam)
100));
}
-// used to determine whether or not a monster should always
-// fire this spell if selected. If not, we should use a
-// tracer.
-
-// note - this function assumes that the monster is "nearby"
-// its target!
-
-bool ms_requires_tracer(spell_type monspell)
-{
- return (spell_needs_tracer(monspell));
-}
-
// returns true if the spell is something you wouldn't want done if
// you had a friendly target.. only returns a meaningful value for
// non-beam spells
@@ -2362,12 +2350,35 @@ bool mons_is_magic_user( const monsters *mon )
return (false);
}
+// Returns true if the monster has an ability that only needs LOS to
+// affect the target.
+bool mons_has_los_ability( int mclass )
+{
+ // These two have Torment, but are handled specially.
+ if (mclass == MONS_FIEND || mclass == MONS_PIT_FIEND)
+ return (true);
+
+ // These eyes only need LOS, as well. (The other eyes use spells.)
+ if (mclass == MONS_GIANT_EYEBALL || mclass == MONS_EYE_OF_DRAINING)
+ return (true);
+
+ // Although not using spells, these are exceedingly dangerous.
+ if (mclass == MONS_SILVER_STATUE || mclass == MONS_ORANGE_STATUE)
+ return (true);
+
+ // Beholding just needs LOS.
+ if (mclass == MONS_MERMAID)
+ return (true);
+
+ return (false);
+}
+
bool mons_has_ranged_spell( const monsters *mon )
{
const int mclass = mon->type;
- // These two have Torment, but are handled specially.
- if (mclass == MONS_FIEND || mclass == MONS_PIT_FIEND)
+ // Monsters may have spell like abilities.
+ if (mons_has_los_ability(mclass))
return (true);
if (mons_class_flag( mclass, M_SPELLCASTER ))
diff --git a/crawl-ref/source/mon-util.h b/crawl-ref/source/mon-util.h
index d2b50087a4..2a75ff66c6 100644
--- a/crawl-ref/source/mon-util.h
+++ b/crawl-ref/source/mon-util.h
@@ -19,16 +19,16 @@
enum corpse_effect_type
{
- CE_NOCORPSE, // 0
- CE_CLEAN, // 1
- CE_CONTAMINATED, // 2
- CE_POISONOUS, // 3
- CE_HCL, // 4
- CE_MUTAGEN_RANDOM, // 5
- CE_MUTAGEN_GOOD, // 6 - may be worth implementing {dlb}
- CE_MUTAGEN_BAD, // 7 - may be worth implementing {dlb}
- CE_RANDOM, // 8 - not used, but may be worth implementing {dlb}
- CE_ROTTEN = 50 // 50 - must remain at 50 for now {dlb}
+ CE_NOCORPSE, // 0
+ CE_CLEAN, // 1
+ CE_CONTAMINATED, // 2
+ CE_POISONOUS, // 3
+ CE_HCL, // 4
+ CE_MUTAGEN_RANDOM, // 5
+ CE_MUTAGEN_GOOD, // 6 - may be worth implementing {dlb}
+ CE_MUTAGEN_BAD, // 7 - may be worth implementing {dlb}
+ CE_RANDOM, // 8 - not used, but may be worth implementing {dlb}
+ CE_ROTTEN = 50 // 50 - must remain at 50 for now {dlb}
};
enum gender_type
@@ -596,16 +596,16 @@ bool ms_direct_nasty(spell_type monspell);
/* ***********************************************************************
* called from: monstuff
* *********************************************************************** */
-bool ms_requires_tracer(spell_type mons_spell);
bool ms_useful_fleeing_out_of_sight( const monsters *mon, spell_type monspell );
bool ms_quick_get_away( const monsters *mon, spell_type monspell );
bool ms_waste_of_time( const monsters *mon, spell_type monspell );
bool ms_low_hitpoint_cast( const monsters *mon, spell_type monspell );
+bool mons_is_magic_user( const monsters *mon );
+bool mons_has_los_ability( int mclass );
bool mons_has_ranged_spell( const monsters *mon );
bool mons_has_ranged_attack( const monsters *mon );
-bool mons_is_magic_user( const monsters *mon );
// last updated 06mar2001 (gdl)
/* ***********************************************************************
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 6ab7630b0c..acdf66aef3 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -3028,17 +3028,17 @@ static bool _handle_special_ability(monsters *monster, bolt & beem)
break;
// setup tracer
- beem.name = "glob of lava";
- beem.range = 4;
- beem.rangeMax = 13;
- beem.damage = dice_def( 3, 10 );
- beem.colour = RED;
- beem.type = dchar_glyph(DCHAR_FIRED_ZAP);
- beem.flavour = BEAM_LAVA;
- beem.hit = 20;
+ beem.name = "glob of lava";
+ beem.aux_source = "glob of lava";
+ beem.range = 4;
+ beem.rangeMax = 13;
+ beem.damage = dice_def( 3, 10 );
+ beem.hit = 20;
+ beem.colour = RED;
+ beem.type = dchar_glyph(DCHAR_FIRED_ZAP);
+ beem.flavour = BEAM_LAVA;
beem.beam_source = monster_index(monster);
- beem.thrower = KILL_MON;
- beem.aux_source = "glob of lava";
+ beem.thrower = KILL_MON;
// fire tracer
fire_tracer(monster, beem);
@@ -3069,18 +3069,18 @@ static bool _handle_special_ability(monsters *monster, bolt & beem)
break;
// setup tracer
- beem.name = "bolt of electricity";
- beem.damage = dice_def( 3, 6 );
- beem.colour = LIGHTCYAN;
- beem.type = dchar_glyph(DCHAR_FIRED_ZAP);
- beem.flavour = BEAM_ELECTRICITY;
- beem.hit = 50;
+ beem.name = "bolt of electricity";
+ beem.aux_source = "bolt of electricity";
+ beem.range = 4;
+ beem.rangeMax = 13;
+ beem.damage = dice_def( 3, 6 );
+ beem.hit = 50;
+ beem.colour = LIGHTCYAN;
+ beem.type = dchar_glyph(DCHAR_FIRED_ZAP);
+ beem.flavour = BEAM_ELECTRICITY;
beem.beam_source = monster_index(monster);
- beem.thrower = KILL_MON;
- beem.aux_source = "bolt of electricity";
- beem.range = 4;
- beem.rangeMax = 13;
- beem.is_beam = true;
+ beem.thrower = KILL_MON;
+ beem.is_beam = true;
// fire tracer
fire_tracer(monster, beem);
@@ -3211,6 +3211,7 @@ static bool _handle_special_ability(monsters *monster, bolt & beem)
// set up the beam
beem.name = "volley of spikes";
+ beem.aux_source = "volley of spikes";
beem.range = 9;
beem.rangeMax = 9;
beem.hit = 14;
@@ -3220,7 +3221,6 @@ static bool _handle_special_ability(monsters *monster, bolt & beem)
beem.colour = LIGHTGREY;
beem.flavour = BEAM_MISSILE;
beem.thrower = KILL_MON;
- beem.aux_source = "volley of spikes";
beem.is_beam = false;
// fire tracer
@@ -4290,7 +4290,7 @@ static bool _handle_spell( monsters *monster, bolt & beem )
setup_mons_cast(monster, beem, spell_cast);
// beam-type spells requiring tracers
- if (ms_requires_tracer(spell_cast))
+ if (spell_needs_tracer(spell_cast))
{
fire_tracer(monster, beem);
// good idea?
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index 718efc2675..6f69da5c9e 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -976,16 +976,16 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
else if (dir == DIR_DIR)
mpr(prompt? prompt : "Which direction? ", MSGCH_PROMPT);
- const bool needs_path =
- !(testbits(flags, SPFLAG_GRID) || testbits(flags, SPFLAG_TARGET));
+ const bool needs_path = (!testbits(flags, SPFLAG_GRID)
+ && !testbits(flags, SPFLAG_TARGET));
- if ( !spell_direction( spd, beam, dir, targ, needs_path, prompt ) )
+ if (!spell_direction( spd, beam, dir, targ, needs_path, prompt ))
return (SPRET_ABORT);
if (testbits( flags, SPFLAG_NOT_SELF ) && spd.isMe)
{
if (spell == SPELL_TELEPORT_OTHER || spell == SPELL_HEAL_OTHER
- || spell == SPELL_POLYMORPH_OTHER)
+ || spell == SPELL_POLYMORPH_OTHER)
{
mpr( "Sorry, this spell works on others only." );
}
@@ -2188,7 +2188,7 @@ static void _miscast_conjuration(int severity, const char* cause)
beam.aux_source.clear();
if (cause)
beam.aux_source = cause;
- beam.ex_size = coinflip()?1:2;
+ beam.ex_size = coinflip() ? 1 : 2;
beam.is_explosion = true;
explosion(beam);
@@ -2689,7 +2689,7 @@ static void _miscast_divination(int severity, const char* cause)
{
case 0:
mpr( forget_spell() ? "You have forgotten a spell!"
- : "You get a splitting headache." );
+ : "You get a splitting headache." );
break;
case 1:
mpr("You feel completely lost.");
diff --git a/crawl-ref/source/spl-data.h b/crawl-ref/source/spl-data.h
index d065a80862..7a1b0fa4cf 100644
--- a/crawl-ref/source/spl-data.h
+++ b/crawl-ref/source/spl-data.h
@@ -108,16 +108,7 @@
I don't plan to implement a 'Poisoner' class, as it would become unplayable
deep in the dungeon where most monsters are poison resistant.
- Many spells use magic from two types. These spells are equally
- available to either type; a conjurer is no worse at a fire/conjuration than
- at a pure conjuration. I guess a spell could be of three types, but they
- would have to be types with short names (limited space in the spell
- windows).
- - Note : this is no longer true, with the implementation of magic skills.
- Your skill for a spell is effectively the average of all types used in it.
- Poison has no skills, but still has a staff
-
-
+ Your skill for a spell is effectively the average of all schools used in it.
*/
/*
@@ -140,13 +131,13 @@
{
SPELL_IDENTIFY, "Identify",
- SPTYP_DIVINATION,
- SPFLAG_NONE,
- 6,
- 0,
- NULL,
- false,
- true
+ SPTYP_DIVINATION,
+ SPFLAG_NONE,
+ 6,
+ 0,
+ NULL,
+ false,
+ true
},
{
@@ -216,66 +207,66 @@
},
{
- SPELL_SWAP, "Swap",
- SPTYP_TRANSLOCATION,
- SPFLAG_NONE,
- 4,
- 0,
- NULL,
- false,
- false
+ SPELL_SWAP, "Swap",
+ SPTYP_TRANSLOCATION,
+ SPFLAG_NONE,
+ 4,
+ 0,
+ NULL,
+ false,
+ false
},
{
- SPELL_APPORTATION, "Apportation",
- SPTYP_TRANSLOCATION,
- SPFLAG_NONE,
- 1,
- 1000,
- NULL,
- false,
- false
+ SPELL_APPORTATION, "Apportation",
+ SPTYP_TRANSLOCATION,
+ SPFLAG_NONE,
+ 1,
+ 1000,
+ NULL,
+ false,
+ false
},
{
- SPELL_TWIST, "Twist",
- SPTYP_TRANSLOCATION,
- SPFLAG_DIR_OR_TARGET | SPFLAG_NOT_SELF,
- 1,
- 25,
- NULL,
- true
+ SPELL_TWIST, "Twist",
+ SPTYP_TRANSLOCATION,
+ SPFLAG_DIR_OR_TARGET | SPFLAG_NOT_SELF,
+ 1,
+ 25,
+ NULL,
+ true
},
{
- SPELL_FAR_STRIKE, "Far Strike",
- SPTYP_TRANSLOCATION,
- SPFLAG_DIR_OR_TARGET | SPFLAG_NOT_SELF,
- 3,
- 100,
- NULL,
- true
+ SPELL_FAR_STRIKE, "Far Strike",
+ SPTYP_TRANSLOCATION,
+ SPFLAG_DIR_OR_TARGET | SPFLAG_NOT_SELF,
+ 3,
+ 100,
+ NULL,
+ true
},
{
- SPELL_DELAYED_FIREBALL, "Delayed Fireball",
- SPTYP_FIRE | SPTYP_CONJURATION,
- SPFLAG_NONE,
- 7,
- 0,
+ SPELL_DELAYED_FIREBALL, "Delayed Fireball",
+ SPTYP_FIRE | SPTYP_CONJURATION,
+ SPFLAG_NONE,
+ 7,
+ 0,
NULL,
false,
- false
+ false
},
{
- SPELL_STRIKING, "Striking",
- 0,
- SPFLAG_DIR_OR_TARGET,
- 1,
- 25,
- NULL,
- true
+ SPELL_STRIKING, "Striking",
+ 0,
+ SPFLAG_DIR_OR_TARGET,
+ 1,
+ 25,
+ NULL,
+ true
},
{
@@ -286,7 +277,7 @@
100,
NULL,
false,
- false
+ false
},
{
@@ -365,8 +356,8 @@
SPTYP_ENCHANTMENT,
SPFLAG_DIR_OR_TARGET | SPFLAG_HELPFUL,
6, // lowered to 6 from 8, since it's easily available from various items
- // and Swiftness is level 2 (and gives a similar effect). It's also
- // not that much better than Invisibility. -- bwr
+ // and Swiftness is level 2 (and gives a similar effect). It's also
+ // not that much better than Invisibility. -- bwr
200,
NULL,
false,
@@ -432,7 +423,7 @@
0,
NULL,
false,
- false
+ false
},
{
@@ -463,7 +454,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -474,7 +465,7 @@
0,
NULL,
false,
- false
+ false
},
{
@@ -485,7 +476,7 @@
0,
NULL,
false,
- false
+ false
},
{
@@ -496,7 +487,7 @@
0,
NULL,
false,
- false
+ false
},
{
@@ -548,7 +539,7 @@
0,
NULL,
false,
- false
+ false
},
{
@@ -559,7 +550,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -570,7 +561,7 @@
0,
NULL,
false,
- false
+ false
},
{
@@ -581,7 +572,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -592,7 +583,7 @@
0,
NULL,
false,
- false
+ false
},
{
@@ -603,7 +594,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -614,7 +605,7 @@
200,
"Smite whom?",
false,
- false
+ false
},
{
@@ -625,7 +616,7 @@
0,
NULL,
false,
- false
+ false
},
{
@@ -636,7 +627,7 @@
0,
NULL,
false,
- false
+ false
},
{
@@ -647,7 +638,7 @@
0,
NULL,
false,
- false
+ false
},
{
@@ -658,7 +649,7 @@
80,
NULL,
false,
- false
+ false
},
{
@@ -669,7 +660,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -680,7 +671,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -691,7 +682,7 @@
150,
NULL,
false,
- false
+ false
},
{
@@ -732,8 +723,7 @@
200,
"Where do you want to put it?",
true
-}
-,
+},
{
SPELL_FIRE_STORM, "Fire Storm",
@@ -753,7 +743,7 @@
50,
NULL,
false,
- false
+ false
},
{
@@ -767,7 +757,6 @@
true
},
-
// The following name was found in the hack.exe file of an early version
// of PCHACK - credit goes to its creator (whoever that may be):
{
@@ -788,7 +777,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -799,7 +788,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -835,7 +824,7 @@
},
{
- SPELL_ANIMATE_DEAD, "Animate Dead",
+ SPELL_ANIMATE_DEAD, "Animate Dead",
SPTYP_NECROMANCY,
SPFLAG_NONE,
4,
@@ -863,7 +852,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -884,7 +873,7 @@
0,
NULL,
false,
- false
+ false
},
{
@@ -895,7 +884,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -906,7 +895,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -917,7 +906,7 @@
50,
NULL,
false,
- false
+ false
},
{
@@ -928,7 +917,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -939,7 +928,7 @@
25,
NULL,
false,
- false
+ false
},
{
@@ -950,7 +939,7 @@
25,
NULL,
false,
- false
+ false
},
{
@@ -961,7 +950,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -992,7 +981,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1003,7 +992,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1014,7 +1003,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1025,7 +1014,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1036,7 +1025,7 @@
0,
NULL,
false,
- false
+ false
},
{
@@ -1057,7 +1046,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1068,7 +1057,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1100,7 +1089,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1111,7 +1100,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1122,28 +1111,28 @@
200,
NULL,
false,
- false
+ false
},
{
- SPELL_FULSOME_DISTILLATION, "Fulsome Distillation",
- SPTYP_TRANSMIGRATION | SPTYP_NECROMANCY,
- SPFLAG_NONE,
- 1,
- 50,
+ SPELL_FULSOME_DISTILLATION, "Fulsome Distillation",
+ SPTYP_TRANSMIGRATION | SPTYP_NECROMANCY,
+ SPFLAG_NONE,
+ 1,
+ 50,
NULL,
false,
- false
+ false
},
{
- SPELL_POISON_ARROW, "Poison Arrow",
- SPTYP_CONJURATION | SPTYP_POISON,
- SPFLAG_DIR_OR_TARGET,
- 6,
- 200,
- NULL,
- true
+ SPELL_POISON_ARROW, "Poison Arrow",
+ SPTYP_CONJURATION | SPTYP_POISON,
+ SPFLAG_DIR_OR_TARGET,
+ 6,
+ 200,
+ NULL,
+ true
},
{
@@ -1154,7 +1143,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1165,7 +1154,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1196,7 +1185,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1217,7 +1206,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1228,7 +1217,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1238,7 +1227,7 @@
9,
200,
NULL,
- true
+ true
},
{
@@ -1249,7 +1238,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1260,7 +1249,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1271,7 +1260,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1282,7 +1271,7 @@
0,
NULL,
false,
- false
+ false
},
{
@@ -1293,7 +1282,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1304,7 +1293,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1315,7 +1304,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1326,7 +1315,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1337,7 +1326,7 @@
25,
NULL,
false,
- false
+ false
},
{
@@ -1368,7 +1357,7 @@
0,
NULL,
false,
- false
+ false
}
,
@@ -1380,7 +1369,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1401,7 +1390,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1412,7 +1401,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1423,7 +1412,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1444,7 +1433,7 @@
60, // not 50, note the fuzz
NULL,
false,
- false
+ false
},
{
@@ -1455,9 +1444,8 @@
200,
NULL,
false,
- false
-}
-,
+ false
+},
{
SPELL_CONTROL_TELEPORT, "Control Teleport",
@@ -1467,7 +1455,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1478,9 +1466,8 @@
0,
NULL,
false,
- false
-}
-,
+ false
+},
{
SPELL_POISON_WEAPON, "Poison Weapon",
@@ -1490,7 +1477,7 @@
0,
NULL,
false,
- false
+ false
},
{
@@ -1501,7 +1488,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1512,7 +1499,7 @@
0,
NULL,
false,
- false
+ false
},
{
@@ -1523,7 +1510,7 @@
0,
NULL,
false,
- false
+ false
},
{
@@ -1534,7 +1521,7 @@
100,
NULL,
false,
- false
+ false
},
{
@@ -1545,7 +1532,7 @@
0,
NULL,
false,
- false
+ false
},
{
@@ -1556,7 +1543,7 @@
0,
NULL,
false,
- false
+ false
},
{
@@ -1567,7 +1554,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1578,7 +1565,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1589,7 +1576,7 @@
25,
NULL,
false,
- false
+ false
},
{
@@ -1610,7 +1597,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1621,7 +1608,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1632,7 +1619,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1643,7 +1630,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1654,7 +1641,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1665,7 +1652,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1676,7 +1663,7 @@
0,
NULL,
false,
- false
+ false
},
{
@@ -1687,7 +1674,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1728,7 +1715,7 @@
25,
NULL,
false,
- false
+ false
},
{
@@ -1739,7 +1726,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1750,8 +1737,7 @@
0,
NULL,
false
-}
-,
+},
{
SPELL_CONFUSING_TOUCH, "Confusing Touch",
@@ -1761,7 +1747,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1772,11 +1758,9 @@
200,
NULL,
false,
- false
+ false
},
- //jmf: new spells
-
{
SPELL_FLAME_TONGUE, "Flame Tongue",
SPTYP_CONJURATION | SPTYP_FIRE,
@@ -1785,7 +1769,7 @@
25,
NULL,
false,
- false
+ false
},
{
@@ -1796,7 +1780,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1807,7 +1791,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1818,7 +1802,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1829,7 +1813,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1840,7 +1824,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1851,7 +1835,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1872,7 +1856,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1883,7 +1867,7 @@
0,
NULL,
false,
- false
+ false
},
{
@@ -1894,7 +1878,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1905,7 +1889,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1916,7 +1900,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1927,7 +1911,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1938,7 +1922,7 @@
0,
NULL,
false,
- false
+ false
},
{
@@ -1949,7 +1933,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1960,7 +1944,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1971,7 +1955,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1982,7 +1966,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -1993,7 +1977,7 @@
100,
NULL,
false,
- false
+ false
},
{
@@ -2014,7 +1998,7 @@
0,
NULL,
false,
- false
+ false
},
{
@@ -2035,7 +2019,7 @@
0,
NULL,
false,
- false
+ false
},
{
@@ -2046,7 +2030,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -2057,7 +2041,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -2078,7 +2062,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -2089,7 +2073,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -2100,7 +2084,7 @@
200,
NULL,
false,
- false
+ false
},
{
@@ -2111,51 +2095,51 @@
100,
NULL,
false,
- false
+ false
},
{
- SPELL_STONESKIN, "Stoneskin",
- SPTYP_EARTH | SPTYP_TRANSMIGRATION, // was ench -- bwr
- SPFLAG_NONE,
- 2,
- 200,
+ SPELL_STONESKIN, "Stoneskin",
+ SPTYP_EARTH | SPTYP_TRANSMIGRATION, // was ench -- bwr
+ SPFLAG_NONE,
+ 2,
+ 200,
NULL,
false,
- false
+ false
},
{
- SPELL_SIMULACRUM, "Simulacrum",
- SPTYP_ICE | SPTYP_NECROMANCY,
- SPFLAG_NONE,
- 6,
- 200,
+ SPELL_SIMULACRUM, "Simulacrum",
+ SPTYP_ICE | SPTYP_NECROMANCY,
+ SPFLAG_NONE,
+ 6,
+ 200,
NULL,
false,
- false
+ false
},
{
- SPELL_CONJURE_BALL_LIGHTNING, "Conjure Ball Lightning",
- SPTYP_AIR | SPTYP_CONJURATION,
- SPFLAG_NONE,
- 7,
- 200,
+ SPELL_CONJURE_BALL_LIGHTNING, "Conjure Ball Lightning",
+ SPTYP_AIR | SPTYP_CONJURATION,
+ SPFLAG_NONE,
+ 7,
+ 200,
NULL,
false,
- false
+ false
},
{
- SPELL_CHAIN_LIGHTNING, "Chain Lightning",
- SPTYP_AIR | SPTYP_CONJURATION,
- SPFLAG_NONE,
- 8,
- 200,
+ SPELL_CHAIN_LIGHTNING, "Chain Lightning",
+ SPTYP_AIR | SPTYP_CONJURATION,
+ SPFLAG_NONE,
+ 8,
+ 200,
NULL,
false,
- false
+ false
},
{
@@ -2166,29 +2150,29 @@
200,
NULL,
false,
- false
+ false
},
{
SPELL_PORTAL_PROJECTILE, "Portal Projectile",
- SPTYP_TRANSLOCATION,
- SPFLAG_TARGET,
- 2,
- 50,
- NULL,
- false,
- false
+ SPTYP_TRANSLOCATION,
+ SPFLAG_TARGET,
+ 2,
+ 50,
+ NULL,
+ false,
+ false
},
{
SPELL_SUMMON_UGLY_THING, "Summon Ugly Thing",
- SPTYP_SUMMONING,
- SPFLAG_NONE,
- 5,
- 200,
- NULL,
- false,
- false
+ SPTYP_SUMMONING,
+ SPFLAG_NONE,
+ 5,
+ 200,
+ NULL,
+ false,
+ false
},
{
@@ -2199,174 +2183,174 @@
200,
NULL,
false,
- false
+ false
},
{
SPELL_VAMPIRE_SUMMON, "Vampire Summon",
- SPTYP_SUMMONING,
- SPFLAG_UNHOLY,
- 3,
- 0,
- NULL,
- false,
- false
+ SPTYP_SUMMONING,
+ SPFLAG_UNHOLY,
+ 3,
+ 0,
+ NULL,
+ false,
+ false
},
{
SPELL_BRAIN_FEED, "Brain Feed",
- SPTYP_NECROMANCY,
- SPFLAG_UNHOLY,
- 3,
- 0,
- NULL,
- false,
- false
+ SPTYP_NECROMANCY,
+ SPFLAG_UNHOLY,
+ 3,
+ 0,
+ NULL,
+ false,
+ false
},
{
SPELL_FAKE_RAKSHASA_SUMMON, "Rakshasa Summon",
- SPTYP_SUMMONING | SPTYP_NECROMANCY,
- SPFLAG_UNHOLY,
- 3,
- 0,
- NULL,
- false
+ SPTYP_SUMMONING | SPTYP_NECROMANCY,
+ SPFLAG_UNHOLY,
+ 3,
+ 0,
+ NULL,
+ false
},
{
SPELL_STEAM_BALL, "Steam Ball",
- SPTYP_CONJURATION | SPTYP_FIRE,
- SPFLAG_DIR_OR_TARGET,
- 4,
- 0,
- NULL,
- true
+ SPTYP_CONJURATION | SPTYP_FIRE,
+ SPFLAG_DIR_OR_TARGET,
+ 4,
+ 0,
+ NULL,
+ true
},
{
SPELL_SUMMON_UFETUBUS, "Summon Ufetubus",
- SPTYP_SUMMONING,
- SPFLAG_UNHOLY,
- 4,
- 0,
- NULL,
- false,
- false
+ SPTYP_SUMMONING,
+ SPFLAG_UNHOLY,
+ 4,
+ 0,
+ NULL,
+ false,
+ false
},
{
SPELL_SUMMON_BEAST, "Summon Beast",
- SPTYP_SUMMONING,
- SPFLAG_UNHOLY,
- 4,
- 0,
- NULL,
- false
+ SPTYP_SUMMONING,
+ SPFLAG_UNHOLY,
+ 4,
+ 0,
+ NULL,
+ false
},
{
SPELL_ENERGY_BOLT, "Energy Bolt",
- SPTYP_CONJURATION,
- SPFLAG_DIR_OR_TARGET,
- 4,
- 0,
- NULL,
- true
+ SPTYP_CONJURATION,
+ SPFLAG_DIR_OR_TARGET,
+ 4,
+ 0,
+ NULL,
+ true
},
{
SPELL_POISON_SPLASH, "Poison Splash",
- SPTYP_POISON,
- SPFLAG_DIR_OR_TARGET,
- 2,
- 0,
- NULL,
- true
+ SPTYP_POISON,
+ SPFLAG_DIR_OR_TARGET,
+ 2,
+ 0,
+ NULL,
+ true
},
{
SPELL_SUMMON_UNDEAD, "Summon Undead",
- SPTYP_SUMMONING | SPTYP_NECROMANCY,
- SPFLAG_NONE,
- 7,
- 0,
- NULL,
- false,
- false,
+ SPTYP_SUMMONING | SPTYP_NECROMANCY,
+ SPFLAG_NONE,
+ 7,
+ 0,
+ NULL,
+ false,
+ false,
},
{
SPELL_CANTRIP, "Cantrip",
- SPTYP_NONE,
- SPFLAG_NONE,
- 1,
- 0,
- NULL,
- false,
- false
+ SPTYP_NONE,
+ SPFLAG_NONE,
+ 1,
+ 0,
+ NULL,
+ false,
+ false
},
{
SPELL_QUICKSILVER_BOLT, "Quicksilver Bolt",
- SPTYP_CONJURATION,
- SPFLAG_DIR_OR_TARGET,
- 5,
- 0,
- NULL,
- true
+ SPTYP_CONJURATION,
+ SPFLAG_DIR_OR_TARGET,
+ 5,
+ 0,
+ NULL,
+ true
},
{
SPELL_METAL_SPLINTERS, "Metal Splinters",
- SPTYP_CONJURATION,
- SPFLAG_DIR_OR_TARGET,
- 5,
- 0,
- NULL,
- true
+ SPTYP_CONJURATION,
+ SPFLAG_DIR_OR_TARGET,
+ 5,
+ 0,
+ NULL,
+ true
},
{
SPELL_MIASMA, "Miasma",
- SPTYP_CONJURATION | SPTYP_NECROMANCY,
- SPFLAG_DIR_OR_TARGET,
- 6,
- 0,
- NULL,
- true
+ SPTYP_CONJURATION | SPTYP_NECROMANCY,
+ SPFLAG_DIR_OR_TARGET,
+ 6,
+ 0,
+ NULL,
+ true
},
{
SPELL_SUMMON_DRAKES, "Summon Drakes",
- SPTYP_SUMMONING,
- SPFLAG_NONE,
- 6,
- 0,
- NULL,
- false,
- false
+ SPTYP_SUMMONING,
+ SPFLAG_NONE,
+ 6,
+ 0,
+ NULL,
+ false,
+ false
},
{
SPELL_BLINK_OTHER, "Blink Other",
- SPTYP_TRANSLOCATION,
- SPFLAG_NONE,
- 2,
- 0,
- NULL,
- true
+ SPTYP_TRANSLOCATION,
+ SPFLAG_NONE,
+ 2,
+ 0,
+ NULL,
+ true
},
{
SPELL_SUMMON_MUSHROOMS, "Summon Mushrooms",
- SPTYP_SUMMONING,
- SPFLAG_NONE,
- 4,
- 0,
- NULL,
- false,
- false
+ SPTYP_SUMMONING,
+ SPFLAG_NONE,
+ 4,
+ 0,
+ NULL,
+ false,
+ false
},
{
diff --git a/crawl-ref/source/spl-util.cc b/crawl-ref/source/spl-util.cc
index f590cfdab9..13622f1e73 100644
--- a/crawl-ref/source/spl-util.cc
+++ b/crawl-ref/source/spl-util.cc
@@ -69,7 +69,7 @@ void init_spell_descs(void)
spell_list[i] = -1;
// can only use up to SPELLDATASIZE _MINUS ONE_, or the
- // last entry tries to set spell_list[SPELL_NO_SPELL]
+ // last entry tries to set spell_list[SPELL_NO_SPELL]
// which corrupts the heap.
for (unsigned int i = 0; i < SPELLDATASIZE - 1; i++)
spell_list[spelldata[i].id] = i;
@@ -86,7 +86,7 @@ void init_spell_name_cache()
if (!is_valid_spell(type))
continue;
-
+
const char *sptitle = spell_title(type);
ASSERT(sptitle);
const std::string spell_name = lowercase_string(sptitle);
@@ -116,7 +116,7 @@ spell_type spell_by_name(std::string name, bool partial_match)
spell_type type = static_cast<spell_type>(i);
if (!is_valid_spell(type))
continue;
-
+
const char *sptitle = spell_title(type);
const std::string spell_name = lowercase_string(sptitle);
@@ -220,6 +220,10 @@ int spell_hunger(spell_type which_spell)
return hunger;
}
+// Used to determine whether or not a monster should always fire this spell
+// if selected. If not, we should use a tracer.
+
+// Note - this function assumes that the monster is "nearby" its target!
bool spell_needs_tracer(spell_type spell)
{
return (_seekspell(spell)->ms_needs_tracer);
@@ -333,7 +337,7 @@ int apply_area_visible( int (*func) (int, int, int, int), int power,
// Applies the effect to all nine squares around/including the target.
// Returns summation of return values from passed in function.
-int apply_area_square( int (*func) (int, int, int, int), int cx, int cy,
+int apply_area_square( int (*func) (int, int, int, int), int cx, int cy,
int power )
{
int x, y;
@@ -353,7 +357,7 @@ int apply_area_square( int (*func) (int, int, int, int), int cx, int cy,
// Applies the effect to the eight squares beside the target.
// Returns summation of return values from passed in function.
-int apply_area_around_square( int (*func) (int, int, int, int),
+int apply_area_around_square( int (*func) (int, int, int, int),
int targ_x, int targ_y, int power)
{
int x, y;
@@ -375,7 +379,7 @@ int apply_area_around_square( int (*func) (int, int, int, int),
// Effect up to max_targs monsters around a point, chosen randomly
// Return varies with the function called; return values will be added up.
int apply_random_around_square( int (*func) (int, int, int, int),
- int targ_x, int targ_y,
+ int targ_x, int targ_y,
bool hole_in_middle, int power, int max_targs )
{
int rv = 0;
@@ -400,15 +404,15 @@ int apply_random_around_square( int (*func) (int, int, int, int),
{
for (int y = targ_y - 1; y <= targ_y + 1; y++)
{
- if (hole_in_middle && (x == targ_x && y == targ_y))
+ if (hole_in_middle && (x == targ_x && y == targ_y))
continue;
- if (mgrd[x][y] == NON_MONSTER
+ if (mgrd[x][y] == NON_MONSTER
&& !(x == you.x_pos && y == you.y_pos))
{
continue;
}
-
+
// Found target
count++;
@@ -486,7 +490,7 @@ int apply_random_around_square( int (*func) (int, int, int, int),
}
else if (random2( count ) < max_targs)
{
- const int pick = random2( max_targs );
+ const int pick = random2( max_targs );
targs[ pick ].x = x;
targs[ pick ].y = y;
}
@@ -749,7 +753,7 @@ void apply_area_cloud( int (*func) (int, int, int, int, cloud_type,
// Select a spell direction and fill dist and pbolt appropriately.
// Return false if the user canceled, true otherwise.
-bool spell_direction( dist &spelld, bolt &pbolt,
+bool spell_direction( dist &spelld, bolt &pbolt,
targeting_type restrict, targ_mode_type mode,
bool needs_path, const char *prompt )
{
@@ -762,14 +766,14 @@ bool spell_direction( dist &spelld, bolt &pbolt,
{
// check for user cancel
canned_msg(MSG_OK);
- return false;
+ return (false);
}
pbolt.set_target(spelld);
pbolt.source_x = you.x_pos;
pbolt.source_y = you.y_pos;
- return true;
+ return (true);
} // end spell_direction()
const char* spelltype_short_name( int which_spelltype )