diff options
author | Nicholas Feinberg <pleasingfung@gmail.com> | 2014-07-12 20:16:45 -0700 |
---|---|---|
committer | Nicholas Feinberg <pleasingfung@gmail.com> | 2014-07-13 00:33:57 -0700 |
commit | 9b6b733bccd0de2af35eb6c28e94e4708a92004d (patch) | |
tree | 30400b1991c700b09fff5dc4644dc43a2c693121 /crawl-ref/source/fight.cc | |
parent | 3663d864c83a72c7cf624617e9a9a5b8b5deaf6a (diff) | |
download | crawl-ref-9b6b733bccd0de2af35eb6c28e94e4708a92004d.tar.gz crawl-ref-9b6b733bccd0de2af35eb6c28e94e4708a92004d.zip |
Refactor weapon_skill()
This function was misleadingly named (it only provided the skill
used for melee weapons, not ranged weapons), and incomplete;
code along the lines of "is_ranged_weapon(*it) ? range_skill(*it)
: weapon_skill(*it)" was scattered in about half a dozen different
functions. I've corrected both of those problems (renaming weapon_
skill() to melee_skill() and adding item_weapon_skill()), and also
possibly fixed two bugs in the process - an l_you.cc function that
claimed to provide the skill used for the starting weapon (but
actually only gave the melee skill), and unrand creation code that
checked if a potential unrand swap used the same (melee) skill as
the weapon type being generated.
Diffstat (limited to 'crawl-ref/source/fight.cc')
-rw-r--r-- | crawl-ref/source/fight.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index e097d1b4ae..71bb9c3a25 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -591,7 +591,7 @@ bool wielded_weapon_check(item_def *weapon, bool no_message) const int weap = you.attribute[ATTR_WEAPON_SWAP_INTERRUPTED] - 1; const item_def &wpn = you.inv[weap]; if (is_melee_weapon(wpn) - && you.skill(weapon_skill(wpn)) > you.skill(SK_UNARMED_COMBAT)) + && you.skill(melee_skill(wpn)) > you.skill(SK_UNARMED_COMBAT)) { unarmed_warning = true; } @@ -705,7 +705,7 @@ int weapon_min_delay(const item_def &weapon) int min_delay = base/2; // Short blades can get up to at least unarmed speed. - if (weapon_skill(weapon) == SK_SHORT_BLADES && min_delay > 5) + if (melee_skill(weapon) == SK_SHORT_BLADES && min_delay > 5) min_delay = 5; // All weapons have min delay 7 or better |