浏览代码

1. All Ceature Banks now have correct configs.
2. Pyramid is fully supported.
3. Minor Pandora fix.

DjWarmonger 16 年之前
父节点
当前提交
62cb72975c
共有 3 个文件被更改,包括 59 次插入47 次删除
  1. 4 4
      config/bankconfig.txt
  2. 51 39
      hch/CObjectHandler.cpp
  3. 4 4
      hch/CObjectHandler.h

+ 4 - 4
config/bankconfig.txt

@@ -45,10 +45,10 @@ Dragon Utopia	1	30%	8	Green Dragons	0%	5	Red Dragons	2	Gold Dragons	1	Black Drag
  	2	30%	8	Green Dragons	0%	6	Red Dragons	3	Gold Dragons	2	Black Dragons	2209	0	0	0	0	0	0	30000	0	None	0	1	1	2	57000	26	125%
  	3	30%	8	Green Dragons	0%	6	Red Dragons	4	Gold Dragons	3	Black Dragons	2556	0	0	0	0	0	0	40000	0	None	0	0	1	3	75000	29	145%
  	4	10%	8	Green Dragons	0%	7	Red Dragons	6	Gold Dragons	5	Black Dragons	3343	0	0	0	0	0	0	50000	0	None	0	0	0	4	90000	27	189%
-Hunting Lodge	1	30%	3	Dendroid	0%	4	Wood Elf	3	Dendroid	4	Wood Elf	100	15	0	0	0	0	0	500	0	None	0	0	0	0	2000	20	100%
- 	2	30%	4	Dendroid	0%	6	Wood Elf	4	Dendroid	6	Wood Elf	150	20	0	0	0	0	0	500	0	None	0	0	0	0	3000	20	100%
- 	3	30%	5	Dendroid	0%	8	Wood Elf	5	Dendroid	8	Wood Elf	200	25	0	0	0	0	0	500	0	None	0	0	0	0	4000	20	150%
- 	4	10%	6	Dendroid Soldier	100%	10	Grand Elf	6	Dendroid Soldier	10	Grand Elf	300	40	0	0	0	0	0	1000	0	None	0	0	0	0	6000	20	200%
+Hunting Lodge	1	30%	3	Dendroid Guard Guard Guard	0%	4	Wood Elf	3	Dendroid Guard	4	Wood Elf	100	15	0	0	0	0	0	500	0	None	0	0	0	0	2000	20	100%
+ 	2	30%	4	Dendroid Guard	0%	6	Wood Elf	4	Dendroid Guard	6	Wood Elf	150	20	0	0	0	0	0	500	0	None	0	0	0	0	3000	20	100%
+ 	3	30%	5	Dendroid Guard	0%	8	Wood Elf	5	Dendroid Guard	8	Wood Elf	200	25	0	0	0	0	0	500	0	None	0	0	0	0	4000	20	150%
+ 	4	10%	6	Dendroid Guard	100%	10	Wood Elf	6	Dendroid Guard	10	Wood Elf	300	40	0	0	0	0	0	1000	0	None	0	0	0	0	6000	20	200%
 Snow-covered Grotto	1	30%	5	Iron Golem	0%	20	Master Gremlin	5	Iron Golem	20	Master Gremlin	100	0	0	15	0	0	0	500	0	None	0	0	0	0	2000	20	100%
  	2	30%	6	Iron Golem	0%	30	Master Gremlin	6	Iron Golem	30	Master Gremlin	150	0	0	20	0	0	0	500	0	None	0	0	0	0	3000	20	100%
  	3	30%	7	Iron Golem	0%	40	Master Gremlin	7	Iron Golem	40	Master Gremlin	200	0	0	30	0	0	0	500	0	None	0	0	0	0	4000	20	150%

+ 51 - 39
hch/CObjectHandler.cpp

@@ -3429,33 +3429,35 @@ void CGPandoraBox::giveContents( const CGHeroInstance *h, bool afterBattle ) con
 	}
 
 	//check if creatures can be moved to hero army
