Browse Source

SPECIAL_SPELL_LEV and SPECIAL_BLESS_DAMAGE no longer scale with hero level

Henning Koehler 7 years ago
parent
commit
6c443d7094

+ 2 - 0
config/heroes/castle.json

@@ -176,6 +176,7 @@
 					"addInfo" : 0,
 					"subtype" : "spell.bless",
 					"type" : "SPECIAL_BLESS_DAMAGE",
+                    "updater" : "TIMES_HERO_LEVEL",
 					"val" : 3
 				}
 			}
@@ -217,6 +218,7 @@
 				"frostRing" : {
 					"subtype" : "spell.frostRing",
 					"type" : "SPECIAL_SPELL_LEV",
+                    "updater" : "TIMES_HERO_LEVEL",
 					"val" : 3
 				}
 			}

+ 3 - 0
config/heroes/dungeon.json

@@ -140,6 +140,7 @@
 				"resurrection" : {
 					"subtype" : "spell.resurrection",
 					"type" : "SPECIAL_SPELL_LEV",
+                    "updater" : "TIMES_HERO_LEVEL",
 					"val" : 3
 				}
 			}
@@ -206,6 +207,7 @@
 				"resurrection" : {
 					"subtype" : "spell.resurrection",
 					"type" : "SPECIAL_SPELL_LEV",
+                    "updater" : "TIMES_HERO_LEVEL",
 					"val" : 3
 				}
 			}
@@ -250,6 +252,7 @@
 				"meteorShower" : {
 					"subtype" : "spell.meteorShower",
 					"type" : "SPECIAL_SPELL_LEV",
+                    "updater" : "TIMES_HERO_LEVEL",
 					"val" : 3
 				}
 			}

+ 2 - 0
config/heroes/inferno.json

@@ -153,6 +153,7 @@
 				"inferno" : {
 					"subtype" : "spell.inferno",
 					"type" : "SPECIAL_SPELL_LEV",
+                    "updater" : "TIMES_HERO_LEVEL",
 					"val" : 3
 				}
 			}
@@ -283,6 +284,7 @@
 				"fireball" : {
 					"subtype" : "spell.fireball",
 					"type" : "SPECIAL_SPELL_LEV",
+                    "updater" : "TIMES_HERO_LEVEL",
 					"val" : 3
 				}
 			}

+ 3 - 0
config/heroes/necropolis.json

@@ -148,6 +148,7 @@
 				"deathRipple" : {
 					"subtype" : "spell.deathRipple",
 					"type" : "SPECIAL_SPELL_LEV",
+                    "updater" : "TIMES_HERO_LEVEL",
 					"val" : 3
 				}
 			}
@@ -169,6 +170,7 @@
 				"meteorShower" : {
 					"subtype" : "spell.meteorShower",
 					"type" : "SPECIAL_SPELL_LEV",
+                    "updater" : "TIMES_HERO_LEVEL",
 					"val" : 3
 				}
 			}
@@ -236,6 +238,7 @@
 				"animateDead" : {
 					"subtype" : "spell.animateDead",
 					"type" : "SPECIAL_SPELL_LEV",
+                    "updater" : "TIMES_HERO_LEVEL",
 					"val" : 3
 				}
 			}

+ 2 - 0
config/heroes/rampart.json

@@ -176,6 +176,7 @@
 				"cure" : {
 					"subtype" : "spell.cure",
 					"type" : "SPECIAL_SPELL_LEV",
+                    "updater" : "TIMES_HERO_LEVEL",
 					"val" : 3
 				}
 			}
@@ -286,6 +287,7 @@
 				"iceBolt" : {
 					"subtype" : "spell.iceBolt",
 					"type" : "SPECIAL_SPELL_LEV",
+                    "updater" : "TIMES_HERO_LEVEL",
 					"val" : 3
 				}
 			}

+ 2 - 0
config/heroes/tower.json

