From 3c053e5dd55063a6eaf92ab16ce2dd8669b4d049 Mon Sep 17 00:00:00 2001 From: AlexVinS Date: Mon, 14 Sep 2015 12:31:47 +0300 Subject: [PATCH] Quick fix for 2245 & 2238 --- config/spells/timed.json | 6 +++--- lib/spells/CDefaultSpellMechanics.cpp | 22 ++++++++++++---------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/config/spells/timed.json b/config/spells/timed.json index b323383ee..c3519faa5 100644 --- a/config/spells/timed.json +++ b/config/spells/timed.json @@ -1022,7 +1022,7 @@ "inFrenzy" : { "type" : "IN_FRENZY", "val" : 100, - "duration" : "STACK_GETS_TURN" + "duration" : "N_TURNS"//hardcoded to 1 } } }, @@ -1096,7 +1096,7 @@ }, "berserk" : { "index" : 59, - "targetType" : "CREATURE", + "targetType" : "LOCATION", "animation":{ "affect":["C01SPF"] //C01SPF0 @@ -1111,7 +1111,7 @@ "effects" : { "attacksNearestCreature" : { "type" : "ATTACKS_NEAREST_CREATURE", - "duration" : "N_TURNS" + "duration" : "N_TURNS" //hardcoded to 1 } } }, diff --git a/lib/spells/CDefaultSpellMechanics.cpp b/lib/spells/CDefaultSpellMechanics.cpp index c29e05ffb..b671a0461 100644 --- a/lib/spells/CDefaultSpellMechanics.cpp +++ b/lib/spells/CDefaultSpellMechanics.cpp @@ -488,19 +488,21 @@ void DefaultSpellMechanics::battleLogSingleTarget(std::vector & log int DefaultSpellMechanics::calculateDuration(const CGHeroInstance * caster, int usedSpellPower) const { - if(!caster) - { - if (!usedSpellPower) - return 3; //default duration of all creature spells - else - return usedSpellPower; //use creature spell power - } switch(owner->id) { - case SpellID::FRENZY: + case SpellID::FRENZY: + case SpellID::BERSERK: return 1; - default: //other spells - return caster->getPrimSkillLevel(PrimarySkill::SPELL_POWER) + caster->valOfBonuses(Bonus::SPELL_DURATION); + default: //other spells + if(caster == nullptr) + { + if (!usedSpellPower) + return 3; //default duration of all creature spells + else + return usedSpellPower; //use creature spell power + } + else + return caster->getPrimSkillLevel(PrimarySkill::SPELL_POWER) + caster->valOfBonuses(Bonus::SPELL_DURATION); } }