瀏覽代碼

Little more events
[Still need more work]

Michał W. Urbańczyk 16 年之前
父節點
當前提交
a81378617f
共有 1 個文件被更改,包括 18 次插入2 次删除
  1. 18 2
      hch/CObjectHandler.cpp

+ 18 - 2
hch/CObjectHandler.cpp

@@ -2308,9 +2308,25 @@ void CGEvent::giveContents( const CGHeroInstance *h, bool afterBattle ) const
 
 	}
 
+	if(spells.size())
+	{
+		std::set<ui32> spellsToGive;
+		iw.components.clear();
+		for(int i=0; i<spells.size(); i++)
+		{
+			iw.components.push_back(Component(Component::SPELL,spells[i],0,0));
+			spellsToGive.insert(spells[i]);
+		}
+		if(spellsToGive.size())
+		{
+			cb->changeSpells(h->id,true,spellsToGive);
+			cb->showInfoDialog(&iw);
+		}
+	}
+
 	if(manaDiff)
 	{
-		getText(iw,afterBattle,luckDiff,176,177,h);
+		getText(iw,afterBattle,manaDiff,176,177,h);
 		iw.components.push_back(Component(Component::PRIM_SKILL,5,manaDiff,0));
 		cb->showInfoDialog(&iw);
 		cb->setManaPoints(h->id, h->mana + manaDiff);
@@ -2318,7 +2334,7 @@ void CGEvent::giveContents( const CGHeroInstance *h, bool afterBattle ) const
 
 	if(moraleDiff)
 	{
-		getText(iw,afterBattle,luckDiff,178,179,h);
+		getText(iw,afterBattle,moraleDiff,178,179,h);
 		iw.components.push_back(Component(Component::MORALE,0,moraleDiff,0));
 		cb->showInfoDialog(&iw);
 		GiveBonus gb;