1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-01 00:45:26 +02:00

Possible fix for #1348

This commit is contained in:
DjWarmonger
2013-07-22 09:48:25 +00:00
parent 3aec2daca1
commit 103a75e763
2 changed files with 9 additions and 7 deletions

View File

@ -3249,6 +3249,7 @@ void CGCreature::initObj()
amount = 1;
}
}
formation.randomFormation = rand();
temppower = stacks[SlotID(0)]->count * 1000;
refusedJoining = false;
@ -3279,7 +3280,7 @@ void CGCreature::setPropertyDer(ui8 what, ui32 val)
giveStackExp(val);
break;
case ObjProperty::MONSTER_RESTORE_TYPE:
restore.basicType = val;
formation.basicType = val;
break;
case ObjProperty::MONSTER_REFUSED_JOIN:
refusedJoining = val;
@ -3462,7 +3463,7 @@ void CGCreature::fight( const CGHeroInstance *h ) const
}
if (stacksCount > 1)
{
if (rand()%100 < 50) //upgrade
if (formation.randomFormation % 100 < 50) //upgrade
{
SlotID slotId = SlotID(stacks.size() / 2);
if(ui32 upgradesSize = getStack(slotId).type->upgrades.size())
@ -3513,7 +3514,7 @@ void CGCreature::battleFinished(const CGHeroInstance *hero, const BattleResult &
//merge stacks into one
TSlots::const_iterator i;
CCreature * cre = VLC->creh->creatures[restore.basicType];
CCreature * cre = VLC->creh->creatures[formation.basicType];
for (i = stacks.begin(); i != stacks.end(); i++)
{
if (cre->isMyUpgrade(i->second->type))