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

Support for sanctuary.

Minor fix.
This commit is contained in:
Michał W. Urbańczyk 2010-07-09 00:54:17 +00:00
parent 1e30045541
commit 44ee8e47b7
2 changed files with 39 additions and 21 deletions

View File

@ -482,12 +482,24 @@ void CGObjectInstance::onHeroVisit( const CGHeroInstance * h ) const
{
switch(ID)
{
case 95:
OpenWindow ow;
ow.window = OpenWindow::TAVERN_WINDOW;
ow.id1 = h->id;
ow.id2 = id;
cb->sendAndApply(&ow);
case 80: //Sanctuary
{
InfoWindow iw;
iw.player = h->tempOwner;
iw.soundID = soundBase::GETPROTECTION;
iw.text.addTxt(MetaString::ADVOB_TXT, 114); //You enter the sanctuary and immediately feel as if a great weight has been lifted off your shoulders. You feel safe here.
cb->sendAndApply(&iw);
}
break;
case 95: //Tavern
{
OpenWindow ow;
ow.window = OpenWindow::TAVERN_WINDOW;
ow.id1 = h->id;
ow.id2 = id;
cb->sendAndApply(&ow);
}
break;
}
}
@ -982,10 +994,10 @@ void CGHeroInstance::initObj()
bonus.type = Bonus::PRIMARY_SKILL; //TODO: limit to specific creature type
bonus.valType = Bonus::ADDITIVE_VALUE;
bonus.subtype = 1; //attack
bonus.val = level * (*creatures)[it->additionalinfo]->attack / (*creatures)[it->additionalinfo]->level /20;
bonus.val = level * (*creatures)[it->additionalinfo]->attack / creLevel /20;
speciality.bonuses.push_back (bonus);
bonus.subtype = 2; //defense
bonus.val = level * (*creatures)[it->additionalinfo]->defence / (*creatures)[it->additionalinfo]->level /20;
bonus.val = level * (*creatures)[it->additionalinfo]->defence / creLevel /20;
speciality.bonuses.push_back (bonus);
bonus.type = Bonus::STACKS_SPEED;
bonus.val = 1; //+1 speed

View File

@ -2172,21 +2172,27 @@ void CGameState::calculatePaths(const CGHeroInstance *hero, CPathsInfo &out, int
}
else if(tinfo->visitable)
{
for(size_t ii = 0; ii < tinfo->visitableObjects.size(); ii++)
//hero is protected in Sanctuary
if(tinfo->visitableObjects.front()->ID == 80 && tinfo->visitableObjects.back()->ID == HEROI_TYPE && tinfo->visitableObjects.back()->tempOwner != hero->tempOwner)
node.accessible = CGPathNode::BLOCKED;
else
{
const CGObjectInstance * const obj = tinfo->visitableObjects[ii];
if(obj->getPassableness() & 1<<hero->tempOwner) //special object instance specific passableness flag - overwrites other accessibility flags
for(size_t ii = 0; ii < tinfo->visitableObjects.size(); ii++)
{
node.accessible = CGPathNode::ACCESSIBLE;
}
else if(obj->blockVisit)
{
node.accessible = CGPathNode::BLOCKVIS;
break;
}
else if(obj->ID != EVENTI_TYPE) //pathfinder should ignore placed events
{
node.accessible = CGPathNode::VISITABLE;
const CGObjectInstance * const obj = tinfo->visitableObjects[ii];
if(obj->getPassableness() & 1<<hero->tempOwner) //special object instance specific passableness flag - overwrites other accessibility flags
{
node.accessible = CGPathNode::ACCESSIBLE;
}
else if(obj->blockVisit)
{
node.accessible = CGPathNode::BLOCKVIS;
break;
}
else if(obj->ID != EVENTI_TYPE) //pathfinder should ignore placed events
{
node.accessible = CGPathNode::VISITABLE;
}
}
}
}