1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-04-15 11:46:56 +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(visitableObjs, obj);
erase_if_present(alreadyVisited, obj); erase_if_present(alreadyVisited, obj);
erase_if_present(reservedObjs, obj);
for (auto h : cb->getHeroesInfo())
for(auto &p : reservedHeroesMap) unreserveObject(h, obj);
erase_if_present(p.second, obj);
//TODO //TODO
//there are other places where CGObjectinstance ptrs are stored... //there are other places where CGObjectinstance ptrs are stored...

View File

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

View File

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

View File

@ -947,7 +947,7 @@ void CGHeroInstance::initObj()
{ {
blockVisit = true; blockVisit = true;
auto hs = new HeroSpecial(); auto hs = new HeroSpecial();
hs->setNodeType(CBonusSystemNode::specialty); hs->setNodeType(CBonusSystemNode::SPECIALTY);
attachTo(hs); //do we ever need to detach it? attachTo(hs); //do we ever need to detach it?
if(!type) if(!type)
@ -1137,7 +1137,7 @@ void CGHeroInstance::initObj()
auto hs = new HeroSpecial(); auto hs = new HeroSpecial();
attachTo(hs); //do we ever need to detach it? attachTo(hs); //do we ever need to detach it?
hs->setNodeType(CBonusSystemNode::specialty); hs->setNodeType(CBonusSystemNode::SPECIALTY);
for (auto bonus : hs2.bonuses) for (auto bonus : hs2.bonuses)
{ {
hs->addNewBonus (bonus); 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)) ("BATTLE_WIDE", make_shared<CPropagatorNodeType>(CBonusSystemNode::BATTLE))
("VISITED_TOWN_AND_VISITOR", make_shared<CPropagatorNodeType>(CBonusSystemNode::TOWN_AND_VISITOR)) ("VISITED_TOWN_AND_VISITOR", make_shared<CPropagatorNodeType>(CBonusSystemNode::TOWN_AND_VISITOR))
("PLAYER_PROPAGATOR", make_shared<CPropagatorNodeType>(CBonusSystemNode::PLAYER)) ("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 #define BONUS_LOG_LINE(x) logBonus->traceStream() << x

View File

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