From 366c06789dcef1a3ae32f37fb9adcb1ca1a08ee4 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Mon, 14 Apr 2008 16:44:22 +0000 Subject: Fix compile (oops) and numerous whitespace changes. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4229 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/beam.cc | 193 +++++++++++++++++++++---------------------- crawl-ref/source/debug.cc | 182 ++++++++++++++++++++-------------------- crawl-ref/source/decks.cc | 65 ++++++++------- crawl-ref/source/item_use.cc | 26 +++--- crawl-ref/source/items.cc | 147 ++++++++++++++++---------------- crawl-ref/source/makeitem.cc | 111 +++++++++++++------------ crawl-ref/source/player.cc | 2 +- crawl-ref/source/spells4.cc | 128 ++++++++++++++-------------- 8 files changed, 430 insertions(+), 424 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index 3966e0afa2..d074f6b29c 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -109,10 +109,10 @@ static std::set beam_message_cache; static bool _beam_is_blockable( bolt &pbolt ) { - // BEAM_ELECTRICITY is added here because chain lighting is not + // BEAM_ELECTRICITY is added here because chain lighting is not // a true beam (stops at the first target it gets to and redirects // from there)... but we don't want it shield blockable. - return (!pbolt.is_beam && !pbolt.is_explosion + return (!pbolt.is_beam && !pbolt.is_explosion && pbolt.flavour != BEAM_ELECTRICITY); } @@ -214,7 +214,7 @@ void zapping(zap_type ztype, int power, bolt &pbolt) { #if DEBUG_DIAGNOSTICS - mprf(MSGCH_DIAGNOSTICS, "zapping: power=%d", power ); + mprf(MSGCH_DIAGNOSTICS, "zapping: power=%d", power ); #endif // GDL: note that rangeMax is set to 0, which means that max range is @@ -266,7 +266,7 @@ dice_def calc_dice( int num_dice, int max_damage ) } else { - // Divied the damage among the dice, and add one + // Divide the damage among the dice, and add one // occasionally to make up for the fractions. -- bwr ret.size = max_damage / num_dice; ret.size += (random2( num_dice ) < max_damage % num_dice); @@ -282,15 +282,15 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) int temp_rand = 0; // probability determination {dlb} // Note: The incoming power is not linear in the case of spellcasting. - // The power curve currently allows for the character to reasonably + // The power curve currently allows for the character to reasonably // get up to a power level of about a 100, but more than that will // be very hard (and the maximum is 200). The low level power caps // provide the useful feature in that they allow for low level spells - // to have quick advancement, but don't cause them to obsolete the + // to have quick advancement, but don't cause them to obsolete the // higher level spells. -- bwr // - // I've added some example characters below to show how little - // people should be concerned about the power caps. + // I've added some example characters below to show how little + // people should be concerned about the power caps. // // The example characters are simplified to three stats: // @@ -299,19 +299,19 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) // - Skills: This represents the character having Spellcasting // and the average of the component skills at this level. // Although, Spellcasting probably isn't quite as high as - // other spell skills for a lot of characters, note that it + // other spell skills for a lot of characters, note that it // contributes much less to the total power (about 20%). // // - Enhancers: These are equipment that the player can use to // apply additional magnifiers (x1.5) to power. There are // also inhibitors that reduce power (/2.0), but we're not - // concerned about those here. Anyways, the character can + // concerned about those here. Anyways, the character can // currently have up to 3 levels (for x1.5, x2.25, x3.375). // The lists below should help to point out the difficulty // and cost of getting more than one level of enhancement. // // Here's a list of current magnifiers: - // + // // - rings of fire/cold // - staff of fire/cold/air/earth/poison/death/conjure/enchant/summon // - staff of Olgreb (poison) @@ -323,7 +323,7 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) // The maximum enhancement, by school (but capped at 3): // // - Necromancy: 4 (Mummies), 3 (others) - // - Fire: 4 + // - Fire: 4 // - Cold: 3 // - Conjuration: 2 // - Enchantment: 2 @@ -336,9 +336,9 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) switch (z_type) { // level 1 - // - // This cap is to keep these easy and very cheap spells from - // becoming too powerful. + // + // This cap is to keep these easy and very cheap spells from + // becoming too powerful. // // Example characters with about 25 power: // @@ -387,7 +387,7 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) // that a high level character can easily have 75 power. // // Example characters with about 75 power: - // + // // - int 10, skills 27, 1 enhancer // - int 15, skills 27, 0 enhancers // - int 15, skills 16, 1 enhancer @@ -397,9 +397,9 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) // level 4 // - // The following examples should make it clear that this is the - // effective maximum power. Its not easy to get to 100 power, - // but 20-20-1 or 25-16-1 is certainly attainable by a high level + // The following examples should make it clear that this is the + // effective maximum power. Its not easy to get to 100 power, + // but 20-20-1 or 25-16-1 is certainly attainable by a high level // spellcaster. As you can see from the examples at 150 and 200, // getting much power beyond this is very difficult. // @@ -423,9 +423,9 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) // levels 5-7 // // These spells used to be capped, but its very hard to raise - // power over 100, and these examples should show that. + // power over 100, and these examples should show that. // Only the twinkiest of characters are expected to get to 150. - // + // // Example characters with about 150 power: // // - int 15, skills 27, 3 enhancers (actually, only 146) @@ -455,7 +455,7 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) // levels 8-9 // // These spells are capped at 200 (which is the cap in calc_spell_power). - // As an example of how little of a cap that is, consider the fact + // As an example of how little of a cap that is, consider the fact // that a 70-27-3 character has an uncapped power of 251. Characters // are never expected to get to this cap. // @@ -543,7 +543,7 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) pbolt.range = 8 + random2(5); pbolt.damage = dice_def( 1, 5 ); // dam: 5 pbolt.hit = 8 + power / 10; // 25: 10 - pbolt.type = dchar_glyph(DCHAR_SPACE); + pbolt.type = dchar_glyph(DCHAR_SPACE); pbolt.flavour = BEAM_MMISSILE; // unresistable pbolt.obvious_effect = true; break; @@ -588,7 +588,7 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) pbolt.name = "0"; pbolt.flavour = BEAM_DISINTEGRATION; pbolt.range = 7 + random2(8); - pbolt.damage = dice_def( 1, 4 + power / 5 ); // 25: 1d9 + pbolt.damage = dice_def( 1, 4 + power / 5 ); // 25: 1d9 pbolt.ench_power *= 3; break; @@ -722,8 +722,8 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) pbolt.name = "orb of energy"; pbolt.colour = LIGHTMAGENTA; pbolt.range = 8 + random2(5); - pbolt.damage = calc_dice( 2, 15 + (power * 2) / 5 ); - pbolt.hit = 10 + power / 7; // 50: 17 100: 24 + pbolt.damage = calc_dice( 2, 15 + (power * 2) / 5 ); + pbolt.hit = 10 + power / 7; // 50: 17 100: 24 pbolt.type = dchar_glyph(DCHAR_FIRED_ZAP); pbolt.flavour = BEAM_MMISSILE; // unresistable @@ -806,7 +806,7 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt ) pbolt.name = "bolt of negative energy"; pbolt.colour = DARKGREY; pbolt.range = 7 + random2(10); - pbolt.damage = calc_dice( 4, 15 + (power * 3) / 5 ); + pbolt.damage = calc_dice( 4, 15 + (power * 3) / 5 ); pbolt.hit = 8 + power / 20; // 50: 10 100: 13 pbolt.type = dchar_glyph(DCHAR_FIRED_ZAP); pbolt.flavour = BEAM_NEG; // drains levels @@ -1328,13 +1328,13 @@ void fire_beam( bolt &pbolt, item_def *item, bool drop_item ) { mprf( MSGCH_DIAGNOSTICS, "%s%s%s (%d,%d) to (%d,%d): ty=%d col=%d flav=%d hit=%d dam=%dd%d range=%d", - (pbolt.is_beam) ? "beam" : "missile", - (pbolt.is_explosion) ? "*" : - (pbolt.is_big_cloud) ? "+" : "", + (pbolt.is_beam) ? "beam" : "missile", + (pbolt.is_explosion) ? "*" : + (pbolt.is_big_cloud) ? "+" : "", (pbolt.is_tracer) ? " tracer" : "", - pbolt.source_x, pbolt.source_y, - pbolt.target_x, pbolt.target_y, - pbolt.type, pbolt.colour, pbolt.flavour, + pbolt.source_x, pbolt.source_y, + pbolt.target_x, pbolt.target_y, + pbolt.type, pbolt.colour, pbolt.flavour, pbolt.hit, pbolt.damage.num, pbolt.damage.size, pbolt.range); } @@ -1419,7 +1419,7 @@ void fire_beam( bolt &pbolt, item_def *item, bool drop_item ) ray.regress(); } while (grid_is_solid(grd(ray.pos()))); - + tx = ray.x(); ty = ray.y(); break; // breaks from line tracing @@ -1435,7 +1435,7 @@ void fire_beam( bolt &pbolt, item_def *item, bool drop_item ) ray.regress(); } while (grid_is_solid(grd(ray.pos()))); - + ray.advance_and_bounce(); --rangeRemaining; } @@ -1453,7 +1453,7 @@ void fire_beam( bolt &pbolt, item_def *item, bool drop_item ) // couldn't find any path: bouncy, fuzzy, or not - so break. if (grid_is_solid(grd[tx][ty])) break; - + // check for "target termination" // occurs when beam can be targetted at empty // cell (e.g. a mage wants an explosion to happen @@ -1557,9 +1557,8 @@ void fire_beam( bolt &pbolt, item_def *item, bool drop_item ) // leave an object, if applicable if (drop_item && item) - { beam_drop_object( pbolt, item, tx, ty ); - } + ASSERT(!drop_item || item); // check for explosion. NOTE that for tracers, we have to make a copy @@ -1625,7 +1624,7 @@ int mons_adjust_flavoured( monsters *monster, bolt &pbolt, (pbolt.flavour == BEAM_FIRE) ? monster->res_fire() : monster->res_steam(), hurted, true); - + if (!hurted) { if (doFlavouredEffects) @@ -1843,7 +1842,7 @@ int mons_adjust_flavoured( monsters *monster, bolt &pbolt, case BEAM_LAVA: hurted = resist_adjust_damage(monster, pbolt.flavour, monster->res_fire(), hurted, true); - + if (hurted < original) { if (doFlavouredEffects) @@ -1985,15 +1984,15 @@ bool mass_enchantment( enchant_type wh_enchant, int pow, int origin, if (m_attempted) ++*m_attempted; - + if (_monster_resists_mass_enchantment(monster, wh_enchant, pow)) - continue; + continue; if (monster->add_ench(mon_enchant(wh_enchant, 0, kc))) { if (m_succumbed) ++*m_succumbed; - + if (player_monster_visible( monster )) { // turn message on @@ -2120,7 +2119,7 @@ int mons_ench_f2(monsters *monster, bolt &pbolt) case BEAM_CONFUSION: /* 4 = confusion */ if (!mons_class_is_confusable(monster->type)) return (MON_UNAFFECTED); - + if (monster->add_ench( mon_enchant(ENCH_CONFUSION, 0, _whose_kill(pbolt)))) { @@ -2134,7 +2133,7 @@ int mons_ench_f2(monsters *monster, bolt &pbolt) { // Store the monster name before it becomes an "it" -- bwr const std::string monster_name = monster->name(DESC_CAP_THE); - + if (!monster->has_ench(ENCH_INVIS) && monster->add_ench(ENCH_INVIS)) { @@ -2259,8 +2258,8 @@ bool poison_monster( monsters *monster, // note: order important here if (verbose && new_pois.degree > old_pois.degree) { - simple_monster_message( monster, - !old_pois.degree? " is poisoned." + simple_monster_message( monster, + !old_pois.degree? " is poisoned." : " looks even sicker." ); } @@ -2343,7 +2342,7 @@ bool check_line_of_sight( int sx, int sy, int tx, int ty ) // currently we limit the range to 8 if (dist > MONSTER_LOS_RANGE) return (false); - + // Note that we are guaranteed to be within the player LOS range, // so fallback is unnecessary. ray_def ray; @@ -2366,13 +2365,13 @@ void mimic_alert(monsters *mimic) { if (should_id) mimic->flags |= MF_KNOWN_MIMIC; - + return; } - + const bool instant_tele = !one_chance_in(3); monster_teleport( mimic, instant_tele ); - + // at least for this short while, we know it's a mimic if (!instant_tele && should_id) mimic->flags |= MF_KNOWN_MIMIC; @@ -2540,11 +2539,11 @@ void beam_drop_object( bolt &beam, item_def *item, int x, int y ) if (beam.is_tracer || beam.flavour != BEAM_MISSILE) return; - if ((YOU_KILL(beam.thrower) && - !thrown_object_destroyed(item, x, y, false)) || - (MON_KILL(beam.thrower) && - !mons_thrown_object_destroyed(item, x, y, false, - beam.beam_source))) + if (YOU_KILL(beam.thrower) + && !thrown_object_destroyed(item, x, y, false) + || MON_KILL(beam.thrower) + && !mons_thrown_object_destroyed(item, x, y, false, + beam.beam_source)) { if (item->sub_type == MI_THROWING_NET) { @@ -2634,7 +2633,7 @@ int affect(bolt &beam, int x, int y) { rangeUsed += _affect_player( beam ); } - + if (_beam_term_on_target(beam, x, y)) return (BEAM_STOP); } @@ -2658,7 +2657,7 @@ int affect(bolt &beam, int x, int y) { rangeUsed += _affect_monster( beam, &menv[mid] ); } - + if (_beam_term_on_target(beam, x, y)) return (BEAM_STOP); } @@ -2690,7 +2689,7 @@ static bool _affects_wall(const bolt &beam, int wall) if (beam.flavour == BEAM_DIGGING) return (true); - // Isn't this much nicer than the hack to remove ice bolts, disrupt, + // Isn't this much nicer than the hack to remove ice bolts, disrupt, // and needles (just because they were also coloured "white") -- bwr if (beam.flavour == BEAM_DISINTEGRATION && beam.damage.num >= 3) return (true); @@ -2726,7 +2725,7 @@ static int _affect_wall(bolt &beam, int x, int y) if (grd[x][y] == DNGN_ROCK_WALL || grd[x][y] == DNGN_CLEAR_ROCK_WALL) { grd[x][y] = DNGN_FLOOR; - + // blood does not transfer onto floor if (is_bloodcovered(x,y)) env.map[x][y].property = FPROP_NONE; @@ -2746,7 +2745,7 @@ static int _affect_wall(bolt &beam, int x, int y) return (rangeUsed); } // END DIGGING EFFECT - + // FIRE effect if (_is_fiery(beam)) { @@ -2798,8 +2797,8 @@ static int _affect_wall(bolt &beam, int x, int y) } } - if (targ_grid == DNGN_ORCISH_IDOL - || targ_grid == DNGN_GRANITE_STATUE) + if (targ_grid == DNGN_ORCISH_IDOL + || targ_grid == DNGN_GRANITE_STATUE) { grd[x][y] = DNGN_FLOOR; @@ -2917,7 +2916,7 @@ static int _affect_place_clouds(bolt &beam, int x, int y) // following two functions used with explosions: static void _affect_place_explosion_clouds(bolt &beam, int x, int y) { - cloud_type cl_type; + cloud_type cl_type; int duration; // first check: FIRE/COLD over water/lava @@ -2969,7 +2968,7 @@ static void _affect_place_explosion_clouds(bolt &beam, int x, int y) break; case BEAM_POTION_RANDOM: - switch (random2(10)) + switch (random2(10)) { case 0: cl_type = CLOUD_FIRE; break; case 1: cl_type = CLOUD_STINK; break; @@ -3084,12 +3083,12 @@ static void _beam_ouch( int dam, bolt &beam ) if (beam.flavour == BEAM_SPORE) ouch( dam, beam.beam_source, KILLED_BY_SPORE ); else - ouch( dam, beam.beam_source, KILLED_BY_BEAM, + ouch( dam, beam.beam_source, KILLED_BY_BEAM, beam.aux_source.c_str() ); } else // KILL_MISC || (YOU_KILL && aux_source) { - ouch( dam, beam.beam_source, KILLED_BY_WILD_MAGIC, + ouch( dam, beam.beam_source, KILLED_BY_WILD_MAGIC, beam.aux_source.c_str() ); } } @@ -3099,7 +3098,7 @@ static void _beam_ouch( int dam, bolt &beam ) static bool _fuzz_invis_tracer(bolt &beem) { // Did the monster have a rough idea of where you are? - int dist = grid_distance(beem.target_x, beem.target_y, + int dist = grid_distance(beem.target_x, beem.target_y, you.x_pos, you.y_pos); // No, ditch this. @@ -3109,7 +3108,7 @@ static bool _fuzz_invis_tracer(bolt &beem) const int beam_src = _beam_source(beem); if (beam_src != MHITNOT && beam_src != MHITYOU) { - // Monsters that can sense invisible + // Monsters that can sense invisible const monsters *mon = &menv[beam_src]; if (mons_sense_invis(mon)) return (!dist); @@ -3166,7 +3165,7 @@ static int _affect_player( bolt &beam ) // check for tracer if (beam.is_tracer) { - // check can see player + // check can see player if (beam.can_see_invis || !you.invisible() || _fuzz_invis_tracer(beam)) { @@ -3199,7 +3198,7 @@ static int _affect_player( bolt &beam ) if (you.invisible() && !beam.can_see_invis) beamHit /= 2; - if (beam.name[0] != '0') + if (beam.name[0] != '0') { if (!beam.is_explosion && !beam.aimed_at_feet) { @@ -3230,7 +3229,7 @@ static int _affect_player( bolt &beam ) else if (_beam_is_blockable(beam)) { // non-beams can be blocked or dodged - if (you.equip[EQ_SHIELD] != -1 + if (you.equip[EQ_SHIELD] != -1 && !beam.aimed_at_feet && player_shield_class() > 0) { @@ -3281,7 +3280,7 @@ static int _affect_player( bolt &beam ) bool nasty = true, nice = false; // BEGIN enchantment beam - if (beam.flavour != BEAM_HASTE + if (beam.flavour != BEAM_HASTE && beam.flavour != BEAM_INVISIBILITY && beam.flavour != BEAM_HEALING && beam.flavour != BEAM_POLYMORPH @@ -3308,7 +3307,7 @@ static int _affect_player( bolt &beam ) case BEAM_SLEEP: you.put_to_sleep(beam.ench_power); break; - + case BEAM_BACKLIGHT: if (!you.duration[DUR_INVIS]) { @@ -3316,7 +3315,7 @@ static int _affect_player( bolt &beam ) mpr("You glow brighter."); else mpr("You are outlined in light."); - + you.duration[DUR_BACKLIGHT] += random_range(15, 35); if (you.duration[DUR_BACKLIGHT] > 250) you.duration[DUR_BACKLIGHT] = 250; @@ -3331,7 +3330,7 @@ static int _affect_player( bolt &beam ) beam.obvious_effect = true; } break; - + case BEAM_POLYMORPH: if (MON_KILL(beam.thrower)) { @@ -3507,7 +3506,7 @@ static int _affect_player( bolt &beam ) // THE BEAM IS NOW GUARANTEED TO BE A NON-ENCHANTMENT WHICH HIT const bool engulfs = (beam.is_explosion || beam.is_big_cloud); - mprf( "The %s %s you!", + mprf( "The %s %s you!", beam.name.c_str(), (engulfs) ? "engulfs" : "hits" ); int hurted = 0; @@ -3515,7 +3514,7 @@ static int _affect_player( bolt &beam ) (beam.is_beam) ? 3 : 2; // Roll the damage - hurted += roll_dice( beam.damage ); + hurted += roll_dice( beam.damage ); #if DEBUG_DIAGNOSTICS int roll = hurted; @@ -3561,7 +3560,7 @@ static int _affect_player( bolt &beam ) int blood = hurted/2; // assumes DVORP_PIERCING, factor: 0.5 if (blood > you.hp) blood = you.hp; - + bleed_onto_floor(you.x_pos, you.y_pos, -1, blood, true); } @@ -3595,7 +3594,7 @@ static int _affect_player( bolt &beam ) was_affected = true; } } - + if (beam.name.find("throwing net") != std::string::npos) { player_caught_in_net(); @@ -3727,7 +3726,7 @@ static int _affect_monster(bolt &beam, monsters *mon) { const int tid = mgrd[mon->x][mon->y]; const int mons_type = menv[tid].type; - const int thrower = YOU_KILL(beam.thrower)? KILL_YOU_MISSILE + const int thrower = YOU_KILL(beam.thrower)? KILL_YOU_MISSILE : KILL_MON_MISSILE; const bool submerged = mon->submerged(); @@ -3935,7 +3934,7 @@ static int _affect_monster(bolt &beam, monsters *mon) if (!beam.is_tracer) { mprf(MSGCH_DIAGNOSTICS, - "Monster: %s; Damage: pre-AC: %d; post-AC: %d; post-resist: %d", + "Monster: %s; Damage: pre-AC: %d; post-AC: %d; post-resist: %d", mon->name(DESC_PLAIN).c_str(), hurt, raw_damage, hurt_final); } #endif @@ -4009,7 +4008,7 @@ static int _affect_monster(bolt &beam, monsters *mon) { hit_woke_orc = true; } - + // Don't annoy friendlies if the player's beam did no damage. // Hostiles will still take umbrage. if (hurt_final > 0 || !mons_friendly(mon) || !YOU_KILL(beam.thrower)) @@ -4051,7 +4050,7 @@ static int _affect_monster(bolt &beam, monsters *mon) mprf("%s blocks the %s.", mon->name(DESC_CAP_THE).c_str(), beam.name.c_str()); - + mon->shield_block_succeeded(); return (BEAM_STOP); } @@ -4061,7 +4060,7 @@ static int _affect_monster(bolt &beam, monsters *mon) _update_hurt_or_helped(beam, mon); conduct.enabled = true; - + // the beam hit. if (mons_near(mon)) { @@ -4105,7 +4104,7 @@ static int _affect_monster(bolt &beam, monsters *mon) // now hurt monster hurt_monster( mon, hurt_final ); - + if (mon->hit_points < 1) { _monster_die(mon, beam); @@ -4363,7 +4362,7 @@ static int _affect_monster_enchantment(bolt &beam, monsters *mon) // if (!death_check && check_mons_resist_magic( mon, beam.ench_power ) - && beam.flavour != BEAM_HASTE + && beam.flavour != BEAM_HASTE && beam.flavour != BEAM_HEALING && beam.flavour != BEAM_INVISIBILITY) { @@ -4409,9 +4408,9 @@ static int _affect_monster_enchantment(bolt &beam, monsters *mon) if (beam.flavour == BEAM_SLEEP) { if (mon->has_ench(ENCH_SLEEP_WARY)) // slept recently - return (MON_RESIST); + return (MON_RESIST); - if (mons_holiness(mon) != MH_NATURAL) // no unnatural + if (mons_holiness(mon) != MH_NATURAL) // no unnatural return (MON_UNAFFECTED); // Cold res monsters resist hibernation (for consistency @@ -4552,7 +4551,7 @@ static void _explosion1(bolt &pbolt) pbolt.flavour = BEAM_HOLY; ex_size = 2; } - + if (pbolt.name == "fireball") { seeMsg = "The fireball explodes!"; @@ -4672,7 +4671,7 @@ void explosion( bolt &beam, bool hole_in_the_middle, if (ray.x() == beam.source_x && ray.y() == beam.source_y) { max_dist--; - ray.advance(true); + ray.advance(true); } int dist = 0; @@ -4743,8 +4742,8 @@ void explosion( bolt &beam, bool hole_in_the_middle, #if DEBUG_DIAGNOSTICS mprf(MSGCH_DIAGNOSTICS, "explosion at (%d, %d) : t=%d c=%d f=%d hit=%d dam=%dd%d", - beam.target_x, beam.target_y, - beam.type, beam.colour, beam.flavour, + beam.target_x, beam.target_y, + beam.type, beam.colour, beam.flavour, beam.hit, beam.damage.num, beam.damage.size ); #endif @@ -4786,7 +4785,7 @@ void explosion( bolt &beam, bool hole_in_the_middle, // do center -- but only if its affected if (!hole_in_the_middle) _explosion_cell(beam, 0, 0, drawing); - + // do the rest of it for (int rad = 1; rad <= r; rad ++) { @@ -5009,7 +5008,7 @@ bool nice_beam( monsters *mon, bolt &beam ) // A constructor for bolt to help guarantee that we start clean (this has // caused way too many bugs). Putting it here since there's no good place to // put it, and it doesn't do anything other than initialize it's members. -// +// // TODO: Eventually it'd be nice to have a proper factory for these things // (extended from setup_mons_cast() and zapping() which act as limited ones). bolt::bolt() : range(0), rangeMax(0), type('*'), @@ -5034,7 +5033,7 @@ killer_type bolt::killer() const { if (flavour == BEAM_BANISH) return (KILL_RESET); - + switch (thrower) { case KILL_YOU: @@ -5076,5 +5075,5 @@ void bolt::setup_retrace() std::swap(source_x, target_x); std::swap(source_y, target_y); affects_nothing = true; - aimed_at_spot = true; + aimed_at_spot = true; } diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc index 0f0509b730..bd1d677599 100644 --- a/crawl-ref/source/debug.cc +++ b/crawl-ref/source/debug.cc @@ -200,7 +200,7 @@ static int debug_prompt_for_skill( const char *prompt ) mpr( prompt, MSGCH_PROMPT ); get_input_line( specs, sizeof( specs ) ); - + if (specs[0] == '\0') return (-1); @@ -239,14 +239,14 @@ static int debug_prompt_for_skill( const char *prompt ) // //--------------------------------------------------------------- #ifdef WIZARD -void debug_change_species( void ) +void debug_change_species( void ) { char specs[80]; int i; mpr( "What species would you like to be now? " , MSGCH_PROMPT ); get_input_line( specs, sizeof( specs ) ); - + if (specs[0] == '\0') return; strlwr(specs); @@ -283,18 +283,18 @@ void debug_change_species( void ) you.skill_points[i] /= species_skills( i, you.species ); } - you.species = sp; + you.species = sp; you.is_undead = ((you.species == SP_MUMMY) ? US_UNDEAD : (you.species == SP_GHOUL || you.species == SP_VAMPIRE) ? US_HUNGRY_DEAD : US_ALIVE); redraw_screen(); } -} -#endif +} +#endif //--------------------------------------------------------------- // -// debug_prompt_for_int +// debug_prompt_for_int // // If nonneg, then it returns a non-negative number or -1 on fail // If !nonneg, then it returns an integer, and 0 on fail @@ -392,11 +392,11 @@ void cast_spec_spell_name(void) void create_spec_monster(void) { int mon = debug_prompt_for_int( "Create which monster by number? ", true ); - + if (mon == -1) canned_msg( MSG_OK ); else - create_monster( mon, 0, BEH_SLEEP, + create_monster( mon, 0, BEH_SLEEP, you.x_pos, you.y_pos, MHITNOT, MONS_PROGRAM_BUG, true ); } // end create_spec_monster() @@ -421,13 +421,13 @@ void create_spec_monster_name(int x, int y) mons_list mlist; std::string err = mlist.add_mons(specs); - + if (!err.empty()) { mpr(err.c_str()); return; } - + const bool force_place = (x != -1 && y != -1); if (x == -1) x = you.x_pos; @@ -449,7 +449,7 @@ void create_spec_monster_name(int x, int y) // were already created. if (mons_is_unique(mspec.mid) && you.unique_creatures[mspec.mid]) you.unique_creatures[mspec.mid] = false; - + if (!dgn_place_monster(mspec, you.your_level, x, y, false)) { mpr("Unable to place monster"); @@ -464,9 +464,11 @@ void create_spec_monster_name(int x, int y) if (mid >= MAX_MONSTERS || menv[mid].type != MONS_PLAYER_GHOST) { for (mid = 0; mid < MAX_MONSTERS; mid++) - if (menv[mid].type == MONS_PLAYER_GHOST + if (menv[mid].type == MONS_PLAYER_GHOST && menv[mid].alive()) + { break; + } } if (mid >= MAX_MONSTERS) @@ -495,7 +497,7 @@ void create_spec_monster_name(int x, int y) sp_id = SP_HUMAN; } ghost.species = static_cast(sp_id); - + mpr( "Make player ghost which class? ", MSGCH_PROMPT ); get_input_line( input_str, sizeof( input_str ) ); @@ -686,7 +688,7 @@ void wizard_interlevel_travel() { const level_pos pos = prompt_translevel_target(TPF_ALLOW_UPDOWN | TPF_SHOW_ALL_BRANCHES).p; - + if (pos.id.depth < 1 || pos.id.depth > branches[pos.id.branch].depth) { canned_msg(MSG_OK); @@ -758,7 +760,7 @@ static void rune_from_specs(const char* _specs, item_def &item) int keyin = tolower( get_ch() ); - if (keyin == ESCAPE || keyin == ' ' + if (keyin == ESCAPE || keyin == ' ' || keyin == '\r' || keyin == '\n') { canned_msg( MSG_OK ); @@ -844,7 +846,7 @@ static void deck_from_specs(const char* _specs, item_def &item) // Remove "plain " from front std::string name = item.name(DESC_PLAIN).substr(6); item.props.clear(); - + if (name.find(type_str) != std::string::npos) break; } @@ -864,7 +866,7 @@ static void deck_from_specs(const char* _specs, item_def &item) int keyin = tolower( get_ch() ); - if (keyin == ESCAPE || keyin == ' ' + if (keyin == ESCAPE || keyin == ' ' || keyin == '\r' || keyin == '\n') { canned_msg( MSG_OK ); @@ -905,7 +907,7 @@ static void deck_from_specs(const char* _specs, item_def &item) int keyin = tolower( get_ch() ); - if (keyin == ESCAPE || keyin == ' ' + if (keyin == ESCAPE || keyin == ' ' || keyin == '\r' || keyin == '\n') { canned_msg( MSG_OK ); @@ -942,7 +944,7 @@ static void deck_from_specs(const char* _specs, item_def &item) return; } - item.plus = num; + item.plus = num; init_deck(item); } @@ -962,7 +964,7 @@ static void rune_or_deck_from_specs(const char* specs, item_def &item) //--------------------------------------------------------------- void create_spec_object() { - static int max_subtype[] = + static int max_subtype[] = { NUM_WEAPONS, NUM_MISSILES, @@ -998,13 +1000,13 @@ void create_spec_object() int thing_created; - while (class_wanted == OBJ_UNASSIGNED) + while (class_wanted == OBJ_UNASSIGNED) { mpr(") - weapons ( - missiles [ - armour / - wands ? - scrolls", MSGCH_PROMPT); mpr("= - jewellery ! - potions : - books | - staves 0 - The Orb", MSGCH_PROMPT); - mpr("} - miscellany X - corpses % - food $ - gold ESC - exit", + mpr("} - miscellany X - corpses % - food $ - gold ESC - exit", MSGCH_PROMPT); mpr("What class of item? ", MSGCH_PROMPT); @@ -1039,7 +1041,7 @@ void create_spec_object() class_wanted = OBJ_FOOD; else if (keyin == '$') class_wanted = OBJ_GOLD; - else if (keyin == ESCAPE || keyin == ' ' + else if (keyin == ESCAPE || keyin == ' ' || keyin == '\r' || keyin == '\n') { canned_msg( MSG_OK ); @@ -1110,8 +1112,8 @@ void create_spec_object() return; } - // In order to get the sub-type, we'll fill out the base type... - // then we're going to iterate over all possible subtype values + // In order to get the sub-type, we'll fill out the base type... + // then we're going to iterate over all possible subtype values // and see if we get a winner. -- bwr mitm[thing_created].base_type = class_wanted; mitm[thing_created].sub_type = 0; @@ -1152,7 +1154,7 @@ void create_spec_object() if (ptr - obj_name < best_index) { mpr( obj_name ); - type_wanted = i; + type_wanted = i; best_index = ptr - obj_name; } } @@ -1173,10 +1175,10 @@ void create_spec_object() } type_wanted--; } - + mitm[thing_created].sub_type = type_wanted; } - + switch (mitm[thing_created].base_type) { case OBJ_MISSILES: @@ -1186,7 +1188,7 @@ void create_spec_object() case OBJ_ARMOUR: mpr( "What ego type? ", MSGCH_PROMPT ); get_input_line( specs, sizeof( specs ) ); - + if (specs[0] != '\0') { special_wanted = 0; @@ -1205,7 +1207,7 @@ void create_spec_object() if (ptr - obj_name < best_index) { mpr( obj_name ); - special_wanted = i; + special_wanted = i; best_index = ptr - obj_name; } } @@ -1225,7 +1227,7 @@ void create_spec_object() mpr( "Sorry, no books on that skill today." ); } break; - + case OBJ_WANDS: mitm[thing_created].plus = 24; break; @@ -1322,7 +1324,7 @@ void tweak_object(void) field_ptr = &(you.inv[item].quantity); else if (keyin == 'e') field_ptr = &(you.inv[item].flags); - else if (keyin == ESCAPE || keyin == ' ' + else if (keyin == ESCAPE || keyin == ' ' || keyin == '\r' || keyin == '\n') { canned_msg( MSG_OK ); @@ -1338,7 +1340,7 @@ void tweak_object(void) const short *const ptr = static_cast< short * >( field_ptr ); mprf("Old value: %d (0x%04x)", *ptr, *ptr ); } - else + else { const long *const ptr = static_cast< long * >( field_ptr ); mprf("Old value: %ld (0x%08lx)", *ptr, *ptr ); @@ -1346,7 +1348,7 @@ void tweak_object(void) mpr( "New value? ", MSGCH_PROMPT ); get_input_line( specs, sizeof( specs ) ); - + if (specs[0] == '\0') return; @@ -1408,7 +1410,7 @@ void stethoscope(int mwh) if (env.cgrid[steth_x][steth_y] != EMPTY_CLOUD) { - mprf(MSGCH_DIAGNOSTICS, "cloud type: %d delay: %d", + mprf(MSGCH_DIAGNOSTICS, "cloud type: %d delay: %d", env.cloud[ env.cgrid[steth_x][steth_y] ].type, env.cloud[ env.cgrid[steth_x][steth_y] ].decay ); } @@ -1428,7 +1430,7 @@ void stethoscope(int mwh) i, menv[i].type, menv[i].x, menv[i].y, ((menv[i].attitude == ATT_FRIENDLY) ? "friendly" : (menv[i].attitude == ATT_HOSTILE) ? "hostile" : - (menv[i].attitude == ATT_NEUTRAL) ? "neutral" + (menv[i].attitude == ATT_NEUTRAL) ? "neutral" : "unknown alignment") ); // print stats and other info @@ -1437,7 +1439,7 @@ void stethoscope(int mwh) "energy=%d num=%d flags=%04lx", menv[i].hit_dice, menv[i].experience, - menv[i].hit_points, menv[i].max_hit_points, + menv[i].hit_points, menv[i].max_hit_points, menv[i].ac, menv[i].ev, mons_resist_magic( &menv[i] ), menv[i].speed, menv[i].speed_increment, @@ -1480,7 +1482,7 @@ void stethoscope(int mwh) mprf(MSGCH_DIAGNOSTICS, "ench: %s", menv[i].describe_enchantments().c_str()); - if (menv[i].type == MONS_PLAYER_GHOST + if (menv[i].type == MONS_PLAYER_GHOST || menv[i].type == MONS_PANDEMONIUM_DEMON) { ASSERT(menv[i].ghost.get()); @@ -1583,7 +1585,7 @@ void debug_item_scan( void ) { mpr( "Unlinked item:", MSGCH_WARN ); dump_item( name, i, mitm[i] ); - + mprf("igrd(%d,%d) = %d", mitm[i].x, mitm[i].y, igrd[ mitm[i].x ][ mitm[i].y ] ); @@ -1594,7 +1596,7 @@ void debug_item_scan( void ) { if (menv[j].inv[k] == i) { - mprf("Held by monster #%d: %s at (%d,%d)", + mprf("Held by monster #%d: %s at (%d,%d)", j, menv[j].name(DESC_CAP_A, true).c_str(), menv[j].x, menv[j].y ); } @@ -1622,20 +1624,20 @@ void debug_item_scan( void ) mpr( "Bad item:", MSGCH_WARN ); dump_item( name, i, mitm[i] ); } - else if ((mitm[i].base_type == OBJ_WEAPONS - && (abs(mitm[i].plus) > 30 + else if ((mitm[i].base_type == OBJ_WEAPONS + && (abs(mitm[i].plus) > 30 || abs(mitm[i].plus2) > 30 || (!is_random_artefact( mitm[i] ) - && (mitm[i].special >= 30 + && (mitm[i].special >= 30 && mitm[i].special < 181)))) - || (mitm[i].base_type == OBJ_MISSILES - && (abs(mitm[i].plus) > 25 - || (!is_random_artefact( mitm[i] ) + || (mitm[i].base_type == OBJ_MISSILES + && (abs(mitm[i].plus) > 25 + || (!is_random_artefact( mitm[i] ) && mitm[i].special >= 30))) || (mitm[i].base_type == OBJ_ARMOUR - && (abs(mitm[i].plus) > 25 + && (abs(mitm[i].plus) > 25 || (!is_random_artefact( mitm[i] ) && mitm[i].special >= 30)))) { @@ -1659,7 +1661,7 @@ void debug_item_scan( void ) mprf( MSGCH_WARN, "Buggy monster detected: monster #%d; position (%d,%d)", i, monster.x, monster.y ); - } + } } } #endif @@ -1738,7 +1740,7 @@ static void debug_acquirement_stats(FILE *ostat) int item_index = NON_ITEM; if (!acquirement(type, AQ_WIZMODE, true, &item_index) - || item_index == NON_ITEM + || item_index == NON_ITEM || !is_valid_item(mitm[item_index])) { mpr("Acquirement failed, stopping early."); @@ -1881,7 +1883,7 @@ static void debug_rap_stats(FILE *ostat) -1, //RAP_CURSED 0, //RAP_STEALTH 0 //RAP_MAGICAL_POWER - }; + }; // No bounds checking to speed things up a bit. int all_props[RAP_NUM_PROPERTIES]; @@ -2112,7 +2114,7 @@ void debug_set_skills(void) canned_msg( MSG_OK ); else { - const int points = (skill_exp_needed( amount + 1 ) + const int points = (skill_exp_needed( amount + 1 ) * species_skills( skill, you.species )) / 100; you.skill_points[skill] = points + 1; @@ -2172,13 +2174,13 @@ void debug_set_all_skills(void) for (i = SK_FIGHTING; i < NUM_SKILLS; i++) { - if (i == SK_UNUSED_1 + if (i == SK_UNUSED_1 || (i > SK_UNARMED_COMBAT && i < SK_SPELLCASTING)) { continue; } - const int points = (skill_exp_needed( amount + 1 ) + const int points = (skill_exp_needed( amount + 1 ) * species_skills( i, you.species )) / 100; you.skill_points[i] = points + 1; @@ -2349,7 +2351,7 @@ bool debug_add_mutation(void) mpr( "Which mutation ('any' for any, 'xom' for xom mutation)? ", MSGCH_PROMPT ); get_input_line( specs, sizeof( specs ) ); - + if (specs[0] == '\0') return (false); @@ -2438,7 +2440,7 @@ bool debug_add_mutation(void) success = true; } } - else + else { for (int i = 0; i < -levels; i++) { @@ -2465,7 +2467,7 @@ void debug_get_religion(void) mpr( "Which god (by name)? ", MSGCH_PROMPT ); get_input_line( specs, sizeof( specs ) ); - + if (specs[0] == '\0') return; @@ -2506,8 +2508,8 @@ void error_message_to_player(void) static int create_fsim_monster(int mtype, int hp) { - const int mi = - create_monster( mtype, 0, BEH_HOSTILE, you.x_pos, you.y_pos, + const int mi = + create_monster( mtype, 0, BEH_HOSTILE, you.x_pos, you.y_pos, MHITNOT, MONS_PROGRAM_BUG ); if (mi == -1) @@ -2538,7 +2540,7 @@ static void fsim_set_ranged_skill(int skill, const item_def *item) you.skills[SK_THROWING] = skill * 15 / 27; } -static void fsim_item(FILE *out, +static void fsim_item(FILE *out, bool melee, const item_def *weap, const char *wskill, @@ -2577,9 +2579,9 @@ static void fsim_defence_item(FILE *out, long cum, int hits, int max, max, 100 / speed); } - -static bool fsim_ranged_combat(FILE *out, int wskill, int mi, + +static bool fsim_ranged_combat(FILE *out, int wskill, int mi, const item_def *item, int missile_slot) { monsters &mon = menv[mi]; @@ -2639,7 +2641,7 @@ static bool fsim_mon_melee(FILE *out, int dodge, int armour, int mi) long hits = 0L; int maxdam = 0; no_messages mx; - + for (long i = 0; i < Options.fsim_rounds; ++i) { you.hp = you.hp_max = 5000; @@ -2660,7 +2662,7 @@ static bool fsim_mon_melee(FILE *out, int dodge, int armour, int mi) return (true); } -static bool fsim_melee_combat(FILE *out, int wskill, int mi, +static bool fsim_melee_combat(FILE *out, int wskill, int mi, const item_def *item) { monsters &mon = menv[mi]; @@ -2720,8 +2722,8 @@ static std::string fsim_wskill(int missile_slot) const item_def *iweap = fsim_weap_item(); if (!iweap && missile_slot != -1) return skill_name(range_skill(you.inv[missile_slot])); - - return iweap && iweap->base_type == OBJ_WEAPONS + + return iweap && iweap->base_type == OBJ_WEAPONS && is_range_weapon(*iweap)? skill_name( range_skill(*iweap) ) : iweap? skill_name( fsim_melee_skill(iweap) ) : @@ -2739,7 +2741,7 @@ static std::string fsim_weapon(int missile_slot) item_buf = weapon.name(DESC_PLAIN, true); if (is_range_weapon(weapon)) { - const int missile = + const int missile = missile_slot == -1? you.m_quiver->get_fire_item() : missile_slot; if (missile < ENDOFPACK && missile >= 0) @@ -2880,7 +2882,7 @@ static bool fsim_mon_hit_you(FILE *ostat, int mindex, int) mprf("Done defence simulation with %s", menv[mindex].name(DESC_PLAIN).c_str()); - + return (true); } @@ -2894,7 +2896,7 @@ static bool fsim_you_hit_mon(FILE *ostat, int mindex, int missile_slot) fsim_weapon(missile_slot).c_str(), wskill); if (!debug_fight_simulate(ostat, wskill, mindex, missile_slot)) return (false); - + fflush(ostat); // Not checking in the combat loop itself; that would be more responsive // for the user, but slow down the sim with all the calls to kbhit(). @@ -3000,7 +3002,7 @@ int fsim_kit_equip(const std::string &kit) { if (!is_valid_item(you.inv[i])) continue; - + if (you.inv[i].name(DESC_PLAIN).find(missile) != std::string::npos) { missile_slot = i; @@ -3014,7 +3016,7 @@ int fsim_kit_equip(const std::string &kit) // Writes statistics about a fight to fight.stat in the current directory. // For fight purposes, a punching bag is summoned and given lots of hp, and the -// average damage the player does to the p. bag over 10000 hits is noted, +// average damage the player does to the p. bag over 10000 hits is noted, // advancing the weapon skill from 0 to 27, and keeping fighting skill to 2/5 // of current weapon skill. void debug_fight_statistics(bool use_defaults, bool defence) @@ -3031,7 +3033,7 @@ void debug_fight_statistics(bool use_defaults, bool defence) } you.exp_available = 0; - + if (!use_defaults || defence) debug_fight_sim(mindex, -1, defence? fsim_mon_hit_you : fsim_you_hit_mon); @@ -3049,7 +3051,7 @@ void debug_fight_statistics(bool use_defaults, bool defence) break; } } - monster_die(&menv[mindex], KILL_DISMISSED, 0); + monster_die(&menv[mindex], KILL_DISMISSED, 0); } static int find_trap_slot() @@ -3091,7 +3093,7 @@ void debug_make_trap() std::vector match_names; for (int t = TRAP_DART; t < NUM_TRAPS; ++t) { - if (strstr(requested_trap, + if (strstr(requested_trap, trap_name(trap_type(t)))) { trap = trap_type(t); @@ -3176,7 +3178,7 @@ void debug_make_shop() representative = !!strchr(requested_shop, '*'); - place_spec_shop(you.your_level, you.x_pos, you.y_pos, + place_spec_shop(you.your_level, you.x_pos, you.y_pos, new_shop_type, representative); link_items(); mprf("Done."); @@ -3277,7 +3279,7 @@ void debug_set_xl() static void debug_load_map_by_name(std::string name) { const bool place_on_us = strip_tag(name, "*", true); - + level_clear_vault_memory(); int map = find_map_by_name(name); if (map == -1) @@ -3316,7 +3318,7 @@ static void debug_load_map_by_name(std::string name) { where = you.pos(); } - + if (dgn_place_map(map, false, true, false, where)) mprf("Successfully placed %s.", map_by_index(map)->name.c_str()); else @@ -3401,7 +3403,7 @@ static int debug_time_explore() start_explore(false); unwind_var es(Options.explore_stop, 0); - + const long start = you.num_turns; while (you_are_delayed()) { @@ -3649,7 +3651,7 @@ void wizard_give_monster_item(monsters *mon) } // Shouldn't be be using MONUSE_MAGIC_ITEMS? - if (item_use == MONUSE_STARTING_EQUIPMENT + if (item_use == MONUSE_STARTING_EQUIPMENT && !mons_is_unique( mon->type )) { switch(mon_slot) @@ -3738,7 +3740,7 @@ void mapgen_report_map_build_start() void mapgen_report_map_veto() { mg_vetoes++; - mapgen_map_builds[level_id::current()].second++; + mapgen_map_builds[level_id::current()].second++; } static map_mask mg_MapMask; @@ -3746,7 +3748,7 @@ static map_mask mg_MapMask; static bool _mg_region_flood(const coord_def &c, int region, bool flag) { bool found_exit = false; - + mg_MapMask(c) = region; if (flag) @@ -3764,7 +3766,7 @@ static bool _mg_region_flood(const coord_def &c, int region, bool flag) { if (!xi && !yi) continue; - + coord_def ci = c + coord_def(xi, yi); if (!in_bounds(ci) || mg_MapMask(ci) || !dgn_square_is_passable(ci)) continue; @@ -3781,7 +3783,7 @@ static bool _mg_is_disconnected_level() if (you.level_type != LEVEL_DUNGEON || (branches[you.where_are_you].branch_flags & BFLAG_ISLANDED)) return (false); - + std::vector region_seeds; mg_MapMask.init(0); @@ -3802,7 +3804,7 @@ static bool _mg_is_disconnected_level() mg_MapMask.init(0); for (int i = 0, size = region_seeds.size(); i < size; ++i) _mg_region_flood(region_seeds[i], 1, true); - + return (good_regions < region); } @@ -3882,9 +3884,9 @@ static bool mg_do_build_level(int niters) for (int y = 0; y < GYM; ++y) for (int x = 0; x < GXM; ++x) set_envmap_obj(x, y, grd[x][y]); - + dump_map(fp); - + return (false); } } @@ -3898,7 +3900,7 @@ static std::vector mg_dungeon_places() { if (branches[br].depth == -1) continue; - + const branch_type branch = static_cast(br); for (int depth = 1; depth <= branches[br].depth; ++depth) places.push_back( level_id(branch, depth) ); @@ -3947,7 +3949,7 @@ static void mg_build_levels(int niters) mapgen_use_count.size(), mg_build_attempts, mg_vetoes, mg_build_attempts? mg_vetoes * 100.0 / mg_build_attempts : 0.0); - + you.uniq_map_tags.clear(); you.uniq_map_names.clear(); if (!mg_build_dungeon()) @@ -3977,7 +3979,7 @@ static void mapgen_report_avaiable_random_vaults(FILE *outf) { you.uniq_map_tags.clear(); you.uniq_map_names.clear(); - + const std::vector places = mg_dungeon_places(); fprintf(outf, "\n\nRandom vaults available by dungeon level:\n"); @@ -4080,7 +4082,7 @@ static void write_mapgen_stats() vetoes, tries, vetoes * 100.0 / tries); } } - + if (!unused_maps.empty()) { fprintf(outf, "\n\nUnused maps:\n\n"); diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc index 7741a091db..1728208b5a 100644 --- a/crawl-ref/source/decks.cc +++ b/crawl-ref/source/decks.cc @@ -370,7 +370,7 @@ static card_type _choose_from_archetype(const deck_archetype* pdeck, card_type result = NUM_CARDS; while ( pdeck[i].card != NUM_CARDS ) { - const card_with_weights& cww = pdeck[i]; + const card_with_weights& cww = pdeck[i]; totalweight += cww.weight[rarity]; if ( random2(totalweight) < cww.weight[rarity] ) result = cww.card; @@ -646,7 +646,7 @@ static bool _check_buggy_deck(item_def& deck) strm << "Oops, counted " << static_cast(num_marked) << " marked cards, but num_marked is " - << (static_cast(props["num_marked"].get_byte())); + << (static_cast(props["num_marked"].get_byte())); #else strm << "Oops, book-keeping on marked cards is wrong."; #endif @@ -654,7 +654,7 @@ static bool _check_buggy_deck(item_def& deck) props["num_marked"] = static_cast(num_marked); problems = true; - } + } if (deck.plus2 >= 0) { @@ -708,7 +708,7 @@ static int _choose_inventory_deck( const char* prompt ) MT_INVLIST, OBJ_MISCELLANY, true, true, true, 0, NULL, OPER_EVOKE ); - + if ( slot == PROMPT_ABORT ) { canned_msg(MSG_OK); @@ -759,8 +759,9 @@ static void _deck_lose_card(item_def& deck) do { _shuffle_deck(deck); get_card_and_flags(deck, -1, flags); - } while ( ((flags & CFLAG_MARKED) && coinflip()) || - ((flags & CFLAG_SEEN) && coinflip()) ); + } + while ( (flags & CFLAG_MARKED) && coinflip() + || (flags & CFLAG_SEEN) && coinflip() ); _draw_top_card(deck, false, flags); deck.plus2++; @@ -973,7 +974,7 @@ bool deck_stack() mprf("The deck only has %d cards.", num_to_stack); else if (num_cards == 5) mpr("The deck has exactly five cards."); - else + else mprf("You draw the first five cards out of %d and discard the rest.", num_cards); more(); @@ -990,7 +991,7 @@ bool deck_stack() cprintf("Press Enter to accept."); _redraw_stacked_cards(draws, selected); - + // Hand-hacked implementation, instead of using Menu. Oh well. while (true) { @@ -1006,19 +1007,19 @@ bool deck_stack() clear_to_end_of_line(); continue; } - + if ( c >= '1' && c <= '0' + static_cast(draws.size()) ) { const unsigned int new_selected = c - '1'; if ( selected < draws.size() ) { std::swap(draws[selected], draws[new_selected]); - std::swap(flags[selected], flags[new_selected]); + std::swap(flags[selected], flags[new_selected]); selected = draws.size(); } else selected = new_selected; - + _redraw_stacked_cards(draws, selected); } } @@ -1031,7 +1032,7 @@ bool deck_stack() _push_top_card(deck, draws[draws.size() - 1 - i], flags[flags.size() - 1 - i]); } - + props["num_marked"] = static_cast(num_to_stack); you.wield_change = true; @@ -1391,10 +1392,10 @@ static void _damnation_card(int power, deck_rarity_type rarity) const int power_level = get_power_level(power, rarity); int nemelex_bonus = 0; if ( you.religion == GOD_NEMELEX_XOBEH && !player_under_penance() ) - nemelex_bonus = you.piety / 20; + nemelex_bonus = you.piety / 20; int extra_targets = power_level + random2(you.skills[SK_EVOCATIONS] + nemelex_bonus) / 12; - + for ( int i = 0; i < 1 + extra_targets; ++i ) { // pick a random monster nearby to banish (or yourself) @@ -1460,7 +1461,7 @@ static void _warpwright_card(int power, deck_rarity_type rarity) static void _flight_card(int power, deck_rarity_type rarity) { const int power_level = get_power_level(power, rarity); - + if ( power_level == 0 ) transform(random2(power/4), coinflip() ? TRAN_SPIDER : TRAN_BAT); if ( power_level >= 1 ) @@ -1500,7 +1501,7 @@ static void _minefield_card(int power, deck_rarity_type rarity) const int ry = you.y_pos + dy; if ( !in_bounds(rx, ry) ) continue; - + if ( grd[rx][ry] == DNGN_FLOOR && trap_at_xy(rx,ry) == -1 && one_chance_in(4 - power_level) ) { @@ -1676,14 +1677,14 @@ static void _metamorphosis_card(int power, deck_rarity_type rarity) { const int power_level = get_power_level(power, rarity); transformation_type trans; - + if ( power_level >= 2 ) trans = coinflip() ? TRAN_DRAGON : TRAN_LICH; else if ( power_level == 1 ) trans = coinflip() ? TRAN_STATUE : TRAN_BLADE_HANDS; else trans = coinflip() ? TRAN_SPIDER : TRAN_ICE_BEAST; - + transform(random2(power/4), trans); } @@ -1728,7 +1729,7 @@ static void _helm_card(int power, deck_rarity_type rarity) const char* resist_names[4] = { "poison", "electricity", "fire", "cold" }; - + for ( int i = 0; i < 4 && num_resists; ++i ) { // if there are n left, of which we need to choose @@ -1839,7 +1840,7 @@ static void _focus_card(int power, deck_rarity_type rarity) const int best_diff = *max_statp[i] - *max_statp[best_stat]; if ( best_diff > 0 || (best_diff == 0 && coinflip()) ) best_stat = i; - + const int worst_diff = *max_statp[i] - *max_statp[worst_stat]; if ( worst_diff < 0 || (worst_diff == 0 && coinflip()) ) worst_stat = i; @@ -1878,7 +1879,7 @@ static void _focus_card(int power, deck_rarity_type rarity) cause = "the 'helpfullness' of " + god_name(which_god); } } - + for ( int i = 0; i < 3; ++i ) if (*max_statp[i] < 1 || *base_statp[i] < 1) ouch(INSTANT_DEATH, 0, kill_types[i], cause.c_str(), true); @@ -1904,7 +1905,7 @@ static void _shuffle_card(int power, deck_rarity_type rarity) modifiers[i] = stat_modifier(stats[i]); std::random_shuffle( perm, perm + 3 ); - + int new_base[3]; int new_max[3]; for ( int i = 0; i < 3; ++i ) @@ -1935,7 +1936,7 @@ static void _shuffle_card(int power, deck_rarity_type rarity) cause = "the 'helpfulness' of " + god_name(which_god); } } - + for ( int i = 0; i < 3; ++i ) if (new_base[i] < 1 || new_max[i] < 1) ouch(INSTANT_DEATH, 0, kill_types[i], cause.c_str(), true); @@ -2076,7 +2077,7 @@ static void _helix_card(int power, deck_rarity_type rarity) delete_mutation(RANDOM_MUTATION); mutate(RANDOM_MUTATION); } - break; + break; } } else @@ -2117,7 +2118,7 @@ static void _sage_card(int power, deck_rarity_type rarity) c = random2(10) + 1; else c = 10; - + // FIXME: yet another reproduction of random_choose_weighted // Ah for Python: // skill = random_choice([x*(40-x)*c/10 for x in skill_levels]) @@ -2498,7 +2499,7 @@ static void _summon_demon_card(int power, deck_rarity_type rarity) dct = DEMON_COMMON; else dct = DEMON_LESSER; - + create_monster( summon_any_demon(dct), std::min(power/50,6), BEH_FRIENDLY, you.x_pos, you.y_pos, MHITYOU, MONS_PROGRAM_BUG ); @@ -2527,7 +2528,7 @@ static void _summon_any_monster(int power, deck_rarity_type rarity) dy = random2(3) - 1; } while ( dx == 0 && dy == 0 ); - + monster_type cur_try; do { @@ -2546,7 +2547,7 @@ static void _summon_any_monster(int power, deck_rarity_type rarity) if ( mon_chosen == NUM_MONSTERS ) // should never happen return; - + if ( power_level == 0 && one_chance_in(4) ) create_monster( mon_chosen, 3, BEH_HOSTILE, chosen_x, chosen_y, MHITYOU, MONS_PROGRAM_BUG ); @@ -2565,7 +2566,7 @@ static void _summon_dancing_weapon(int power, deck_rarity_type rarity) friendly ? you.pet_target : MHITYOU, MONS_PROGRAM_BUG, false, false, false, true ); - + // Given the abundance of Nemelex decks, not setting hard reset // leaves a trail of weapons behind, most of which just get // offered to Nemelex again, adding an unnecessary source of @@ -2575,7 +2576,7 @@ static void _summon_dancing_weapon(int power, deck_rarity_type rarity) // Override the weapon ASSERT( menv[mon].weapon() != NULL ); item_def& wpn(*menv[mon].weapon()); - + // FIXME Mega-hack (breaks encapsulation too) wpn.flags &= ~ISFLAG_RACIAL_MASK; @@ -2680,7 +2681,7 @@ bool card_effect(card_type which_card, deck_rarity_type rarity, { bool rc = true; const int power = _card_power(rarity); - + #ifdef DEBUG_DIAGNOSTICS msg::streams(MSGCH_DIAGNOSTICS) << "Card power: " << power << ", rarity: " << static_cast(rarity) @@ -2805,7 +2806,7 @@ bool card_effect(card_type which_card, deck_rarity_type rarity, god_speaks(GOD_XOM, "\"How boring, let's spice things up a little.\""); xom_acts(abs(you.piety - 100)); } - + if (you.religion == GOD_NEMELEX_XOBEH && !rc) simple_god_message(" seems disappointed in you."); diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index ed787ab125..461f4341de 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -1288,7 +1288,7 @@ void fire_target_behaviour::message_ammo_prompt(const std::string* pre_text) { const int next_item = get_next_fire_item(m_slot, +1); bool no_other_items = (next_item == -1 || next_item == m_slot); - + mesclr(); if (pre_text) @@ -1408,7 +1408,7 @@ static bool _fire_choose_item_and_target(int& slot, dist& target) beh.message_ammo_prompt(); message_current_target(); // XXX: this stuff should be done by direction() direction( target, DIR_NONE, TARG_ENEMY, -1, false, true, NULL, &beh ); - + if (beh.m_slot == -1) { canned_msg(MSG_OK); @@ -1713,15 +1713,15 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, // launcher weapon sub-type weapon_type lnchType; - int baseHit = 0, baseDam = 0; // from thrown or ammo - int ammoHitBonus = 0, ammoDamBonus = 0; // from thrown or ammo - int lnchHitBonus = 0, lnchDamBonus = 0; // special add from launcher - int exHitBonus = 0, exDamBonus = 0; // 'extra' bonus from skill/dex/str - int effSkill = 0; // effective launcher skill - int dice_mult = 100; - bool returning = false; // item can return to pack - bool did_return = false; // returning item actually does return to pack - int slayDam = 0; + int baseHit = 0, baseDam = 0; // from thrown or ammo + int ammoHitBonus = 0, ammoDamBonus = 0; // from thrown or ammo + int lnchHitBonus = 0, lnchDamBonus = 0; // special add from launcher + int exHitBonus = 0, exDamBonus = 0; // 'extra' bonus from skill/dex/str + int effSkill = 0; // effective launcher skill + int dice_mult = 100; + bool returning = false; // item can return to pack + bool did_return = false; // returning item actually does return to pack + int slayDam = 0; if (!teleport) { @@ -1915,9 +1915,7 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, // lower accuracy if held in a net (needs testing) if (you.attribute[ATTR_HELD]) - { baseHit--; - } // for all launched weapons, maximum effective specific skill // is twice throwing skill. This models the fact that no matter @@ -3689,7 +3687,7 @@ static bool affix_weapon_enchantment() // is only naughty if you know you're doing it did_god_conduct(DID_UNHOLY, 10, - get_ident_type(OBJ_SCROLLS, SCR_ENCHANT_WEAPON_III)==ID_KNOWN_TYPE); + get_ident_type(OBJ_SCROLLS, SCR_ENCHANT_WEAPON_III) == ID_KNOWN_TYPE); break; diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc index 06ccc9d944..54b4ec0bf3 100644 --- a/crawl-ref/source/items.cc +++ b/crawl-ref/source/items.cc @@ -141,7 +141,7 @@ static bool _item_ok_to_clean(int item) return false; // never clean runes - if (mitm[item].base_type == OBJ_MISCELLANY + if (mitm[item].base_type == OBJ_MISCELLANY && mitm[item].sub_type == MISC_RUNE_OF_ZOT) { return false; @@ -156,7 +156,7 @@ static int _cull_items(void) { crawl_state.cancel_cmd_repeat(); - // XXX: Not the prettiest of messages, but the player + // XXX: Not the prettiest of messages, but the player // deserves to know whenever this kicks in. -- bwr mpr( "Too many items on level, removing some.", MSGCH_WARN ); @@ -188,7 +188,7 @@ static int _cull_items(void) int next; - // iterate through the grids list of items: + // iterate through the grids list of items: for (int item = igrd[x][y]; item != NON_ITEM; item = next) { next = mitm[item].link; // in case we can't get it later. @@ -223,18 +223,18 @@ static int _cull_items(void) return (first_cleaned); } -// Note: This function is to isolate all the checks to see if +// Note: This function is to isolate all the checks to see if // an item is valid (often just checking the quantity). // -// It shouldn't be used a a substitute for those cases -// which actually want to check the quantity (as the +// It shouldn't be used a a substitute for those cases +// which actually want to check the quantity (as the // rules for unused objects might change). bool is_valid_item( const item_def &item ) { return (item.base_type != OBJ_UNASSIGNED && item.quantity > 0); } -// Reduce quantity of an inventory item, do cleanup if item goes away. +// Reduce quantity of an inventory item, do cleanup if item goes away. // // Returns true if stack of items no longer exists. bool dec_inv_item_quantity( int obj, int amount ) @@ -248,7 +248,7 @@ bool dec_inv_item_quantity( int obj, int amount ) if (you.inv[obj].quantity <= amount) { - for (int i = 0; i < NUM_EQUIP; i++) + for (int i = 0; i < NUM_EQUIP; i++) { if (you.equip[i] == obj) { @@ -283,7 +283,7 @@ bool dec_inv_item_quantity( int obj, int amount ) return (ret); } -// Reduce quantity of a monster/grid item, do cleanup if item goes away. +// Reduce quantity of a monster/grid item, do cleanup if item goes away. // // Returns true if stack of items no longer exists. bool dec_mitm_item_quantity( int obj, int amount ) @@ -337,7 +337,7 @@ void init_item( int item ) } // Returns an unused mitm slot, or NON_ITEM if none available. -// The reserve is the number of item slots to not check. +// The reserve is the number of item slots to not check. // Items may be culled if a reserve <= 10 is specified. int get_item_slot( int reserve ) { @@ -376,7 +376,7 @@ void unlink_item( int dest ) if (dest == NON_ITEM || !is_valid_item( mitm[dest] )) return; - if (mitm[dest].x == 0 && mitm[dest].y == 0) + if (mitm[dest].x == 0 && mitm[dest].y == 0) { // (0,0) is where the monster items are (and they're unlinked by igrd), // although it also contains items that are not linked in yet. @@ -410,7 +410,7 @@ void unlink_item( int dest ) // Always return because this item might just be temporary. return; } - else + else { // Linked item on map: // @@ -450,11 +450,11 @@ void unlink_item( int dest ) // Okay, the sane ways are gone... let's warn the player: mpr( "BUG WARNING: Problems unlinking item!!!", MSGCH_DANGER ); - // Okay, first we scan all items to see if we have something - // linked to this item. We're not going to return if we find - // such a case... instead, since things are already out of + // Okay, first we scan all items to see if we have something + // linked to this item. We're not going to return if we find + // such a case... instead, since things are already out of // alignment, let's assume there might be multiple links as well. - bool linked = false; + bool linked = false; int old_link = mitm[dest].link; // used to try linking the first // clean the relevant parts of the object: @@ -532,7 +532,7 @@ void destroy_item( item_def &item, bool never_created ) void destroy_item( int dest, bool never_created ) { - // Don't destroy non-items, but this function may be called upon + // Don't destroy non-items, but this function may be called upon // to remove items reduced to zero quantity, so we allow "invalid" // objects in. if (dest == NON_ITEM || !is_valid_item( mitm[dest] )) @@ -547,15 +547,15 @@ static void _handle_gone_item(const item_def &item) if (you.level_type == LEVEL_ABYSS && place_type(item.orig_place) == LEVEL_ABYSS && !(item.flags & ISFLAG_BEEN_IN_INV)) - { + { if (item.base_type == OBJ_ORBS) { - set_unique_item_status(OBJ_ORBS, item.sub_type, + set_unique_item_status(OBJ_ORBS, item.sub_type, UNIQ_LOST_IN_ABYSS); } else if (is_fixed_artefact(item)) { - set_unique_item_status(OBJ_WEAPONS, item.special, + set_unique_item_status(OBJ_WEAPONS, item.special, UNIQ_LOST_IN_ABYSS); } } @@ -730,7 +730,7 @@ static int item_name_specialness(const item_def& item) std::string itname = item.name(DESC_PLAIN, false, false, false); lowercase(itname); - + // FIXME Maybe we should replace this with a test of ISFLAG_COSMETIC_MASK? const bool item_runed = itname.find("runed ") != std::string::npos; const bool heav_runed = itname.find("heavily ") != std::string::npos; @@ -778,7 +778,7 @@ void item_check(bool verbose) } bool done_init_line = false; - + if (static_cast(items.size()) >= Options.item_stack_summary_minimum) { std::vector item_chars; @@ -786,7 +786,7 @@ void item_check(bool verbose) { unsigned glyph_char; unsigned short glyph_col; - get_item_glyph( items[i], &glyph_char, &glyph_col ); + get_item_glyph( items[i], &glyph_char, &glyph_col ); item_chars.push_back( glyph_char * 0x100 + (10 - item_name_specialness(*(items[i]))) ); } @@ -827,7 +827,7 @@ void item_check(bool verbose) } else if ( !done_init_line ) strm << "There are many items here." << std::endl; - + if ( items.size() > 5 ) learned_something_new(TUT_MULTI_PICKUP); } @@ -837,7 +837,7 @@ static void _pickup_menu(int item_link) std::vector items; _item_list_on_square( items, item_link, false ); - std::vector selected = + std::vector selected = select_items( items, "Select items to pick up" ); redraw_screen(); @@ -855,7 +855,7 @@ static void _pickup_menu(int item_link) int result = move_item_to_player( j, selected[i].quantity ); // If we cleared any flags on the items, but the pickup was - // partial, reset the flags for the items that remain on the + // partial, reset the flags for the items that remain on the // floor. if (is_valid_item(mitm[j])) mitm[j].flags = oldflags; @@ -1010,7 +1010,7 @@ static void _origin_freeze(item_def &item, int x, int y) { if (!item.orig_monnum && x != -1 && y != -1) origin_set_monstercorpse(item, x, y); - + item.orig_place = get_packed_place(); check_note_item(item); #ifdef DGL_MILESTONES @@ -1120,14 +1120,14 @@ std::string origin_desc(const item_def &item) } else desc += "You found " + _article_it(item) + " "; - + desc += _origin_place_desc(item); return (desc); } bool pickup_single_item(int link, int qty) { - if (you.attribute[ATTR_TRANSFORMATION] == TRAN_AIR + if (you.attribute[ATTR_TRANSFORMATION] == TRAN_AIR && you.duration[DUR_TRANSFORMATION] > 0) { mpr("You can't pick up anything in this form!"); @@ -1161,7 +1161,7 @@ bool pickup_single_item(int link, int qty) learned_something_new(TUT_HEAVY_LOAD); return (false); } - + return (true); } @@ -1169,7 +1169,7 @@ void pickup() { int keyin = 'x'; - if (you.attribute[ATTR_TRANSFORMATION] == TRAN_AIR + if (you.attribute[ATTR_TRANSFORMATION] == TRAN_AIR && you.duration[DUR_TRANSFORMATION] > 0) { mpr("You can't pick up anything in this form!"); @@ -1255,7 +1255,7 @@ void pickup() break; } } - + o = next; } } @@ -1272,7 +1272,7 @@ bool is_stackable_item( const item_def &item ) || item.base_type == OBJ_POTIONS || item.base_type == OBJ_UNKNOWN_II || item.base_type == OBJ_GOLD - || (item.base_type == OBJ_MISCELLANY + || (item.base_type == OBJ_MISCELLANY && item.sub_type == MISC_RUNE_OF_ZOT)) { return (true); @@ -1334,7 +1334,7 @@ bool items_stack( const item_def &item1, const item_def &item2, ISFLAG_DROPPED | ISFLAG_THROWN | \ ISFLAG_NOTED_ID | ISFLAG_NOTED_GET | \ ISFLAG_BEEN_IN_INV) - + if ((item1.flags & NON_IDENT_FLAGS) != (item2.flags & NON_IDENT_FLAGS)) { return false; @@ -1392,9 +1392,11 @@ int find_free_slot(const item_def &i) // See if the item remembers where it's been. Lua code can play with // this field so be extra careful. - if ((i.slot >= 'a' && i.slot <= 'z') || - (i.slot >= 'A' && i.slot <= 'Z')) + if (i.slot >= 'a' && i.slot <= 'z' + || i.slot >= 'A' && i.slot <= 'Z') + { slot = letter_to_index(i.slot); + } if (slotisfree(slot)) return slot; @@ -1408,10 +1410,11 @@ int find_free_slot(const item_def &i) { if (is_valid_item(you.inv[slot])) { - if (!accept_empty && slot + 1 < ENDOFPACK && - !is_valid_item(you.inv[slot + 1])) + if (!accept_empty && slot + 1 < ENDOFPACK + && !is_valid_item(you.inv[slot + 1])) + { return (slot + 1); - + } accept_empty = true; } else if (accept_empty) @@ -1453,7 +1456,7 @@ static void _got_item(item_def& item, int quant) item.flags |= ISFLAG_BEEN_IN_INV; } -// Returns quantity of items moved into player's inventory and -1 if +// Returns quantity of items moved into player's inventory and -1 if // the player's inventory is full. int move_item_to_player( int obj, int quant_got, bool quiet ) { @@ -1486,7 +1489,7 @@ int move_item_to_player( int obj, int quant_got, bool quiet ) const int unit_mass = item_mass( mitm[obj] ); if (quant_got > mitm[obj].quantity || quant_got <= 0) quant_got = mitm[obj].quantity; - + const int imass = unit_mass * quant_got; bool partial_pickup = false; @@ -1505,7 +1508,7 @@ int move_item_to_player( int obj, int quant_got, bool quiet ) retval = part; } - + if (is_stackable_item( mitm[obj] )) { for (int m = 0; m < ENDOFPACK; m++) @@ -1556,8 +1559,8 @@ int move_item_to_player( int obj, int quant_got, bool quiet ) mpr("You can only carry some of what is here."); int freeslot = find_free_slot(mitm[obj]); - if (freeslot < 0 || freeslot >= ENDOFPACK - || is_valid_item(you.inv[freeslot])) + if (freeslot < 0 || freeslot >= ENDOFPACK + || is_valid_item(you.inv[freeslot])) { // Something is terribly wrong return (-1); @@ -1641,8 +1644,8 @@ void mark_items_non_pickup_at(const coord_def &pos) } } -// Moves mitm[obj] to (x,y)... will modify the value of obj to -// be the index of the final object (possibly different). +// Moves mitm[obj] to (x,y)... will modify the value of obj to +// be the index of the final object (possibly different). // // Done this way in the hopes that it will be obvious from // calling code that "obj" is possibly modified. @@ -1660,11 +1663,11 @@ bool move_item_to_grid( int *const obj, int x, int y ) { // check if item already linked here -- don't want to unlink it if (*obj == i) - return (false); + return (false); if (items_stack( mitm[*obj], mitm[i] )) { - // Add quantity to item already here, and dispose + // Add quantity to item already here, and dispose // of obj, while returning the found item. -- bwr inc_mitm_item_quantity( i, mitm[*obj].quantity ); destroy_item( *obj ); @@ -1691,7 +1694,7 @@ bool move_item_to_grid( int *const obj, int x, int y ) ASSERT( *obj != NON_ITEM ); - // Need to actually move object, so first unlink from old position. + // Need to actually move object, so first unlink from old position. unlink_item( *obj ); // move item to coord: @@ -1718,7 +1721,7 @@ bool move_item_to_grid( int *const obj, int x, int y ) void move_item_stack_to_grid( int x, int y, int targ_x, int targ_y ) { - // Tell all items in stack what the new coordinate is. + // Tell all items in stack what the new coordinate is. for (int o = igrd[x][y]; o != NON_ITEM; o = mitm[o].link) { mitm[o].x = targ_x; @@ -1731,7 +1734,7 @@ void move_item_stack_to_grid( int x, int y, int targ_x, int targ_y ) // returns quantity dropped -bool copy_item_to_grid( const item_def &item, int x_plos, int y_plos, +bool copy_item_to_grid( const item_def &item, int x_plos, int y_plos, int quant_drop, bool mark_dropped ) { if (quant_drop == 0) @@ -1818,7 +1821,7 @@ bool move_top_item( const coord_def &pos, const coord_def &dest ) dungeon_events.fire_position_event( dgn_event(DET_ITEM_MOVED, pos, 0, item, -1, dest), pos); - + // Now move the item to its new possition... move_item_to_grid( &item, dest.x, dest.y ); @@ -1846,7 +1849,7 @@ bool drop_item( int item_dropped, int quant_drop, bool try_offer ) return (false); } - if (item_dropped == you.equip[EQ_WEAPON] + if (item_dropped == you.equip[EQ_WEAPON] && you.inv[item_dropped].base_type == OBJ_WEAPONS && item_cursed( you.inv[item_dropped] )) { @@ -1862,7 +1865,7 @@ bool drop_item( int item_dropped, int quant_drop, bool try_offer ) { mpr("You will have to take that off first."); } - else + else { // If we take off the item, cue up the item being dropped if (takeoff_armour( item_dropped )) @@ -1873,7 +1876,7 @@ bool drop_item( int item_dropped, int quant_drop, bool try_offer ) } // Regardless, we want to return here because either we're - // aborting the drop, or the drop is delayed until after + // aborting the drop, or the drop is delayed until after // the armour is removed. -- bwr return (false); } @@ -1893,7 +1896,7 @@ bool drop_item( int item_dropped, int quant_drop, bool try_offer ) const dungeon_feature_type my_grid = grd[you.x_pos][you.y_pos]; if ( !grid_destroys_items(my_grid) - && !copy_item_to_grid( you.inv[item_dropped], + && !copy_item_to_grid( you.inv[item_dropped], you.x_pos, you.y_pos, quant_drop, true )) { mpr( "Too many items on this level, not dropping the item." ); @@ -1902,7 +1905,7 @@ bool drop_item( int item_dropped, int quant_drop, bool try_offer ) mprf("You drop %s.", quant_name(you.inv[item_dropped], quant_drop, DESC_NOCAP_A).c_str()); - + if ( grid_destroys_items(my_grid) ) { if( !silenced(you.pos()) ) @@ -2007,8 +2010,8 @@ static std::string drop_selitem_text( const std::vector *s ) break; } } - - snprintf( buf, sizeof buf, " (%lu%s turn%s)", + + snprintf( buf, sizeof buf, " (%lu%s turn%s)", (unsigned long) (s->size()), extraturns? "+" : "", s->size() > 1? "s" : "" ); @@ -2054,7 +2057,7 @@ void drop(void) } std::vector tmp_items; - tmp_items = prompt_invent_items( "Drop what?", MT_DROP, -1, + tmp_items = prompt_invent_items( "Drop what?", MT_DROP, -1, drop_menu_title, true, true, 0, &Options.drop_filter, drop_selitem_text, &items_for_multidrop ); @@ -2171,7 +2174,7 @@ void autoinscribe() static inline std::string autopickup_item_name(const item_def &item) { return userdef_annotate_item(STASH_LUA_SEARCH_ANNOTATE, &item, true) - + item.name(DESC_PLAIN); + + item.name(DESC_PLAIN); } static bool is_denied_autopickup(const item_def &item, std::string &iname) @@ -2202,7 +2205,7 @@ bool item_needs_autopickup(const item_def &item) { if (item_is_stationary(item)) return (false); - + if (strstr(item.inscription.c_str(), "=g") != 0) return (true); @@ -2218,7 +2221,7 @@ bool item_needs_autopickup(const item_def &item) && (Options.pickup_dropped || !(item.flags & ISFLAG_DROPPED)) && !is_denied_autopickup(item, itemname)); } - + bool can_autopickup() { // [ds] Checking for autopickups == 0 is a bad idea because @@ -2227,9 +2230,11 @@ bool can_autopickup() if (!Options.autopickup_on) return (false); - if (you.attribute[ATTR_TRANSFORMATION] == TRAN_AIR + if (you.attribute[ATTR_TRANSFORMATION] == TRAN_AIR && you.duration[DUR_TRANSFORMATION] > 0) + { return (false); + } if (you.flight_mode() == FL_LEVITATE) return (false); @@ -2247,13 +2252,13 @@ static void do_autopickup() int n_tried_pickup = 0; will_autopickup = false; - + if (!can_autopickup()) { item_check(false); return; } - + int o = igrd[you.x_pos][you.y_pos]; std::string pickup_warning; @@ -2314,7 +2319,7 @@ static void do_autopickup() you.turn_is_over = true; item_check(false); - + explore_pickup_event(n_did_pickup, n_tried_pickup); } @@ -2341,8 +2346,8 @@ static bool find_subtype_by_name(item_def &item, object_class_type base_type, int ntypes, const std::string &name) { - // In order to get the sub-type, we'll fill out the base type... - // then we're going to iterate over all possible subtype values + // In order to get the sub-type, we'll fill out the base type... + // then we're going to iterate over all possible subtype values // and see if we get a winner. -- bwr item.base_type = base_type; @@ -2386,8 +2391,8 @@ item_def find_item_type(object_class_type base_type, std::string name) if (base_type == OBJ_RANDOM || base_type == OBJ_UNASSIGNED) base_type = OBJ_UNASSIGNED; - - static int max_subtype[] = + + static int max_subtype[] = { NUM_WEAPONS, NUM_MISSILES, diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc index efb4afbe4f..e16eab55cf 100644 --- a/crawl-ref/source/makeitem.cc +++ b/crawl-ref/source/makeitem.cc @@ -61,7 +61,7 @@ static int newwave_weapon_colour(const item_def &item) std::string itname = item.name(DESC_PLAIN); lowercase(itname); - + const bool item_runed = itname.find(" runed ") != std::string::npos; const bool heav_runed = itname.find(" heavily ") != std::string::npos; @@ -124,7 +124,7 @@ static int newwave_weapon_colour(const item_def &item) static int classic_weapon_colour(const item_def &item) { int item_colour = BLACK; - + if (is_range_weapon( item )) item_colour = BROWN; else @@ -239,7 +239,7 @@ static int newwave_armour_colour(const item_def &item) int item_colour = BLACK; std::string itname = item.name(DESC_PLAIN); lowercase(itname); - + const bool item_runed = itname.find(" runed ") != std::string::npos; const bool heav_runed = itname.find(" heavily ") != std::string::npos; @@ -576,7 +576,7 @@ void item_colour( item_def &item ) item.colour = (coinflip() ? MAGENTA : GREEN); break; case FOOD_CHUNK: - // set the appropriate colour of the meat: + // set the appropriate colour of the meat: temp_value = mons_class_colour( item.plus ); item.colour = (temp_value == BLACK) ? LIGHTRED : temp_value; break; @@ -763,7 +763,7 @@ void item_colour( item_def &item ) case RUNE_SNAKE_PIT: // serpentine item.colour = EC_POISON; break; - + case RUNE_ELVEN_HALLS: // elven item.colour = EC_ELVEN; break; @@ -779,12 +779,12 @@ void item_colour( item_def &item ) case RUNE_SWAMP: // decaying item.colour = EC_DECAY; break; - + case RUNE_SHOALS: // barnacled item.colour = EC_WATER; break; - // This one is hardly unique, but colour isn't used for + // This one is hardly unique, but colour isn't used for // stacking, so we don't have to worry too much about this. -- bwr case RUNE_DEMONIC: // random pandemonium demonlords { @@ -792,7 +792,7 @@ void item_colour( item_def &item ) {EC_EARTH, EC_ELECTRICITY, EC_ENCHANT, EC_HEAL, EC_BLOOD, EC_DEATH, EC_UNHOLY, EC_VEHUMET, EC_BEOGH, EC_CRYSTAL, EC_SMOKE, EC_DWARVEN, EC_ORCISH, EC_GILA}; - + item.colour = RANDOM_ELEMENT(types); break; } @@ -870,7 +870,7 @@ static weapon_type determine_weapon_subtype(int item_level) rc = RANDOM_ELEMENT(rare_subtypes); else { - // pick a weapon based on rarity + // pick a weapon based on rarity while (true) { const int wpntype = random2(NUM_WEAPONS); @@ -1173,7 +1173,7 @@ static brand_type determine_weapon_brand(const item_def& item, int item_level) const bool force_good = (item_level == MAKE_GOOD_ITEM); const int tries = force_good ? 5 : 1; brand_type rc = SPWPN_NORMAL; - + for (int count = 0; count < tries && rc == SPWPN_NORMAL; ++count) { if (!(force_good || is_demonic(item) || random2(300) <= 100+item_level)) @@ -1399,7 +1399,7 @@ static brand_type determine_weapon_brand(const item_def& item, int item_level) if (one_chance_in(6)) rc = SPWPN_VENOM; - + if (one_chance_in(5)) rc = SPWPN_DRAGON_SLAYING; @@ -1556,7 +1556,7 @@ static void generate_weapon_item(item_def& item, bool allow_uniques, item.plus2 += 2 + random2(3); } - const int chance = force_good ? 200 : item_level; + const int chance = force_good ? 200 : item_level; // odd-looking, but this is how the algorithm compacts {dlb}: for (int i = 0; i < 4; ++i) @@ -1613,7 +1613,7 @@ static item_status_flag_type determine_missile_race(const item_def& item, rc = ISFLAG_ELVEN; break; - case MAKE_ITEM_DWARVEN: + case MAKE_ITEM_DWARVEN: rc = ISFLAG_DWARVEN; break; @@ -2163,7 +2163,7 @@ static int wand_max_charges(int subtype) { case WAND_HEALING: case WAND_HASTING: case WAND_INVISIBILITY: return 8; - + case WAND_FLAME: case WAND_FROST: case WAND_MAGIC_DARTS: case WAND_RANDOM_EFFECTS: return 28; @@ -2176,7 +2176,7 @@ static int wand_max_charges(int subtype) static void generate_wand_item(item_def& item, int force_type) { // determine sub_type - if (force_type != OBJ_RANDOM) + if (force_type != OBJ_RANDOM) item.sub_type = force_type; else item.sub_type = random_wand_subtype(); @@ -2305,7 +2305,7 @@ static void generate_potion_item(item_def& item, int force_type, int item_level) } while ( stype == POT_POISON && item_level < 1 || stype == POT_STRONG_POISON && item_level < 11 ); - + if ( stype == POT_GAIN_STRENGTH || stype == POT_GAIN_DEXTERITY || stype == POT_GAIN_INTELLIGENCE || stype == POT_EXPERIENCE || stype == POT_MAGIC || stype == POT_RESTORE_ABILITIES ) @@ -2330,7 +2330,7 @@ static void generate_scroll_item(item_def& item, int force_type, // only used in certain cases {dlb} const int depth_mod = random2(1 + item_level); const int temp_rand = random2(935); - + item.sub_type = ((temp_rand > 766) ? SCR_IDENTIFY : // 17.97% (temp_rand > 644) ? SCR_REMOVE_CURSE : // 13.05% @@ -2414,7 +2414,7 @@ static void generate_book_item(item_def& item, int force_type, do { item.sub_type = random2(NUM_BOOKS); - + if (item.sub_type != BOOK_DESTRUCTION && item.sub_type != BOOK_MANUAL && book_rarity(item.sub_type) != 100 && @@ -2422,7 +2422,7 @@ static void generate_book_item(item_def& item, int force_type, { item.sub_type = coinflip() ? BOOK_WIZARDRY : BOOK_POWER; } - + if (!one_chance_in(100) && random2(item_level+1) + 1 < book_rarity(item.sub_type)) { @@ -2465,20 +2465,20 @@ static void generate_staff_item(item_def& item, int force_type) { // assumption: STAFF_SMITING is the first rod item.sub_type = random2(STAFF_SMITING); - + // rods are rare (10% of all staves) if (one_chance_in(10)) item.sub_type = random_rod_subtype(); - + // staves of energy/channeling are 25% less common, wizardry/power // are more common - if ((item.sub_type == STAFF_ENERGY + if ((item.sub_type == STAFF_ENERGY || item.sub_type == STAFF_CHANNELING) && one_chance_in(4)) { - item.sub_type = coinflip() ? STAFF_WIZARDRY : STAFF_POWER; + item.sub_type = coinflip() ? STAFF_WIZARDRY : STAFF_POWER; } } - + if (item_is_rod( item )) init_rod_mp( item ); } @@ -2521,7 +2521,7 @@ static int determine_ring_plus(int subtype) if (one_chance_in(5)) // 20% of such rings are cursed {dlb} { rc = (coinflip() ? -2 : -3); - + if (one_chance_in(3)) rc -= random2(4); } @@ -2694,8 +2694,8 @@ int items( int allow_uniques, // not just true-false, if (item_level > 7 && (20 + item_level) >= random2(3500)) item.base_type = OBJ_MISCELLANY; - if (item_level < 7 - && (item.base_type == OBJ_BOOKS + if (item_level < 7 + && (item.base_type == OBJ_BOOKS || item.base_type == OBJ_STAVES || item.base_type == OBJ_WANDS) && random2(7) >= item_level) @@ -2703,7 +2703,7 @@ int items( int allow_uniques, // not just true-false, item.base_type = coinflip() ? OBJ_POTIONS : OBJ_SCROLLS; } } - + item.quantity = 1; // generally the case // determine sub_type accordingly {dlb}: @@ -2793,7 +2793,7 @@ int items( int allow_uniques, // not just true-false, destroy_item(p); return (NON_ITEM); } - + x_pos = random2(GXM); y_pos = random2(GYM); } @@ -2866,8 +2866,8 @@ static void give_monster_item( destroy_item(thing); return ; } - - if (!force_item || mthing.colour == BLACK) + + if (!force_item || mthing.colour == BLACK) item_colour( mthing ); } @@ -2936,7 +2936,7 @@ static item_make_species_type give_weapon(monsters *mon, int level, { const int bp = get_item_slot(); bool force_item = false; - + if (bp == NON_ITEM) return (MAKE_ITEM_RANDOM_RACE); @@ -3150,7 +3150,7 @@ static item_make_species_type give_weapon(monsters *mon, int level, { if (mons_genus(mon->type) != MONS_DRACONIAN) item_race = MAKE_ITEM_ELVEN; - + item.base_type = OBJ_WEAPONS; const int temp_rand = random2(6); @@ -3224,7 +3224,7 @@ static item_make_species_type give_weapon(monsters *mon, int level, case MONS_URUG: item_race = MAKE_ITEM_ORCISH; // fall through - + case MONS_NORBERT: case MONS_JOZEF: case MONS_VAULT_GUARD: @@ -3430,11 +3430,11 @@ static item_make_species_type give_weapon(monsters *mon, int level, else if (one_chance_in(3)) { const int temp_rand = random2(5); - set_item_ego_type( item, OBJ_WEAPONS, + set_item_ego_type( item, OBJ_WEAPONS, ((temp_rand == 0) ? SPWPN_DRAINING : (temp_rand == 1) ? SPWPN_VORPAL : (temp_rand == 2) ? SPWPN_PAIN : - (temp_rand == 3) ? SPWPN_DISTORTION + (temp_rand == 3) ? SPWPN_DISTORTION : SPWPN_SPEED) ); } @@ -3506,7 +3506,7 @@ static item_make_species_type give_weapon(monsters *mon, int level, make_item_fixed_artefact( item, false, SPWPN_SCEPTRE_OF_ASMODEUS ); break; - case MONS_GERYON: + case MONS_GERYON: //mv: probably should be moved out of this switch, //but it's not worth of it, unless we have more //monsters with misc. items @@ -3540,10 +3540,10 @@ static item_make_species_type give_weapon(monsters *mon, int level, item.colour = RED; // forced by force_item above {dlb} break; } - + default: break; } // end "switch(mon->type)" - + // Nagas don't get racial stuff. if (mons_genus(mon->type) == MONS_NAGA) item_race = MAKE_ITEM_NO_RACE; @@ -3588,12 +3588,12 @@ static item_make_species_type give_weapon(monsters *mon, int level, if (force_item) item_set_appearance(i); - + if (iquan > 1 && !force_item) i.quantity = iquan; - + give_monster_item(mon, thing_created, force_item); - + if (give_aux_melee && (i.base_type != OBJ_WEAPONS || is_range_weapon(i))) give_weapon(mon, level, true, false); @@ -3620,15 +3620,16 @@ static void give_ammo(monsters *mon, int level, // monsters will always have poisoned needles -- otherwise // they are just going to behave badly --GDL if (xitt == MI_NEEDLE) - set_item_ego_type(mitm[thing_created], OBJ_MISSILES, - got_curare_roll(level)? - SPMSL_CURARE - : SPMSL_POISONED); + { + set_item_ego_type(mitm[thing_created], OBJ_MISSILES, + got_curare_roll(level) ? SPMSL_CURARE + : SPMSL_POISONED); + } // Master archers get double ammo - archery is their only attack. if (mon->type == MONS_DEEP_ELF_MASTER_ARCHER) mitm[thing_created].quantity *= 2; - + give_monster_item(mon, thing_created); } // end if needs ammo else @@ -3666,7 +3667,7 @@ static void give_ammo(monsters *mon, int level, { weap_type = random_choose(WPN_HAND_AXE, WPN_SPEAR, -1); - qty = random_range(2, 5); + qty = random_range(2, 5); item_race = MAKE_ITEM_ORCISH; } break; @@ -3712,7 +3713,7 @@ static void give_ammo(monsters *mon, int level, if (weap_type == -1) return ; - + const int thing_created = items( 0, weap_class, weap_type, true, level, item_race ); if (thing_created != NON_ITEM) @@ -3754,7 +3755,7 @@ void give_shield(monsters *mon, int level) make_item_for_monster(mon, OBJ_ARMOUR, ARM_LARGE_SHIELD, level * 2 + 1, MAKE_ITEM_NO_RACE, 1); break; - + case MONS_DEEP_ELF_SOLDIER: case MONS_DEEP_ELF_FIGHTER: if (one_chance_in(6)) @@ -3793,7 +3794,7 @@ void give_shield(monsters *mon, int level) make_item_for_monster(mon, OBJ_ARMOUR, ARM_SHIELD, level * 2 + 1, MAKE_ITEM_RANDOM_RACE, 1); break; - + default: break; } } @@ -4016,7 +4017,7 @@ void give_armour(monsters *mon, int level) { if (random2(100) < 9 + mon->hit_dice) level = MAKE_GOOD_ITEM; - else + else level = level * 2 + 5; } @@ -4028,7 +4029,7 @@ void give_armour(monsters *mon, int level) give_monster_item(mon, thing_created); //mv: all items with force_colour = 0 are colored via items(). - if (force_colour) + if (force_colour) mitm[thing_created].colour = force_colour; } @@ -4039,9 +4040,9 @@ void give_item(int mid, int level_number) //mv: cleanup+minor changes give_scroll(mons, level_number); give_wand(mons, level_number); give_potion(mons, level_number); - + const item_make_species_type item_race = give_weapon(mons, level_number); - + give_ammo(mons, level_number, item_race); give_armour(mons, 1 + level_number / 2); give_shield(mons, 1 + level_number / 2); diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 044e59ee2d..cfcd8087a1 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -1242,7 +1242,7 @@ int player_res_fire(bool calc_unid, bool temp) rf += scan_randarts(RAP_FIRE, calc_unid); // species: - if (you.species == SP_MUMMY + if (you.species == SP_MUMMY) rf--; // mutations: diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc index d1e5192f24..248ba9422d 100644 --- a/crawl-ref/source/spells4.cc +++ b/crawl-ref/source/spells4.cc @@ -232,7 +232,7 @@ static int shatter_monsters(int x, int y, int pow, int garbage) if (damage > 0) player_hurt_monster( monster, damage ); - else + else damage = 0; return (damage); @@ -392,7 +392,7 @@ void cast_shatter(int pow) apply_area_within_radius(shatter_items, you.x_pos, you.y_pos, pow, rad, 0); apply_area_within_radius(shatter_monsters, you.x_pos, you.y_pos, pow, rad, 0); - int dest = apply_area_within_radius( shatter_walls, you.x_pos, you.y_pos, + int dest = apply_area_within_radius( shatter_walls, you.x_pos, you.y_pos, pow, rad, 0 ); if (dest && !sil) @@ -507,7 +507,7 @@ void cast_summon_large_mammal(int pow) } } - create_monster( mon, 3, BEH_FRIENDLY, you.x_pos, you.y_pos, + create_monster( mon, 3, BEH_FRIENDLY, you.x_pos, you.y_pos, you.pet_target, MONS_PROGRAM_BUG, false, false, false, true ); } @@ -549,7 +549,7 @@ void cast_sticks_to_snakes(int pow) mon = MONS_SMALL_SNAKE; } - if (create_monster( mon, dur, behaviour, you.x_pos, you.y_pos, + if (create_monster( mon, dur, behaviour, you.x_pos, you.y_pos, MHITYOU, MONS_PROGRAM_BUG, false, false, false, true ) != -1) { @@ -674,7 +674,7 @@ void cast_conjure_ball_lightning( int pow ) int mon = mons_place( MONS_BALL_LIGHTNING, BEH_FRIENDLY, MHITNOT, true, tx, ty ); - // int mon = create_monster( MONS_BALL_LIGHTNING, 0, BEH_FRIENDLY, + // int mon = create_monster( MONS_BALL_LIGHTNING, 0, BEH_FRIENDLY, // tx, ty, MHITNOT, MONS_PROGRAM_BUG ); if (mon != -1) @@ -899,7 +899,7 @@ static int ignite_poison_monsters(int x, int y, int pow, int garbage) if (ench.ench != ENCH_NONE) strength += ench.degree; - // strength is now the sum of both poison types (although only + // strength is now the sum of both poison types (although only // one should actually be present at a given time): dam_dice.num += strength; @@ -909,8 +909,8 @@ static int ignite_poison_monsters(int x, int y, int pow, int garbage) damage = mons_adjust_flavoured( mon, beam, damage ); #if DEBUG_DIAGNOSTICS - mprf(MSGCH_DIAGNOSTICS, "Dice: %dd%d; Damage: %d", - dam_dice.num, dam_dice.size, damage ); + mprf(MSGCH_DIAGNOSTICS, "Dice: %dd%d; Damage: %d", + dam_dice.num, dam_dice.size, damage ); #endif if (!player_hurt_monster( mon_index, damage )) @@ -935,7 +935,7 @@ void cast_ignite_poison(int pow) // temp weapon of venom => temp fire brand const int wpn = you.equip[EQ_WEAPON]; - if (wpn != -1 + if (wpn != -1 && you.duration[DUR_WEAPON_BRAND] && get_weapon_brand( you.inv[wpn] ) == SPWPN_VENOM) { @@ -1082,7 +1082,7 @@ void cast_silence(int pow) if (you.duration[DUR_SILENCE] > 100) you.duration[DUR_SILENCE] = 100; - + if (you.duration[DUR_BEHELD]) { mpr("You break out of your daze!", MSGCH_RECOVERY); @@ -1109,7 +1109,7 @@ static int discharge_monsters( int x, int y, int pow, int garbage ) if ( player_is_airborne() ) damage /= 2; ouch( damage, 0, KILLED_BY_WILD_MAGIC ); - } + } else if (mon == NON_MONSTER) return (0); else if (mons_res_elec(&menv[mon]) > 0 || mons_flies(&menv[mon])) @@ -1133,18 +1133,18 @@ static int discharge_monsters( int x, int y, int pow, int garbage ) { mpr( "The lightning arcs!" ); pow /= (coinflip() ? 2 : 3); - damage += apply_random_around_square( discharge_monsters, x, y, - true, pow, 1 ); + damage += apply_random_around_square( discharge_monsters, x, y, + true, pow, 1 ); } else if (damage > 0) { - // Only printed if we did damage, so that the messages in + // Only printed if we did damage, so that the messages in // cast_discharge() are clean. -- bwr mpr( "The lightning grounds out." ); } return (damage); -} // end discharge_monsters() +} // end discharge_monsters() void cast_discharge( int pow ) { @@ -1158,11 +1158,11 @@ void cast_discharge( int pow ) mprf(MSGCH_DIAGNOSTICS, "Arcs: %d Damage: %d", num_targs, dam ); #endif - if (dam == 0) + if (dam == 0) { if (coinflip()) mpr("The air around you crackles with electrical energy."); - else + else { const bool plural = coinflip(); mprf("%s blue arc%s ground%s harmlessly %s you.", @@ -1195,12 +1195,12 @@ static int distortion_monsters(int x, int y, int pow, int message) { if (you.skills[SK_TRANSLOCATIONS] < random2(8)) { - miscast_effect( SPTYP_TRANSLOCATION, pow / 9 + 1, pow, 100, + miscast_effect( SPTYP_TRANSLOCATION, pow / 9 + 1, pow, 100, "cast bend on self" ); } else { - miscast_effect( SPTYP_TRANSLOCATION, 1, 1, 100, + miscast_effect( SPTYP_TRANSLOCATION, 1, 1, 100, "cast bend on self" ); } @@ -1309,7 +1309,7 @@ int disperse_monsters(int x, int y, int pow, int message) void cast_dispersal(int pow) { - if (apply_area_around_square( disperse_monsters, + if (apply_area_around_square( disperse_monsters, you.x_pos, you.y_pos, pow ) == 0) { mpr( "There is a brief shimmering in the air around you." ); @@ -1396,7 +1396,7 @@ static int make_a_rot_cloud(int x, int y, int pow, cloud_type ctype) int make_a_normal_cloud(int x, int y, int pow, int spread_rate, cloud_type ctype, kill_category whose) { - place_cloud( ctype, x, y, + place_cloud( ctype, x, y, (3 + random2(pow / 4) + random2(pow / 4) + random2(pow / 4)), whose, spread_rate ); @@ -1442,7 +1442,7 @@ static int passwall(int x, int y, int pow, int garbage) non_rock_barriers = true; done = true; break; - + case DNGN_ROCK_WALL: case DNGN_CLEAR_ROCK_WALL: case DNGN_ORCISH_IDOL: @@ -1578,14 +1578,14 @@ bool backlight_monsters(int x, int y, int pow, int garbage) } return (true); } - + menv[mon].add_ench(mon_enchant(ENCH_BACKLIGHT, 1)); if (lvl == 0) simple_monster_message( &menv[mon], " is outlined in light." ); else if (lvl == 4) simple_monster_message( &menv[mon], " glows brighter for a moment." ); - else + else simple_monster_message( &menv[mon], " glows brighter." ); return (true); @@ -1632,7 +1632,7 @@ bool cast_evaporate(int pow, bolt& beem, int potion) beem.flavour = (coinflip() ? BEAM_POTION_POISON : BEAM_POTION_MIASMA); beem.ench_power *= 2; break; - + case POT_POISON: beem.flavour = BEAM_POTION_POISON; break; @@ -1726,13 +1726,13 @@ void cast_fulsome_distillation( int powc ) int corpse = -1; // Search items at the players location for corpses. - // XXX: Turn this into a separate function and merge with - // the messes over in butchery, animating, and maybe even - // item pickup from stacks (which would make it easier to + // XXX: Turn this into a separate function and merge with + // the messes over in butchery, animating, and maybe even + // item pickup from stacks (which would make it easier to // create a floor stack menu system later) -- bwr - for (int curr_item = igrd[you.x_pos][you.y_pos]; - curr_item != NON_ITEM; - curr_item = mitm[curr_item].link) + for (int curr_item = igrd[you.x_pos][you.y_pos]; + curr_item != NON_ITEM; + curr_item = mitm[curr_item].link) { const item_def& item = mitm[curr_item]; if (item.base_type == OBJ_CORPSES && item.sub_type == CORPSE_BODY) @@ -1801,14 +1801,14 @@ void cast_fulsome_distillation( int powc ) pot_type = (power_up ? POT_STRONG_POISON : POT_POISON); break; - case CE_MUTAGEN_RANDOM: + case CE_MUTAGEN_RANDOM: case CE_MUTAGEN_GOOD: // unused case CE_RANDOM: // unused pot_type = POT_MUTATION; break; case CE_MUTAGEN_BAD: // unused - case CE_ROTTEN: // actually this only occurs via mangling + case CE_ROTTEN: // actually this only occurs via mangling case CE_HCL: // necrophage pot_type = (power_up ? POT_DECAY : POT_STRONG_POISON); break; @@ -1825,23 +1825,23 @@ void cast_fulsome_distillation( int powc ) { switch (pot_type) { - case POT_DECAY: - case POT_DEGENERATION: - case POT_STRONG_POISON: + case POT_DECAY: + case POT_DEGENERATION: + case POT_STRONG_POISON: pot_type = POT_POISON; break; - case POT_MUTATION: - case POT_POISON: + case POT_MUTATION: + case POT_POISON: pot_type = POT_CONFUSION; break; - case POT_PARALYSIS: + case POT_PARALYSIS: pot_type = POT_SLOWING; break; - case POT_CONFUSION: - case POT_SLOWING: + case POT_CONFUSION: + case POT_SLOWING: default: pot_type = POT_WATER; break; @@ -2052,7 +2052,7 @@ void cast_fragmentation(int pow) // jmf: ripped idea from airstrike blast.hit = AUTOMATIC_HIT; // Number of dice vary... 3 is easy/common, but it can get as high as 6. - blast.damage = dice_def( 0, 5 + pow / 10 ); + blast.damage = dice_def( 0, 5 + pow / 10 ); const int grid = grd[beam.tx][beam.ty]; const int mon = mgrd[beam.tx][beam.ty]; @@ -2100,11 +2100,11 @@ void cast_fragmentation(int pow) // jmf: ripped idea from airstrike if (random2(50) < (pow / 5)) // potential insta-kill { monster_die(&menv[mon], KILL_YOU, 0); - blast.damage.num = 4; + blast.damage.num = 4; } else { - blast.damage.num = 2; + blast.damage.num = 2; if (player_hurt_monster(mon, roll_dice( blast.damage ))) blast.damage.num = 4; } @@ -2114,10 +2114,10 @@ void cast_fragmentation(int pow) // jmf: ripped idea from airstrike explode = false; simple_monster_message(&menv[mon], " shudders violently!"); - // We use blast.damage not only for inflicting damage here, - // but so that later on we'll know that the spell didn't + // We use blast.damage not only for inflicting damage here, + // but so that later on we'll know that the spell didn't // fizzle (since we don't actually explode wood golems). -- bwr - blast.damage.num = 2; + blast.damage.num = 2; player_hurt_monster( mon, roll_dice( blast.damage ) ); break; @@ -2165,7 +2165,7 @@ void cast_fragmentation(int pow) // jmf: ripped idea from airstrike int statue_damage = roll_dice(blast.damage) * 2; if (pow >= 50 && one_chance_in(10)) statue_damage = menv[mon].hit_points; - + if (player_hurt_monster(mon, statue_damage)) blast.damage.num += 2; } @@ -2184,8 +2184,8 @@ void cast_fragmentation(int pow) // jmf: ripped idea from airstrike default: blast.damage.num = 1; // to mark that a monster was targetted - // Yes, this spell does lousy damage if the - // monster isn't susceptible. -- bwr + // Yes, this spell does lousy damage if the + // monster isn't susceptible. -- bwr player_hurt_monster( mon, roll_dice( 1, 5 + pow / 25 ) ); goto do_terrain; } @@ -2231,7 +2231,7 @@ void cast_fragmentation(int pow) // jmf: ripped idea from airstrike blast.colour = LIGHTGREY; if (okay_to_dest - && (grid == DNGN_ORCISH_IDOL + && (grid == DNGN_ORCISH_IDOL || grid == DNGN_GRANITE_STATUE || (pow >= 40 && grid == DNGN_ROCK_WALL && one_chance_in(3)) || (pow >= 40 && grid == DNGN_CLEAR_ROCK_WALL @@ -2251,7 +2251,7 @@ void cast_fragmentation(int pow) // jmf: ripped idea from airstrike // Metal -- small but nasty explosion // - case DNGN_METAL_WALL: + case DNGN_METAL_WALL: what = "metal wall"; blast.colour = CYAN; explode = true; @@ -2267,7 +2267,7 @@ void cast_fragmentation(int pow) // jmf: ripped idea from airstrike break; // - // Crystal + // Crystal // case DNGN_GREEN_CRYSTAL_WALL: // crystal -- large & nasty explosion @@ -2287,17 +2287,17 @@ void cast_fragmentation(int pow) // jmf: ripped idea from airstrike } break; - // + // // Traps // case DNGN_UNDISCOVERED_TRAP: case DNGN_TRAP_MECHANICAL: trap = trap_at_xy( beam.tx, beam.ty ); - if (trap != -1 + if (trap != -1 && trap_category( env.trap[trap].type ) != DNGN_TRAP_MECHANICAL) { - // non-mechanical traps don't explode with this spell -- bwr + // non-mechanical traps don't explode with this spell -- bwr break; } @@ -2344,7 +2344,7 @@ void cast_fragmentation(int pow) // jmf: ripped idea from airstrike case DNGN_FLOOR: explode = false; mprf("%s seems to be unnaturally hard.", - (grid == DNGN_PERMAROCK_WALL) ? "That wall" + (grid == DNGN_PERMAROCK_WALL) ? "That wall" : "The dungeon floor"); break; @@ -2639,7 +2639,7 @@ int cast_apportation(int pow) { mprf("%s twitches.", menv[mon].name(DESC_CAP_THE).c_str()); } - else + else mpr( "This spell does not work on creatures." ); return (0); @@ -2683,7 +2683,7 @@ int cast_apportation(int pow) (mitm[ item ].quantity > 1) ? "s" : "" ); } done = 1; - + // if we apport a net, free the monster under it if (mitm[item].base_type == OBJ_MISSILES && mitm[item].sub_type == MI_THROWING_NET @@ -2691,7 +2691,7 @@ int cast_apportation(int pow) { const int mon = mgrd[ beam.tx ][ beam.ty ]; remove_item_stationary(mitm[item]); - + if (mon != NON_MONSTER) (&menv[mon])->del_ench(ENCH_HELD, true); } @@ -2763,14 +2763,14 @@ void cast_divine_shield() else mpr("A divine shield forms around you!"); } - + // duration of complete shield bonus up to 18 turns you.duration[DUR_DIVINE_SHIELD] = 5 + (you.skills[SK_SHIELDS] + you.skills[SK_INVOCATIONS]*2)/6; // shield bonus up to 8 you.attribute[ATTR_DIVINE_SHIELD] = 3 + you.skills[SK_SHIELDS]/5; - + return; } @@ -2815,7 +2815,7 @@ static int quadrant_blink(int x, int y, int pow, int garbage) if (!see_grid_no_trans(tx, ty)) continue; - + found = true; break; } @@ -2840,7 +2840,7 @@ void cast_stoneskin(int pow) return; } - if (you.attribute[ATTR_TRANSFORMATION] != TRAN_NONE + if (you.attribute[ATTR_TRANSFORMATION] != TRAN_NONE && you.attribute[ATTR_TRANSFORMATION] != TRAN_STATUE && you.attribute[ATTR_TRANSFORMATION] != TRAN_BLADE_HANDS) { -- cgit v1.2.3-54-g00ecf