Skip to content

Commit

Permalink
Move minimum skil level (otland#3721)
Browse files Browse the repository at this point in the history
  • Loading branch information
ramon-bernardo authored and Znote committed Jan 30, 2022
1 parent 61dacd4 commit bc7d862
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -506,8 +506,8 @@ void Player::removeSkillTries(skills_t skill, uint64_t count, bool notify/* = fa
while (count > skills[skill].tries) {
count -= skills[skill].tries;

if (skills[skill].level <= 10) {
skills[skill].level = 10;
if (skills[skill].level <= MINIMUM_SKILL_LEVEL) {
skills[skill].level = MINIMUM_SKILL_LEVEL;
skills[skill].tries = 0;
count = 0;
break;
Expand Down Expand Up @@ -2030,7 +2030,7 @@ void Player::death(Creature* lastHitCreature)
//Skill loss
for (uint8_t i = SKILL_FIRST; i <= SKILL_LAST; ++i) { //for each skill
uint64_t sumSkillTries = 0;
for (uint16_t c = 11; c <= skills[i].level; ++c) { //sum up all required tries for all skill levels
for (uint16_t c = MINIMUM_SKILL_LEVEL + 1; c <= skills[i].level; ++c) { //sum up all required tries for all skill levels
sumSkillTries += vocation->getReqSkillTries(i, c);
}

Expand Down
4 changes: 3 additions & 1 deletion src/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,11 @@ struct OutfitEntry {
uint8_t addons;
};

static constexpr int16_t MINIMUM_SKILL_LEVEL = 10;

struct Skill {
uint64_t tries = 0;
uint16_t level = 10;
uint16_t level = MINIMUM_SKILL_LEVEL;
uint8_t percent = 0;
};

Expand Down

0 comments on commit bc7d862

Please sign in to comment.