1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-26 22:57:00 +02:00

* artifacts will be present on morale/luck bonuses list

* fixed problems with 3-tiles monoliths
* fixed some descriptions for events
This commit is contained in:
Michał W. Urbańczyk 2009-07-14 16:20:15 +00:00
parent acfe94a966
commit 48661bd714
3 changed files with 21 additions and 7 deletions

View File

@ -5,6 +5,7 @@
#include "CGeneralTextHandler.h"
#include <boost/assign/std/vector.hpp>
#include <boost/assign/list_of.hpp>
#include <boost/lexical_cast.hpp>
#include "../lib/VCMI_Lib.h"
extern CLodHandler *bitmaph;
using namespace boost::assign;
@ -138,6 +139,10 @@ void CArtHandler::sortArts()
void CArtHandler::giveArtBonus( int aid, HeroBonus::BonusType type, int val, int subtype )
{
artifacts[aid].bonuses.push_back(HeroBonus(HeroBonus::PERMANENT,type,HeroBonus::ARTIFACT,val,aid,subtype));
if(type == HeroBonus::MORALE || HeroBonus::LUCK || HeroBonus::MORALE_AND_LUCK)
artifacts[aid].bonuses.back().description = "\n" + artifacts[aid].Name() + (val > 0 ? " +" : " ")
+ boost::lexical_cast<std::string>(val);
}
void CArtHandler::addBonuses()

View File

@ -256,6 +256,17 @@ int CGObjectInstance::getSightRadious() const
return 3;
}
int3 CGObjectInstance::getVisitableOffset() const
{
for(int y = 0; y < 6; y++)
for (int x = 0; x < 8; x++)
if((defInfo->visitMap[5-y] >> x) & 1)
return int3(x,y,0);
tlog2 << "Warning: getVisitableOffset called on non-visitable obj!\n";
return int3(-1,-1,-1);
}
static int lowestSpeed(const CGHeroInstance * chi)
{
if(!chi->army.slots.size())
@ -2068,7 +2079,7 @@ void CGTeleport::onHeroVisit( const CGHeroInstance * h ) const
int destinationid=-1;
switch(ID)
{
case 43: //one way - find correspong exit monolith
case 43: //one way - find corresponding exit monolith
if(vstd::contains(objs,44) && vstd::contains(objs[44],subID) && objs[44][subID].size())
destinationid = objs[44][subID][rand()%objs[44][subID].size()];
else
@ -2105,10 +2116,7 @@ void CGTeleport::onHeroVisit( const CGHeroInstance * h ) const
tlog2 << "Cannot find exit... :( \n";
return;
}
cb->moveHero(h->id,
(ID!=103)
? (CGHeroInstance::convertPosition(cb->getObj(destinationid)->pos,true))
: (cb->getObj(destinationid)->pos),
cb->moveHero(h->id,CGHeroInstance::convertPosition(cb->getObj(destinationid)->pos,true) - getVisitableOffset(),
true);
}
@ -2784,7 +2792,7 @@ void CGEvent::getText( InfoWindow &iw, bool &afterBattle, int text, const CGHero
}
}
void CGEvent::getText( InfoWindow &iw, bool &afterBattle, int val, int positive, int negative, const CGHeroInstance * h ) const
void CGEvent::getText( InfoWindow &iw, bool &afterBattle, int val, int negative, int positive, const CGHeroInstance * h ) const
{
iw.components.clear();
iw.text.clear();

View File

@ -125,6 +125,7 @@ public:
int getWidth() const; //returns width of object graphic in tiles
int getHeight() const; //returns height of object graphic in tiles
bool visitableAt(int x, int y) const; //returns true if object is visitable at location (x, y) form left top tile of image (x, y in tiles)
int3 getVisitableOffset() const; //returns (x,y,0) offset to first visitable tile from bottom right obj tile (0,0,0) (h3m pos)
bool blockingAt(int x, int y) const; //returns true if object is blocking location (x, y) form left top tile of image (x, y in tiles)
bool coveringAt(int x, int y) const; //returns true if object covers with picture location (x, y) form left top tile of maximal possible image (8 x 6 tiles) (x, y in tiles)
bool operator<(const CGObjectInstance & cmp) const; //screen printing priority comparing
@ -432,7 +433,7 @@ public:
void endBattle(const CGHeroInstance *h, BattleResult *result) const;
void giveContents(const CGHeroInstance *h, bool afterBattle) const;
void getText( InfoWindow &iw, bool &afterBattle, int val, int positive, int negative, const CGHeroInstance * h ) const;
void getText( InfoWindow &iw, bool &afterBattle, int val, int negative, int positive, const CGHeroInstance * h ) const;
void getText( InfoWindow &iw, bool &afterBattle, int text, const CGHeroInstance * h ) const;
};