1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

* fix for #123 (I hope)

This commit is contained in:
mateuszb 2010-01-29 16:35:05 +00:00
parent 23a32ebf7a
commit 2fdc53594b
4 changed files with 6 additions and 2 deletions

View File

@ -306,7 +306,7 @@ public:
static int3 convertPosition(int3 src, bool toh3m); //toh3m=true: manifest->h3m; toh3m=false: h3m->manifest static int3 convertPosition(int3 src, bool toh3m); //toh3m=true: manifest->h3m; toh3m=false: h3m->manifest
double getHeroStrength() const; double getHeroStrength() const;
int getTotalStrength() 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 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; std::pair<ui32, si32> calculateNecromancy (const BattleResult &battleResult) const;
void showNecromancyDialog (std::pair<ui32, si32> raisedStack) const; void showNecromancyDialog (std::pair<ui32, si32> raisedStack) const;

View File

@ -1000,9 +1000,10 @@ struct StacksHealedOrResurrected : public CPackForClient //3013
{ {
ui32 stackID; ui32 stackID;
ui32 healedHP; 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) template <typename Handler> void serialize(Handler &h, const int version)
{ {
h & stackID & healedHP; h & stackID & healedHP & lowLevelResurrection;
} }
}; };

View File

@ -1045,6 +1045,8 @@ DLL_EXPORT void StacksHealedOrResurrected::applyGs( CGameState *gs )
if(!changedStack->alive()) if(!changedStack->alive())
{ {
changedStack->state.insert(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 missingHPfirst = changedStack->MaxHealth() - changedStack->firstHPleft;
int res = std::min( healedStacks[g].healedHP / changedStack->MaxHealth() , changedStack->baseAmount - changedStack->amount ); int res = std::min( healedStacks[g].healedHP / changedStack->MaxHealth() , changedStack->baseAmount - changedStack->amount );

View File

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