Bläddra i källkod

vcmi: remove SPECIAL_BLESS_DAMAGE bonus

It is handled by HAS_ANOTHER_BONUS_LIMITER with SPELL_EFFECT limiter
with desired spell id (bless). Yes, bonus will come from HERO_SPECIAL,
but will work only for blessed with spell id creatures.
Konstantin 2 år sedan
förälder
incheckning
96c40eb36e
5 ändrade filer med 24 tillägg och 20 borttagningar
  1. 14 3
      config/heroes/castle.json
  2. 10 6
      lib/CHeroHandler.cpp
  3. 0 2
      lib/HeroBonus.cpp
  4. 0 1
      lib/HeroBonus.h
  5. 0 8
      lib/spells/effects/Timed.cpp

+ 14 - 3
config/heroes/castle.json

@@ -173,9 +173,20 @@
 		"specialty" : {
 			"bonuses" : {
 				"bless" : {
-					"addInfo" : 0,
-					"subtype" : "spell.bless",
-					"type" : "SPECIAL_BLESS_DAMAGE",
+					"type" : "GENERAL_DAMAGE_PREMY",
+					"limiters" : [
+						{
+							"type" : "HAS_ANOTHER_BONUS_LIMITER",
+							"parameters" : [
+								"GENERAL_DAMAGE_PREMY",
+								1,
+								{
+									"type" : "SPELL_EFFECT",
+									"id" : "spell.bless"
+								}
+							]
+						}
+					],
 					"updater" : "TIMES_HERO_LEVEL",
 					"val" : 3
 				}

+ 10 - 6
lib/CHeroHandler.cpp

@@ -604,12 +604,16 @@ std::vector<std::shared_ptr<Bonus>> SpecialtyInfoToBonuses(const SSpecialtyInfo
 		result.push_back(bonus);
 		break;
 	case 6: //damage bonus for bless (Adela)
-		bonus->type = Bonus::SPECIAL_BLESS_DAMAGE;
-		bonus->subtype = spec.subtype; //spell id if you ever wanted to use it otherwise
-		bonus->additionalInfo = spec.additionalinfo; //damage factor
-		bonus->updater.reset(new TimesHeroLevelUpdater());
-		result.push_back(bonus);
-		break;
+		{
+			auto limiter = std::make_shared<HasAnotherBonusLimiter>(Bonus::GENERAL_DAMAGE_PREMY,Bonus::SPELL_EFFECT);
+			limiter->sid = spec.subtype; //spell id if you ever wanted to use it otherwise
+			limiter->isSourceIDRelevant = true;
+			bonus->type = Bonus::GENERAL_DAMAGE_PREMY;
+			bonus->updater.reset(new TimesHeroLevelUpdater());
+			bonus->addLimiter(limiter);
+			result.push_back(bonus);
+			break;
+		}
 	case 7: //maxed mastery for spell
 		bonus->type = Bonus::SPECIAL_FIXED_VALUE_ENCHANT;
 		bonus->subtype = spec.subtype; //spell id

+ 0 - 2
lib/HeroBonus.cpp

@@ -1649,7 +1649,6 @@ JsonNode subtypeToJson(Bonus::BonusType type, int subtype)
 		return JsonUtils::stringNode(CSkillHandler::encodeSkillWithType(subtype));
 	case Bonus::SPECIAL_SPELL_LEV:
 	case Bonus::SPECIFIC_SPELL_DAMAGE:
-	case Bonus::SPECIAL_BLESS_DAMAGE:
 	case Bonus::MAXED_SPELL:
 	case Bonus::SPECIAL_PECULIAR_ENCHANT:
 	case Bonus::SPECIAL_ADD_VALUE_ENCHANT:
@@ -1757,7 +1756,6 @@ std::string Bonus::nameForBonus() const
 		return CSkillHandler::encodeSkill(subtype);
 	case Bonus::SPECIAL_SPELL_LEV:
 	case Bonus::SPECIFIC_SPELL_DAMAGE:
-	case Bonus::SPECIAL_BLESS_DAMAGE:
 	case Bonus::MAXED_SPELL:
 	case Bonus::SPECIAL_PECULIAR_ENCHANT:
 	case Bonus::SPECIAL_ADD_VALUE_ENCHANT:

+ 0 - 1
lib/HeroBonus.h

@@ -290,7 +290,6 @@ public:
 	BONUS_NAME(SPECIAL_SPELL_LEV) /*subtype = id, val = value per level in percent*/\
 	BONUS_NAME(SPELL_DAMAGE) /*val = value*/\
 	BONUS_NAME(SPECIFIC_SPELL_DAMAGE) /*subtype = id of spell, val = value*/\
-	BONUS_NAME(SPECIAL_BLESS_DAMAGE) /*val = spell (bless), additionalInfo = value per level in percent*/\
 	BONUS_NAME(MAXED_SPELL) /*val = id. deprecated in favour of SPECIAL_FIXED_VALUE_ENCHANT*/\
 	BONUS_NAME(SPECIAL_PECULIAR_ENCHANT) /*blesses and curses with id = val dependent on unit's level, subtype = 0 or 1 for Coronius*/\
 	BONUS_NAME(SPECIAL_UPGRADE) /*subtype = base, additionalInfo = target */\

+ 0 - 8
lib/spells/effects/Timed.cpp

@@ -197,14 +197,6 @@ void Timed::apply(ServerCallback * server, const Mechanics * m, const EffectTarg
 			}
 		}
 
-		if(casterHero && casterHero->hasBonusOfType(Bonus::SPECIAL_BLESS_DAMAGE, m->getSpellIndex())) //TODO: better handling of bonus percentages
-		{
-			int damagePercent = casterHero->valOfBonuses(Bonus::SPECIAL_BLESS_DAMAGE, m->getSpellIndex()) / tier;
-			Bonus specialBonus(Bonus::N_TURNS, Bonus::GENERAL_DAMAGE_PREMY, Bonus::SPELL_EFFECT, damagePercent, m->getSpellIndex());
-			specialBonus.turnsRemain = duration;
-			buffer.push_back(specialBonus);
-		}
-
 		if(cumulative)
 			sse.toAdd.emplace_back(affected->unitId(), buffer);
 		else