1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-10-08 23:22:25 +02:00

Now parsing CREXPBON into Bonus System, with limiters. StackExperience class removed.

Exp ranks are now calculated, though exp is never set.
This commit is contained in:
DjWarmonger
2011-02-11 08:20:26 +00:00
parent d630d88ac1
commit c0f2b3f32b
6 changed files with 149 additions and 57 deletions

View File

@@ -430,6 +430,29 @@ int CStackInstance::getQuantityID() const
return CCreature::getQuantityID(count);
}
int CStackInstance::getExpRank() const
{
int tier = type->level;
if (isbetw(tier, 1, 7))
{
for (int i = VLC->creh->expRanks[tier].size()-2; i >-1; --i)//sic!
{ //exp values vary from 1st level to max exp at 11th level
if (experience >= VLC->creh->expRanks[tier][i])
return ++i; //faster, but confusing - 0 index mean 1st level of experience
}
return 0;
}
else //higher tier
{
for (int i = VLC->creh->expRanks[tier].size()-2; i >-1; --i)
{
if (experience >= VLC->creh->expRanks[0][i])
return ++i;
}
return 0;
}
}
void CStackInstance::setType(int creID)
{
setType(VLC->creh->creatures[creID]);