diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-01 23:32:17 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-01 23:32:17 +0000 |
commit | 24be5339e3c697c6faf7038a7cbeddae0cf92314 (patch) | |
tree | 2c6c70307ecf9b9996737717fd4bfd852b6057e3 /crawl-ref/source/skills2.cc | |
parent | a6935bcfb6948bdb6d366cfecda141093b8163f3 (diff) | |
download | crawl-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/skills2.cc')
-rw-r--r-- | crawl-ref/source/skills2.cc | 45 |
1 files changed, 28 insertions, 17 deletions
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); + } } } |