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-06-01 23:32:17 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-01 23:32:17 +0000
commit24be5339e3c697c6faf7038a7cbeddae0cf92314 (patch)
tree2c6c70307ecf9b9996737717fd4bfd852b6057e3 /crawl-ref/source
parenta6935bcfb6948bdb6d366cfecda141093b8163f3 (diff)
downloadcrawl-ref-24be5339e3c697c6faf7038a7cbeddae0cf92314.tar.gz
crawl-ref-24be5339e3c697c6faf7038a7cbeddae0cf92314.zip
Commit a few changes, mostly clean-up.
* Modify tile_show_items setting in tutorial to (hopefully) show corpses again. * Change skill_exp_needed to use the level input rather than decreasing the passed in parameter, esp. when it was mostly called in the form skill_exp_needed(x + 1) anyway. I was trying to find out what went wrong in BR 1929156 but I can't work out the formula. :( git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5421 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/abl-show.cc11
-rw-r--r--crawl-ref/source/debug.cc4
-rw-r--r--crawl-ref/source/effects.cc8
-rw-r--r--crawl-ref/source/mon-util.cc17
-rw-r--r--crawl-ref/source/monstuff.cc24
-rw-r--r--crawl-ref/source/newgame.cc8
-rw-r--r--crawl-ref/source/output.cc4
-rw-r--r--crawl-ref/source/religion.cc41
-rw-r--r--crawl-ref/source/skills.cc6
-rw-r--r--crawl-ref/source/skills2.cc45
-rw-r--r--crawl-ref/source/tutorial.cc6
11 files changed, 94 insertions, 80 deletions
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc
index b71a0e3b7b..8a94c634d5 100644
--- a/crawl-ref/source/abl-show.cc
+++ b/crawl-ref/source/abl-show.cc
@@ -827,7 +827,8 @@ bool activate_ability()
// * Permanent flying (Kenku) cannot be turned off.
if (you.species == SP_VAMPIRE && you.experience_level >= 3)
mpr("Sorry, you're too full to transform right now.");
- else if (you.species == SP_KENKU && you.experience_level >= 5)
+ else if (you.species == SP_KENKU && you.experience_level >= 5
+ || player_mutation_level(MUT_BIG_WINGS))
{
if (you.flight_mode() == FL_FLY)
mpr("You're already flying!");
@@ -1248,7 +1249,7 @@ static bool _do_ability(const ability_def& abil)
exercise( SK_EVOCATIONS, 1 );
break;
- // fly (kenku) -- eventually becomes permanent (see acr.cc)
+ // Fly (kenku) -- eventually becomes permanent (see acr.cc).
case ABIL_FLY:
cast_fly( you.experience_level * 4 );
@@ -2041,9 +2042,9 @@ std::vector<talent> your_talents( bool check_confused )
if (!player_is_airborne())
{
- // kenku can fly, but only from the ground
- // (until level 15, when it becomes permanent until revoked)
- //jmf: "upgrade" for draconians -- expensive flight
+ // Kenku can fly, but only from the ground
+ // (until level 15, when it becomes permanent until revoked).
+ // jmf: "upgrade" for draconians -- expensive flight
if (you.species == SP_KENKU && you.experience_level >= 5)
_add_talent(talents, ABIL_FLY, check_confused );
else if (player_genus(GENPC_DRACONIAN)
diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc
index 88f6540ab4..e2e369fd25 100644
--- a/crawl-ref/source/debug.cc
+++ b/crawl-ref/source/debug.cc
@@ -2116,7 +2116,7 @@ void debug_set_skills(void)
else
{
const int old_amount = you.skills[skill];
- const int points = (skill_exp_needed( amount + 1 )
+ const int points = (skill_exp_needed( amount )
* species_skills( skill, you.species )) / 100;
you.skill_points[skill] = points + 1;
@@ -2195,7 +2195,7 @@ void debug_set_all_skills(void)
continue;
}
- const int points = (skill_exp_needed( amount + 1 )
+ const int points = (skill_exp_needed( amount )
* species_skills( i, you.species )) / 100;
you.skill_points[i] = points + 1;
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index 2e9ca80f70..f172544727 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -2699,18 +2699,20 @@ void handle_time( long time_delta )
// off-level.
static void catchup_monster_moves(monsters *mon, int turns)
{
- // Summoned monsters might have disappeared
+ // Summoned monsters might have disappeared.
if (!mon->alive())
return;
- // Don't move non-land or stationary monsters around
+ // Don't move non-land or stationary monsters around.
if (mons_habitat( mon ) != HT_LAND
+ || mons_is_zombified( mon )
+ && mons_habitat_by_type(mon->base_monster) != HT_LAND
|| mons_is_stationary( mon ))
{
return;
}
- // Let sleeping monsters lie
+ // Let sleeping monsters lie.
if (mon->behaviour == BEH_SLEEP || mons_is_paralysed(mon))
return;
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 9bc7092d78..fb2527097f 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -2329,7 +2329,7 @@ bool ms_waste_of_time( const monsters *mon, spell_type monspell )
if (monspell == SPELL_SLEEP && (!foe || foe->asleep()))
return (true);
- // occasionally we don't estimate... just fire and see:
+ // Occasionally we don't estimate... just fire and see.
if (one_chance_in(5))
return (false);
@@ -4861,7 +4861,7 @@ void monsters::remove_enchantment_effect(const mon_enchant &me, bool quiet)
if (!quiet)
simple_monster_message(this, info);
- // reevaluate behaviour
+ // Reevaluate behaviour.
behaviour_event(this, ME_EVAL);
break;
@@ -4869,12 +4869,12 @@ void monsters::remove_enchantment_effect(const mon_enchant &me, bool quiet)
if (!quiet)
simple_monster_message(this, " seems less confused.");
- // reevaluate behaviour
+ // Reevaluate behaviour.
behaviour_event(this, ME_EVAL);
break;
case ENCH_INVIS:
- // invisible monsters stay invisible
+ // Invisible monsters stay invisible.
if (mons_class_flag(type, M_INVIS))
add_ench( mon_enchant(ENCH_INVIS) );
else if (mons_near(this) && !player_see_invis()
@@ -5074,9 +5074,9 @@ void monsters::timeout_enchantments(int levels)
{
case ENCH_POISON: case ENCH_ROT: case ENCH_BACKLIGHT:
case ENCH_STICKY_FLAME: case ENCH_ABJ: case ENCH_SHORT_LIVED:
- case ENCH_SLOW: case ENCH_HASTE: case ENCH_FEAR:
- case ENCH_INVIS: case ENCH_CHARM: case ENCH_SLEEP_WARY:
- case ENCH_SICK: case ENCH_SLEEPY: case ENCH_PARALYSIS:
+ case ENCH_SLOW: case ENCH_HASTE: case ENCH_FEAR:
+ case ENCH_INVIS: case ENCH_CHARM: case ENCH_SLEEP_WARY:
+ case ENCH_SICK: case ENCH_SLEEPY: case ENCH_PARALYSIS:
case ENCH_BATTLE_FRENZY: case ENCH_NEUTRAL:
lose_ench_levels(i->second, levels);
break;
@@ -5224,7 +5224,7 @@ void monsters::apply_enchantment(const mon_enchant &me)
int net = get_trapping_net(x,y,true);
- if (net == NON_ITEM) // really shouldn't happen!
+ if (net == NON_ITEM) // Really shouldn't happen!
{
del_ench(ENCH_HELD);
break;
@@ -5892,6 +5892,7 @@ void monsters::put_to_sleep(int)
{
if (has_ench(ENCH_BERSERK))
return;
+
behaviour = BEH_SLEEP;
add_ench(ENCH_SLEEPY);
add_ench(ENCH_SLEEP_WARY);
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index bb585e7730..bbff0afdd4 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -2032,7 +2032,7 @@ void behaviour_event( monsters *mon, int event, int src,
switch(event)
{
case ME_DISTURB:
- // assumes disturbed by noise...
+ // Assumes disturbed by noise...
if (mon->behaviour == BEH_SLEEP)
mon->behaviour = BEH_WANDER;
@@ -2479,7 +2479,7 @@ static void _handle_behaviour(monsters *mon)
break;
case BEH_SEEK:
- // no foe? then wander or seek the player
+ // No foe? Then wander or seek the player.
if (mon->foe == MHITNOT)
{
if (!proxPlayer || isNeutral || patrolling)
@@ -3122,7 +3122,7 @@ static void _handle_nearby_ability(monsters *monster)
// Okay then, don't speak.
if (monster_can_submerge(monster, grd[monster->x][monster->y])
- && !player_beheld_by(monster) // no submerging if player entranced
+ && !player_beheld_by(monster) // No submerging if player entranced.
&& (one_chance_in(5)
|| grid_distance( monster->x, monster->y,
you.x_pos, you.y_pos ) > 1
@@ -3149,13 +3149,14 @@ static void _handle_nearby_ability(monsters *monster)
{
case MONS_SPATIAL_VORTEX:
case MONS_KILLER_KLOWN:
- // used for colour (butterflies too, but they don't change)
+ // Choose random colour.
monster->colour = random_colour();
break;
case MONS_GIANT_EYEBALL:
if (coinflip() && !mons_friendly(monster)
- && monster->behaviour != BEH_WANDER)
+ && monster->behaviour != BEH_WANDER
+ && monster->behaviour != BEH_FLEE)
{
simple_monster_message(monster, " stares at you.");
@@ -3167,7 +3168,8 @@ static void _handle_nearby_ability(monsters *monster)
case MONS_EYE_OF_DRAINING:
if (coinflip() && !mons_friendly(monster)
- && monster->behaviour != BEH_WANDER)
+ && monster->behaviour != BEH_WANDER
+ && monster->behaviour != BEH_FLEE)
{
simple_monster_message(monster, " stares at you.");
@@ -3427,6 +3429,7 @@ static bool _handle_special_ability(monsters *monster, bolt & beem)
case 0:
if (!mons_friendly(monster))
{
+ _make_mons_stop_fleeing(monster);
spell_cast = SPELL_SYMBOL_OF_TORMENT;
mons_cast(monster, beem, spell_cast);
used = true;
@@ -3599,7 +3602,8 @@ static bool _handle_special_ability(monsters *monster, bolt & beem)
// 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
+ 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))
@@ -4782,7 +4786,7 @@ int mons_pick_best_missile(monsters *mons, item_def **launcher,
//---------------------------------------------------------------
static bool _handle_throw(monsters *monster, bolt & beem)
{
- // yes, there is a logic to this ordering {dlb}:
+ // Yes, there is a logic to this ordering {dlb}:
if (monster->incapacitated()
|| monster->asleep()
|| monster->submerged())
@@ -5658,9 +5662,9 @@ static bool _mons_can_displace(const monsters *mpusher, const monsters *mpushee)
// can't push. Note that sleeping monsters can't be pushed
// past, either, but they may be woken up by a crowd trying to
// elbow past them, and the wake-up check happens downstream.
- if (mons_is_confused(mpusher) || mons_is_confused(mpushee)
+ if (mons_is_confused(mpusher) || mons_is_confused(mpushee)
|| mons_is_paralysed(mpusher) || mons_is_paralysed(mpushee)
- || mons_is_sleeping(mpusher) || mons_is_stationary(mpusher)
+ || mons_is_sleeping(mpusher) || mons_is_stationary(mpusher)
|| mons_is_stationary(mpushee))
{
return (false);
diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc
index b65f2f774c..42a3623a76 100644
--- a/crawl-ref/source/newgame.cc
+++ b/crawl-ref/source/newgame.cc
@@ -939,8 +939,8 @@ static void _reassess_starting_skills()
if (!you.skills[i])
continue;
- // Grant the amount of skill points required for a human
- const int points = skill_exp_needed( you.skills[i] + 1 );
+ // Grant the amount of skill points required for a human.
+ const int points = skill_exp_needed( you.skills[i] );
you.skill_points[i] = (points * species_skills(i, SP_HUMAN))/100 + 1;
// Find out what level that earns this character.
@@ -949,7 +949,7 @@ static void _reassess_starting_skills()
for (int lvl = 1; lvl <= 8; lvl++)
{
- if (you.skill_points[i] > (skill_exp_needed(lvl+1) * sp_diff)/100)
+ if (you.skill_points[i] > (skill_exp_needed(lvl) * sp_diff)/100)
you.skills[i] = lvl;
else
break;
@@ -958,7 +958,7 @@ static void _reassess_starting_skills()
// Spellcasters should always have Spellcasting skill.
if ( i == SK_SPELLCASTING && you.skills[i] == 0 )
{
- you.skill_points[i] = (skill_exp_needed(2) * sp_diff) / 100;
+ you.skill_points[i] = (skill_exp_needed(1) * sp_diff) / 100;
you.skills[i] = 1;
}
}
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index 3fa6ba109f..216aad8293 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -941,12 +941,12 @@ void redraw_skill(const std::string &your_name, const std::string &class_name)
const unsigned int WIDTH = crawl_view.hudsz.x;
if (in_len > WIDTH)
{
- in_len -= 3; // what we're getting back from removing "the"
+ in_len -= 3; // What we're getting back from removing "the".
const unsigned int name_len = your_name.length();
std::string trimmed_name = your_name;
- // squeeze name if required, the "- 8" is to not squeeze too much
+ // Squeeze name if required, the "- 8" is to not squeeze too much.
if (in_len > WIDTH && (name_len - 8) > (in_len - WIDTH))
{
trimmed_name =
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index ff9d1c5a8b..53ed6dcd91 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -418,41 +418,36 @@ god_conduct_trigger::~god_conduct_trigger()
bool is_evil_god(god_type god)
{
- return
- god == GOD_KIKUBAAQUDGHA ||
- god == GOD_MAKHLEB ||
- god == GOD_YREDELEMNUL ||
- god == GOD_BEOGH ||
- god == GOD_LUGONU;
+ return (god == GOD_KIKUBAAQUDGHA
+ || god == GOD_MAKHLEB
+ || god == GOD_YREDELEMNUL
+ || god == GOD_BEOGH
+ || god == GOD_LUGONU);
}
bool is_good_god(god_type god)
{
- return
- god == GOD_ZIN ||
- god == GOD_SHINING_ONE ||
- god == GOD_ELYVILON;
+ return (god == GOD_ZIN
+ || god == GOD_SHINING_ONE
+ || god == GOD_ELYVILON);
}
bool is_chaotic_god(god_type god)
{
- return
- god == GOD_XOM ||
- god == GOD_MAKHLEB;
+ return (god == GOD_XOM
+ || god == GOD_MAKHLEB);
}
bool is_lawful_god(god_type god)
{
- return
- god == GOD_ZIN;
+ return (god == GOD_ZIN);
}
bool is_priest_god(god_type god)
{
- return
- god == GOD_ZIN ||
- god == GOD_YREDELEMNUL ||
- god == GOD_BEOGH;
+ return (god == GOD_ZIN
+ || god == GOD_YREDELEMNUL
+ || god == GOD_BEOGH);
}
void dec_penance(god_type god, int val)
@@ -468,14 +463,14 @@ void dec_penance(god_type god, int val)
take_note(Note(NOTE_MOLLIFY_GOD, god));
you.penance[god] = 0;
- // TSO's halo is once more available
+ // TSO's halo is once more available.
if (god == GOD_SHINING_ONE && you.religion == GOD_SHINING_ONE
&& you.piety >= piety_breakpoint(0))
{
mpr("Your divine halo returns!");
}
- // orcish bonuses are now once more effective
+ // Orcish bonuses are now once more effective.
if (god == GOD_BEOGH && you.religion == GOD_BEOGH)
you.redraw_armour_class = true;
@@ -487,12 +482,12 @@ void dec_penance(god_type god, int val)
else
you.penance[god] -= val;
}
-} // end dec_penance()
+}
void dec_penance(int val)
{
dec_penance(you.religion, val);
-} // end dec_penance()
+}
bool beogh_water_walk()
{
diff --git a/crawl-ref/source/skills.cc b/crawl-ref/source/skills.cc
index 8aa0ba2b82..bc696f93d8 100644
--- a/crawl-ref/source/skills.cc
+++ b/crawl-ref/source/skills.cc
@@ -89,15 +89,11 @@ void calc_total_skill_points( void )
you.total_skill_points = 0;
for (i = 0; i < NUM_SKILLS; i++)
- {
you.total_skill_points += you.skill_points[i];
- }
for (i = 1; i <= 27; i++)
- {
if (you.total_skill_points < skill_cost_needed(i))
break;
- }
you.skill_cost_level = i - 1;
@@ -403,7 +399,7 @@ static int _exercise2( int exsk )
*/
if (you.skill_points[exsk] >
- (skill_exp_needed(you.skills[exsk] + 2)
+ (skill_exp_needed(you.skills[exsk] + 1)
* species_skills(exsk, you.species) / 100))
{
diff --git a/crawl-ref/source/skills2.cc b/crawl-ref/source/skills2.cc
index baf2d7f8d5..c5ba46e013 100644
--- a/crawl-ref/source/skills2.cc
+++ b/crawl-ref/source/skills2.cc
@@ -1786,22 +1786,26 @@ static void _display_skill_table(bool show_aptitudes)
if (you.skills[x] < 27)
{
- const int needed = skill_exp_needed(you.skills[x] + 2);
- const int prev_needed = skill_exp_needed(you.skills[x] + 1);
- int spec_abil = species_skills(x, you.species);
-
- int percent_done = ((you.skill_points[x] -
- (prev_needed * spec_abil) / 100) * 100) /
- (((needed - prev_needed) * spec_abil) / 100);
-
- if (percent_done == 100)
- --percent_done;
- if (percent_done == 0)
- ++percent_done;
+ const int needed = skill_exp_needed(you.skills[x] + 1);
+ const int prev_needed = skill_exp_needed(you.skills[x]);
+ int spec_abil = species_skills(x, you.species);
if (!show_aptitudes)
{
+ int percent_done = ((you.skill_points[x] -
+ (prev_needed * spec_abil) / 100) * 100) /
+ (((needed - prev_needed) * spec_abil) / 100);
+
+ // But wouldn't that put us way into the next level?
+ // Shouldn't it be 0 then, or maybe the difference?
+ if (percent_done >= 100)
+ percent_done = 99;
+
+ if (percent_done <= 0)
+ percent_done = 1; // This'll just be turned to 0 anyway.
+
textcolor(CYAN);
+ // Round down by 5 digits.
cprintf( " (%2d%%)", (percent_done / 5) * 5 );
}
else
@@ -2241,7 +2245,6 @@ int calc_mp(bool real_mp)
unsigned int skill_exp_needed(int lev)
{
- lev--;
switch (lev)
{
case 0: return 0;
@@ -2270,18 +2273,18 @@ int species_skills(int skill, species_type species)
void wield_warning(bool newWeapon)
{
- // early out - no weapon
+ // Early out - no weapon.
if (!you.weapon())
return;
const item_def& wep = *you.weapon();
- // early out - don't warn for non-weapons or launchers
+ // Early out - don't warn for non-weapons or launchers.
if (wep.base_type != OBJ_WEAPONS || is_range_weapon(wep))
return;
- // don't warn if the weapon is OK, of course
- if ( effective_stat_bonus() > -4 )
+ // Don't warn if the weapon is OK, of course.
+ if (effective_stat_bonus() > -4)
return;
std::string msg = (newWeapon ? "this " : "your ") + wep.name(DESC_BASENAME);
@@ -2290,19 +2293,27 @@ void wield_warning(bool newWeapon)
if (you.strength < you.dex)
{
if (you.strength < 11)
+ {
mprf(MSGCH_WARN, "You have %strouble swinging %s.",
(you.strength < 7) ? "" : "a little ", mstr);
+ }
else
+ {
mprf(MSGCH_WARN, "You'd be more effective with "
"%s if you were stronger.", mstr);
+ }
}
else
{
if (you.dex < 11)
+ {
mprf(MSGCH_WARN, "Wielding %s is %s awkward.",
mstr, (you.dex < 7) ? "fairly" : "a little" );
+ }
else
+ {
mprf(MSGCH_WARN, "You'd be more effective with "
"%s if you were nimbler.", mstr);
+ }
}
}
diff --git a/crawl-ref/source/tutorial.cc b/crawl-ref/source/tutorial.cc
index a182e2bb0e..bf4a0299ab 100644
--- a/crawl-ref/source/tutorial.cc
+++ b/crawl-ref/source/tutorial.cc
@@ -99,7 +99,11 @@ void init_tutorial_options()
#ifdef USE_TILE
// Show all items in inventory.
- strncpy(Options.tile_show_items, "!?/%=([)X}+\\_.", 18);
+ // FIXME: Ideally, we'd use the user-specified order, and push all
+ // missing item types at the end of it, NetHack like.
+ // Unfortunately I can't think of a remotely non-hacky way
+ // to do this.
+ strncpy(Options.tile_show_items, "!?/%=([)x}+\\_", 18);
#endif
}