1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Implemented giving bonuses to commanders

This commit is contained in:
Ivan Savenko
2025-05-07 22:44:44 +03:00
parent 434da3ffe1
commit 6b6199d3a4
7 changed files with 25 additions and 2 deletions

View File

@@ -1014,6 +1014,9 @@ void GiveBonus::applyGs(CGameState *gs)
case ETarget::OBJECT:
cbsn = dynamic_cast<CBonusSystemNode*>(gs->getObjInstance(id.as<ObjectInstanceID>()));
break;
case ETarget::HERO_COMMANDER:
cbsn = gs->getHero(id.as<ObjectInstanceID>())->getCommander();
break;
case ETarget::PLAYER:
cbsn = gs->getPlayerState(id.as<PlayerColor>());
break;

View File

@@ -409,8 +409,14 @@ struct DLL_LINKAGE SetAvailableHero : public CPackForClient
struct DLL_LINKAGE GiveBonus : public CPackForClient
{
using VariantType = VariantIdentifier<ObjectInstanceID, PlayerColor, BattleID>;
enum class ETarget : int8_t { OBJECT, PLAYER, BATTLE };
enum class ETarget : int8_t
{
OBJECT,
PLAYER,
BATTLE,
HERO_COMMANDER
};
explicit GiveBonus(ETarget Who = ETarget::OBJECT)
:who(Who)
{