mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-29 23:07:48 +02:00
Support for special upgrades (like Gelu).
This commit is contained in:
@@ -155,10 +155,10 @@
|
|||||||
144 12 2 0 0
|
144 12 2 0 0
|
||||||
145 11 14 0 0
|
145 11 14 0 0
|
||||||
146 1 0 0 4
|
146 1 0 0 4
|
||||||
147 9 8 0 136
|
147 9 0 8 136
|
||||||
147 9 34 0 136
|
147 9 0 34 136
|
||||||
148 9 2 0 137
|
148 9 0 2 137
|
||||||
148 9 18 0 137
|
148 9 0 18 137
|
||||||
149 4 5 1 96
|
149 4 5 1 96
|
||||||
149 4 5 2 96
|
149 4 5 2 96
|
||||||
149 4 10 3 96
|
149 4 10 3 96
|
||||||
|
|||||||
@@ -1085,13 +1085,15 @@ void CGHeroInstance::initObj()
|
|||||||
{
|
{
|
||||||
std::vector<CCreature*>* creatures = &VLC->creh->creatures;
|
std::vector<CCreature*>* creatures = &VLC->creh->creatures;
|
||||||
bonus.type = Bonus::SPECIAL_UPGRADE;
|
bonus.type = Bonus::SPECIAL_UPGRADE;
|
||||||
bonus.additionalInfo = it->additionalinfo;
|
bonus.subtype = it->subtype; //base id
|
||||||
|
bonus.additionalInfo = it->additionalinfo; //target id
|
||||||
speciality.bonuses.push_back (bonus);
|
speciality.bonuses.push_back (bonus);
|
||||||
for (std::set<ui32>::iterator i = (*creatures)[it->val]->upgrades.begin();
|
|
||||||
i != (*creatures)[it->val]->upgrades.end(); i++)
|
for (std::set<ui32>::iterator i = (*creatures)[it->subtype]->upgrades.begin();
|
||||||
|
i != (*creatures)[it->subtype]->upgrades.end(); i++)
|
||||||
{
|
{
|
||||||
bonus.val = *i;
|
bonus.subtype = *i; //propagate for regular upgrades of base creature
|
||||||
speciality.bonuses.push_back (bonus); //propagate for regular upgrades of base creature
|
speciality.bonuses.push_back (bonus);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1746,8 +1746,19 @@ UpgradeInfo CGameState::getUpgradeInfo(const CStackInstance &stack)
|
|||||||
if(stack.armyObj->ID == TOWNI_TYPE)
|
if(stack.armyObj->ID == TOWNI_TYPE)
|
||||||
t = static_cast<const CGTownInstance *>(stack.armyObj);
|
t = static_cast<const CGTownInstance *>(stack.armyObj);
|
||||||
else if(h)
|
else if(h)
|
||||||
|
{ //TODO: check if hero specialty makes some upgrades possible
|
||||||
|
BonusList lista = h->speciality.getBonuses(Selector::typeSybtype(Bonus::SPECIAL_UPGRADE, base->idNumber));
|
||||||
|
for (BonusList::iterator it = lista.begin(); it != lista.end(); it++)
|
||||||
|
{
|
||||||
|
ui16 nid = it->additionalInfo;
|
||||||
|
if (nid != base->idNumber) //sharpshooter appears to be default upgrade of minor creatures (?)
|
||||||
|
{
|
||||||
|
ret.newID.push_back(nid);
|
||||||
|
ret.cost.push_back(costDiff(VLC->creh->creatures[nid]->cost, base->cost));
|
||||||
|
}
|
||||||
|
}
|
||||||
t = h->visitedTown;
|
t = h->visitedTown;
|
||||||
|
}
|
||||||
if(t)
|
if(t)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(si32 bid, t->builtBuildings)
|
BOOST_FOREACH(si32 bid, t->builtBuildings)
|
||||||
@@ -1777,8 +1788,6 @@ UpgradeInfo CGameState::getUpgradeInfo(const CStackInstance &stack)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: check if hero specialty makes some upgrades possible
|
|
||||||
|
|
||||||
if(ret.newID.size())
|
if(ret.newID.size())
|
||||||
ret.oldID = base->idNumber;
|
ret.oldID = base->idNumber;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user