mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
This commit is contained in:
@@ -85,3 +85,4 @@ Grotto 1 30% 3 Harpy 0 3 Beholder 3 Harpy 3 Beholder 200 20 1000 0 None 0 0
|
|||||||
2 30% 4 Harpy 0 4 Beholder 4 Harpy 4 Beholder 300 25 1000 0 None 0 0 0 0 3000 20 150%
|
2 30% 4 Harpy 0 4 Beholder 4 Harpy 4 Beholder 300 25 1000 0 None 0 0 0 0 3000 20 150%
|
||||||
3 30% 5 Harpy 0 5 Beholder 5 Harpy 5 Beholder 400 30 1500 0 None 0 0 0 0 4000 20 200%
|
3 30% 5 Harpy 0 5 Beholder 5 Harpy 5 Beholder 400 30 1500 0 None 0 0 0 0 4000 20 200%
|
||||||
4 10% 6 Harpy 0 6 Beholder 6 Harpy 6 Beholder 500 35 2000 0 None 0 0 0 0 5000 20 250%
|
4 10% 6 Harpy 0 6 Beholder 6 Harpy 6 Beholder 500 35 2000 0 None 0 0 0 0 5000 20 250%
|
||||||
|
Pyramid 1 100% 20 Gold Golem 0% 10 Diamond Golem 20 Gold Golem 10 Diamond Golem 786 15000 19 100%
|
||||||
|
@@ -46,7 +46,6 @@ extern CLodHandler * bitmaph;
|
|||||||
extern boost::rand48 ran;
|
extern boost::rand48 ran;
|
||||||
std::map <ui8, std::set <ui8> > CGKeys::playerKeyMap;
|
std::map <ui8, std::set <ui8> > CGKeys::playerKeyMap;
|
||||||
std::map <si32, std::vector<si32> > CGMagi::eyelist;
|
std::map <si32, std::vector<si32> > CGMagi::eyelist;
|
||||||
BankConfig CGPyramid::pyramidConfig;
|
|
||||||
ui8 CGObelisk::obeliskCount; //how many obelisks are on map
|
ui8 CGObelisk::obeliskCount; //how many obelisks are on map
|
||||||
std::map<ui8, ui8> CGObelisk::visited; //map: team_id => how many obelisks has been visited
|
std::map<ui8, ui8> CGObelisk::visited; //map: team_id => how many obelisks has been visited
|
||||||
|
|
||||||
@@ -130,6 +129,54 @@ static void readCreatures(std::istream & is, BankConfig & bc, bool guards) //hel
|
|||||||
else //given creatures
|
else //given creatures
|
||||||
bc.creatures.push_back(guardInfo);
|
bc.creatures.push_back(guardInfo);
|
||||||
}
|
}
|
||||||
|
void CObjectHandler::readConfigLine(std::ifstream &istr, int g)
|
||||||
|
{
|
||||||
|
banksInfo[g].push_back(new BankConfig);
|
||||||
|
|
||||||
|
BankConfig &bc = *banksInfo[g].back();
|
||||||
|
std::string buf;
|
||||||
|
char dump;
|
||||||
|
//bc.level is of type char and thus we cannot read directly to it; same for some othre variables
|
||||||
|
istr >> buf;
|
||||||
|
bc.level = atoi(buf.c_str());
|
||||||
|
|
||||||
|
istr >> buf;
|
||||||
|
bc.chance = atoi(buf.c_str());
|
||||||
|
|
||||||
|
readCreatures(istr, bc, true);
|
||||||
|
istr >> buf;
|
||||||
|
bc.upgradeChance = atoi(buf.c_str());
|
||||||
|
|
||||||
|
for(int b=0; b<3; ++b)
|
||||||
|
readCreatures(istr, bc, true);
|
||||||
|
|
||||||
|
istr >> bc.combatValue;
|
||||||
|
bc.resources.resize(RESOURCE_QUANTITY);
|
||||||
|
|
||||||
|
//a dirty trick to make it work if there is no 0 for 0 quantity (like in grotto - last entry)
|
||||||
|
char buft[52];
|
||||||
|
istr.getline(buft, 50, '\t');
|
||||||
|
for(int h=0; h<7; ++h)
|
||||||
|
{
|
||||||
|
istr.getline(buft, 50, '\t');
|
||||||
|
if(buft[0] == '\0')
|
||||||
|
bc.resources[h] = 0;
|
||||||
|
else
|
||||||
|
bc.resources[h] = SDL_atoi(buft);
|
||||||
|
}
|
||||||
|
readCreatures(istr, bc, false);
|
||||||
|
|
||||||
|
bc.artifacts.resize(4);
|
||||||
|
for(int b=0; b<4; ++b)
|
||||||
|
{
|
||||||
|
istr >> bc.artifacts[b];
|
||||||
|
}
|
||||||
|
|
||||||
|
istr >> bc.value;
|
||||||
|
istr >> bc.rewardDifficulty;
|
||||||
|
istr >> buf;
|
||||||
|
bc.easiest = atoi(buf.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
void CObjectHandler::loadObjects()
|
void CObjectHandler::loadObjects()
|
||||||
{
|
{
|
||||||
@@ -164,8 +211,6 @@ void CObjectHandler::loadObjects()
|
|||||||
tlog5 << "\t\tDone loading resource prices!\n";
|
tlog5 << "\t\tDone loading resource prices!\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
std::ifstream istr;
|
std::ifstream istr;
|
||||||
istr.open(DATA_DIR "/config/bankconfig.txt", std::ios_base::binary);
|
istr.open(DATA_DIR "/config/bankconfig.txt", std::ios_base::binary);
|
||||||
if(!istr.is_open())
|
if(!istr.is_open())
|
||||||
@@ -191,53 +236,15 @@ void CObjectHandler::loadObjects()
|
|||||||
|
|
||||||
for(int i=0; i<4; ++i) //reading levels
|
for(int i=0; i<4; ++i) //reading levels
|
||||||
{
|
{
|
||||||
banksInfo[g].push_back(new BankConfig);
|
readConfigLine(istr,g);
|
||||||
|
|
||||||
BankConfig &bc = *banksInfo[g].back();
|
|
||||||
std::string buf;
|
|
||||||
char dump;
|
|
||||||
//bc.level is of type char and thus we cannot read directly to it; same for some othre variables
|
|
||||||
istr >> buf;
|
|
||||||
bc.level = atoi(buf.c_str());
|
|
||||||
|
|
||||||
istr >> buf;
|
|
||||||
bc.chance = atoi(buf.c_str());
|
|
||||||
|
|
||||||
readCreatures(istr, bc, true);
|
|
||||||
istr >> buf;
|
|
||||||
bc.upgradeChance = atoi(buf.c_str());
|
|
||||||
|
|
||||||
for(int b=0; b<3; ++b)
|
|
||||||
readCreatures(istr, bc, true);
|
|
||||||
|
|
||||||
istr >> bc.combatValue;
|
|
||||||
bc.resources.resize(RESOURCE_QUANTITY);
|
|
||||||
|
|
||||||
//a dirty trick to make it work if there is no 0 for 0 quantity (like in grotto - last entry)
|
|
||||||
char buft[52];
|
|
||||||
istr.getline(buft, 50, '\t');
|
|
||||||
for(int h=0; h<7; ++h)
|
|
||||||
{
|
|
||||||
istr.getline(buft, 50, '\t');
|
|
||||||
if(buft[0] == '\0')
|
|
||||||
bc.resources[h] = 0;
|
|
||||||
else
|
|
||||||
bc.resources[h] = SDL_atoi(buft);
|
|
||||||
}
|
|
||||||
readCreatures(istr, bc, false);
|
|
||||||
|
|
||||||
bc.artifacts.resize(4);
|
|
||||||
for(int b=0; b<4; ++b)
|
|
||||||
{
|
|
||||||
istr >> bc.artifacts[b];
|
|
||||||
}
|
|
||||||
|
|
||||||
istr >> bc.value;
|
|
||||||
istr >> bc.rewardDifficulty;
|
|
||||||
istr >> buf;
|
|
||||||
bc.easiest = atoi(buf.c_str());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//reading name
|
||||||
|
istr.getline(buffer, MAX_BUF, '\t');
|
||||||
|
creBanksNames[21] = std::string(buffer);
|
||||||
|
while(creBanksNames[21][0] == 10 || creBanksNames[21][0] == 13)
|
||||||
|
creBanksNames[21].erase(creBanksNames[21].begin());
|
||||||
|
readConfigLine(istr,21); //pyramid
|
||||||
}
|
}
|
||||||
|
|
||||||
int CGObjectInstance::getOwner() const
|
int CGObjectInstance::getOwner() const
|
||||||
@@ -5863,30 +5870,22 @@ void CBank::endBattle (const CGHeroInstance *h, const BattleResult *result) cons
|
|||||||
|
|
||||||
void CGPyramid::initObj()
|
void CGPyramid::initObj()
|
||||||
{
|
{
|
||||||
//would be nice to do that only once
|
|
||||||
if (!pyramidConfig.guards.size())
|
|
||||||
{
|
|
||||||
pyramidConfig.level = 1;
|
|
||||||
pyramidConfig.chance = 100;
|
|
||||||
pyramidConfig.upgradeChance = 0;
|
|
||||||
for (int i = 0; i < 2; ++i)
|
|
||||||
{
|
|
||||||
pyramidConfig.guards.push_back (std::pair <ui16, ui32>(116, 20));
|
|
||||||
pyramidConfig.guards.push_back (std::pair <ui16, ui32>(117, 10));
|
|
||||||
}
|
|
||||||
pyramidConfig.combatValue; //how hard are guards of this level
|
|
||||||
pyramidConfig.value; //overall value of given things
|
|
||||||
pyramidConfig.rewardDifficulty; //proportion of reward value to difficulty of guards; how profitable is this creature Bank config
|
|
||||||
pyramidConfig.easiest; //?!?
|
|
||||||
}
|
|
||||||
bc = &pyramidConfig;
|
|
||||||
std::vector<ui16> available;
|
std::vector<ui16> available;
|
||||||
cb->getAllowedSpells (available, 5);
|
cb->getAllowedSpells (available, 5);
|
||||||
spell = (available[rand()%available.size()]);
|
if (available.size())
|
||||||
|
{
|
||||||
|
bc = VLC->objh->banksInfo[21].front(); //TODO: remove hardcoded value?
|
||||||
|
spell = (available[rand()%available.size()]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tlog1 <<"No spells available for Pyramid! Object set to empty.\n";
|
||||||
|
}
|
||||||
|
setPropertyDer (17,ran()); //set guards at game start
|
||||||
}
|
}
|
||||||
const std::string & CGPyramid::getHoverText() const
|
const std::string & CGPyramid::getHoverText() const
|
||||||
{
|
{
|
||||||
hoverName = VLC->generaltexth->names[ID];
|
hoverName = VLC->objh->creBanksNames[21];
|
||||||
if (bc == NULL)
|
if (bc == NULL)
|
||||||
hoverName += " " + VLC->generaltexth->allTexts[352];
|
hoverName += " " + VLC->generaltexth->allTexts[352];
|
||||||
else
|
else
|
||||||
|
@@ -1079,7 +1079,6 @@ class DLL_EXPORT CBank : public CArmedInstance
|
|||||||
class DLL_EXPORT CGPyramid : public CBank
|
class DLL_EXPORT CGPyramid : public CBank
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static BankConfig pyramidConfig;
|
|
||||||
ui16 spell;
|
ui16 spell;
|
||||||
|
|
||||||
void initObj();
|
void initObj();
|
||||||
@@ -1247,6 +1246,7 @@ public:
|
|||||||
std::vector<ui32> resVals; //default values of resources in gold
|
std::vector<ui32> resVals; //default values of resources in gold
|
||||||
|
|
||||||
void loadObjects();
|
void loadObjects();
|
||||||
|
void readConfigLine(std::ifstream &istr, int g);
|
||||||
|
|
||||||
template <typename Handler> void serialize(Handler &h, const int version)
|
template <typename Handler> void serialize(Handler &h, const int version)
|
||||||
{
|
{
|
||||||
|
@@ -342,7 +342,6 @@ struct DLL_EXPORT Mapa : public CMapHeader
|
|||||||
h & CGTeleport::gates;
|
h & CGTeleport::gates;
|
||||||
h & CGKeys::playerKeyMap;
|
h & CGKeys::playerKeyMap;
|
||||||
h & CGMagi::eyelist;
|
h & CGMagi::eyelist;
|
||||||
h & CGPyramid::pyramidConfig;
|
|
||||||
h & CGObelisk::obeliskCount & CGObelisk::visited;
|
h & CGObelisk::obeliskCount & CGObelisk::visited;
|
||||||
h & CGTownInstance::merchantArtifacts;
|
h & CGTownInstance::merchantArtifacts;
|
||||||
|
|
||||||
|
@@ -625,15 +625,15 @@ void CGameHandler::endBattle(int3 tile, const CGHeroInstance *hero1, const CGHer
|
|||||||
if(battleResult.data->exp[1] && hero2)
|
if(battleResult.data->exp[1] && hero2)
|
||||||
changePrimSkill(hero2->id,4,battleResult.data->exp[1]);
|
changePrimSkill(hero2->id,4,battleResult.data->exp[1]);
|
||||||
|
|
||||||
if(battleEndCallback && *battleEndCallback)
|
sendAndApply(&resultsApplied);
|
||||||
|
|
||||||
|
if(battleEndCallback && *battleEndCallback) //TODO: object interaction after level dialog is handled
|
||||||
{
|
{
|
||||||
(*battleEndCallback)(battleResult.data);
|
(*battleEndCallback)(battleResult.data);
|
||||||
delete battleEndCallback;
|
delete battleEndCallback;
|
||||||
battleEndCallback = 0;
|
battleEndCallback = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
sendAndApply(&resultsApplied);
|
|
||||||
|
|
||||||
// Necromancy if applicable.
|
// Necromancy if applicable.
|
||||||
const CGHeroInstance *winnerHero = battleResult.data->winner != 0 ? hero2 : hero1;
|
const CGHeroInstance *winnerHero = battleResult.data->winner != 0 ? hero2 : hero1;
|
||||||
const CGHeroInstance *loserHero = battleResult.data->winner != 0 ? hero1 : hero2;
|
const CGHeroInstance *loserHero = battleResult.data->winner != 0 ? hero1 : hero2;
|
||||||
|
@@ -160,7 +160,7 @@ bool TradeOnMarketplace::applyGh( CGameHandler *gh )
|
|||||||
case CREATURE_UNDEAD:
|
case CREATURE_UNDEAD:
|
||||||
return gh->transformInUndead(m, hero, r1);
|
return gh->transformInUndead(m, hero, r1);
|
||||||
case RESOURCE_SKILL:
|
case RESOURCE_SKILL:
|
||||||
return gh->buySecSkill(m, hero, r2);
|
return gh->buySecSkill(m, hero, r2);
|
||||||
case CREATURE_EXP:
|
case CREATURE_EXP:
|
||||||
return gh->sacrificeCreatures(m, hero, r1, val);
|
return gh->sacrificeCreatures(m, hero, r1, val);
|
||||||
case ARTIFACT_EXP:
|
case ARTIFACT_EXP:
|
||||||
|
Reference in New Issue
Block a user