mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Merge pull request #557 from dydzio0614/CrystalDragonAbility
Fix crystal dragon ability to match H3
This commit is contained in:
commit
549d8c97df
@ -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
|
||||||
},
|
},
|
||||||
|
@ -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 */
|
||||||
|
|
||||||
|
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user