Browse Source

Ability rename + bugfix + changelog extend

Dydzio 8 years ago
parent
commit
da6d01b0c7
4 changed files with 22 additions and 17 deletions
  1. 6 0
      ChangeLog
  2. 6 6
      config/bonuses_texts.json
  3. 1 1
      lib/HeroBonus.h
  4. 9 10
      server/CGameHandler.cpp

+ 6 - 0
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

+ 6 - 6
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",

+ 1 - 1
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 */
 

+ 9 - 10
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);
 	}
 }