Browse Source

Yog is not able to buy a spellbook in his campaign anymore, as intended (#472)

* Yog is not able to buy a spellbook in his campaign anymore, as intended
yupinov 7 years ago
parent
commit
b56f862094
1 changed files with 12 additions and 1 deletions
  1. 12 1
      client/windows/CCastleInterface.cpp

+ 12 - 1
client/windows/CCastleInterface.cpp

@@ -37,6 +37,8 @@
 #include "../../lib/spells/CSpellHandler.h"
 #include "../../lib/CTownHandler.h"
 #include "../../lib/GameConstants.h"
+#include "../../lib/StartInfo.h"
+#include "../../lib/mapping/CCampaignHandler.h"
 #include "../../lib/mapObjects/CGHeroInstance.h"
 #include "../../lib/mapObjects/CGTownInstance.h"
 
@@ -874,7 +876,16 @@ void CCastleBuildings::enterMagesGuild()
 
 	if(hero && !hero->hasSpellbook()) //hero doesn't have spellbok
 	{
-		if(LOCPLINT->cb->getResourceAmount(Res::GOLD) < 500) //not enough gold to buy spellbook
+		const StartInfo *si = LOCPLINT->cb->getStartInfo();
+		// it would be nice to find a way to move this hack to config/mapOverrides.json
+		if(si && si->campState && si->campState->camp &&                // We're in campaign,
+			(si->campState->camp->header.filename == "DATA/YOG.H3C") && // which is "Birth of a Barbarian",
+			(hero->subID == 45))                                        // and the hero is Yog (based on Solmyr)
+		{
+			// "Yog has given up magic in all its forms..."
+			LOCPLINT->showInfoDialog(CGI->generaltexth->allTexts[736]);
+		}
+		else if(LOCPLINT->cb->getResourceAmount(Res::GOLD) < 500) //not enough gold to buy spellbook
 		{
 			openMagesGuild();
 			LOCPLINT->showInfoDialog(CGI->generaltexth->allTexts[213]);