mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-20 20:23:03 +02:00
vcmi: rename HeroBonus.h to Bonus.h
This commit is contained in:
parent
3df5a8e415
commit
a6de9097be
@ -51,11 +51,11 @@ int64_t AttackPossibility::calculateDamageReduce(
|
|||||||
|
|
||||||
// FIXME: provide distance info for Jousting bonus
|
// FIXME: provide distance info for Jousting bonus
|
||||||
auto enemyDamageBeforeAttack = cb.battleEstimateDamage(defender, attacker, 0);
|
auto enemyDamageBeforeAttack = cb.battleEstimateDamage(defender, attacker, 0);
|
||||||
auto enemiesKilled = damageDealt / defender->MaxHealth() + (damageDealt % defender->MaxHealth() >= defender->getFirstHPleft() ? 1 : 0);
|
auto enemiesKilled = damageDealt / defender->getMaxHealth() + (damageDealt % defender->getMaxHealth() >= defender->getFirstHPleft() ? 1 : 0);
|
||||||
auto enemyDamage = averageDmg(enemyDamageBeforeAttack.damage);
|
auto enemyDamage = averageDmg(enemyDamageBeforeAttack.damage);
|
||||||
auto damagePerEnemy = enemyDamage / (double)defender->getCount();
|
auto damagePerEnemy = enemyDamage / (double)defender->getCount();
|
||||||
|
|
||||||
return (int64_t)(damagePerEnemy * (enemiesKilled * KILL_BOUNTY + damageDealt * HEALTH_BOUNTY / (double)defender->MaxHealth()));
|
return (int64_t)(damagePerEnemy * (enemiesKilled * KILL_BOUNTY + damageDealt * HEALTH_BOUNTY / (double)defender->getMaxHealth()));
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t AttackPossibility::evaluateBlockedShootersDmg(const BattleAttackInfo & attackInfo, BattleHex hex, const HypotheticBattle & state)
|
int64_t AttackPossibility::evaluateBlockedShootersDmg(const BattleAttackInfo & attackInfo, BattleHex hex, const HypotheticBattle & state)
|
||||||
|
@ -109,7 +109,7 @@ BattleAction CBattleAI::activeStack( const CStack * stack )
|
|||||||
auto healingTargets = cb->battleGetStacks(CBattleInfoEssentials::ONLY_MINE);
|
auto healingTargets = cb->battleGetStacks(CBattleInfoEssentials::ONLY_MINE);
|
||||||
std::map<int, const CStack*> woundHpToStack;
|
std::map<int, const CStack*> woundHpToStack;
|
||||||
for(auto stack : healingTargets)
|
for(auto stack : healingTargets)
|
||||||
if(auto woundHp = stack->MaxHealth() - stack->getFirstHPleft())
|
if(auto woundHp = stack->getMaxHealth() - stack->getFirstHPleft())
|
||||||
woundHpToStack[woundHp] = stack;
|
woundHpToStack[woundHp] = stack;
|
||||||
if(woundHpToStack.empty())
|
if(woundHpToStack.empty())
|
||||||
return BattleAction::makeDefend(stack);
|
return BattleAction::makeDefend(stack);
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#include <vcmi/Environment.h>
|
#include <vcmi/Environment.h>
|
||||||
#include <vcmi/ServerCallback.h>
|
#include <vcmi/ServerCallback.h>
|
||||||
|
|
||||||
#include "../../lib/bonuses/HeroBonus.h"
|
#include "../../lib/bonuses/Bonus.h"
|
||||||
#include "../../lib/battle/BattleProxy.h"
|
#include "../../lib/battle/BattleProxy.h"
|
||||||
#include "../../lib/battle/CUnitState.h"
|
#include "../../lib/battle/CUnitState.h"
|
||||||
|
|
||||||
|
@ -1703,7 +1703,7 @@ CFortScreen::RecruitArea::RecruitArea(int posX, int posY, const CGTownInstance *
|
|||||||
sizes.y+=21;
|
sizes.y+=21;
|
||||||
values.push_back(std::make_shared<LabeledValue>(sizes, CGI->generaltexth->allTexts[199], CGI->generaltexth->fcommands[2], getMyCreature()->getMinDamage(false), getMyCreature()->getMaxDamage(false)));
|
values.push_back(std::make_shared<LabeledValue>(sizes, CGI->generaltexth->allTexts[199], CGI->generaltexth->fcommands[2], getMyCreature()->getMinDamage(false), getMyCreature()->getMaxDamage(false)));
|
||||||
sizes.y+=20;
|
sizes.y+=20;
|
||||||
values.push_back(std::make_shared<LabeledValue>(sizes, CGI->generaltexth->allTexts[388], CGI->generaltexth->fcommands[3], getMyCreature()->MaxHealth()));
|
values.push_back(std::make_shared<LabeledValue>(sizes, CGI->generaltexth->allTexts[388], CGI->generaltexth->fcommands[3], getMyCreature()->getMaxHealth()));
|
||||||
sizes.y+=21;
|
sizes.y+=21;
|
||||||
values.push_back(std::make_shared<LabeledValue>(sizes, CGI->generaltexth->allTexts[193], CGI->generaltexth->fcommands[4], getMyCreature()->valOfBonuses(Bonus::STACKS_SPEED)));
|
values.push_back(std::make_shared<LabeledValue>(sizes, CGI->generaltexth->allTexts[193], CGI->generaltexth->fcommands[4], getMyCreature()->valOfBonuses(Bonus::STACKS_SPEED)));
|
||||||
sizes.y+=20;
|
sizes.y+=20;
|
||||||
|
@ -525,7 +525,7 @@ CStackWindow::MainSection::MainSection(CStackWindow * owner, int yOffset, bool s
|
|||||||
addStatLabel(EStat::ATTACK, parent->info->creature->getAttack(battleStack->isShooter()), battleStack->getAttack(battleStack->isShooter()));
|
addStatLabel(EStat::ATTACK, parent->info->creature->getAttack(battleStack->isShooter()), battleStack->getAttack(battleStack->isShooter()));
|
||||||
addStatLabel(EStat::DEFENCE, parent->info->creature->getDefense(battleStack->isShooter()), battleStack->getDefense(battleStack->isShooter()));
|
addStatLabel(EStat::DEFENCE, parent->info->creature->getDefense(battleStack->isShooter()), battleStack->getDefense(battleStack->isShooter()));
|
||||||
addStatLabel(EStat::DAMAGE, parent->info->stackNode->getMinDamage(battleStack->isShooter()) * dmgMultiply, battleStack->getMaxDamage(battleStack->isShooter()) * dmgMultiply);
|
addStatLabel(EStat::DAMAGE, parent->info->stackNode->getMinDamage(battleStack->isShooter()) * dmgMultiply, battleStack->getMaxDamage(battleStack->isShooter()) * dmgMultiply);
|
||||||
addStatLabel(EStat::HEALTH, parent->info->creature->MaxHealth(), battleStack->MaxHealth());
|
addStatLabel(EStat::HEALTH, parent->info->creature->getMaxHealth(), battleStack->getMaxHealth());
|
||||||
addStatLabel(EStat::SPEED, parent->info->creature->Speed(), battleStack->Speed());
|
addStatLabel(EStat::SPEED, parent->info->creature->Speed(), battleStack->Speed());
|
||||||
|
|
||||||
if(battleStack->isShooter())
|
if(battleStack->isShooter())
|
||||||
@ -545,7 +545,7 @@ CStackWindow::MainSection::MainSection(CStackWindow * owner, int yOffset, bool s
|
|||||||
addStatLabel(EStat::ATTACK, parent->info->creature->getAttack(shooter), parent->info->stackNode->getAttack(shooter));
|
addStatLabel(EStat::ATTACK, parent->info->creature->getAttack(shooter), parent->info->stackNode->getAttack(shooter));
|
||||||
addStatLabel(EStat::DEFENCE, parent->info->creature->getDefense(shooter), parent->info->stackNode->getDefense(shooter));
|
addStatLabel(EStat::DEFENCE, parent->info->creature->getDefense(shooter), parent->info->stackNode->getDefense(shooter));
|
||||||
addStatLabel(EStat::DAMAGE, parent->info->stackNode->getMinDamage(shooter) * dmgMultiply, parent->info->stackNode->getMaxDamage(shooter) * dmgMultiply);
|
addStatLabel(EStat::DAMAGE, parent->info->stackNode->getMinDamage(shooter) * dmgMultiply, parent->info->stackNode->getMaxDamage(shooter) * dmgMultiply);
|
||||||
addStatLabel(EStat::HEALTH, parent->info->creature->MaxHealth(), parent->info->stackNode->MaxHealth());
|
addStatLabel(EStat::HEALTH, parent->info->creature->getMaxHealth(), parent->info->stackNode->getMaxHealth());
|
||||||
addStatLabel(EStat::SPEED, parent->info->creature->Speed(), parent->info->stackNode->Speed());
|
addStatLabel(EStat::SPEED, parent->info->creature->Speed(), parent->info->stackNode->Speed());
|
||||||
|
|
||||||
if(shooter)
|
if(shooter)
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../../lib/bonuses/HeroBonus.h"
|
#include "../../lib/bonuses/Bonus.h"
|
||||||
#include "../widgets/MiscWidgets.h"
|
#include "../widgets/MiscWidgets.h"
|
||||||
#include "CWindowObject.h"
|
#include "CWindowObject.h"
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
#include <vcmi/FactionMember.h>
|
#include <vcmi/FactionMember.h>
|
||||||
|
|
||||||
#include "../../lib/bonuses/HeroBonus.h"
|
#include "../../lib/bonuses/Bonus.h"
|
||||||
#include "../../lib/bonuses/IBonusBearer.h"
|
#include "../../lib/bonuses/IBonusBearer.h"
|
||||||
#include "../widgets/CWindowWithArtifacts.h"
|
#include "../widgets/CWindowWithArtifacts.h"
|
||||||
#include "../widgets/CGarrisonInt.h"
|
#include "../widgets/CGarrisonInt.h"
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
#include "../lib/CStopWatch.h"
|
#include "../lib/CStopWatch.h"
|
||||||
#include "../lib/CTownHandler.h"
|
#include "../lib/CTownHandler.h"
|
||||||
#include "../lib/GameConstants.h"
|
#include "../lib/GameConstants.h"
|
||||||
#include "../lib/bonuses/HeroBonus.h"
|
#include "../lib/bonuses/Bonus.h"
|
||||||
#include "../lib/mapping/CMap.h"
|
#include "../lib/mapping/CMap.h"
|
||||||
#include "../lib/NetPacksBase.h"
|
#include "../lib/NetPacksBase.h"
|
||||||
#include "../lib/StartInfo.h"
|
#include "../lib/StartInfo.h"
|
||||||
|
@ -27,12 +27,12 @@ macro(add_main_lib TARGET_NAME LIBRARY_TYPE)
|
|||||||
${MAIN_LIB_DIR}/battle/SiegeInfo.cpp
|
${MAIN_LIB_DIR}/battle/SiegeInfo.cpp
|
||||||
${MAIN_LIB_DIR}/battle/Unit.cpp
|
${MAIN_LIB_DIR}/battle/Unit.cpp
|
||||||
|
|
||||||
|
${MAIN_LIB_DIR}/bonuses/Bonus.cpp
|
||||||
${MAIN_LIB_DIR}/bonuses/BonusList.cpp
|
${MAIN_LIB_DIR}/bonuses/BonusList.cpp
|
||||||
${MAIN_LIB_DIR}/bonuses/BonusParams.cpp
|
${MAIN_LIB_DIR}/bonuses/BonusParams.cpp
|
||||||
${MAIN_LIB_DIR}/bonuses/BonusSelector.cpp
|
${MAIN_LIB_DIR}/bonuses/BonusSelector.cpp
|
||||||
${MAIN_LIB_DIR}/bonuses/CBonusProxy.cpp
|
${MAIN_LIB_DIR}/bonuses/CBonusProxy.cpp
|
||||||
${MAIN_LIB_DIR}/bonuses/CBonusSystemNode.cpp
|
${MAIN_LIB_DIR}/bonuses/CBonusSystemNode.cpp
|
||||||
${MAIN_LIB_DIR}/bonuses/HeroBonus.cpp
|
|
||||||
${MAIN_LIB_DIR}/bonuses/IBonusBearer.cpp
|
${MAIN_LIB_DIR}/bonuses/IBonusBearer.cpp
|
||||||
${MAIN_LIB_DIR}/bonuses/Limiters.cpp
|
${MAIN_LIB_DIR}/bonuses/Limiters.cpp
|
||||||
${MAIN_LIB_DIR}/bonuses/Propagators.cpp
|
${MAIN_LIB_DIR}/bonuses/Propagators.cpp
|
||||||
@ -310,12 +310,12 @@ macro(add_main_lib TARGET_NAME LIBRARY_TYPE)
|
|||||||
${MAIN_LIB_DIR}/battle/SiegeInfo.h
|
${MAIN_LIB_DIR}/battle/SiegeInfo.h
|
||||||
${MAIN_LIB_DIR}/battle/Unit.h
|
${MAIN_LIB_DIR}/battle/Unit.h
|
||||||
|
|
||||||
|
${MAIN_LIB_DIR}/bonuses/Bonus.h
|
||||||
${MAIN_LIB_DIR}/bonuses/BonusList.h
|
${MAIN_LIB_DIR}/bonuses/BonusList.h
|
||||||
${MAIN_LIB_DIR}/bonuses/BonusParams.h
|
${MAIN_LIB_DIR}/bonuses/BonusParams.h
|
||||||
${MAIN_LIB_DIR}/bonuses/BonusSelector.h
|
${MAIN_LIB_DIR}/bonuses/BonusSelector.h
|
||||||
${MAIN_LIB_DIR}/bonuses/CBonusProxy.h
|
${MAIN_LIB_DIR}/bonuses/CBonusProxy.h
|
||||||
${MAIN_LIB_DIR}/bonuses/CBonusSystemNode.h
|
${MAIN_LIB_DIR}/bonuses/CBonusSystemNode.h
|
||||||
${MAIN_LIB_DIR}/bonuses/HeroBonus.h
|
|
||||||
${MAIN_LIB_DIR}/bonuses/IBonusBearer.h
|
${MAIN_LIB_DIR}/bonuses/IBonusBearer.h
|
||||||
${MAIN_LIB_DIR}/bonuses/Limiters.h
|
${MAIN_LIB_DIR}/bonuses/Limiters.h
|
||||||
${MAIN_LIB_DIR}/bonuses/Propagators.h
|
${MAIN_LIB_DIR}/bonuses/Propagators.h
|
||||||
|
@ -24,7 +24,7 @@ class DLL_LINKAGE ACreature: public AFactionMember
|
|||||||
public:
|
public:
|
||||||
bool isLiving() const; //non-undead, non-non living or alive
|
bool isLiving() const; //non-undead, non-non living or alive
|
||||||
ui32 Speed(int turn = 0, bool useBind = false) const; //get speed (in moving tiles) of creature with all modificators
|
ui32 Speed(int turn = 0, bool useBind = false) const; //get speed (in moving tiles) of creature with all modificators
|
||||||
ui32 MaxHealth() const; //get max HP of stack with all modifiers
|
virtual ui32 getMaxHealth() const; //get max HP of stack with all modifiers
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename IdType>
|
template <typename IdType>
|
||||||
@ -46,8 +46,6 @@ public:
|
|||||||
virtual std::string getNamePluralTextID() const = 0;
|
virtual std::string getNamePluralTextID() const = 0;
|
||||||
virtual std::string getNameSingularTextID() const = 0;
|
virtual std::string getNameSingularTextID() const = 0;
|
||||||
|
|
||||||
virtual uint32_t getMaxHealth() const = 0;
|
|
||||||
|
|
||||||
virtual int32_t getAdvMapAmountMin() const = 0;
|
virtual int32_t getAdvMapAmountMin() const = 0;
|
||||||
virtual int32_t getAdvMapAmountMax() const = 0;
|
virtual int32_t getAdvMapAmountMax() const = 0;
|
||||||
virtual int32_t getAIValue() const = 0;
|
virtual int32_t getAIValue() const = 0;
|
||||||
|
@ -53,10 +53,15 @@ public:
|
|||||||
*/
|
*/
|
||||||
int getPrimSkillLevel(PrimarySkill::PrimarySkill id) const;
|
int getPrimSkillLevel(PrimarySkill::PrimarySkill id) const;
|
||||||
/**
|
/**
|
||||||
Returns morale or luck of creature or hero.
|
Returns morale of creature or hero. Taking absolute bonuses into account.
|
||||||
|
For now, uses range [-3, +3]
|
||||||
*/
|
*/
|
||||||
int MoraleVal() const; //range [-3, +3]
|
int MoraleVal() const;
|
||||||
int LuckVal() const; //range [-3, +3]
|
/**
|
||||||
|
Returns luck of creature or hero. Taking absolute bonuses into account.
|
||||||
|
For now, uses range [-3, +3]
|
||||||
|
*/
|
||||||
|
int LuckVal() const;
|
||||||
/**
|
/**
|
||||||
Returns total value of all morale bonuses and sets bonusList as a pointer to the list of selected bonuses.
|
Returns total value of all morale bonuses and sets bonusList as a pointer to the list of selected bonuses.
|
||||||
@param bonusList is the out param it's list of all selected bonuses
|
@param bonusList is the out param it's list of all selected bonuses
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#include "VCMI_Lib.h"
|
#include "VCMI_Lib.h"
|
||||||
#include "GameConstants.h"
|
#include "GameConstants.h"
|
||||||
#include "bonuses/BonusList.h"
|
#include "bonuses/BonusList.h"
|
||||||
#include "bonuses/HeroBonus.h"
|
#include "bonuses/Bonus.h"
|
||||||
#include "bonuses/IBonusBearer.h"
|
#include "bonuses/IBonusBearer.h"
|
||||||
|
|
||||||
#include <vcmi/Creature.h>
|
#include <vcmi/Creature.h>
|
||||||
@ -139,7 +139,7 @@ int AFactionMember::LuckVal() const
|
|||||||
return LuckValAndBonusList(tmp);
|
return LuckValAndBonusList(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui32 ACreature::MaxHealth() const
|
ui32 ACreature::getMaxHealth() const
|
||||||
{
|
{
|
||||||
const std::string cachingStr = "type_STACK_HEALTH";
|
const std::string cachingStr = "type_STACK_HEALTH";
|
||||||
static const auto selector = Selector::type()(Bonus::STACK_HEALTH);
|
static const auto selector = Selector::type()(Bonus::STACK_HEALTH);
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
#include <vcmi/EntityService.h>
|
#include <vcmi/EntityService.h>
|
||||||
#include <vcmi/Entity.h>
|
#include <vcmi/Entity.h>
|
||||||
#include "bonuses/HeroBonus.h"
|
#include "bonuses/Bonus.h"
|
||||||
#include "GameConstants.h"
|
#include "GameConstants.h"
|
||||||
#include "IHandlerBase.h"
|
#include "IHandlerBase.h"
|
||||||
#include "battle/BattleHex.h"
|
#include "battle/BattleHex.h"
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include <vcmi/Artifact.h>
|
#include <vcmi/Artifact.h>
|
||||||
#include <vcmi/ArtifactService.h>
|
#include <vcmi/ArtifactService.h>
|
||||||
|
|
||||||
#include "bonuses/HeroBonus.h"
|
#include "bonuses/Bonus.h"
|
||||||
#include "bonuses/CBonusSystemNode.h"
|
#include "bonuses/CBonusSystemNode.h"
|
||||||
#include "GameConstants.h"
|
#include "GameConstants.h"
|
||||||
#include "IHandlerBase.h"
|
#include "IHandlerBase.h"
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
#include "IBonusTypeHandler.h"
|
#include "IBonusTypeHandler.h"
|
||||||
#include "IHandlerBase.h"
|
#include "IHandlerBase.h"
|
||||||
#include "bonuses/HeroBonus.h"
|
#include "bonuses/Bonus.h"
|
||||||
|
|
||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
@ -71,11 +71,6 @@ const IBonusBearer * CCreature::getBonusBearer() const
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t CCreature::getMaxHealth() const
|
|
||||||
{
|
|
||||||
return MaxHealth();
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CCreature::getAdvMapAmountMin() const
|
int32_t CCreature::getAdvMapAmountMin() const
|
||||||
{
|
{
|
||||||
return ammMin;
|
return ammMin;
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "bonuses/HeroBonus.h"
|
#include "bonuses/Bonus.h"
|
||||||
#include "bonuses/CBonusSystemNode.h"
|
#include "bonuses/CBonusSystemNode.h"
|
||||||
#include "ConstTransitivePtr.h"
|
#include "ConstTransitivePtr.h"
|
||||||
#include "ResourceSet.h"
|
#include "ResourceSet.h"
|
||||||
@ -169,7 +169,6 @@ public:
|
|||||||
void registerIcons(const IconRegistar & cb) const override;
|
void registerIcons(const IconRegistar & cb) const override;
|
||||||
CreatureID getId() const override;
|
CreatureID getId() const override;
|
||||||
virtual const IBonusBearer * getBonusBearer() const override;
|
virtual const IBonusBearer * getBonusBearer() const override;
|
||||||
uint32_t getMaxHealth() const override;
|
|
||||||
|
|
||||||
int32_t getAdvMapAmountMin() const override;
|
int32_t getAdvMapAmountMin() const override;
|
||||||
int32_t getAdvMapAmountMax() const override;
|
int32_t getAdvMapAmountMax() const override;
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "bonuses/HeroBonus.h"
|
#include "bonuses/Bonus.h"
|
||||||
#include "bonuses/CBonusSystemNode.h"
|
#include "bonuses/CBonusSystemNode.h"
|
||||||
#include "GameConstants.h"
|
#include "GameConstants.h"
|
||||||
#include "CArtHandler.h"
|
#include "CArtHandler.h"
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include "CCreatureHandler.h"
|
#include "CCreatureHandler.h"
|
||||||
#include "VCMI_Lib.h"
|
#include "VCMI_Lib.h"
|
||||||
|
|
||||||
#include "bonuses/HeroBonus.h"
|
#include "bonuses/Bonus.h"
|
||||||
#include "CCreatureSet.h"
|
#include "CCreatureSet.h"
|
||||||
#include "ConstTransitivePtr.h"
|
#include "ConstTransitivePtr.h"
|
||||||
#include "IGameCallback.h"
|
#include "IGameCallback.h"
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
#include "../lib/ConstTransitivePtr.h"
|
#include "../lib/ConstTransitivePtr.h"
|
||||||
#include "GameConstants.h"
|
#include "GameConstants.h"
|
||||||
#include "bonuses/HeroBonus.h"
|
#include "bonuses/Bonus.h"
|
||||||
#include "bonuses/BonusList.h"
|
#include "bonuses/BonusList.h"
|
||||||
#include "IHandlerBase.h"
|
#include "IHandlerBase.h"
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
#include "VCMI_Lib.h"
|
#include "VCMI_Lib.h"
|
||||||
#include "IGameCallback.h"
|
#include "IGameCallback.h"
|
||||||
#include "bonuses/HeroBonus.h"
|
#include "bonuses/Bonus.h"
|
||||||
#include "int3.h"
|
#include "int3.h"
|
||||||
|
|
||||||
#include <boost/heap/fibonacci_heap.hpp>
|
#include <boost/heap/fibonacci_heap.hpp>
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include <vcmi/Player.h>
|
#include <vcmi/Player.h>
|
||||||
#include <vcmi/Team.h>
|
#include <vcmi/Team.h>
|
||||||
|
|
||||||
#include "bonuses/HeroBonus.h"
|
#include "bonuses/Bonus.h"
|
||||||
#include "bonuses/CBonusSystemNode.h"
|
#include "bonuses/CBonusSystemNode.h"
|
||||||
#include "ResourceSet.h"
|
#include "ResourceSet.h"
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include <vcmi/Skill.h>
|
#include <vcmi/Skill.h>
|
||||||
#include <vcmi/SkillService.h>
|
#include <vcmi/SkillService.h>
|
||||||
|
|
||||||
#include "../lib/bonuses/HeroBonus.h"
|
#include "../lib/bonuses/Bonus.h"
|
||||||
#include "GameConstants.h"
|
#include "GameConstants.h"
|
||||||
#include "IHandlerBase.h"
|
#include "IHandlerBase.h"
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@ void CStack::prepareAttacked(BattleStackAttacked & bsa, vstd::RNG & rand, const
|
|||||||
{
|
{
|
||||||
customState->casts.use();
|
customState->casts.use();
|
||||||
bsa.flags |= BattleStackAttacked::REBIRTH;
|
bsa.flags |= BattleStackAttacked::REBIRTH;
|
||||||
int64_t toHeal = customState->MaxHealth() * resurrectedCount;
|
int64_t toHeal = customState->getMaxHealth() * resurrectedCount;
|
||||||
//TODO: add one-battle rebirth?
|
//TODO: add one-battle rebirth?
|
||||||
customState->heal(toHeal, EHealLevel::RESURRECT, EHealPower::PERMANENT);
|
customState->heal(toHeal, EHealLevel::RESURRECT, EHealPower::PERMANENT);
|
||||||
customState->counterAttacks.use(customState->counterAttacks.available());
|
customState->counterAttacks.use(customState->counterAttacks.available());
|
||||||
@ -308,7 +308,7 @@ std::string CStack::getName() const
|
|||||||
|
|
||||||
bool CStack::canBeHealed() const
|
bool CStack::canBeHealed() const
|
||||||
{
|
{
|
||||||
return getFirstHPleft() < static_cast<int32_t>(MaxHealth()) && isValidTarget() && !hasBonusOfType(Bonus::SIEGE_WEAPON);
|
return getFirstHPleft() < static_cast<int32_t>(getMaxHealth()) && isValidTarget() && !hasBonusOfType(Bonus::SIEGE_WEAPON);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CStack::isOnNativeTerrain() const
|
bool CStack::isOnNativeTerrain() const
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "JsonNode.h"
|
#include "JsonNode.h"
|
||||||
#include "bonuses/HeroBonus.h"
|
#include "bonuses/Bonus.h"
|
||||||
#include "bonuses/CBonusSystemNode.h"
|
#include "bonuses/CBonusSystemNode.h"
|
||||||
#include "CCreatureHandler.h" //todo: remove
|
#include "CCreatureHandler.h" //todo: remove
|
||||||
#include "battle/BattleHex.h"
|
#include "battle/BattleHex.h"
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include "filesystem/Filesystem.h"
|
#include "filesystem/Filesystem.h"
|
||||||
#include "mapObjects/CObjectClassesHandler.h"
|
#include "mapObjects/CObjectClassesHandler.h"
|
||||||
#include "mapObjects/CObjectHandler.h"
|
#include "mapObjects/CObjectHandler.h"
|
||||||
#include "bonuses/HeroBonus.h"
|
#include "bonuses/Bonus.h"
|
||||||
#include "bonuses/Propagators.h"
|
#include "bonuses/Propagators.h"
|
||||||
#include "ResourceSet.h"
|
#include "ResourceSet.h"
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#include "IHandlerBase.h"
|
#include "IHandlerBase.h"
|
||||||
#include "LogicalExpression.h"
|
#include "LogicalExpression.h"
|
||||||
#include "battle/BattleHex.h"
|
#include "battle/BattleHex.h"
|
||||||
#include "bonuses/HeroBonus.h"
|
#include "bonuses/Bonus.h"
|
||||||
#include "bonuses/BonusList.h"
|
#include "bonuses/BonusList.h"
|
||||||
#include "Point.h"
|
#include "Point.h"
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#include "ScopeGuard.h"
|
#include "ScopeGuard.h"
|
||||||
|
|
||||||
#include "bonuses/BonusParams.h"
|
#include "bonuses/BonusParams.h"
|
||||||
#include "bonuses/HeroBonus.h"
|
#include "bonuses/Bonus.h"
|
||||||
#include "bonuses/Limiters.h"
|
#include "bonuses/Limiters.h"
|
||||||
#include "bonuses/Propagators.h"
|
#include "bonuses/Propagators.h"
|
||||||
#include "bonuses/Updaters.h"
|
#include "bonuses/Updaters.h"
|
||||||
|
@ -245,7 +245,7 @@
|
|||||||
<Unit filename="GameConstants.cpp" />
|
<Unit filename="GameConstants.cpp" />
|
||||||
<Unit filename="GameConstants.h" />
|
<Unit filename="GameConstants.h" />
|
||||||
<Unit filename="HeroBonus.cpp" />
|
<Unit filename="HeroBonus.cpp" />
|
||||||
<Unit filename="HeroBonus.h" />
|
<Unit filename="Bonus.h" />
|
||||||
<Unit filename="IBonusTypeHandler.h" />
|
<Unit filename="IBonusTypeHandler.h" />
|
||||||
<Unit filename="IGameCallback.cpp" />
|
<Unit filename="IGameCallback.cpp" />
|
||||||
<Unit filename="IGameCallback.h" />
|
<Unit filename="IGameCallback.h" />
|
||||||
|
@ -426,7 +426,7 @@
|
|||||||
<ClInclude Include="logging\CLogger.h" />
|
<ClInclude Include="logging\CLogger.h" />
|
||||||
<ClInclude Include="logging\CBasicLogConfigurator.h" />
|
<ClInclude Include="logging\CBasicLogConfigurator.h" />
|
||||||
<ClInclude Include="GameConstants.h" />
|
<ClInclude Include="GameConstants.h" />
|
||||||
<ClInclude Include="HeroBonus.h" />
|
<ClInclude Include="Bonus.h" />
|
||||||
<ClInclude Include="IGameCallback.h" />
|
<ClInclude Include="IGameCallback.h" />
|
||||||
<ClInclude Include="CGameInfoCallback.h" />
|
<ClInclude Include="CGameInfoCallback.h" />
|
||||||
<ClInclude Include="IGameEventsReceiver.h" />
|
<ClInclude Include="IGameEventsReceiver.h" />
|
||||||
|
@ -407,7 +407,7 @@
|
|||||||
<ClInclude Include="CondSh.h">
|
<ClInclude Include="CondSh.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="HeroBonus.h">
|
<ClInclude Include="Bonus.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="IGameCallback.h">
|
<ClInclude Include="IGameCallback.h">
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "../int3.h"
|
#include "../int3.h"
|
||||||
#include "../bonuses/HeroBonus.h"
|
#include "../bonuses/Bonus.h"
|
||||||
#include "../bonuses/CBonusSystemNode.h"
|
#include "../bonuses/CBonusSystemNode.h"
|
||||||
#include "CBattleInfoCallback.h"
|
#include "CBattleInfoCallback.h"
|
||||||
#include "IBattleState.h"
|
#include "IBattleState.h"
|
||||||
|
@ -179,7 +179,7 @@ void CHealth::init()
|
|||||||
{
|
{
|
||||||
reset();
|
reset();
|
||||||
fullUnits = owner->unitBaseAmount() > 1 ? owner->unitBaseAmount() - 1 : 0;
|
fullUnits = owner->unitBaseAmount() > 1 ? owner->unitBaseAmount() - 1 : 0;
|
||||||
firstHPleft = owner->unitBaseAmount() > 0 ? owner->MaxHealth() : 0;
|
firstHPleft = owner->unitBaseAmount() > 0 ? owner->getMaxHealth() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHealth::addResurrected(int32_t amount)
|
void CHealth::addResurrected(int32_t amount)
|
||||||
@ -190,12 +190,12 @@ void CHealth::addResurrected(int32_t amount)
|
|||||||
|
|
||||||
int64_t CHealth::available() const
|
int64_t CHealth::available() const
|
||||||
{
|
{
|
||||||
return static_cast<int64_t>(firstHPleft) + owner->MaxHealth() * fullUnits;
|
return static_cast<int64_t>(firstHPleft) + owner->getMaxHealth() * fullUnits;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t CHealth::total() const
|
int64_t CHealth::total() const
|
||||||
{
|
{
|
||||||
return static_cast<int64_t>(owner->MaxHealth()) * owner->unitBaseAmount();
|
return static_cast<int64_t>(owner->getMaxHealth()) * owner->unitBaseAmount();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHealth::damage(int64_t & amount)
|
void CHealth::damage(int64_t & amount)
|
||||||
@ -230,7 +230,7 @@ void CHealth::damage(int64_t & amount)
|
|||||||
|
|
||||||
void CHealth::heal(int64_t & amount, EHealLevel level, EHealPower power)
|
void CHealth::heal(int64_t & amount, EHealLevel level, EHealPower power)
|
||||||
{
|
{
|
||||||
const int32_t unitHealth = owner->MaxHealth();
|
const int32_t unitHealth = owner->getMaxHealth();
|
||||||
const int32_t oldCount = getCount();
|
const int32_t oldCount = getCount();
|
||||||
|
|
||||||
int64_t maxHeal = std::numeric_limits<int64_t>::max();
|
int64_t maxHeal = std::numeric_limits<int64_t>::max();
|
||||||
@ -267,7 +267,7 @@ void CHealth::heal(int64_t & amount, EHealLevel level, EHealPower power)
|
|||||||
|
|
||||||
void CHealth::setFromTotal(const int64_t totalHealth)
|
void CHealth::setFromTotal(const int64_t totalHealth)
|
||||||
{
|
{
|
||||||
const int32_t unitHealth = owner->MaxHealth();
|
const int32_t unitHealth = owner->getMaxHealth();
|
||||||
firstHPleft = totalHealth % unitHealth;
|
firstHPleft = totalHealth % unitHealth;
|
||||||
fullUnits = static_cast<int32_t>(totalHealth / unitHealth);
|
fullUnits = static_cast<int32_t>(totalHealth / unitHealth);
|
||||||
|
|
||||||
@ -306,7 +306,7 @@ void CHealth::takeResurrected()
|
|||||||
{
|
{
|
||||||
int64_t totalHealth = available();
|
int64_t totalHealth = available();
|
||||||
|
|
||||||
totalHealth -= resurrected * owner->MaxHealth();
|
totalHealth -= resurrected * owner->getMaxHealth();
|
||||||
vstd::amax(totalHealth, 0);
|
vstd::amax(totalHealth, 0);
|
||||||
setFromTotal(totalHealth);
|
setFromTotal(totalHealth);
|
||||||
resurrected = 0;
|
resurrected = 0;
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#include "CBattleInfoCallback.h"
|
#include "CBattleInfoCallback.h"
|
||||||
#include "Unit.h"
|
#include "Unit.h"
|
||||||
|
|
||||||
#include "../bonuses/HeroBonus.h"
|
#include "../bonuses/Bonus.h"
|
||||||
#include "../mapObjects/CGTownInstance.h"
|
#include "../mapObjects/CGTownInstance.h"
|
||||||
#include "../spells/CSpellHandler.h"
|
#include "../spells/CSpellHandler.h"
|
||||||
#include "../GameSettings.h"
|
#include "../GameSettings.h"
|
||||||
@ -464,7 +464,7 @@ int64_t DamageCalculator::getCasualties(int64_t damageDealt) const
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
int64_t damageLeft = damageDealt - info.defender->getFirstHPleft();
|
int64_t damageLeft = damageDealt - info.defender->getFirstHPleft();
|
||||||
int64_t killsLeft = damageLeft / info.defender->MaxHealth();
|
int64_t killsLeft = damageLeft / info.defender->getMaxHealth();
|
||||||
|
|
||||||
return 1 + killsLeft;
|
return 1 + killsLeft;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#include <vcmi/Creature.h>
|
#include <vcmi/Creature.h>
|
||||||
#include <vcmi/spells/Caster.h>
|
#include <vcmi/spells/Caster.h>
|
||||||
|
|
||||||
#include "../bonuses/HeroBonus.h"
|
#include "../bonuses/Bonus.h"
|
||||||
#include "../bonuses/IBonusBearer.h"
|
#include "../bonuses/IBonusBearer.h"
|
||||||
|
|
||||||
#include "IUnitInfo.h"
|
#include "IUnitInfo.h"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* HeroBonus.cpp, part of VCMI engine
|
* Bonus.cpp, part of VCMI engine
|
||||||
*
|
*
|
||||||
* Authors: listed in file AUTHORS in main folder
|
* Authors: listed in file AUTHORS in main folder
|
||||||
*
|
*
|
||||||
@ -9,7 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "StdInc.h"
|
#include "StdInc.h"
|
||||||
#include "HeroBonus.h"
|
#include "Bonus.h"
|
||||||
#include "CBonusSystemNode.h"
|
#include "CBonusSystemNode.h"
|
||||||
#include "Limiters.h"
|
#include "Limiters.h"
|
||||||
#include "Updaters.h"
|
#include "Updaters.h"
|
||||||
@ -86,7 +86,8 @@ const std::set<std::string> deprecatedBonusSet = {
|
|||||||
"BLOCK_MORALE",
|
"BLOCK_MORALE",
|
||||||
"BLOCK_LUCK",
|
"BLOCK_LUCK",
|
||||||
"SELF_MORALE",
|
"SELF_MORALE",
|
||||||
"SELF_LUCK"
|
"SELF_LUCK",
|
||||||
|
"DIRECT_DAMAGE_IMMUNITY"
|
||||||
};
|
};
|
||||||
|
|
||||||
//This constructor should be placed here to avoid side effects
|
//This constructor should be placed here to avoid side effects
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* HeroBonus.h, part of VCMI engine
|
* Bonus.h, part of VCMI engine
|
||||||
*
|
*
|
||||||
* Authors: listed in file AUTHORS in main folder
|
* Authors: listed in file AUTHORS in main folder
|
||||||
*
|
*
|
@ -9,7 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "HeroBonus.h"
|
#include "Bonus.h"
|
||||||
#include "BonusSelector.h"
|
#include "BonusSelector.h"
|
||||||
|
|
||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "HeroBonus.h"
|
#include "Bonus.h"
|
||||||
|
|
||||||
#include "../GameConstants.h"
|
#include "../GameConstants.h"
|
||||||
#include "../JsonNode.h"
|
#include "../JsonNode.h"
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "HeroBonus.h"
|
#include "Bonus.h"
|
||||||
|
|
||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "HeroBonus.h"
|
#include "Bonus.h"
|
||||||
#include "BonusSelector.h"
|
#include "BonusSelector.h"
|
||||||
|
|
||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* CBonusSystemNode.h, part of VCMI engine
|
* IBonusBearer.h, part of VCMI engine
|
||||||
*
|
*
|
||||||
* Authors: listed in file AUTHORS in main folder
|
* Authors: listed in file AUTHORS in main folder
|
||||||
*
|
*
|
||||||
@ -10,7 +10,7 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "HeroBonus.h"
|
#include "Bonus.h"
|
||||||
|
|
||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "HeroBonus.h"
|
#include "Bonus.h"
|
||||||
#include "battle/BattleHex.h"
|
#include "battle/BattleHex.h"
|
||||||
|
|
||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "HeroBonus.h"
|
#include "Bonus.h"
|
||||||
#include "CBonusSystemNode.h"
|
#include "CBonusSystemNode.h"
|
||||||
|
|
||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "HeroBonus.h"
|
#include "Bonus.h"
|
||||||
|
|
||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
@ -849,12 +849,12 @@ CStackBasicDescriptor CGHeroInstance::calculateNecromancy (const BattleResult &b
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// calculate number of creatures raised - low level units contribute at 50% rate
|
// calculate number of creatures raised - low level units contribute at 50% rate
|
||||||
const double raisedUnitHealth = VLC->creh->objects[creatureTypeRaised]->MaxHealth();
|
const double raisedUnitHealth = VLC->creh->objects[creatureTypeRaised]->getMaxHealth();
|
||||||
double raisedUnits = 0;
|
double raisedUnits = 0;
|
||||||
for(const auto & casualty : casualties)
|
for(const auto & casualty : casualties)
|
||||||
{
|
{
|
||||||
const CCreature * c = VLC->creh->objects[casualty.first];
|
const CCreature * c = VLC->creh->objects[casualty.first];
|
||||||
double raisedFromCasualty = std::min(c->MaxHealth() / raisedUnitHealth, 1.0) * casualty.second * necromancySkill;
|
double raisedFromCasualty = std::min(c->getMaxHealth() / raisedUnitHealth, 1.0) * casualty.second * necromancySkill;
|
||||||
if(c->getLevel() < requiredCasualtyLevel)
|
if(c->getLevel() < requiredCasualtyLevel)
|
||||||
raisedFromCasualty *= 0.5;
|
raisedFromCasualty *= 0.5;
|
||||||
raisedUnits += raisedFromCasualty;
|
raisedUnits += raisedFromCasualty;
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include "CGTownInstance.h"
|
#include "CGTownInstance.h"
|
||||||
#include "CObjectClassesHandler.h"
|
#include "CObjectClassesHandler.h"
|
||||||
#include "../spells/CSpellHandler.h"
|
#include "../spells/CSpellHandler.h"
|
||||||
#include "../bonuses/HeroBonus.h"
|
#include "../bonuses/Bonus.h"
|
||||||
#include "../battle/IBattleInfoCallback.h"
|
#include "../battle/IBattleInfoCallback.h"
|
||||||
#include "../NetPacks.h"
|
#include "../NetPacks.h"
|
||||||
#include "../CConfigHandler.h"
|
#include "../CConfigHandler.h"
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#include "../NetPacksBase.h"
|
#include "../NetPacksBase.h"
|
||||||
#include "../ResourceSet.h"
|
#include "../ResourceSet.h"
|
||||||
|
|
||||||
#include "../bonuses/HeroBonus.h"
|
#include "../bonuses/Bonus.h"
|
||||||
|
|
||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
@ -1895,7 +1895,7 @@ void CGSirens::onHeroVisit( const CGHeroInstance * h ) const
|
|||||||
if(drown)
|
if(drown)
|
||||||
{
|
{
|
||||||
cb->changeStackCount(StackLocation(h, i->first), -drown);
|
cb->changeStackCount(StackLocation(h, i->first), -drown);
|
||||||
xp += drown * i->second->type->MaxHealth();
|
xp += drown * i->second->type->getMaxHealth();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#include "../JsonNode.h"
|
#include "../JsonNode.h"
|
||||||
|
|
||||||
#include "../bonuses/CBonusSystemNode.h"
|
#include "../bonuses/CBonusSystemNode.h"
|
||||||
#include "../bonuses/HeroBonus.h"
|
#include "../bonuses/Bonus.h"
|
||||||
|
|
||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
#include "../NetPacksBase.h"
|
#include "../NetPacksBase.h"
|
||||||
#include "../battle/Unit.h"
|
#include "../battle/Unit.h"
|
||||||
#include "../bonuses/HeroBonus.h"
|
#include "../bonuses/Bonus.h"
|
||||||
|
|
||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#include "../int3.h"
|
#include "../int3.h"
|
||||||
#include "../GameConstants.h"
|
#include "../GameConstants.h"
|
||||||
#include "../battle/BattleHex.h"
|
#include "../battle/BattleHex.h"
|
||||||
#include "../bonuses/HeroBonus.h"
|
#include "../bonuses/Bonus.h"
|
||||||
|
|
||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#include "../CRandomGenerator.h"
|
#include "../CRandomGenerator.h"
|
||||||
#include "../VCMI_Lib.h"
|
#include "../VCMI_Lib.h"
|
||||||
|
|
||||||
#include "../bonuses/HeroBonus.h"
|
#include "../bonuses/Bonus.h"
|
||||||
#include "../battle/CBattleInfoCallback.h"
|
#include "../battle/CBattleInfoCallback.h"
|
||||||
#include "../battle/IBattleState.h"
|
#include "../battle/IBattleState.h"
|
||||||
#include "../battle/Unit.h"
|
#include "../battle/Unit.h"
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#include "../battle/Destination.h"
|
#include "../battle/Destination.h"
|
||||||
#include "../int3.h"
|
#include "../int3.h"
|
||||||
#include "../GameConstants.h"
|
#include "../GameConstants.h"
|
||||||
#include "../bonuses/HeroBonus.h"
|
#include "../bonuses/Bonus.h"
|
||||||
|
|
||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
@ -107,11 +107,11 @@ int64_t Damage::damageForTarget(size_t targetIndex, const Mechanics * m, const b
|
|||||||
if(killByPercentage)
|
if(killByPercentage)
|
||||||
{
|
{
|
||||||
int64_t amountToKill = target->getCount() * m->getEffectValue() / 100;
|
int64_t amountToKill = target->getCount() * m->getEffectValue() / 100;
|
||||||
baseDamage = amountToKill * target->MaxHealth();
|
baseDamage = amountToKill * target->getMaxHealth();
|
||||||
}
|
}
|
||||||
else if(killByCount)
|
else if(killByCount)
|
||||||
{
|
{
|
||||||
baseDamage = m->getEffectValue() * target->MaxHealth();
|
baseDamage = m->getEffectValue() * target->getMaxHealth();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -59,7 +59,7 @@ bool Heal::isValidTarget(const Mechanics * m, const battle::Unit * unit) const
|
|||||||
if(minFullUnits > 0)
|
if(minFullUnits > 0)
|
||||||
{
|
{
|
||||||
auto hpGained = std::min(m->getEffectValue(), injuries);
|
auto hpGained = std::min(m->getEffectValue(), injuries);
|
||||||
if(hpGained < minFullUnits * unit->MaxHealth())
|
if(hpGained < minFullUnits * unit->getMaxHealth())
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ EffectTarget Sacrifice::transformTarget(const Mechanics * m, const Target & aimP
|
|||||||
|
|
||||||
int64_t Sacrifice::calculateHealEffectValue(const Mechanics * m, const battle::Unit * victim)
|
int64_t Sacrifice::calculateHealEffectValue(const Mechanics * m, const battle::Unit * victim)
|
||||||
{
|
{
|
||||||
return (m->getEffectPower() + victim->MaxHealth() + m->calculateRawEffectValue(0, 1)) * victim->getCount();
|
return (m->getEffectPower() + victim->getMaxHealth() + m->calculateRawEffectValue(0, 1)) * victim->getCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ void Summon::apply(ServerCallback * server, const Mechanics * m, const EffectTar
|
|||||||
{
|
{
|
||||||
const battle::Unit * summoned = dest.unitValue;
|
const battle::Unit * summoned = dest.unitValue;
|
||||||
std::shared_ptr<battle::Unit> state = summoned->acquire();
|
std::shared_ptr<battle::Unit> state = summoned->acquire();
|
||||||
int64_t healthValue = (summonByHealth ? valueWithBonus : (valueWithBonus * summoned->MaxHealth()));
|
int64_t healthValue = (summonByHealth ? valueWithBonus : (valueWithBonus * summoned->getMaxHealth()));
|
||||||
state->heal(healthValue, EHealLevel::OVERHEAL, (permanent ? EHealPower::PERMANENT : EHealPower::ONE_BATTLE));
|
state->heal(healthValue, EHealLevel::OVERHEAL, (permanent ? EHealPower::PERMANENT : EHealPower::ONE_BATTLE));
|
||||||
pack.changedStacks.emplace_back(summoned->unitId(), UnitChanges::EOperation::RESET_STATE);
|
pack.changedStacks.emplace_back(summoned->unitId(), UnitChanges::EOperation::RESET_STATE);
|
||||||
state->save(pack.changedStacks.back().data);
|
state->save(pack.changedStacks.back().data);
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
#include "../LuaStack.h"
|
#include "../LuaStack.h"
|
||||||
#include "../LuaCallWrapper.h"
|
#include "../LuaCallWrapper.h"
|
||||||
#include "../../../lib/bonuses/HeroBonus.h"
|
#include "../../../lib/bonuses/Bonus.h"
|
||||||
#include "../../../lib/bonuses/IBonusBearer.h"
|
#include "../../../lib/bonuses/IBonusBearer.h"
|
||||||
|
|
||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include "BonusSystem.h"
|
#include "BonusSystem.h"
|
||||||
|
|
||||||
#include "../../../lib/bonuses/BonusList.h"
|
#include "../../../lib/bonuses/BonusList.h"
|
||||||
#include "../../../lib/bonuses/HeroBonus.h"
|
#include "../../../lib/bonuses/Bonus.h"
|
||||||
#include "../../../lib/bonuses/IBonusBearer.h"
|
#include "../../../lib/bonuses/IBonusBearer.h"
|
||||||
|
|
||||||
#include "Registry.h"
|
#include "Registry.h"
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
#include "../LuaStack.h"
|
#include "../LuaStack.h"
|
||||||
#include "../LuaCallWrapper.h"
|
#include "../LuaCallWrapper.h"
|
||||||
#include "../../../lib/bonuses/HeroBonus.h"
|
#include "../../../lib/bonuses/Bonus.h"
|
||||||
#include "../../../lib/bonuses/IBonusBearer.h"
|
#include "../../../lib/bonuses/IBonusBearer.h"
|
||||||
|
|
||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
@ -1158,7 +1158,7 @@ int64_t CGameHandler::applyBattleEffects(BattleAttack & bat, std::shared_ptr<bat
|
|||||||
{
|
{
|
||||||
if(attackerState->hasBonusOfType(Bonus::SOUL_STEAL, subtype))
|
if(attackerState->hasBonusOfType(Bonus::SOUL_STEAL, subtype))
|
||||||
{
|
{
|
||||||
int64_t toHeal = bsa.killedAmount * attackerState->valOfBonuses(Bonus::SOUL_STEAL, subtype) * attackerState->MaxHealth();
|
int64_t toHeal = bsa.killedAmount * attackerState->valOfBonuses(Bonus::SOUL_STEAL, subtype) * attackerState->getMaxHealth();
|
||||||
attackerState->heal(toHeal, EHealLevel::OVERHEAL, ((subtype == 0) ? EHealPower::ONE_BATTLE : EHealPower::PERMANENT));
|
attackerState->heal(toHeal, EHealLevel::OVERHEAL, ((subtype == 0) ? EHealPower::ONE_BATTLE : EHealPower::PERMANENT));
|
||||||
drainedLife += toHeal;
|
drainedLife += toHeal;
|
||||||
break;
|
break;
|
||||||
@ -6003,7 +6003,7 @@ void CGameHandler::handleAfterAttackCasting(bool ranged, const CStack * attacker
|
|||||||
resurrectInfo.type = attacker->creatureId();
|
resurrectInfo.type = attacker->creatureId();
|
||||||
|
|
||||||
if(attacker->hasBonusOfType((Bonus::TRANSMUTATION), 0))
|
if(attacker->hasBonusOfType((Bonus::TRANSMUTATION), 0))
|
||||||
resurrectInfo.count = std::max((defender->getCount() * defender->MaxHealth()) / resurrectInfo.type.toCreature()->MaxHealth(), 1u);
|
resurrectInfo.count = std::max((defender->getCount() * defender->getMaxHealth()) / resurrectInfo.type.toCreature()->getMaxHealth(), 1u);
|
||||||
else if (attacker->hasBonusOfType((Bonus::TRANSMUTATION), 1))
|
else if (attacker->hasBonusOfType((Bonus::TRANSMUTATION), 1))
|
||||||
resurrectInfo.count = defender->getCount();
|
resurrectInfo.count = defender->getCount();
|
||||||
else
|
else
|
||||||
@ -6044,7 +6044,7 @@ void CGameHandler::handleAfterAttackCasting(bool ranged, const CStack * attacker
|
|||||||
BattleStackAttacked bsa;
|
BattleStackAttacked bsa;
|
||||||
bsa.attackerID = -1;
|
bsa.attackerID = -1;
|
||||||
bsa.stackAttacked = defender->unitId();
|
bsa.stackAttacked = defender->unitId();
|
||||||
bsa.damageAmount = amountToDie * defender->MaxHealth();
|
bsa.damageAmount = amountToDie * defender->getMaxHealth();
|
||||||
bsa.flags = BattleStackAttacked::SPELL_EFFECT;
|
bsa.flags = BattleStackAttacked::SPELL_EFFECT;
|
||||||
bsa.spellID = SpellID::SLAYER;
|
bsa.spellID = SpellID::SLAYER;
|
||||||
defender->prepareAttacked(bsa, getRandomGenerator());
|
defender->prepareAttacked(bsa, getRandomGenerator());
|
||||||
@ -6488,7 +6488,7 @@ void CGameHandler::runBattle()
|
|||||||
bte.stackID = stack->unitId();
|
bte.stackID = stack->unitId();
|
||||||
bte.effect = Bonus::HP_REGENERATION;
|
bte.effect = Bonus::HP_REGENERATION;
|
||||||
|
|
||||||
const int32_t lostHealth = stack->MaxHealth() - stack->getFirstHPleft();
|
const int32_t lostHealth = stack->getMaxHealth() - stack->getFirstHPleft();
|
||||||
if(stack->hasBonusOfType(Bonus::HP_REGENERATION))
|
if(stack->hasBonusOfType(Bonus::HP_REGENERATION))
|
||||||
bte.val = std::min(lostHealth, stack->valOfBonuses(Bonus::HP_REGENERATION));
|
bte.val = std::min(lostHealth, stack->valOfBonuses(Bonus::HP_REGENERATION));
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ public:
|
|||||||
|
|
||||||
static void checkTotal(const CHealth & health, const UnitMock & mock)
|
static void checkTotal(const CHealth & health, const UnitMock & mock)
|
||||||
{
|
{
|
||||||
EXPECT_EQ(health.total(), mock.MaxHealth() * mock.unitBaseAmount());
|
EXPECT_EQ(health.total(), mock.getMaxHealth() * mock.unitBaseAmount());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void checkEmptyHealth(const CHealth & health, const UnitMock & mock)
|
static void checkEmptyHealth(const CHealth & health, const UnitMock & mock)
|
||||||
@ -58,9 +58,9 @@ static void checkFullHealth(const CHealth & health, const UnitMock & mock)
|
|||||||
{
|
{
|
||||||
checkTotal(health, mock);
|
checkTotal(health, mock);
|
||||||
EXPECT_EQ(health.getCount(), mock.unitBaseAmount());
|
EXPECT_EQ(health.getCount(), mock.unitBaseAmount());
|
||||||
EXPECT_EQ(health.getFirstHPleft(), mock.MaxHealth());
|
EXPECT_EQ(health.getFirstHPleft(), mock.getMaxHealth());
|
||||||
EXPECT_EQ(health.getResurrected(), 0);
|
EXPECT_EQ(health.getResurrected(), 0);
|
||||||
EXPECT_EQ(health.available(), mock.MaxHealth() * mock.unitBaseAmount());
|
EXPECT_EQ(health.available(), mock.getMaxHealth() * mock.unitBaseAmount());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void checkDamage(CHealth & health, const int64_t initialDamage, const int64_t expectedDamage)
|
static void checkDamage(CHealth & health, const int64_t initialDamage, const int64_t expectedDamage)
|
||||||
@ -110,7 +110,7 @@ TEST_F(HealthTest, damage)
|
|||||||
checkNormalDamage(health, 0);
|
checkNormalDamage(health, 0);
|
||||||
checkFullHealth(health, mock);
|
checkFullHealth(health, mock);
|
||||||
|
|
||||||
checkNormalDamage(health, mock.MaxHealth() - 1);
|
checkNormalDamage(health, mock.getMaxHealth() - 1);
|
||||||
EXPECT_EQ(health.getCount(), UNIT_AMOUNT);
|
EXPECT_EQ(health.getCount(), UNIT_AMOUNT);
|
||||||
EXPECT_EQ(health.getFirstHPleft(), 1);
|
EXPECT_EQ(health.getFirstHPleft(), 1);
|
||||||
EXPECT_EQ(health.getResurrected(), 0);
|
EXPECT_EQ(health.getResurrected(), 0);
|
||||||
|
@ -374,7 +374,7 @@ TEST_F(CGameStateTest, battleResurrection)
|
|||||||
|
|
||||||
ASSERT_NE(unit, nullptr);
|
ASSERT_NE(unit, nullptr);
|
||||||
|
|
||||||
int64_t damage = unit->MaxHealth() + 1;
|
int64_t damage = unit->getMaxHealth() + 1;
|
||||||
|
|
||||||
unit->damage(damage);
|
unit->damage(damage);
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../../lib/bonuses/BonusList.h"
|
#include "../../lib/bonuses/BonusList.h"
|
||||||
#include "../../lib/bonuses/HeroBonus.h"
|
#include "../../lib/bonuses/Bonus.h"
|
||||||
#include "../../lib/bonuses/IBonusBearer.h"
|
#include "../../lib/bonuses/IBonusBearer.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include "../../lib/ScriptHandler.h"
|
#include "../../lib/ScriptHandler.h"
|
||||||
#include "../../lib/NetPacksBase.h"
|
#include "../../lib/NetPacksBase.h"
|
||||||
#include "../../lib/battle/CBattleInfoCallback.h"
|
#include "../../lib/battle/CBattleInfoCallback.h"
|
||||||
#include "../../lib/bonuses/HeroBonus.h"
|
#include "../../lib/bonuses/Bonus.h"
|
||||||
|
|
||||||
#include "../mock/mock_ServerCallback.h"
|
#include "../mock/mock_ServerCallback.h"
|
||||||
#include "../mock/mock_IBattleInfoCallback.h"
|
#include "../mock/mock_IBattleInfoCallback.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user