From 96c40eb36e428508d504ff237713f5ffc03249b0 Mon Sep 17 00:00:00 2001 From: Konstantin Date: Sun, 5 Mar 2023 21:50:58 +0300 Subject: [PATCH] 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. --- config/heroes/castle.json | 17 ++++++++++++++--- lib/CHeroHandler.cpp | 16 ++++++++++------ lib/HeroBonus.cpp | 2 -- lib/HeroBonus.h | 1 - lib/spells/effects/Timed.cpp | 8 -------- 5 files changed, 24 insertions(+), 20 deletions(-) diff --git a/config/heroes/castle.json b/config/heroes/castle.json index 5a8088d14..dcc38d14b 100644 --- a/config/heroes/castle.json +++ b/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 } diff --git a/lib/CHeroHandler.cpp b/lib/CHeroHandler.cpp index 58dfe02da..3aee1ee62 100644 --- a/lib/CHeroHandler.cpp +++ b/lib/CHeroHandler.cpp @@ -604,12 +604,16 @@ std::vector> 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(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 diff --git a/lib/HeroBonus.cpp b/lib/HeroBonus.cpp index 5f9da31dc..711f99399 100644 --- a/lib/HeroBonus.cpp +++ b/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: diff --git a/lib/HeroBonus.h b/lib/HeroBonus.h index 68a794d70..35fecc5dc 100644 --- a/lib/HeroBonus.h +++ b/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 */\ diff --git a/lib/spells/effects/Timed.cpp b/lib/spells/effects/Timed.cpp index b0edeca60..83a795315 100644 --- a/lib/spells/effects/Timed.cpp +++ b/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