1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

Merge pull request #1973 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
6 changed files with 33 additions and 18 deletions

View File

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

View File

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

View File

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

View File

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

View File

@@ -44,7 +44,7 @@ CQuest::CQuest():
completedOption(0), completedOption(0),
stackDirection(0), stackDirection(0),
heroPortrait(-1), heroPortrait(-1),
isCustomFirst(false), isCustomFirst(false),
isCustomNext(false), isCustomNext(false),
isCustomComplete(false) isCustomComplete(false)
{ {
@@ -288,7 +288,7 @@ void CQuest::getRolloverText(MetaString &ms, bool onHover) const
if(onHover) if(onHover)
ms << "\n\n"; ms << "\n\n";
std::string questName = missionName(static_cast<Emission>(missionType - 1)); std::string questName = missionName(missionType);
std::string questState = missionState(onHover ? 3 : 4); std::string questState = missionState(onHover ? 3 : 4);
ms << VLC->generaltexth->translate("core.seerhut.quest", questName, questState,textOption); 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); handler.serializeIdArray<ArtifactID>("artifacts", m5arts);
break; break;
case MISSION_ARMY: case MISSION_ARMY:
{ {
auto a = handler.enterArray("creatures"); auto a = handler.enterArray("creatures");
a.serializeStruct(m6creatures); a.serializeStruct(m6creatures);
} }
break; break;
case MISSION_RESOURCES: 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); m7resources.resize(GameConstants::RESOURCE_QUANTITY-1);
for(size_t idx = 0; idx < (GameConstants::RESOURCE_QUANTITY - 1); idx++) for(size_t idx = 0; idx < (GameConstants::RESOURCE_QUANTITY - 1); idx++)
{ {
handler.serializeInt(GameConstants::RESOURCE_NAMES[idx], m7resources[idx], 0); handler.serializeInt(GameConstants::RESOURCE_NAMES[idx], m7resources[idx], 0);
} }
} }
break; break;
case MISSION_HERO: case MISSION_HERO:
handler.serializeId<ui32, ui32, HeroTypeID>("hero", m13489val, 0); 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"); 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->textOption = rand.nextInt(2);
quest->completedOption = rand.nextInt(1, 3); quest->completedOption = rand.nextInt(1, 3);
} }

View File

@@ -89,20 +89,32 @@ void DemonSummon::apply(ServerCallback * server, const Mechanics * m, const Effe
server->apply(&pack); 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; 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; return false;
const auto *creatureType = creature.toCreature(m->creatures()); const auto *creatureType = creature.toCreature(m->creatures());
if (s->getTotalHealth() < creatureType->getMaxHealth()) if (unit->getTotalHealth() < creatureType->getMaxHealth())
return false; return false;
return m->isReceptive(s); return m->isReceptive(unit);
} }
void DemonSummon::serializeJsonUnitEffect(JsonSerializeFormat & handler) void DemonSummon::serializeJsonUnitEffect(JsonSerializeFormat & handler)