mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-06 09:09:40 +02:00
Working FIRST_STRIKE ability
This commit is contained in:
@@ -150,12 +150,17 @@
|
|||||||
"description": "Immune to all Fire school spells"
|
"description": "Immune to all Fire school spells"
|
||||||
},
|
},
|
||||||
|
|
||||||
"FIRE_SHIELD":
|
"FIRE_SHIELD": {
|
||||||
{
|
|
||||||
"name": "Fire Shield (${val}%)",
|
"name": "Fire Shield (${val}%)",
|
||||||
"description": "Reflects part of melee damage"
|
"description": "Reflects part of melee damage"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"FIRST_STRIKE":
|
||||||
|
{
|
||||||
|
"name": "First Strike",
|
||||||
|
"description": "This creature attacks first instead of retaliating"
|
||||||
|
},
|
||||||
|
|
||||||
"FEAR":
|
"FEAR":
|
||||||
{
|
{
|
||||||
"name": "Fear",
|
"name": "Fear",
|
||||||
|
|||||||
@@ -236,6 +236,7 @@ private:
|
|||||||
BONUS_NAME(RANGED_RETALIATION) /*allows shooters to perform ranged retaliation*/\
|
BONUS_NAME(RANGED_RETALIATION) /*allows shooters to perform ranged retaliation*/\
|
||||||
BONUS_NAME(BLOCKS_RANGED_RETALIATION) /*disallows ranged retaliation for shooter unit, BLOCKS_RETALIATION bonus is for melee retaliation only*/\
|
BONUS_NAME(BLOCKS_RANGED_RETALIATION) /*disallows ranged retaliation for shooter unit, BLOCKS_RETALIATION bonus is for melee retaliation only*/\
|
||||||
BONUS_NAME(WIDE_BREATH) /* Kuririn skill */\
|
BONUS_NAME(WIDE_BREATH) /* Kuririn skill */\
|
||||||
|
BONUS_NAME(FIRST_STRIKE) /* Witchking skill */\
|
||||||
/* end of list */
|
/* end of list */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3935,6 +3935,19 @@ bool CGameHandler::makeBattleAction(BattleAction &ba)
|
|||||||
|
|
||||||
for (int i = 0; i < totalAttacks; ++i)
|
for (int i = 0; i < totalAttacks; ++i)
|
||||||
{
|
{
|
||||||
|
//first strike
|
||||||
|
if(i == 0 && destinationStack
|
||||||
|
&& destinationStack->hasBonusOfType(Bonus::FIRST_STRIKE)
|
||||||
|
&& destinationStack->ableToRetaliate()
|
||||||
|
&& stack->alive()) //probably not needed
|
||||||
|
{
|
||||||
|
BattleAttack bat;
|
||||||
|
prepareAttack(bat, destinationStack, stack, 0, stack->position);
|
||||||
|
bat.flags |= BattleAttack::COUNTER;
|
||||||
|
sendAndApply(&bat);
|
||||||
|
handleAfterAttackCasting(bat);
|
||||||
|
}
|
||||||
|
|
||||||
if (stack &&
|
if (stack &&
|
||||||
stack->alive() && //move can cause death, eg. by walking into the moat
|
stack->alive() && //move can cause death, eg. by walking into the moat
|
||||||
destinationStack->alive())
|
destinationStack->alive())
|
||||||
@@ -3950,6 +3963,7 @@ bool CGameHandler::makeBattleAction(BattleAction &ba)
|
|||||||
//counterattack
|
//counterattack
|
||||||
if (i == 0 && destinationStack
|
if (i == 0 && destinationStack
|
||||||
&& !stack->hasBonusOfType(Bonus::BLOCKS_RETALIATION)
|
&& !stack->hasBonusOfType(Bonus::BLOCKS_RETALIATION)
|
||||||
|
&& !destinationStack->hasBonusOfType(Bonus::FIRST_STRIKE)
|
||||||
&& destinationStack->ableToRetaliate()
|
&& destinationStack->ableToRetaliate()
|
||||||
&& stack->alive()) //attacker may have died (fire shield)
|
&& stack->alive()) //attacker may have died (fire shield)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user