ソースを参照

Various fixes.

DjWarmonger 14 年 前
コミット
4dc258521b
2 ファイル変更23 行追加12 行削除
  1. 18 8
      lib/CCreatureHandler.cpp
  2. 5 4
      lib/CCreatureSet.cpp

+ 18 - 8
lib/CCreatureHandler.cpp

@@ -645,7 +645,7 @@ void CCreatureHandler::loadCreatures()
 			addBonusForAllCreatures(b); //health bonus is common for all
 
 		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
 			{
@@ -657,6 +657,18 @@ void CCreatureHandler::loadCreatures()
 				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
 		{
 			loadToIt(creid, buf, it, 4); //get index
@@ -710,8 +722,9 @@ void CCreatureHandler::loadCreatures()
 			creatures[56].get()->addBonus(-50, Bonus::EXP_MULTIPLIER, -1);
 			creatures[57].get()->addBonus(-50, Bonus::EXP_MULTIPLIER, -1);
 		//exp for tier >7, rank 11
-			expRanks[0].push_back(14700);
+			expRanks[0].push_back(147000);
 			expAfterUpgrade = 75; //percent
+			maxExpPerBattle[0] = maxExpPerBattle[7];
 
 	}//end of Stack Experience
 	//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
-{ //TODO: handle rank limiters
+{
 	std::string buf, mod;
 	bool enable = false; //some bonuses are activated with values 2 or 1
 	loadToIt(buf, src, it, 4);
@@ -819,9 +832,7 @@ void CCreatureHandler::loadStackExp(Bonus & b, BonusList & bl, std::string & src
 		b.subtype = 1;
 		break;
 	case 'S':
-		b.type = Bonus::STACKS_SPEED;
-		b.additionalInfo = 0;
-		break;
+		b.type = Bonus::STACKS_SPEED; break;
 
 	case 'b':
 		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;
 			case 'u':
 				b.type = Bonus::SPELL_RESISTANCE_AURA; break;
-				break;
 			case 'U':
 				b.type = Bonus::UNDEAD; break;
 			default:
@@ -911,7 +921,7 @@ void CCreatureHandler::loadStackExp(Bonus & b, BonusList & bl, std::string & src
 				b.type = Bonus::SPELL_IMMUNITY;
 				b.subtype = 54;
 				break;
-			case '6': //problem - in VCMI value represents level, here it represents on/off
+			case '6':
 			case '7':
 			case '8':
 			case '9':

+ 5 - 4
lib/CCreatureSet.cpp

@@ -452,7 +452,7 @@ int CStackInstance::getExpRank() const
 	}
 	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])
 				return ++i;
@@ -468,10 +468,11 @@ void CStackInstance::giveStackExp(expType exp)
 		level = 0;
 
 	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, (exp * creh->maxExpPerBattle[level])/100);
-	amin(experience += exp, creh->expRanks[level].back()); //can't get more exp than this limit
+	amin(exp, (expType)maxExp); //prevent exp overflow due to different types
+	amin(exp, (maxExp * creh->maxExpPerBattle[level])/100);
+	amin(experience += exp, maxExp); //can't get more exp than this limit
 }
 
 void CStackInstance::setType(int creID)