@@ -147,6 +147,7 @@
 				"hypnotize" : {
 					"subtype" : "spell.hypnotize",
 					"type" : "SPECIAL_SPELL_LEV",
+                    "updater" : "TIMES_HERO_LEVEL",
 					"val" : 3
 				}
 			}
@@ -249,6 +250,7 @@
 				"chainLightning" : {
 					"subtype" : "spell.chainLightning",
 					"type" : "SPECIAL_SPELL_LEV",
+                    "updater" : "TIMES_HERO_LEVEL",
 					"val" : 3
 				}
 			}

+ 10 - 1
lib/CHeroHandler.cpp

@@ -442,6 +442,7 @@ std::vector<std::shared_ptr<Bonus>> SpecialtyInfoToBonuses(const SSpecialtyInfo
 	case 3: //spell damage bonus, level dependent but calculated elsewhere
 		bonus->type = Bonus::SPECIAL_SPELL_LEV;
 		bonus->subtype = spec.subtype;
+		bonus->updater.reset(new TimesHeroLevelUpdater());
 		result.push_back(bonus);
 		break;
 	case 4: //creature stat boost
@@ -483,6 +484,7 @@ std::vector<std::shared_ptr<Bonus>> SpecialtyInfoToBonuses(const SSpecialtyInfo
 		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;
 	case 7: //maxed mastery for spell
@@ -553,7 +555,14 @@ std::vector<std::shared_ptr<Bonus>> SpecialtyBonusToBonuses(const SSpecialtyBonu
 	std::vector<std::shared_ptr<Bonus>> result;
 	for(std::shared_ptr<Bonus> oldBonus : spec.bonuses)
 	{
-		if(spec.growsWithLevel)
+		if(oldBonus->type == Bonus::SPECIAL_SPELL_LEV || oldBonus->type == Bonus::SPECIAL_BLESS_DAMAGE)
+		{
+			// these bonuses used to auto-scale with hero level
+			std::shared_ptr<Bonus> newBonus = std::make_shared<Bonus>(*oldBonus);
+			newBonus->updater = std::make_shared<TimesHeroLevelUpdater>();
+			result.push_back(newBonus);
+		}
+		else if(spec.growsWithLevel)
 		{
 			std::shared_ptr<Bonus> newBonus = std::make_shared<Bonus>(*oldBonus);
 			switch(newBonus->type)

+ 1 - 1
lib/mapObjects/CGHeroInstance.cpp

@@ -651,7 +651,7 @@ int64_t CGHeroInstance::getSpellBonus(const spells::Spell * spell, int64_t base,
 	});
 
 	if(affectedStack && affectedStack->creatureLevel() > 0) //Hero specials like Solmyr, Deemer
-		base *= (100. + ((valOfBonuses(Bonus::SPECIAL_SPELL_LEV, spell->getIndex()) * level) / affectedStack->creatureLevel())) / 100.0;
+		base *= (100. + valOfBonuses(Bonus::SPECIAL_SPELL_LEV, spell->getIndex()) / affectedStack->creatureLevel()) / 100.0;
 
 	return base;
 }

+ 1 - 1
lib/spells/effects/Timed.cpp

@@ -219,7 +219,7 @@ void Timed::prepareEffects(SetStackEffect & sse, const Mechanics * m, const Effe
 		}
 		if(casterHero && casterHero->hasBonusOfType(Bonus::SPECIAL_BLESS_DAMAGE, m->getSpellIndex())) //TODO: better handling of bonus percentages
 		{
-			int damagePercent = casterHero->level * casterHero->valOfBonuses(Bonus::SPECIAL_BLESS_DAMAGE, m->getSpellIndex()) / tier;
+			int damagePercent = casterHero->valOfBonuses(Bonus::SPECIAL_BLESS_DAMAGE, m->getSpellIndex()) / tier;
 			Bonus specialBonus(Bonus::N_TURNS, Bonus::CREATURE_DAMAGE, Bonus::SPELL_EFFECT, damagePercent, m->getSpellIndex(), 0, Bonus::PERCENT_TO_ALL);
 			specialBonus.turnsRemain = duration;
 			buffer.push_back(specialBonus);