mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-26 03:52:01 +02:00
tweaks
This commit is contained in:
parent
9bf4b2a1b0
commit
5da109ad30
@ -138,7 +138,7 @@ static void giveExp(BattleResult &r)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SummonGuardiansHelper(std::vector<BattleHex> & output, const BattleHex & targetPosition, bool targetIsAttacker, bool targetIsTwoHex) //return hexes for summoning two hex monsters in output, target = unit to guard
|
static void summonGuardiansHelper(std::vector<BattleHex> & output, const BattleHex & targetPosition, bool targetIsAttacker, bool targetIsTwoHex) //return hexes for summoning two hex monsters in output, target = unit to guard
|
||||||
{
|
{
|
||||||
int x = targetPosition.getX();
|
int x = targetPosition.getX();
|
||||||
int y = targetPosition.getY();
|
int y = targetPosition.getY();
|
||||||
@ -5649,20 +5649,21 @@ void CGameHandler::runBattle()
|
|||||||
auto accessibility = getAccesibility();
|
auto accessibility = getAccesibility();
|
||||||
CreatureID creatureData = CreatureID(summonInfo->subtype);
|
CreatureID creatureData = CreatureID(summonInfo->subtype);
|
||||||
std::vector<BattleHex> targetHexes;
|
std::vector<BattleHex> targetHexes;
|
||||||
bool targetIsBig = stack->getCreature()->isDoubleWide(); //target = creature to guard
|
const bool targetIsBig = stack->getCreature()->isDoubleWide(); //target = creature to guard
|
||||||
|
const bool guardianIsBig = creatureData.toCreature()->isDoubleWide();
|
||||||
|
|
||||||
/*Chosen idea for two hex units was to cover all possible surrounding hexes of target unit with as small number of stacks as possible.
|
/*Chosen idea for two hex units was to cover all possible surrounding hexes of target unit with as small number of stacks as possible.
|
||||||
For one-hex targets there are four guardians - front, back and one per side (up + down).
|
For one-hex targets there are four guardians - front, back and one per side (up + down).
|
||||||
Two-hex targets are wider and the difference is there are two guardians per side to cover 3 hexes + extra hex in the front
|
Two-hex targets are wider and the difference is there are two guardians per side to cover 3 hexes + extra hex in the front
|
||||||
Additionally, there are special cases for starting positions etc., where guardians would be outside of battlefield if spawned normally*/
|
Additionally, there are special cases for starting positions etc., where guardians would be outside of battlefield if spawned normally*/
|
||||||
if (!creatureData.toCreature()->isDoubleWide())
|
if (!guardianIsBig)
|
||||||
targetHexes = stack->getSurroundingHexes();
|
targetHexes = stack->getSurroundingHexes();
|
||||||
else
|
else
|
||||||
SummonGuardiansHelper(targetHexes, stack->position, stack->attackerOwned, stack->getCreature()->isDoubleWide());
|
summonGuardiansHelper(targetHexes, stack->position, stack->attackerOwned, targetIsBig);
|
||||||
|
|
||||||
for (auto hex : targetHexes)
|
for (auto hex : targetHexes)
|
||||||
{
|
{
|
||||||
if (accessibility.accessible(hex, creatureData.toCreature()->isDoubleWide(), stack->attackerOwned)) //without this multiple creatures can occupy one hex
|
if (accessibility.accessible(hex, guardianIsBig, stack->attackerOwned)) //without this multiple creatures can occupy one hex
|
||||||
{
|
{
|
||||||
BattleStackAdded newStack;
|
BattleStackAdded newStack;
|
||||||
newStack.amount = std::max(1, (int)(stack->count * 0.01 * summonInfo->val));
|
newStack.amount = std::max(1, (int)(stack->count * 0.01 * summonInfo->val));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user