mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Merge remote-tracking branch 'origin/beta' into hota-fixes
This commit is contained in:
commit
97977c06dc
@ -609,7 +609,7 @@ bool BattleEvaluator::attemptCastingSpell(const CStack * activeStack)
|
||||
|
||||
if(ourUnit * goodEffect == 1)
|
||||
{
|
||||
if(ourUnit && goodEffect && (unit->isClone() || unit->isGhost() || !unit->unitSlot().validSlot()))
|
||||
if(ourUnit && goodEffect && (unit->isClone() || unit->isGhost()))
|
||||
continue;
|
||||
|
||||
ps.value += dpsReduce * scoreEvaluator.getPositiveEffectMultiplier();
|
||||
|
@ -258,7 +258,9 @@ EvaluationResult BattleExchangeEvaluator::findBestTarget(
|
||||
|
||||
updateReachabilityMap(hb);
|
||||
|
||||
if(result.bestAttack.attack.shooting && hb->battleHasShootingPenalty(activeStack, result.bestAttack.dest))
|
||||
if(result.bestAttack.attack.shooting
|
||||
&& !activeStack->waited()
|
||||
&& hb->battleHasShootingPenalty(activeStack, result.bestAttack.dest))
|
||||
{
|
||||
if(!canBeHitThisTurn(result.bestAttack))
|
||||
return result; // lets wait
|
||||
@ -481,11 +483,6 @@ float BattleExchangeEvaluator::evaluateExchange(
|
||||
DamageCache & damageCache,
|
||||
std::shared_ptr<HypotheticBattle> hb)
|
||||
{
|
||||
if(ap.from.hex == 127)
|
||||
{
|
||||
logAi->trace("x");
|
||||
}
|
||||
|
||||
BattleScore score = calculateExchange(ap, turn, targets, damageCache, hb);
|
||||
|
||||
#if BATTLE_TRACE_LEVEL >= 1
|
||||
@ -887,7 +884,7 @@ bool BattleExchangeEvaluator::checkPositionBlocksOurStacks(HypotheticBattle & hb
|
||||
continue;
|
||||
|
||||
auto blockedUnitDamage = unit->getMinDamage(hb.battleCanShoot(unit)) * unit->getCount();
|
||||
auto ratio = blockedUnitDamage / (blockedUnitDamage + activeUnitDamage);
|
||||
float ratio = blockedUnitDamage / (float)(blockedUnitDamage + activeUnitDamage + 0.01);
|
||||
|
||||
auto unitReachability = turnBattle.getReachability(unit);
|
||||
auto unitSpeed = unit->speed(turn); // Cached value, to avoid performance hit
|
||||
|
@ -615,6 +615,14 @@ std::pair<std::unique_ptr<ui8 []>, si64> CVideoPlayer::getAudio(const VideoPath
|
||||
return dat;
|
||||
}
|
||||
|
||||
Point CVideoPlayer::size()
|
||||
{
|
||||
if(frame)
|
||||
return Point(frame->width, frame->height);
|
||||
else
|
||||
return Point(0, 0);
|
||||
}
|
||||
|
||||
// Plays a video. Only works for overlays.
|
||||
bool CVideoPlayer::playVideo(int x, int y, bool stopOnKey)
|
||||
{
|
||||
|
@ -38,6 +38,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
virtual std::pair<std::unique_ptr<ui8 []>, si64> getAudio(const VideoPath & videoToOpen) { return std::make_pair(nullptr, 0); };
|
||||
virtual Point size() { return Point(0, 0); };
|
||||
};
|
||||
|
||||
class CEmptyVideoPlayer final : public IMainVideoPlayer
|
||||
@ -109,6 +110,8 @@ public:
|
||||
|
||||
std::pair<std::unique_ptr<ui8 []>, si64> getAudio(const VideoPath & videoToOpen) override;
|
||||
|
||||
Point size() override;
|
||||
|
||||
//TODO:
|
||||
bool wait() override {return false;};
|
||||
int curFrame() const override {return -1;};
|
||||
|
@ -45,10 +45,8 @@ CPrologEpilogVideo::CPrologEpilogVideo(CampaignScenarioPrologEpilog _spe, std::f
|
||||
void CPrologEpilogVideo::show(Canvas & to)
|
||||
{
|
||||
to.drawColor(pos, Colors::BLACK);
|
||||
//BUG: some videos are 800x600 in size while some are 800x400
|
||||
//VCMI should center them in the middle of the screen. Possible but needs modification
|
||||
//of video player API which I'd like to avoid until we'll get rid of Windows-specific player
|
||||
CCS->videoh->update(pos.x, pos.y, to.getInternalSurface(), true, false);
|
||||
//some videos are 800x600 in size while some are 800x400
|
||||
CCS->videoh->update(pos.x, pos.y + (CCS->videoh->size().y == 400 ? 100 : 0), to.getInternalSurface(), true, false);
|
||||
|
||||
//move text every 5 calls/frames; seems to be good enough
|
||||
++positionCounter;
|
||||
|
@ -322,10 +322,10 @@ void CSpellWindow::processSpells()
|
||||
sitesPerTabAdv[v] = 1;
|
||||
else
|
||||
{
|
||||
if((sitesPerTabAdv[v] - spellsPerPage - 2) % spellsPerPage == 0)
|
||||
sitesPerTabAdv[v] = (sitesPerTabAdv[v] - spellsPerPage - 2) / spellsPerPage + 1;
|
||||
if((sitesPerTabAdv[v] - (spellsPerPage - 2)) % spellsPerPage == 0)
|
||||
sitesPerTabAdv[v] = (sitesPerTabAdv[v] - (spellsPerPage - 2)) / spellsPerPage + 1;
|
||||
else
|
||||
sitesPerTabAdv[v] = (sitesPerTabAdv[v] - spellsPerPage - 2) / spellsPerPage + 2;
|
||||
sitesPerTabAdv[v] = (sitesPerTabAdv[v] - (spellsPerPage - 2)) / spellsPerPage + 2;
|
||||
}
|
||||
}
|
||||
|
||||
@ -340,10 +340,10 @@ void CSpellWindow::processSpells()
|
||||
sitesPerTabBattle[v] = 1;
|
||||
else
|
||||
{
|
||||
if((sitesPerTabBattle[v] - spellsPerPage - 2) % spellsPerPage == 0)
|
||||
sitesPerTabBattle[v] = (sitesPerTabBattle[v] - spellsPerPage - 2) / spellsPerPage + 1;
|
||||
if((sitesPerTabBattle[v] - (spellsPerPage - 2)) % spellsPerPage == 0)
|
||||
sitesPerTabBattle[v] = (sitesPerTabBattle[v] - (spellsPerPage - 2)) / spellsPerPage + 1;
|
||||
else
|
||||
sitesPerTabBattle[v] = (sitesPerTabBattle[v] - spellsPerPage - 2) / spellsPerPage + 2;
|
||||
sitesPerTabBattle[v] = (sitesPerTabBattle[v] - (spellsPerPage - 2)) / spellsPerPage + 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
[
|
||||
["CREATURE_DAMAGE", 2, "creatureDamageMin", 0 ], //+2 minimum damage
|
||||
["CREATURE_DAMAGE", 4, "creatureDamageMax", 0 ], //+4 maximum damage
|
||||
["STACK_HEALTH", 20, null, 0 ] //+5 hp
|
||||
["STACK_HEALTH", 20, null, 0 ] //+20 hp
|
||||
],
|
||||
//Value of bonuses given by each skill level
|
||||
"skillLevels":
|
||||
|
Loading…
Reference in New Issue
Block a user