Skip to content

Commit

Permalink
Add description about 50% retaliation damage to the Blind spell (#9482)
Browse files Browse the repository at this point in the history
  • Loading branch information
zenseii authored Jan 25, 2025
1 parent d053891 commit 2c87dfa
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
20 changes: 15 additions & 5 deletions src/fheroes2/battle/battle_troop.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/***************************************************************************
* fheroes2: https://github.com/ihhub/fheroes2 *
* Copyright (C) 2019 - 2024 *
* Copyright (C) 2019 - 2025 *
* *
* Free Heroes2 Engine: http://sourceforge.net/projects/fheroes2 *
* Copyright (C) 2010 by Andrey Afletdinov <[email protected]> *
Expand Down Expand Up @@ -516,8 +516,15 @@ uint32_t Battle::Unit::EstimateRetaliatoryDamage( const uint32_t damageTaken ) c

const uint32_t retaliatoryDamage = unitsLeft * damagePerUnit;

// The retaliatory damage of a blinded unit is halved
return ( Modes( SP_BLIND ) ? retaliatoryDamage / 2 : retaliatoryDamage );
if ( !Modes( SP_BLIND ) ) {
return retaliatoryDamage;
}

// The retaliatory damage of a blinded unit is reduced
const uint32_t reductionPercent = Spell( Spell::BLIND ).ExtraValue();
assert( reductionPercent <= 100 );

return retaliatoryDamage * ( 100 - reductionPercent ) / 100;
}

uint32_t Battle::Unit::CalculateMinDamage( const Unit & enemy ) const
Expand Down Expand Up @@ -560,12 +567,15 @@ uint32_t Battle::Unit::CalculateDamageUnit( const Unit & enemy, double dmg ) con
}
}

// The retaliatory damage of a blinded unit is halved
// The retaliatory damage of a blinded unit is reduced
if ( _blindRetaliation ) {
// Petrified units cannot attack, respectively, there should be no retaliation
assert( !enemy.Modes( SP_STONE ) );

dmg /= 2;
const uint32_t reductionPercent = Spell( Spell::BLIND ).ExtraValue();
assert( reductionPercent <= 100 );

dmg = dmg * ( 100 - reductionPercent ) / 100;
}

// A petrified unit takes only half of the damage
Expand Down
5 changes: 3 additions & 2 deletions src/fheroes2/spell/spell.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/***************************************************************************
* fheroes2: https://github.com/ihhub/fheroes2 *
* Copyright (C) 2019 - 2024 *
* Copyright (C) 2019 - 2025 *
* *
* Free Heroes2 Engine: http://sourceforge.net/projects/fheroes2 *
* Copyright (C) 2009 by Andrey Afletdinov <[email protected]> *
Expand Down Expand Up @@ -73,7 +73,8 @@ namespace
{ gettext_noop( "Mass Haste" ), 10, 0, 0, 61, 2, gettext_noop( "Increases the speed of all of your creatures by %{count}." ) },
{ gettext_noop( "spell|Slow" ), 3, 0, 0, 1, 0, gettext_noop( "Slows target to half movement rate." ) },
{ gettext_noop( "Mass Slow" ), 15, 0, 0, 62, 0, gettext_noop( "Slows all enemies to half movement rate." ) },
{ gettext_noop( "spell|Blind" ), 6, 0, 0, 21, 0, gettext_noop( "Clouds the affected creatures' eyes, preventing them from moving." ) },
{ gettext_noop( "spell|Blind" ), 6, 0, 0, 21, 50,
gettext_noop( "Clouds the affected creatures' eyes, preventing them from moving and reduces the damage when retaliating by %{count} percent." ) },
{ gettext_noop( "Bless" ), 3, 0, 0, 7, 0, gettext_noop( "Causes the selected creatures to inflict maximum damage." ) },
{ gettext_noop( "Mass Bless" ), 12, 0, 0, 63, 0, gettext_noop( "Causes all of your units to inflict maximum damage." ) },
{ gettext_noop( "Stoneskin" ), 3, 0, 0, 31, 3, gettext_noop( "Magically increases the defense skill of the selected creatures." ) },
Expand Down

0 comments on commit 2c87dfa

Please sign in to comment.