mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-15 01:24:45 +02:00
Support for Death Blow ability.
This commit is contained in:
@ -425,7 +425,8 @@ std::pair< std::vector<THex>, int > BattleInfo::getPath(THex start, THex dest, b
|
||||
return std::make_pair(path, dist[dest]);
|
||||
}
|
||||
|
||||
TDmgRange BattleInfo::calculateDmgRange( const CStack* attacker, const CStack* defender, TQuantity attackerCount, TQuantity defenderCount, const CGHeroInstance * attackerHero, const CGHeroInstance * defendingHero, bool shooting, ui8 charge, bool lucky, bool ballistaDoubleDmg ) const
|
||||
TDmgRange BattleInfo::calculateDmgRange( const CStack* attacker, const CStack* defender, TQuantity attackerCount, TQuantity defenderCount, const CGHeroInstance * attackerHero, const CGHeroInstance * defendingHero,
|
||||
bool shooting, ui8 charge, bool lucky, bool deathBlow, bool ballistaDoubleDmg ) const
|
||||
{
|
||||
float additiveBonus=1.0f, multBonus=1.0f,
|
||||
minDmg = attacker->getMinDamage() * attackerCount,
|
||||
@ -575,6 +576,11 @@ TDmgRange BattleInfo::calculateDmgRange( const CStack* attacker, const CStack* d
|
||||
additiveBonus += 1.0f;
|
||||
}
|
||||
|
||||
if (deathBlow) //Dread Knight and many WoGified creatures
|
||||
{
|
||||
additiveBonus += 1.0f;
|
||||
}
|
||||
|
||||
//handling spell effects
|
||||
if(!shooting && defender->hasBonusOfType(Bonus::GENERAL_DAMAGE_REDUCTION, 0)) //eg. shield
|
||||
{
|
||||
@ -647,14 +653,16 @@ TDmgRange BattleInfo::calculateDmgRange( const CStack* attacker, const CStack* d
|
||||
return returnedVal;
|
||||
}
|
||||
|
||||
TDmgRange BattleInfo::calculateDmgRange(const CStack* attacker, const CStack* defender, const CGHeroInstance * attackerHero, const CGHeroInstance * defendingHero, bool shooting, ui8 charge, bool lucky, bool ballistaDoubleDmg) const
|
||||
TDmgRange BattleInfo::calculateDmgRange(const CStack* attacker, const CStack* defender, const CGHeroInstance * attackerHero, const CGHeroInstance * defendingHero,
|
||||
bool shooting, ui8 charge, bool lucky, bool deathBlow, bool ballistaDoubleDmg) const
|
||||
{
|
||||
return calculateDmgRange(attacker, defender, attacker->count, defender->count, attackerHero, defendingHero, shooting, charge, lucky, ballistaDoubleDmg);
|
||||
return calculateDmgRange(attacker, defender, attacker->count, defender->count, attackerHero, defendingHero, shooting, charge, lucky, deathBlow, ballistaDoubleDmg);
|
||||
}
|
||||
|
||||
ui32 BattleInfo::calculateDmg( const CStack* attacker, const CStack* defender, const CGHeroInstance * attackerHero, const CGHeroInstance * defendingHero, bool shooting, ui8 charge, bool lucky, bool ballistaDoubleDmg )
|
||||
ui32 BattleInfo::calculateDmg( const CStack* attacker, const CStack* defender, const CGHeroInstance * attackerHero, const CGHeroInstance * defendingHero,
|
||||
bool shooting, ui8 charge, bool lucky, bool deathBlow, bool ballistaDoubleDmg )
|
||||
{
|
||||
TDmgRange range = calculateDmgRange(attacker, defender, attackerHero, defendingHero, shooting, charge, lucky, ballistaDoubleDmg);
|
||||
TDmgRange range = calculateDmgRange(attacker, defender, attackerHero, defendingHero, shooting, charge, lucky, deathBlow, ballistaDoubleDmg);
|
||||
|
||||
if(range.first != range.second)
|
||||
{
|
||||
|
Reference in New Issue
Block a user