1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

- Added and improved some propagators, including Crystal Dragons ability (#1232)

- Minor refactoring in AI
This commit is contained in:
DjWarmonger 2014-03-29 21:39:19 +00:00
parent 791099ab33
commit 8683c8c0eb
6 changed files with 17 additions and 9 deletions

View File

@ -374,11 +374,9 @@ void VCAI::objectRemoved(const CGObjectInstance *obj)
erase_if_present(visitableObjs, obj);
erase_if_present(alreadyVisited, obj);
erase_if_present(reservedObjs, obj);
for(auto &p : reservedHeroesMap)
erase_if_present(p.second, obj);
for (auto h : cb->getHeroesInfo())
unreserveObject(h, obj);
//TODO
//there are other places where CGObjectinstance ptrs are stored...

View File

@ -117,6 +117,13 @@
{
"type" : "DRAGON_NATURE"
},
"crystals" :
{
"type" : "GENERATE_RESOURCE",
"subtype" : "resource.crystal"
"val" : 1,
"propagator" : "HERO"
}
"FLYING_ARMY" : null
},
"graphics" :

View File

@ -739,6 +739,7 @@ CGameState::CGameState()
registerTypesClientPacks2(*applierGs);
//objCaller = new CObjectCallersHandler;
globalEffects.setDescription("Global effects");
globalEffects.setNodeType(CBonusSystemNode::GLOBAL_EFFECTS);
}
CGameState::~CGameState()

View File

@ -947,7 +947,7 @@ void CGHeroInstance::initObj()
{
blockVisit = true;
auto hs = new HeroSpecial();
hs->setNodeType(CBonusSystemNode::specialty);
hs->setNodeType(CBonusSystemNode::SPECIALTY);
attachTo(hs); //do we ever need to detach it?
if(!type)
@ -1137,7 +1137,7 @@ void CGHeroInstance::initObj()
auto hs = new HeroSpecial();
attachTo(hs); //do we ever need to detach it?
hs->setNodeType(CBonusSystemNode::specialty);
hs->setNodeType(CBonusSystemNode::SPECIALTY);
for (auto bonus : hs2.bonuses)
{
hs->addNewBonus (bonus);

View File

@ -67,7 +67,9 @@ const std::map<std::string, TPropagatorPtr> bonusPropagatorMap = boost::assign::
("BATTLE_WIDE", make_shared<CPropagatorNodeType>(CBonusSystemNode::BATTLE))
("VISITED_TOWN_AND_VISITOR", make_shared<CPropagatorNodeType>(CBonusSystemNode::TOWN_AND_VISITOR))
("PLAYER_PROPAGATOR", make_shared<CPropagatorNodeType>(CBonusSystemNode::PLAYER))
("HERO", make_shared<CPropagatorNodeType>(CBonusSystemNode::HERO));
("HERO", make_shared<CPropagatorNodeType>(CBonusSystemNode::HERO))
("TEAM_PROPAGATOR", make_shared<CPropagatorNodeType>(CBonusSystemNode::TEAM)) //untested
("GLOBAL_EFFECT", make_shared<CPropagatorNodeType>(CBonusSystemNode::GLOBAL_EFFECTS)); //untested
#define BONUS_LOG_LINE(x) logBonus->traceStream() << x

View File

@ -606,8 +606,8 @@ class DLL_LINKAGE CBonusSystemNode : public IBonusBearer
public:
enum ENodeTypes
{
UNKNOWN, STACK_INSTANCE, STACK_BATTLE, specialty, ARTIFACT, CREATURE, ARTIFACT_INSTANCE, HERO, PLAYER, TEAM,
TOWN_AND_VISITOR, BATTLE, COMMANDER
UNKNOWN, STACK_INSTANCE, STACK_BATTLE, SPECIALTY, ARTIFACT, CREATURE, ARTIFACT_INSTANCE, HERO, PLAYER, TEAM,
TOWN_AND_VISITOR, BATTLE, COMMANDER, GLOBAL_EFFECTS
};
private:
BonusList bonuses; //wielded bonuses (local or up-propagated here)