mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	Fix assert and condition for counting spell hexes
This commit is contained in:
		| @@ -937,7 +937,7 @@ void CPlayerInterface::battleAttack(const BattleID & battleID, const BattleAttac | |||||||
| 			info.secondaryDefender.push_back(cb->getBattle(battleID)->battleGetStackByID(elem.stackAttacked)); | 			info.secondaryDefender.push_back(cb->getBattle(battleID)->battleGetStackByID(elem.stackAttacked)); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	assert(info.defender != nullptr); | 	assert(info.defender != nullptr || (info.spellEffect != SpellID::NONE && info.indirectAttack)); | ||||||
| 	assert(info.attacker != nullptr); | 	assert(info.attacker != nullptr); | ||||||
|  |  | ||||||
| 	battleInt->stackAttacking(info); | 	battleInt->stackAttacking(info); | ||||||
|   | |||||||
| @@ -532,7 +532,7 @@ std::string BattleActionsController::actionGetStatusMessage(PossiblePlayerBattle | |||||||
| 			if(targetStack == nullptr) //should be true only for spell-like attack | 			if(targetStack == nullptr) //should be true only for spell-like attack | ||||||
| 			{ | 			{ | ||||||
| 				auto spellLikeAttackBonus = owner.stacksController->getActiveStack()->getBonus(Selector::type()(BonusType::SPELL_LIKE_ATTACK)); | 				auto spellLikeAttackBonus = owner.stacksController->getActiveStack()->getBonus(Selector::type()(BonusType::SPELL_LIKE_ATTACK)); | ||||||
| 				assert(bonus != nullptr); | 				assert(spellLikeAttackBonus != nullptr); | ||||||
| 				return boost::str(boost::format(CGI->generaltexth->allTexts[26]) % spellLikeAttackBonus->subtype.as<SpellID>().toSpell()->getNameTranslated()); | 				return boost::str(boost::format(CGI->generaltexth->allTexts[26]) % spellLikeAttackBonus->subtype.as<SpellID>().toSpell()->getNameTranslated()); | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -740,8 +740,8 @@ bool CBattleInfoCallback::battleCanTargetEmptyHex(const battle::Unit * attacker) | |||||||
| 		if(spell->isDamage()) | 		if(spell->isDamage()) | ||||||
| 		{ | 		{ | ||||||
| 			spells::BattleCast cast(this, attacker, spells::Mode::SPELL_LIKE_ATTACK, spell); | 			spells::BattleCast cast(this, attacker, spells::Mode::SPELL_LIKE_ATTACK, spell); | ||||||
|  | 			BattleHex dummySpellTarget = BattleHex(50); //check arbitrary hex for general spell range since currently there is no general way to access amount of hexes | ||||||
| 			if(vstd::find(spell->battleMechanics(&cast)->getTargetTypes(), spells::AimType::LOCATION) != spell->battleMechanics(&cast)->getTargetTypes().end()) | 			if(spell->battleMechanics(&cast)->rangeInHexes(dummySpellTarget).size() > 1) | ||||||
| 			{ | 			{ | ||||||
| 				return true; | 				return true; | ||||||
| 			} | 			} | ||||||
|   | |||||||
| @@ -164,6 +164,7 @@ EffectTarget UnitEffect::transformTargetByRange(const Mechanics * m, const Targe | |||||||
|  |  | ||||||
| 	if(m->alwaysHitFirstTarget()) | 	if(m->alwaysHitFirstTarget()) | ||||||
| 	{ | 	{ | ||||||
|  | 		//TODO: examine if adjustments needed related to INVINCIBLE bonus | ||||||
| 		if(!aimPoint.empty() && aimPoint.front().unitValue) | 		if(!aimPoint.empty() && aimPoint.front().unitValue) | ||||||
| 			targets.insert(aimPoint.front().unitValue); | 			targets.insert(aimPoint.front().unitValue); | ||||||
| 	} | 	} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user