1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

Merge beta -> develop

This commit is contained in:
Ivan Savenko
2023-04-26 22:45:41 +03:00
34 changed files with 307 additions and 72 deletions

View File

@ -676,12 +676,12 @@ void CGameHandler::endBattleConfirm(const BattleInfo * battleInfo)
sendMoveArtifact(art, &ma);
}
}
while(!finishingBattle->loserHero->artifactsInBackpack.empty())
for(int slotNumber = finishingBattle->loserHero->artifactsInBackpack.size() - 1; slotNumber >= 0; slotNumber--)
{
//we assume that no big artifacts can be found
MoveArtifact ma;
ma.src = ArtifactLocation(finishingBattle->loserHero,
ArtifactPosition(GameConstants::BACKPACK_START)); //backpack automatically shifts arts to beginning
ArtifactPosition(GameConstants::BACKPACK_START + slotNumber)); //backpack automatically shifts arts to beginning
const CArtifactInstance * art = ma.src.getArt();
if (art->artType->getId() != ArtifactID::GRAIL) //grail may not be won
{
@ -6517,9 +6517,9 @@ void CGameHandler::runBattle()
if(!removeGhosts.changedStacks.empty())
sendAndApply(&removeGhosts);
//check for bad morale => freeze
// check for bad morale => freeze
int nextStackMorale = next->MoraleVal();
if (nextStackMorale < 0)
if(!next->hadMorale && !next->waited() && nextStackMorale < 0)
{
auto diceSize = VLC->settings()->getVector(EGameSettings::COMBAT_BAD_MORALE_DICE);
size_t diceIndex = std::min<size_t>(diceSize.size()-1, -nextStackMorale);
@ -6705,12 +6705,13 @@ void CGameHandler::runBattle()
{
//check for good morale
nextStackMorale = next->MoraleVal();
if(!next->hadMorale //only one extra move per turn possible
if( !battleResult.get()
&& !next->hadMorale
&& !next->defending
&& !next->waited()
&& !next->fear
&& next->alive()
&& nextStackMorale > 0)
&& next->alive()
&& nextStackMorale > 0)
{
auto diceSize = VLC->settings()->getVector(EGameSettings::COMBAT_GOOD_MORALE_DICE);
size_t diceIndex = std::min<size_t>(diceSize.size()-1, nextStackMorale);