From e628026533c6037acce8ce945425ce1523285a15 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Sun, 8 Jun 2008 19:52:52 +0000 Subject: Lower chance of vampiric bite during bat form, and if it happens, halve healing and nutrition gain. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5606 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/fight.cc | 27 +++-- crawl-ref/source/food.cc | 4 +- crawl-ref/source/mon-util.cc | 238 ++++++++++++++++++++++--------------------- crawl-ref/source/player.cc | 160 ++++++++++++++--------------- 4 files changed, 219 insertions(+), 210 deletions(-) diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index e460f85141..d420986590 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -719,8 +719,15 @@ static bool _player_vampire_draws_blood(const int mons, const int damage, if (chunk_type == CE_CLEAN) heal += 1 + random2(damage); - inc_hp(heal, false); - mprf("You feel %sbetter.", (you.hp == you.hp_max) ? "much " : ""); + // Decrease healing when done in bat form. + if (you.attribute[ATTR_TRANSFORMATION] == TRAN_BAT) + heal /= 2; + + if (heal > 0) + { + inc_hp(heal, false); + mprf("You feel %sbetter.", (you.hp == you.hp_max) ? "much " : ""); + } } // Gain nutrition. @@ -735,9 +742,9 @@ static bool _player_vampire_draws_blood(const int mons, const int damage, food_value = 15 + random2avg(29, 2); } - // Bats get a little less nutrition out of it + // Bats get a rather less nutrition out of it. if (you.attribute[ATTR_TRANSFORMATION] == TRAN_BAT) - food_value -= 5 + random2(16); + food_value /= 2; lessen_hunger(food_value, false); } @@ -819,7 +826,7 @@ bool melee_attack::player_attack() player_sustain_passive_damage(); - // thirsty stabbing vampires get to draw blood + // Thirsty stabbing vampires get to draw blood. if (you.species == SP_VAMPIRE && you.hunger_state < HS_SATIATED && stab_attempt && stab_bonus > 0) { @@ -832,8 +839,8 @@ bool melee_attack::player_attack() if (hit_woke_orc) { - // call function of orcs first noticing you but with - // beaten-up conversion messages (if applicable) + // Call function of orcs first noticing you, but with + // beaten-up conversion messages (if applicable). beogh_follower_convert(def, true); } } @@ -1194,7 +1201,7 @@ bool melee_attack::player_apply_aux_unarmed() if (damage_brand == SPWPN_VENOM && coinflip()) poison_monster( def, KC_YOU ); - // normal vampiric biting attack, not if already got stabbing special + // Normal vampiric biting attack, not if already got stabbing special. if (damage_brand == SPWPN_VAMPIRICISM && you.species == SP_VAMPIRE && (!stab_attempt || stab_bonus <= 0)) { @@ -1788,7 +1795,7 @@ bool melee_attack::player_monattk_hit_effects(bool mondied) { mpr("You feel better."); - // more than if not killed + // More than if not killed. const int heal = 1 + random2(damage_done); #ifdef DEBUG_DIAGNOSTICS @@ -3022,7 +3029,7 @@ int melee_attack::player_calc_base_unarmed_damage() damage = 5; break; case TRAN_BAT: - damage = (you.species == SP_VAMPIRE ? 2 : 1); + damage = (you.species == SP_VAMPIRE ? 1 : coinflip()); break; case TRAN_ICE_BEAST: damage = 12; diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc index 07759d0fcc..b1daa6c5e7 100644 --- a/crawl-ref/source/food.cc +++ b/crawl-ref/source/food.cc @@ -726,7 +726,7 @@ bool prompt_eat_from_inventory(int slot) return (false); } - // this conditional can later be merged into food::can_ingest() when + // This conditional can later be merged into food::can_ingest() when // expanded to handle more than just OBJ_FOOD 16mar200 {dlb} if (you.species != SP_VAMPIRE) { @@ -760,7 +760,7 @@ bool prompt_eat_from_inventory(int slot) return (true); } -// [ds] Returns true if something was eaten +// [ds] Returns true if something was eaten. bool eat_food(bool run_hook, int slot) { if (you.is_undead == US_UNDEAD) diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index 209220e22f..3f5f63340b 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -72,7 +72,7 @@ struct mon_spellbook mon_display monster_symbols[NUM_MONSTERS]; -// really important extern -- screen redraws suck w/o it {dlb} +// Really important extern -- screen redraws suck w/o it! {dlb} FixedVector < unsigned short, 1000 > mcolour; static bool initialized_randmons = false; @@ -90,7 +90,7 @@ static mon_spellbook mspell_list[] = { static int _mons_exp_mod(int mclass); -// macro that saves some typing, nothing more +// Macro that saves some typing, nothing more. #define smc get_monster_data(mc) /* ******************** BEGIN PUBLIC FUNCTIONS ******************** */ @@ -189,7 +189,7 @@ void init_mon_name_cache() || mon == MONS_POTION_MIMIC || mon == MONS_ABOMINATION_LARGE) { - // keep previous entry + // Leep previous entry. continue; } else @@ -230,7 +230,7 @@ monster_type get_monster_by_name(std::string name, bool exact) continue; mon = monster_type(mtype); - // we prefer prefixes over partial matches + // We prefer prefixes over partial matches. if (match == 0) break; } @@ -244,22 +244,20 @@ void init_monsters(FixedVector < unsigned short, 1000 > &colour) for (x = 0; x < MONDATASIZE; x++) colour[mondata[x].mc] = mondata[x].colour; - //unsigned int x = 0; // must be unsigned to match size_t {dlb} - - // first, fill static array with dummy values {dlb}; + // First, fill static array with dummy values. {dlb} mon_entry.init(-1); - // next, fill static array with location of entry in mondata[] {dlb}: + // Next, fill static array with location of entry in mondata[]. {dlb}: for (x = 0; x < MONDATASIZE; x++) mon_entry[mondata[x].mc] = x; - // finally, monsters yet with dummy entries point to TTTSNB(tm) {dlb}: + // Finally, monsters yet with dummy entries point to TTTSNB(tm). {dlb}: for (x = 0; x < NUM_MONSTERS; x++) if (mon_entry[x] == -1) mon_entry[x] = mon_entry[MONS_PROGRAM_BUG]; init_monster_symbols(); -} // end mons_init() +} void init_monster_symbols() { @@ -372,8 +370,8 @@ static int _scan_mon_inv_randarts( const monsters *mon, return (ret); } -// Returns true if a given monster is an abomination -// created by Twisted Resurrection +// Returns true if a given monster is an abomination created by +// Twisted Resurrection. static bool _mons_your_abomination(const monsters *mon) { if ( mon->type != MONS_ABOMINATION_SMALL @@ -473,7 +471,8 @@ bool mons_is_native_in_branch(const monsters *monster, || mons_species(monster->type) == MONS_SNAKE); case BRANCH_HALL_OF_ZOT: - return (mons_species(monster->type) == MONS_DRACONIAN); + return (mons_species(monster->type) == MONS_DRACONIAN + || monster->type == MONS_ORB_GUARDIAN); case BRANCH_TOMB: return (mons_species(monster->type) == MONS_MUMMY); @@ -539,7 +538,7 @@ bool mons_is_demon(int mc) { const int show_char = mons_char(mc); - // Not every demonic monster is a demon (hell hog, hell hound, etc.). + // Not every demonic monster is a demon (hell hog, hell hound, etc.) if (mons_class_holiness(mc) == MH_DEMONIC && (isdigit( show_char ) || show_char == '&')) { @@ -781,7 +780,7 @@ bool mons_is_zombified(const monsters *monster) int downscale_zombie_damage(int damage) { - // these are cumulative, of course: {dlb} + // These are cumulative, of course: {dlb} if (damage > 1) damage--; if (damage > 4) @@ -863,7 +862,7 @@ int mons_damage(int mc, int rt) if (rt < 0 || rt > 3) rt = 0; return smc->attack[rt].damage; -} // end mons_damage() +} bool mons_immune_magic(const monsters *mon) { @@ -902,7 +901,7 @@ int mons_resist_magic( const monsters *mon ) } return (u); -} // end mon_resist_magic() +} const char* mons_resist_string(const monsters *mon) { @@ -947,7 +946,7 @@ bool check_mons_resist_magic( const monsters *monster, int pow ) #endif return (mrch2 < mrchance); -} // end check_mons_resist_magic() +} int mons_res_elec( const monsters *mon ) { @@ -963,7 +962,7 @@ int mons_res_elec( const monsters *mon ) { u += _scan_mon_inv_randarts( mon, RAP_ELECTRICITY ); - // no ego armour, but storm dragon. + // No ego armour, but storm dragon. const int armour = mon->inv[MSLOT_ARMOUR]; if (armour != NON_ITEM && mitm[armour].base_type == OBJ_ARMOUR && mitm[armour].sub_type == ARM_STORM_DRAGON_ARMOUR) @@ -975,7 +974,7 @@ int mons_res_elec( const monsters *mon ) // Monsters can legitimately get multiple levels of electricity resistance. return (u); -} // end mons_res_elec() +} bool mons_res_asphyx( const monsters *mon ) { @@ -1031,7 +1030,7 @@ int mons_res_poison( const monsters *mon ) // Monsters can legitimately get multiple levels of poison resistance. return (u); -} // end mons_res_poison() +} bool mons_res_sticky_flame( const monsters *mon ) { @@ -1094,7 +1093,7 @@ int mons_res_fire( const monsters *mon ) u = 3; return (u); -} // end mons_res_fire() +} int mons_res_cold( const monsters *mon ) { @@ -1141,7 +1140,7 @@ int mons_res_cold( const monsters *mon ) u = 3; return (u); -} // end mons_res_cold() +} int mons_res_miasma( const monsters *mon ) { @@ -1222,7 +1221,6 @@ bool mons_has_lifeforce( const monsters *mon ) const mon_holy_type holiness = mons_holiness( mon ); return (holiness == MH_NATURAL || holiness == MH_PLANT); - // && !mon->has_ench(ENCH_PETRIFY)); } bool mons_skeleton(int mc) @@ -1301,20 +1299,20 @@ int exper_value( const struct monsters *monster ) { long x_val = 0; - // these three are the original arguments: + // These three are the original arguments. const int mclass = monster->type; const int mHD = monster->hit_dice; const int maxhp = monster->max_hit_points; - // these are some values we care about: + // These are some values we care about. const int speed = mons_speed(mclass); const int modifier = _mons_exp_mod(mclass); const int item_usage = mons_itemuse(mclass); - // XXX: shapeshifters can qualify here, even though they can't cast: + // XXX: Shapeshifters can qualify here, even though they can't cast. const bool spellcaster = mons_class_flag( mclass, M_SPELLCASTER ); - // early out for no XP monsters + // Early out for no XP monsters. if (mons_class_flag(mclass, M_NO_EXP_GAIN)) return (0); @@ -1337,10 +1335,10 @@ int exper_value( const struct monsters *monster ) } - // Let's calculate a simple difficulty modifier -- bwr + // Let's calculate a simple difficulty modifier. -- bwr int diff = 0; - // Let's look for big spells: + // Let's look for big spells. if (spellcaster) { const monster_spells &hspell_pass = monster->spells; @@ -1377,11 +1375,11 @@ int exper_value( const struct monsters *monster ) } } - // let's look at regeneration + // Let's look at regeneration. if (monster_descriptor( mclass, MDSC_REGENERATES )) diff += 15; - // Monsters at normal or fast speed with big melee damage + // Monsters at normal or fast speed with big melee damage. if (speed >= 10) { int max_melee = 0; @@ -1402,17 +1400,17 @@ int exper_value( const struct monsters *monster ) } // Set a reasonable range on the difficulty modifier... - // Currently 70% - 200% -- bwr + // Currently 70% - 200%. -- bwr if (diff > 100) diff = 100; else if (diff < -30) diff = -30; - // Apply difficulty + // Apply difficulty. x_val *= (100 + diff); x_val /= 100; - // Basic speed modification + // Basic speed modification. if (speed > 0) { x_val *= speed; @@ -1425,7 +1423,7 @@ int exper_value( const struct monsters *monster ) if (speed < 10 && !spellcaster && item_usage < MONUSE_STARTING_EQUIPMENT) x_val /= 2; - // Apply the modifier in the monster's definition + // Apply the modifier in the monster's definition. if (modifier > 0) { x_val *= modifier; @@ -1438,7 +1436,7 @@ int exper_value( const struct monsters *monster ) if (x_val > 1000) x_val = 1000 + (x_val - 1000) / 2; - // guarantee the value is within limits + // Guarantee the value is within limits. if (x_val <= 0) x_val = 1; else if (x_val > 15000) @@ -1457,16 +1455,16 @@ void define_monster(int index) define_monster(menv[index]); } -// generate a shiny new and unscarred monster +// Generate a shiny new and unscarred monster. void define_monster(monsters &mons) { int temp_rand = 0; // probability determination {dlb} - int mcls = mons.type; + int mcls = mons.type; int hd, hp, hp_max, ac, ev, speed; - int monnumber = mons.number; - monster_type monbase = mons.base_monster; - const monsterentry *m = get_monster_data(mcls); - int col = mons_class_colour(mons.type); + int monnumber = mons.number; + monster_type monbase = mons.base_monster; + const monsterentry *m = get_monster_data(mcls); + int col = mons_class_colour(mons.type); mon_spellbook_type spells = MST_NO_SPELLS; mons.mname.clear(); @@ -1549,14 +1547,14 @@ void define_monster(monsters &mons) case MONS_BUTTERFLY: case MONS_SPATIAL_VORTEX: case MONS_KILLER_KLOWN: - if (col != BLACK) // maybe overwritten by the mon_glyph option + if (col != BLACK) // May be overwritten by the mon_glyph option. break; col = random_colour(); break; case MONS_GILA_MONSTER: - if (col != BLACK) // maybe overwritten by the mon_glyph option + if (col != BLACK) // May be overwritten by the mon_glyph option. break; temp_rand = random2(7); @@ -1568,7 +1566,7 @@ void define_monster(monsters &mons) break; case MONS_DRACONIAN: - // these are supposed to only be created by polymorph + // These are supposed to only be created by polymorph. hd += random2(10); ac += random2(5); ev += random2(5); @@ -1599,15 +1597,17 @@ void define_monster(monsters &mons) else if (temp_rand < 9) spells = (coinflip() ? MST_NECROMANCER_I : MST_NECROMANCER_II); else + { spells = (coinflip() ? MST_DEEP_ELF_CONJURER_I : MST_DEEP_ELF_CONJURER_II); + } monbase = static_cast(MONS_BLACK_DRACONIAN + random2(8)); break; } case MONS_HUMAN: case MONS_ELF: - // these are supposed to only be created by polymorph + // These are supposed to only be created by polymorph. hd += random2(10); ac += random2(5); ev += random2(5); @@ -1625,18 +1625,18 @@ void define_monster(monsters &mons) if (spells == MST_NO_SPELLS && mons_class_flag(mons.type, M_SPELLCASTER)) spells = m->sec; - // some calculations + // Some calculations. hp = hit_points(hd, m->hpdice[1], m->hpdice[2]); hp += m->hpdice[3]; hp_max = hp; - // so let it be written, so let it be done - mons.hit_dice = hd; - mons.hit_points = hp; - mons.max_hit_points = hp_max; - mons.ac = ac; - mons.ev = ev; - mons.speed = speed; + // So let it be written, so let it be done. + mons.hit_dice = hd; + mons.hit_points = hp; + mons.max_hit_points = hp_max; + mons.ac = ac; + mons.ev = ev; + mons.speed = speed; mons.speed_increment = 70; if (mons.base_monster == MONS_PROGRAM_BUG) @@ -1651,7 +1651,7 @@ void define_monster(monsters &mons) mons_load_spells( &mons, spells ); - // reset monster enchantments + // Reset monster enchantments. mons.enchantments.clear(); mons.ench_countdown = 0; } // end define_monster() @@ -1689,7 +1689,7 @@ static std::string _str_monam(const monsters& mon, description_level_type desc, if (desc == DESC_NONE) return (""); - // Handle non-visible case first + // Handle non-visible case first. if (!force_seen && !player_monster_visible(&mon)) { switch (desc) @@ -1869,7 +1869,7 @@ std::string mons_type_name(int type, description_level_type desc ) result += get_monster_data(type)->name; - // Vowel fix: Change 'a orc' to 'an orc' + // Vowel fix: Change 'a orc' to 'an orc'. if (result.length() >= 3 && (result[0] == 'a' || result[0] == 'A') && result[1] == ' ' @@ -1900,11 +1900,10 @@ static std::string _get_proper_monster_name(const monsters *mon) return name; } -// Fills the number parameter (if not otherwise needed) with a seed for -// random name choice from randname.txt. +// Names a previously unnamed monster. bool give_monster_proper_name(monsters *mon, bool orcs_only) { - // already has a unique name + // Already has a unique name. if (mon->is_named()) return (false); @@ -1923,7 +1922,7 @@ bool give_monster_proper_name(monsters *mon, bool orcs_only) return (mon->is_named()); } -// see mons_init for initialization of mon_entry array. +// See mons_init for initialization of mon_entry array. monsterentry *get_monster_data(int p_monsterid) { const int me = @@ -1973,7 +1972,7 @@ bool intelligent_ally(const monsters *monster) int mons_power(int mc) { - // for now, just return monster hit dice. + // For now, just return monster hit dice. return (smc->hpdice[0]); } @@ -2167,11 +2166,11 @@ bool mons_should_fire(struct bolt &beam) beam.foe_count, beam.fr_count, beam.foe_ratio, beam.smart_monster ? "yes" : "no"); #endif - // use of foeRatio: - // The higher this number, the more monsters will _avoid_ - // collateral damage to their friends. - // Setting this to zero will in fact have all monsters ignore - // their friends when considering collateral damage. + // Use of foeRatio: + // The higher this number, the more monsters will _avoid_ collateral + // damage to their friends. + // Setting this to zero will in fact have all monsters ignore their + // friends when considering collateral damage. // Quick check - did we in fact get any foes? if (beam.foe_count == 0) @@ -2181,14 +2180,14 @@ bool mons_should_fire(struct bolt &beam) if (beam.fr_count == 0 || !beam.smart_monster) return (true); - // only fire if they do acceptably low collateral damage + // Only fire if they do acceptably low collateral damage. return (beam.foe_power >= div_round_up(beam.foe_ratio * (beam.foe_power + beam.fr_power), 100)); } // Returns true if the spell is something you wouldn't want done if -// you had a friendly target.. only returns a meaningful value for +// you had a friendly target... only returns a meaningful value for // non-beam spells. bool ms_direct_nasty(spell_type monspell) { @@ -2264,8 +2263,8 @@ bool ms_low_hitpoint_cast( const monsters *mon, spell_type monspell ) return (ret); } -// spells for a quick get-away -// currently only used to get out of a net +// Spells for a quick get-away. +// Currently only used to get out of a net. bool ms_quick_get_away( const monsters *mon /*unused*/, spell_type monspell ) { switch (monspell) @@ -2523,7 +2522,7 @@ bool mons_has_ranged_attack( const monsters *mon ) } -// use of variant: +// Use of variant: // 0 : She is tap dancing. // 1 : It seems she is tap dancing. (lower case pronoun) // 2 : Her sword explodes! (upper case possessive) @@ -2578,7 +2577,7 @@ const char *mons_pronoun(monster_type mon_type, pronoun_type variant) return ((gender == 0) ? "its" : (gender == 1) ? "his" : "her"); - case PRONOUN_REFLEXIVE: // awkward at start of sentence, always lower + case PRONOUN_REFLEXIVE: // Awkward at start of sentence, always lower. return ((gender == 0) ? "itself" : (gender == 1) ? "himself" : "herself"); } @@ -2622,9 +2621,11 @@ bool monster_shover(const monsters *m) // Efreet and fire elementals are disqualified because they leave behind // clouds of flame. Rotting devils trail clouds of miasma. if (m->type == MONS_EFREET || m->type == MONS_FIRE_ELEMENTAL - || m->type == MONS_ROTTING_DEVIL - || m->type == MONS_CURSE_TOE) + || m->type == MONS_ROTTING_DEVIL + || m->type == MONS_CURSE_TOE) + { return (false); + } // Smiters profit from staying back and smiting. if (_mons_can_smite(m)) @@ -2669,14 +2670,16 @@ bool monster_senior(const monsters *m1, const monsters *m2) return (m1->hit_dice > m2->hit_dice); if (m1->type == MONS_QUEEN_BEE - && (m2->type == MONS_KILLER_BEE - || m2->type == MONS_KILLER_BEE_LARVA)) + && (m2->type == MONS_KILLER_BEE + || m2->type == MONS_KILLER_BEE_LARVA)) + { return (true); + } if (m1->type == MONS_KILLER_BEE && m2->type == MONS_KILLER_BEE_LARVA) return (true); - // Special-case gnolls so they can't get past (hob)goblins + // Special-case gnolls, so they can't get past (hob)goblins. if (m1->type == MONS_GNOLL && m2->type != MONS_GNOLL) return (false); @@ -3118,7 +3121,7 @@ bool monsters::can_use_missile(const item_def &item) const return (true); } - // no fitting launcher in inventory + // No fitting launcher in inventory. return (false); } @@ -3603,7 +3606,7 @@ bool monsters::wants_weapon(const item_def &weap) const if (mons_wields_two_weapons(this) && hands_reqd(weap, body_size(PSIZE_BODY)) == HANDS_TWO) { - return false; + return (false); } // Nobody picks up giant clubs. @@ -3771,7 +3774,7 @@ bool monsters::pickup_missile(item_def &item, int near, bool force) if (item.sub_type == MI_THROWING_NET) { - // monster may not pick up trapping net + // Monster may not pick up trapping net. if (mons_is_caught(this) && item_is_stationary(item)) return (false); } @@ -3916,7 +3919,7 @@ bool monsters::eat_corpse(item_def &carrion, int near) hit_points += 1 + random2(mons_weight(carrion.plus)) / 100; - // limited growth factor here -- should 77 really be the cap? {dlb}: + // Limited growth factor here -- should 77 really be the cap? {dlb}: if (hit_points > 100) hit_points = 100; @@ -3963,18 +3966,18 @@ bool monsters::pickup_item(item_def &item, int near, bool force) if (!wandering && (hit_points * 10 < max_hit_points || hit_points < 10) && mon_enemies_around(this)) { - return false; + return (false); } if (mons_friendly(this)) { // No pickup for abjurable (summoned) allies - not worth the hassle. if (has_ench(ENCH_ABJ)) - return false; + return (false); // Never pick up gold or misc. items, it'd only annoy the player. if (itype == OBJ_MISCELLANY || itype == OBJ_GOLD) - return false; + return (false); // Depending on the friendly pickup toggle, your allies may not // pick up anything, or only stuff dropped by (other) allies. @@ -3982,7 +3985,7 @@ bool monsters::pickup_item(item_def &item, int near, bool force) || you.friendly_pickup == FRIENDLY_PICKUP_FRIEND && !testbits(item.flags, ISFLAG_DROPPED_BY_ALLY)) { - return false; + return (false); } } @@ -3993,14 +3996,14 @@ bool monsters::pickup_item(item_def &item, int near, bool force) if (itype == OBJ_ARMOUR || itype == OBJ_CORPSES || itype == OBJ_MISCELLANY || itype == OBJ_GOLD) { - return false; + return (false); } if (itype == OBJ_WEAPONS || itype == OBJ_MISSILES) { // Fleeing monster only pick up emergency equipment. if (behaviour == BEH_FLEE) - return false; + return (false); // While occupied, hostile monsters won't pick up items // dropped or thrown by you. (You might have done that to @@ -4009,7 +4012,7 @@ bool monsters::pickup_item(item_def &item, int near, bool force) && (testbits(item.flags, ISFLAG_DROPPED) || testbits(item.flags, ISFLAG_THROWN))) { - return false; + return (false); } } } @@ -4058,7 +4061,7 @@ void monsters::swap_weapons(int near) if (weap && !unequip(*weap, MSLOT_WEAPON, near)) { - // Item was cursed + // Item was cursed. return; } @@ -4211,14 +4214,14 @@ void monsters::go_berserk(bool /* intentional */) if (has_ench(ENCH_SLOW)) { - del_ench(ENCH_SLOW, true); // give no additional message + del_ench(ENCH_SLOW, true); // Give no additional message. simple_monster_message( this, make_stringf(" shakes off %s lethargy.", pronoun(PRONOUN_NOCAP_POSSESSIVE).c_str()).c_str()); } del_ench(ENCH_HASTE); - del_ench(ENCH_FATIGUE, true); // give no additional message + del_ench(ENCH_FATIGUE, true); // Give no additional message. const int duration = 16 + random2avg(13, 2); add_ench(mon_enchant(ENCH_BERSERK, 0, KC_OTHER, duration * 10)); @@ -4527,8 +4530,8 @@ void monsters::pandemon_init() max_hit_points = ghost->max_hp; ac = ghost->ac; ev = ghost->ev; - // Don't make greased-lightning Pandemonium demons in the dungeon (max - // speed = 17). Demons in Pandemonium can be up to speed 24. + // Don't make greased-lightning Pandemonium demons in the dungeon + // max speed = 17). Demons in Pandemonium can be up to speed 24. if (you.level_type == LEVEL_DUNGEON) speed = (one_chance_in(3)? 10 : 7 + roll_dice(2, 5)); else @@ -4680,7 +4683,8 @@ bool monsters::needs_transit() const return ((mons_is_unique(type) || (flags & MF_BANISHED) || type == MONS_ROYAL_JELLY - || you.level_type == LEVEL_DUNGEON && hit_dice > 8 + random2(25)) + || you.level_type == LEVEL_DUNGEON + && hit_dice > 8 + random2(25)) && !mons_is_summoned(this)); } @@ -4811,7 +4815,7 @@ bool monsters::add_ench(const mon_enchant &ench) void monsters::add_enchantment_effect(const mon_enchant &ench, bool quiet) { - // check for slow/haste + // Check for slow/haste. switch (ench.ench) { case ENCH_BERSERK: @@ -4992,7 +4996,7 @@ void monsters::remove_enchantment_effect(const mon_enchant &me, bool quiet) patrol_point = coord_def(0, 0); } - // reevaluate behaviour + // Reevaluate behaviour. behaviour_event(this, ME_EVAL); break; @@ -5038,7 +5042,7 @@ void monsters::remove_enchantment_effect(const mon_enchant &me, bool quiet) case ENCH_SHORT_LIVED: add_ench(mon_enchant(ENCH_ABJ)); - // just for flavour + // Just for flavour. if (testbits(this->flags, MF_GOD_GIFT) && this->has_ench(ENCH_BERSERK)) simple_monster_message(this, " is no longer berserk."); @@ -5228,7 +5232,7 @@ std::string monsters::describe_enchantments() const return (oss.str()); } -// used to adjust time durations in calc_duration() for monster speed +// Used to adjust time durations in calc_duration() for monster speed. static inline int _mod_speed( int val, int speed ) { if (!speed) @@ -5330,7 +5334,7 @@ void monsters::apply_enchantment(const mon_enchant &me) break; } - // handled in handle_pickup + // Handled in handle_pickup. if (mons_itemuse(type) == MONUSE_EATS_ITEMS) break; @@ -5366,19 +5370,19 @@ void monsters::apply_enchantment(const mon_enchant &me) else simple_monster_message(this, " struggles against the net."); - // confused monsters more likely to struggle without result + // Confused monsters more likely to struggle without result. if (has_ench(ENCH_CONFUSION) && one_chance_in(3)) break; - // nets get destroyed more quickly for larger monsters - // and if already strongly frayed + // Nets get destroyed more quickly for larger monsters + // and if already strongly frayed. int damage = 0; // tiny: 1/6, little: 2/5, small: 3/4, medium and above: always if (random2(SIZE_GIANT - mon_size) <= mon_size) damage++; - // handled specially to make up for its small size + // Handled specially to make up for its small size. if (type == MONS_DANCING_WEAPON) { damage += one_chance_in(3); @@ -5388,7 +5392,7 @@ void monsters::apply_enchantment(const mon_enchant &me) } - // extra damage for large (50%) and big (always) + // Extra damage for large (50%) and big (always). if (mon_size == SIZE_BIG || mon_size == SIZE_LARGE && coinflip()) damage++; @@ -5404,7 +5408,7 @@ void monsters::apply_enchantment(const mon_enchant &me) if (random2(body_size(PSIZE_BODY) - hold + 1) >= 4) damage++; - // berserking doubles damage dealt + // Berserking doubles damage dealt. if (has_ench(ENCH_BERSERK)) damage *= 2; @@ -5573,13 +5577,13 @@ void monsters::apply_enchantment(const mon_enchant &me) hit_points = -1; break; - case ENCH_GLOWING_SHAPESHIFTER: // this ench never runs out - // number of actions is fine for shapeshifters + case ENCH_GLOWING_SHAPESHIFTER: // This ench never runs out! + // Number of actions is fine for shapeshifters. if (type == MONS_GLOWING_SHAPESHIFTER || one_chance_in(4)) monster_polymorph(this, RANDOM_MONSTER, PPT_SAME); break; - case ENCH_SHAPESHIFTER: // this ench never runs out + case ENCH_SHAPESHIFTER: // This ench never runs out! if (type == MONS_SHAPESHIFTER || random2(1000) < ( 1000 / ((15 * hit_dice) / 5))) { @@ -5923,10 +5927,10 @@ bool monsters::move_to_pos(const coord_def &newpos) return (false); } - // clear old cell pointer + // Clear old cell pointer. mgrd[x][y] = NON_MONSTER; - // set monster x,y to new value + // Set monster x,y to new value. x = newpos.x; y = newpos.y; @@ -6306,8 +6310,8 @@ void mon_enchant::set_duration(const monsters *mons, const mon_enchant *added) maxduration = duration; } -// replaces @player_god@ and @god_is@ with player's god name -// special handling for atheists: use "you"/"You" instead +// Replaces @player_god@ and @god_is@ with player's god name +// special handling for atheists: use "you"/"You" instead. static std::string _replace_god_name(bool need_verb = false, bool capital = false) { @@ -6326,13 +6330,13 @@ static std::string _replace_god_name(bool need_verb = false, static std::string _get_species_insult(const std::string type) { std::string lookup = "insult "; - // get species genus + // Get species genus. lookup += species_name(you.species, 1, true); lookup += " "; lookup += type; std::string insult = getSpeakString(lowercase(lookup)); - if (insult.empty()) // species too specific? + if (insult.empty()) // Species too specific? { lookup = "insult general "; lookup += type; @@ -6463,7 +6467,7 @@ std::string do_mon_str_replacements(const std::string &in_msg, msg = replace_all(msg, "@god_is@", _replace_god_name(true, false)); msg = replace_all(msg, "@God_is@", _replace_god_name(true, true)); - // no verb needed + // No verb needed, msg = replace_all(msg, "@player_god@", _replace_god_name(false, false)); msg = replace_all(msg, "@Player_god@", _replace_god_name(false, true)); diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 0033a257f9..6ee128d590 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -464,7 +464,7 @@ bool player_genus(genus_type which_genus, species_type species) } return (false); -} // end player_genus() +} // If transform is true, compare with current transformation instead // of (or in addition to) underlying species. @@ -477,23 +477,23 @@ bool is_player_same_species(const int mon, bool transform) { case TRAN_AIR: return (false); - // unique monsters + // Unique monsters. case TRAN_BAT: return (mon == MONS_GIANT_BAT); case TRAN_ICE_BEAST: return (mon == MONS_ICE_BEAST); case TRAN_SERPENT_OF_HELL: return (mon == MONS_SERPENT_OF_HELL); - // compare with monster *species* + // Compare with monster *species*. case TRAN_LICH: return (mons_species(mon) == MONS_LICH); - // compare with monster *genus* + // Compare with monster *genus*. case TRAN_SPIDER: return (mons_genus(mon) == MONS_WOLF_SPIDER); case TRAN_DRAGON: - return (mons_genus(mon) == MONS_DRAGON); // includes all drakes + return (mons_genus(mon) == MONS_DRAGON); // Includes all drakes. default: - break; // check real (non-transformed) form + break; // Check real (non-transformed) form. } } @@ -520,7 +520,7 @@ bool is_player_same_species(const int mon, bool transform) if (mons_genus(mon) == MONS_MUMMY) return (true); return (false); - case SP_GHOUL: // genus would include necrophage and rotting hulk + case SP_GHOUL: // Genus would include necrophage and rotting hulk. if (mons_species(mon) == MONS_GHOUL) return (true); return (false); @@ -639,66 +639,64 @@ bool player_has_feet() bool you_tran_can_wear(int eq, bool check_mutation) { - // not a transformation, but also temporary -> check first - if (check_mutation) - { - if (eq == EQ_GLOVES && you.has_claws(false) >= 3) - return false; + // Not a transformation, but also temporary -> check first. + if (check_mutation) + { + if (eq == EQ_GLOVES && you.has_claws(false) >= 3) + return (false); - if (eq == EQ_BOOTS - && ( player_is_swimming() && you.species == SP_MERFOLK + if (eq == EQ_BOOTS + && (player_is_swimming() && you.species == SP_MERFOLK || player_mutation_level(MUT_HOOVES) - || player_mutation_level(MUT_TALONS) )) - { - return false; - } - } + || player_mutation_level(MUT_TALONS))) + { + return (false); + } + } - int transform = you.attribute[ATTR_TRANSFORMATION]; + int transform = you.attribute[ATTR_TRANSFORMATION]; - // no further restrictions - if (transform == TRAN_NONE || transform == TRAN_LICH) - return true; + // No further restrictions. + if (transform == TRAN_NONE || transform == TRAN_LICH) + return (true); - // bats cannot use anything, clouds obviously so - if (transform == TRAN_BAT || transform == TRAN_AIR) - return false; + // Bats cannot use anything, clouds obviously so. + if (transform == TRAN_BAT || transform == TRAN_AIR) + return (false); - // everyone else can wear jewellery, at least - if (eq == EQ_LEFT_RING || eq == EQ_RIGHT_RING || eq == EQ_AMULET) - return true; + // Everyone else can wear jewellery, at least. + if (eq == EQ_LEFT_RING || eq == EQ_RIGHT_RING || eq == EQ_AMULET) + return (true); - // these cannot use anything but jewellery - if (transform == TRAN_SPIDER || transform == TRAN_DRAGON - || transform == TRAN_SERPENT_OF_HELL) - { - return false; - } + // These cannot use anything but jewellery. + if (transform == TRAN_SPIDER || transform == TRAN_DRAGON + || transform == TRAN_SERPENT_OF_HELL) + { + return (false); + } - if (transform == TRAN_BLADE_HANDS) - { - if (eq == EQ_WEAPON || eq == EQ_GLOVES || eq == EQ_SHIELD) - return false; - return true; - } + if (transform == TRAN_BLADE_HANDS) + { + if (eq == EQ_WEAPON || eq == EQ_GLOVES || eq == EQ_SHIELD) + return (false); + return (true); + } - if (transform == TRAN_ICE_BEAST) - { - if (eq != EQ_CLOAK) - { - return false; - } - return true; - } + if (transform == TRAN_ICE_BEAST) + { + if (eq != EQ_CLOAK) + return (false); + return (true); + } - if (transform == TRAN_STATUE) - { - if (eq == EQ_BODY_ARMOUR || eq == EQ_GLOVES || eq == EQ_SHIELD) - return false; - return true; - } + if (transform == TRAN_STATUE) + { + if (eq == EQ_BODY_ARMOUR || eq == EQ_GLOVES || eq == EQ_SHIELD) + return (false); + return (true); + } - return true; + return (true); } // Returns the item in the given equipment slot, NULL if the slot is empty. @@ -920,13 +918,13 @@ int player_teleport(bool calc_unid) { int tp = 0; - /* rings */ + // rings tp += 8 * player_equip( EQ_RINGS, RING_TELEPORTATION, calc_unid ); - /* mutations */ + // mutations tp += player_mutation_level(MUT_TELEPORT) * 3; - /* randart weapons only */ + // randart weapons only if (you.equip[EQ_WEAPON] != -1 && you.inv[you.equip[EQ_WEAPON]].base_type == OBJ_WEAPONS && is_random_artefact( you.inv[you.equip[EQ_WEAPON]] )) @@ -935,7 +933,7 @@ int player_teleport(bool calc_unid) } return tp; -} // end player_teleport() +} int player_regen(void) { @@ -959,9 +957,9 @@ int player_regen(void) // fast heal mutation rr += player_mutation_level(MUT_REGENERATION) * 20; - // ghouls heal slowly - // dematerialised people heal slowly - // dematerialised ghouls shouldn't heal any more slowly -- bwr + // Ghouls heal slowly. + // Dematerialised people heal slowly. + // Dematerialised ghouls shouldn't heal any more slowly. -- bwr if ((you.species == SP_GHOUL && (you.attribute[ATTR_TRANSFORMATION] == TRAN_NONE || you.attribute[ATTR_TRANSFORMATION] == TRAN_BLADE_HANDS)) @@ -970,14 +968,14 @@ int player_regen(void) rr /= 2; } - // healing depending on satiation + // Healing depending on satiation. if (you.species == SP_VAMPIRE) { switch (you.hunger_state) { case HS_STARVING: if (you.attribute[ATTR_TRANSFORMATION] != TRAN_BAT) - return (0); // no regeneration for starving vampires! + return (0); // No regeneration for starving vampires! // intentional fall-through for bat form case HS_NEAR_STARVING: case HS_VERY_HUNGRY: @@ -1017,13 +1015,13 @@ int player_hunger_rate(void) if (you.duration[DUR_REGENERATION] > 0) hunger += 4; - // moved here from acr.cc... maintaining the >= 40 behaviour + // Moved here from acr.cc... maintaining the >= 40 behaviour. if (you.hunger >= 40) { if (you.duration[DUR_INVIS] > 0) hunger += 5; - // berserk has its own food penalty -- excluding berserk haste + // Berserk has its own food penalty -- excluding berserk haste. if (you.duration[DUR_HASTE] > 0 && !you.duration[DUR_BERSERKER]) hunger += 5; } @@ -1808,20 +1806,20 @@ int player_movement_speed(void) } else { - /* transformations */ + // transformations if (you.attribute[ATTR_TRANSFORMATION] == TRAN_SPIDER) mv = 8; else if (you.attribute[ATTR_TRANSFORMATION] == TRAN_BAT) mv = 5; // but allowed minimum is six - /* armour */ + // armour if (player_equip_ego_type( EQ_BOOTS, SPARM_RUNNING )) mv -= 2; if (player_equip_ego_type( EQ_BODY_ARMOUR, SPARM_PONDEROUSNESS )) mv += 2; - // in the air, can fly fast (should be lightly burdened). + // In the air, can fly fast (should be lightly burdened). if (you.light_flight()) mv--; @@ -4183,30 +4181,30 @@ bool wearing_amulet(char amulet, bool calc_unid) || you.attribute[ATTR_TRANSFORMATION] == TRAN_DRAGON || you.attribute[ATTR_TRANSFORMATION] == TRAN_BAT)) { - return true; + return (true); } if (amulet == AMU_CLARITY && player_mutation_level(MUT_CLARITY)) - return true; + return (true); if (amulet == AMU_RESIST_CORROSION || amulet == AMU_CONSERVATION) { - // this is hackish {dlb} + // XXX: this is hackish {dlb} if (player_equip_ego_type( EQ_CLOAK, SPARM_PRESERVATION )) - return true; + return (true); } if (you.equip[EQ_AMULET] == -1) - return false; + return (false); if (you.inv[you.equip[EQ_AMULET]].sub_type == amulet && ( calc_unid || item_type_known(you.inv[you.equip[EQ_AMULET]]) )) { - return true; + return (true); } - return false; -} // end wearing_amulet() + return (false); +} bool player_is_airborne(void) { @@ -5839,7 +5837,7 @@ int player::damage_brand(int) break; case TRAN_BAT: - if (you.species == SP_VAMPIRE && one_chance_in(5)) + if (you.species == SP_VAMPIRE && one_chance_in(8)) ret = SPWPN_VAMPIRICISM; break; @@ -6244,8 +6242,8 @@ bool player::omnivorous() const flight_type player::flight_mode() const { - if (attribute[ATTR_TRANSFORMATION] == TRAN_DRAGON || - attribute[ATTR_TRANSFORMATION] == TRAN_BAT) + if (attribute[ATTR_TRANSFORMATION] == TRAN_DRAGON + || attribute[ATTR_TRANSFORMATION] == TRAN_BAT) { return FL_FLY; } -- cgit v1.2.3-54-g00ecf