mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
Start spell-relatet files reorganisation
* moved existing files to separate directory -> todo: split mechanics
This commit is contained in:
parent
c7c235c0ca
commit
685deddac1
@ -4,7 +4,7 @@
|
||||
#include "../../lib/BattleState.h"
|
||||
#include "../../CCallback.h"
|
||||
#include "../../lib/CCreatureHandler.h"
|
||||
#include "../../lib/CSpellHandler.h"
|
||||
#include "../../lib/spells/CSpellHandler.h"
|
||||
#include "../../lib/VCMI_Lib.h"
|
||||
|
||||
using boost::optional;
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include "../../lib/CBuildingHandler.h"
|
||||
#include "../../lib/CCreatureHandler.h"
|
||||
#include "../../lib/CTownHandler.h"
|
||||
#include "../../lib/CSpellHandler.h"
|
||||
#include "../../lib/spells/CSpellHandler.h"
|
||||
#include "../../lib/Connection.h"
|
||||
#include "../../lib/CGameState.h"
|
||||
#include "../../lib/mapping/CMap.h"
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "../../lib/CBuildingHandler.h"
|
||||
#include "../../lib/CCreatureHandler.h"
|
||||
#include "../../lib/CTownHandler.h"
|
||||
#include "../../lib/CSpellHandler.h"
|
||||
#include "../../lib/spells/CSpellHandler.h"
|
||||
#include "../../lib/Connection.h"
|
||||
#include "../../lib/CGameState.h"
|
||||
#include "../../lib/mapping/CMap.h"
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "lib/Connection.h"
|
||||
#include "lib/NetPacks.h"
|
||||
#include "client/mapHandler.h"
|
||||
#include "lib/CSpellHandler.h"
|
||||
#include "lib/spells/CSpellHandler.h"
|
||||
#include "lib/CArtHandler.h"
|
||||
#include "lib/GameConstants.h"
|
||||
#ifdef min
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "CVideoHandler.h"
|
||||
#include "../lib/CHeroHandler.h"
|
||||
#include "../lib/CCreatureHandler.h"
|
||||
#include "../lib/CSpellHandler.h"
|
||||
#include "../lib/spells/CSpellHandler.h"
|
||||
#include "CMusicHandler.h"
|
||||
#include "CVideoHandler.h"
|
||||
#include "CDefHandler.h"
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include "CMusicHandler.h"
|
||||
#include "CGameInfo.h"
|
||||
#include "../lib/CCreatureHandler.h"
|
||||
#include "../lib/CSpellHandler.h"
|
||||
#include "../lib/spells/CSpellHandler.h"
|
||||
#include "../lib/JsonNode.h"
|
||||
#include "../lib/GameConstants.h"
|
||||
#include "../lib/filesystem/Filesystem.h"
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "../lib/CGeneralTextHandler.h"
|
||||
#include "../lib/CHeroHandler.h"
|
||||
#include "../lib/Connection.h"
|
||||
#include "../lib/CSpellHandler.h"
|
||||
#include "../lib/spells/CSpellHandler.h"
|
||||
#include "../lib/CTownHandler.h"
|
||||
#include "../lib/mapObjects/CObjectClassesHandler.h" // For displaying correct UI when interacting with objects
|
||||
#include "../lib/BattleState.h"
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "CPlayerInterface.h"
|
||||
#include "../CCallback.h"
|
||||
#include "CMessage.h"
|
||||
#include "../lib/CSpellHandler.h" /*for campaign bonuses*/
|
||||
#include "../lib/spells/CSpellHandler.h" /*for campaign bonuses*/
|
||||
#include "../lib/CArtHandler.h" /*for campaign bonuses*/
|
||||
#include "../lib/CBuildingHandler.h" /*for campaign bonuses*/
|
||||
#include "CBitmapHandler.h"
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "../lib/CHeroHandler.h"
|
||||
#include "../lib/CTownHandler.h"
|
||||
#include "../lib/CBuildingHandler.h"
|
||||
#include "../lib/CSpellHandler.h"
|
||||
#include "../lib/spells/CSpellHandler.h"
|
||||
#include "../lib/Connection.h"
|
||||
#ifndef VCMI_ANDROID
|
||||
#include "../lib/Interprocess.h"
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "../lib/CGeneralTextHandler.h"
|
||||
#include "../lib/CCreatureHandler.h"
|
||||
#include "CBitmapHandler.h"
|
||||
#include "../lib/CSpellHandler.h"
|
||||
#include "../lib/spells/CSpellHandler.h"
|
||||
#include "../lib/CGameState.h"
|
||||
#include "../lib/JsonNode.h"
|
||||
#include "../lib/vcmi_endian.h"
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "../lib/VCMI_Lib.h"
|
||||
#include "../lib/mapping/CMap.h"
|
||||
#include "../lib/VCMIDirs.h"
|
||||
#include "../lib/CSpellHandler.h"
|
||||
#include "../lib/spells/CSpellHandler.h"
|
||||
#include "../lib/CSoundBase.h"
|
||||
#include "../lib/StartInfo.h"
|
||||
#include "mapHandler.h"
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "../../lib/BattleState.h"
|
||||
#include "../../lib/CTownHandler.h"
|
||||
#include "../../lib/mapObjects/CGTownInstance.h"
|
||||
#include "../../lib/CSpellHandler.h"
|
||||
#include "../../lib/spells/CSpellHandler.h"
|
||||
|
||||
/*
|
||||
* CBattleAnimations.cpp, part of VCMI engine
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "../../lib/CHeroHandler.h"
|
||||
#include "../../lib/CondSh.h"
|
||||
#include "../../lib/CRandomGenerator.h"
|
||||
#include "../../lib/CSpellHandler.h"
|
||||
#include "../../lib/spells/CSpellHandler.h"
|
||||
#include "../../lib/CTownHandler.h"
|
||||
#include "../../lib/CGameState.h"
|
||||
#include "../../lib/mapping/CMap.h"
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "../../CCallback.h"
|
||||
|
||||
#include "../../lib/CArtHandler.h"
|
||||
#include "../../lib/CSpellHandler.h"
|
||||
#include "../../lib/spells/CSpellHandler.h"
|
||||
#include "../../lib/CGeneralTextHandler.h"
|
||||
|
||||
#include "../../lib/mapObjects/CGHeroInstance.h"
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "../../lib/CArtHandler.h"
|
||||
#include "../../lib/CTownHandler.h"
|
||||
#include "../../lib/CCreatureHandler.h"
|
||||
#include "../../lib/CSpellHandler.h"
|
||||
#include "../../lib/spells/CSpellHandler.h"
|
||||
#include "../../lib/CGeneralTextHandler.h"
|
||||
#include "../../lib/NetPacksBase.h"
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include "../../lib/CGeneralTextHandler.h"
|
||||
#include "../../lib/CHeroHandler.h"
|
||||
#include "../../lib/CSoundBase.h"
|
||||
#include "../../lib/CSpellHandler.h"
|
||||
#include "../../lib/spells/CSpellHandler.h"
|
||||
#include "../../lib/CTownHandler.h"
|
||||
#include "../../lib/JsonNode.h"
|
||||
#include "../../lib/mapObjects/CGHeroInstance.h"
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "../../lib/CCreatureHandler.h"
|
||||
#include "../../lib/CGeneralTextHandler.h"
|
||||
#include "../../lib/CModHandler.h"
|
||||
#include "../../lib/CSpellHandler.h"
|
||||
#include "../../lib/spells/CSpellHandler.h"
|
||||
#include "../../lib/CTownHandler.h"
|
||||
#include "../../lib/GameConstants.h"
|
||||
#include "../../lib/mapObjects/CGHeroInstance.h"
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "../../lib/CGeneralTextHandler.h"
|
||||
#include "../../lib/CModHandler.h"
|
||||
#include "../../lib/CHeroHandler.h"
|
||||
#include "../../lib/CSpellHandler.h"
|
||||
#include "../../lib/spells/CSpellHandler.h"
|
||||
#include "../../lib/CGameState.h"
|
||||
|
||||
using namespace CSDL_Ext;
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "../../lib/CConfigHandler.h"
|
||||
#include "../../lib/CGeneralTextHandler.h"
|
||||
#include "../../lib/CHeroHandler.h"
|
||||
#include "../../lib/CSpellHandler.h"
|
||||
#include "../../lib/spells/CSpellHandler.h"
|
||||
#include "../../lib/GameConstants.h"
|
||||
#include "../../lib/CGameState.h"
|
||||
#include "../../lib/mapObjects/CGTownInstance.h"
|
||||
|
@ -42,7 +42,7 @@
|
||||
#include "../lib/CHeroHandler.h"
|
||||
#include "../lib/CModHandler.h"
|
||||
#include "../lib/CondSh.h"
|
||||
#include "../lib/CSpellHandler.h"
|
||||
#include "../lib/spells/CSpellHandler.h"
|
||||
#include "../lib/CStopWatch.h"
|
||||
#include "../lib/CTownHandler.h"
|
||||
#include "../lib/GameConstants.h"
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "mapObjects/CObjectHandler.h"
|
||||
#include "CHeroHandler.h"
|
||||
#include "CCreatureHandler.h"
|
||||
#include "CSpellHandler.h"
|
||||
#include "spells/CSpellHandler.h"
|
||||
#include "CTownHandler.h"
|
||||
#include "NetPacks.h"
|
||||
#include "JsonNode.h"
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "CGeneralTextHandler.h"
|
||||
#include "VCMI_Lib.h"
|
||||
#include "CModHandler.h"
|
||||
#include "CSpellHandler.h"
|
||||
#include "spells/CSpellHandler.h"
|
||||
#include "mapObjects/MapObjects.h"
|
||||
#include "NetPacksBase.h"
|
||||
#include "GameConstants.h"
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "BattleState.h"
|
||||
#include "CGameState.h"
|
||||
#include "NetPacks.h"
|
||||
#include "CSpellHandler.h"
|
||||
#include "spells/CSpellHandler.h"
|
||||
#include "VCMI_Lib.h"
|
||||
#include "CTownHandler.h"
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#include "GameConstants.h"
|
||||
#include "CCreatureHandler.h"
|
||||
#include "CSpellHandler.h"
|
||||
#include "spells/CSpellHandler.h"
|
||||
|
||||
///MacroString
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "IGameCallback.h"
|
||||
#include "CGameState.h"
|
||||
#include "CGeneralTextHandler.h"
|
||||
#include "CSpellHandler.h"
|
||||
#include "spells/CSpellHandler.h"
|
||||
#include "CHeroHandler.h"
|
||||
#include "IBonusTypeHandler.h"
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include "BattleState.h" // for BattleInfo
|
||||
#include "NetPacks.h" // for InfoWindow
|
||||
#include "CModHandler.h"
|
||||
#include "CSpellHandler.h"
|
||||
#include "spells/CSpellHandler.h"
|
||||
|
||||
//TODO make clean
|
||||
#define ERROR_VERBOSE_OR_NOT_RET_VAL_IF(cond, verbose, txt, retVal) do {if(cond){if(verbose)logGlobal->errorStream() << BOOST_CURRENT_FUNCTION << ": " << txt; return retVal;}} while(0)
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "CBuildingHandler.h"
|
||||
#include "CGeneralTextHandler.h"
|
||||
#include "CTownHandler.h"
|
||||
#include "CSpellHandler.h"
|
||||
#include "spells/CSpellHandler.h"
|
||||
#include "CHeroHandler.h"
|
||||
#include "mapObjects/CObjectHandler.h"
|
||||
#include "CCreatureHandler.h"
|
||||
|
@ -54,6 +54,9 @@ set(lib_SRCS
|
||||
rmg/CZoneGraphGenerator.cpp
|
||||
rmg/CZonePlacer.cpp
|
||||
|
||||
spells/CSpellHandler.cpp
|
||||
spells/ISpellMechanics.cpp
|
||||
|
||||
BattleAction.cpp
|
||||
BattleHex.cpp
|
||||
BattleState.cpp
|
||||
@ -71,7 +74,7 @@ set(lib_SRCS
|
||||
CModHandler.cpp
|
||||
CObstacleInstance.cpp
|
||||
CRandomGenerator.cpp
|
||||
CSpellHandler.cpp
|
||||
|
||||
CThreadHelper.cpp
|
||||
CTownHandler.cpp
|
||||
GameConstants.cpp
|
||||
@ -83,7 +86,6 @@ set(lib_SRCS
|
||||
VCMI_Lib.cpp
|
||||
VCMIDirs.cpp
|
||||
IHandlerBase.cpp
|
||||
SpellMechanics.cpp
|
||||
|
||||
IGameCallback.cpp
|
||||
CGameInfoCallback.cpp
|
||||
@ -96,7 +98,7 @@ set(lib_SRCS
|
||||
registerTypes/TypesClientPacks2.cpp
|
||||
registerTypes/TypesMapObjects1.cpp
|
||||
registerTypes/TypesMapObjects2.cpp
|
||||
registerTypes/TypesMapObjects3.cpp
|
||||
registerTypes/TypesMapObjects3.cpp
|
||||
registerTypes/TypesPregamePacks.cpp
|
||||
registerTypes/TypesServerPacks.cpp
|
||||
)
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "StringConstants.h"
|
||||
#include "CStopWatch.h"
|
||||
#include "IHandlerBase.h"
|
||||
#include "CSpellHandler.h"
|
||||
#include "spells/CSpellHandler.h"
|
||||
|
||||
/*
|
||||
* CModHandler.cpp, part of VCMI engine
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include "CObstacleInstance.h"
|
||||
#include "CHeroHandler.h"
|
||||
#include "VCMI_Lib.h"
|
||||
#include "CSpellHandler.h"
|
||||
#include "spells/CSpellHandler.h"
|
||||
|
||||
/*
|
||||
* CObstacleInstance.cpp, part of VCMI engine
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "CModHandler.h"
|
||||
#include "CHeroHandler.h"
|
||||
#include "CArtHandler.h"
|
||||
#include "CSpellHandler.h"
|
||||
#include "spells/CSpellHandler.h"
|
||||
#include "filesystem/Filesystem.h"
|
||||
#include "mapObjects/CObjectClassesHandler.h"
|
||||
#include "mapObjects/CObjectHandler.h"
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "mapObjects/CObjectClassesHandler.h"
|
||||
#include "CArtHandler.h"
|
||||
#include "CCreatureHandler.h"
|
||||
#include "CSpellHandler.h"
|
||||
#include "spells/CSpellHandler.h"
|
||||
|
||||
const SlotID SlotID::COMMANDER_SLOT_PLACEHOLDER = SlotID(-2);
|
||||
const PlayerColor PlayerColor::CANNOT_DETERMINE = PlayerColor(253);
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "HeroBonus.h"
|
||||
|
||||
#include "VCMI_Lib.h"
|
||||
#include "CSpellHandler.h"
|
||||
#include "spells/CSpellHandler.h"
|
||||
#include "CCreatureHandler.h"
|
||||
#include "CCreatureSet.h"
|
||||
#include "CHeroHandler.h"
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "IGameCallback.h"
|
||||
|
||||
#include "CHeroHandler.h" // for CHeroHandler
|
||||
#include "CSpellHandler.h" // for CSpell
|
||||
#include "spells/CSpellHandler.h"// for CSpell
|
||||
#include "NetPacks.h"
|
||||
#include "CBonusTypeHandler.h"
|
||||
#include "CModHandler.h"
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "CModHandler.h"
|
||||
#include "VCMI_Lib.h"
|
||||
#include "mapping/CMap.h"
|
||||
#include "CSpellHandler.h"
|
||||
#include "spells/CSpellHandler.h"
|
||||
#include "CCreatureHandler.h"
|
||||
#include "CGameState.h"
|
||||
#include "BattleState.h"
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "mapObjects/CObjectHandler.h"
|
||||
#include "CTownHandler.h"
|
||||
#include "CBuildingHandler.h"
|
||||
#include "CSpellHandler.h"
|
||||
#include "spells/CSpellHandler.h"
|
||||
#include "CGeneralTextHandler.h"
|
||||
#include "CModHandler.h"
|
||||
#include "IGameEventsReceiver.h"
|
||||
|
@ -184,11 +184,11 @@
|
||||
<ClCompile Include="CModHandler.cpp" />
|
||||
<ClCompile Include="CObstacleInstance.cpp" />
|
||||
<ClCompile Include="Connection.cpp" />
|
||||
<ClCompile Include="CSpellHandler.cpp" />
|
||||
<ClCompile Include="SpellMechanics.cpp" />
|
||||
<ClCompile Include="CThreadHelper.cpp" />
|
||||
<ClCompile Include="CTownHandler.cpp" />
|
||||
<ClCompile Include="CRandomGenerator.cpp" />
|
||||
<ClCompile Include="spells\CSpellHandler.cpp" />
|
||||
<ClCompile Include="spells\ISpellMechanics.cpp" />
|
||||
<ClCompile Include="filesystem\AdapterLoaders.cpp" />
|
||||
<ClCompile Include="filesystem\CArchiveLoader.cpp" />
|
||||
<ClCompile Include="filesystem\CBinaryReader.cpp" />
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "../CGeneralTextHandler.h"
|
||||
#include "../CSoundBase.h"
|
||||
#include "CommonConstructors.h"
|
||||
#include "../CSpellHandler.h"
|
||||
#include "../spells/CSpellHandler.h"
|
||||
#include "../IGameCallback.h"
|
||||
#include "../CGameState.h"
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "../CHeroHandler.h"
|
||||
#include "../CModHandler.h"
|
||||
#include "../CSoundBase.h"
|
||||
#include "../CSpellHandler.h"
|
||||
#include "../spells/CSpellHandler.h"
|
||||
#include "CObjectClassesHandler.h"
|
||||
#include "../IGameCallback.h"
|
||||
#include "../CGameState.h"
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "../NetPacks.h"
|
||||
#include "../CSoundBase.h"
|
||||
|
||||
#include "../CSpellHandler.h"
|
||||
#include "../spells/CSpellHandler.h"
|
||||
#include "../StartInfo.h"
|
||||
#include "../IGameCallback.h"
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "../CArtHandler.h"
|
||||
#include "../CCreatureHandler.h"
|
||||
#include "../CCreatureSet.h"
|
||||
#include "../CSpellHandler.h"
|
||||
#include "../spells/CSpellHandler.h"
|
||||
|
||||
namespace JsonRandom
|
||||
{
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include "../CModHandler.h"
|
||||
|
||||
#include "CObjectClassesHandler.h"
|
||||
#include "../CSpellHandler.h"
|
||||
#include "../spells/CSpellHandler.h"
|
||||
#include "../IGameCallback.h"
|
||||
#include "../CGameState.h"
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "../mapObjects/CObjectClassesHandler.h"
|
||||
#include "../mapObjects/CGHeroInstance.h"
|
||||
#include "../CGeneralTextHandler.h"
|
||||
#include "../CSpellHandler.h"
|
||||
#include "../spells/CSpellHandler.h"
|
||||
#include "CMapEditManager.h"
|
||||
|
||||
SHeroName::SHeroName() : heroId(-1)
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include "../CStopWatch.h"
|
||||
#include "../filesystem/Filesystem.h"
|
||||
#include "../CSpellHandler.h"
|
||||
#include "../spells/CSpellHandler.h"
|
||||
#include "../CCreatureHandler.h"
|
||||
#include "../CGeneralTextHandler.h"
|
||||
#include "../CHeroHandler.h"
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "../VCMI_Lib.h"
|
||||
#include "../CArtHandler.h"
|
||||
#include "../CHeroHandler.h"
|
||||
#include "../CSpellHandler.h"
|
||||
#include "../spells/CSpellHandler.h"
|
||||
#include "../CTownHandler.h"
|
||||
#include "../mapping/CCampaignHandler.h"
|
||||
#include "../NetPacks.h"
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "../VCMI_Lib.h"
|
||||
#include "../CArtHandler.h"
|
||||
#include "../CHeroHandler.h"
|
||||
#include "../CSpellHandler.h"
|
||||
#include "../spells/CSpellHandler.h"
|
||||
#include "../CTownHandler.h"
|
||||
#include "../mapping/CCampaignHandler.h"
|
||||
#include "../NetPacks.h"
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "../VCMI_Lib.h"
|
||||
#include "../CArtHandler.h"
|
||||
#include "../CHeroHandler.h"
|
||||
#include "../CSpellHandler.h"
|
||||
#include "../spells/CSpellHandler.h"
|
||||
#include "../CTownHandler.h"
|
||||
#include "../mapping/CCampaignHandler.h"
|
||||
#include "../NetPacks.h"
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "../VCMI_Lib.h"
|
||||
#include "../CArtHandler.h"
|
||||
#include "../CHeroHandler.h"
|
||||
#include "../CSpellHandler.h"
|
||||
#include "../spells/CSpellHandler.h"
|
||||
#include "../CTownHandler.h"
|
||||
#include "../mapping/CCampaignHandler.h"
|
||||
#include "../NetPacks.h"
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "../VCMI_Lib.h"
|
||||
#include "../CArtHandler.h"
|
||||
#include "../CHeroHandler.h"
|
||||
#include "../CSpellHandler.h"
|
||||
#include "../spells/CSpellHandler.h"
|
||||
#include "../CTownHandler.h"
|
||||
#include "../mapping/CCampaignHandler.h"
|
||||
#include "../NetPacks.h"
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "../VCMI_Lib.h"
|
||||
#include "../CArtHandler.h"
|
||||
#include "../CHeroHandler.h"
|
||||
#include "../CSpellHandler.h"
|
||||
#include "../spells/CSpellHandler.h"
|
||||
#include "../CTownHandler.h"
|
||||
#include "../mapping/CCampaignHandler.h"
|
||||
#include "../NetPacks.h"
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "../VCMI_Lib.h"
|
||||
#include "../CArtHandler.h"
|
||||
#include "../CHeroHandler.h"
|
||||
#include "../CSpellHandler.h"
|
||||
#include "../spells/CSpellHandler.h"
|
||||
#include "../CTownHandler.h"
|
||||
#include "../mapping/CCampaignHandler.h"
|
||||
#include "../NetPacks.h"
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "../VCMI_Lib.h"
|
||||
#include "../CArtHandler.h"
|
||||
#include "../CHeroHandler.h"
|
||||
#include "../CSpellHandler.h"
|
||||
#include "../spells/CSpellHandler.h"
|
||||
#include "../CTownHandler.h"
|
||||
#include "../mapping/CCampaignHandler.h"
|
||||
#include "../NetPacks.h"
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include "../VCMI_Lib.h"
|
||||
#include "../CTownHandler.h"
|
||||
#include "../CCreatureHandler.h"
|
||||
#include "../CSpellHandler.h" //for choosing random spells
|
||||
#include "../spells/CSpellHandler.h" //for choosing random spells
|
||||
|
||||
#include "../mapObjects/CommonConstructors.h"
|
||||
#include "../mapObjects/MapObjects.h" //needed to resolve templates for CommonConstructors.h
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,399 +1,399 @@
|
||||
#pragma once
|
||||
|
||||
#include "IHandlerBase.h"
|
||||
#include "../lib/ConstTransitivePtr.h"
|
||||
#include "int3.h"
|
||||
#include "GameConstants.h"
|
||||
#include "BattleHex.h"
|
||||
#include "HeroBonus.h"
|
||||
|
||||
|
||||
/*
|
||||
* CSpellHandler.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
|
||||
*
|
||||
*/
|
||||
|
||||
class CGObjectInstance;
|
||||
|
||||
class CSpell;
|
||||
class ISpellMechanics;
|
||||
|
||||
class CLegacyConfigParser;
|
||||
|
||||
class CGHeroInstance;
|
||||
class CStack;
|
||||
|
||||
class CBattleInfoCallback;
|
||||
class BattleInfo;
|
||||
|
||||
struct CPackForClient;
|
||||
struct BattleSpellCast;
|
||||
|
||||
class CGameInfoCallback;
|
||||
class CRandomGenerator;
|
||||
class CMap;
|
||||
|
||||
struct SpellSchoolInfo
|
||||
{
|
||||
ESpellSchool id; //backlink
|
||||
Bonus::BonusType damagePremyBonus;
|
||||
Bonus::BonusType immunityBonus;
|
||||
std::string jsonName;
|
||||
SecondarySkill::ESecondarySkill skill;
|
||||
Bonus::BonusType knoledgeBonus;
|
||||
};
|
||||
|
||||
///callback to be provided by server
|
||||
class DLL_LINKAGE SpellCastEnvironment
|
||||
{
|
||||
public:
|
||||
virtual ~SpellCastEnvironment(){};
|
||||
virtual void sendAndApply(CPackForClient * info) const = 0;
|
||||
|
||||
virtual CRandomGenerator & getRandomGenerator() const = 0;
|
||||
virtual void complain(const std::string & problem) const = 0;
|
||||
|
||||
virtual const CMap * getMap() const = 0;
|
||||
virtual const CGameInfoCallback * getCb() const = 0;
|
||||
|
||||
virtual bool moveHero(ObjectInstanceID hid, int3 dst, ui8 teleporting, PlayerColor asker = PlayerColor::NEUTRAL) const =0; //TODO: remove
|
||||
};
|
||||
|
||||
///helper struct
|
||||
struct DLL_LINKAGE BattleSpellCastParameters
|
||||
{
|
||||
public:
|
||||
BattleSpellCastParameters(const BattleInfo * cb);
|
||||
int spellLvl;
|
||||
BattleHex destination;
|
||||
ui8 casterSide;
|
||||
PlayerColor casterColor;
|
||||
const CGHeroInstance * caster;
|
||||
const CGHeroInstance * secHero;
|
||||
int usedSpellPower;
|
||||
ECastingMode::ECastingMode mode;
|
||||
const CStack * casterStack;
|
||||
const CStack * selectedStack;
|
||||
const BattleInfo * cb;
|
||||
};
|
||||
|
||||
struct DLL_LINKAGE AdventureSpellCastParameters
|
||||
{
|
||||
const CGHeroInstance * caster;
|
||||
int3 pos;
|
||||
};
|
||||
|
||||
enum class VerticalPosition : ui8{TOP, CENTER, BOTTOM};
|
||||
|
||||
class DLL_LINKAGE CSpell
|
||||
{
|
||||
public:
|
||||
|
||||
struct ProjectileInfo
|
||||
{
|
||||
///in radians. Only positive value. Negative angle is handled by vertical flip
|
||||
double minimumAngle;
|
||||
|
||||
///resource name
|
||||
std::string resourceName;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & minimumAngle & resourceName;
|
||||
}
|
||||
};
|
||||
|
||||
struct AnimationItem
|
||||
{
|
||||
std::string resourceName;
|
||||
VerticalPosition verticalPosition;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & resourceName & verticalPosition;
|
||||
}
|
||||
};
|
||||
|
||||
typedef AnimationItem TAnimation;
|
||||
typedef std::vector<TAnimation> TAnimationQueue;
|
||||
|
||||
struct DLL_LINKAGE AnimationInfo
|
||||
{
|
||||
AnimationInfo();
|
||||
~AnimationInfo();
|
||||
|
||||
///displayed on all affected targets.
|
||||
TAnimationQueue affect;
|
||||
|
||||
///displayed on caster.
|
||||
TAnimationQueue cast;
|
||||
|
||||
///displayed on target hex. If spell was casted with no target selection displayed on entire battlefield (f.e. ARMAGEDDON)
|
||||
TAnimationQueue hit;
|
||||
|
||||
///displayed "between" caster and (first) target. Ignored if spell was casted with no target selection.
|
||||
///use selectProjectile to access
|
||||
std::vector<ProjectileInfo> projectile;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & projectile & hit & cast;
|
||||
}
|
||||
|
||||
std::string selectProjectile(const double angle) const;
|
||||
} animationInfo;
|
||||
|
||||
public:
|
||||
struct LevelInfo
|
||||
{
|
||||
std::string description; //descriptions of spell for skill level
|
||||
si32 cost;
|
||||
si32 power;
|
||||
si32 AIValue;
|
||||
|
||||
bool smartTarget;
|
||||
bool clearTarget;
|
||||
bool clearAffected;
|
||||
std::string range;
|
||||
|
||||
std::vector<Bonus> effects;
|
||||
|
||||
LevelInfo();
|
||||
~LevelInfo();
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & description & cost & power & AIValue & smartTarget & range & effects;
|
||||
h & clearTarget & clearAffected;
|
||||
}
|
||||
};
|
||||
|
||||
/** \brief Low level accessor. Don`t use it if absolutely necessary
|
||||
*
|
||||
* \param level. spell school level
|
||||
* \return Spell level info structure
|
||||
*
|
||||
*/
|
||||
const CSpell::LevelInfo& getLevelInfo(const int level) const;
|
||||
public:
|
||||
enum ETargetType {NO_TARGET, CREATURE, OBSTACLE, LOCATION};
|
||||
enum ESpellPositiveness {NEGATIVE = -1, NEUTRAL = 0, POSITIVE = 1};
|
||||
|
||||
struct TargetInfo
|
||||
{
|
||||
ETargetType type;
|
||||
bool smart;
|
||||
bool massive;
|
||||
bool onlyAlive;
|
||||
///no immunity on primary target (mostly spell-like attack)
|
||||
bool alwaysHitDirectly;
|
||||
|
||||
bool clearTarget;
|
||||
bool clearAffected;
|
||||
|
||||
TargetInfo(const CSpell * spell, const int level);
|
||||
TargetInfo(const CSpell * spell, const int level, ECastingMode::ECastingMode mode);
|
||||
|
||||
private:
|
||||
void init(const CSpell * spell, const int level);
|
||||
};
|
||||
|
||||
SpellID id;
|
||||
std::string identifier; //???
|
||||
std::string name;
|
||||
|
||||
si32 level;
|
||||
|
||||
std::map<ESpellSchool, bool> school; //todo: use this instead of separate boolean fields
|
||||
|
||||
si32 power; //spell's power
|
||||
|
||||
std::map<TFaction, si32> probabilities; //% chance to gain for castles
|
||||
|
||||
bool combatSpell; //is this spell combat (true) or adventure (false)
|
||||
bool creatureAbility; //if true, only creatures can use this spell
|
||||
si8 positiveness; //1 if spell is positive for influenced stacks, 0 if it is indifferent, -1 if it's negative
|
||||
|
||||
std::vector<SpellID> counteredSpells; //spells that are removed when effect of this spell is placed on creature (for bless-curse, haste-slow, and similar pairs)
|
||||
|
||||
CSpell();
|
||||
~CSpell();
|
||||
|
||||
bool isCastableBy(const IBonusBearer * caster, bool hasSpellBook, const std::set<SpellID> & spellBook) const;
|
||||
|
||||
|
||||
std::vector<BattleHex> rangeInHexes(BattleHex centralHex, ui8 schoolLvl, ui8 side, bool *outDroppedHexes = nullptr ) const; //convert range to specific hexes; last optional out parameter is set to true, if spell would cover unavailable hexes (that are not included in ret)
|
||||
ETargetType getTargetType() const; //deprecated
|
||||
|
||||
CSpell::TargetInfo getTargetInfo(const int level) const;
|
||||
|
||||
|
||||
bool isCombatSpell() const;
|
||||
bool isAdventureSpell() const;
|
||||
bool isCreatureAbility() const;
|
||||
|
||||
bool isPositive() const;
|
||||
bool isNegative() const;
|
||||
bool isNeutral() const;
|
||||
|
||||
bool isDamageSpell() const;
|
||||
bool isHealingSpell() const;
|
||||
bool isRisingSpell() const;
|
||||
bool isOffensiveSpell() const;
|
||||
|
||||
bool isSpecialSpell() const;
|
||||
|
||||
bool hasEffects() const;
|
||||
void getEffects(std::vector<Bonus> &lst, const int level) const;
|
||||
|
||||
///checks for creature immunity / anything that prevent casting *at given hex* - doesn't take into account general problems such as not having spellbook or mana points etc.
|
||||
ESpellCastProblem::ESpellCastProblem isImmuneAt(const CBattleInfoCallback * cb, const CGHeroInstance * caster, ECastingMode::ECastingMode mode, BattleHex destination) const;
|
||||
|
||||
//internal, for use only by Mechanics classes
|
||||
ESpellCastProblem::ESpellCastProblem isImmuneBy(const IBonusBearer *obj) const;
|
||||
|
||||
//checks for creature immunity / anything that prevent casting *at given target* - doesn't take into account general problems such as not having spellbook or mana points etc.
|
||||
ESpellCastProblem::ESpellCastProblem isImmuneByStack(const CGHeroInstance * caster, const CStack * obj) const;
|
||||
|
||||
//internal, for use only by Mechanics classes. applying secondary skills
|
||||
ui32 calculateBonus(ui32 baseDamage, const CGHeroInstance * caster, const CStack * affectedCreature) const;
|
||||
|
||||
///calculate spell damage on stack taking caster`s secondary skills and affectedCreature`s bonuses into account
|
||||
ui32 calculateDamage(const CGHeroInstance * caster, const CStack * affectedCreature, int spellSchoolLevel, int usedSpellPower) const;
|
||||
|
||||
///selects from allStacks actually affected stacks
|
||||
std::set<const CStack *> getAffectedStacks(const CBattleInfoCallback * cb, ECastingMode::ECastingMode mode, PlayerColor casterColor, int spellLvl, BattleHex destination, const CGHeroInstance * caster = nullptr) const;
|
||||
|
||||
si32 getCost(const int skillLevel) const;
|
||||
|
||||
/**
|
||||
* Returns spell level power, base power ignored
|
||||
*/
|
||||
si32 getPower(const int skillLevel) const;
|
||||
|
||||
si32 getProbability(const TFaction factionId) const;
|
||||
|
||||
/**
|
||||
* Calls cb for each school this spell belongs to
|
||||
*
|
||||
* Set stop to true to abort looping
|
||||
*/
|
||||
void forEachSchool(const std::function<void (const SpellSchoolInfo &, bool &)> & cb) const;
|
||||
|
||||
/**
|
||||
* Returns resource name of icon for SPELL_IMMUNITY bonus
|
||||
*/
|
||||
const std::string& getIconImmune() const;
|
||||
|
||||
const std::string& getCastSound() const;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & identifier & id & name & level & power
|
||||
& probabilities & attributes & combatSpell & creatureAbility & positiveness & counteredSpells;
|
||||
h & isRising & isDamage & isOffensive;
|
||||
h & targetType;
|
||||
h & immunities & limiters & absoluteImmunities & absoluteLimiters;
|
||||
h & iconImmune;
|
||||
h & defaultProbability;
|
||||
h & isSpecial;
|
||||
h & castSound & iconBook & iconEffect & iconScenarioBonus & iconScroll;
|
||||
h & levels;
|
||||
h & school;
|
||||
h & animationInfo;
|
||||
|
||||
if(!h.saving)
|
||||
setup();
|
||||
}
|
||||
friend class CSpellHandler;
|
||||
friend class Graphics;
|
||||
public:
|
||||
///Server logic. Has write access to GameState via packets.
|
||||
///May be executed on client side by (future) non-cheat-proof scripts.
|
||||
|
||||
bool adventureCast(const SpellCastEnvironment * env, AdventureSpellCastParameters & parameters) const;
|
||||
void battleCast(const SpellCastEnvironment * env, BattleSpellCastParameters & parameters) const;
|
||||
|
||||
public:
|
||||
///Client-server logic. Has direct write access to GameState.
|
||||
///Shall be called (only) when applying packets on BOTH SIDES
|
||||
|
||||
///implementation of BattleSpellCast applying
|
||||
void applyBattle(BattleInfo * battle, const BattleSpellCast * packet) const;
|
||||
|
||||
private:
|
||||
void setIsOffensive(const bool val);
|
||||
void setIsRising(const bool val);
|
||||
|
||||
//call this after load or deserialization. cant be done in constructor.
|
||||
void setup();
|
||||
void setupMechanics();
|
||||
private:
|
||||
si32 defaultProbability;
|
||||
|
||||
bool isRising;
|
||||
bool isDamage;
|
||||
bool isOffensive;
|
||||
bool isSpecial;
|
||||
|
||||
std::string attributes; //reference only attributes //todo: remove or include in configuration format, currently unused
|
||||
|
||||
ETargetType targetType;
|
||||
|
||||
std::vector<Bonus::BonusType> immunities; //any of these grants immunity
|
||||
std::vector<Bonus::BonusType> absoluteImmunities; //any of these grants immunity, can't be negated
|
||||
std::vector<Bonus::BonusType> limiters; //all of them are required to be affected
|
||||
std::vector<Bonus::BonusType> absoluteLimiters; //all of them are required to be affected, can't be negated
|
||||
|
||||
///graphics related stuff
|
||||
|
||||
std::string iconImmune;
|
||||
|
||||
std::string iconBook;
|
||||
std::string iconEffect;
|
||||
std::string iconScenarioBonus;
|
||||
std::string iconScroll;
|
||||
|
||||
///sound related stuff
|
||||
std::string castSound;
|
||||
|
||||
std::vector<LevelInfo> levels;
|
||||
|
||||
ISpellMechanics * mechanics;//(!) do not serialize
|
||||
};
|
||||
|
||||
bool DLL_LINKAGE isInScreenRange(const int3 ¢er, const int3 &pos); //for spells like Dimension Door
|
||||
|
||||
class DLL_LINKAGE CSpellHandler: public CHandlerBase<SpellID, CSpell>
|
||||
{
|
||||
public:
|
||||
CSpellHandler();
|
||||
virtual ~CSpellHandler();
|
||||
|
||||
///IHandler base
|
||||
std::vector<JsonNode> loadLegacyData(size_t dataSize) override;
|
||||
void afterLoadFinalization() override;
|
||||
void beforeValidate(JsonNode & object) override;
|
||||
|
||||
/**
|
||||
* Gets a list of default allowed spells. OH3 spells are all allowed by default.
|
||||
*
|
||||
* @return a list of allowed spells, the index is the spell id and the value either 0 for not allowed or 1 for allowed
|
||||
*/
|
||||
std::vector<bool> getDefaultAllowed() const override;
|
||||
|
||||
const std::string getTypeName() const override;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & objects ;
|
||||
}
|
||||
|
||||
protected:
|
||||
CSpell * loadFromJson(const JsonNode & json) override;
|
||||
};
|
||||
#pragma once
|
||||
|
||||
#include "../IHandlerBase.h"
|
||||
#include "../ConstTransitivePtr.h"
|
||||
#include "../int3.h"
|
||||
#include "../GameConstants.h"
|
||||
#include "../BattleHex.h"
|
||||
#include "../HeroBonus.h"
|
||||
|
||||
|
||||
/*
|
||||
* CSpellHandler.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
|
||||
*
|
||||
*/
|
||||
|
||||
class CGObjectInstance;
|
||||
|
||||
class CSpell;
|
||||
class ISpellMechanics;
|
||||
|
||||
class CLegacyConfigParser;
|
||||
|
||||
class CGHeroInstance;
|
||||
class CStack;
|
||||
|
||||
class CBattleInfoCallback;
|
||||
class BattleInfo;
|
||||
|
||||
struct CPackForClient;
|
||||
struct BattleSpellCast;
|
||||
|
||||
class CGameInfoCallback;
|
||||
class CRandomGenerator;
|
||||
class CMap;
|
||||
|
||||
struct SpellSchoolInfo
|
||||
{
|
||||
ESpellSchool id; //backlink
|
||||
Bonus::BonusType damagePremyBonus;
|
||||
Bonus::BonusType immunityBonus;
|
||||
std::string jsonName;
|
||||
SecondarySkill::ESecondarySkill skill;
|
||||
Bonus::BonusType knoledgeBonus;
|
||||
};
|
||||
|
||||
///callback to be provided by server
|
||||
class DLL_LINKAGE SpellCastEnvironment
|
||||
{
|
||||
public:
|
||||
virtual ~SpellCastEnvironment(){};
|
||||
virtual void sendAndApply(CPackForClient * info) const = 0;
|
||||
|
||||
virtual CRandomGenerator & getRandomGenerator() const = 0;
|
||||
virtual void complain(const std::string & problem) const = 0;
|
||||
|
||||
virtual const CMap * getMap() const = 0;
|
||||
virtual const CGameInfoCallback * getCb() const = 0;
|
||||
|
||||
virtual bool moveHero(ObjectInstanceID hid, int3 dst, ui8 teleporting, PlayerColor asker = PlayerColor::NEUTRAL) const =0; //TODO: remove
|
||||
};
|
||||
|
||||
///helper struct
|
||||
struct DLL_LINKAGE BattleSpellCastParameters
|
||||
{
|
||||
public:
|
||||
BattleSpellCastParameters(const BattleInfo * cb);
|
||||
int spellLvl;
|
||||
BattleHex destination;
|
||||
ui8 casterSide;
|
||||
PlayerColor casterColor;
|
||||
const CGHeroInstance * caster;
|
||||
const CGHeroInstance * secHero;
|
||||
int usedSpellPower;
|
||||
ECastingMode::ECastingMode mode;
|
||||
const CStack * casterStack;
|
||||
const CStack * selectedStack;
|
||||
const BattleInfo * cb;
|
||||
};
|
||||
|
||||
struct DLL_LINKAGE AdventureSpellCastParameters
|
||||
{
|
||||
const CGHeroInstance * caster;
|
||||
int3 pos;
|
||||
};
|
||||
|
||||
enum class VerticalPosition : ui8{TOP, CENTER, BOTTOM};
|
||||
|
||||
class DLL_LINKAGE CSpell
|
||||
{
|
||||
public:
|
||||
|
||||
struct ProjectileInfo
|
||||
{
|
||||
///in radians. Only positive value. Negative angle is handled by vertical flip
|
||||
double minimumAngle;
|
||||
|
||||
///resource name
|
||||
std::string resourceName;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & minimumAngle & resourceName;
|
||||
}
|
||||
};
|
||||
|
||||
struct AnimationItem
|
||||
{
|
||||
std::string resourceName;
|
||||
VerticalPosition verticalPosition;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & resourceName & verticalPosition;
|
||||
}
|
||||
};
|
||||
|
||||
typedef AnimationItem TAnimation;
|
||||
typedef std::vector<TAnimation> TAnimationQueue;
|
||||
|
||||
struct DLL_LINKAGE AnimationInfo
|
||||
{
|
||||
AnimationInfo();
|
||||
~AnimationInfo();
|
||||
|
||||
///displayed on all affected targets.
|
||||
TAnimationQueue affect;
|
||||
|
||||
///displayed on caster.
|
||||
TAnimationQueue cast;
|
||||
|
||||
///displayed on target hex. If spell was casted with no target selection displayed on entire battlefield (f.e. ARMAGEDDON)
|
||||
TAnimationQueue hit;
|
||||
|
||||
///displayed "between" caster and (first) target. Ignored if spell was casted with no target selection.
|
||||
///use selectProjectile to access
|
||||
std::vector<ProjectileInfo> projectile;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & projectile & hit & cast;
|
||||
}
|
||||
|
||||
std::string selectProjectile(const double angle) const;
|
||||
} animationInfo;
|
||||
|
||||
public:
|
||||
struct LevelInfo
|
||||
{
|
||||
std::string description; //descriptions of spell for skill level
|
||||
si32 cost;
|
||||
si32 power;
|
||||
si32 AIValue;
|
||||
|
||||
bool smartTarget;
|
||||
bool clearTarget;
|
||||
bool clearAffected;
|
||||
std::string range;
|
||||
|
||||
std::vector<Bonus> effects;
|
||||
|
||||
LevelInfo();
|
||||
~LevelInfo();
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & description & cost & power & AIValue & smartTarget & range & effects;
|
||||
h & clearTarget & clearAffected;
|
||||
}
|
||||
};
|
||||
|
||||
/** \brief Low level accessor. Don`t use it if absolutely necessary
|
||||
*
|
||||
* \param level. spell school level
|
||||
* \return Spell level info structure
|
||||
*
|
||||
*/
|
||||
const CSpell::LevelInfo& getLevelInfo(const int level) const;
|
||||
public:
|
||||
enum ETargetType {NO_TARGET, CREATURE, OBSTACLE, LOCATION};
|
||||
enum ESpellPositiveness {NEGATIVE = -1, NEUTRAL = 0, POSITIVE = 1};
|
||||
|
||||
struct TargetInfo
|
||||
{
|
||||
ETargetType type;
|
||||
bool smart;
|
||||
bool massive;
|
||||
bool onlyAlive;
|
||||
///no immunity on primary target (mostly spell-like attack)
|
||||
bool alwaysHitDirectly;
|
||||
|
||||
bool clearTarget;
|
||||
bool clearAffected;
|
||||
|
||||
TargetInfo(const CSpell * spell, const int level);
|
||||
TargetInfo(const CSpell * spell, const int level, ECastingMode::ECastingMode mode);
|
||||
|
||||
private:
|
||||
void init(const CSpell * spell, const int level);
|
||||
};
|
||||
|
||||
SpellID id;
|
||||
std::string identifier; //???
|
||||
std::string name;
|
||||
|
||||
si32 level;
|
||||
|
||||
std::map<ESpellSchool, bool> school; //todo: use this instead of separate boolean fields
|
||||
|
||||
si32 power; //spell's power
|
||||
|
||||
std::map<TFaction, si32> probabilities; //% chance to gain for castles
|
||||
|
||||
bool combatSpell; //is this spell combat (true) or adventure (false)
|
||||
bool creatureAbility; //if true, only creatures can use this spell
|
||||
si8 positiveness; //1 if spell is positive for influenced stacks, 0 if it is indifferent, -1 if it's negative
|
||||
|
||||
std::vector<SpellID> counteredSpells; //spells that are removed when effect of this spell is placed on creature (for bless-curse, haste-slow, and similar pairs)
|
||||
|
||||
CSpell();
|
||||
~CSpell();
|
||||
|
||||
bool isCastableBy(const IBonusBearer * caster, bool hasSpellBook, const std::set<SpellID> & spellBook) const;
|
||||
|
||||
|
||||
std::vector<BattleHex> rangeInHexes(BattleHex centralHex, ui8 schoolLvl, ui8 side, bool *outDroppedHexes = nullptr ) const; //convert range to specific hexes; last optional out parameter is set to true, if spell would cover unavailable hexes (that are not included in ret)
|
||||
ETargetType getTargetType() const; //deprecated
|
||||
|
||||
CSpell::TargetInfo getTargetInfo(const int level) const;
|
||||
|
||||
|
||||
bool isCombatSpell() const;
|
||||
bool isAdventureSpell() const;
|
||||
bool isCreatureAbility() const;
|
||||
|
||||
bool isPositive() const;
|
||||
bool isNegative() const;
|
||||
bool isNeutral() const;
|
||||
|
||||
bool isDamageSpell() const;
|
||||
bool isHealingSpell() const;
|
||||
bool isRisingSpell() const;
|
||||
bool isOffensiveSpell() const;
|
||||
|
||||
bool isSpecialSpell() const;
|
||||
|
||||
bool hasEffects() const;
|
||||
void getEffects(std::vector<Bonus> &lst, const int level) const;
|
||||
|
||||
///checks for creature immunity / anything that prevent casting *at given hex* - doesn't take into account general problems such as not having spellbook or mana points etc.
|
||||
ESpellCastProblem::ESpellCastProblem isImmuneAt(const CBattleInfoCallback * cb, const CGHeroInstance * caster, ECastingMode::ECastingMode mode, BattleHex destination) const;
|
||||
|
||||
//internal, for use only by Mechanics classes
|
||||
ESpellCastProblem::ESpellCastProblem isImmuneBy(const IBonusBearer *obj) const;
|
||||
|
||||
//checks for creature immunity / anything that prevent casting *at given target* - doesn't take into account general problems such as not having spellbook or mana points etc.
|
||||
ESpellCastProblem::ESpellCastProblem isImmuneByStack(const CGHeroInstance * caster, const CStack * obj) const;
|
||||
|
||||
//internal, for use only by Mechanics classes. applying secondary skills
|
||||
ui32 calculateBonus(ui32 baseDamage, const CGHeroInstance * caster, const CStack * affectedCreature) const;
|
||||
|
||||
///calculate spell damage on stack taking caster`s secondary skills and affectedCreature`s bonuses into account
|
||||
ui32 calculateDamage(const CGHeroInstance * caster, const CStack * affectedCreature, int spellSchoolLevel, int usedSpellPower) const;
|
||||
|
||||
///selects from allStacks actually affected stacks
|
||||
std::set<const CStack *> getAffectedStacks(const CBattleInfoCallback * cb, ECastingMode::ECastingMode mode, PlayerColor casterColor, int spellLvl, BattleHex destination, const CGHeroInstance * caster = nullptr) const;
|
||||
|
||||
si32 getCost(const int skillLevel) const;
|
||||
|
||||
/**
|
||||
* Returns spell level power, base power ignored
|
||||
*/
|
||||
si32 getPower(const int skillLevel) const;
|
||||
|
||||
si32 getProbability(const TFaction factionId) const;
|
||||
|
||||
/**
|
||||
* Calls cb for each school this spell belongs to
|
||||
*
|
||||
* Set stop to true to abort looping
|
||||
*/
|
||||
void forEachSchool(const std::function<void (const SpellSchoolInfo &, bool &)> & cb) const;
|
||||
|
||||
/**
|
||||
* Returns resource name of icon for SPELL_IMMUNITY bonus
|
||||
*/
|
||||
const std::string& getIconImmune() const;
|
||||
|
||||
const std::string& getCastSound() const;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & identifier & id & name & level & power
|
||||
& probabilities & attributes & combatSpell & creatureAbility & positiveness & counteredSpells;
|
||||
h & isRising & isDamage & isOffensive;
|
||||
h & targetType;
|
||||
h & immunities & limiters & absoluteImmunities & absoluteLimiters;
|
||||
h & iconImmune;
|
||||
h & defaultProbability;
|
||||
h & isSpecial;
|
||||
h & castSound & iconBook & iconEffect & iconScenarioBonus & iconScroll;
|
||||
h & levels;
|
||||
h & school;
|
||||
h & animationInfo;
|
||||
|
||||
if(!h.saving)
|
||||
setup();
|
||||
}
|
||||
friend class CSpellHandler;
|
||||
friend class Graphics;
|
||||
public:
|
||||
///Server logic. Has write access to GameState via packets.
|
||||
///May be executed on client side by (future) non-cheat-proof scripts.
|
||||
|
||||
bool adventureCast(const SpellCastEnvironment * env, AdventureSpellCastParameters & parameters) const;
|
||||
void battleCast(const SpellCastEnvironment * env, BattleSpellCastParameters & parameters) const;
|
||||
|
||||
public:
|
||||
///Client-server logic. Has direct write access to GameState.
|
||||
///Shall be called (only) when applying packets on BOTH SIDES
|
||||
|
||||
///implementation of BattleSpellCast applying
|
||||
void applyBattle(BattleInfo * battle, const BattleSpellCast * packet) const;
|
||||
|
||||
private:
|
||||
void setIsOffensive(const bool val);
|
||||
void setIsRising(const bool val);
|
||||
|
||||
//call this after load or deserialization. cant be done in constructor.
|
||||
void setup();
|
||||
void setupMechanics();
|
||||
private:
|
||||
si32 defaultProbability;
|
||||
|
||||
bool isRising;
|
||||
bool isDamage;
|
||||
bool isOffensive;
|
||||
bool isSpecial;
|
||||
|
||||
std::string attributes; //reference only attributes //todo: remove or include in configuration format, currently unused
|
||||
|
||||
ETargetType targetType;
|
||||
|
||||
std::vector<Bonus::BonusType> immunities; //any of these grants immunity
|
||||
std::vector<Bonus::BonusType> absoluteImmunities; //any of these grants immunity, can't be negated
|
||||
std::vector<Bonus::BonusType> limiters; //all of them are required to be affected
|
||||
std::vector<Bonus::BonusType> absoluteLimiters; //all of them are required to be affected, can't be negated
|
||||
|
||||
///graphics related stuff
|
||||
|
||||
std::string iconImmune;
|
||||
|
||||
std::string iconBook;
|
||||
std::string iconEffect;
|
||||
std::string iconScenarioBonus;
|
||||
std::string iconScroll;
|
||||
|
||||
///sound related stuff
|
||||
std::string castSound;
|
||||
|
||||
std::vector<LevelInfo> levels;
|
||||
|
||||
ISpellMechanics * mechanics;//(!) do not serialize
|
||||
};
|
||||
|
||||
bool DLL_LINKAGE isInScreenRange(const int3 ¢er, const int3 &pos); //for spells like Dimension Door
|
||||
|
||||
class DLL_LINKAGE CSpellHandler: public CHandlerBase<SpellID, CSpell>
|
||||
{
|
||||
public:
|
||||
CSpellHandler();
|
||||
virtual ~CSpellHandler();
|
||||
|
||||
///IHandler base
|
||||
std::vector<JsonNode> loadLegacyData(size_t dataSize) override;
|
||||
void afterLoadFinalization() override;
|
||||
void beforeValidate(JsonNode & object) override;
|
||||
|
||||
/**
|
||||
* Gets a list of default allowed spells. OH3 spells are all allowed by default.
|
||||
*
|
||||
* @return a list of allowed spells, the index is the spell id and the value either 0 for not allowed or 1 for allowed
|
||||
*/
|
||||
std::vector<bool> getDefaultAllowed() const override;
|
||||
|
||||
const std::string getTypeName() const override;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & objects ;
|
||||
}
|
||||
|
||||
protected:
|
||||
CSpell * loadFromJson(const JsonNode & json) override;
|
||||
};
|
@ -9,18 +9,18 @@
|
||||
*/
|
||||
|
||||
#include "StdInc.h"
|
||||
#include "SpellMechanics.h"
|
||||
#include "ISpellMechanics.h"
|
||||
|
||||
#include "CObstacleInstance.h"
|
||||
#include "mapObjects/CGHeroInstance.h"
|
||||
#include "BattleState.h"
|
||||
#include "CRandomGenerator.h"
|
||||
#include "../CObstacleInstance.h"
|
||||
#include "../mapObjects/CGHeroInstance.h"
|
||||
#include "../BattleState.h"
|
||||
#include "../CRandomGenerator.h"
|
||||
|
||||
#include "NetPacks.h"
|
||||
#include "../NetPacks.h"
|
||||
|
||||
#include "mapping/CMap.h"
|
||||
#include "CGameInfoCallback.h"
|
||||
#include "CGameState.h"
|
||||
#include "../mapping/CMap.h"
|
||||
#include "../CGameInfoCallback.h"
|
||||
#include "../CGameState.h"
|
||||
|
||||
namespace SRSLPraserHelpers
|
||||
{
|
@ -11,7 +11,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "CSpellHandler.h"
|
||||
#include "BattleHex.h"
|
||||
#include "../BattleHex.h"
|
||||
|
||||
class DLL_LINKAGE ISpellMechanics
|
||||
{
|
@ -9,7 +9,7 @@
|
||||
#include "../lib/CArtHandler.h"
|
||||
#include "../lib/CBuildingHandler.h"
|
||||
#include "../lib/CHeroHandler.h"
|
||||
#include "../lib/CSpellHandler.h"
|
||||
#include "../lib/spells/CSpellHandler.h"
|
||||
#include "../lib/CGeneralTextHandler.h"
|
||||
#include "../lib/CTownHandler.h"
|
||||
#include "../lib/CCreatureHandler.h"
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "../lib/CHeroHandler.h"
|
||||
#include "../lib/CTownHandler.h"
|
||||
#include "../lib/CBuildingHandler.h"
|
||||
#include "../lib/CSpellHandler.h"
|
||||
#include "../lib/spells/CSpellHandler.h"
|
||||
#include "../lib/CCreatureHandler.h"
|
||||
#include "zlib.h"
|
||||
#include "CVCMIServer.h"
|
||||
|
Loading…
Reference in New Issue
Block a user