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

Update Nullkiller.cpp

Don't trade away gold when the gold-pressure is high.
This commit is contained in:
Xilmi 2024-08-18 09:47:37 +02:00
parent 3be25d9414
commit 284f276108

View File

@ -635,7 +635,7 @@ bool Nullkiller::handleTrading()
if (i == 6)
{
if (income[i] > 0)
if (income[i] > 0 && !buildAnalyzer->isGoldPressureHigh())
okToSell = true;
}
else
@ -663,7 +663,7 @@ bool Nullkiller::handleTrading()
if (toGive && toGive <= available[mostExpendable]) //don't try to sell 0 resources
{
cb->trade(m, EMarketMode::RESOURCE_RESOURCE, GameResID(mostExpendable), GameResID(mostWanted), toGive);
logAi->debug("Traded %d of %s for %d of %s at %s", toGive, mostExpendable, toGet, mostWanted, obj->getObjectName());
logAi->info("Traded %d of %s for %d of %s at %s", toGive, mostExpendable, toGet, mostWanted, obj->getObjectName());
haveTraded = true;
shouldTryToTrade = true;
}