From c1109452d6e85f3ac6d46171b61a1786678fb11b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20W=2E=20Urba=C5=84czyk?= Date: Sun, 15 Feb 2009 19:49:23 +0000 Subject: [PATCH] * blocked opening sepllbook if hero doesn't have a one * removing one-battle bonuses after battle * windmill gives 500 gold only during first week ever --- CBattleInterface.cpp | 12 +++++++++++- CGameState.cpp | 10 ++++++++++ hch/CObjectHandler.cpp | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/CBattleInterface.cpp b/CBattleInterface.cpp index 350325e97..872841dd7 100644 --- a/CBattleInterface.cpp +++ b/CBattleInterface.cpp @@ -953,6 +953,16 @@ void CBattleInterface::stackActivated(int number) myTurn = true; redrawBackgroundWithHexes(number); bWait->block(vstd::contains(LOCPLINT->cb->battleGetStackByID(number)->state,WAITING)); //block waiting button if stack has been already waiting + + //block cast spell button if hero doesn't have a spellbook + if(attackingHeroInstance && attackingHeroInstance->tempOwner==LOCPLINT->cb->battleGetStackByID(number)->owner) + { + bSpell->block(!attackingHeroInstance->getArt(17)); + } + else if(defendingHeroInstance && defendingHeroInstance->tempOwner==LOCPLINT->cb->battleGetStackByID(number)->owner) + { + bSpell->block(!defendingHeroInstance->getArt(17)); + } } void CBattleInterface::stackMoved(int number, int destHex, bool endMoving) @@ -2235,7 +2245,7 @@ void CBattleHero::setPhase(int newPhase) void CBattleHero::clickLeft(boost::logic::tribool down) { - if(!down && myHero) + if(!down && myHero && myHero->getArt(17)) { for(int it=0; it(pack); for(unsigned i=0;istacks.size();i++) delete curB->stacks[i]; + + //remove any "until next battle" bonuses + CGHeroInstance *h; + h = getHero(curB->hero1); + if(h) + h->bonuses.remove_if(HeroBonus::OneBattle); + h = getHero(curB->hero2); + if(h) + h->bonuses.remove_if(HeroBonus::OneBattle); + delete curB; curB = NULL; break; diff --git a/hch/CObjectHandler.cpp b/hch/CObjectHandler.cpp index bfee5a606..dd74afa8f 100644 --- a/hch/CObjectHandler.cpp +++ b/hch/CObjectHandler.cpp @@ -1323,7 +1323,7 @@ void CGVisitableOPW::onHeroVisit( const CGHeroInstance * h ) const case 109: mid = 164; sub = 6; - if(cb->getDate(2)<2) + if(cb->getDate(0)<8) val = 500; else val = 1000;