summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-25 17:39:04 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-25 17:39:04 +0000
commitf5526da8ba8130dd9f03e7e97406537d95866268 (patch)
tree7c98b03f098b2eec5fa797ae4d836e655f3f1b42 /crawl-ref/source
parent63e4083df060b3cdd0ce18d04949dd7831cc10d4 (diff)
downloadcrawl-ref-f5526da8ba8130dd9f03e7e97406537d95866268.tar.gz
crawl-ref-f5526da8ba8130dd9f03e7e97406537d95866268.zip
Force fleeing monsters to "turn to fight" before breathing at you.
(Fixes 1967981: TSO punishes fighting back against "helpless" fleeing monsters.) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5236 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/effects.cc46
-rw-r--r--crawl-ref/source/mon-spll.h282
-rw-r--r--crawl-ref/source/monstuff.cc81
-rw-r--r--crawl-ref/source/mstuff2.cc27
-rw-r--r--crawl-ref/source/newgame.cc64
-rw-r--r--crawl-ref/source/player.cc36
6 files changed, 326 insertions, 210 deletions
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index 153b195d82..9a49d673fa 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -625,41 +625,39 @@ void direct_effect(struct bolt &pbolt)
switch (pbolt.type)
{
case DMNBM_HELLFIRE:
- pbolt.name = "hellfire";
- pbolt.ex_size = 1;
- pbolt.flavour = BEAM_HELLFIRE;
+ pbolt.aux_source = "burst of hellfire";
+ pbolt.name = "hellfire";
+ pbolt.ex_size = 1;
+ pbolt.flavour = BEAM_HELLFIRE;
pbolt.is_explosion = true;
- pbolt.type = dchar_glyph(DCHAR_FIRED_ZAP);
- pbolt.colour = RED;
- pbolt.thrower = KILL_MON_MISSILE;
+ pbolt.type = dchar_glyph(DCHAR_FIRED_ZAP);
+ pbolt.colour = RED;
+ pbolt.thrower = KILL_MON_MISSILE;
pbolt.aux_source.clear();
- pbolt.is_beam = false;
- pbolt.is_tracer = false;
- pbolt.hit = 20;
- pbolt.damage = dice_def( 3, 20 );
- pbolt.aux_source = "burst of hellfire";
+ pbolt.is_beam = false;
+ pbolt.is_tracer = false;
+ pbolt.hit = 20;
+ pbolt.damage = dice_def( 3, 20 );
explosion( pbolt );
break;
case DMNBM_SMITING:
mpr( "Something smites you!" );
- pbolt.name = "smiting";
+ pbolt.name = "smiting";
pbolt.aux_source = "by divine providence";
- damage_taken = 7 + random2avg(11, 2);
+ damage_taken = 7 + random2avg(11, 2);
break;
case DMNBM_BRAIN_FEED:
// lose_stat() must come last {dlb}
- if (one_chance_in(3) &&
- lose_stat(STAT_INTELLIGENCE, 1, source))
+ if (one_chance_in(3)
+ && lose_stat(STAT_INTELLIGENCE, 1, source))
{
mpr("Something feeds on your intellect!");
xom_is_stimulated(50);
}
else
- {
mpr("Something tries to feed on your intellect!");
- }
break;
}
@@ -688,16 +686,16 @@ void mons_direct_effect(struct bolt &pbolt, int i)
{
case DMNBM_HELLFIRE:
simple_monster_message(monster, " is engulfed in hellfire.");
- pbolt.name = "hellfire";
+ pbolt.name = "hellfire";
pbolt.flavour = BEAM_LAVA;
- damage_taken = 5 + random2(10) + random2(5);
- damage_taken = mons_adjust_flavoured(monster, pbolt, damage_taken);
+ damage_taken = 5 + random2(10) + random2(5);
+ damage_taken = mons_adjust_flavoured(monster, pbolt, damage_taken);
break;
case DMNBM_SMITING:
simple_monster_message(monster, " is smitten.");
- pbolt.name = "smiting";
+ pbolt.name = "smiting";
pbolt.flavour = BEAM_MISSILE;
damage_taken += 7 + random2avg(11, 2);
@@ -707,9 +705,11 @@ void mons_direct_effect(struct bolt &pbolt, int i)
break;
case DMNBM_MUTATION:
- if (mons_holiness(monster) != MH_NATURAL ||
- mons_immune_magic(monster))
+ if (mons_holiness(monster) != MH_NATURAL
+ || mons_immune_magic(monster))
+ {
simple_monster_message(monster, " is unaffected.");
+ }
else if (check_mons_resist_magic( monster, pbolt.ench_power ))
simple_monster_message(monster, " resists.");
else
diff --git a/crawl-ref/source/mon-spll.h b/crawl-ref/source/mon-spll.h
index faf2c42912..35fe793695 100644
--- a/crawl-ref/source/mon-spll.h
+++ b/crawl-ref/source/mon-spll.h
@@ -40,7 +40,8 @@
SPELL_INVISIBILITY,
SPELL_MAGIC_DART,
SPELL_NO_SPELL,
- SPELL_CONFUSE }
+ SPELL_CONFUSE
+ }
},
{ MST_ORC_WIZARD_III,
@@ -50,7 +51,8 @@
SPELL_HASTE,
SPELL_THROW_FLAME,
SPELL_MAGIC_DART,
- SPELL_INVISIBILITY }
+ SPELL_INVISIBILITY
+ }
},
{ MST_GUARDIAN_NAGA,
@@ -60,7 +62,8 @@
SPELL_LESSER_HEALING,
SPELL_VENOM_BOLT,
SPELL_SLOW,
- SPELL_LESSER_HEALING }
+ SPELL_LESSER_HEALING
+ }
},
{ MST_LICH_I,
@@ -70,7 +73,8 @@
SPELL_SUMMON_GREATER_DEMON,
SPELL_ANIMATE_DEAD,
SPELL_BOLT_OF_IRON,
- SPELL_TELEPORT_SELF }
+ SPELL_TELEPORT_SELF
+ }
},
{ MST_LICH_II,
@@ -80,7 +84,8 @@
SPELL_HASTE,
SPELL_BOLT_OF_DRAINING,
SPELL_SUMMON_GREATER_DEMON,
- SPELL_BANISHMENT }
+ SPELL_BANISHMENT
+ }
},
{ MST_LICH_III,
@@ -90,7 +95,8 @@
SPELL_SUMMON_UNDEAD,
SPELL_THROW_FROST,
SPELL_LEHUDIBS_CRYSTAL_SPEAR,
- SPELL_SUMMON_UNDEAD }
+ SPELL_SUMMON_UNDEAD
+ }
},
{ MST_LICH_IV,
@@ -100,7 +106,8 @@
SPELL_INVISIBILITY,
SPELL_ANIMATE_DEAD,
SPELL_BOLT_OF_IRON,
- SPELL_INVISIBILITY }
+ SPELL_INVISIBILITY
+ }
},
{ MST_BURNING_DEVIL,
@@ -110,7 +117,8 @@
SPELL_NO_SPELL,
SPELL_HELLFIRE_BURST,
SPELL_HELLFIRE_BURST,
- SPELL_HELLFIRE_BURST }
+ SPELL_HELLFIRE_BURST
+ }
},
{ MST_VAMPIRE,
@@ -120,7 +128,8 @@
SPELL_INVISIBILITY,
SPELL_NO_SPELL,
SPELL_VAMPIRE_SUMMON,
- SPELL_VAMPIRE_SUMMON }
+ SPELL_VAMPIRE_SUMMON
+ }
},
{ MST_VAMPIRE_KNIGHT,
@@ -130,7 +139,8 @@
SPELL_HASTE,
SPELL_INVISIBILITY,
SPELL_VAMPIRE_SUMMON,
- SPELL_LESSER_HEALING }
+ SPELL_LESSER_HEALING
+ }
},
{ MST_VAMPIRE_MAGE,
@@ -140,7 +150,8 @@
SPELL_INVISIBILITY,
SPELL_ANIMATE_DEAD,
SPELL_ANIMATE_DEAD,
- SPELL_TELEPORT_SELF }
+ SPELL_TELEPORT_SELF
+ }
},
{ MST_EFREET,
@@ -150,7 +161,8 @@
SPELL_NO_SPELL,
SPELL_FIREBALL,
SPELL_NO_SPELL,
- SPELL_NO_SPELL }
+ SPELL_NO_SPELL
+ }
},
{ MST_BRAIN_WORM,
@@ -160,7 +172,8 @@
SPELL_NO_SPELL,
SPELL_BRAIN_FEED,
SPELL_NO_SPELL,
- SPELL_NO_SPELL }
+ SPELL_NO_SPELL
+ }
},
{ MST_GIANT_ORANGE_BRAIN,
@@ -170,7 +183,8 @@
SPELL_SHADOW_CREATURES,
SPELL_CONFUSE,
SPELL_BLINK,
- SPELL_TELEPORT_SELF }
+ SPELL_TELEPORT_SELF
+ }
},
{ MST_RAKSHASA,
@@ -180,7 +194,8 @@
SPELL_INVISIBILITY,
SPELL_FAKE_RAKSHASA_SUMMON,
SPELL_BLINK,
- SPELL_TELEPORT_SELF }
+ SPELL_TELEPORT_SELF
+ }
},
{ MST_GREAT_ORB_OF_EYES,
@@ -190,7 +205,8 @@
SPELL_NO_SPELL,
SPELL_SLOW,
SPELL_CONFUSE,
- SPELL_TELEPORT_OTHER }
+ SPELL_TELEPORT_OTHER
+ }
},
{ MST_ORC_SORCERER,
@@ -200,7 +216,8 @@
SPELL_SUMMON_DEMON,
SPELL_PARALYSE,
SPELL_ANIMATE_DEAD,
- SPELL_TELEPORT_SELF }
+ SPELL_TELEPORT_SELF
+ }
},
{ MST_STEAM_DRAGON,
@@ -210,7 +227,8 @@
SPELL_NO_SPELL,
SPELL_STEAM_BALL,
SPELL_STEAM_BALL,
- SPELL_NO_SPELL }
+ SPELL_NO_SPELL
+ }
},
{ MST_HELL_KNIGHT_I,
@@ -220,7 +238,8 @@
SPELL_HASTE,
SPELL_NO_SPELL,
SPELL_NO_SPELL,
- SPELL_HASTE }
+ SPELL_HASTE
+ }
},
{ MST_HELL_KNIGHT_II,
@@ -230,7 +249,8 @@
SPELL_NO_SPELL,
SPELL_NO_SPELL,
SPELL_NO_SPELL,
- SPELL_BLINK }
+ SPELL_BLINK
+ }
},
{ MST_NECROMANCER_I,
@@ -240,7 +260,8 @@
SPELL_NO_SPELL,
SPELL_ANIMATE_DEAD,
SPELL_ANIMATE_DEAD,
- SPELL_TELEPORT_SELF }
+ SPELL_TELEPORT_SELF
+ }
},
{ MST_NECROMANCER_II,
@@ -250,7 +271,8 @@
SPELL_INVISIBILITY,
SPELL_ANIMATE_DEAD,
SPELL_ANIMATE_DEAD,
- SPELL_BLINK }
+ SPELL_BLINK
+ }
},
{ MST_WIZARD_I,
@@ -260,7 +282,8 @@
SPELL_HASTE,
SPELL_LIGHTNING_BOLT,
SPELL_CONFUSE,
- SPELL_TELEPORT_SELF }
+ SPELL_TELEPORT_SELF
+ }
},
{ MST_WIZARD_II,
@@ -270,7 +293,8 @@
SPELL_INVISIBILITY,
SPELL_CONFUSE,
SPELL_SLOW,
- SPELL_TELEPORT_SELF }
+ SPELL_TELEPORT_SELF
+ }
},
{ MST_WIZARD_III,
@@ -280,7 +304,8 @@
SPELL_BLINK,
SPELL_BOLT_OF_FIRE,
SPELL_BOLT_OF_COLD,
- SPELL_LESSER_HEALING }
+ SPELL_LESSER_HEALING
+ }
},
{ MST_WIZARD_IV,
@@ -290,7 +315,8 @@
SPELL_BLINK,
SPELL_LIGHTNING_BOLT,
SPELL_BANISHMENT,
- SPELL_LESSER_HEALING }
+ SPELL_LESSER_HEALING
+ }
},
{ MST_WIZARD_V,
@@ -300,7 +326,8 @@
SPELL_INVISIBILITY,
SPELL_TELEPORT_OTHER,
SPELL_FIREBALL,
- SPELL_TELEPORT_OTHER }
+ SPELL_TELEPORT_OTHER
+ }
},
{ MST_ORC_PRIEST,
@@ -310,7 +337,8 @@
SPELL_CANTRIP,
SPELL_SMITING,
SPELL_NO_SPELL,
- SPELL_LESSER_HEALING }
+ SPELL_LESSER_HEALING
+ }
},
{ MST_ORC_HIGH_PRIEST,
@@ -320,7 +348,8 @@
SPELL_SUMMON_DEMON,
SPELL_SMITING,
SPELL_ANIMATE_DEAD,
- SPELL_LESSER_HEALING }
+ SPELL_LESSER_HEALING
+ }
},
{ MST_MOTTLED_DRAGON,
@@ -330,7 +359,8 @@
SPELL_NO_SPELL,
SPELL_STICKY_FLAME,
SPELL_STICKY_FLAME,
- SPELL_NO_SPELL }
+ SPELL_NO_SPELL
+ }
},
{ MST_ICE_FIEND,
@@ -340,7 +370,8 @@
SPELL_NO_SPELL,
SPELL_SYMBOL_OF_TORMENT,
SPELL_NO_SPELL,
- SPELL_SUMMON_DEMON }
+ SPELL_SUMMON_DEMON
+ }
},
{ MST_SHADOW_FIEND,
@@ -350,7 +381,8 @@
SPELL_NO_SPELL,
SPELL_SYMBOL_OF_TORMENT,
SPELL_DISPEL_UNDEAD,
- SPELL_SUMMON_DEMON }
+ SPELL_SUMMON_DEMON
+ }
},
{ MST_TORMENTOR,
@@ -360,7 +392,8 @@
SPELL_NO_SPELL,
SPELL_PAIN,
SPELL_NO_SPELL,
- SPELL_SYMBOL_OF_TORMENT }
+ SPELL_SYMBOL_OF_TORMENT
+ }
},
{ MST_STORM_DRAGON,
@@ -370,7 +403,8 @@
SPELL_NO_SPELL,
SPELL_LIGHTNING_BOLT,
SPELL_LIGHTNING_BOLT,
- SPELL_NO_SPELL }
+ SPELL_NO_SPELL
+ }
},
{ MST_WHITE_IMP,
@@ -380,7 +414,8 @@
SPELL_NO_SPELL,
SPELL_NO_SPELL,
SPELL_NO_SPELL,
- SPELL_NO_SPELL }
+ SPELL_NO_SPELL
+ }
},
{ MST_YNOXINUL,
@@ -390,7 +425,8 @@
SPELL_SUMMON_UFETUBUS,
SPELL_NO_SPELL,
SPELL_SUMMON_UFETUBUS,
- SPELL_NO_SPELL }
+ SPELL_NO_SPELL
+ }
},
{ MST_NEQOXEC,
@@ -400,7 +436,8 @@
SPELL_NO_SPELL,
SPELL_BRAIN_FEED,
SPELL_CALL_IMP,
- SPELL_NO_SPELL }
+ SPELL_NO_SPELL
+ }
},
{ MST_HELLWING,
@@ -410,7 +447,8 @@
SPELL_NO_SPELL,
SPELL_TELEPORT_OTHER,
SPELL_ANIMATE_DEAD,
- SPELL_TELEPORT_SELF }
+ SPELL_TELEPORT_SELF
+ }
},
{ MST_SMOKE_DEMON,
@@ -420,7 +458,8 @@
SPELL_NO_SPELL,
SPELL_SMITING,
SPELL_NO_SPELL,
- SPELL_NO_SPELL }
+ SPELL_NO_SPELL
+ }
},
{ MST_CACODEMON,
@@ -430,7 +469,8 @@
SPELL_CALL_IMP,
SPELL_POLYMORPH_OTHER,
SPELL_DIG,
- SPELL_SUMMON_DEMON }
+ SPELL_SUMMON_DEMON
+ }
},
{ MST_GREEN_DEATH,
@@ -440,7 +480,8 @@
SPELL_NO_SPELL,
SPELL_VENOM_BOLT,
SPELL_CALL_IMP,
- SPELL_BLINK }
+ SPELL_BLINK
+ }
},
{ MST_BALRUG,
@@ -450,7 +491,8 @@
SPELL_NO_SPELL,
SPELL_STICKY_FLAME,
SPELL_SMITING,
- SPELL_TELEPORT_SELF }
+ SPELL_TELEPORT_SELF
+ }
},
{ MST_BLUE_DEATH,
@@ -460,7 +502,8 @@
SPELL_NO_SPELL,
SPELL_CALL_IMP,
SPELL_SHADOW_CREATURES,
- SPELL_TELEPORT_OTHER }
+ SPELL_TELEPORT_OTHER
+ }
},
{ MST_GERYON,
@@ -470,7 +513,8 @@
SPELL_NO_SPELL,
SPELL_SUMMON_BEAST,
SPELL_NO_SPELL,
- SPELL_SUMMON_BEAST }
+ SPELL_SUMMON_BEAST
+ }
},
{ MST_DISPATER,
@@ -480,7 +524,8 @@
SPELL_SUMMON_DEMON,
SPELL_LIGHTNING_BOLT,
SPELL_HELLFIRE,
- SPELL_SUMMON_GREATER_DEMON }
+ SPELL_SUMMON_GREATER_DEMON
+ }
},
{ MST_ASMODEUS,
@@ -490,7 +535,8 @@
SPELL_SUMMON_DEMON,
SPELL_SUMMON_GREATER_DEMON,
SPELL_BOLT_OF_DRAINING,
- SPELL_TELEPORT_SELF }
+ SPELL_TELEPORT_SELF
+ }
},
{ MST_ERESHKIGAL,
@@ -500,7 +546,8 @@
SPELL_SUMMON_GREATER_DEMON,
SPELL_SYMBOL_OF_TORMENT,
SPELL_PARALYSE,
- SPELL_LESSER_HEALING }
+ SPELL_LESSER_HEALING
+ }
},
{ MST_ANTAEUS,
@@ -510,7 +557,8 @@
SPELL_NO_SPELL,
SPELL_NO_SPELL,
SPELL_NO_SPELL,
- SPELL_NO_SPELL }
+ SPELL_NO_SPELL
+ }
},
{ MST_MNOLEG,
@@ -520,7 +568,8 @@
SPELL_INVISIBILITY,
SPELL_POLYMORPH_OTHER,
SPELL_SHADOW_CREATURES,
- SPELL_TELEPORT_SELF }
+ SPELL_TELEPORT_SELF
+ }
},
{ MST_LOM_LOBON,
@@ -530,7 +579,8 @@
SPELL_GREATER_HEALING,
SPELL_SUMMON_DEMON,
SPELL_TELEPORT_SELF,
- SPELL_TELEPORT_SELF }
+ SPELL_TELEPORT_SELF
+ }
},
{ MST_CEREBOV,
@@ -540,7 +590,8 @@
SPELL_HASTE,
SPELL_FIREBALL,
SPELL_SUMMON_GREATER_DEMON,
- SPELL_HASTE }
+ SPELL_HASTE
+ }
},
{ MST_GLOORX_VLOQ,
@@ -550,7 +601,8 @@
SPELL_SUMMON_DEMON,
SPELL_BOLT_OF_DRAINING,
SPELL_DISPEL_UNDEAD,
- SPELL_INVISIBILITY }
+ SPELL_INVISIBILITY
+ }
},
{ MST_TITAN,
@@ -560,7 +612,8 @@
SPELL_LESSER_HEALING,
SPELL_NO_SPELL,
SPELL_NO_SPELL,
- SPELL_LESSER_HEALING }
+ SPELL_LESSER_HEALING
+ }
},
{ MST_GOLDEN_DRAGON,
@@ -570,7 +623,8 @@
SPELL_NO_SPELL,
SPELL_NO_SPELL,
SPELL_POISONOUS_CLOUD,
- SPELL_NO_SPELL }
+ SPELL_NO_SPELL
+ }
},
{ MST_DEEP_ELF_SUMMONER,
@@ -580,7 +634,8 @@
SPELL_SUMMON_UFETUBUS,
SPELL_VAMPIRE_SUMMON,
SPELL_SUMMON_DEMON,
- SPELL_TELEPORT_SELF }
+ SPELL_TELEPORT_SELF
+ }
},
{ MST_DEEP_ELF_CONJURER_I,
@@ -590,7 +645,8 @@
SPELL_CANTRIP,
SPELL_LIGHTNING_BOLT,
SPELL_STICKY_FLAME,
- SPELL_TELEPORT_SELF }
+ SPELL_TELEPORT_SELF
+ }
},
{ MST_DEEP_ELF_CONJURER_II,
@@ -600,7 +656,8 @@
SPELL_INVISIBILITY,
SPELL_STONE_ARROW,
SPELL_BOLT_OF_DRAINING,
- SPELL_TELEPORT_SELF }
+ SPELL_TELEPORT_SELF
+ }
},
{ MST_DEEP_ELF_PRIEST,
@@ -610,7 +667,8 @@
SPELL_LESSER_HEALING,
SPELL_SMITING,
SPELL_ANIMATE_DEAD,
- SPELL_LESSER_HEALING }
+ SPELL_LESSER_HEALING
+ }
},
{ MST_DEEP_ELF_HIGH_PRIEST,
@@ -620,7 +678,8 @@
SPELL_LESSER_HEALING,
SPELL_SMITING,
SPELL_ANIMATE_DEAD,
- SPELL_LESSER_HEALING }
+ SPELL_LESSER_HEALING
+ }
},
{ MST_DEEP_ELF_DEMONOLOGIST,
@@ -630,7 +689,8 @@
SPELL_SUMMON_DEMON,
SPELL_SUMMON_GREATER_DEMON,
SPELL_CALL_IMP,
- SPELL_TELEPORT_SELF }
+ SPELL_TELEPORT_SELF
+ }
},
{ MST_DEEP_ELF_ANNIHILATOR,
@@ -640,7 +700,8 @@
SPELL_BLINK,
SPELL_BOLT_OF_IRON,
SPELL_POISON_ARROW,
- SPELL_TELEPORT_SELF }
+ SPELL_TELEPORT_SELF
+ }
},
{ MST_DEEP_ELF_SORCERER,
@@ -650,7 +711,8 @@
SPELL_HASTE,
SPELL_SUMMON_DEMON,
SPELL_HELLFIRE,
- SPELL_TELEPORT_SELF }
+ SPELL_TELEPORT_SELF
+ }
},
{ MST_DEEP_ELF_DEATH_MAGE,
@@ -660,7 +722,8 @@
SPELL_LESSER_HEALING,
SPELL_ANIMATE_DEAD,
SPELL_ANIMATE_DEAD,
- SPELL_TELEPORT_SELF }
+ SPELL_TELEPORT_SELF
+ }
},
{ MST_KOBOLD_DEMONOLOGIST,
@@ -670,7 +733,8 @@
SPELL_CANTRIP,
SPELL_CALL_IMP,
SPELL_SUMMON_DEMON,
- SPELL_CANTRIP }, // this should be cute -- bw
+ SPELL_CANTRIP // this should be cute -- bw
+ },
},
{ MST_NAGA,
@@ -680,7 +744,8 @@
SPELL_NO_SPELL,
SPELL_NO_SPELL,
SPELL_NO_SPELL,
- SPELL_NO_SPELL }
+ SPELL_NO_SPELL
+ }
},
{ MST_NAGA_MAGE,
@@ -690,7 +755,8 @@
SPELL_HASTE,
SPELL_POISON_ARROW,
SPELL_TELEPORT_OTHER,
- SPELL_TELEPORT_SELF }
+ SPELL_TELEPORT_SELF
+ }
},
{ MST_CURSE_SKULL,
@@ -700,7 +766,8 @@
SPELL_NO_SPELL,
SPELL_SYMBOL_OF_TORMENT,
SPELL_SUMMON_UNDEAD,
- SPELL_NO_SPELL }
+ SPELL_NO_SPELL
+ }
},
{ MST_SHINING_EYE,
@@ -710,7 +777,8 @@
SPELL_NO_SPELL,
SPELL_NO_SPELL,
SPELL_NO_SPELL,
- SPELL_NO_SPELL }
+ SPELL_NO_SPELL
+ }
},
{ MST_FROST_GIANT,
@@ -720,7 +788,8 @@
SPELL_NO_SPELL,
SPELL_NO_SPELL,
SPELL_NO_SPELL,
- SPELL_NO_SPELL }
+ SPELL_NO_SPELL
+ }
},
{ MST_ANGEL,
@@ -730,7 +799,8 @@
SPELL_LESSER_HEALING,
SPELL_NO_SPELL,
SPELL_LESSER_HEALING,
- SPELL_LESSER_HEALING }
+ SPELL_LESSER_HEALING
+ }
},
{ MST_DAEVA,
@@ -740,7 +810,8 @@
SPELL_NO_SPELL,
SPELL_SMITING,
SPELL_SMITING,
- SPELL_NO_SPELL }
+ SPELL_NO_SPELL
+ }
},
{ MST_SHADOW_DRAGON,
@@ -750,7 +821,8 @@
SPELL_NO_SPELL,
SPELL_NO_SPELL,
SPELL_BOLT_OF_DRAINING,
- SPELL_NO_SPELL }
+ SPELL_NO_SPELL
+ }
},
{ MST_SPHINX,
@@ -760,7 +832,8 @@
SPELL_LESSER_HEALING,
SPELL_SMITING,
SPELL_SLOW,
- SPELL_LESSER_HEALING }
+ SPELL_LESSER_HEALING
+ }
},
{ MST_MUMMY,
@@ -770,7 +843,8 @@
SPELL_NO_SPELL,
SPELL_SYMBOL_OF_TORMENT,
SPELL_SUMMON_UNDEAD,
- SPELL_SUMMON_UNDEAD }
+ SPELL_SUMMON_UNDEAD
+ }
},
{ MST_ELECTRIC_GOLEM,
@@ -780,7 +854,8 @@
SPELL_BLINK,
SPELL_LIGHTNING_BOLT,
SPELL_LIGHTNING_BOLT,
- SPELL_BLINK }
+ SPELL_BLINK
+ }
},
{ MST_ORB_OF_FIRE,
@@ -790,7 +865,8 @@
SPELL_NO_SPELL,
SPELL_POLYMORPH_OTHER,
SPELL_FIREBALL,
- SPELL_FIREBALL }
+ SPELL_FIREBALL
+ }
},
{ MST_SHADOW_IMP,
@@ -800,7 +876,8 @@
SPELL_ANIMATE_DEAD,
SPELL_ANIMATE_DEAD,
SPELL_NO_SPELL,
- SPELL_NO_SPELL }
+ SPELL_NO_SPELL
+ }
},
{ MST_HELL_HOG,
@@ -810,7 +887,8 @@
SPELL_NO_SPELL,
SPELL_NO_SPELL,
SPELL_NO_SPELL,
- SPELL_NO_SPELL }
+ SPELL_NO_SPELL
+ }
},
{ MST_SWAMP_DRAGON,
@@ -820,7 +898,8 @@
SPELL_NO_SPELL,
SPELL_POISONOUS_CLOUD,
SPELL_POISONOUS_CLOUD,
- SPELL_NO_SPELL }
+ SPELL_NO_SPELL
+ }
},
{ MST_SWAMP_DRAKE,
@@ -830,7 +909,8 @@
SPELL_NO_SPELL,
SPELL_MEPHITIC_CLOUD,
SPELL_MEPHITIC_CLOUD,
- SPELL_NO_SPELL }
+ SPELL_NO_SPELL
+ }
},
{ MST_SERPENT_OF_HELL,
@@ -840,7 +920,8 @@
SPELL_NO_SPELL,
SPELL_HELLFIRE,
SPELL_HELLFIRE,
- SPELL_NO_SPELL }
+ SPELL_NO_SPELL
+ }
},
{ MST_BOGGART,
@@ -850,7 +931,8 @@
SPELL_INVISIBILITY,
SPELL_BLINK,
SPELL_SHADOW_CREATURES,
- SPELL_SHADOW_CREATURES }
+ SPELL_SHADOW_CREATURES
+ }
},
{ MST_EYE_OF_DEVASTATION,
@@ -860,7 +942,8 @@
SPELL_NO_SPELL,
SPELL_ENERGY_BOLT,
SPELL_ENERGY_BOLT,
- SPELL_NO_SPELL }
+ SPELL_NO_SPELL
+ }
},
{ MST_QUICKSILVER_DRAGON,
@@ -870,7 +953,8 @@
SPELL_NO_SPELL,
SPELL_QUICKSILVER_BOLT,
SPELL_QUICKSILVER_BOLT,
- SPELL_NO_SPELL }
+ SPELL_NO_SPELL
+ }
},
{ MST_IRON_DRAGON,
@@ -880,7 +964,8 @@
SPELL_NO_SPELL,
SPELL_METAL_SPLINTERS,
SPELL_METAL_SPLINTERS,
- SPELL_NO_SPELL }
+ SPELL_NO_SPELL
+ }
},
{ MST_SKELETAL_WARRIOR,
@@ -890,7 +975,8 @@
SPELL_ANIMATE_DEAD,
SPELL_NO_SPELL,
SPELL_NO_SPELL,
- SPELL_NO_SPELL }
+ SPELL_NO_SPELL
+ }
},
{ MST_MYSTIC,
@@ -900,7 +986,8 @@
SPELL_INVISIBILITY,
SPELL_CONFUSE,
SPELL_PARALYSE,
- SPELL_LESSER_HEALING }
+ SPELL_LESSER_HEALING
+ }
},
{ MST_DEATH_DRAKE,
@@ -910,7 +997,8 @@
SPELL_NO_SPELL,
SPELL_MIASMA,
SPELL_MIASMA,
- SPELL_NO_SPELL }
+ SPELL_NO_SPELL
+ }
},
{ MST_DRAC_SCORCHER,
@@ -920,7 +1008,8 @@
SPELL_NO_SPELL,
SPELL_FIREBALL,
SPELL_HELLFIRE,
- SPELL_HELLFIRE_BURST }
+ SPELL_HELLFIRE_BURST
+ }
},
{ MST_DRAC_CALLER,
@@ -930,7 +1019,8 @@
SPELL_SUMMON_DRAKES,
SPELL_NO_SPELL,
SPELL_NO_SPELL,
- SPELL_SUMMON_DRAKES }
+ SPELL_SUMMON_DRAKES
+ }
},
{ MST_DRAC_SHIFTER,
@@ -940,7 +1030,8 @@
SPELL_BLINK,
SPELL_NO_SPELL,
SPELL_BLINK_OTHER,
- SPELL_CONTROLLED_BLINK }
+ SPELL_CONTROLLED_BLINK
+ }
},
// Curse toe menu should be kept full, because otherwise the toe spends
@@ -952,7 +1043,8 @@
SPELL_SUMMON_MUSHROOMS,
SPELL_SYMBOL_OF_TORMENT,
SPELL_SUMMON_UNDEAD,
- SPELL_SYMBOL_OF_TORMENT }
+ SPELL_SYMBOL_OF_TORMENT
+ }
},
// Crusader theme.
@@ -963,7 +1055,8 @@
SPELL_BERSERKER_RAGE,
SPELL_NO_SPELL,
SPELL_NO_SPELL,
- SPELL_BERSERKER_RAGE }
+ SPELL_BERSERKER_RAGE
+ }
},
{ MST_ICE_STATUE,
@@ -973,7 +1066,8 @@
SPELL_NO_SPELL,
SPELL_FREEZING_CLOUD,
SPELL_SUMMON_ICE_BEAST,
- SPELL_SUMMON_ICE_BEAST }
+ SPELL_SUMMON_ICE_BEAST
+ }
}
#endif
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 14092f9840..36562bcf19 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -2084,9 +2084,12 @@ void behaviour_event( monsters *mon, int event, int src,
if (mon->has_ench(ENCH_BERSERK))
break;
- // Neither do wandering mushrooms.
- if (mon->type == MONS_WANDERING_MUSHROOM)
+ // Neither do plants or nonliving beings.
+ if (mons_class_holiness(mon->type) == MH_PLANT
+ || mons_class_holiness(mon->type) == MH_NONLIVING)
+ {
break;
+ }
mon->foe = src;
mon->behaviour = BEH_FLEE;
@@ -2098,11 +2101,15 @@ void behaviour_event( monsters *mon, int event, int src,
break;
case ME_CORNERED:
- if (mon->type == MONS_WANDERING_MUSHROOM)
+ // Plants or nonliving monsters cannot flee.
+ if (mons_class_holiness(mon->type) == MH_PLANT)
+ || mons_class_holiness(mon->type) == MH_NONLIVING)
+ {
break;
+ }
- // just set behaviour.. foe doesn't change.
- if (mon->behaviour != BEH_CORNERED && !mon->has_ench(ENCH_FEAR))
+ // Just set behaviour.. foe doesn't change.
+ if (mon->behaviour != BEH_CORNERED)
simple_monster_message(mon, " turns to fight!");
mon->behaviour = BEH_CORNERED;
@@ -2793,6 +2800,12 @@ static void _handle_movement(monsters *monster)
}
} // end handle_movement()
+static void _make_mons_stop_fleeing(monsters *mon)
+{
+ if (mon->behaviour == BEH_FLEE)
+ behaviour_event(mon, ME_CORNERED);
+}
+
//---------------------------------------------------------------
//
// handle_nearby_ability
@@ -3042,6 +3055,7 @@ static bool _handle_special_ability(monsters *monster, bolt & beem)
// good idea?
if (mons_should_fire(beem))
{
+ _make_mons_stop_fleeing(monster);
simple_monster_message(monster, " spits lava!");
fire_beam(beem);
used = true;
@@ -3084,6 +3098,7 @@ static bool _handle_special_ability(monsters *monster, bolt & beem)
// good idea?
if (mons_should_fire(beem))
{
+ _make_mons_stop_fleeing(monster);
simple_monster_message(monster,
" shoots out a bolt of electricity!");
fire_beam(beem);
@@ -3126,7 +3141,7 @@ static bool _handle_special_ability(monsters *monster, bolt & beem)
break;
}
- // friendly fiends won't use torment, preferring hellfire
+ // Friendly fiends won't use torment, preferring hellfire
// (right now there is no way a monster can predict how
// badly they'll damage the player with torment) -- GDL
@@ -3162,6 +3177,7 @@ static bool _handle_special_ability(monsters *monster, bolt & beem)
// good idea?
if (mons_should_fire(beem))
{
+ _make_mons_stop_fleeing(monster);
simple_monster_message( monster, " makes a gesture!", spl );
mons_cast(monster, beem, spell_cast);
@@ -3231,6 +3247,7 @@ static bool _handle_special_ability(monsters *monster, bolt & beem)
// good idea?
if (mons_should_fire(beem))
{
+ _make_mons_stop_fleeing(monster);
simple_monster_message(monster, " flicks its tail!");
fire_beam(beem);
used = true;
@@ -3284,6 +3301,7 @@ static bool _handle_special_ability(monsters *monster, bolt & beem)
// good idea?
if (mons_should_fire(beem))
{
+ _make_mons_stop_fleeing(monster);
simple_monster_message(monster, " breathes.", spl);
fire_beam(beem);
mmov_x = 0;
@@ -3296,7 +3314,7 @@ static bool _handle_special_ability(monsters *monster, bolt & beem)
case MONS_MERMAID:
{
// Don't behold player already half down or up the stairs
- if ( !you.delay_queue.empty() )
+ if (!you.delay_queue.empty())
{
delay_queue_item delay = you.delay_queue.front();
@@ -3310,8 +3328,10 @@ static bool _handle_special_ability(monsters *monster, bolt & beem)
}
}
- // Won't sing if either of you silenced, or it's friendly or confused.
- if (monster->has_ench(ENCH_CONFUSION) || mons_friendly(monster)
+ // Won't sing if either of you silenced, or it's friendly,
+ // confused or fleeing.
+ if (monster->has_ench(ENCH_CONFUSION) || monster->behaviour == BEH_FLEE
+ || mons_friendly(monster)
|| silenced(monster->x, monster->y)
|| silenced(you.x_pos, you.y_pos))
{
@@ -4109,8 +4129,8 @@ static bool _handle_spell( monsters *monster, bolt & beem )
// yes, there is a logic to this ordering {dlb}:
if (monster->behaviour == BEH_SLEEP
- || (!mons_class_flag(monster->type, M_SPELLCASTER)
- && draco_breath == SPELL_NO_SPELL)
+ || !mons_class_flag(monster->type, M_SPELLCASTER)
+ && draco_breath == SPELL_NO_SPELL
|| monster->has_ench(ENCH_SUBMERGED))
{
return (false);
@@ -4118,7 +4138,7 @@ static bool _handle_spell( monsters *monster, bolt & beem )
if ((mons_class_flag(monster->type, M_ACTUAL_SPELLS)
|| mons_class_flag(monster->type, M_PRIEST))
- && (monster->has_ench(ENCH_GLOWING_SHAPESHIFTER, ENCH_SHAPESHIFTER)))
+ && monster->has_ench(ENCH_GLOWING_SHAPESHIFTER, ENCH_SHAPESHIFTER))
{
return (false); //jmf: shapeshifters don't get spells, just
// physical powers.
@@ -4145,7 +4165,7 @@ static bool _handle_spell( monsters *monster, bolt & beem )
if (!mon_enemies_around(monster))
{
- // forces the casting of dig when player not visible - this is EVIL!
+ // Forces the casting of dig when player not visible - this is EVIL!
if (monster->has_spell(SPELL_DIG)
&& monster->behaviour == BEH_SEEK)
{
@@ -4153,7 +4173,7 @@ static bool _handle_spell( monsters *monster, bolt & beem )
finalAnswer = true;
}
else if ((monster->has_spell(SPELL_LESSER_HEALING)
- || monster->has_spell(SPELL_GREATER_HEALING))
+ || monster->has_spell(SPELL_GREATER_HEALING))
&& monster->hit_points < monster->max_hit_points)
{
// The player's out of sight!
@@ -4183,8 +4203,8 @@ static bool _handle_spell( monsters *monster, bolt & beem )
return (false);
}
- // monsters caught in a net try to get away
- // this is only urgent if enemies are around
+ // Monsters caught in a net try to get away.
+ // This is only urgent if enemies are around.
if (!finalAnswer && mon_enemies_around(monster)
&& mons_is_caught(monster) && one_chance_in(4))
{
@@ -4234,7 +4254,7 @@ static bool _handle_spell( monsters *monster, bolt & beem )
{
// If nothing found by now, safe friendlies will rarely cast.
if (mons_friendly(monster) && !mon_enemies_around(monster)
- && !one_chance_in(8))
+ && !one_chance_in(10))
{
return (false);
}
@@ -4247,9 +4267,10 @@ static bool _handle_spell( monsters *monster, bolt & beem )
if (hspell_pass[i] == SPELL_NO_SPELL)
num_no_spell++;
else if (ms_waste_of_time( monster, hspell_pass[i] )
- // should monster not have selected dig by now, it never will:
|| hspell_pass[i] == SPELL_DIG)
{
+ // Should monster not have selected dig by now,
+ // it never will.
hspell_pass[i] = SPELL_NO_SPELL;
num_no_spell++;
}
@@ -4262,12 +4283,12 @@ static bool _handle_spell( monsters *monster, bolt & beem )
return (false);
}
- // up to four tries to pick a spell.
+ // Up to four tries to pick a spell.
for (int loopy = 0; loopy < 4; loopy ++)
{
bool spellOK = false;
- // setup spell - fleeing monsters will always try to
+ // Setup spell - fleeing monsters will always try to
// choose their emergency spell.
if (monster->behaviour == BEH_FLEE)
{
@@ -4334,7 +4355,7 @@ static bool _handle_spell( monsters *monster, bolt & beem )
}
}
- // if not okay, then maybe we'll cast a defensive spell
+ // If not okay, then maybe we'll cast a defensive spell.
if (!spellOK)
{
if (is_sanctuary(you.x_pos, you.y_pos)
@@ -4343,7 +4364,10 @@ static bool _handle_spell( monsters *monster, bolt & beem )
spell_cast = SPELL_NO_SPELL;
}
else
- spell_cast = (coinflip() ? hspell_pass[2] : SPELL_NO_SPELL);
+ {
+ spell_cast = (coinflip() ? hspell_pass[2]
+ : SPELL_NO_SPELL);
+ }
}
if (spell_cast != SPELL_NO_SPELL)
@@ -4354,9 +4378,9 @@ static bool _handle_spell( monsters *monster, bolt & beem )
// If there's otherwise no ranged attack use the breath weapon.
// The breath weapon is also occasionally used.
if (draco_breath != SPELL_NO_SPELL
- && (spell_cast == SPELL_NO_SPELL
- || (!_is_emergency_spell(hspell_pass, spell_cast)
- && one_chance_in(4)))
+ && (spell_cast == SPELL_NO_SPELL
+ || !_is_emergency_spell(hspell_pass, spell_cast)
+ && one_chance_in(4))
&& !is_sanctuary(you.x_pos, you.y_pos)
&& !is_sanctuary(monster->x, monster->y))
{
@@ -4364,11 +4388,11 @@ static bool _handle_spell( monsters *monster, bolt & beem )
finalAnswer = true;
}
- // should the monster *still* not have a spell, well, too bad {dlb}:
+ // Should the monster *still* not have a spell, well, too bad {dlb}:
if (spell_cast == SPELL_NO_SPELL)
return (false);
- // Try to animate dead: if nothing rises, pretend we didn't cast it
+ // Try to animate dead: if nothing rises, pretend we didn't cast it.
if (spell_cast == SPELL_ANIMATE_DEAD
&& !animate_dead( monster, 100, SAME_ATTITUDE(monster),
monster->foe, 0 ))
@@ -4398,6 +4422,8 @@ static bool _handle_spell( monsters *monster, bolt & beem )
}
else
{
+ if (spell_needs_foe(spell_cast))
+ _make_mons_stop_fleeing(monster);
mons_cast(monster, beem, spell_cast);
mmov_x = 0;
mmov_y = 0;
@@ -6379,6 +6405,7 @@ static bool _plant_spit(monsters *monster, bolt &pbolt)
if (mons_should_fire(pbolt))
{
+ _make_mons_stop_fleeing(monster);
strcpy( spit_string, " spits" );
if (pbolt.target_x == you.x_pos && pbolt.target_y == you.y_pos)
strcat( spit_string, " at you" );
diff --git a/crawl-ref/source/mstuff2.cc b/crawl-ref/source/mstuff2.cc
index 22a97cae09..af6b149e34 100644
--- a/crawl-ref/source/mstuff2.cc
+++ b/crawl-ref/source/mstuff2.cc
@@ -493,7 +493,7 @@ static void _do_high_level_summon(monsters *monster, bool monsterNearby,
void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast)
{
- // always do setup. It might be done already, but it doesn't
+ // Always do setup. It might be done already, but it doesn't
// hurt to do it again (cheap).
setup_mons_cast(monster, pbolt, spell_cast);
@@ -511,7 +511,7 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast)
if (spell_cast == SPELL_HELLFIRE_BURST || spell_cast == SPELL_BRAIN_FEED
|| spell_cast == SPELL_SMITING)
- { // etc.
+ {
if (monster->foe == MHITYOU || monster->foe == MHITNOT)
{
if (monsterNearby)
@@ -574,9 +574,8 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast)
}
}
- create_monster(
- mgen_data( mons, SAME_ATTITUDE(monster), 5,
- monster->pos(), monster->foe ) );
+ create_monster( mgen_data( mons, SAME_ATTITUDE(monster), 5,
+ monster->pos(), monster->foe ) );
}
return;
@@ -588,9 +587,8 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast)
for (sumcount = 0; sumcount < sumcount2; sumcount++)
{
- create_monster(
- mgen_data( RANDOM_MONSTER, SAME_ATTITUDE(monster), 5,
- monster->pos(), monster->foe ) );
+ create_monster( mgen_data( RANDOM_MONSTER, SAME_ATTITUDE(monster),
+ 5, monster->pos(), monster->foe ) );
}
return;
@@ -621,11 +619,11 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast)
mons = summon_any_demon(DEMON_COMMON);
else
{
- int chance =
- std::max(6 - (monster->hit_dice / 5) + random2(2), 1);
+ int chance = std::max(6 - (monster->hit_dice / 5)
+ + random2(2), 1);
- mons = (one_chance_in(chance)) ?
- MONS_VERY_UGLY_THING : MONS_UGLY_THING;
+ mons = (one_chance_in(chance) ? MONS_VERY_UGLY_THING
+ : MONS_UGLY_THING);
}
create_monster(
@@ -668,9 +666,8 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast)
return;
case SPELL_SUMMON_BEAST: // Geryon
- create_monster(
- mgen_data(MONS_BEAST, SAME_ATTITUDE(monster), 4,
- monster->pos(), monster->foe));
+ create_monster( mgen_data(MONS_BEAST, SAME_ATTITUDE(monster), 4,
+ monster->pos(), monster->foe) );
return;
case SPELL_SUMMON_ICE_BEAST:
diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc
index 1e0d18f870..2b2baa873a 100644
--- a/crawl-ref/source/newgame.cc
+++ b/crawl-ref/source/newgame.cc
@@ -1204,14 +1204,14 @@ game_start:
}
-// ************ round-out character statistics and such ************
+// ************ Round-out character statistics and such. ************
_species_stat_init( you.species ); // must be down here {dlb}
you.is_undead = get_undead_state(you.species);
- // before we get into the inventory init, set light radius based
- // on species vision. currently, all species see out to 8 squares.
+ // Before we get into the inventory init, set light radius based
+ // on species vision. Currently, all species see out to 8 squares.
you.normal_vision = 8;
you.current_vision = 8;
@@ -1221,40 +1221,39 @@ game_start:
_assign_remaining_stats((you.species == SP_DEMIGOD ||
you.species == SP_DEMONSPAWN) ? 15 : 8);
- // this function depends on stats being finalized
- // returns false if Backspace on god/weapon/... selection
+ // This function depends on stats being finalized.
+ // Returns false if Backspace on god/weapon/... selection.
if (!_give_items_skills())
{
- // now choose again, name stays same
+ // Now choose again, name stays same.
const std::string old_name = you.your_name;
Options.prev_randpick = false;
- Options.prev_race = ng_race;
- Options.prev_cls = ng_cls;
- Options.prev_weapon = ng_weapon;
- // ck, dk, pr and book are asked last
- // --> don't need to be changed
+ Options.prev_race = ng_race;
+ Options.prev_cls = ng_cls;
+ Options.prev_weapon = ng_weapon;
+ // ck, dk, pr and book are asked last --> don't need to be changed
- // reset stats
+ // Reset stats.
_init_player();
Options.reset_startup_options();
- // Restore old name
+ // Restore old name.
strncpy(you.your_name, old_name.c_str(), kNameLen);
you.your_name[kNameLen - 1] = 0;
- // choose new character
+ // Choose new character.
goto game_start;
}
_give_species_bonus_hp();
_give_species_bonus_mp();
- // these need to be set above using functions!!! {dlb}
- you.max_dex = you.dex;
+ // XXX: these need to be set above using functions!!! {dlb}
+ you.max_dex = you.dex;
you.max_strength = you.strength;
- you.max_intel = you.intel;
+ you.max_intel = you.intel;
_give_starting_food();
_mark_starting_books();
@@ -1266,13 +1265,12 @@ game_start:
calc_total_skill_points();
for (int i = 0; i < ENDOFPACK; i++)
- {
if (is_valid_item(you.inv[i]))
{
- // Why is this here? Elsewhere it's only ever used for runes
+ // XXX: Why is this here? Elsewhere it's only ever used for runes.
you.inv[i].flags |= ISFLAG_BEEN_IN_INV;
- // identify all items in pack
+ // Identify all items in pack.
set_ident_type( you.inv[i].base_type,
you.inv[i].sub_type, ID_KNOWN_TYPE );
// link properly
@@ -1282,7 +1280,6 @@ game_start:
you.inv[i].slot = index_to_letter(you.inv[i].link);
item_colour( you.inv[i] ); // set correct special and colour
}
- }
// Apply autoinscribe rules to inventory.
request_autoinscribe();
@@ -1291,12 +1288,12 @@ game_start:
// Brand items as original equipment.
origin_set_inventory(origin_set_startequip);
- // we calculate hp and mp here; all relevant factors should be
- // finalized by now (GDL)
+ // We calculate hp and mp here; all relevant factors should be
+ // finalized by now. (GDL)
calc_hp();
calc_mp();
- // make sure the starting player is fully charged up
+ // Make sure the starting player is fully charged up.
set_hp( you.hp_max, false );
set_mp( you.max_magic_points, false );
@@ -2352,8 +2349,8 @@ static void _give_basic_mutations(species_type speci)
break;
}
- // starting mutations are unremoveable
- for ( int i = 0; i < NUM_MUTATIONS; ++i )
+ // Starting mutations are unremoveable.
+ for (int i = 0; i < NUM_MUTATIONS; ++i)
you.demon_pow[i] = you.mutation[i];
}
@@ -2488,8 +2485,8 @@ static void _opening_screen(void)
}
static void _show_name_prompt(int where, bool blankOK,
- const std::vector<player_save_info> &existing_chars,
- slider_menu &menu)
+ const std::vector<player_save_info> &existing_chars,
+ slider_menu &menu)
{
cgotoxy(1, where);
textcolor( CYAN );
@@ -2525,8 +2522,8 @@ static void _show_name_prompt(int where, bool blankOK,
static void _preprocess_character_name(char *name, bool blankOK)
{
- if (!*name && blankOK && Options.prev_name.length() &&
- Options.remember_name)
+ if (!*name && blankOK && Options.prev_name.length()
+ && Options.remember_name)
{
strncpy(name, Options.prev_name.c_str(), kNameLen);
name[kNameLen - 1] = 0;
@@ -2574,12 +2571,13 @@ static int newname_keyfilter(int &ch)
{
if (ch == CK_DOWN || ch == CK_PGDN || ch == '\t')
return -1;
+
return 1;
}
static bool _read_player_name( char *name, int len,
- const std::vector<player_save_info> &existing,
- slider_menu &menu)
+ const std::vector<player_save_info> &existing,
+ slider_menu &menu)
{
const int name_x = wherex(), name_y = wherey();
int (*keyfilter)(int &) = newname_keyfilter;
@@ -3108,7 +3106,7 @@ static void _create_wanderer( void )
_give_random_secondary_armour(5);
}
- // remove potion if good weapon is given:
+ // Remove potion if good weapon is given:
if (_give_wanderer_weapon( 0, wpn_skill ))
you.inv[3].quantity = 0;
}
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index ee24dc3615..21f45ae029 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -4003,7 +4003,7 @@ void display_char_status()
(ustealth < 220) ? "very " :
(ustealth < 300) ? "extremely " :
(ustealth < 400) ? "extraordinarily " :
- (ustealth < 520) ? "incredibly "
+ (ustealth < 520) ? "incredibly "
: "uncannily ");
#if DEBUG_DIAGNOSTICS
@@ -5776,8 +5776,8 @@ int player::damage_type(int)
{
return (get_vorpal_type(inv[wpn]));
}
- else if (equip[EQ_GLOVES] == -1 &&
- attribute[ATTR_TRANSFORMATION] == TRAN_BLADE_HANDS)
+ else if (equip[EQ_GLOVES] == -1
+ && attribute[ATTR_TRANSFORMATION] == TRAN_BLADE_HANDS)
{
return (DVORP_SLICING);
}
@@ -6619,16 +6619,16 @@ void PlaceInfo::make_global()
void PlaceInfo::assert_validity() const
{
// Check that level_type and branch match up
- ASSERT(is_global() ||
- (level_type == LEVEL_DUNGEON && branch >= BRANCH_MAIN_DUNGEON &&
- branch < NUM_BRANCHES) ||
- (level_type > LEVEL_DUNGEON && level_type < NUM_LEVEL_AREA_TYPES &&
- branch == -1));
+ ASSERT(is_global()
+ || level_type == LEVEL_DUNGEON && branch >= BRANCH_MAIN_DUNGEON
+ && branch < NUM_BRANCHES
+ || level_type > LEVEL_DUNGEON && level_type < NUM_LEVEL_AREA_TYPES
+ && branch == -1);
// Can't have visited a place without seeing any of its levels, and
// visa versa
- ASSERT((num_visits == 0 && levels_seen == 0) ||
- (num_visits > 0 && levels_seen > 0));
+ ASSERT(num_visits == 0 && levels_seen == 0
+ || num_visits > 0 && levels_seen > 0);
if (level_type == LEVEL_LABYRINTH || level_type == LEVEL_ABYSS)
ASSERT(num_visits == levels_seen);
@@ -6637,12 +6637,12 @@ void PlaceInfo::assert_validity() const
else if (level_type == LEVEL_DUNGEON && branches[branch].depth > 0)
ASSERT(levels_seen <= (unsigned long) branches[branch].depth);
- ASSERT(turns_total == (turns_explore + turns_travel + turns_interlevel +
- turns_resting + turns_other));
+ ASSERT(turns_total == (turns_explore + turns_travel + turns_interlevel
+ + turns_resting + turns_other));
- ASSERT(elapsed_total == (elapsed_explore + elapsed_travel +
- elapsed_interlevel + elapsed_resting +
- elapsed_other));
+ ASSERT(elapsed_total == (elapsed_explore + elapsed_travel
+ + elapsed_interlevel + elapsed_resting
+ + elapsed_other));
}
const std::string PlaceInfo::short_name() const
@@ -6759,9 +6759,9 @@ PlaceInfo& player::get_place_info(level_area_type level_type2) const
PlaceInfo& player::get_place_info(branch_type branch,
level_area_type level_type2) const
{
- ASSERT((level_type2 == LEVEL_DUNGEON && branch >= BRANCH_MAIN_DUNGEON &&
- branch < NUM_BRANCHES) ||
- (level_type2 > LEVEL_DUNGEON && level_type < NUM_LEVEL_AREA_TYPES));
+ ASSERT(level_type2 == LEVEL_DUNGEON && branch >= BRANCH_MAIN_DUNGEON
+ && branch < NUM_BRANCHES
+ || level_type2 > LEVEL_DUNGEON && level_type < NUM_LEVEL_AREA_TYPES);
if (level_type2 == LEVEL_DUNGEON)
return (PlaceInfo&) branch_info[branch];