mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-15 00:05:02 +02:00
Fix commanders requirements for special skills to match WoG
This commit is contained in:
@ -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(),
|
: object(),
|
||||||
isGrandmasterAbility(isGrandmasterAbility_),
|
isMasterAbility(isMasterAbility_),
|
||||||
isSelected(false),
|
isSelected(false),
|
||||||
callback(callback)
|
callback(callback)
|
||||||
{
|
{
|
||||||
pos = object_->pos;
|
pos = object_->pos;
|
||||||
this->isGrandmasterAbility = isGrandmasterAbility_;
|
this->isMasterAbility = isMasterAbility_;
|
||||||
setObject(object_);
|
setObject(object_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,16 +128,16 @@ void CCommanderSkillIcon::deselect()
|
|||||||
isSelected = false;
|
isSelected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CCommanderSkillIcon::getIsGrandmasterAbility()
|
bool CCommanderSkillIcon::getIsMasterAbility()
|
||||||
{
|
{
|
||||||
return isGrandmasterAbility;
|
return isMasterAbility;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCommanderSkillIcon::show(Canvas &to)
|
void CCommanderSkillIcon::show(Canvas &to)
|
||||||
{
|
{
|
||||||
CIntObject::show(to);
|
CIntObject::show(to);
|
||||||
|
|
||||||
if(isGrandmasterAbility && isSelected)
|
if(isMasterAbility && isSelected)
|
||||||
to.drawBorder(pos, Colors::YELLOW, 2);
|
to.drawBorder(pos, Colors::YELLOW, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -921,7 +921,7 @@ void CStackWindow::setSelection(si32 newSkill, std::shared_ptr<CCommanderSkillIc
|
|||||||
|
|
||||||
if(selectedIcon)
|
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
|
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)
|
if(newSkill < 100)
|
||||||
{
|
{
|
||||||
newIcon->setObject(std::make_shared<CPicture>(getSkillImage(newSkill)));
|
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
|
newIcon->text = getSkillDescription(newSkill, true); //update currently selected icon's message to show upgrade description
|
||||||
}
|
}
|
||||||
|
@ -32,10 +32,10 @@ class CCommanderArtPlace;
|
|||||||
class CCommanderSkillIcon : public LRClickableAreaWText //TODO: maybe bring commander skill button initialization logic inside?
|
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
|
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 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 "grandmaster abilities"
|
bool isSelected; // used only for programatically created border around selected "master abilities"
|
||||||
public:
|
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;
|
std::function<void()> callback;
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ public:
|
|||||||
|
|
||||||
void setObject(std::shared_ptr<CIntObject> object);
|
void setObject(std::shared_ptr<CIntObject> object);
|
||||||
void deselect(); //TODO: consider using observer pattern instead?
|
void deselect(); //TODO: consider using observer pattern instead?
|
||||||
bool getIsGrandmasterAbility();
|
bool getIsMasterAbility();
|
||||||
|
|
||||||
void show(Canvas &to) override;
|
void show(Canvas &to) override;
|
||||||
};
|
};
|
||||||
|
@ -139,7 +139,7 @@ public:
|
|||||||
ui8 level; //required only to count callbacks
|
ui8 level; //required only to count callbacks
|
||||||
std::string name; // each Commander has different name
|
std::string name; // each Commander has different name
|
||||||
std::vector <ui8> secondarySkills; //ID -> level
|
std::vector <ui8> secondarySkills; //ID -> level
|
||||||
std::set <ui8> specialSKills;
|
std::set <ui8> specialSkills;
|
||||||
//std::vector <CArtifactInstance *> arts;
|
//std::vector <CArtifactInstance *> arts;
|
||||||
void init() override;
|
void init() override;
|
||||||
CCommanderInstance();
|
CCommanderInstance();
|
||||||
@ -161,7 +161,7 @@ public:
|
|||||||
h & level;
|
h & level;
|
||||||
h & name;
|
h & name;
|
||||||
h & secondarySkills;
|
h & secondarySkills;
|
||||||
h & specialSKills;
|
h & specialSkills;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -803,7 +803,7 @@ void SetCommanderProperty::applyGs(CGameState *gs)
|
|||||||
break;
|
break;
|
||||||
case SPECIAL_SKILL:
|
case SPECIAL_SKILL:
|
||||||
commander->accumulateBonus (std::make_shared<Bonus>(accumulatedBonus));
|
commander->accumulateBonus (std::make_shared<Bonus>(accumulatedBonus));
|
||||||
commander->specialSKills.insert (additionalInfo);
|
commander->specialSkills.insert (additionalInfo);
|
||||||
break;
|
break;
|
||||||
case SECONDARY_SKILL:
|
case SECONDARY_SKILL:
|
||||||
commander->secondarySkills[additionalInfo] = static_cast<ui8>(amount);
|
commander->secondarySkills[additionalInfo] = static_cast<ui8>(amount);
|
||||||
|
@ -468,9 +468,9 @@ void CGameHandler::levelUpCommander(const CCommanderInstance * c)
|
|||||||
int i = 100;
|
int i = 100;
|
||||||
for (auto specialSkill : VLC->creh->skillRequirements)
|
for (auto specialSkill : VLC->creh->skillRequirements)
|
||||||
{
|
{
|
||||||
if (c->secondarySkills.at(specialSkill.second.first) == ECommander::MAX_SKILL_LEVEL
|
if (c->secondarySkills.at(specialSkill.second.first) == ECommander::MAX_SKILL_LEVEL - 1
|
||||||
&& c->secondarySkills.at(specialSkill.second.second) == ECommander::MAX_SKILL_LEVEL
|
&& c->secondarySkills.at(specialSkill.second.second) == ECommander::MAX_SKILL_LEVEL - 1
|
||||||
&& !vstd::contains (c->specialSKills, i))
|
&& !vstd::contains (c->specialSkills, i))
|
||||||
clu.skills.push_back (i);
|
clu.skills.push_back (i);
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user