1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-22 22:13:35 +02:00

Bonus: prism breath

This commit is contained in:
Laserlicht 2024-10-20 22:02:56 +02:00
parent 6dc6cc4cbf
commit 0991f02282
5 changed files with 45 additions and 18 deletions

View File

@ -687,5 +687,7 @@
"core.bonus.DISINTEGRATE.name": "Disintegrate", "core.bonus.DISINTEGRATE.name": "Disintegrate",
"core.bonus.DISINTEGRATE.description": "No corpse remains after death", "core.bonus.DISINTEGRATE.description": "No corpse remains after death",
"core.bonus.INVINCIBLE.name": "Invincible", "core.bonus.INVINCIBLE.name": "Invincible",
"core.bonus.INVINCIBLE.description": "Cannot be affected by anything" "core.bonus.INVINCIBLE.description": "Cannot be affected by anything",
"core.bonus.PRISM_HEX_ATTACK_BREATH.name": "Prism Breath",
"core.bonus.PRISM_HEX_ATTACK_BREATH.description": "Prism Breath Attack (three directions)"
} }

View File

@ -548,6 +548,14 @@
} }
}, },
"PRISM_HEX_ATTACK_BREATH":
{
"graphics":
{
"icon": "zvs/Lib1.res/PrismBreath"
}
},
"THREE_HEADED_ATTACK": "THREE_HEADED_ATTACK":
{ {
"graphics": "graphics":

View File

@ -502,6 +502,10 @@ Affected unit attacks all adjacent creatures (Hydra). Only directly targeted cre
Affected unit attacks creature located directly behind targeted tile (Dragons). Only directly targeted creature will attempt to retaliate Affected unit attacks creature located directly behind targeted tile (Dragons). Only directly targeted creature will attempt to retaliate
### PRISM_HEX_ATTACK_BREATH
Like `TWO_HEX_ATTACK_BREATH` but affects also two additional cratures (in triangle form from target tile)
### RETURN_AFTER_STRIKE ### RETURN_AFTER_STRIKE
Affected unit can return to his starting location after attack (Harpies) Affected unit can return to his starting location after attack (Harpies)

View File

@ -1392,7 +1392,7 @@ AttackableTiles CBattleInfoCallback::getPotentiallyAttackableHexes(
at.friendlyCreaturePositions.insert(tile); at.friendlyCreaturePositions.insert(tile);
} }
} }
else if(attacker->hasBonusOfType(BonusType::TWO_HEX_ATTACK_BREATH)) else if(attacker->hasBonusOfType(BonusType::TWO_HEX_ATTACK_BREATH) || attacker->hasBonusOfType(BonusType::PRISM_HEX_ATTACK_BREATH))
{ {
auto direction = BattleHex::mutualPosition(attackOriginHex, destinationTile); auto direction = BattleHex::mutualPosition(attackOriginHex, destinationTile);
@ -1404,27 +1404,39 @@ AttackableTiles CBattleInfoCallback::getPotentiallyAttackableHexes(
direction = BattleHex::mutualPosition(attackOriginHex, defender->occupiedHex(defenderPos)); direction = BattleHex::mutualPosition(attackOriginHex, defender->occupiedHex(defenderPos));
} }
if(direction != BattleHex::NONE) //only adjacent hexes are subject of dragon breath calculation for(int i = 0; i < 3; i++)
{ {
BattleHex nextHex = destinationTile.cloneInDirection(direction, false); if(direction != BattleHex::NONE) //only adjacent hexes are subject of dragon breath calculation
if ( defender->doubleWide() )
{ {
auto secondHex = destinationTile == defenderPos ? defender->occupiedHex(defenderPos) : defenderPos; BattleHex nextHex = destinationTile.cloneInDirection(direction, false);
// if targeted double-wide creature is attacked from above or below ( -> second hex is also adjacent to attack origin) if ( defender->doubleWide() )
// then dragon breath should target tile on the opposite side of targeted creature {
if(BattleHex::mutualPosition(attackOriginHex, secondHex) != BattleHex::NONE) auto secondHex = destinationTile == defenderPos ? defender->occupiedHex(defenderPos) : defenderPos;
nextHex = secondHex.cloneInDirection(direction, false);
// if targeted double-wide creature is attacked from above or below ( -> second hex is also adjacent to attack origin)
// then dragon breath should target tile on the opposite side of targeted creature
if(BattleHex::mutualPosition(attackOriginHex, secondHex) != BattleHex::NONE)
nextHex = secondHex.cloneInDirection(direction, false);
}
if (nextHex.isValid())
{
//friendly stacks can also be damaged by Dragon Breath
const auto * st = battleGetUnitByPos(nextHex, true);
if(st != nullptr)
at.friendlyCreaturePositions.insert(nextHex);
}
} }
if (nextHex.isValid()) if(!attacker->hasBonusOfType(BonusType::PRISM_HEX_ATTACK_BREATH))
{ break;
//friendly stacks can also be damaged by Dragon Breath
const auto * st = battleGetUnitByPos(nextHex, true); // only needed for prism
if(st != nullptr) int tmpDirection = static_cast<int>(direction) + 2;
at.friendlyCreaturePositions.insert(nextHex); if(tmpDirection > static_cast<int>(BattleHex::EDir::LEFT))
} tmpDirection -= static_cast<int>(BattleHex::EDir::TOP);
direction = static_cast<BattleHex::EDir>(tmpDirection);
} }
} }
return at; return at;

View File

@ -180,6 +180,7 @@ class JsonNode;
BONUS_NAME(RESOURCES_TOWN_MULTIPLYING_BOOST) /*Bonus that does not account for propagation and gives extra resources per day with amount multiplied by number of owned towns. val - base resource amount to be multiplied times number of owned towns, subtype - resource type*/ \ BONUS_NAME(RESOURCES_TOWN_MULTIPLYING_BOOST) /*Bonus that does not account for propagation and gives extra resources per day with amount multiplied by number of owned towns. val - base resource amount to be multiplied times number of owned towns, subtype - resource type*/ \
BONUS_NAME(DISINTEGRATE) /* after death no corpse remains */ \ BONUS_NAME(DISINTEGRATE) /* after death no corpse remains */ \
BONUS_NAME(INVINCIBLE) /* cannot be target of attacks or spells */ \ BONUS_NAME(INVINCIBLE) /* cannot be target of attacks or spells */ \
BONUS_NAME(PRISM_HEX_ATTACK_BREATH) /*eg. dragons*/ \
/* end of list */ /* end of list */