1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

Merge pull request #3240 from IvanSavenko/bugfixing

[1.4.0] Bugfixing for beta
This commit is contained in:
Ivan Savenko 2023-12-02 12:20:37 +02:00 committed by GitHub
commit d919cb0eac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 26 additions and 15 deletions

View File

@ -145,7 +145,7 @@ void CBattleAI::activeStack(const BattleID & battleID, const CStack * stack )
result = evaluator.selectStackAction(stack);
if(!skipCastUntilNextBattle && evaluator.canCastSpell())
if(autobattlePreferences.enableSpellsUsage && !skipCastUntilNextBattle && evaluator.canCastSpell())
{
auto spelCasted = evaluator.attemptCastingSpell(stack);

View File

@ -901,7 +901,7 @@ void CCastleBuildings::enterDwelling(int level)
{
LOCPLINT->cb->recruitCreatures(town, town->getUpperArmy(), id, count, level);
};
GH.windows().createAndPushWindow<CRecruitmentWindow>(town, level, town, recruitCb, nullptr, -87);
GH.windows().createAndPushWindow<CRecruitmentWindow>(town, level, town->getUpperArmy(), recruitCb, nullptr, -87);
}
void CCastleBuildings::enterToTheQuickRecruitmentWindow()
@ -1110,7 +1110,7 @@ void CCreaInfo::clickPressed(const Point & cursorPosition)
{
LOCPLINT->cb->recruitCreatures(town, town->getUpperArmy(), id, count, level);
};
GH.windows().createAndPushWindow<CRecruitmentWindow>(town, level, town, recruitCb, nullptr, offset);
GH.windows().createAndPushWindow<CRecruitmentWindow>(town, level, town->getUpperArmy(), recruitCb, nullptr, offset);
}
std::string CCreaInfo::genGrowthText()

View File

@ -159,7 +159,7 @@ void CRecruitmentWindow::buy()
else
{
std::string txt;
if(dst->ID == Obj::HERO)
if(dwelling->ID != Obj::TOWN)
{
txt = CGI->generaltexth->allTexts[425]; //The %s would join your hero, but there aren't enough provisions to support them.
boost::algorithm::replace_first(txt, "%s", slider->getValue() > 1 ? CGI->creh->objects[crid]->getNamePluralTranslated() : CGI->creh->objects[crid]->getNameSingularTranslated());

View File

@ -237,13 +237,13 @@
],
"specialty" : {
"bonuses" : {
"sorcery" : {
"targetSourceType" : "SECONDARY_SKILL",
"type" : "SPELL_DAMAGE",
"subtype" : "spellSchool.any",
"offence" : {
"subtype" : "damageTypeMelee",
"type" : "PERCENTAGE_DAMAGE_BOOST",
"updater" : "TIMES_HERO_LEVEL",
"val" : 5,
"valueType" : "PERCENT_TO_TARGET_TYPE"
"valueType" : "PERCENT_TO_TARGET_TYPE",
"targetSourceType" : "SECONDARY_SKILL"
}
}
}

View File

@ -69,7 +69,6 @@
[
{
"name": "enableAutocombatSpellsCheckbox",
"help": "vcmi.battleOptions.enableAutocombatSpells",
"callback": "enableAutocombatSpellsChanged"
}
]

View File

@ -89,11 +89,23 @@ int3 IBoatGenerator::bestLocation() const
int3 targetTile = getObject()->visitablePos() + offset;
const TerrainTile *tile = getObject()->cb->getTile(targetTile, false);
if(tile) //tile is in the map
if(!tile)
continue; // tile not visible / outside the map
if(!tile->terType->isWater())
continue;
if (tile->blocked)
{
if(tile->terType->isWater() && (!tile->blocked || tile->blockingObjects.front()->ID == Obj::BOAT)) //and is water and is not blocked or is blocked by boat
return targetTile;
bool hasBoat = false;
for (auto const * object : tile->blockingObjects)
if (object->ID == Obj::BOAT || object->ID == Obj::HERO)
hasBoat = true;
if (!hasBoat)
continue; // tile is blocked, but not by boat -> check next potential position
}
return targetTile;
}
return int3 (-1,-1,-1);
}
@ -112,7 +124,7 @@ IBoatGenerator::EGeneratorState IBoatGenerator::shipyardStatus() const
if(t->blockingObjects.empty())
return GOOD; //OK
if(t->blockingObjects.front()->ID == Obj::BOAT)
if(t->blockingObjects.front()->ID == Obj::BOAT || t->blockingObjects.front()->ID == Obj::HERO)
return BOAT_ALREADY_BUILT; //blocked with boat
return TILE_BLOCKED; //blocked

View File

@ -313,8 +313,8 @@ void CMapGenOptions::resetPlayersMap()
while (players.size() < realPlayersCnt && !availableColors.empty())
{
auto color = availableColors.front();
setPlayerTypeForStandardPlayer(color, EPlayerType::AI);
players[color].setColor(color);
setPlayerTypeForStandardPlayer(color, EPlayerType::AI);
availableColors.erase(availableColors.begin());
if (vstd::contains(savedPlayerSettings, color))