Browse Source

fixes formatting

Opuszek 4 months ago
parent
commit
f7bd9de59f
2 changed files with 4 additions and 8 deletions
  1. 2 6
      lib/spells/BattleSpellMechanics.cpp
  2. 2 2
      lib/spells/BattleSpellMechanics.h

+ 2 - 6
lib/spells/BattleSpellMechanics.cpp

@@ -413,9 +413,7 @@ void BattleSpellMechanics::beforeCast(BattleSpellCast & sc, vstd::RNG & rng, con
 	std::set<const battle::Unit *> unitTargets = collectTargets();
 
 	if (unitTargets.size()==1 && isReflected(*(unitTargets.begin()), rng))
-	{
 		return reflect(sc, rng, *(unitTargets.begin()));
-	}
 
 	//process them
 	for(const auto * unit : unitTargets)
@@ -449,7 +447,7 @@ bool BattleSpellMechanics::isReflected(const battle::Unit * unit, vstd::RNG & rn
 	return targetCanReflectSpell && rng.nextInt(0, 99) < unit->valOfBonuses(magicMirrorSelector, magicMirrorCacheStr);
 }
 
-void BattleSpellMechanics::reflect(BattleSpellCast & sc, vstd::RNG & rng, const battle::Unit* unit)
+void BattleSpellMechanics::reflect(BattleSpellCast & sc, vstd::RNG & rng, const battle::Unit * unit)
 {
 	auto otherSide = battle()->otherSide(unit->unitSide());
 	auto newTarget = getRandomUnit(rng, otherSide);
@@ -460,15 +458,13 @@ void BattleSpellMechanics::reflect(BattleSpellCast & sc, vstd::RNG & rng, const
 	sc.tile = reflectedTo;
 
 	if (!isReceptive(newTarget))
-	{
 		sc.resistedCres.insert(newTarget->unitId());    //A spell can be reflected to then resisted by an immune unit. Consistent with the original game.
-	}
 
 	beforeCast(sc, rng,
 		boost::assign::list_of(reflectedTo));
 }
 
-const battle::Unit* BattleSpellMechanics::getRandomUnit(vstd::RNG & rng, BattleSide & side)
+const battle::Unit * BattleSpellMechanics::getRandomUnit(vstd::RNG & rng, BattleSide & side)
 {
 	auto targets = battle()->getBattle()->getUnitsIf([this, & side](const battle::Unit * unit)
 	{

+ 2 - 2
lib/spells/BattleSpellMechanics.h

@@ -77,8 +77,8 @@ private:
 
 	void beforeCast(BattleSpellCast & sc, vstd::RNG & rng, const Target & target);
 	bool isReflected(const battle::Unit * unit, vstd::RNG & rng);
-	void reflect(BattleSpellCast & sc, vstd::RNG & rng, const battle::Unit* unit);
-	const battle::Unit* getRandomUnit(vstd::RNG & rng, BattleSide & side);
+	void reflect(BattleSpellCast & sc, vstd::RNG & rng, const battle::Unit * unit);
+	const battle::Unit * getRandomUnit(vstd::RNG & rng, BattleSide & side);
 
 	std::set<const battle::Unit *> collectTargets() const;