浏览代码

Fixed handling of SPELL_AFTER_ATTACK without addInfo field

Ivan Savenko 1 年之前
父节点
当前提交
5565b55bb0
共有 2 个文件被更改,包括 6 次插入14 次删除
  1. 2 2
      docs/modders/Bonus/Bonus_Types.md
  2. 4 12
      server/battles/BattleActionProcessor.cpp

+ 2 - 2
docs/modders/Bonus/Bonus_Types.md

@@ -788,7 +788,7 @@ Determines how many times per combat affected creature can cast its targeted spe
 - subtype - spell id, eg. spell.iceBolt
 - subtype - spell id, eg. spell.iceBolt
 - value - chance (percent)
 - value - chance (percent)
 - additional info - \[X, Y, Z\]
 - additional info - \[X, Y, Z\]
-    - X - spell level
+    - X - spell mastery level (1 - Basic, 3 - Expert)
     - Y = 0 - all attacks, 1 - shot only, 2 - melee only
     - Y = 0 - all attacks, 1 - shot only, 2 - melee only
     - Z (optional) - layer for multiple SPELL_AFTER_ATTACK bonuses and multi-turn casting. Empty or value less than 0 = not participating in layering.
     - Z (optional) - layer for multiple SPELL_AFTER_ATTACK bonuses and multi-turn casting. Empty or value less than 0 = not participating in layering.
   When enabled - spells from specific layer will not be cast until target has all spells from previous layer on him. Spell from last layer is on repeat if none of spells on lower layers expired.
   When enabled - spells from specific layer will not be cast until target has all spells from previous layer on him. Spell from last layer is on repeat if none of spells on lower layers expired.
@@ -798,7 +798,7 @@ Determines how many times per combat affected creature can cast its targeted spe
 - subtype - spell id
 - subtype - spell id
 - value - chance %
 - value - chance %
 - additional info - \[X, Y, Z\]
 - additional info - \[X, Y, Z\]
-    - X - spell level
+    - X - spell mastery level (1 - Basic, 3 - Expert)
     - Y = 0 - all attacks, 1 - shot only, 2 - melee only
     - Y = 0 - all attacks, 1 - shot only, 2 - melee only
     - Z (optional) - layer for multiple SPELL_BEFORE_ATTACK bonuses and multi-turn casting. Empty or value less than 0 = not participating in layering.
     - Z (optional) - layer for multiple SPELL_BEFORE_ATTACK bonuses and multi-turn casting. Empty or value less than 0 = not participating in layering.
   When enabled - spells from specific layer will not be cast until target has all spells from previous layer on him. Spell from last layer is on repeat if none of spells on lower layers expired.
   When enabled - spells from specific layer will not be cast until target has all spells from previous layer on him. Spell from last layer is on repeat if none of spells on lower layers expired.

+ 4 - 12
server/battles/BattleActionProcessor.cpp

@@ -1139,18 +1139,10 @@ void BattleActionProcessor::attackCasting(const CBattleInfoCallback & battle, bo
 			for(const auto & sf : *spellsByType)
 			for(const auto & sf : *spellsByType)
 			{
 			{
 				int meleeRanged;
 				int meleeRanged;
-				if(sf->additionalInfo.size() < 2)
-				{
-					// legacy format
-					vstd::amax(spellLevel, sf->additionalInfo[0] % 1000);
-					meleeRanged = sf->additionalInfo[0] / 1000;
-				}
-				else
-				{
-					vstd::amax(spellLevel, sf->additionalInfo[0]);
-					meleeRanged = sf->additionalInfo[1];
-				}
-				if (meleeRanged == 0 || (meleeRanged == 1 && ranged) || (meleeRanged == 2 && !ranged))
+				vstd::amax(spellLevel, sf->additionalInfo[0]);
+				meleeRanged = sf->additionalInfo[1];
+
+				if (meleeRanged == CAddInfo::NONE || meleeRanged == 0 || (meleeRanged == 1 && ranged) || (meleeRanged == 2 && !ranged))
 					castMe = true;
 					castMe = true;
 			}
 			}
 			int chance = attacker->valOfBonuses((Selector::typeSubtype(attackMode, BonusSubtypeID(spellID))));
 			int chance = attacker->valOfBonuses((Selector::typeSubtype(attackMode, BonusSubtypeID(spellID))));