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

Merge pull request #191 from vmarkovtsev/feature/psychic_elementals

I think we could implement general bonus that reduces damage depending on arbitrary immunity (or other bonus), but it's beyond the scope of this PR.
This commit is contained in:
DjWarmonger 2016-02-02 13:02:13 +01:00
commit 97117491ae
2 changed files with 35 additions and 33 deletions

View File

@ -997,7 +997,7 @@ TDmgRange CBattleInfoCallback::calculateDmgRange(const BattleAttackInfo &info) c
const bool distPenalty = !info.attackerBonuses->hasBonusOfType(Bonus::NO_DISTANCE_PENALTY) && battleHasDistancePenalty(info.attackerBonuses, info.attackerPosition, info.defenderPosition);
const bool obstaclePenalty = battleHasWallPenalty(info.attackerBonuses, info.attackerPosition, info.defenderPosition);
if (info.shooting)
if(info.shooting)
{
if (distPenalty || info.defenderBonuses->hasBonus(isAdvancedAirShield))
{
@ -1013,9 +1013,14 @@ TDmgRange CBattleInfoCallback::calculateDmgRange(const BattleAttackInfo &info) c
multBonus *= 0.5;
}
// psychic elementals versus mind immune units 50%
if(attackerType->idNumber == CreatureID::PSYCHIC_ELEMENTAL
&& info.defenderBonuses->hasBonusOfType(Bonus::MIND_IMMUNITY))
{
multBonus *= 0.5;
}
// TODO attack on petrified unit 50%
// psychic elementals versus mind immune units 50%
// blinded unit retaliates
minDmg *= additiveBonus * multBonus;

View File

@ -968,6 +968,7 @@ public:
WATER_ELEMENTAL = 115,
GOLD_GOLEM = 116,
DIAMOND_GOLEM = 117,
PSYCHIC_ELEMENTAL = 120,
CATAPULT = 145,
BALLISTA = 146,
FIRST_AID_TENT = 147,
@ -1053,7 +1054,3 @@ typedef int TRmgTemplateZoneId;
#undef ID_LIKE_OPERATORS_INTERNAL
#undef INSTID_LIKE_CLASS_COMMON
#undef OP_DECL_INT