1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-25 21:38:59 +02:00

Merge pull request from IvanSavenko/beta_fixes

Fixes for 1.2 release
This commit is contained in:
Ivan Savenko 2023-04-14 11:41:22 +03:00 committed by GitHub
commit 5dd1d5bf3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 33 additions and 18 deletions
client/battle
config/spells
launcher/settingsView
lib
StartInfo.h
mapObjects
spells/effects

@ -530,7 +530,7 @@ bool BattleActionsController::actionIsLegal(PossiblePlayerBattleAction action, B
return (targetStack && targetStackOwned && targetStack->Speed() > 0);
case PossiblePlayerBattleAction::CREATURE_INFO:
return (targetStack && targetStackOwned);
return (targetStack && targetStackOwned && targetStack->alive());
case PossiblePlayerBattleAction::HERO_INFO:
if (targetHex == BattleHex::HERO_ATTACKER)

@ -19,6 +19,7 @@
"aiValue" : 0,
"power" : 40,
"cost" : 1,
"targetModifier":{"smart":true},
"range" : "0",
"battleEffects":{
"demonSummon":{

@ -68,12 +68,13 @@ void CSettingsView::loadSettings()
ui->comboBoxShowIntro->setCurrentIndex(settings["video"]["showIntro"].Bool());
#ifdef Q_OS_IOS
ui->comboBoxFullScreen->setCurrentIndex(true);
ui->comboBoxFullScreen->setCurrentIndex(1);
ui->comboBoxFullScreen->setDisabled(true);
#else
ui->comboBoxFullScreen->setCurrentIndex(settings["video"]["fullscreen"].Bool());
if (settings["video"]["realFullscreen"].Bool())
ui->comboBoxFullScreen->setCurrentIndex(2);
else
ui->comboBoxFullScreen->setCurrentIndex(settings["video"]["fullscreen"].Bool());
#endif
ui->comboBoxFriendlyAI->setCurrentText(QString::fromStdString(settings["server"]["friendlyAI"].String()));

@ -111,7 +111,7 @@ struct DLL_LINKAGE StartInfo
h & campState;
}
StartInfo() : mode(INVALID), difficulty(0), seedToBeUsed(0), seedPostInit(0),
StartInfo() : mode(INVALID), difficulty(1), seedToBeUsed(0), seedPostInit(0),
mapfileChecksum(0), turnTime(0)
{

@ -44,7 +44,7 @@ CQuest::CQuest():
completedOption(0),
stackDirection(0),
heroPortrait(-1),
isCustomFirst(false),
isCustomFirst(false),
isCustomNext(false),
isCustomComplete(false)
{
@ -288,7 +288,7 @@ void CQuest::getRolloverText(MetaString &ms, bool onHover) const
if(onHover)
ms << "\n\n";
std::string questName = missionName(static_cast<Emission>(missionType - 1));
std::string questName = missionName(missionType);
std::string questState = missionState(onHover ? 3 : 4);
ms << VLC->generaltexth->translate("core.seerhut.quest", questName, questState,textOption);
@ -504,23 +504,23 @@ void CQuest::serializeJson(JsonSerializeFormat & handler, const std::string & fi
handler.serializeIdArray<ArtifactID>("artifacts", m5arts);
break;
case MISSION_ARMY:
{
{
auto a = handler.enterArray("creatures");
a.serializeStruct(m6creatures);
}
}
break;
case MISSION_RESOURCES:
{
auto r = handler.enterStruct("resources");
{
auto r = handler.enterStruct("resources");
if(!handler.saving)
if(!handler.saving)
m7resources.resize(GameConstants::RESOURCE_QUANTITY-1);
for(size_t idx = 0; idx < (GameConstants::RESOURCE_QUANTITY - 1); idx++)
{
handler.serializeInt(GameConstants::RESOURCE_NAMES[idx], m7resources[idx], 0);
}
}
}
break;
case MISSION_HERO:
handler.serializeId<ui32, ui32, HeroTypeID>("hero", m13489val, 0);
@ -555,7 +555,8 @@ void CGSeerHut::init(CRandomGenerator & rand)
{
auto names = VLC->generaltexth->findStringsWithPrefix("core.seerhut.names");
seerName = *RandomGeneratorUtil::nextItem(names, rand);
auto seerNameID = *RandomGeneratorUtil::nextItem(names, rand);
seerName = VLC->generaltexth->translate(seerNameID);
quest->textOption = rand.nextInt(2);
quest->completedOption = rand.nextInt(1, 3);
}

@ -89,20 +89,32 @@ void DemonSummon::apply(ServerCallback * server, const Mechanics * m, const Effe
server->apply(&pack);
}
bool DemonSummon::isValidTarget(const Mechanics * m, const battle::Unit * s) const
bool DemonSummon::isValidTarget(const Mechanics * m, const battle::Unit * unit) const
{
if(!s->isDead())
if(!unit->isDead())
return false;
if (s->isGhost())
//check if alive unit blocks rising
for(const BattleHex & hex : battle::Unit::getHexes(unit->getPosition(), unit->doubleWide(), unit->unitSide()))
{
auto blocking = m->battle()->battleGetUnitsIf([hex, unit](const battle::Unit * other)
{
return other->isValidTarget(false) && other->coversPos(hex) && other != unit;
});
if(!blocking.empty())
return false;
}
if (unit->isGhost())
return false;
const auto *creatureType = creature.toCreature(m->creatures());
if (s->getTotalHealth() < creatureType->getMaxHealth())
if (unit->getTotalHealth() < creatureType->getMaxHealth())
return false;
return m->isReceptive(s);
return m->isReceptive(unit);
}
void DemonSummon::serializeJsonUnitEffect(JsonSerializeFormat & handler)