From 2c43707661795b8588e37b70a6b1faeab2eeb4ff Mon Sep 17 00:00:00 2001 From: DjWarmonger Date: Sat, 2 Oct 2010 09:43:22 +0000 Subject: [PATCH] More fixes for weeks & growths. --- client/CCastleInterface.cpp | 3 ++- hch/CObjectHandler.cpp | 7 ++++--- hch/CObjectHandler.h | 2 +- lib/NetPacksLib.cpp | 5 +---- server/CGameHandler.cpp | 2 ++ 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/client/CCastleInterface.cpp b/client/CCastleInterface.cpp index 1bea648cf..2e0aaaf6a 100644 --- a/client/CCastleInterface.cpp +++ b/client/CCastleInterface.cpp @@ -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())) diff --git a/hch/CObjectHandler.cpp b/hch/CObjectHandler.cpp index 4bca7c761..57c214e5c 100644 --- a/hch/CObjectHandler.cpp +++ b/hch/CObjectHandler.cpp @@ -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::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 diff --git a/hch/CObjectHandler.h b/hch/CObjectHandler.h index af9a0d583..da3c6964c 100644 --- a/hch/CObjectHandler.h +++ b/hch/CObjectHandler.h @@ -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(); diff --git a/lib/NetPacksLib.cpp b/lib/NetPacksLib.cpp index 629b8dc9a..193a5310d 100644 --- a/lib/NetPacksLib.cpp +++ b/lib/NetPacksLib.cpp @@ -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; diff --git a/server/CGameHandler.cpp b/server/CGameHandler.cpp index aec1088ef..2d82ac48f 100644 --- a/server/CGameHandler.cpp +++ b/server/CGameHandler.cpp @@ -1041,6 +1041,8 @@ void CGameHandler::newTurn() n.specialWeek = NewTurn::NORMAL; } } + else + n.specialWeek = NewTurn::NO_ACTION; //don't remove bonuses std::map pool = gs->hpool.heroesPool;