mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
some additional descriptions on heroWindow, better functions for hero level <-> exp (to be tested a bit more)
This commit is contained in:
parent
9b805ea1e7
commit
74cce9b7a0
@ -221,6 +221,11 @@ void CHeroList::hover (bool on)
|
||||
void CHeroList::keyPressed (SDL_KeyboardEvent & key)
|
||||
{
|
||||
}
|
||||
void CHeroList::updateHList()
|
||||
{
|
||||
items.clear();
|
||||
genList();
|
||||
}
|
||||
void CHeroList::updateMove(const CGHeroInstance* which) //draws move points bar
|
||||
{
|
||||
int ser = LOCPLINT->cb->getHeroSerial(which);
|
||||
|
@ -396,6 +396,17 @@ int CCallback::swapCreatures(const CCreatureSet *s1, const CCreatureSet *s2, int
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool CCallback::dismissHero(const CGHeroInstance *hero)
|
||||
{
|
||||
CGHeroInstance * Vhero = const_cast<CGHeroInstance *>(hero);
|
||||
CGI->mh->removeObject(Vhero);
|
||||
std::vector<CGHeroInstance*>::iterator nitr = find(CGI->state->players[player].heroes.begin(), CGI->state->players[player].heroes.end(), Vhero);
|
||||
CGI->state->players[player].heroes.erase(nitr);
|
||||
LOCPLINT->adventureInt->heroList.updateHList();
|
||||
return false;
|
||||
}
|
||||
|
||||
int CCallback::getMySerial()
|
||||
{
|
||||
return gs->players[player].serial;
|
||||
|
@ -35,6 +35,7 @@ public:
|
||||
virtual int getMySerial()=0;
|
||||
virtual int getHeroSerial(const CGHeroInstance * hero)=0;
|
||||
virtual int swapCreatures(const CCreatureSet *s1, const CCreatureSet *s2, int p1, int p2)=0;//swaps creatures between two posiibly different garrisons // TODO: AI-unsafe code - fix it!
|
||||
virtual bool dismissHero(const CGHeroInstance * hero)=0; //dismisses diven hero; true - successfuly, false - not successfuly
|
||||
};
|
||||
|
||||
struct HeroMoveDetails
|
||||
@ -80,6 +81,7 @@ public:
|
||||
int getHeroSerial(const CGHeroInstance * hero);
|
||||
int getMySerial();
|
||||
int swapCreatures(const CCreatureSet *s1, const CCreatureSet *s2, int p1, int p2);
|
||||
bool dismissHero(const CGHeroInstance * hero);
|
||||
|
||||
//friends
|
||||
friend int _tmain(int argc, _TCHAR* argv[]);
|
||||
|
103
CHeroWindow.cpp
103
CHeroWindow.cpp
@ -56,12 +56,27 @@ CHeroWindow::CHeroWindow(int playerColor): artFeet(0), artHead(0), artLHand(0),
|
||||
skillpics = CGI->spriteh->giveDef("pskil42.def");
|
||||
flags = CGI->spriteh->giveDef("CREST58.DEF");
|
||||
//areas
|
||||
portraitArea = new LClickableAreaWText();
|
||||
portraitArea = new LRClickableAreaWText();
|
||||
portraitArea->pos.x = 83;
|
||||
portraitArea->pos.y = 26;
|
||||
portraitArea->pos.w = 58;
|
||||
portraitArea->pos.h = 64;
|
||||
|
||||
for(int v=0; v<4; ++v)
|
||||
{
|
||||
primSkillAreas.push_back(new LRClickableAreaWTextComp());
|
||||
primSkillAreas[v]->pos.x = 95 + 70*v;
|
||||
primSkillAreas[v]->pos.y = 111;
|
||||
primSkillAreas[v]->pos.w = 42;
|
||||
primSkillAreas[v]->pos.h = 42;
|
||||
primSkillAreas[v]->text = CGI->generaltexth->arraytxt[2+v].substr(1, CGI->generaltexth->arraytxt[2+v].size()-2);
|
||||
primSkillAreas[v]->type = v;
|
||||
primSkillAreas[v]->bonus = -1; // to be initilized when hero is being set
|
||||
}
|
||||
expArea = new LRClickableAreaWText();
|
||||
expArea->pos.x = 83;
|
||||
expArea->pos.y = 236;
|
||||
expArea->pos.w = 136;
|
||||
expArea->pos.h = 42;
|
||||
}
|
||||
|
||||
CHeroWindow::~CHeroWindow()
|
||||
@ -112,6 +127,11 @@ CHeroWindow::~CHeroWindow()
|
||||
backpack.clear();
|
||||
|
||||
delete portraitArea;
|
||||
delete expArea;
|
||||
for(int v=0; v<primSkillAreas.size(); ++v)
|
||||
{
|
||||
delete primSkillAreas[v];
|
||||
}
|
||||
}
|
||||
|
||||
void CHeroWindow::show(SDL_Surface *to)
|
||||
@ -164,6 +184,16 @@ void CHeroWindow::setHero(const CGHeroInstance *hero)
|
||||
curHero = hero;
|
||||
portraitArea->text = hero->biography;
|
||||
|
||||
for(int g=0; g<primSkillAreas.size(); ++g)
|
||||
{
|
||||
primSkillAreas[g]->bonus = hero->primSkills[g];
|
||||
}
|
||||
|
||||
char * th = new char[200];
|
||||
sprintf(th, CGI->generaltexth->allTexts[2].substr(1, CGI->generaltexth->allTexts[2].size()-2).c_str(), hero->level, CGI->heroh->reqExp(hero->level+1)-hero->exp, hero->exp);
|
||||
expArea->text = std::string(th);
|
||||
delete [] th;
|
||||
|
||||
delete artFeet;
|
||||
delete artHead;
|
||||
delete artLHand;
|
||||
@ -355,6 +385,12 @@ void CHeroWindow::activate()
|
||||
leftArtRoll->activate();
|
||||
rightArtRoll->activate();
|
||||
portraitArea->activate();
|
||||
expArea->activate();
|
||||
for(int v=0; v<primSkillAreas.size(); ++v)
|
||||
{
|
||||
primSkillAreas[v]->activate();
|
||||
}
|
||||
|
||||
for(int g=0; g<heroListMi.size(); ++g)
|
||||
{
|
||||
heroListMi[g]->activate();
|
||||
@ -424,6 +460,12 @@ void CHeroWindow::deactivate()
|
||||
leftArtRoll->deactivate();
|
||||
rightArtRoll->deactivate();
|
||||
portraitArea->deactivate();
|
||||
expArea->deactivate();
|
||||
for(int v=0; v<primSkillAreas.size(); ++v)
|
||||
{
|
||||
primSkillAreas[v]->deactivate();
|
||||
}
|
||||
|
||||
for(int g=0; g<heroListMi.size(); ++g)
|
||||
{
|
||||
heroListMi[g]->deactivate();
|
||||
@ -480,6 +522,8 @@ void CHeroWindow::deactivate()
|
||||
|
||||
void CHeroWindow::dismissCurrent()
|
||||
{
|
||||
LOCPLINT->cb->dismissHero(curHero);
|
||||
quit();
|
||||
}
|
||||
|
||||
void CHeroWindow::questlog()
|
||||
@ -749,13 +793,43 @@ void LClickableArea::clickLeft(boost::logic::tribool down)
|
||||
}
|
||||
}
|
||||
|
||||
void LClickableAreaWText::clickLeft(boost::logic::tribool down)
|
||||
void RClickableArea::activate()
|
||||
{
|
||||
ClickableR::activate();
|
||||
}
|
||||
void RClickableArea::deactivate()
|
||||
{
|
||||
ClickableR::deactivate();
|
||||
}
|
||||
void RClickableArea::clickRight(boost::logic::tribool down)
|
||||
{
|
||||
if(!down)
|
||||
{
|
||||
LOCPLINT->showInfoDialog("TEST TEST AAA", std::vector<SComponent*>());
|
||||
}
|
||||
}
|
||||
|
||||
void LRClickableAreaWText::clickLeft(boost::logic::tribool down)
|
||||
{
|
||||
if(!down)
|
||||
{
|
||||
LOCPLINT->showInfoDialog(text, std::vector<SComponent*>());
|
||||
}
|
||||
}
|
||||
void LRClickableAreaWText::clickRight(boost::logic::tribool down)
|
||||
{
|
||||
LOCPLINT->adventureInt->handleRightClick(text, down, this);
|
||||
}
|
||||
void LRClickableAreaWText::activate()
|
||||
{
|
||||
LClickableArea::activate();
|
||||
RClickableArea::activate();
|
||||
}
|
||||
void LRClickableAreaWText::deactivate()
|
||||
{
|
||||
LClickableArea::deactivate();
|
||||
RClickableArea::deactivate();
|
||||
}
|
||||
|
||||
void LClickableAreaHero::clickLeft(boost::logic::tribool down)
|
||||
{
|
||||
@ -768,3 +842,26 @@ void LClickableAreaHero::clickLeft(boost::logic::tribool down)
|
||||
owner->activate();
|
||||
}
|
||||
}
|
||||
|
||||
void LRClickableAreaWTextComp::clickLeft(boost::logic::tribool down)
|
||||
{
|
||||
if(!down)
|
||||
{
|
||||
LOCPLINT->showInfoDialog(text, std::vector<SComponent*>(1, new SComponent(SComponent::Etype::primskill, type, bonus)));
|
||||
}
|
||||
}
|
||||
void LRClickableAreaWTextComp::clickRight(boost::logic::tribool down)
|
||||
{
|
||||
LOCPLINT->adventureInt->handleRightClick(text, down, this);
|
||||
}
|
||||
void LRClickableAreaWTextComp::activate()
|
||||
{
|
||||
LClickableArea::activate();
|
||||
RClickableArea::activate();
|
||||
}
|
||||
void LRClickableAreaWTextComp::deactivate()
|
||||
{
|
||||
LClickableArea::deactivate();
|
||||
RClickableArea::deactivate();
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,14 @@ public:
|
||||
virtual void deactivate();
|
||||
};
|
||||
|
||||
class RClickableArea: public ClickableR
|
||||
{
|
||||
public:
|
||||
virtual void clickRight (tribool down);
|
||||
virtual void activate();
|
||||
virtual void deactivate();
|
||||
};
|
||||
|
||||
class LClickableAreaHero : public LClickableArea
|
||||
{
|
||||
public:
|
||||
@ -25,11 +33,25 @@ public:
|
||||
virtual void clickLeft (tribool down);
|
||||
};
|
||||
|
||||
class LClickableAreaWText: public LClickableArea
|
||||
class LRClickableAreaWText: public virtual LClickableArea, public virtual RClickableArea
|
||||
{
|
||||
public:
|
||||
std::string text;
|
||||
virtual void activate();
|
||||
virtual void deactivate();
|
||||
virtual void clickLeft (tribool down);
|
||||
virtual void clickRight (tribool down);
|
||||
};
|
||||
|
||||
class LRClickableAreaWTextComp: public virtual LClickableArea, public virtual RClickableArea
|
||||
{
|
||||
public:
|
||||
std::string text;
|
||||
int bonus, type;
|
||||
virtual void activate();
|
||||
virtual void deactivate();
|
||||
virtual void clickLeft (tribool down);
|
||||
virtual void clickRight (tribool down);
|
||||
};
|
||||
|
||||
class CArtPlace: public ClickableL, public IShowable
|
||||
@ -69,7 +91,9 @@ class CHeroWindow: public IActivable, public IShowable, public virtual CIntObjec
|
||||
std::vector<CArtPlace *> backpack; //hero's visible backpack (only 5 elements!)
|
||||
int backpackPos; //unmber of first art visible in backpack (in hero's vector)
|
||||
//clickable areas
|
||||
LClickableAreaWText * portraitArea;
|
||||
LRClickableAreaWText * portraitArea;
|
||||
std::vector<LRClickableAreaWTextComp *> primSkillAreas;
|
||||
LRClickableAreaWText * expArea;
|
||||
public:
|
||||
int player;
|
||||
CHeroWindow(int playerColor); //c-tor
|
||||
|
@ -49,148 +49,6 @@ void CGeneralTextHandler::load()
|
||||
CGeneralTextHandler::loadToIt(tmp, strin2, itr, 3);
|
||||
jktexts.push_back(tmp);
|
||||
}
|
||||
|
||||
//std::ofstream ofs("arraytxts.txt");
|
||||
//for (int i=0;i<arraytxt.size();i++)
|
||||
// ofs << i <<".\t" << arraytxt[i] << std::endl<< std::endl;
|
||||
/*loadToIt(cantAddManager, buf, i, 2);
|
||||
loadToIt(experienceLimitScenarioReached, buf, i, 2);
|
||||
loadToIt(heroExperienceInfo, buf, i, 2);
|
||||
loadToIt(perDay, buf, i, 2);
|
||||
loadToIt(or, buf, i, 2);
|
||||
loadToIt(somethingVanquished, buf, i, 2);
|
||||
loadToIt(lastTownLostInfo, buf, i, 2);
|
||||
loadToIt(heroesAbandonedYou, buf, i, 2);
|
||||
loadToIt(heroesAbandonedHim, buf, i, 2);
|
||||
loadToIt(couldNotSaveGame, buf, i, 2);
|
||||
loadToIt(errorOpeningFile, buf, i, 2);
|
||||
loadToIt(newgameUppercase, buf, i, 2);
|
||||
loadToIt(sureToDismissArmy, buf, i, 2);
|
||||
loadToIt(playersTurn, buf, i, 2);
|
||||
loadToIt(errorReceivingDataKeepTrying, buf, i, 2);
|
||||
loadToIt(somethingTheSomething, buf, i, 2);
|
||||
loadToIt(recruit, buf, i, 2);
|
||||
loadToIt(noRoomInGarrision, buf, i, 2);
|
||||
loadToIt(numberOFAdventuringHeroes, buf, i, 2);
|
||||
loadToIt(heroWithoutCreatures, buf, i, 2);
|
||||
loadToIt(videoQuality, buf, i, 2);
|
||||
loadToIt(itemCantBeTraded, buf, i, 2);
|
||||
loadToIt(sureDismissHero, buf, i, 2);
|
||||
loadToIt(selectSpellTarget, buf, i, 2);
|
||||
loadToIt(invalidTeleportDestination, buf, i, 2);
|
||||
loadToIt(teleportHere, buf, i, 2);
|
||||
loadToIt(castSomething, buf, i, 2);
|
||||
loadToIt(castSomethingOnSomething, buf, i, 2);
|
||||
loadToIt(sureRetreat, buf, i, 2);
|
||||
loadToIt(notEnoughGold, buf, i, 2);
|
||||
loadToIt(capturedEnemyArtifact, buf, i, 2);
|
||||
loadToIt(none, buf, i, 2);
|
||||
loadToIt(surrenderProposal, buf, i, 2);
|
||||
loadToIt(highMoraleNextAttack, buf, i, 2);
|
||||
loadToIt(lowMoraleFreeze, buf, i, 2);
|
||||
loadToIt(makeRoomInArmyForSomething, buf, i, 2);
|
||||
loadToIt(attackSomethingSomethingDamage, buf, i, 2);
|
||||
loadToIt(shootSomethingOneShootLeftSomethingDamage, buf, i, 2);
|
||||
loadToIt(campaignDescription, buf, i, 2);
|
||||
loadToIt(somethingIsActive, buf, i, 2);
|
||||
loadToIt(sessionName, buf, i, 2);
|
||||
loadToIt(userName, buf, i, 2);
|
||||
loadToIt(creature, buf, i, 2);
|
||||
loadToIt(creatures, buf, i, 2);
|
||||
loadToIt(badLuckOnSomething, buf, i, 2);
|
||||
loadToIt(goodLuckOnSomething, buf, i, 2);
|
||||
loadToIt(treasure, buf, i, 2);
|
||||
loadToIt(somethingSomethingsUnderAttack, buf, i, 2);
|
||||
loadToIt(town, buf, i, 2);
|
||||
loadToIt(hero, buf, i, 2);
|
||||
loadToIt(townScreen, buf, i, 2);
|
||||
loadToIt(cannotBuildBoat, buf, i, 2);
|
||||
loadToIt(requires, buf, i, 2);
|
||||
loadToIt(systemUppercase, buf, i, 2);
|
||||
loadToIt(worldMapHelp, buf, i, 2);
|
||||
loadToIt(sureEndTurnHeroMayMove, buf, i, 2);
|
||||
loadToIt(diggingArtifactWholeDay, buf, i, 2);
|
||||
loadToIt(noRoomForArtifact, buf, i, 2);
|
||||
loadToIt(heroUncoveredThe, buf, i, 2);
|
||||
loadToIt(diggingNothing, buf, i, 2);
|
||||
loadToIt(tryLookingOnLand, buf, i, 2);
|
||||
loadToIt(unchartedTerritory, buf, i, 2);
|
||||
loadToIt(month, buf, i, 2);
|
||||
loadToIt(week, buf, i, 2);
|
||||
loadToIt(day, buf, i, 2);
|
||||
loadToIt(enemyViewTip, buf, i, 2);
|
||||
loadToIt(pingInfo, buf, i, 2);
|
||||
loadToIt(sureToRestart, buf, i, 2);
|
||||
loadToIt(sureToStartNewGame, buf, i, 2);
|
||||
loadToIt(sureQuit, buf, i, 2);
|
||||
loadToIt(dimensionDoorFiled, buf, i, 2);
|
||||
loadToIt(chooseBonus, buf, i, 2);
|
||||
loadToIt(ping, buf, i, 2);
|
||||
loadToIt(pingSomething, buf, i, 2);
|
||||
loadToIt(pingEveryone, buf, i, 2);
|
||||
loadToIt(score, buf, i, 2);
|
||||
loadToIt(autosaveUppercase, buf, i, 2);
|
||||
loadToIt(startingHeroB, buf, i, 2);
|
||||
loadToIt(heroSpecialityB, buf, i, 2);
|
||||
loadToIt(associatedCreaturesB, buf, i, 2);
|
||||
loadToIt(townAlignmentB, buf, i, 2);
|
||||
loadToIt(errorSendingDataKeepTrying, buf, i, 2);
|
||||
loadToIt(tooFewPalyersForMultiGame, buf, i, 2);
|
||||
loadToIt(artifactBonusB, buf, i, 2);
|
||||
loadToIt(goldBonusB, buf, i, 2);
|
||||
loadToIt(resourceBonusB, buf, i, 2);
|
||||
loadToIt(randomBonusB, buf, i, 2);
|
||||
loadToIt(fiveHundredToOneThousand, buf, i, 2);
|
||||
loadToIt(armageddonDamages, buf, i, 2);
|
||||
loadToIt(woodOreBonus, buf, i, 2);
|
||||
loadToIt(randomlyChoosenArtifact, buf, i, 2);
|
||||
loadToIt(disruptingRayReducesDefence, buf, i, 2);
|
||||
loadToIt(goldStartingBonus, buf, i, 2);
|
||||
loadToIt(woodOreStartingBonus, buf, i, 2);
|
||||
loadToIt(randomStartingBonus, buf, i, 2);
|
||||
loadToIt(youEliminatedFormGame, buf, i, 2);
|
||||
loadToIt(scoreToHallOfFame, buf, i, 2);
|
||||
loadToIt(trySearchingOnClearGround, buf, i, 2);
|
||||
loadToIt(sendingData, buf, i, 2);
|
||||
loadToIt(receivingData, buf, i, 2);
|
||||
loadToIt(chaosMp2, buf, i, 2);
|
||||
loadToIt(randomHeroB, buf, i, 2);
|
||||
loadToIt(randomStartingHeroInfo, buf, i, 2);
|
||||
loadToIt(randomTownB, buf, i, 2);
|
||||
loadToIt(randomStartingTownInfo, buf, i, 2);
|
||||
loadToIt(somethingSurrendersInfo, buf, i, 2);
|
||||
loadToIt(heroesCDNotFound, buf, i, 2);
|
||||
loadToIt(autosaving, buf, i, 2);
|
||||
loadToIt(playerexitUppercase, buf, i, 2);
|
||||
loadToIt(statusWindowTip, buf, i, 2);
|
||||
loadToIt(border, buf, i, 2);
|
||||
loadToIt(somethingAbsorbsMana, buf, i, 2);
|
||||
loadToIt(somethingsAbsorbMana, buf, i, 2);
|
||||
loadToIt(unableChangeHeroesDirectory, buf, i, 2);
|
||||
loadToIt(unableFindHeoresDataFiles, buf, i, 2);
|
||||
loadToIt(victoryAchievementText, buf, i, 2);
|
||||
loadToIt(somethingsRiseFromDeath, buf, i, 2);
|
||||
loadToIt(somethingRisesFormDeath, buf, i, 2);
|
||||
loadToIt(somethingDiesUnderGaze, buf, i, 2);
|
||||
loadToIt(somethingsDieUnderGaze, buf, i, 2);
|
||||
loadToIt(somethingTakesDefensiveStance, buf, i, 2);
|
||||
loadToIt(somethingsTakeDefensiveStance, buf, i, 2);
|
||||
loadToIt(somethingExp, buf, i, 2);
|
||||
loadToIt(nearestTownOccupied, buf, i, 2);
|
||||
loadToIt(noAvailableTown, buf, i, 2);
|
||||
loadToIt(heroTooTiredSpell, buf, i, 2);
|
||||
loadToIt(townGateCannotBeUsed, buf, i, 2);
|
||||
loadToIt(youHaveNoHeroes, buf, i, 2);
|
||||
loadToIt(heroHasCastSpell, buf, i, 2);
|
||||
loadToIt(requires, buf, i, 2);
|
||||
loadToIt(requires, buf, i, 2);
|
||||
loadToIt(requires, buf, i, 2);
|
||||
loadToIt(requires, buf, i, 2);
|
||||
loadToIt(requires, buf, i, 2);
|
||||
loadToIt(requires, buf, i, 2);
|
||||
loadToIt(requires, buf, i, 2);
|
||||
loadToIt(requires, buf, i, 2);
|
||||
loadToIt(requires, buf, i, 2);*/
|
||||
}
|
||||
|
||||
|
||||
|
@ -134,6 +134,21 @@ void CHeroHandler::loadHeroes()
|
||||
loadBiographies();
|
||||
loadHeroClasses();
|
||||
initHeroClasses();
|
||||
expPerLevel.push_back(0);
|
||||
expPerLevel.push_back(1000);
|
||||
expPerLevel.push_back(2000);
|
||||
expPerLevel.push_back(3200);
|
||||
expPerLevel.push_back(4500);
|
||||
expPerLevel.push_back(6000);
|
||||
expPerLevel.push_back(7700);
|
||||
expPerLevel.push_back(9000);
|
||||
expPerLevel.push_back(11000);
|
||||
expPerLevel.push_back(13200);
|
||||
expPerLevel.push_back(15500);
|
||||
expPerLevel.push_back(18500);
|
||||
expPerLevel.push_back(22100);
|
||||
expPerLevel.push_back(26420);
|
||||
expPerLevel.push_back(31604);
|
||||
return;
|
||||
|
||||
}
|
||||
@ -453,33 +468,61 @@ unsigned int CHeroInstance::getTileCost(EterrainType & ttype, Eroad & rdtype, Er
|
||||
|
||||
unsigned int CHeroHandler::level(unsigned int experience)
|
||||
{
|
||||
if (experience==0)
|
||||
return 0;
|
||||
else if (experience<14700) //level < 10
|
||||
//if (experience==0)
|
||||
// return 0;
|
||||
//else if (experience<14700) //level < 10
|
||||
//{
|
||||
// return (-500+20*sqrt((float)experience+1025))/(200);
|
||||
//}
|
||||
//else if (experience<24320) //10 - 12
|
||||
//{
|
||||
// if (experience>20600)
|
||||
// return 12;
|
||||
// else if (experience>17500)
|
||||
// return 11;
|
||||
// else return 10;
|
||||
//}
|
||||
//else //>12
|
||||
//{
|
||||
// int lvl=12;
|
||||
// int xp = 24320; //xp needed for 13 lvl
|
||||
// int td = 4464; //diff 14-13
|
||||
// float mp = 1.2;
|
||||
// while (experience>xp)
|
||||
// {
|
||||
// xp+=td;
|
||||
// td*=mp;
|
||||
// lvl++;
|
||||
// }
|
||||
// return lvl;
|
||||
//}
|
||||
int add=0;
|
||||
while(experience>=expPerLevel[expPerLevel.size()-1])
|
||||
{
|
||||
return (-500+20*sqrt((float)experience+1025))/(200);
|
||||
experience/=1.2;
|
||||
add+1;
|
||||
}
|
||||
else if (experience<24320) //10 - 12
|
||||
for(int i=expPerLevel.size()-1; i>=0; --i)
|
||||
{
|
||||
if (experience>20600)
|
||||
return 12;
|
||||
else if (experience>17500)
|
||||
return 11;
|
||||
else return 10;
|
||||
if(experience>=expPerLevel[i])
|
||||
return i+add;
|
||||
}
|
||||
else //>12
|
||||
}
|
||||
|
||||
unsigned int CHeroHandler::reqExp(unsigned int level)
|
||||
{
|
||||
level-=1;
|
||||
if(level<=expPerLevel.size())
|
||||
return expPerLevel[level];
|
||||
else
|
||||
{
|
||||
int lvl=12;
|
||||
int xp = 24320; //xp needed for 13 lvl
|
||||
int td = 4464; //diff 14-13
|
||||
float mp = 1.2;
|
||||
while (experience>xp)
|
||||
unsigned int exp = expPerLevel[expPerLevel.size()-1];
|
||||
level-=expPerLevel.size();
|
||||
while(level>0)
|
||||
{
|
||||
xp+=td;
|
||||
td*=mp;
|
||||
lvl++;
|
||||
--level;
|
||||
exp*=1.2;
|
||||
}
|
||||
return lvl;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,9 @@ public:
|
||||
CDefHandler * pskillsb, *resources; //82x93
|
||||
CDefHandler * un44; //many things
|
||||
std::vector<std::string> pskillsn;
|
||||
std::vector<int> expPerLevel; //expPerLEvel[i] is amount of exp needed to reach level i; if it is not in this vector, multiplicate last value by 1,2 to get next value
|
||||
unsigned int level(unsigned int experience);
|
||||
unsigned int reqExp(unsigned int level);
|
||||
void loadHeroes();
|
||||
void loadSpecialAbilities();
|
||||
void loadBiographies();
|
||||
|
Loading…
Reference in New Issue
Block a user