瀏覽代碼

* fix for #123 (I hope)

mateuszb 15 年之前
父節點
當前提交
2fdc53594b
共有 4 個文件被更改,包括 6 次插入2 次删除
  1. 1 1
      hch/CObjectHandler.h
  2. 2 1
      lib/NetPacks.h
  3. 2 0
      lib/NetPacksLib.cpp
  4. 1 0
      server/CGameHandler.cpp

+ 1 - 1
hch/CObjectHandler.h

@@ -306,7 +306,7 @@ public:
 	static int3 convertPosition(int3 src, bool toh3m); //toh3m=true: manifest->h3m; toh3m=false: h3m->manifest
 	double getHeroStrength() const;
 	int getTotalStrength() const;
-	ui8 getSpellSchoolLevel(const CSpell * spell) const; //returns level on which given spell would be cast by this hero
+	ui8 getSpellSchoolLevel(const CSpell * spell) const; //returns level on which given spell would be cast by this hero (0 - none, 1 - basic etc)
 	bool canCastThisSpell(const CSpell * spell) const; //determines if this hero can cast given spell; takes into account existing spell in spellbook, existing spellbook and artifact bonuses
 	std::pair<ui32, si32> calculateNecromancy (const BattleResult &battleResult) const;
 	void showNecromancyDialog (std::pair<ui32, si32> raisedStack) const;

+ 2 - 1
lib/NetPacks.h

@@ -1000,9 +1000,10 @@ struct StacksHealedOrResurrected : public CPackForClient //3013
 	{
 		ui32 stackID;
 		ui32 healedHP;
+		ui8 lowLevelResurrection; //in case this stack is resurrected by this heal, it will be marked as SUMMONED
 		template <typename Handler> void serialize(Handler &h, const int version)
 		{
-			h & stackID & healedHP;
+			h & stackID & healedHP & lowLevelResurrection;
 		}
 	};
 

+ 2 - 0
lib/NetPacksLib.cpp

@@ -1045,6 +1045,8 @@ DLL_EXPORT void StacksHealedOrResurrected::applyGs( CGameState *gs )
 		if(!changedStack->alive())
 		{
 			changedStack->state.insert(ALIVE);
+			if(healedStacks[g].lowLevelResurrection)
+				changedStack->features.push_back( makeFeature(StackFeature::SUMMONED, StackFeature::WHOLE_BATTLE, 0, 0, StackFeature::BONUS_FROM_HERO) );
 		}
 		int missingHPfirst = changedStack->MaxHealth() - changedStack->firstHPleft;
 		int res = std::min( healedStacks[g].healedHP / changedStack->MaxHealth() , changedStack->baseAmount - changedStack->amount );

+ 1 - 0
server/CGameHandler.cpp

@@ -3184,6 +3184,7 @@ bool CGameHandler::makeCustomAction( BattleAction &ba )
 						StacksHealedOrResurrected::HealInfo hi;
 						hi.stackID = (*it)->ID;
 						hi.healedHP = calculateHealedHP(h, s, *it);
+						hi.lowLevelResurrection = h->getSpellSchoolLevel(s) <= 1;
 						shr.healedStacks.push_back(hi);
 					}
 					if(!shr.healedStacks.empty())