Ver Fonte

Fixes for regressions

Ivan Savenko há 9 meses atrás
pai
commit
83b9a8d750

+ 3 - 3
lib/battle/CUnitState.cpp

@@ -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 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 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 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 = {
 		additionalAttack.And(selectorMelee), //TOTAL_ATTACKS_MELEE,
 		additionalAttack.And(selectorRanged), //TOTAL_ATTACKS_RANGED,
 		minDamage.And(selectorMelee), //MIN_DAMAGE_MELEE,
 		minDamage.And(selectorRanged), //MIN_DAMAGE_RANGED,
-		minDamage.And(selectorMelee), //MAX_DAMAGE_MELEE,
+		maxDamage.And(selectorMelee), //MAX_DAMAGE_MELEE,
 		maxDamage.And(selectorRanged), //MAX_DAMAGE_RANGED,
 		attack.And(selectorRanged),//ATTACK_MELEE,
 		attack.And(selectorRanged),//ATTACK_RANGED,

+ 1 - 1
lib/bonuses/IBonusBearer.cpp

@@ -105,7 +105,7 @@ bool IBonusBearer::hasBonusOfType(BonusType type, BonusSubtypeID subtype) 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);
 }
 

+ 5 - 5
lib/pathfinder/TurnInfo.cpp

@@ -113,20 +113,20 @@ TurnInfo::TurnInfo(TurnInfoCache * sharedCache, const CGHeroInstance * target, i
 
 	{
 		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;
 	}
 
 	{
 		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;
 	}
 
 	{
 		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 & bonuses = sharedCache->flyingMovement.getBonusList(target, selector);
+		const auto & bonuses = sharedCache->movementPointsLimitWater.getBonusList(target, selector);
 		int baseMovementPointsSea;
 		if (lowestSpeed < vectorSea.size())
 			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);
 		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;
 		if (lowestSpeed < vectorLand.size())
 			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);
-		const auto & bonuses = sharedCache->flyingMovement.getBonusList(target, selector);
+		const auto & bonuses = sharedCache->noTerrainPenalty.getBonusList(target, selector);
 		for (const auto & bonus : *bonuses)
 		{
 			TerrainId affectedTerrain = bonus->subtype.as<TerrainId>();