mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-27 22:49:25 +02:00
Change nix rounding, revert assert comment
This commit is contained in:
@@ -791,7 +791,7 @@ void BattleInterface::waitForAnimations()
|
|||||||
}
|
}
|
||||||
|
|
||||||
assert(!hasAnimations());
|
assert(!hasAnimations());
|
||||||
//assert(awaitingEvents.empty());
|
assert(awaitingEvents.empty());
|
||||||
|
|
||||||
if (!awaitingEvents.empty())
|
if (!awaitingEvents.empty())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -132,15 +132,12 @@ int DamageCalculator::getActorAttackEffective() const
|
|||||||
|
|
||||||
int DamageCalculator::getActorAttackIgnored() const
|
int DamageCalculator::getActorAttackIgnored() const
|
||||||
{
|
{
|
||||||
double multAttackReduction = battleBonusValue(info.defender, Selector::type()(BonusType::ENEMY_ATTACK_REDUCTION)) / 100.0;
|
int multAttackReductionPercent = battleBonusValue(info.defender, Selector::type()(BonusType::ENEMY_ATTACK_REDUCTION));
|
||||||
|
|
||||||
if(multAttackReduction > 0)
|
if(multAttackReductionPercent > 0)
|
||||||
{
|
{
|
||||||
int defaultRoundingMode = std::fegetround();
|
int reduction = (getActorAttackBase() * multAttackReductionPercent + 49) / 100; //using ints so 1.5 for 5 attack is rounded down as in HotA / h3assist etc. (keep in mind h3assist 1.2 shows wrong value for 15 attack points and unupg. nix)
|
||||||
std::fesetround(FE_TOWARDZERO);
|
return -std::min(reduction, getActorAttackBase());
|
||||||
int reduction = std::nearbyint(multAttackReduction * getActorAttackBase());
|
|
||||||
std::fesetround(defaultRoundingMode);
|
|
||||||
return -std::min(reduction,getActorAttackBase());
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user