2022-11-24 16:30:04 +02:00
|
|
|
/*
|
|
|
|
* CBattleEffectsController.h, part of VCMI engine
|
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "../../lib/battle/BattleHex.h"
|
|
|
|
|
2022-11-29 02:00:08 +02:00
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
|
2022-11-24 16:30:04 +02:00
|
|
|
class BattleAction;
|
2022-11-29 02:00:08 +02:00
|
|
|
struct CustomEffectInfo;
|
|
|
|
struct BattleTriggerEffect;
|
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_END
|
|
|
|
|
|
|
|
struct SDL_Surface;
|
2022-11-24 16:30:04 +02:00
|
|
|
class CAnimation;
|
2022-11-26 23:12:20 +02:00
|
|
|
class CCanvas;
|
2022-12-09 13:26:17 +02:00
|
|
|
class BattleInterface;
|
|
|
|
class BattleRenderer;
|
2022-12-01 22:06:42 +02:00
|
|
|
class CPointEffectAnimation;
|
2022-11-24 16:30:04 +02:00
|
|
|
|
|
|
|
namespace EBattleEffect
|
|
|
|
{
|
|
|
|
enum EBattleEffect
|
|
|
|
{
|
|
|
|
// list of battle effects that have hardcoded triggers
|
|
|
|
FEAR = 15,
|
|
|
|
GOOD_LUCK = 18,
|
|
|
|
GOOD_MORALE = 20,
|
|
|
|
BAD_MORALE = 30,
|
|
|
|
BAD_LUCK = 48,
|
|
|
|
RESURRECT = 50,
|
2022-12-01 22:06:42 +02:00
|
|
|
DRAIN_LIFE = 52, // hardcoded constant in CGameHandler
|
2022-11-24 16:30:04 +02:00
|
|
|
POISON = 67,
|
|
|
|
DEATH_BLOW = 73,
|
|
|
|
REGENERATION = 74,
|
|
|
|
MANA_DRAIN = 77,
|
|
|
|
|
|
|
|
INVALID = -1,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Struct for battle effect animation e.g. morale, prayer, armageddon, bless,...
|
|
|
|
struct BattleEffect
|
|
|
|
{
|
|
|
|
int x, y; //position on the screen
|
|
|
|
float currentFrame;
|
|
|
|
std::shared_ptr<CAnimation> animation;
|
|
|
|
int effectID; //uniqueID equal ot ID of appropriate CSpellEffectAnim
|
|
|
|
BattleHex position; //Indicates if effect which hex the effect is drawn on
|
|
|
|
};
|
|
|
|
|
2022-12-09 13:26:17 +02:00
|
|
|
class BattleEffectsController
|
2022-11-24 16:30:04 +02:00
|
|
|
{
|
2022-12-09 13:26:17 +02:00
|
|
|
BattleInterface * owner;
|
2022-11-24 16:30:04 +02:00
|
|
|
|
2022-11-25 00:26:14 +02:00
|
|
|
/// list of current effects that are being displayed on screen (spells & creature abilities)
|
|
|
|
std::vector<BattleEffect> battleEffects;
|
|
|
|
|
2022-11-24 16:30:04 +02:00
|
|
|
public:
|
2022-12-09 13:26:17 +02:00
|
|
|
BattleEffectsController(BattleInterface * owner);
|
2022-11-24 16:30:04 +02:00
|
|
|
|
|
|
|
void startAction(const BattleAction* action);
|
|
|
|
|
|
|
|
void displayCustomEffects(const std::vector<CustomEffectInfo> & customEffects);
|
|
|
|
|
2022-12-01 22:06:42 +02:00
|
|
|
//displays custom effect on the battlefield
|
|
|
|
void displayEffect(EBattleEffect::EBattleEffect effect, const BattleHex & destTile);
|
|
|
|
void displayEffect(EBattleEffect::EBattleEffect effect, uint32_t soundID, const BattleHex & destTile);
|
|
|
|
//void displayEffects(EBattleEffect::EBattleEffect effect, uint32_t soundID, const std::vector<BattleHex> & destTiles);
|
|
|
|
|
2022-11-24 16:30:04 +02:00
|
|
|
void battleTriggerEffect(const BattleTriggerEffect & bte);
|
2022-11-25 00:26:14 +02:00
|
|
|
|
2022-12-09 13:26:17 +02:00
|
|
|
void collectRenderableObjects(BattleRenderer & renderer);
|
2022-11-24 16:30:04 +02:00
|
|
|
|
2022-12-01 22:06:42 +02:00
|
|
|
friend class CPointEffectAnimation;
|
2022-11-24 16:30:04 +02:00
|
|
|
};
|