From 7133357b1a92dfc9d185e0b8df81035be49d6d01 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Sun, 2 Mar 2014 03:46:51 -0500 Subject: [PATCH] Revisions to how charm works. Optional SQL for rules --- changelog.txt | 7 +++++++ common/ruletypes.h | 2 ++ .../git/optional/2013_03_02_CharmRules.sql | 2 ++ zone/aggro.cpp | 15 +++++++++++++-- zone/spells.cpp | 19 ++++++++++++++----- 5 files changed, 38 insertions(+), 7 deletions(-) create mode 100644 utils/sql/git/optional/2013_03_02_CharmRules.sql diff --git a/changelog.txt b/changelog.txt index 56afea293..3a1ebb0bd 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,12 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 03/02/2014 == +Kayen: Revision to charm code to be consistent with live based on extensive personal parsing. +*Charisma ONLY effects the initial resist check when charm is cast with 10 CHA = -1 Resist mod up to 200 CHA +*Charisma DOES NOT extend charm durations. + +Optional SQL: utils/sql/git/optional/2014_03_02_CharmRules.sql + == 02/27/2014 == cavedude: Exported TrainDisc to Lua. diff --git a/common/ruletypes.h b/common/ruletypes.h index dcfeafbaf..614e12eb7 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -290,6 +290,8 @@ RULE_BOOL ( Spells, NPCIgnoreBaseImmunity, true) // Whether or not NPCs get to i RULE_REAL ( Spells, AvgSpellProcsPerMinute, 6.0) //Adjust rate for sympathetic spell procs RULE_INT ( Spells, ResistFalloff, 67) //Max that level that will adjust our resist chance based on level modifiers RULE_INT ( Spells, CharismaEffectiveness, 10) // Deterimes how much resist modification charisma applies to charm/pacify checks. Default 10 CHA = -1 resist mod. +RULE_INT ( Spells, CharismaEffectivenessCap, 200) // Deterimes how much resist modification charisma applies to charm/pacify checks. Default 10 CHA = -1 resist mod. +RULE_BOOL ( Spells, CharismaCharmDuration, false) // Allow CHA resist mod to extend charm duration. RULE_INT ( Spells, CharmBreakCheckChance, 25) //Determines chance for a charm break check to occur each buff tick. RULE_INT ( Spells, MaxCastTimeReduction, 50) //Max percent your spell cast time can be reduced by spell haste RULE_INT ( Spells, RootBreakFromSpells, 20) //Chance for root to break when cast on. diff --git a/utils/sql/git/optional/2013_03_02_CharmRules.sql b/utils/sql/git/optional/2013_03_02_CharmRules.sql new file mode 100644 index 000000000..9780f8594 --- /dev/null +++ b/utils/sql/git/optional/2013_03_02_CharmRules.sql @@ -0,0 +1,2 @@ +INSERT INTO `rule_values` (`ruleset_id`, `rule_name`, `rule_value`, `notes`) VALUES (1, 'Spells:CharismaCharmDuration', 'false', 'Allow CHA to extend charm duration.'); +INSERT INTO `rule_values` (`ruleset_id`, `rule_name`, `rule_value`, `notes`) VALUES (1, 'Spells:CharismaResistCap', '200', 'Maximium amount of CHA that will effect charm resist rate.'); \ No newline at end of file diff --git a/zone/aggro.cpp b/zone/aggro.cpp index d9c50a430..4e40e7e24 100644 --- a/zone/aggro.cpp +++ b/zone/aggro.cpp @@ -1388,13 +1388,24 @@ void Mob::ClearFeignMemory() { bool Mob::PassCharismaCheck(Mob* caster, Mob* spellTarget, uint16 spell_id) { + /* + Charm formula is correct based on over 50 hours of personal live parsing - Kayen + Charisma ONLY effects the initial resist check when charm is cast with 10 CHA = -1 Resist mod up to 200 CHA + Charisma DOES NOT extend charm durations. + Base effect value of charm spells in the spell file DOES NOT effect duration OR resist rate (unclear if does anything) + */ + if(!caster) return false; if(spells[spell_id].ResistDiff <= -600) return true; - //Applies additional Charisma bonus to resist rate - float resist_check = ResistSpell(spells[spell_id].resisttype, spell_id, caster,0,0,1); + float resist_check = 0; + + if (RuleB(Spells, CharismaCharmDuration)) + resist_check = ResistSpell(spells[spell_id].resisttype, spell_id, caster,0,0,true); + else + resist_check = ResistSpell(spells[spell_id].resisttype, spell_id, caster); if(IsCharmSpell(spell_id)) { diff --git a/zone/spells.cpp b/zone/spells.cpp index 855b292d5..e487f1f93 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -3417,7 +3417,11 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r // not all unresistable, so changing this to only check certain spells if(IsResistableSpell(spell_id)) { - spell_effectiveness = spelltar->ResistSpell(spells[spell_id].resisttype, spell_id, this, use_resist_adjust, resist_adjust); + if (IsCharmSpell(spell_id)) + spell_effectiveness = spelltar->ResistSpell(spells[spell_id].resisttype, spell_id, this, use_resist_adjust, resist_adjust,true); + else + spell_effectiveness = spelltar->ResistSpell(spells[spell_id].resisttype, spell_id, this, use_resist_adjust, resist_adjust); + if(spell_effectiveness < 100) { if(spell_effectiveness == 0 || !IsPartialCapableSpell(spell_id) ) @@ -4245,10 +4249,15 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use if (CharismaCheck) { - //For charm chance to break checks, Default 10 CHA = -1 resist mod. - int16 cha_resist_modifier = 0; - cha_resist_modifier = caster->GetCHA()/RuleI(Spells, CharismaEffectiveness); - resist_modifier -= cha_resist_modifier; + //Charisma ONLY effects the initial resist check when charm is cast with 10 CHA = -1 Resist mod up to 200 CHA + //Charisma DOES NOT extend charm durations. + int16 charisma = caster->GetCHA(); + + if (charisma > RuleI(Spells, CharismaEffectivenessCap)) + charisma = RuleI(Spells, CharismaEffectivenessCap); + + resist_modifier -= charisma/RuleI(Spells, CharismaEffectiveness); + Shout("Resist MOD = %i", resist_modifier); } //Add our level, resist and -spell resist modifier to our roll chance