summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/abyss.cc95
-rw-r--r--crawl-ref/source/beam.cc51
-rw-r--r--crawl-ref/source/beam.h2
-rw-r--r--crawl-ref/source/dungeon.cc34
-rw-r--r--crawl-ref/source/effects.cc10
-rw-r--r--crawl-ref/source/item_use.cc49
-rw-r--r--crawl-ref/source/mon-util.cc18
-rw-r--r--crawl-ref/source/monstuff.cc127
-rw-r--r--crawl-ref/source/mutation.cc6
-rw-r--r--crawl-ref/source/spells1.cc6
-rw-r--r--crawl-ref/source/spl-cast.cc164
11 files changed, 316 insertions, 246 deletions
diff --git a/crawl-ref/source/abyss.cc b/crawl-ref/source/abyss.cc
index b53669672a..35001d76e2 100644
--- a/crawl-ref/source/abyss.cc
+++ b/crawl-ref/source/abyss.cc
@@ -77,7 +77,6 @@ void generate_abyss(void)
#endif
for (i = 5; i < (GXM - 5); i++)
- {
for (j = 5; j < (GYM - 5); j++)
{
temp_rand = random2(4000);
@@ -88,12 +87,13 @@ void generate_abyss(void)
(temp_rand > 0) ? DNGN_METAL_WALL // 2.5%
: DNGN_CLOSED_DOOR); // 1 in 4000
}
- }
grd[45][35] = DNGN_FLOOR;
- if ( one_chance_in(5) )
+ if (one_chance_in(5))
+ {
place_feature_near( coord_def(45, 35), LOS_RADIUS,
DNGN_FLOOR, DNGN_ALTAR_LUGONU, 50 );
+ }
}
static void generate_area(int gx1, int gy1, int gx2, int gy2)
@@ -143,18 +143,21 @@ static void generate_area(int gx1, int gy1, int gx2, int gy2)
for (int i = x1; room_ok && i < x2; i++)
for (int j = y1; room_ok && j < y2; j++)
+ {
if (grd[i][j] != DNGN_UNSEEN)
room_ok = false;
+ }
- if ( room_ok )
+ if (room_ok)
+ {
for (int i = x1; i < x2; i++)
for (int j = y1; j < y2; j++)
grd[i][j] = DNGN_FLOOR;
+ }
}
}
for (int i = gx1; i <= gx2; i++)
- {
for (int j = gy1; j <= gy2; j++)
{
if (grd[i][j] == DNGN_UNSEEN && random2(100) <= thickness)
@@ -184,13 +187,11 @@ static void generate_area(int gx1, int gy1, int gx2, int gy2)
}
}
}
- }
int exits_wanted = 0;
int altars_wanted = 0;
for (int i = gx1; i <= gx2; i++)
- {
for (int j = gy1; j <= gy2; j++)
{
if (grd[i][j] == DNGN_UNSEEN)
@@ -217,16 +218,15 @@ static void generate_area(int gx1, int gy1, int gx2, int gy2)
{
do
{
- grd[i][j] =
- static_cast<dungeon_feature_type>(
- DNGN_ALTAR_ZIN + random2(NUM_GODS-1) );
+ grd[i][j] = static_cast<dungeon_feature_type>(
+ DNGN_ALTAR_ZIN + random2(NUM_GODS-1) );
}
while (grd[i][j] == DNGN_ALTAR_ZIN
|| grd[i][j] == DNGN_ALTAR_SHINING_ONE
|| grd[i][j] == DNGN_ALTAR_ELYVILON);
// Lugonu has a flat 50% chance of corrupting the altar
- if ( coinflip() )
+ if (coinflip())
grd[i][j] = DNGN_ALTAR_LUGONU;
altars_wanted--;
@@ -235,7 +235,6 @@ static void generate_area(int gx1, int gy1, int gx2, int gy2)
#endif
}
}
- }
}
static int abyss_exit_nearness()
@@ -253,8 +252,7 @@ static int abyss_exit_nearness()
&& get_screen_glyph(x, y) != ' ')
{
nearness = MIN(nearness,
- grid_distance(you.x_pos, you.y_pos,
- x, y));
+ grid_distance(you.x_pos, you.y_pos, x, y));
}
}
@@ -280,9 +278,11 @@ static int abyss_rune_nearness()
{
item_def& item(mitm[i]);
if (is_rune(item) && item.plus == RUNE_ABYSSAL)
+ {
nearness = MIN(nearness,
grid_distance(you.x_pos, you.y_pos,
x, y));
+ }
i = item.link;
}
}
@@ -312,20 +312,20 @@ static void xom_check_nearness()
int exit_is_near = abyss_exit_nearness();
int rune_is_near = abyss_rune_nearness();
- if ((exit_was_near < INFINITE_DISTANCE
- && exit_is_near == INFINITE_DISTANCE)
- || (rune_was_near < INFINITE_DISTANCE
+ if (exit_was_near < INFINITE_DISTANCE
+ && exit_is_near == INFINITE_DISTANCE
+ || rune_was_near < INFINITE_DISTANCE
&& rune_is_near == INFINITE_DISTANCE
- && you.attribute[ATTR_ABYSSAL_RUNES] == 0))
+ && you.attribute[ATTR_ABYSSAL_RUNES] == 0)
{
xom_is_stimulated(255, "Xom snickers loudly.", true);
}
- if ((rune_was_near == INFINITE_DISTANCE
- && rune_is_near < INFINITE_DISTANCE
- && you.attribute[ATTR_ABYSSAL_RUNES] == 0)
- || (exit_was_near == INFINITE_DISTANCE &&
- exit_is_near < INFINITE_DISTANCE))
+ if (rune_was_near == INFINITE_DISTANCE
+ && rune_is_near < INFINITE_DISTANCE
+ && you.attribute[ATTR_ABYSSAL_RUNES] == 0
+ || exit_was_near == INFINITE_DISTANCE
+ && exit_is_near < INFINITE_DISTANCE)
{
xom_is_stimulated(255);
}
@@ -361,7 +361,6 @@ void area_shift(void)
}
for (int i = 5; i < (GXM - 5); i++)
- {
for (int j = 5; j < (GYM - 5); j++)
{
// don't modify terrain by player
@@ -377,7 +376,6 @@ void area_shift(void)
if (mgrd[i][j] != NON_MONSTER)
abyss_lose_monster( menv[ mgrd[i][j] ] );
}
- }
// shift all monsters & items to new area
for (int i = you.x_pos - 10; i < you.x_pos + 11; i++)
@@ -436,7 +434,7 @@ void area_shift(void)
mgen_data mons;
mons.level_type = LEVEL_ABYSS;
mons.proximity = PROX_AWAY_FROM_PLAYER;
-
+
for (unsigned int mcount = 0; mcount < 15; mcount++)
mons_place(mons);
@@ -519,15 +517,13 @@ void abyss_teleport( bool new_area )
delete_cloud( i );
for (i = 10; i < (GXM - 9); i++)
- {
for (j = 10; j < (GYM - 9); j++)
{
- grd[i][j] = DNGN_UNSEEN; // so generate_area will pick it up
- igrd[i][j] = NON_ITEM;
- mgrd[i][j] = NON_MONSTER;
+ grd[i][j] = DNGN_UNSEEN; // so generate_area will pick it up
+ igrd[i][j] = NON_ITEM;
+ mgrd[i][j] = NON_MONSTER;
env.cgrid[i][j] = EMPTY_CLOUD;
}
- }
ASSERT( env.cloud_no == 0 );
@@ -538,9 +534,11 @@ void abyss_teleport( bool new_area )
xom_check_nearness();
grd[you.x_pos][you.y_pos] = DNGN_FLOOR;
- if ( one_chance_in(5) )
+ if (one_chance_in(5))
+ {
place_feature_near( you.pos(), LOS_RADIUS,
DNGN_FLOOR, DNGN_ALTAR_LUGONU, 50 );
+ }
place_transiting_monsters();
place_transiting_items();
@@ -570,7 +568,9 @@ static void initialise_level_corrupt_seeds(int power)
{
coord_def where;
do
+ {
where = coord_def(random2(GXM), random2(GYM));
+ }
while (!in_bounds(where) || grd(where) != DNGN_FLOOR
|| env.markers.find(where, MAT_ANY));
@@ -587,20 +587,22 @@ static bool spawn_corrupted_servant_near(const coord_def &pos)
pos.y + random2avg(4, 3) + random2(3) );
if (!in_bounds(p) || p == you.pos() || mgrd(p) != NON_MONSTER
|| !grid_compatible(DNGN_FLOOR, grd(p), true))
+ {
continue;
+ }
// Got a place, summon the beast.
int level = 51;
- monster_type mons =
- pick_random_monster(level_id(LEVEL_ABYSS), level, level);
+ monster_type mons = pick_random_monster(level_id(LEVEL_ABYSS), level,
+ level);
if (mons == MONS_PROGRAM_BUG)
return (false);
const beh_type beh =
- one_chance_in(5 + you.skills[SK_INVOCATIONS] / 4)?
- BEH_HOSTILE : BEH_NEUTRAL;
- const int mid =
- create_monster( mgen_data( mons, beh, 5, p ) );
+ one_chance_in(5 + you.skills[SK_INVOCATIONS] / 4) ? BEH_HOSTILE
+ : BEH_NEUTRAL;
+ const int mid = create_monster( mgen_data( mons, beh, 5, p ) );
+
return (mid != -1);
}
return (false);
@@ -618,10 +620,10 @@ static void apply_corruption_effect(
for (int i = 0; i < neffects; ++i)
{
- if (random2(4000) < cmark->duration)
+ if (random2(4000) < cmark->duration
+ && !spawn_corrupted_servant_near(cmark->pos))
{
- if (!spawn_corrupted_servant_near(cmark->pos))
- break;
+ break;
}
}
cmark->duration -= duration;
@@ -680,7 +682,6 @@ static bool is_crowded_square(const coord_def &c)
{
int neighbours = 0;
for (int xi = -1; xi <= 1; ++xi)
- {
for (int yi = -1; yi <= 1; ++yi)
{
if (!xi && !yi)
@@ -693,7 +694,7 @@ static bool is_crowded_square(const coord_def &c)
if (++neighbours > 4)
return (false);
}
- }
+
return (true);
}
@@ -701,7 +702,6 @@ static bool is_crowded_square(const coord_def &c)
static bool is_sealed_square(const coord_def &c)
{
for (int xi = -1; xi <= 1; ++xi)
- {
for (int yi = -1; yi <= 1; ++yi)
{
if (!xi && !yi)
@@ -714,7 +714,7 @@ static bool is_sealed_square(const coord_def &c)
if (!grid_is_opaque(grd(n)))
return (false);
}
- }
+
return (true);
}
@@ -825,11 +825,16 @@ static void corrupt_choose_colours()
{
int colour = BLACK;
do
+ {
colour = random_uncommon_colour();
+ }
while (colour == env.rock_colour || colour == LIGHTGREY || colour == WHITE);
env.rock_colour = colour;
+
do
+ {
colour = random_uncommon_colour();
+ }
while (colour == env.floor_colour || colour == LIGHTGREY
|| colour == WHITE);
env.floor_colour = colour;
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 362f161646..d96086afe3 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -211,7 +211,7 @@ static void _ench_animation( int flavour, const monsters *mon, bool force )
zap_animation( element_colour( elem ), mon, force );
}
-void zapping(zap_type ztype, int power, bolt &pbolt)
+bool zapping(zap_type ztype, int power, bolt &pbolt)
{
#if DEBUG_DIAGNOSTICS
@@ -239,16 +239,35 @@ void zapping(zap_type ztype, int power, bolt &pbolt)
// fill in the bolt structure
_zappy( ztype, power, pbolt );
+ if (pbolt.thrower == KILL_YOU_MISSILE)
+ {
+ pbolt.is_tracer = true;
+ // XXX: rangeMax needs to be set appropriately for the tracer!
+ pbolt.attitude = ATT_FRIENDLY;
+ pbolt.source_x = you.x_pos;
+ pbolt.source_y = you.y_pos;
+ fire_beam(pbolt);
+
+ if (pbolt.fr_count > 0 && !yesno("Really fire through this friendly "
+ "creature?", true, 'n'))
+ {
+ canned_msg(MSG_OK);
+ you.turn_is_over = false;
+ return (false);
+ }
+ pbolt.is_tracer = false;
+ }
+
if (ztype == ZAP_LIGHTNING && !silenced(you.x_pos, you.y_pos))
- // needs to check silenced at other location, too {dlb}
{
+ // XXX: needs to check silenced at other location, too {dlb}
mpr("You hear a mighty clap of thunder!");
noisy( 25, you.x_pos, you.y_pos );
}
fire_beam(pbolt);
- return;
+ return (true);
} // end zapping()
dice_def calc_dice( int num_dice, int max_damage )
@@ -1347,7 +1366,7 @@ void fire_beam( bolt &pbolt, item_def *item, bool drop_item )
rangeRemaining += random2((pbolt.rangeMax - pbolt.range) + 1);
}
- // before we start drawing the beam, turn buffering off
+ // Before we start drawing the beam, turn buffering off.
#ifdef WIN32CONSOLE
bool oldValue = true;
if (!pbolt.is_tracer)
@@ -1359,11 +1378,11 @@ void fire_beam( bolt &pbolt, item_def *item, bool drop_item )
tx = ray.x();
ty = ray.y();
- // shooting through clouds affects accuracy
- if ( env.cgrid[tx][ty] != EMPTY_CLOUD )
+ // Shooting through clouds affects accuracy.
+ if (env.cgrid[tx][ty] != EMPTY_CLOUD)
pbolt.hit = std::max(pbolt.hit - 2, 0);
- // see if tx, ty is blocked by something
+ // See if tx, ty is blocked by something.
if (grid_is_solid(grd[tx][ty]))
{
// first, check to see if this beam affects walls.
@@ -1479,11 +1498,11 @@ void fire_beam( bolt &pbolt, item_def *item, bool drop_item )
if (!pbolt.is_tracer && pbolt.name[0] != '0' && see_grid(tx,ty))
{
// we don't clean up the old position.
- // first, most people like seeing the full path,
+ // First, most people like to see the full path,
// and second, it is hard to do it right with
// respect to killed monsters, cloud trails, etc.
- // draw new position
+ // Draw new position.
int drawx = grid2viewX(tx);
int drawy = grid2viewY(ty);
@@ -1768,7 +1787,7 @@ int mons_adjust_flavoured( monsters *monster, bolt &pbolt,
}
else
{
- // early out for tracer/no side effects
+ // Early out for tracer/no side effects.
if (!doFlavouredEffects)
return (hurted);
@@ -2311,9 +2330,9 @@ void fire_tracer(const monsters *monster, bolt &pbolt)
pbolt.foe_helped = pbolt.foe_hurt = 0;
pbolt.foe_ratio = 80; // default - see mons_should_fire()
- // foe ratio for summoning gtr. demons & undead -- they may be
+ // Foe ratio for summoning gtr. demons & undead -- they may be
// summoned, but they're hostile and would love nothing better
- // than to nuke the player and his minions
+ // than to nuke the player and his minions.
if (mons_att_wont_attack(pbolt.attitude)
&& !mons_att_wont_attack(monster->attitude))
{
@@ -2323,7 +2342,7 @@ void fire_tracer(const monsters *monster, bolt &pbolt)
// fire!
fire_beam(pbolt);
- // unset tracer flag (convenience)
+ // Unset tracer flag (convenience).
pbolt.is_tracer = false;
} // end tracer_f()
@@ -2615,14 +2634,14 @@ int affect(bolt &beam, int x, int y, item_def *item)
// grd[x][y] will NOT be a wall for the remainder of this function.
- // if not a tracer, affect items and place clouds
+ // If not a tracer, affect items and place clouds.
if (!beam.is_tracer)
{
expose_items_to_element(beam.flavour, x, y);
rangeUsed += _affect_place_clouds(beam, x, y);
}
- // if player is at this location, try to affect unless term_on_target
+ // If player is at this location, try to affect unless term_on_target.
if (_found_player(beam, x, y))
{
// Done this way so that poison blasts affect the target once (via
@@ -3934,7 +3953,7 @@ static int _affect_monster(bolt &beam, monsters *mon, item_def *item)
// them and be considered naughty if they do damage (this is so as
// not to penalize players that fling fireballs into a melee with
// fire elementals on their side - the elementals won't give a sh*t,
- // after all)
+ // after all).
god_conduct_trigger conduct;
conduct.enabled = false;
diff --git a/crawl-ref/source/beam.h b/crawl-ref/source/beam.h
index 5dbe798705..77c0a9eb99 100644
--- a/crawl-ref/source/beam.h
+++ b/crawl-ref/source/beam.h
@@ -238,7 +238,7 @@ bool check_line_of_sight( int sx, int sy, int tx, int ty );
void mimic_alert( monsters *mimic );
-void zapping( zap_type ztype, int power, struct bolt &pbolt );
+bool zapping( zap_type ztype, int power, struct bolt &pbolt );
int affect(bolt &beam, int x, int y, item_def *item = NULL);
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index b51759ba37..3e2611cfb8 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -641,7 +641,7 @@ static void _register_place(const vault_placement &place)
if (!place.map.has_tag("layout"))
_mask_vault(place, MMT_VAULT | MMT_NO_DOOR);
-
+
if (place.map.has_tag("no_monster_gen"))
_mask_vault(place, MMT_NO_MONS);
@@ -776,16 +776,14 @@ static void _reset_level()
// Set default level flags
if (you.level_type == LEVEL_DUNGEON)
env.level_flags = branches[you.where_are_you].default_level_flags;
- else if (you.level_type == LEVEL_LABYRINTH ||
- you.level_type == LEVEL_ABYSS)
+ else if (you.level_type == LEVEL_LABYRINTH
+ || you.level_type == LEVEL_ABYSS)
{
env.level_flags = LFLAG_NO_TELE_CONTROL | LFLAG_NOT_MAPPABLE;
- if (!(you.level_type == LEVEL_LABYRINTH
- && you.species != SP_MINOTAUR))
- {
+ // Labyrinths are *only* magic mappable for minotaurs.
+ if (you.level_type != LEVEL_LABYRINTH || you.species != SP_MINOTAUR)
env.level_flags |= LFLAG_NO_MAGIC_MAP;
- }
}
else
env.level_flags = 0;
@@ -837,15 +835,17 @@ static int _num_items_wanted(int level_number)
static int _num_mons_wanted(int level_type)
{
- if (level_type == LEVEL_ABYSS ||
- player_in_branch( BRANCH_ECUMENICAL_TEMPLE ))
+ if (level_type == LEVEL_ABYSS
+ || player_in_branch(BRANCH_ECUMENICAL_TEMPLE))
+ {
return 0;
+ }
int mon_wanted = roll_dice( 3, 10 );
if (player_in_hell())
mon_wanted += roll_dice( 3, 8 );
- else if (player_in_branch( BRANCH_HALL_OF_BLADES ))
+ else if (player_in_branch(BRANCH_HALL_OF_BLADES))
mon_wanted += roll_dice( 6, 8 );
if (mon_wanted > 60)
@@ -1051,7 +1051,7 @@ static bool _fixup_stone_stairs(bool preserve_vault_stairs)
{
int start = remove;
do
- {
+ {
if (!(dgn_Map_Mask(stair_list[remove]) & MMT_VAULT))
break;
remove = (remove + 1) % num_stairs;
@@ -2897,7 +2897,7 @@ static int _place_monster_vector(std::vector<monster_type> montypes,
mg.behaviour = BEH_SLEEP;
mg.flags |= MG_PERMIT_BANDS;
mg.map_mask |= MMT_NO_MONS;
-
+
for (int i = 0; i < num_to_place; i++)
{
mg.cls = montypes[random2(montypes.size())];
@@ -2984,7 +2984,7 @@ static void _builder_monsters(int level_number, char level_type, int mon_wanted)
mg.power = level_number;
mg.flags |= MG_PERMIT_BANDS;
mg.map_mask |= MMT_NO_MONS;
-
+
place_monster(mg);
}
@@ -3213,7 +3213,7 @@ static void _fill_monster_pit( spec_room &sr, FixedVector<pit_mons_def,
mg.cls = lord_type;
mg.behaviour = BEH_SLEEP;
mg.pos = coord_def(lordx, lordy);
-
+
mons_place(
mgen_data::sleeper_at(lord_type, coord_def(lordx, lordy)));
}
@@ -3392,7 +3392,7 @@ static void _special_room(int level_number, spec_room &sr)
mons_place(
mgen_data::sleeper_at(
- mons_alloc[random2(10)],
+ mons_alloc[random2(10)],
coord_def(x, y) ));
}
@@ -6058,9 +6058,9 @@ static char _plan_6(int level_number)
// Note, that although "level_number > 20" will work for most
// trips to pandemonium (through regular portals), it won't work
// for demonspawn who gate themselves there. -- bwr
- if (((player_in_branch( BRANCH_MAIN_DUNGEON ) && level_number > 20)
+ if ((player_in_branch(BRANCH_MAIN_DUNGEON) && level_number > 20
|| you.level_type == LEVEL_PANDEMONIUM)
- && (coinflip() || you.mutation[ MUT_PANDEMONIUM ]))
+ && (coinflip() || player_mutation_level(MUT_PANDEMONIUM)))
{
grd[40][36] = DNGN_ENTER_ABYSS;
grd[41][36] = DNGN_ENTER_ABYSS;
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index 7bc319bff2..b26f14c4f9 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -1800,8 +1800,10 @@ bool acquirement(object_class_type class_wanted, int agent,
bool recharge_wand(int item_slot)
{
if (item_slot == -1)
+ {
item_slot = prompt_invent_item( "Charge which item?", MT_INVLIST,
OSEL_RECHARGE, true, true, false );
+ }
if (item_slot == PROMPT_ABORT)
{
@@ -1811,10 +1813,11 @@ bool recharge_wand(int item_slot)
item_def &wand = you.inv[ item_slot ];
+ // Weapons of electrocution can be "charged", i.e. gain +1 damage.
if (wand.base_type == OBJ_WEAPONS
&& get_weapon_brand(wand) == SPWPN_ELECTROCUTION)
{
- // might fail because of already high enchantment
+ // Might fail because of already high enchantment.
if (enchant_weapon( ENCHANT_TO_DAM, false, wand ))
{
you.wield_change = true;
@@ -1858,7 +1861,7 @@ bool recharge_wand(int item_slot)
break;
}
- // don't display zap counts any more
+ // Don't display zap counts any more.
wand.plus2 = ZAPCOUNT_UNKNOWN;
mprf("%s glows for a moment.", wand.name(DESC_CAP_YOUR).c_str());
@@ -1868,9 +1871,8 @@ bool recharge_wand(int item_slot)
if (wand.plus > charge_gain * 3)
wand.plus = charge_gain * 3;
}
- else
+ else // It's a rod.
{
- // This is a rod.
bool work = false;
if (wand.plus2 <= MAX_ROD_CHARGE * ROD_CHARGE_MULT)
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 596ef98904..5150573186 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -3266,11 +3266,14 @@ void zap_wand( int slot )
if (slot != -1)
item_slot = slot;
else
+ {
item_slot = prompt_invent_item( "Zap which item?",
MT_INVLIST,
OBJ_WANDS,
true, true, true, 0, NULL,
OPER_ZAP );
+ }
+
if (item_slot == PROMPT_ABORT)
{
canned_msg( MSG_OK );
@@ -3288,24 +3291,26 @@ void zap_wand( int slot )
if (you.equip[EQ_WEAPON] == item_slot)
you.wield_change = true;
- if ( wand.plus < 1 )
+ bool has_charges = true;
+ if (wand.plus < 1)
{
- // it's an empty wand, inscribe it that way
- canned_msg(MSG_NOTHING_HAPPENS);
- wand.plus2 = ZAPCOUNT_EMPTY;
- you.turn_is_over = true;
- return;
+ if (wand.plus2 == ZAPCOUNT_EMPTY)
+ {
+ mpr("This wand has no charges.");
+ return;
+ }
+ has_charges = false;
}
const bool alreadyknown = item_type_known(wand);
const bool alreadytried = item_type_tried(wand);
+ const bool dangerous = player_in_a_dangerous_place();
+
if (!alreadyknown)
beam.effect_known = false;
-
- const bool dangerous = player_in_a_dangerous_place();
- if (alreadyknown)
+ else
{
- switch ( wand.sub_type )
+ switch (wand.sub_type)
{
case WAND_DIGGING:
case WAND_TELEPORTATION:
@@ -3334,6 +3339,16 @@ void zap_wand( int slot )
return;
}
+ if (!has_charges)
+ {
+ canned_msg(MSG_NOTHING_HAPPENS);
+ // It's an empty wand; inscribe it that way.
+ wand.plus2 = ZAPCOUNT_EMPTY;
+ you.turn_is_over = true;
+ return;
+ }
+
+
if (you.duration[DUR_CONF])
{
zap_wand.tx = you.x_pos + random2(13) - 6;
@@ -3357,27 +3372,27 @@ void zap_wand( int slot )
beam.set_target(zap_wand);
// zapping() updates beam
- zapping( static_cast<zap_type>(type_zapped),
- 30 + roll_dice(2, you.skills[SK_EVOCATIONS]), beam );
+ if (!zapping( static_cast<zap_type>(type_zapped),
+ 30 + roll_dice(2, you.skills[SK_EVOCATIONS]), beam ))
+ {
+ return;
+ }
// take off a charge
wand.plus--;
// increment zap count
- if ( wand.plus2 >= 0 )
+ if (wand.plus2 >= 0)
wand.plus2++;
// identify if necessary
- if ((beam.obvious_effect || type_zapped == ZAP_FIREBALL) &&
- !alreadyknown)
+ if (!alreadyknown && (beam.obvious_effect || type_zapped == ZAP_FIREBALL))
{
set_ident_type( wand.base_type, wand.sub_type, ID_KNOWN_TYPE );
mpr(wand.name(DESC_INVENTORY_EQUIP).c_str());
}
else
- {
set_ident_type( wand.base_type, wand.sub_type, ID_TRIED_TYPE );
- }
if (item_type_known(wand)
&& (item_ident( wand, ISFLAG_KNOW_PLUSES )
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 1b8d97a49b..c96fcbb0a1 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -2071,17 +2071,16 @@ bool mons_should_fire(struct bolt &beam)
beam.smart_monster? "yes" : "no");
#endif
// use of foeRatio:
- // the higher this number, the more monsters
- // will _avoid_ collateral damage to their friends.
- // setting this to zero will in fact have all
- // monsters ignore their friends when considering
- // collateral damage.
+ // The higher this number, the more monsters will _avoid_
+ // collateral damage to their friends.
+ // Setting this to zero will in fact have all monsters ignore
+ // their friends when considering collateral damage.
- // quick check - did we in fact get any foes?
+ // Quick check - did we in fact get any foes?
if (beam.foe_count == 0)
return (false);
- // if we either hit no friends, or monster too dumb to care
+ // If we either hit no friends, or monster too dumb to care.
if (beam.fr_count == 0 || !beam.smart_monster)
return (true);
@@ -2091,10 +2090,9 @@ bool mons_should_fire(struct bolt &beam)
100));
}
-// returns true if the spell is something you wouldn't want done if
+// 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
-
+// non-beam spells.
bool ms_direct_nasty(spell_type monspell)
{
return (spell_needs_foe(monspell)
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 68b3278017..e946e39512 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -2341,15 +2341,14 @@ static void _handle_behaviour(monsters *mon)
if (mon->foe_memory > 0 && mon->foe != MHITNOT)
{
- // if we've arrived at our target x,y
+ // If we've arrived at our target x,y
// do a stealth check. If the foe
// fails, monster will then start
// tracking foe's CURRENT position,
// but only for a few moves (smell and
- // intuition only go so far)
+ // intuition only go so far).
- if (mon->x == mon->target_x &&
- mon->y == mon->target_y)
+ if (mon->x == mon->target_x && mon->y == mon->target_y)
{
if (mon->foe == MHITYOU)
{
@@ -2373,8 +2372,7 @@ static void _handle_behaviour(monsters *mon)
}
}
- // either keep chasing, or start
- // wandering.
+ // Either keep chasing, or start wandering.
if (mon->foe_memory < 2)
{
mon->foe_memory = 0;
@@ -2404,7 +2402,7 @@ static void _handle_behaviour(monsters *mon)
}
mon->foe_memory = memory;
- break; // from case
+ break; // switch/case BEH_SEEK
}
// monster can see foe: continue 'tracking'
@@ -2417,7 +2415,7 @@ static void _handle_behaviour(monsters *mon)
mon->target_x = 10 + random2(GXM - 10);
mon->target_y = 10 + random2(GYM - 10);
mon->foe = MHITNOT;
- new_beh = BEH_WANDER;
+ new_beh = BEH_WANDER;
}
else
{
@@ -2478,7 +2476,8 @@ static void _handle_behaviour(monsters *mon)
// check for healed
if (isHealthy && !isScared)
new_beh = BEH_SEEK;
- // smart monsters flee until they can
+
+ // Smart monsters flee until they can
// flee no more... possible to get a
// 'CORNERED' event, at which point
// we can jump back to WANDER if the foe
@@ -2726,6 +2725,7 @@ static void _handle_movement(monsters *monster)
// some calculations
if (monster->type == MONS_BORING_BEETLE && monster->foe == MHITYOU)
{
+ // Boring beetles always move in a straight line in your direction.
dx = you.x_pos - monster->x;
dy = you.y_pos - monster->y;
}
@@ -2748,8 +2748,8 @@ static void _handle_movement(monsters *monster)
mmov_y *= -1;
}
- // don't allow monsters to enter a sanctuary
- // or attack you inside a sanctuary even if it's right next to them
+ // Don't allow monsters to enter a sanctuary
+ // or attack you inside a sanctuary even if you're right next to them.
if (is_sanctuary(monster->x + mmov_x, monster->y + mmov_y)
&& (!is_sanctuary(monster->x, monster->y)
|| monster->x + mmov_x == you.x_pos
@@ -2759,8 +2759,7 @@ static void _handle_movement(monsters *monster)
mmov_y = 0;
}
- // bounds check: don't let fleeing monsters try to run
- // off the map
+ // Bounds check: don't let fleeing monsters try to run off the map.
if (monster->target_x + mmov_x < 0 || monster->target_x + mmov_x >= GXM)
mmov_x = 0;
@@ -2771,7 +2770,7 @@ static void _handle_movement(monsters *monster)
if (mmov_x == 0 && mmov_y == 0)
return;
- // reproduced here is some semi-legacy code that makes monsters
+ // Reproduced here is some semi-legacy code that makes monsters
// move somewhat randomly along oblique paths. It is an exceedingly
// good idea, given crawl's unique line of sight properties.
//
@@ -4237,7 +4236,7 @@ static bool _handle_spell( monsters *monster, bolt & beem )
return (false);
}
- // remove healing/invis/haste if we don't need them
+ // Remove healing/invis/haste if we don't need them.
int num_no_spell = 0;
for (int i = 0; i < NUM_MONSTER_SPELL_SLOTS; i++)
@@ -4664,10 +4663,11 @@ static void _monster_regenerate(monsters *monster)
static void _swim_or_move_energy(monsters *mon)
{
const dungeon_feature_type feat = grd[mon->x][mon->y];
+
// FIXME: Replace check with mons_is_swimming()?
- mon->lose_energy(
- feat >= DNGN_LAVA && feat <= DNGN_SHALLOW_WATER
- && !mon->airborne() ? EUT_SWIM : EUT_MOVE );
+ mon->lose_energy( (feat >= DNGN_LAVA && feat <= DNGN_SHALLOW_WATER
+ && !mon->airborne()) ? EUT_SWIM
+ : EUT_MOVE );
}
#if DEBUG
@@ -4699,13 +4699,11 @@ static void _handle_monster_move(int i, monsters *monster)
_monster_add_energy(monster);
// Handle clouds on nonmoving monsters:
- if (monster->speed == 0)
+ if (monster->speed == 0
+ && env.cgrid[monster->x][monster->y] != EMPTY_CLOUD
+ && !monster->has_ench(ENCH_SUBMERGED))
{
- if (env.cgrid[monster->x][monster->y] != EMPTY_CLOUD
- && !monster->has_ench(ENCH_SUBMERGED))
- {
- _mons_in_cloud( monster );
- }
+ _mons_in_cloud( monster );
}
// Apply monster enchantments once for every normal-speed
@@ -4723,19 +4721,19 @@ static void _handle_monster_move(int i, monsters *monster)
// reset, since then the monster type is invalid.
if (monster->type == -1)
return;
- else if (monster->hit_points < 1)
+ if (monster->hit_points < 1)
break;
}
- // memory is decremented here for a reason -- we only want it
- // decrementing once per monster "move"
+ // Memory is decremented here for a reason -- we only want it
+ // decrementing once per monster "move".
if (monster->foe_memory > 0)
monster->foe_memory--;
+ // Otherwise there are potential problems with summonings.
if (monster->type == MONS_GLOWING_SHAPESHIFTER)
monster->add_ench(ENCH_GLOWING_SHAPESHIFTER);
- // otherwise there are potential problems with summonings
if (monster->type == MONS_SHAPESHIFTER)
monster->add_ench(ENCH_SHAPESHIFTER);
@@ -4761,7 +4759,7 @@ static void _handle_monster_move(int i, monsters *monster)
entry->energy_usage.swim);
while (monster->has_action_energy())
- { // The continues & breaks are WRT this.
+ { // The continues & breaks are WRT this.
if (!monster->alive())
break;
@@ -4900,19 +4898,13 @@ static void _handle_monster_move(int i, monsters *monster)
if (random2(2 + pfound) < 2)
mmov_x = mmov_y = 0;
- // bounds check: don't let confused monsters try to run
- // off the map
- if (monster->x + mmov_x < 0
- || monster->x + mmov_x >= GXM)
- {
+ // Bounds check: don't let confused monsters try to run
+ // off the map.
+ if (monster->x + mmov_x < 0 || monster->x + mmov_x >= GXM)
mmov_x = 0;
- }
- if (monster->y + mmov_y < 0
- || monster->y + mmov_y >= GYM)
- {
+ if (monster->y + mmov_y < 0 || monster->y + mmov_y >= GYM)
mmov_y = 0;
- }
if (!monster->can_pass_through(monster->x + mmov_x,
monster->y + mmov_y))
@@ -4945,11 +4937,11 @@ static void _handle_monster_move(int i, monsters *monster)
if (monster->behaviour != BEH_SLEEP
&& monster->behaviour != BEH_WANDER
- // berserking monsters are limited to running up and
+ // Berserking monsters are limited to running up and
// hitting their foes.
&& !monster->has_ench(ENCH_BERSERK))
{
- // prevents unfriendlies from nuking you from offscreen.
+ // Prevents unfriendlies from nuking you from offscreen.
// How nice!
if (mons_friendly(monster) || mons_near(monster))
{
@@ -4957,11 +4949,10 @@ static void _handle_monster_move(int i, monsters *monster)
// in monsters that have both. This aims to give them both
// roughly the same weight.
- if (coinflip()?
- _handle_special_ability(monster, beem)
- || _handle_monster_spell(monster, beem)
- : _handle_monster_spell(monster, beem)
- || _handle_special_ability(monster, beem))
+ if (coinflip() ? _handle_special_ability(monster, beem)
+ || _handle_monster_spell(monster, beem)
+ : _handle_monster_spell(monster, beem)
+ || _handle_special_ability(monster, beem))
{
DEBUG_ENERGY_USE("spell or special");
continue;
@@ -5001,7 +4992,7 @@ static void _handle_monster_move(int i, monsters *monster)
if (!mons_is_caught(monster))
{
- // see if we move into (and fight) an unfriendly monster
+ // See if we move into (and fight) an unfriendly monster.
int targmon = mgrd[monster->x + mmov_x][monster->y + mmov_y];
if (targmon != NON_MONSTER
&& targmon != i
@@ -5032,7 +5023,7 @@ static void _handle_monster_move(int i, monsters *monster)
&& monster->y + mmov_y == you.y_pos)
{
bool isFriendly = mons_friendly(monster);
- bool attacked = false;
+ bool attacked = false;
if (!isFriendly)
{
@@ -5053,8 +5044,8 @@ static void _handle_monster_move(int i, monsters *monster)
&& monster->hit_points < 1)
{
- // detach monster from the grid first, so it
- // doesn't get hit by its own explosion (GDL)
+ // Detach monster from the grid first, so it
+ // doesn't get hit by its own explosion. (GDL)
mgrd[monster->x][monster->y] = NON_MONSTER;
spore_goes_pop(monster);
@@ -5096,8 +5087,8 @@ static void _handle_monster_move(int i, monsters *monster)
if (monster->type == MONS_GIANT_SPORE
|| monster->type == MONS_BALL_LIGHTNING)
{
- // detach monster from the grid first, so it
- // doesn't get hit by its own explosion (GDL)
+ // Detach monster from the grid first, so it
+ // doesn't get hit by its own explosion. (GDL)
mgrd[monster->x][monster->y] = NON_MONSTER;
spore_goes_pop( monster );
@@ -5105,9 +5096,7 @@ static void _handle_monster_move(int i, monsters *monster)
return;
}
else
- {
monster_die( monster, KILL_MISC, 0 );
- }
}
}
@@ -5131,8 +5120,8 @@ void handle_monsters(void)
if (monster->type == -1 || immobile_monster[i])
continue;
- const int mx = monster->x,
- my = monster->y;
+ const int mx = monster->x, my = monster->y;
+
_handle_monster_move(i, monster);
if (!invalid_monster(monster)
@@ -5157,26 +5146,24 @@ void handle_monsters(void)
// Clear any summoning flags so that lower indiced
// monsters get their actions in the next round.
for (int i = 0; i < MAX_MONSTERS; i++)
- {
menv[i].flags &= ~MF_JUST_SUMMONED;
- }
-} // end handle_monster()
+}
static bool _is_item_jelly_edible(const item_def &item)
{
- // don't eat artefacts (note that unrandarts are randarts)
+ // Don't eat artefacts (note that unrandarts are randarts).
if (is_fixed_artefact(item) || is_random_artefact(item))
return (false);
- // shouldn't eat stone things
- // - but what about wands and rings?
+ // Shouldn't eat stone things
+ // - but what about wands and rings?
if (item.base_type == OBJ_MISSILES
&& (item.sub_type == MI_STONE || item.sub_type == MI_LARGE_ROCK))
{
return (false);
}
- // don't eat special game items
+ // Don't eat special game items.
if (item.base_type == OBJ_ORBS
|| (item.base_type == OBJ_MISCELLANY
&& (item.sub_type == MISC_RUNE_OF_ZOT
@@ -5298,7 +5285,8 @@ static bool _handle_pickup(monsters *monster)
} // end "if jellies"
// Note: Monsters only look at stuff near the top of stacks.
-
+ // XXX: Need to put in something so that monster picks up multiple items
+ // (eg ammunition) identical to those it's carrying.
bool success = false;
for (item = igrd[monster->x][monster->y]; item != NON_ITEM; )
{
@@ -5405,6 +5393,7 @@ static bool _monster_swaps_places( monsters *mon, int mx, int my )
// Check that both monsters will be happy at their proposed new locations.
const int cx = mon->x, cy = mon->y,
nx = mon->x + mx, ny = mon->y + my;
+
if (!_habitat_okay(mon, grd[nx][ny])
|| !_habitat_okay(m2, grd[cx][cy]))
{
@@ -5435,7 +5424,7 @@ static bool _monster_swaps_places( monsters *mon, int mx, int my )
static bool _do_move_monster(monsters *monster, int xi, int yi)
{
const int fx = monster->x + xi,
- fy = monster->y + yi;
+ fy = monster->y + yi;
if (!in_bounds(fx, fy))
return false;
@@ -5470,8 +5459,6 @@ static bool _do_move_monster(monsters *monster, int xi, int yi)
monster->x = fx;
monster->y = fy;
- // need to put in something so that monster picks up multiple
- // items (eg ammunition) identical to those it's carrying.
mgrd[monster->x][monster->y] = monster_index(monster);
monster->check_redraw(monster->pos() - coord_def(xi, yi));
@@ -5492,12 +5479,14 @@ void mons_check_pool(monsters *mons, killer_type killer, int killnum)
{
const bool message = mons_near(mons);
- // don't worry about invisibility - you should be able to
- // see if something has fallen into the lava
+ // Don't worry about invisibility - you should be able to
+ // see if something has fallen into the lava.
if (message)
+ {
mprf("%s falls into the %s!",
mons->name(DESC_CAP_THE).c_str(),
(grid == DNGN_LAVA ? "lava" : "water"));
+ }
if (grid == DNGN_LAVA && mons_res_fire(mons) >= 2)
grid = DNGN_DEEP_WATER;
diff --git a/crawl-ref/source/mutation.cc b/crawl-ref/source/mutation.cc
index ca2013223c..23ee151116 100644
--- a/crawl-ref/source/mutation.cc
+++ b/crawl-ref/source/mutation.cc
@@ -1655,11 +1655,11 @@ bool mutate(mutation_type which_mutation, bool failMsg,
{
// God gifts override all sources of mutation resistance other
// than the mutation resistance mutation and divine protection.
- if ((wearing_amulet(AMU_RESIST_MUTATION)
- && !one_chance_in(10) && !god_gift)
+ if (wearing_amulet(AMU_RESIST_MUTATION)
+ && !one_chance_in(10) && !god_gift
|| player_mutation_level(MUT_MUTATION_RESISTANCE) == 3
|| player_mutation_level(MUT_MUTATION_RESISTANCE)
- && !one_chance_in(3))
+ && !one_chance_in(3))
{
if (failMsg)
mpr("You feel odd for a moment.", MSGCH_MUTATION);
diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc
index 2c0b92a1ee..309023e596 100644
--- a/crawl-ref/source/spells1.cc
+++ b/crawl-ref/source/spells1.cc
@@ -435,8 +435,10 @@ void identify(int power, int item_slot)
do
{
if (item_slot == -1)
+ {
item_slot = prompt_invent_item( "Identify which item?", MT_INVLIST,
OSEL_UNIDENT, true, true, false );
+ }
if (item_slot == PROMPT_ABORT)
{
canned_msg( MSG_OK );
@@ -445,7 +447,7 @@ void identify(int power, int item_slot)
item_def& item(you.inv[item_slot]);
- if ( fully_identified(item) )
+ if (fully_identified(item))
{
mpr("Choose an unidentified item, or Esc to abort.");
if ( Options.auto_list )
@@ -454,7 +456,7 @@ void identify(int power, int item_slot)
continue;
}
- if ( !is_artefact(item) )
+ if (!is_artefact(item))
set_ident_type( item.base_type, item.sub_type, ID_KNOWN_TYPE );
set_ident_flags( item, ISFLAG_IDENT_MASK );
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index 6f69da5c9e..fffba572d9 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -908,7 +908,7 @@ static bool _spell_is_uncastable(spell_type spell)
return (false);
}
-// returns SPRET_SUCCESS if spell is successfully cast for purposes of
+// Returns SPRET_SUCCESS if spell is successfully cast for purposes of
// exercising, SPRET_FAIL otherwise, or SPRET_ABORT if the player canceled
// the casting.
spret_type your_spells( spell_type spell, int powc, bool allow_fail )
@@ -917,7 +917,7 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
struct bolt beam;
// [dshaligram] Any action that depends on the spellcasting attempt to have
- // succeeded must be performed after the switch()
+ // succeeded must be performed after the switch().
if (_spell_is_uncastable(spell))
return (SPRET_ABORT);
@@ -985,21 +985,19 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
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 || spell == SPELL_BANISHMENT)
{
mpr( "Sorry, this spell works on others only." );
}
else
- {
canned_msg(MSG_UNTHINKING_ACT);
- }
return (SPRET_ABORT);
}
}
- // enhancers only matter for calc_spell_power() and spell_fail()
- // not sure about this: is it flavour or misleading?
+ // Enhancers only matter for calc_spell_power() and spell_fail().
+ // Not sure about this: is it flavour or misleading? (jpeg)
if (powc == 0 || allow_fail)
_surge_power(spell);
@@ -1065,7 +1063,7 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
// spells can be quite nasty: 9 * 9 * 90 / 500 = 15
// points of contamination!
int nastiness = spell_mana(spell) * spell_mana(spell)
- * (spfail_chance - spfl) + 250;
+ * (spfail_chance - spfl) + 250;
const int cont_points = div_rand_round(nastiness, 500);
@@ -1110,7 +1108,8 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
break;
case SPELL_MAGIC_DART:
- zapping(ZAP_MAGIC_DARTS, powc, beam);
+ if (!zapping(ZAP_MAGIC_DARTS, powc, beam))
+ return (SPRET_ABORT);
break;
case SPELL_FIREBALL:
@@ -1152,13 +1151,12 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
you.attribute[ ATTR_DELAYED_FIREBALL ] = 1;
}
else
- {
canned_msg( MSG_NOTHING_HAPPENS );
- }
break;
case SPELL_STRIKING:
- zapping( ZAP_STRIKING, powc, beam );
+ if (!zapping( ZAP_STRIKING, powc, beam ))
+ return (SPRET_ABORT);
break;
case SPELL_CONJURE_FLAME:
@@ -1167,34 +1165,41 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
break;
case SPELL_DIG:
- zapping(ZAP_DIGGING, powc, beam);
+ if (!zapping(ZAP_DIGGING, powc, beam))
+ return (SPRET_ABORT);
break;
case SPELL_BOLT_OF_FIRE:
- zapping(ZAP_FIRE, powc, beam);
+ if (!zapping(ZAP_FIRE, powc, beam))
+ return (SPRET_ABORT);
break;
case SPELL_BOLT_OF_COLD:
- zapping(ZAP_COLD, powc, beam);
+ if (!zapping(ZAP_COLD, powc, beam))
+ return (SPRET_ABORT);
break;
case SPELL_LIGHTNING_BOLT:
- zapping(ZAP_LIGHTNING, powc, beam);
+ if (!zapping(ZAP_LIGHTNING, powc, beam))
+ return (SPRET_ABORT);
break;
case SPELL_BOLT_OF_MAGMA:
- zapping(ZAP_MAGMA, powc, beam);
+ if (!zapping(ZAP_MAGMA, powc, beam))
+ return (SPRET_ABORT);
break;
case SPELL_POLYMORPH_OTHER:
- // trying is already enough, even if it fails
+ // Trying is already enough, even if it fails.
did_god_conduct(DID_DELIBERATE_MUTATING, 10);
- zapping(ZAP_POLYMORPH_OTHER, powc, beam);
+ if (!zapping(ZAP_POLYMORPH_OTHER, powc, beam))
+ return (SPRET_ABORT);
break;
case SPELL_SLOW:
- zapping(ZAP_SLOWING, powc, beam);
+ if (!zapping(ZAP_SLOWING, powc, beam))
+ return (SPRET_ABORT);
break;
case SPELL_HASTE:
@@ -1202,11 +1207,13 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
break;
case SPELL_PARALYSE:
- zapping(ZAP_PARALYSIS, powc, beam);
+ if (!zapping(ZAP_PARALYSIS, powc, beam))
+ return (SPRET_ABORT);
break;
case SPELL_CONFUSE:
- zapping(ZAP_CONFUSION, powc, beam);
+ if (!zapping(ZAP_CONFUSION, powc, beam))
+ return (SPRET_ABORT);
break;
case SPELL_CONFUSING_TOUCH:
@@ -1222,11 +1229,13 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
break;
case SPELL_THROW_FLAME:
- zapping(ZAP_FLAME, powc, beam);
+ if (!zapping(ZAP_FLAME, powc, beam))
+ return (SPRET_ABORT);
break;
case SPELL_THROW_FROST:
- zapping(ZAP_FROST, powc, beam);
+ if (!zapping(ZAP_FROST, powc, beam))
+ return (SPRET_ABORT);
break;
case SPELL_CONTROLLED_BLINK:
@@ -1259,7 +1268,8 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
break;
case SPELL_VENOM_BOLT:
- zapping(ZAP_VENOM_BOLT, powc, beam);
+ if (!zapping(ZAP_VENOM_BOLT, powc, beam))
+ return (SPRET_ABORT);
break;
case SPELL_OLGREBS_TOXIC_RADIANCE:
@@ -1268,7 +1278,8 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
case SPELL_TELEPORT_OTHER:
// teleport creature (I think)
- zapping(ZAP_TELEPORTATION, powc, beam);
+ if (!zapping(ZAP_TELEPORTATION, powc, beam))
+ return (SPRET_ABORT);
break;
case SPELL_LESSER_HEALING:
@@ -1338,15 +1349,18 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
break;
case SPELL_BOLT_OF_DRAINING:
- zapping(ZAP_NEGATIVE_ENERGY, powc, beam);
+ if (!zapping(ZAP_NEGATIVE_ENERGY, powc, beam))
+ return (SPRET_ABORT);
break;
case SPELL_LEHUDIBS_CRYSTAL_SPEAR:
- zapping(ZAP_CRYSTAL_SPEAR, powc, beam);
+ if (!zapping(ZAP_CRYSTAL_SPEAR, powc, beam))
+ return (SPRET_ABORT);
break;
case SPELL_BOLT_OF_INACCURACY:
- zapping(ZAP_BEAM_OF_ENERGY, powc, beam);
+ if (!zapping(ZAP_BEAM_OF_ENERGY, powc, beam))
+ return (SPRET_ABORT);
break;
case SPELL_POISONOUS_CLOUD:
@@ -1354,7 +1368,8 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
break;
case SPELL_POISON_ARROW:
- zapping( ZAP_POISON_ARROW, powc, beam );
+ if (!zapping( ZAP_POISON_ARROW, powc, beam ))
+ return (SPRET_ABORT);
break;
case SPELL_FIRE_STORM:
@@ -1362,8 +1377,8 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
break;
case SPELL_DETECT_TRAPS:
- mprf("You detect %s",
- (detect_traps(powc) > 0) ? "traps!" : "nothing.");
+ mprf("You detect %s", (detect_traps(powc) > 0) ? "traps!"
+ : "nothing.");
break;
case SPELL_BLINK:
@@ -1371,7 +1386,8 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
break;
case SPELL_ISKENDERUNS_MYSTIC_BLAST:
- zapping( ZAP_MYSTIC_BLAST, powc, beam );
+ if (!zapping( ZAP_MYSTIC_BLAST, powc, beam ))
+ return (SPRET_ABORT);
break;
case SPELL_SWARM:
@@ -1383,7 +1399,8 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
break;
case SPELL_ENSLAVEMENT:
- zapping(ZAP_ENSLAVEMENT, powc, beam);
+ if (!zapping(ZAP_ENSLAVEMENT, powc, beam))
+ return (SPRET_ABORT);
break;
case SPELL_MAGIC_MAPPING:
@@ -1408,8 +1425,9 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
break;
case SPELL_PAIN:
+ if (!zapping(ZAP_PAIN, powc, beam))
+ return (SPRET_ABORT);
dec_hp(1, false);
- zapping(ZAP_PAIN, powc, beam);
break;
case SPELL_EXTENSION:
@@ -1435,8 +1453,8 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
break;
case SPELL_DETECT_ITEMS:
- mprf("You detect %s",
- (detect_items(powc) > 0) ? "items!" : "nothing.");
+ mprf("You detect %s", (detect_items(powc) > 0) ? "items!"
+ : "nothing.");
break;
case SPELL_BORGNJORS_REVIVIFICATION:
@@ -1463,7 +1481,8 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
break;
case SPELL_STICKY_FLAME:
- zapping(ZAP_STICKY_FLAME, powc, beam);
+ if (!zapping(ZAP_STICKY_FLAME, powc, beam))
+ return (SPRET_ABORT);
break;
case SPELL_SUMMON_ICE_BEAST:
@@ -1492,7 +1511,8 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
break;
case SPELL_DISPEL_UNDEAD:
- zapping(ZAP_DISPEL_UNDEAD, powc, beam);
+ if (!zapping(ZAP_DISPEL_UNDEAD, powc, beam))
+ return (SPRET_ABORT);
break;
case SPELL_GUARDIAN:
@@ -1500,11 +1520,13 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
break;
case SPELL_THUNDERBOLT:
- zapping(ZAP_LIGHTNING, powc, beam);
+ if (!zapping(ZAP_LIGHTNING, powc, beam))
+ return (SPRET_ABORT);
break;
case SPELL_FLAME_OF_CLEANSING:
- zapping(ZAP_CLEANSING_FLAME, powc, beam);
+ if (!zapping(ZAP_CLEANSING_FLAME, powc, beam))
+ return (SPRET_ABORT);
break;
case SPELL_SUMMON_DAEVA:
@@ -1531,15 +1553,18 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
mpr("You cannot banish yourself!");
break;
}
- zapping(ZAP_BANISHMENT, powc, beam);
+ if (!zapping(ZAP_BANISHMENT, powc, beam))
+ return (SPRET_ABORT);
break;
case SPELL_CIGOTUVIS_DEGENERATION:
- zapping(ZAP_DEGENERATION, powc, beam);
+ if (!zapping(ZAP_DEGENERATION, powc, beam))
+ return (SPRET_ABORT);
break;
case SPELL_STING:
- zapping(ZAP_STING, powc, beam);
+ if (!zapping(ZAP_STING, powc, beam))
+ return (SPRET_ABORT);
break;
case SPELL_SUBLIMATION_OF_BLOOD:
@@ -1554,7 +1579,8 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
case SPELL_HELLFIRE:
// should only be available from:
// staff of Dispater & Sceptre of Asmodeus
- zapping(ZAP_HELLFIRE, powc, beam);
+ if (!zapping(ZAP_HELLFIRE, powc, beam))
+ return (SPRET_ABORT);
break;
case SPELL_SUMMON_DEMON:
@@ -1626,11 +1652,13 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
break;
case SPELL_BOLT_OF_IRON:
- zapping(ZAP_IRON_BOLT, powc, beam);
+ if (!zapping(ZAP_IRON_BOLT, powc, beam))
+ return (SPRET_ABORT);
break;
case SPELL_STONE_ARROW:
- zapping(ZAP_STONE_ARROW, powc, beam);
+ if (!zapping(ZAP_STONE_ARROW, powc, beam))
+ return (SPRET_ABORT);
break;
case SPELL_TOMB_OF_DOROKLOHE:
@@ -1642,7 +1670,8 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
break;
case SPELL_SHOCK:
- zapping(ZAP_ELECTRICITY, powc, beam);
+ if (!zapping(ZAP_ELECTRICITY, powc, beam))
+ return (SPRET_ABORT);
break;
case SPELL_SWIFTNESS:
@@ -1658,12 +1687,13 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
break;
case SPELL_ORB_OF_ELECTROCUTION:
- zapping(ZAP_ORB_OF_ELECTRICITY, powc, beam);
+ if (!zapping(ZAP_ORB_OF_ELECTRICITY, powc, beam))
+ return (SPRET_ABORT);
break;
case SPELL_DETECT_CREATURES:
- mprf("You detect %s",
- (detect_creatures(powc) > 0) ? "creatures!" : "nothing.");
+ mprf("You detect %s", (detect_creatures(powc) > 0) ? "creatures!"
+ : "nothing.");
break;
case SPELL_CURE_POISON_II: // poison magic version of cure poison
@@ -1690,7 +1720,7 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
// trying is already enough, even if it fails
did_god_conduct(DID_DELIBERATE_MUTATING, 10);
- crawl_state.cant_cmd_repeat("You can't repeat alter self.");
+ crawl_state.cant_cmd_repeat("You can't repeat Alter Self.");
if (!enough_hp( you.hp_max / 2, true ))
{
mpr( "Your body is in too poor a condition "
@@ -1708,7 +1738,8 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
break;
case SPELL_DEBUGGING_RAY:
- zapping(ZAP_DEBUGGING_RAY, powc, beam);
+ if (!zapping(ZAP_DEBUGGING_RAY, powc, beam))
+ return (SPRET_ABORT);
break;
case SPELL_RECALL:
@@ -1722,7 +1753,8 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
break;
case SPELL_AGONY:
- zapping(ZAP_AGONY, powc, beam);
+ if (!zapping(ZAP_AGONY, powc, beam))
+ return (SPRET_ABORT);
break;
case SPELL_SPIDER_FORM:
@@ -1730,11 +1762,13 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
break;
case SPELL_DISRUPT:
- zapping(ZAP_DISRUPTION, powc, beam);
+ if (!zapping(ZAP_DISRUPTION, powc, beam))
+ return (SPRET_ABORT);
break;
case SPELL_DISINTEGRATE:
- zapping(ZAP_DISINTEGRATION, powc, beam);
+ if (!zapping(ZAP_DISINTEGRATION, powc, beam))
+ return (SPRET_ABORT);
break;
case SPELL_BLADE_HANDS:
@@ -1770,11 +1804,13 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
break;
case SPELL_ORB_OF_FRAGMENTATION:
- zapping(ZAP_ORB_OF_FRAGMENTATION, powc, beam);
+ if (!zapping(ZAP_ORB_OF_FRAGMENTATION, powc, beam))
+ return (SPRET_ABORT);
break;
case SPELL_ICE_BOLT:
- zapping(ZAP_ICE_BOLT, powc, beam);
+ if (!zapping(ZAP_ICE_BOLT, powc, beam))
+ return (SPRET_ABORT);
break;
case SPELL_ARC:
@@ -1787,7 +1823,8 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
break;
case SPELL_ICE_STORM:
- zapping(ZAP_ICE_STORM, powc, beam);
+ if (!zapping(ZAP_ICE_STORM, powc, beam))
+ return (SPRET_ABORT);
break;
case SPELL_SUMMON_UGLY_THING:
@@ -1805,7 +1842,8 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
//jmf: new spells 19mar2000
case SPELL_FLAME_TONGUE:
- zapping(ZAP_FLAME_TONGUE, powc, beam);
+ if (!zapping(ZAP_FLAME_TONGUE, powc, beam))
+ return (SPRET_ABORT);
break;
case SPELL_PASSWALL:
@@ -1840,7 +1878,8 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
mprf(MSGCH_DIAGNOSTICS, "Sleep power stepdown: %d -> %d",
powc, sleep_power);
#endif
- zapping(ZAP_SLEEP, sleep_power, beam);
+ if (!zapping(ZAP_SLEEP, sleep_power, beam))
+ return (SPRET_ABORT);
break;
}
@@ -1899,7 +1938,8 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail )
break;
case SPELL_BACKLIGHT:
- zapping(ZAP_BACKLIGHT, powc + 10, beam);
+ if (!zapping(ZAP_BACKLIGHT, powc + 10, beam))
+ return (SPRET_ABORT);
break;
case SPELL_INTOXICATE: