Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #73 from rootslinux/balancing

Fixed a bug where new skill notifications were not being printed to the ...
  • Loading branch information...
commit 5f8ef82539fd0efdb318c35954f89a67b7c150e3 2 parents 2db5081 + d45d305
@Bertram25 authored
View
12 dat/actors/enemies.lua
@@ -54,10 +54,10 @@ enemies[1] = {
base_stats = {
hit_points = 55,
skill_points = 0,
- strength = 15,
+ strength = 11,
vigor = 0,
- fortitude = 4, -- base defense
- protection = 1, -- armor defense
+ fortitude = 4,
+ protection = 1,
agility = 20,
evade = 2.0,
experience_points = 8,
@@ -101,7 +101,7 @@ enemies[2] = {
base_stats = {
hit_points = 65,
skill_points = 0,
- strength = 18,
+ strength = 14,
vigor = 0,
fortitude = 5,
protection = 4,
@@ -152,9 +152,9 @@ enemies[3] = {
hit_points = 160,
skill_points = 10,
experience_points = 120,
- strength = 27,
+ strength = 20,
vigor = 14,
- fortitude = 10,
+ fortitude = 6,
protection = 6,
agility = 40,
evade = 4.0,
View
6 src/common/global/global_actors.cpp
@@ -1019,10 +1019,10 @@ void GlobalCharacter::AddNewSkillLearned(uint32 skill_id)
std::map<uint32, GlobalSkill *>::iterator skill = _skills.find(skill_id);
if(skill == _skills.end()) {
IF_PRINT_WARNING(GLOBAL_DEBUG) << "failed because the new skill was not added successfully: " << skill_id << std::endl;
+ return;
}
- else {
- _new_skills_learned.push_back(skill->second);
- }
+
+ _new_skills_learned.push_back(skill->second);
}
View
37 src/modes/battle/battle_finish.cpp
@@ -88,9 +88,29 @@ CharacterGrowth::CharacterGrowth(GlobalCharacter* ch) :
void CharacterGrowth::UpdateGrowthData() {
- do {
- if (_character->ReachedNewExperienceLevel() == true) {
- ++_experience_levels_gained;
+ bool remaining_growth = true;
+ bool level_gained = false;
+
+ // The logic required to update this data can be a bit tricky. We have to retrieve all of the stat growth
+ // prior to calling AcknowledgeGrowth() because that call will reset the stat data. However, the list of
+ // new skills learned is not available until after calling AcknowledgeGrowth to process the new level gained
+ // (if any). And of course multiple AcknowledgeGrowth() calls may have to be made. The structure of the loop
+ // below addresses all of these cases.
+ while (remaining_growth == true) {
+ hit_points += _character->GetHitPointsGrowth();
+ skill_points += _character->GetSkillPointsGrowth();
+ strength += _character->GetStrengthGrowth();
+ vigor += _character->GetVigorGrowth();
+ fortitude += _character->GetFortitudeGrowth();
+ protection += _character->GetProtectionGrowth();
+ agility += _character->GetAgilityGrowth();
+ evade += _character->GetEvadeGrowth();
+
+ level_gained = _character->ReachedNewExperienceLevel();
+ remaining_growth = _character->AcknowledgeGrowth();
+
+ if (level_gained == true) {
+ _experience_levels_gained++;
AudioManager->PlaySound("snd/levelup.wav");
// New skills are only found in growth data when the character has reached a new level
@@ -101,16 +121,7 @@ void CharacterGrowth::UpdateGrowthData() {
skills_learned.push_back(skills->at(i));
}
}
-
- hit_points += _character->GetHitPointsGrowth();
- skill_points += _character->GetSkillPointsGrowth();
- strength += _character->GetStrengthGrowth();
- vigor += _character->GetVigorGrowth();
- fortitude += _character->GetFortitudeGrowth();
- protection += _character->GetProtectionGrowth();
- agility += _character->GetAgilityGrowth();
- evade += _character->GetEvadeGrowth();
- } while (_character->AcknowledgeGrowth() == true);
+ }
}
////////////////////////////////////////////////////////////////////////////////
Please sign in to comment.
Something went wrong with that request. Please try again.