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

Add initial version of Ferocity ability (for Ayssids)

This commit is contained in:
Dydzio 2024-01-01 19:58:32 +01:00
parent 4cd910a4ce
commit 898b8f3c71
4 changed files with 21 additions and 1 deletions

View File

@ -379,6 +379,8 @@
"core.bonus.FEAR.description": "Causes Fear on an enemy stack", "core.bonus.FEAR.description": "Causes Fear on an enemy stack",
"core.bonus.FEARLESS.name": "Fearless", "core.bonus.FEARLESS.name": "Fearless",
"core.bonus.FEARLESS.description": "Immune to Fear ability", "core.bonus.FEARLESS.description": "Immune to Fear ability",
"core.bonus.FEROCITY.name": "Ferocity",
"core.bonus.FEROCITY.description": "DESCRIPTION TO BE ADDED",
"core.bonus.FLYING.name": "Fly", "core.bonus.FLYING.name": "Fly",
"core.bonus.FLYING.description": "Flies when moving (ignores obstacles)", "core.bonus.FLYING.description": "Flies when moving (ignores obstacles)",
"core.bonus.FREE_SHOOTING.name": "Shoot Close", "core.bonus.FREE_SHOOTING.name": "Shoot Close",

View File

@ -185,6 +185,14 @@
} }
}, },
"FEROCITY":
{
"graphics":
{
"icon": ""
}
},
"FLYING": "FLYING":
{ {
"graphics": "graphics":

View File

@ -48,7 +48,7 @@ class JsonNode;
BONUS_NAME(FLYING) \ BONUS_NAME(FLYING) \
BONUS_NAME(SHOOTER) \ BONUS_NAME(SHOOTER) \
BONUS_NAME(CHARGE_IMMUNITY) \ BONUS_NAME(CHARGE_IMMUNITY) \
BONUS_NAME(ADDITIONAL_ATTACK) \ BONUS_NAME(ADDITIONAL_ATTACK) /*val: number of additional attacks to perform*/ \
BONUS_NAME(UNLIMITED_RETALIATIONS) \ BONUS_NAME(UNLIMITED_RETALIATIONS) \
BONUS_NAME(NO_MELEE_PENALTY) \ BONUS_NAME(NO_MELEE_PENALTY) \
BONUS_NAME(JOUSTING) /*for champions*/ \ BONUS_NAME(JOUSTING) /*for champions*/ \
@ -173,6 +173,7 @@ class JsonNode;
BONUS_NAME(UNLIMITED_MOVEMENT) /*cheat bonus*/ \ BONUS_NAME(UNLIMITED_MOVEMENT) /*cheat bonus*/ \
BONUS_NAME(MAX_MORALE) /*cheat bonus*/ \ BONUS_NAME(MAX_MORALE) /*cheat bonus*/ \
BONUS_NAME(MAX_LUCK) /*cheat bonus*/ \ BONUS_NAME(MAX_LUCK) /*cheat bonus*/ \
BONUS_NAME(FEROCITY) /*extra attack, only if at least 1 creature killed in opponent target unit*/ \
/* end of list */ /* end of list */

View File

@ -270,6 +270,9 @@ bool BattleActionProcessor::doAttackAction(const CBattleInfoCallback & battle, c
const bool firstStrike = destinationStack->hasBonusOfType(BonusType::FIRST_STRIKE); const bool firstStrike = destinationStack->hasBonusOfType(BonusType::FIRST_STRIKE);
const bool retaliation = destinationStack->ableToRetaliate(); const bool retaliation = destinationStack->ableToRetaliate();
bool ferocityApplied = false;
int32_t defenderCreatureQuantity = destinationStack->getCount();
for (int i = 0; i < totalAttacks; ++i) for (int i = 0; i < totalAttacks; ++i)
{ {
//first strike //first strike
@ -282,6 +285,12 @@ bool BattleActionProcessor::doAttackAction(const CBattleInfoCallback & battle, c
if(stack->alive() && !stack->hasBonusOfType(BonusType::NOT_ACTIVE) && destinationStack->alive()) if(stack->alive() && !stack->hasBonusOfType(BonusType::NOT_ACTIVE) && destinationStack->alive())
{ {
makeAttack(battle, stack, destinationStack, (i ? 0 : distance), destinationTile, i==0, false, false);//no distance travelled on second attack makeAttack(battle, stack, destinationStack, (i ? 0 : distance), destinationTile, i==0, false, false);//no distance travelled on second attack
if(!ferocityApplied && stack->hasBonusOfType(BonusType::FEROCITY) && destinationStack->getCount() < defenderCreatureQuantity)
{
ferocityApplied = true;
++totalAttacks;
}
} }
//counterattack //counterattack