-	CCreatureSet heroArmy = h->army;
-	CCreatureSet ourArmy = creatures;
-	while(ourArmy.slots.size() > 0)
-	{
-		int slot = heroArmy.getSlotFor(ourArmy.slots.begin()->second.first);
-		if(slot < 0)
-			break;
+	if (creatures.slots.size())
+		{
+		CCreatureSet heroArmy = h->army;
+		CCreatureSet ourArmy = creatures;
+		while(ourArmy.slots.size() > 0)
+		{
+			int slot = heroArmy.getSlotFor(ourArmy.slots.begin()->second.first);
+			if(slot < 0)
+				break;
 
-		heroArmy.slots[slot].first = ourArmy.slots.begin()->second.first;
-		heroArmy.slots[slot].second += ourArmy.slots.begin()->second.second;
-		ourArmy.slots.erase(ourArmy.slots.begin());
-	}
+			heroArmy.slots[slot].first = ourArmy.slots.begin()->second.first;
+			heroArmy.slots[slot].second += ourArmy.slots.begin()->second.second;
+			ourArmy.slots.erase(ourArmy.slots.begin());
+		}
 
-	if(ourArmy.slots.size() > 0) //all creatures can be moved to hero army - do that
-	{
-		SetGarrisons sg;
-		sg.garrs[h->id] = heroArmy;
-		cb->sendAndApply(&sg);
-	}
-	else //show garrison window and let player pick creatures
-	{
-		SetGarrisons sg;
-		sg.garrs[id] = creatures;
-		cb->sendAndApply(&sg);
-		cb->showGarrisonDialog(id,h->id,true,boost::bind(&IGameCallback::removeObject,cb,id));
+		if(ourArmy.slots.size() > 0) //all creatures can be moved to hero army - do that
+		{
+			SetGarrisons sg;
+			sg.garrs[h->id] = heroArmy;
+			cb->sendAndApply(&sg);
+		}
+		else //show garrison window and let player pick creatures
+		{
+			SetGarrisons sg;
+			sg.garrs[id] = creatures;
+			cb->sendAndApply(&sg);
+			cb->showGarrisonDialog(id,h->id,true,boost::bind(&IGameCallback::removeObject,cb,id));
+		}
 	}
-
 	if(!afterBattle && message.size())
 	{
 		iw.text << message;
@@ -4060,17 +4062,14 @@ void CBank::newTurn() const
 {
 	if (bc == NULL)
 	{
-		if (daycounter >= 28 || cb->getDate(0) == 1)
+		if (cb->getDate(0) == 1)
+			cb->setObjProperty (id, 14, ran()); //initialize on first day
+		else if (daycounter >= 28 && (subID < 13 || subID > 16)) //no reset for Emissaries
 		{
-			if (subID < 13 || subID > 16) //no reset for Emissaries
-			{
-				cb->setObjProperty (id, 11, 0); //daycounter 0
-				cb->setObjProperty (id, 14, ran()); //reset
-				if (ID == 24 && cb->getDate(0) > 1)
-				{
-					cb->setObjProperty (id, 16, 0);; //derelict ships are usable only once
-				}
-			}
+			cb->setObjProperty (id, 14, ran()); //reset
+			cb->setObjProperty (id, 11, 0); //daycounter 0
+			if (ID == 24 && cb->getDate(0) > 1)
+				cb->setObjProperty (id, 16, 0); //derelict ships are usable only once
 		}
 		else
 			cb->setObjProperty (id, 11, 1); //daycounter++
@@ -4269,6 +4268,15 @@ void CGPyramid::initObj()
 	cb->getAllowedSpells (available, 5);
 	spell = (available[rand()%available.size()]);
 }
+const std::string & CGPyramid::getHoverText() const
+{
+	hoverName = VLC->generaltexth->names[ID];
+	if (bc == NULL)
+		hoverName += " " + VLC->generaltexth->allTexts[352];
+	else
+		hoverName += " " + VLC->generaltexth->allTexts[353];
+	return hoverName;
+}
 void CGPyramid::onHeroVisit (const CGHeroInstance * h) const
 {
 	if (bc)
@@ -4282,10 +4290,12 @@ void CGPyramid::onHeroVisit (const CGHeroInstance * h) const
 	else
 	{
 		InfoWindow iw;
+		iw.player = h->getOwner();
 		iw.text << VLC->generaltexth->advobtxt[107];
 		iw.components.push_back (Component (Component::LUCK, 0 , -2, 0));
 		GiveBonus gb;
-		gb.bonus = HeroBonus(HeroBonus::ONE_BATTLE,HeroBonus::LUCK,HeroBonus::OBJECT,-2,id,VLC->generaltexth->arraytxt[ID]);
+		gb.bonus = HeroBonus(HeroBonus::ONE_BATTLE,HeroBonus::LUCK,HeroBonus::OBJECT,-2,id,VLC->generaltexth->arraytxt[70]);
+		gb.hid = h->id;
 		cb->giveHeroBonus(&gb);
 		cb->showInfoDialog(&iw);
 	}
@@ -4296,12 +4306,13 @@ void CGPyramid::endBattle (const CGHeroInstance *h, const BattleResult *result)
 	if (result->winner == 0)
 	{
 		InfoWindow iw;
+		iw.player = h->getOwner();
 		iw.text.addTxt (MetaString::ADVOB_TXT, 106);
 		iw.text.addTxt (MetaString::SPELL_NAME, spell);
-		if (!h->getArt(17)) //no spellbook
-			iw.text.addTxt (MetaString::ADVOB_TXT, 109);
-		else if (h->getSecSkillLevel(7) < 3) //no expert Wisdom
-			iw.text.addTxt (MetaString::ADVOB_TXT, 108);
+		if (!h->getArt(17))						
+			iw.text.addTxt (MetaString::ADVOB_TXT, 109); //no spellbook
+		else if (h->getSecSkillLevel(7) < 3)	
+			iw.text.addTxt (MetaString::ADVOB_TXT, 108); //no expert Wisdom
 		else
 		{
 			std::set<ui32> spells;
@@ -4310,6 +4321,7 @@ void CGPyramid::endBattle (const CGHeroInstance *h, const BattleResult *result)
 				iw.components.push_back(Component (Component::SPELL, spell, 0, 0));
 		}
 		cb->showInfoDialog(&iw);
+		cb->setObjProperty (id, 15, 0);
 	}
 }
 void CGKeys::setPropertyDer (ui8 what, ui32 val) //101-108 - enable key for player 1-8

+ 4 - 4
hch/CObjectHandler.h

@@ -902,9 +902,9 @@ class DLL_EXPORT CBank : public CArmedInstance
 	void setPropertyDer (ui8 what, ui32 val);
 	void reset(ui16 var1, ui16 var2);
 	void newTurn() const;
-	void onHeroVisit (const CGHeroInstance * h) const;
-	void fightGuards (const CGHeroInstance *h, ui32 accept) const;
-	void endBattle (const CGHeroInstance *h, const BattleResult *result) const;
+	virtual void onHeroVisit (const CGHeroInstance * h) const;
+	virtual void fightGuards (const CGHeroInstance *h, ui32 accept) const;
+	virtual void endBattle (const CGHeroInstance *h, const BattleResult *result) const;
 
 	template <typename Handler> void serialize(Handler &h, const int version)
 	{
@@ -919,9 +919,9 @@ public:
 	ui16 spell;
 
 	void initObj();
+	const std::string & getHoverText() const;
 	void newTurn() const {}; //empty, no reset
 	void onHeroVisit (const CGHeroInstance * h) const;
-	void fightGuards (const CGHeroInstance *h, ui32 accept) const {};
 	void endBattle (const CGHeroInstance *h, const BattleResult *result) const;
 
 	template <typename Handler> void serialize(Handler &h, const int version)