mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-06 09:09:40 +02:00
Fixed total spell immunity granted by 2212.
Improvements for Life Drain.
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
#include "../vcmi/lib/HeroBonus.h"
|
#include "../vcmi/lib/HeroBonus.h"
|
||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <list>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ExpertSystem.h, part of VCMI engine
|
* ExpertSystem.h, part of VCMI engine
|
||||||
|
|||||||
@@ -587,6 +587,7 @@ void CPlayerInterface::battleStacksHealedRes(const std::vector<std::pair<ui32, u
|
|||||||
{
|
{
|
||||||
textOff += 1;
|
textOff += 1;
|
||||||
}
|
}
|
||||||
|
CCS->soundh->playSound(soundBase::DRAINLIF);
|
||||||
}
|
}
|
||||||
|
|
||||||
//print info about life drain
|
//print info about life drain
|
||||||
|
|||||||
@@ -1782,7 +1782,7 @@ bool BattleInfo::battleTestElementalImmunity(const CStack * subject, const CSpel
|
|||||||
{
|
{
|
||||||
if (spell->positiveness < 1) //negative or indifferent
|
if (spell->positiveness < 1) //negative or indifferent
|
||||||
{
|
{
|
||||||
if (damageSpell && subject->hasBonusOfType(element, 2) || subject->hasBonusOfType(element, 1))
|
if ((damageSpell && subject->hasBonusOfType(element, 2)) || subject->hasBonusOfType(element, 1))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (spell->positiveness == 1) //positive
|
else if (spell->positiveness == 1) //positive
|
||||||
@@ -1806,27 +1806,27 @@ SpellCasting::ESpellCastProblem BattleInfo::battleIsImmune(const CGHeroInstance
|
|||||||
|
|
||||||
bool damageSpell = (VLC->spellh->damageSpells.find(spell->id) != VLC->spellh->damageSpells.end());
|
bool damageSpell = (VLC->spellh->damageSpells.find(spell->id) != VLC->spellh->damageSpells.end());
|
||||||
|
|
||||||
if (damageSpell && subject->hasBonusOfType(Bonus::DIRECT_DAMAGE_IMMUNITY));
|
if (damageSpell && subject->hasBonusOfType(Bonus::DIRECT_DAMAGE_IMMUNITY))
|
||||||
return SpellCasting::STACK_IMMUNE_TO_SPELL;
|
return SpellCasting::STACK_IMMUNE_TO_SPELL;
|
||||||
|
|
||||||
if (spell->fire)
|
if (spell->fire)
|
||||||
{
|
{
|
||||||
if (battleTestElementalImmunity(subject, spell, Bonus::FIRE_IMMUNITY, damageSpell));
|
if (battleTestElementalImmunity(subject, spell, Bonus::FIRE_IMMUNITY, damageSpell))
|
||||||
return SpellCasting::STACK_IMMUNE_TO_SPELL;
|
return SpellCasting::STACK_IMMUNE_TO_SPELL;
|
||||||
}
|
}
|
||||||
if (spell->water)
|
if (spell->water)
|
||||||
{
|
{
|
||||||
if (battleTestElementalImmunity(subject, spell, Bonus::WATER_IMMUNITY, damageSpell));
|
if (battleTestElementalImmunity(subject, spell, Bonus::WATER_IMMUNITY, damageSpell))
|
||||||
return SpellCasting::STACK_IMMUNE_TO_SPELL;
|
return SpellCasting::STACK_IMMUNE_TO_SPELL;
|
||||||
}
|
}
|
||||||
if (spell->earth)
|
if (spell->earth)
|
||||||
{
|
{
|
||||||
if (battleTestElementalImmunity(subject, spell, Bonus::EARTH_IMMUNITY, damageSpell));
|
if (battleTestElementalImmunity(subject, spell, Bonus::EARTH_IMMUNITY, damageSpell))
|
||||||
return SpellCasting::STACK_IMMUNE_TO_SPELL;
|
return SpellCasting::STACK_IMMUNE_TO_SPELL;
|
||||||
}
|
}
|
||||||
if (spell->air)
|
if (spell->air)
|
||||||
{
|
{
|
||||||
if (battleTestElementalImmunity(subject, spell, Bonus::AIR_IMMUNITY, damageSpell));
|
if (battleTestElementalImmunity(subject, spell, Bonus::AIR_IMMUNITY, damageSpell))
|
||||||
return SpellCasting::STACK_IMMUNE_TO_SPELL;
|
return SpellCasting::STACK_IMMUNE_TO_SPELL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1346,7 +1346,7 @@ CStackBasicDescriptor CGHeroInstance::calculateNecromancy (const BattleResult &b
|
|||||||
{
|
{
|
||||||
// Get lost enemy hit points convertible to units.
|
// Get lost enemy hit points convertible to units.
|
||||||
CCreature * c = VLC->creh->creatures[it->first];
|
CCreature * c = VLC->creh->creatures[it->first];
|
||||||
if (!(c->hasBonusOfType(Bonus::UNDEAD) || c->hasBonusOfType(Bonus::NON_LIVING)))
|
if (c->isLiving())
|
||||||
{
|
{
|
||||||
const ui32 raisedHP = c->valOfBonuses(Bonus::STACK_HEALTH) * it->second * necromancySkill;
|
const ui32 raisedHP = c->valOfBonuses(Bonus::STACK_HEALTH) * it->second * necromancySkill;
|
||||||
raisedUnits += std::min<ui32>(raisedHP / raisedUnitHP, it->second * necromancySkill); //limit to % of HP and % of original stack count
|
raisedUnits += std::min<ui32>(raisedHP / raisedUnitHP, it->second * necromancySkill); //limit to % of HP and % of original stack count
|
||||||
|
|||||||
@@ -319,6 +319,11 @@ si32 IBonusBearer::magicResistance() const
|
|||||||
return valOfBonuses(Selector::type(Bonus::MAGIC_RESISTANCE));
|
return valOfBonuses(Selector::type(Bonus::MAGIC_RESISTANCE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IBonusBearer::isLiving() const //TODO: theoreticaly there exists "LIVING" bonus in stack experience documentation
|
||||||
|
{
|
||||||
|
return(!hasBonus(Selector::type(Bonus::UNDEAD) || Selector::type(Bonus::NON_LIVING)));
|
||||||
|
}
|
||||||
|
|
||||||
void IBonusBearer::setCachingStr(const std::string &request) const
|
void IBonusBearer::setCachingStr(const std::string &request) const
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -426,6 +426,7 @@ public:
|
|||||||
si32 Attack() const; //get attack of stack with all modificators
|
si32 Attack() const; //get attack of stack with all modificators
|
||||||
si32 Defense(bool withFrenzy = true) const; //get defense of stack with all modificators
|
si32 Defense(bool withFrenzy = true) const; //get defense of stack with all modificators
|
||||||
ui16 MaxHealth() const; //get max HP of stack with all modifiers
|
ui16 MaxHealth() const; //get max HP of stack with all modifiers
|
||||||
|
bool isLiving() const; //non-undead, non-non living or alive
|
||||||
virtual si32 magicResistance() const;
|
virtual si32 magicResistance() const;
|
||||||
|
|
||||||
si32 manaLimit() const; //maximum mana value for this hero (basically 10*knowledge)
|
si32 manaLimit() const; //maximum mana value for this hero (basically 10*knowledge)
|
||||||
|
|||||||
@@ -545,7 +545,7 @@ void CGameHandler::prepareAttack(BattleAttack &bat, const CStack *att, const CSt
|
|||||||
def->prepareAttacked(*bsa);
|
def->prepareAttacked(*bsa);
|
||||||
|
|
||||||
//life drain handling
|
//life drain handling
|
||||||
if (att->hasBonusOfType(Bonus::LIFE_DRAIN))
|
if (att->hasBonusOfType(Bonus::LIFE_DRAIN) && def->isLiving())
|
||||||
{
|
{
|
||||||
StacksHealedOrResurrected shi;
|
StacksHealedOrResurrected shi;
|
||||||
shi.lifeDrain = (ui8)true;
|
shi.lifeDrain = (ui8)true;
|
||||||
|
|||||||
Reference in New Issue
Block a user