Просмотр исходного кода

Fix commanders requirements for special skills to match WoG

Dydzio 2 лет назад
Родитель
Сommit
56c969be4f

+ 10 - 10
client/windows/CCreatureWindow.cpp

@@ -96,14 +96,14 @@ private:
 
 };
 
-CCommanderSkillIcon::CCommanderSkillIcon(std::shared_ptr<CIntObject> object_, bool isGrandmasterAbility_, std::function<void()> callback)
+CCommanderSkillIcon::CCommanderSkillIcon(std::shared_ptr<CIntObject> object_, bool isMasterAbility_, std::function<void()> callback)
 	: object(),
-	isGrandmasterAbility(isGrandmasterAbility_),
-	isSelected(false),
-	callback(callback)
+	  isMasterAbility(isMasterAbility_),
+	  isSelected(false),
+	  callback(callback)
 {
 	pos = object_->pos;
-	this->isGrandmasterAbility = isGrandmasterAbility_;
+	this->isMasterAbility = isMasterAbility_;
 	setObject(object_);
 }
 
@@ -128,16 +128,16 @@ void CCommanderSkillIcon::deselect()
 	isSelected = false;
 }
 
-bool CCommanderSkillIcon::getIsGrandmasterAbility()
+bool CCommanderSkillIcon::getIsMasterAbility()
 {
-	return isGrandmasterAbility;
+	return isMasterAbility;
 }
 
 void CCommanderSkillIcon::show(Canvas &to)
 {
 	CIntObject::show(to);
 
-	if(isGrandmasterAbility && isSelected)
+	if(isMasterAbility && isSelected)
 		to.drawBorder(pos, Colors::YELLOW, 2);
 }
 
@@ -921,7 +921,7 @@ void CStackWindow::setSelection(si32 newSkill, std::shared_ptr<CCommanderSkillIc
 
 	if(selectedIcon)
 	{
-		if(!selectedIcon->getIsGrandmasterAbility()) //unlike WoG, in VCMI grandmaster skill descriptions are taken from bonus descriptions
+		if(!selectedIcon->getIsMasterAbility()) //unlike WoG, in VCMI master skill descriptions are taken from bonus descriptions
 		{
 			selectedIcon->text = getSkillDescription(oldSelection, false); //update previously selected icon's message to existing skill level
 		}
@@ -932,7 +932,7 @@ void CStackWindow::setSelection(si32 newSkill, std::shared_ptr<CCommanderSkillIc
 	if(newSkill < 100)
 	{
 		newIcon->setObject(std::make_shared<CPicture>(getSkillImage(newSkill)));
-		if(!newIcon->getIsGrandmasterAbility())
+		if(!newIcon->getIsMasterAbility())
 		{
 			newIcon->text = getSkillDescription(newSkill, true); //update currently selected icon's message to show upgrade description
 		}

+ 4 - 4
client/windows/CCreatureWindow.h

@@ -32,10 +32,10 @@ class CCommanderArtPlace;
 class CCommanderSkillIcon : public LRClickableAreaWText //TODO: maybe bring commander skill button initialization logic inside?
 {
 	std::shared_ptr<CIntObject> object; // passive object that will be used to determine clickable area
-	bool isGrandmasterAbility; // refers to WoG abilities obtainable via combining grandmaster skills (for example attack + speed unlocks shoot)
-	bool isSelected; // used only for programatically created border around selected "grandmaster abilities"
+	bool isMasterAbility; // refers to WoG abilities obtainable via combining master skills (for example attack + speed unlocks shoot)
+	bool isSelected; // used only for programatically created border around selected "master abilities"
 public:
-	CCommanderSkillIcon(std::shared_ptr<CIntObject> object_, bool isGrandmasterAbility, std::function<void()> callback);
+	CCommanderSkillIcon(std::shared_ptr<CIntObject> object_, bool isMasterAbility_, std::function<void()> callback);
 
 	std::function<void()> callback;
 
@@ -43,7 +43,7 @@ public:
 
 	void setObject(std::shared_ptr<CIntObject> object);
 	void deselect(); //TODO: consider using observer pattern instead?
-	bool getIsGrandmasterAbility();
+	bool getIsMasterAbility();
 
 	void show(Canvas &to) override;
 };

+ 2 - 2
lib/CCreatureSet.h

@@ -139,7 +139,7 @@ public:
 	ui8 level; //required only to count callbacks
 	std::string name; // each Commander has different name
 	std::vector <ui8> secondarySkills; //ID -> level
-	std::set <ui8> specialSKills;
+	std::set <ui8> specialSkills;
 	//std::vector <CArtifactInstance *> arts;
 	void init() override;
 	CCommanderInstance();
@@ -161,7 +161,7 @@ public:
 		h & level;
 		h & name;
 		h & secondarySkills;
-		h & specialSKills;
+		h & specialSkills;
 	}
 };
 

+ 1 - 1
lib/NetPacksLib.cpp

@@ -803,7 +803,7 @@ void SetCommanderProperty::applyGs(CGameState *gs)
 			break;
 		case SPECIAL_SKILL:
 			commander->accumulateBonus (std::make_shared<Bonus>(accumulatedBonus));
-			commander->specialSKills.insert (additionalInfo);
+			commander->specialSkills.insert (additionalInfo);
 			break;
 		case SECONDARY_SKILL:
 			commander->secondarySkills[additionalInfo] = static_cast<ui8>(amount);

+ 3 - 3
server/CGameHandler.cpp

@@ -468,9 +468,9 @@ void CGameHandler::levelUpCommander(const CCommanderInstance * c)
 	int i = 100;
 	for (auto specialSkill : VLC->creh->skillRequirements)
 	{
-		if (c->secondarySkills.at(specialSkill.second.first) == ECommander::MAX_SKILL_LEVEL
-			&&  c->secondarySkills.at(specialSkill.second.second) == ECommander::MAX_SKILL_LEVEL
-			&&  !vstd::contains (c->specialSKills, i))
+		if (c->secondarySkills.at(specialSkill.second.first) == ECommander::MAX_SKILL_LEVEL - 1
+			&&  c->secondarySkills.at(specialSkill.second.second) == ECommander::MAX_SKILL_LEVEL - 1
+			&&  !vstd::contains (c->specialSkills, i))
 			clu.skills.push_back (i);
 		++i;
 	}