mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-10 22:31:40 +02:00
Fixes for regressions
This commit is contained in:
@@ -939,16 +939,16 @@ const UnitBonusValuesProxy::SelectorsArray * CUnitState::generateBonusSelectors(
|
|||||||
static const CSelector selectorMelee = Selector::effectRange()(BonusLimitEffect::NO_LIMIT).Or(Selector::effectRange()(BonusLimitEffect::ONLY_MELEE_FIGHT));
|
static const CSelector selectorMelee = Selector::effectRange()(BonusLimitEffect::NO_LIMIT).Or(Selector::effectRange()(BonusLimitEffect::ONLY_MELEE_FIGHT));
|
||||||
static const CSelector selectorRanged = Selector::effectRange()(BonusLimitEffect::NO_LIMIT).Or(Selector::effectRange()(BonusLimitEffect::ONLY_DISTANCE_FIGHT));
|
static const CSelector selectorRanged = Selector::effectRange()(BonusLimitEffect::NO_LIMIT).Or(Selector::effectRange()(BonusLimitEffect::ONLY_DISTANCE_FIGHT));
|
||||||
static const CSelector minDamage = Selector::typeSubtype(BonusType::CREATURE_DAMAGE, BonusCustomSubtype::creatureDamageBoth).Or(Selector::typeSubtype(BonusType::CREATURE_DAMAGE, BonusCustomSubtype::creatureDamageMin));
|
static const CSelector minDamage = Selector::typeSubtype(BonusType::CREATURE_DAMAGE, BonusCustomSubtype::creatureDamageBoth).Or(Selector::typeSubtype(BonusType::CREATURE_DAMAGE, BonusCustomSubtype::creatureDamageMin));
|
||||||
static const CSelector maxDamage = Selector::typeSubtype(BonusType::CREATURE_DAMAGE, BonusCustomSubtype::creatureDamageBoth).Or(Selector::typeSubtype(BonusType::CREATURE_DAMAGE, BonusCustomSubtype::creatureDamageMin));
|
static const CSelector maxDamage = Selector::typeSubtype(BonusType::CREATURE_DAMAGE, BonusCustomSubtype::creatureDamageBoth).Or(Selector::typeSubtype(BonusType::CREATURE_DAMAGE, BonusCustomSubtype::creatureDamageMax));
|
||||||
static const CSelector attack = Selector::typeSubtype(BonusType::PRIMARY_SKILL, BonusSubtypeID(PrimarySkill::ATTACK));
|
static const CSelector attack = Selector::typeSubtype(BonusType::PRIMARY_SKILL, BonusSubtypeID(PrimarySkill::ATTACK));
|
||||||
static const CSelector defence = Selector::typeSubtype(BonusType::PRIMARY_SKILL, BonusSubtypeID(PrimarySkill::ATTACK));
|
static const CSelector defence = Selector::typeSubtype(BonusType::PRIMARY_SKILL, BonusSubtypeID(PrimarySkill::DEFENSE));
|
||||||
|
|
||||||
static const UnitBonusValuesProxy::SelectorsArray selectors = {
|
static const UnitBonusValuesProxy::SelectorsArray selectors = {
|
||||||
additionalAttack.And(selectorMelee), //TOTAL_ATTACKS_MELEE,
|
additionalAttack.And(selectorMelee), //TOTAL_ATTACKS_MELEE,
|
||||||
additionalAttack.And(selectorRanged), //TOTAL_ATTACKS_RANGED,
|
additionalAttack.And(selectorRanged), //TOTAL_ATTACKS_RANGED,
|
||||||
minDamage.And(selectorMelee), //MIN_DAMAGE_MELEE,
|
minDamage.And(selectorMelee), //MIN_DAMAGE_MELEE,
|
||||||
minDamage.And(selectorRanged), //MIN_DAMAGE_RANGED,
|
minDamage.And(selectorRanged), //MIN_DAMAGE_RANGED,
|
||||||
minDamage.And(selectorMelee), //MAX_DAMAGE_MELEE,
|
maxDamage.And(selectorMelee), //MAX_DAMAGE_MELEE,
|
||||||
maxDamage.And(selectorRanged), //MAX_DAMAGE_RANGED,
|
maxDamage.And(selectorRanged), //MAX_DAMAGE_RANGED,
|
||||||
attack.And(selectorRanged),//ATTACK_MELEE,
|
attack.And(selectorRanged),//ATTACK_MELEE,
|
||||||
attack.And(selectorRanged),//ATTACK_RANGED,
|
attack.And(selectorRanged),//ATTACK_RANGED,
|
||||||
|
@@ -105,7 +105,7 @@ bool IBonusBearer::hasBonusOfType(BonusType type, BonusSubtypeID subtype) const
|
|||||||
|
|
||||||
bool IBonusBearer::hasBonusFrom(BonusSource source, BonusSourceID sourceID) const
|
bool IBonusBearer::hasBonusFrom(BonusSource source, BonusSourceID sourceID) const
|
||||||
{
|
{
|
||||||
std::string cachingStr = "source_" + std::to_string(static_cast<int>(source)) + "_" + sourceID.toString();
|
std::string cachingStr = "source_" + std::to_string(static_cast<int>(source)) + "_" + std::to_string(sourceID.getNum());
|
||||||
return hasBonus(Selector::source(source,sourceID), cachingStr);
|
return hasBonus(Selector::source(source,sourceID), cachingStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -113,20 +113,20 @@ TurnInfo::TurnInfo(TurnInfoCache * sharedCache, const CGHeroInstance * target, i
|
|||||||
|
|
||||||
{
|
{
|
||||||
static const CSelector selector = Selector::type()(BonusType::FREE_SHIP_BOARDING);
|
static const CSelector selector = Selector::type()(BonusType::FREE_SHIP_BOARDING);
|
||||||
const auto & bonuses = sharedCache->flyingMovement.getBonusList(target, selector);
|
const auto & bonuses = sharedCache->freeShipBoarding.getBonusList(target, selector);
|
||||||
freeShipBoardingTest = bonuses->getFirst(selector) != nullptr;
|
freeShipBoardingTest = bonuses->getFirst(selector) != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
static const CSelector selector = Selector::type()(BonusType::ROUGH_TERRAIN_DISCOUNT);
|
static const CSelector selector = Selector::type()(BonusType::ROUGH_TERRAIN_DISCOUNT);
|
||||||
const auto & bonuses = sharedCache->flyingMovement.getBonusList(target, selector);
|
const auto & bonuses = sharedCache->roughTerrainDiscount.getBonusList(target, selector);
|
||||||
roughTerrainDiscountValue = bonuses->getFirst(selector) != nullptr;
|
roughTerrainDiscountValue = bonuses->getFirst(selector) != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
static const CSelector selector = Selector::typeSubtype(BonusType::MOVEMENT, BonusCustomSubtype::heroMovementSea);
|
static const CSelector selector = Selector::typeSubtype(BonusType::MOVEMENT, BonusCustomSubtype::heroMovementSea);
|
||||||
const auto & vectorSea = target->cb->getSettings().getValue(EGameSettings::HEROES_MOVEMENT_POINTS_SEA).Vector();
|
const auto & vectorSea = target->cb->getSettings().getValue(EGameSettings::HEROES_MOVEMENT_POINTS_SEA).Vector();
|
||||||
const auto & bonuses = sharedCache->flyingMovement.getBonusList(target, selector);
|
const auto & bonuses = sharedCache->movementPointsLimitWater.getBonusList(target, selector);
|
||||||
int baseMovementPointsSea;
|
int baseMovementPointsSea;
|
||||||
if (lowestSpeed < vectorSea.size())
|
if (lowestSpeed < vectorSea.size())
|
||||||
baseMovementPointsSea = vectorSea[lowestSpeed].Integer();
|
baseMovementPointsSea = vectorSea[lowestSpeed].Integer();
|
||||||
@@ -139,7 +139,7 @@ TurnInfo::TurnInfo(TurnInfoCache * sharedCache, const CGHeroInstance * target, i
|
|||||||
{
|
{
|
||||||
static const CSelector selector = Selector::typeSubtype(BonusType::MOVEMENT, BonusCustomSubtype::heroMovementSea);
|
static const CSelector selector = Selector::typeSubtype(BonusType::MOVEMENT, BonusCustomSubtype::heroMovementSea);
|
||||||
const auto & vectorLand = target->cb->getSettings().getValue(EGameSettings::HEROES_MOVEMENT_POINTS_LAND).Vector();
|
const auto & vectorLand = target->cb->getSettings().getValue(EGameSettings::HEROES_MOVEMENT_POINTS_LAND).Vector();
|
||||||
const auto & bonuses = sharedCache->flyingMovement.getBonusList(target, selector);
|
const auto & bonuses = sharedCache->movementPointsLimitLand.getBonusList(target, selector);
|
||||||
int baseMovementPointsLand;
|
int baseMovementPointsLand;
|
||||||
if (lowestSpeed < vectorLand.size())
|
if (lowestSpeed < vectorLand.size())
|
||||||
baseMovementPointsLand = vectorLand[lowestSpeed].Integer();
|
baseMovementPointsLand = vectorLand[lowestSpeed].Integer();
|
||||||
@@ -151,7 +151,7 @@ TurnInfo::TurnInfo(TurnInfoCache * sharedCache, const CGHeroInstance * target, i
|
|||||||
|
|
||||||
{
|
{
|
||||||
static const CSelector selector = Selector::type()(BonusType::NO_TERRAIN_PENALTY);
|
static const CSelector selector = Selector::type()(BonusType::NO_TERRAIN_PENALTY);
|
||||||
const auto & bonuses = sharedCache->flyingMovement.getBonusList(target, selector);
|
const auto & bonuses = sharedCache->noTerrainPenalty.getBonusList(target, selector);
|
||||||
for (const auto & bonus : *bonuses)
|
for (const auto & bonus : *bonuses)
|
||||||
{
|
{
|
||||||
TerrainId affectedTerrain = bonus->subtype.as<TerrainId>();
|
TerrainId affectedTerrain = bonus->subtype.as<TerrainId>();
|
||||||
|
Reference in New Issue
Block a user