mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-28 23:06:24 +02:00
Working FIRST_STRIKE ability
This commit is contained in:
parent
5ba8d64b63
commit
1df939bf70
@ -150,10 +150,15 @@
|
||||
"description": "Immune to all Fire school spells"
|
||||
},
|
||||
|
||||
"FIRE_SHIELD":
|
||||
"FIRE_SHIELD": {
|
||||
"name": "Fire Shield (${val}%)",
|
||||
"description": "Reflects part of melee damage"
|
||||
},
|
||||
|
||||
"FIRST_STRIKE":
|
||||
{
|
||||
"name": "Fire Shield (${val}%)",
|
||||
"description": "Reflects part of melee damage"
|
||||
"name": "First Strike",
|
||||
"description": "This creature attacks first instead of retaliating"
|
||||
},
|
||||
|
||||
"FEAR":
|
||||
|
@ -236,6 +236,7 @@ private:
|
||||
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(WIDE_BREATH) /* Kuririn skill */\
|
||||
BONUS_NAME(FIRST_STRIKE) /* Witchking skill */\
|
||||
/* end of list */
|
||||
|
||||
|
||||
|
@ -3935,6 +3935,19 @@ bool CGameHandler::makeBattleAction(BattleAction &ba)
|
||||
|
||||
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 &&
|
||||
stack->alive() && //move can cause death, eg. by walking into the moat
|
||||
destinationStack->alive())
|
||||
@ -3950,6 +3963,7 @@ bool CGameHandler::makeBattleAction(BattleAction &ba)
|
||||
//counterattack
|
||||
if (i == 0 && destinationStack
|
||||
&& !stack->hasBonusOfType(Bonus::BLOCKS_RETALIATION)
|
||||
&& !destinationStack->hasBonusOfType(Bonus::FIRST_STRIKE)
|
||||
&& destinationStack->ableToRetaliate()
|
||||
&& stack->alive()) //attacker may have died (fire shield)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user