mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-31 22:05:10 +02:00
1.Support for Mana Vortex
2.Bonusing town buildings now dispplay correct message.
This commit is contained in:
parent
60085e2249
commit
9764e968cd
@ -1408,6 +1408,9 @@ void CGTownInstance::setPropertyDer(ui8 what, ui32 val)
|
|||||||
case 11: //add visitor of town building
|
case 11: //add visitor of town building
|
||||||
bonusingBuildings[val]->setProperty (4, visitingHero->id);
|
bonusingBuildings[val]->setProperty (4, visitingHero->id);
|
||||||
break;
|
break;
|
||||||
|
case 12:
|
||||||
|
bonusingBuildings[val]->setProperty (12, 0);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int CGTownInstance::fortLevel() const //0 - none, 1 - fort, 2 - citadel, 3 - castle
|
int CGTownInstance::fortLevel() const //0 - none, 1 - fort, 2 - citadel, 3 - castle
|
||||||
@ -1594,7 +1597,7 @@ void CGTownInstance::initObj()
|
|||||||
case 2: case 3: case 5: case 6:
|
case 2: case 3: case 5: case 6:
|
||||||
bonusingBuildings.push_back (new CTownBonus(23, this));
|
bonusingBuildings.push_back (new CTownBonus(23, this));
|
||||||
if (subID == 5)
|
if (subID == 5)
|
||||||
bonusingBuildings.push_back (new COPWBonus(18, this)); //Vortex
|
bonusingBuildings.push_back (new COPWBonus(21, this)); //Vortex
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
bonusingBuildings.push_back (new CTownBonus(17, this));
|
bonusingBuildings.push_back (new CTownBonus(17, this));
|
||||||
@ -1604,6 +1607,15 @@ void CGTownInstance::initObj()
|
|||||||
removeCapitols (getOwner(), false); // destroy other capitols
|
removeCapitols (getOwner(), false); // destroy other capitols
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CGTownInstance::newTurn() const
|
||||||
|
{
|
||||||
|
if (cb->getDate(0)%7 == 1) //reset on new week
|
||||||
|
{
|
||||||
|
for (std::vector<CGTownBuilding*>::const_iterator i = bonusingBuildings.begin(); i!=bonusingBuildings.end(); i++)
|
||||||
|
cb->setObjProperty (id, 12, 0); //reset visitors for Mana Vortex
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
int3 CGTownInstance::getSightCenter() const
|
int3 CGTownInstance::getSightCenter() const
|
||||||
{
|
{
|
||||||
return pos - int3(2,0,0);
|
return pos - int3(2,0,0);
|
||||||
@ -1987,7 +1999,7 @@ void COPWBonus::setProperty(ui8 what, ui32 val)
|
|||||||
case 4:
|
case 4:
|
||||||
visitors.insert(val);
|
visitors.insert(val);
|
||||||
break;
|
break;
|
||||||
case 11:
|
case 12:
|
||||||
visitors.clear();
|
visitors.clear();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1999,25 +2011,29 @@ void COPWBonus::onHeroVisit (const CGHeroInstance * h) const
|
|||||||
{
|
{
|
||||||
InfoWindow iw;
|
InfoWindow iw;
|
||||||
iw.player = h->tempOwner;
|
iw.player = h->tempOwner;
|
||||||
switch (ID)
|
switch (town->subID)
|
||||||
{
|
{
|
||||||
case 18: //Mana Vortex
|
case 0: //Stables
|
||||||
if (visitors.size())
|
|
||||||
{
|
|
||||||
cb->setObjProperty (town->id, 11, id); //add to visitors
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 21: //Stables
|
|
||||||
if (!h->getBonus(HeroBonus::OBJECT, 94)) //no advMap Stables
|
if (!h->getBonus(HeroBonus::OBJECT, 94)) //no advMap Stables
|
||||||
{
|
{
|
||||||
GiveBonus gb;
|
GiveBonus gb;
|
||||||
gb.bonus = HeroBonus(HeroBonus::ONE_WEEK, HeroBonus::LAND_MOVEMENT, HeroBonus::OBJECT, 600, 94, VLC->generaltexth->arraytxt[100]);
|
gb.bonus = HeroBonus(HeroBonus::ONE_WEEK, HeroBonus::LAND_MOVEMENT, HeroBonus::OBJECT, 600, 94, VLC->generaltexth->arraytxt[100]);
|
||||||
gb.hid = heroID;
|
gb.hid = heroID;
|
||||||
cb->giveHeroBonus(&gb);
|
cb->giveHeroBonus(&gb);
|
||||||
iw.text << std::pair<ui8,ui32>(11, 137);
|
iw.text << VLC->generaltexth->allTexts[580];
|
||||||
cb->showInfoDialog(&iw);
|
cb->showInfoDialog(&iw);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 5: //Mana Vortex
|
||||||
|
if (visitors.find(heroID) == visitors.end() && h->mana <= h->manaLimit())
|
||||||
|
{
|
||||||
|
cb->setManaPoints (heroID, 2 * h->manaLimit());
|
||||||
|
cb->setObjProperty (id, 5, true);
|
||||||
|
iw.text << VLC->generaltexth->allTexts[579];
|
||||||
|
cb->showInfoDialog(&iw);
|
||||||
|
cb->setObjProperty (town->id, 11, id); //add to visitors
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2038,7 +2054,7 @@ void CTownBonus::onHeroVisit (const CGHeroInstance * h) const
|
|||||||
if ((town->builtBuildings.find(ID) != town->builtBuildings.end()) && (visitors.find(heroID) == visitors.end()))
|
if ((town->builtBuildings.find(ID) != town->builtBuildings.end()) && (visitors.find(heroID) == visitors.end()))
|
||||||
{
|
{
|
||||||
InfoWindow iw;
|
InfoWindow iw;
|
||||||
int what, val;
|
int what, val, mid;
|
||||||
switch (ID)
|
switch (ID)
|
||||||
{
|
{
|
||||||
case 23:
|
case 23:
|
||||||
@ -2047,21 +2063,25 @@ void CTownBonus::onHeroVisit (const CGHeroInstance * h) const
|
|||||||
case 2: //wall
|
case 2: //wall
|
||||||
what = 3;
|
what = 3;
|
||||||
val = 1;
|
val = 1;
|
||||||
|
mid = 581;
|
||||||
iw.components.push_back (Component(Component::PRIM_SKILL, 3, 1, 0));
|
iw.components.push_back (Component(Component::PRIM_SKILL, 3, 1, 0));
|
||||||
break;
|
break;
|
||||||
case 3: //order of fire
|
case 3: //order of fire
|
||||||
what = 2;
|
what = 2;
|
||||||
val = 1;
|
val = 1;
|
||||||
|
mid = 582;
|
||||||
iw.components.push_back (Component(Component::PRIM_SKILL, 2, 1, 0));
|
iw.components.push_back (Component(Component::PRIM_SKILL, 2, 1, 0));
|
||||||
break;
|
break;
|
||||||
case 6://hall of valhalla
|
case 6://hall of valhalla
|
||||||
what = 0;
|
what = 0;
|
||||||
val = 1;
|
val = 1;
|
||||||
|
mid = 584;
|
||||||
iw.components.push_back (Component(Component::PRIM_SKILL, 0, 1, 0));
|
iw.components.push_back (Component(Component::PRIM_SKILL, 0, 1, 0));
|
||||||
break;
|
break;
|
||||||
case 5://academy of battle scholars
|
case 5://academy of battle scholars
|
||||||
what = 4;
|
what = 4;
|
||||||
val = 1000;
|
val = 1000;
|
||||||
|
mid = 583;
|
||||||
iw.components.push_back (Component(Component::EXPERIENCE, 0, 1000, 0));
|
iw.components.push_back (Component(Component::EXPERIENCE, 0, 1000, 0));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2072,13 +2092,14 @@ void CTownBonus::onHeroVisit (const CGHeroInstance * h) const
|
|||||||
case 7: //cage of warlords
|
case 7: //cage of warlords
|
||||||
what = 1;
|
what = 1;
|
||||||
val = 1;
|
val = 1;
|
||||||
|
mid = 585;
|
||||||
iw.components.push_back (Component(Component::PRIM_SKILL, 1, 1, 0));
|
iw.components.push_back (Component(Component::PRIM_SKILL, 1, 1, 0));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
iw.player = cb->getOwner(heroID);
|
iw.player = cb->getOwner(heroID);
|
||||||
iw.text << VLC->generaltexth->buildings[town->subID][ID].second;
|
iw.text << VLC->generaltexth->allTexts[mid];
|
||||||
cb->showInfoDialog(&iw);
|
cb->showInfoDialog(&iw);
|
||||||
cb->changePrimSkill (heroID, what, val);
|
cb->changePrimSkill (heroID, what, val);
|
||||||
cb->setObjProperty (town->id, 11, id); //add to visitors
|
cb->setObjProperty (town->id, 11, id); //add to visitors
|
||||||
|
@ -444,6 +444,7 @@ public:
|
|||||||
int getSightRadious() const; //returns sight distance
|
int getSightRadious() const; //returns sight distance
|
||||||
void getOutOffsets(std::vector<int3> &offsets) const; //offsets to obj pos when we boat can be placed
|
void getOutOffsets(std::vector<int3> &offsets) const; //offsets to obj pos when we boat can be placed
|
||||||
void setPropertyDer(ui8 what, ui32 val);
|
void setPropertyDer(ui8 what, ui32 val);
|
||||||
|
void newTurn() const;
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user