diff --git a/ChangeLog b/ChangeLog index 57add05bf..db8795119 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,12 @@ GENERAL: - BLOCKS_RANGED_RETALIATION - disallow enemy ranged counterattack - SECONDARY_SKILL_VAL2 - set additional parameter for certain secondary skills - MANUAL_CONTROL - grant manual control over war machine +- WIDE_BREATH - melee creature attacks affect many nearby hexes +- FIRST_STRIKE - creature counterattacks before attack if possible +- SYNERGY_TARGET - placeholder bonus for Mod Design Team (subject to removal in future) +- SHOOTS_ALL_ADJACENT - makes creature shots affect all neighbouring hexes +- BLOCK_MAGIC_BELOW - allows blocking spells below particular spell level. HotA cape artifact can be implemented with this +- DESTRUCTION - creature ability for killing extra units after hit, configurable SPELLS: * Implemented cumulative effects for spells diff --git a/config/bonuses_texts.json b/config/bonuses_texts.json index 46b9eacd7..6b78376ab 100644 --- a/config/bonuses_texts.json +++ b/config/bonuses_texts.json @@ -96,6 +96,12 @@ "description": "+${val} Defense when defending" }, + "DESTRUCTION": + { + "name": "Destruction", + "description": "Has ${val}% chance to kill extra units after attack" + }, + "DOUBLE_DAMAGE_CHANCE": { "name": "Death Blow", @@ -420,12 +426,6 @@ "description": "This creature is vulnerable to synergy effect" }, - "TERMINATOR": - { - "name": "Terminator", - "description": "Has ${val}% chance to kill extra units after attack" - }, - "TWO_HEX_ATTACK_BREATH": { "name": "Breath", diff --git a/lib/HeroBonus.h b/lib/HeroBonus.h index 7c6d4c525..2f76c76ea 100644 --- a/lib/HeroBonus.h +++ b/lib/HeroBonus.h @@ -242,7 +242,7 @@ private: BONUS_NAME(SYNERGY_TARGET) /* dummy skill for alternative upgrades mod */\ BONUS_NAME(SHOOTS_ALL_ADJACENT) /* H4 Cyclops-like shoot (attacks all hexes neighboring with target) without spell-like mechanics */\ BONUS_NAME(BLOCK_MAGIC_BELOW) /*blocks casting spells of the level < value */ \ - BONUS_NAME(TERMINATOR) /*kills extra units after hit, subtype = 0 - kill percentage of units, 1 - kill amount, val = chance in percent to trigger, additional info - amount/percentage to kill*/ \ + BONUS_NAME(DESTRUCTION) /*kills extra units after hit, subtype = 0 - kill percentage of units, 1 - kill amount, val = chance in percent to trigger, additional info - amount/percentage to kill*/ \ /* end of list */ diff --git a/server/CGameHandler.cpp b/server/CGameHandler.cpp index fd53f2b57..7a32574d0 100644 --- a/server/CGameHandler.cpp +++ b/server/CGameHandler.cpp @@ -5417,22 +5417,21 @@ void CGameHandler::handleAfterAttackCasting(const BattleAttack & bat) sendAndApply(&victimInfo); sendAndApply(&resurrectInfo); } - if(attacker->hasBonusOfType(Bonus::TERMINATOR, 0) || attacker->hasBonusOfType(Bonus::TERMINATOR, 1)) + if(attacker->hasBonusOfType(Bonus::DESTRUCTION, 0) || attacker->hasBonusOfType(Bonus::DESTRUCTION, 1)) { double chanceToTrigger = 0; int amountToDie = 0; - if(attacker->hasBonusOfType(Bonus::TERMINATOR, 0)) //killing by percentage + if(attacker->hasBonusOfType(Bonus::DESTRUCTION, 0)) //killing by percentage { - chanceToTrigger = attacker->valOfBonuses(Bonus::TERMINATOR, 0) / 100.0f; - int percentageToDie = attacker->getBonus(Selector::type(Bonus::TERMINATOR).And(Selector::subtype(0)))->additionalInfo; - amountToDie = defender->getCount() * (percentageToDie / 100.0); - + chanceToTrigger = attacker->valOfBonuses(Bonus::DESTRUCTION, 0) / 100.0f; + int percentageToDie = attacker->getBonus(Selector::type(Bonus::DESTRUCTION).And(Selector::subtype(0)))->additionalInfo; + amountToDie = defender->getCount() * percentageToDie * 0.01f; } - else if(attacker->hasBonusOfType(Bonus::TERMINATOR, 1)) //killing by count + else if(attacker->hasBonusOfType(Bonus::DESTRUCTION, 1)) //killing by count { - chanceToTrigger = attacker->valOfBonuses(Bonus::TERMINATOR, 1) / 100.0f; - amountToDie = attacker->getBonus(Selector::type(Bonus::TERMINATOR).And(Selector::subtype(1)))->additionalInfo; + chanceToTrigger = attacker->valOfBonuses(Bonus::DESTRUCTION, 1) / 100.0f; + amountToDie = attacker->getBonus(Selector::type(Bonus::DESTRUCTION).And(Selector::subtype(1)))->additionalInfo; } vstd::amin(chanceToTrigger, 1); //cap trigger chance at 100% @@ -5446,7 +5445,7 @@ void CGameHandler::handleAfterAttackCasting(const BattleAttack & bat) bsa.damageAmount = amountToDie * defender->getCreature()->MaxHealth(); bsa.flags = BattleStackAttacked::SPELL_EFFECT; bsa.spellID = SpellID::SLAYER; - attacker->prepareAttacked(bsa, getRandomGenerator()); + defender->prepareAttacked(bsa, getRandomGenerator()); sendAndApply(&bsa); } }