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

Fix crystal dragon ability to match H3

This commit is contained in:
Dydzio 2019-03-17 19:48:47 +01:00
parent 8b6316c8ee
commit 53f4ba6464
3 changed files with 34 additions and 4 deletions

View File

@ -122,10 +122,7 @@
}, },
"crystals" : "crystals" :
{ {
"type" : "GENERATE_RESOURCE", "type" : "SPECIAL_CRYSTAL_GENERATION"
"subtype" : "resource.crystal",
"val" : 1,
"propagator" : "HERO"
}, },
"FLYING_ARMY" : null "FLYING_ARMY" : null
}, },

View File

@ -269,6 +269,7 @@ public:
BONUS_NAME(SHOOTS_ALL_ADJACENT) /* H4 Cyclops-like shoot (attacks all hexes neighboring with target) without spell-like mechanics */\ BONUS_NAME(SHOOTS_ALL_ADJACENT) /* H4 Cyclops-like shoot (attacks all hexes neighboring with target) without spell-like mechanics */\
BONUS_NAME(BLOCK_MAGIC_BELOW) /*blocks casting spells of the level < value */ \ BONUS_NAME(BLOCK_MAGIC_BELOW) /*blocks casting spells of the level < value */ \
BONUS_NAME(DESTRUCTION) /*kills extra units after hit, subtype = 0 - kill percentage of units, 1 - kill amount, val = chance in percent to trigger, additional info - amount/percentage to kill*/ \ BONUS_NAME(DESTRUCTION) /*kills extra units after hit, subtype = 0 - kill percentage of units, 1 - kill amount, val = chance in percent to trigger, additional info - amount/percentage to kill*/ \
BONUS_NAME(SPECIAL_CRYSTAL_GENERATION) /*crystal dragon crystal generation*/ \
/* end of list */ /* end of list */

View File

@ -1739,6 +1739,38 @@ void CGameHandler::newTurn()
n.res[elem.first] = elem.second.resources; n.res[elem.first] = elem.second.resources;
if(!firstTurn && newWeek) //weekly crystal generation if 1 or more crystal dragons in any hero army or town garrison
{
bool hasCrystalGenCreature = false;
for(CGHeroInstance * hero : elem.second.heroes)
{
for(auto stack : hero->stacks)
{
if(stack.second->hasBonusOfType(Bonus::SPECIAL_CRYSTAL_GENERATION))
{
hasCrystalGenCreature = true;
break;
}
}
}
if(!hasCrystalGenCreature) //not found in armies, check towns
{
for(CGTownInstance * town : elem.second.towns)
{
for(auto stack : town->stacks)
{
if(stack.second->hasBonusOfType(Bonus::SPECIAL_CRYSTAL_GENERATION))
{
hasCrystalGenCreature = true;
break;
}
}
}
}
if(hasCrystalGenCreature)
n.res[elem.first][Res::CRYSTAL] += 3;
}
for (CGHeroInstance *h : (elem).second.heroes) for (CGHeroInstance *h : (elem).second.heroes)
{ {
if (h->visitedTown) if (h->visitedTown)