2009-04-15 17:03:31 +03:00
/*
* CCreatureHandler . 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
*
2009-04-16 14:14:13 +03:00
*/
2017-07-13 10:26:03 +02:00
# pragma once
2023-05-01 19:29:53 +02:00
# include "bonuses/Bonus.h"
2023-04-30 16:35:15 +02:00
# include "bonuses/CBonusSystemNode.h"
2017-07-13 10:26:03 +02:00
# include "ConstTransitivePtr.h"
# include "ResourceSet.h"
# include "GameConstants.h"
# include "JsonNode.h"
# include "IHandlerBase.h"
# include "CRandomGenerator.h"
2023-01-30 00:12:43 +02:00
# include "Color.h"
2023-08-23 14:07:50 +02:00
# include "filesystem/ResourcePath.h"
2009-04-16 14:14:13 +03:00
2023-04-05 02:26:29 +02:00
# include <vcmi/Creature.h>
# include <vcmi/CreatureService.h>
2022-07-26 15:07:42 +02:00
VCMI_LIB_NAMESPACE_BEGIN
2012-08-25 11:44:51 +03:00
class CLegacyConfigParser ;
2010-05-02 21:20:26 +03:00
class CCreatureHandler ;
2010-08-24 17:26:57 +03:00
class CCreature ;
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
class JsonSerializeFormat ;
2009-04-16 14:14:13 +03:00
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
class DLL_LINKAGE CCreature : public Creature , public CBonusSystemNode
2009-04-16 14:14:13 +03:00
{
2023-01-02 18:00:51 +02:00
friend class CCreatureHandler ;
std : : string modScope ;
2015-08-24 10:55:45 +02:00
std : : string identifier ;
2023-01-02 18:00:51 +02:00
std : : string getNameTranslated ( ) const override ;
std : : string getNameTextID ( ) const override ;
2013-03-02 19:55:51 +03:00
2013-02-11 02:24:57 +03:00
CreatureID idNumber ;
2023-01-02 18:00:51 +02:00
2023-04-09 17:26:32 +02:00
FactionID faction = FactionID : : NEUTRAL ;
2023-03-13 23:26:44 +02:00
ui8 level = 0 ; // 0 - unknown; 1-7 for "usual" creatures
2013-03-02 19:55:51 +03:00
//stats that are not handled by bonus system
ui32 fightValue , AIValue , growth , hordeGrowth ;
2023-03-13 23:26:44 +02:00
bool doubleWide = false ;
2023-04-05 02:26:29 +02:00
2013-03-02 19:55:51 +03:00
TResources cost ; //cost[res_id] - amount of that resource required to buy creature from dwelling
2023-04-05 02:26:29 +02:00
public :
ui32 ammMin , ammMax ; // initial size of stack of these creatures on adventure map (if not set in editor)
bool special = true ; // Creature is not available normally (war machines, commanders, several unused creatures, etc
2013-03-02 19:55:51 +03:00
std : : set < CreatureID > upgrades ; // IDs of creatures to which this creature can be upgraded
2009-04-16 14:14:13 +03:00
2023-08-23 14:07:50 +02:00
AnimationPath animDefName ; // creature animation used during battles
2013-03-02 19:55:51 +03:00
2023-04-25 11:02:31 +02:00
si32 iconIndex = - 1 ; // index of icon in files like twcrport, used in tests now.
2013-04-22 22:51:22 +03:00
/// names of files with appropriate icons. Used only during loading
std : : string smallIconName ;
std : : string largeIconName ;
2023-01-14 16:55:08 +02:00
enum class CreatureQuantityId
{
FEW = 1 ,
SEVERAL ,
PACK ,
LOTS ,
HORDE ,
THRONG ,
SWARM ,
ZOUNDS ,
LEGION
} ;
2013-03-02 19:55:51 +03:00
struct CreatureAnimation
{
2022-11-15 21:42:16 +02:00
struct RayColor {
2023-01-30 00:12:43 +02:00
ColorRGBA start ;
ColorRGBA end ;
2022-11-15 21:42:16 +02:00
template < typename Handler > void serialize ( Handler & h , const int version )
{
2023-01-30 00:12:43 +02:00
h & start & end ;
2022-11-15 21:42:16 +02:00
}
} ;
2013-11-06 16:42:58 +03:00
double timeBetweenFidgets , idleAnimationTime ,
2023-01-28 13:56:51 +02:00
walkAnimationTime , attackAnimationTime ;
2013-03-02 19:55:51 +03:00
int upperRightMissleOffsetX , rightMissleOffsetX , lowerRightMissleOffsetX ,
upperRightMissleOffsetY , rightMissleOffsetY , lowerRightMissleOffsetY ;
2013-04-04 16:18:38 +03:00
std : : vector < double > missleFrameAngles ;
2013-03-02 19:55:51 +03:00
int troopCountLocationOffset , attackClimaxFrame ;
2023-08-23 14:07:50 +02:00
AnimationPath projectileImageName ;
2022-11-15 21:42:16 +02:00
std : : vector < RayColor > projectileRay ;
2013-04-04 16:18:38 +03:00
//bool projectileSpin; //if true, appropriate projectile is spinning during flight
2013-03-02 19:55:51 +03:00
template < typename Handler > void serialize ( Handler & h , const int version )
{
2017-07-31 15:35:42 +02:00
h & timeBetweenFidgets ;
h & idleAnimationTime ;
h & walkAnimationTime ;
h & attackAnimationTime ;
2023-01-31 15:00:46 +02:00
if ( version < 814 )
{
float unused = 0.f ;
h & unused ;
}
2017-07-31 15:35:42 +02:00
h & upperRightMissleOffsetX ;
h & rightMissleOffsetX ;
h & lowerRightMissleOffsetX ;
h & upperRightMissleOffsetY ;
h & rightMissleOffsetY ;
h & lowerRightMissleOffsetY ;
h & missleFrameAngles ;
h & troopCountLocationOffset ;
h & attackClimaxFrame ;
2013-04-04 16:18:38 +03:00
h & projectileImageName ;
2022-11-15 21:42:16 +02:00
h & projectileRay ;
2013-03-02 19:55:51 +03:00
}
} animation ;
2009-04-16 14:14:13 +03:00
2012-09-17 22:00:26 +03:00
//sound info
2013-03-02 19:55:51 +03:00
struct CreatureBattleSounds
2012-09-17 22:00:26 +03:00
{
2023-09-04 12:03:15 +02:00
AudioPath attack ;
AudioPath defend ;
AudioPath killed ; // was killed or died
AudioPath move ;
AudioPath shoot ; // range attack
AudioPath wince ; // attacked but did not die
AudioPath startMoving ;
AudioPath endMoving ;
2012-09-17 22:00:26 +03:00
template < typename Handler > void serialize ( Handler & h , const int version )
{
2017-07-31 15:35:42 +02:00
h & attack ;
h & defend ;
h & killed ;
h & move ;
h & shoot ;
h & wince ;
h & startMoving ;
h & endMoving ;
2012-09-17 22:00:26 +03:00
}
} sounds ;
2017-05-26 18:51:45 +02:00
ArtifactID warMachine ;
2023-01-02 18:00:51 +02:00
std : : string getNamePluralTranslated ( ) const override ;
std : : string getNameSingularTranslated ( ) const override ;
std : : string getNamePluralTextID ( ) const override ;
std : : string getNameSingularTextID ( ) const override ;
2023-04-05 02:50:29 +02:00
FactionID getFaction ( ) const override ;
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
int32_t getIndex ( ) const override ;
int32_t getIconIndex ( ) const override ;
2023-01-18 23:56:01 +02:00
std : : string getJsonKey ( ) const override ;
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
void registerIcons ( const IconRegistar & cb ) const override ;
CreatureID getId ( ) const override ;
2023-04-05 02:26:29 +02:00
virtual const IBonusBearer * getBonusBearer ( ) const override ;
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
int32_t getAdvMapAmountMin ( ) const override ;
int32_t getAdvMapAmountMax ( ) const override ;
int32_t getAIValue ( ) const override ;
int32_t getFightValue ( ) const override ;
int32_t getLevel ( ) const override ;
int32_t getGrowth ( ) const override ;
int32_t getHorde ( ) const override ;
int32_t getBaseAttack ( ) const override ;
int32_t getBaseDefense ( ) const override ;
int32_t getBaseDamageMin ( ) const override ;
int32_t getBaseDamageMax ( ) const override ;
int32_t getBaseHitPoints ( ) const override ;
int32_t getBaseSpellPoints ( ) const override ;
int32_t getBaseSpeed ( ) const override ;
int32_t getBaseShots ( ) const override ;
2023-04-05 02:26:29 +02:00
int32_t getRecruitCost ( GameResID resIndex ) const override ;
TResources getFullRecruitCost ( ) const override ;
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
bool isDoubleWide ( ) const override ; //returns true if unit is double wide on battlefield
2023-04-05 02:26:29 +02:00
bool hasUpgrades ( ) const override ;
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
2009-08-24 20:40:20 +03:00
bool isGood ( ) const ;
bool isEvil ( ) const ;
2023-03-17 01:19:04 +02:00
si32 maxAmount ( const TResources & res ) const ; //how many creatures can be bought
2023-01-14 16:55:08 +02:00
static CCreature : : CreatureQuantityId getQuantityID ( const int & quantity ) ;
static std : : string getQuantityRangeStringForId ( const CCreature : : CreatureQuantityId & quantityId ) ;
2011-12-14 00:23:17 +03:00
static int estimateCreatureCount ( ui32 countID ) ; //reverse version of above function, returns middle of range
2010-07-12 13:20:25 +03:00
bool isMyUpgrade ( const CCreature * anotherCre ) const ;
2009-04-16 14:14:13 +03:00
2010-11-27 22:17:28 +02:00
bool valid ( ) const ;
2023-05-01 00:20:01 +02:00
void addBonus ( int val , BonusType type , int subtype = - 1 ) ;
2012-12-03 19:00:17 +03:00
std : : string nodeName ( ) const override ;
2010-07-12 13:20:25 +03:00
2009-07-09 22:15:22 +03:00
template < typename RanGen >
2011-12-31 13:03:29 +03:00
int getRandomAmount ( RanGen ranGen ) const
2009-07-09 22:15:22 +03:00
{
if ( ammMax = = ammMin )
return ammMax ;
else
return ammMin + ( ranGen ( ) % ( ammMax - ammMin ) ) ;
}
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
void updateFrom ( const JsonNode & data ) ;
void serializeJson ( JsonSerializeFormat & handler ) ;
2009-04-16 14:14:13 +03:00
template < typename Handler > void serialize ( Handler & h , const int version )
{
2010-05-02 21:20:26 +03:00
h & static_cast < CBonusSystemNode & > ( * this ) ;
2017-07-31 15:35:42 +02:00
h & cost ;
h & upgrades ;
h & fightValue ;
h & AIValue ;
h & growth ;
h & hordeGrowth ;
h & ammMin ;
h & ammMax ;
h & level ;
h & animDefName ;
h & iconIndex ;
h & smallIconName ;
h & largeIconName ;
h & idNumber ;
h & faction ;
h & sounds ;
h & animation ;
h & doubleWide ;
h & special ;
2022-06-20 16:39:50 +02:00
h & identifier ;
2023-01-02 18:00:51 +02:00
h & modScope ;
2022-06-20 16:39:50 +02:00
h & warMachine ;
2009-04-16 14:14:13 +03:00
}
2010-05-02 21:20:26 +03:00
CCreature ( ) ;
2017-05-26 18:51:45 +02:00
private :
2023-01-15 17:19:55 +02:00
static const std : : map < CreatureQuantityId , std : : string > creatureQuantityRanges ;
2009-04-16 14:14:13 +03:00
} ;
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
class DLL_LINKAGE CCreatureHandler : public CHandlerBase < CreatureID , Creature , CCreature , CreatureService >
2011-02-11 10:20:26 +02:00
{
2012-12-23 13:23:41 +03:00
private :
2023-03-13 23:26:44 +02:00
void loadJsonAnimation ( CCreature * creature , const JsonNode & graphics ) const ;
void loadStackExperience ( CCreature * creature , const JsonNode & input ) const ;
void loadCreatureJson ( CCreature * creature , const JsonNode & config ) const ;
2011-02-22 11:47:25 +02:00
2013-03-02 19:55:51 +03:00
/// adding abilities from ZCRTRAIT.TXT
2023-03-13 23:26:44 +02:00
void loadBonuses ( JsonNode & creature , std : : string bonuses ) const ;
2012-11-13 14:52:23 +03:00
/// load all creatures from H3 files
2013-03-06 21:49:56 +03:00
void load ( ) ;
2013-04-11 22:24:14 +03:00
void loadCommanders ( ) ;
2013-03-02 19:55:51 +03:00
/// load creature from json structure
void load ( std : : string creatureID , const JsonNode & node ) ;
2012-11-13 14:52:23 +03:00
/// read cranim.txt file from H3
2023-03-13 23:26:44 +02:00
void loadAnimationInfo ( std : : vector < JsonNode > & h3Data ) const ;
2012-11-13 14:52:23 +03:00
/// read one line from cranim.txt
2023-03-13 23:26:44 +02:00
void loadUnitAnimInfo ( JsonNode & unit , CLegacyConfigParser & parser ) const ;
2012-11-13 14:52:23 +03:00
/// parse crexpbon.txt file from H3
2023-03-13 23:26:44 +02:00
void loadStackExp ( Bonus & b , BonusList & bl , CLegacyConfigParser & parser ) const ;
2012-11-13 14:52:23 +03:00
/// help function for parsing CREXPBON.txt
2023-03-13 23:26:44 +02:00
int stringToNumber ( std : : string & s ) const ;
2012-11-13 14:52:23 +03:00
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
protected :
const std : : vector < std : : string > & getTypeNames ( ) const override ;
CCreature * loadFromJson ( const std : : string & scope , const JsonNode & node , const std : : string & identifier , size_t index ) override ;
2013-04-21 15:49:26 +03:00
public :
std : : set < CreatureID > doubledCreatures ; //they get double week
//stack exp
std : : vector < std : : vector < ui32 > > expRanks ; // stack experience needed for certain rank, index 0 for other tiers (?)
std : : vector < ui32 > maxExpPerBattle ; //%, tiers same as above
si8 expAfterUpgrade ; //multiplier in %
//Commanders
BonusList commanderLevelPremy ; //bonus values added with each level-up
std : : vector < std : : vector < ui8 > > skillLevels ; //how much of a bonus will be given to commander with every level. SPELL_POWER also gives CASTS and RESISTANCE
2016-09-19 23:36:35 +02:00
std : : vector < std : : pair < std : : shared_ptr < Bonus > , std : : pair < ui8 , ui8 > > > skillRequirements ; // first - Bonus, second - which two skills are needed to use it
2009-08-24 20:40:20 +03:00
2016-01-15 19:24:17 +02:00
const CCreature * getCreature ( const std : : string & scope , const std : : string & identifier ) const ;
2014-03-17 22:51:07 +03:00
CreatureID pickRandomMonster ( CRandomGenerator & rand , int tier = - 1 ) const ; //tier <1 - CREATURES_PER_TOWN> or -1 for any
2010-07-24 00:05:49 +03:00
2013-04-21 15:49:26 +03:00
CCreatureHandler ( ) ;
~ CCreatureHandler ( ) ;
2023-04-06 18:56:48 +02:00
/// load all stack experience bonuses from H3 files
void loadCrExpBon ( CBonusSystemNode & globalEffects ) ;
2013-04-21 15:49:26 +03:00
2023-04-11 17:16:18 +02:00
/// load all stack modifier bonuses from H3 files. TODO: move this to json
void loadCrExpMod ( ) ;
2015-10-12 15:47:10 +02:00
void afterLoadFinalization ( ) override ;
2014-01-03 02:48:38 +03:00
2023-03-15 21:34:29 +02:00
std : : vector < JsonNode > loadLegacyData ( ) override ;
2013-04-21 15:49:26 +03:00
std : : vector < bool > getDefaultAllowed ( ) const override ;
2009-04-16 14:14:13 +03:00
template < typename Handler > void serialize ( Handler & h , const int version )
{
//TODO: should be optimized, not all these informations needs to be serialized (same for ccreature)
2017-07-31 15:35:42 +02:00
h & doubledCreatures ;
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
h & objects ;
2017-07-31 15:35:42 +02:00
h & expRanks ;
h & maxExpPerBattle ;
h & expAfterUpgrade ;
h & skillLevels ;
h & skillRequirements ;
h & commanderLevelPremy ;
2009-04-16 14:14:13 +03:00
}
} ;
2022-07-26 15:07:42 +02:00
VCMI_LIB_NAMESPACE_END