1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

More fixes for weeks & growths.

This commit is contained in:
DjWarmonger 2010-10-02 09:43:22 +00:00
parent 02d7fa35b7
commit 2c43707661
5 changed files with 10 additions and 9 deletions

View File

@ -1161,7 +1161,8 @@ void CCastleInterface::CCreaInfo::clickRight(tribool down, bool previousState)
summ * CGI->creh->creatures[crid]->valOfBonuses(Bonus::CREATURE_GROWTH_PERCENT)/100);
summ+=AddToString(CGI->generaltexth->artifNames[133] + " %+d",descr,
summ * ci->town->valOfGlobalBonuses(Bonus::CREATURE_GROWTH_PERCENT, -1)/100); //Statue of Legion
summ * ci->town->valOfGlobalBonuses
(Selector::type(Bonus::CREATURE_GROWTH_PERCENT) && Selector::sourceType(Bonus::ARTIFACT))/100); //Statue of Legion
if(ci->town->town->hordeLvl[0]==level)//horde, x to summ
if((bld.find(18)!=bld.end()) || (bld.find(19)!=bld.end()))

View File

@ -1949,7 +1949,8 @@ int CGTownInstance::creatureGrowth(const int & level) const
ret *= (1 + VLC->creh->creatures[creid]->valOfBonuses(Bonus::CREATURE_GROWTH_PERCENT)/100); // double growth or plague
if(tempOwner != NEUTRAL_PLAYER)
{
ret *= (100.0f + cb->gameState()->players[tempOwner].valOfBonuses(Bonus::CREATURE_GROWTH_PERCENT))/100; //Statue of Legion
ret *= (100.0f + cb->gameState()->players[tempOwner].valOfBonuses
(Selector::type(Bonus::CREATURE_GROWTH_PERCENT) && Selector::sourceType(Bonus::ARTIFACT)))/100; //Statue of Legion
for (std::vector<CGDwelling*>::const_iterator it = cb->gameState()->players[tempOwner].dwellings.begin(); it != cb->gameState()->players[tempOwner].dwellings.end(); ++it)
{ //+1 for each dwelling
if (VLC->creh->creatures[creid]->idNumber == (*it)->creatures[0].second[0])
@ -6613,10 +6614,10 @@ void CArmedInstance::getBonuses(BonusList &out, const CSelector &selector, const
}
}
int CArmedInstance::valOfGlobalBonuses(Bonus::BonusType type, int subtype) const
int CArmedInstance::valOfGlobalBonuses(CSelector selector) const
{
//if (tempOwner != NEUTRAL_PLAYER)
return cb->gameState()->players[tempOwner].valOfBonuses(type, subtype);
return cb->gameState()->players[tempOwner].valOfBonuses(selector, this);
}
bool IMarket::getOffer(int id1, int id2, int &val1, int &val2, EMarketMode mode) const

View File

@ -228,7 +228,7 @@ public:
//////////////////////////////////////////////////////////////////////////
void getParents(TCNodes &out, const CBonusSystemNode *root = NULL) const;
void getBonuses(BonusList &out, const CSelector &selector, const CBonusSystemNode *root = NULL) const;
int valOfGlobalBonuses(Bonus::BonusType type, int subtype) const; //used only for castle interface
int valOfGlobalBonuses(CSelector selector) const; //used only for castle interface
//////////////////////////////////////////////////////////////////////////
CArmedInstance();

View File

@ -648,30 +648,27 @@ DLL_EXPORT void NewTurn::applyGs( CGameState *gs )
b.duration = Bonus::ONE_WEEK;
b.source = Bonus::SPECIAL_WEEK;
b.effectRange = Bonus::NO_LIMIT;
b.valType = Bonus::BASE_NUMBER; //certainly not intuitive
switch (specialWeek)
{
case DOUBLE_GROWTH:
b.val = 100;
b.type = Bonus::CREATURE_GROWTH_PERCENT;
b.limiter = new CCreatureTypeLimiter(*VLC->creh->creatures[creatureid], false);
b.valType = Bonus::BASE_NUMBER; //certainly not intuitive
break;
case BONUS_GROWTH:
b.val = 5;
b.type = Bonus::CREATURE_GROWTH;
b.limiter = new CCreatureTypeLimiter(*VLC->creh->creatures[creatureid], false);
b.valType = Bonus::BASE_NUMBER;
break;
case DEITYOFFIRE:
b.val = 15;
b.type = Bonus::CREATURE_GROWTH;
b.limiter = new CCreatureTypeLimiter(*VLC->creh->creatures[42], true);
b.valType = Bonus::BASE_NUMBER;
break;
case PLAGUE:
b.val = -100; //no basic creatures
b.type = Bonus::CREATURE_GROWTH_PERCENT;
b.valType = Bonus::BASE_NUMBER;
break;
default:
b.val = 0;

View File

@ -1041,6 +1041,8 @@ void CGameHandler::newTurn()
n.specialWeek = NewTurn::NORMAL;
}
}
else
n.specialWeek = NewTurn::NO_ACTION; //don't remove bonuses
std::map<ui32,CGHeroInstance *> pool = gs->hpool.heroesPool;