mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
This commit is contained in:
parent
936a310b0a
commit
0a2b04709f
@ -62,11 +62,12 @@ std::string Goals::AbstractGoal::name() const //TODO: virtualize
|
||||
desc = "GATHER TROOPS";
|
||||
break;
|
||||
case GET_OBJ:
|
||||
{
|
||||
auto obj = cb->getObjInstance(ObjectInstanceID(objid));
|
||||
if (obj)
|
||||
desc = "GET OBJ " + obj->getObjectName();
|
||||
}
|
||||
{
|
||||
auto obj = cb->getObjInstance(ObjectInstanceID(objid));
|
||||
if(obj)
|
||||
desc = "GET OBJ " + obj->getObjectName();
|
||||
}
|
||||
break;
|
||||
case FIND_OBJ:
|
||||
desc = "FIND OBJ " + boost::lexical_cast<std::string>(objid);
|
||||
break;
|
||||
|
@ -3310,12 +3310,13 @@ bool shouldVisit(HeroPtr h, const CGObjectInstance * obj)
|
||||
case Obj::PRISON:
|
||||
return ai->myCb->getHeroesInfo().size() < VLC->modh->settings.MAX_HEROES_ON_MAP_PER_PLAYER;
|
||||
case Obj::TAVERN:
|
||||
{//TODO: make AI actually recruit heroes
|
||||
//TODO: only on request
|
||||
if ((ai->myCb->getHeroesInfo().size() >= VLC->modh->settings.MAX_HEROES_ON_MAP_PER_PLAYER) ||
|
||||
(ai->myCb->getResourceAmount()[Res::GOLD] - GOLD_RESERVE < GameConstants::HERO_GOLD_COST))
|
||||
return false;
|
||||
}
|
||||
{//TODO: make AI actually recruit heroes
|
||||
//TODO: only on request
|
||||
if((ai->myCb->getHeroesInfo().size() >= VLC->modh->settings.MAX_HEROES_ON_MAP_PER_PLAYER) ||
|
||||
(ai->myCb->getResourceAmount()[Res::GOLD] - GOLD_RESERVE < GameConstants::HERO_GOLD_COST))
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case Obj::BOAT:
|
||||
return false;
|
||||
//Boats are handled by pathfinder
|
||||
|
@ -303,19 +303,21 @@ int InfoBoxHeroData::getSubID()
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case HERO_PRIMARY_SKILL:
|
||||
return index;
|
||||
case HERO_SECONDARY_SKILL:
|
||||
if (hero->secSkills.size() > index)
|
||||
return hero->secSkills[index].first;
|
||||
case HERO_SPECIAL:
|
||||
return hero->type->ID.getNum();
|
||||
case HERO_MANA:
|
||||
case HERO_EXPERIENCE:
|
||||
return 0;
|
||||
default:
|
||||
assert(0);
|
||||
case HERO_PRIMARY_SKILL:
|
||||
return index;
|
||||
case HERO_SECONDARY_SKILL:
|
||||
if(hero->secSkills.size() > index)
|
||||
return hero->secSkills[index].first;
|
||||
else
|
||||
return 0;
|
||||
case HERO_SPECIAL:
|
||||
return hero->type->ID.getNum();
|
||||
case HERO_MANA:
|
||||
case HERO_EXPERIENCE:
|
||||
return 0;
|
||||
default:
|
||||
assert(0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -330,10 +332,12 @@ si64 InfoBoxHeroData::getValue()
|
||||
case HERO_EXPERIENCE:
|
||||
return hero->exp;
|
||||
case HERO_SECONDARY_SKILL:
|
||||
if (hero->secSkills.size() > index)
|
||||
if(hero->secSkills.size() > index)
|
||||
return hero->secSkills[index].second;
|
||||
case HERO_SPECIAL:
|
||||
else
|
||||
return 0;
|
||||
case HERO_SPECIAL:
|
||||
return 0;
|
||||
default:
|
||||
assert(0);
|
||||
return 0;
|
||||
@ -353,7 +357,6 @@ std::string InfoBoxHeroData::getHoverText()
|
||||
case HERO_SPECIAL:
|
||||
return CGI->generaltexth->heroscrn[27];
|
||||
case HERO_SECONDARY_SKILL:
|
||||
{
|
||||
if (hero->secSkills.size() > index)
|
||||
{
|
||||
std::string level = CGI->generaltexth->levels[hero->secSkills[index].second-1];
|
||||
@ -361,6 +364,7 @@ std::string InfoBoxHeroData::getHoverText()
|
||||
return boost::str(boost::format(CGI->generaltexth->heroscrn[21]) % level % skill);
|
||||
}
|
||||
else
|
||||
{
|
||||
return "";
|
||||
}
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user