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

Various fixes.

This commit is contained in:
DjWarmonger 2011-02-13 19:46:16 +00:00
parent adb1d9181d
commit 4dc258521b
2 changed files with 23 additions and 12 deletions

View File

@ -645,7 +645,7 @@ void CCreatureHandler::loadCreatures()
addBonusForAllCreatures(b); //health bonus is common for all addBonusForAllCreatures(b); //health bonus is common for all
loadToIt (dump2, buf, it, 3); //crop comment loadToIt (dump2, buf, it, 3); //crop comment
for (i = 1; i < 8; ++i) for (i = 1; i < 7; ++i)
{ {
for (int j = 0; j < 4; ++j) //four modifiers common for tiers for (int j = 0; j < 4; ++j) //four modifiers common for tiers
{ {
@ -657,6 +657,18 @@ void CCreatureHandler::loadCreatures()
loadToIt (dump2, buf, it, 3); //crop comment loadToIt (dump2, buf, it, 3); //crop comment
} }
} }
for (int j = 0; j < 4; ++j) //tier 7
{
loadToIt (dump2, buf, it, 4); //ignore index
bl.clear();
loadStackExp(b, bl, buf, it);
BOOST_FOREACH(Bonus * b, bl)
{
addBonusForTier(7, b);
creaturesOfLevel[0].addNewBonus(b); //bonuses from level 7 are given to high-level creatures
}
loadToIt (dump2, buf, it, 3); //crop comment
}
do //parse everything that's left do //parse everything that's left
{ {
loadToIt(creid, buf, it, 4); //get index loadToIt(creid, buf, it, 4); //get index
@ -710,8 +722,9 @@ void CCreatureHandler::loadCreatures()
creatures[56].get()->addBonus(-50, Bonus::EXP_MULTIPLIER, -1); creatures[56].get()->addBonus(-50, Bonus::EXP_MULTIPLIER, -1);
creatures[57].get()->addBonus(-50, Bonus::EXP_MULTIPLIER, -1); creatures[57].get()->addBonus(-50, Bonus::EXP_MULTIPLIER, -1);
//exp for tier >7, rank 11 //exp for tier >7, rank 11
expRanks[0].push_back(14700); expRanks[0].push_back(147000);
expAfterUpgrade = 75; //percent expAfterUpgrade = 75; //percent
maxExpPerBattle[0] = maxExpPerBattle[7];
}//end of Stack Experience }//end of Stack Experience
//experiment - add 100 to attack for creatures of tier 1 //experiment - add 100 to attack for creatures of tier 1
@ -790,7 +803,7 @@ void CCreatureHandler::loadUnitAnimInfo(CCreature & unit, std::string & src, int
} }
void CCreatureHandler::loadStackExp(Bonus & b, BonusList & bl, std::string & src, int & it) //help function for parsing CREXPBON.txt void CCreatureHandler::loadStackExp(Bonus & b, BonusList & bl, std::string & src, int & it) //help function for parsing CREXPBON.txt
{ //TODO: handle rank limiters {
std::string buf, mod; std::string buf, mod;
bool enable = false; //some bonuses are activated with values 2 or 1 bool enable = false; //some bonuses are activated with values 2 or 1
loadToIt(buf, src, it, 4); loadToIt(buf, src, it, 4);
@ -819,9 +832,7 @@ void CCreatureHandler::loadStackExp(Bonus & b, BonusList & bl, std::string & src
b.subtype = 1; b.subtype = 1;
break; break;
case 'S': case 'S':
b.type = Bonus::STACKS_SPEED; b.type = Bonus::STACKS_SPEED; break;
b.additionalInfo = 0;
break;
case 'b': case 'b':
b.type = Bonus::ENEMY_DEFENCE_REDUCTION; break; b.type = Bonus::ENEMY_DEFENCE_REDUCTION; break;
@ -871,7 +882,6 @@ void CCreatureHandler::loadStackExp(Bonus & b, BonusList & bl, std::string & src
b.type = Bonus::FREE_SHOOTING; break; b.type = Bonus::FREE_SHOOTING; break;
case 'u': case 'u':
b.type = Bonus::SPELL_RESISTANCE_AURA; break; b.type = Bonus::SPELL_RESISTANCE_AURA; break;
break;
case 'U': case 'U':
b.type = Bonus::UNDEAD; break; b.type = Bonus::UNDEAD; break;
default: default:
@ -911,7 +921,7 @@ void CCreatureHandler::loadStackExp(Bonus & b, BonusList & bl, std::string & src
b.type = Bonus::SPELL_IMMUNITY; b.type = Bonus::SPELL_IMMUNITY;
b.subtype = 54; b.subtype = 54;
break; break;
case '6': //problem - in VCMI value represents level, here it represents on/off case '6':
case '7': case '7':
case '8': case '8':
case '9': case '9':

View File

@ -452,7 +452,7 @@ int CStackInstance::getExpRank() const
} }
else //higher tier else //higher tier
{ {
for (int i = VLC->creh->expRanks[tier].size()-2; i >-1; --i) for (int i = VLC->creh->expRanks[0].size()-2; i >-1; --i)
{ {
if (experience >= VLC->creh->expRanks[0][i]) if (experience >= VLC->creh->expRanks[0][i])
return ++i; return ++i;
@ -468,10 +468,11 @@ void CStackInstance::giveStackExp(expType exp)
level = 0; level = 0;
CCreatureHandler * creh = VLC->creh; CCreatureHandler * creh = VLC->creh;
ui32 maxExp = creh->expRanks[level].back();
amin(exp, (expType)creh->expRanks[level].back()); //prevent exp overflow due to different types amin(exp, (expType)maxExp); //prevent exp overflow due to different types
amin(exp, (exp * creh->maxExpPerBattle[level])/100); amin(exp, (maxExp * creh->maxExpPerBattle[level])/100);
amin(experience += exp, creh->expRanks[level].back()); //can't get more exp than this limit amin(experience += exp, maxExp); //can't get more exp than this limit
} }
void CStackInstance::setType(int creID) void CStackInstance::setType(int creID)