From 55f5d4affa40c027b4afa97f2bc83cdba256a60c Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Thu, 6 Mar 2014 07:36:47 -0500 Subject: [PATCH] SE_Root and SE_RootBreakChance updates --- zone/attack.cpp | 41 ++++++++++++++++++++--------------------- zone/bonuses.cpp | 10 ++++++++++ zone/common.h | 4 +++- zone/mob.h | 1 - zone/spell_effects.cpp | 8 +++----- zone/spells.cpp | 1 + zone/zonedb.cpp | 1 + 7 files changed, 38 insertions(+), 28 deletions(-) diff --git a/zone/attack.cpp b/zone/attack.cpp index 594961c7c..a291a709b 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -4564,32 +4564,31 @@ bool Mob::TryRootFadeByDamage(int buffslot) chance to break root is increased. My guess is when this code was put in place, the devs at the time couldn't imagine DOT damage getting that high. */ + + /* General Mechanics + - Check buffslot to make sure damage from a root does not cancel the root + - If multiple roots on target, always and only checks first root slot and if broken only removes that slots root. + - Only roots on determental spells can be broken by damage. + */ - int BreakChance = RuleI(Spells, RootBreakFromSpells); + if (!spellbonuses.Root[0] || spellbonuses.Root[1] < 0) + return false; + + if (IsDetrimentalSpell(spellbonuses.Root[1]) && spellbonuses.Root[1] != buffslot){ - BreakChance -= BreakChance*rooted_mod/100; + int BreakChance = RuleI(Spells, RootBreakFromSpells); + + BreakChance -= BreakChance*buffs[spellbonuses.Root[1]].RootBreakChance/100; - if (BreakChance < 1) - BreakChance = 1; + if (BreakChance < 1) + BreakChance = 1; - if (MakeRandomInt(0, 99) < BreakChance) { + if (MakeRandomInt(0, 99) < BreakChance) { - /* - - Check buffslot to make sure damage from a root does not cancel the root - - If multiple roots on target, always and only checks first root slot and if broken only removes that slots root. - - Only roots on determental spells can be broken by damage. - */ - - uint32 buff_count = GetMaxTotalSlots(); - for(int i = 0; i < buff_count; i++) - { - if(IsValidSpell(buffs[i].spellid) && - (IsEffectInSpell(buffs[i].spellid, SE_Root) && IsDetrimentalSpell(buffs[i].spellid) && i != buffslot)){ - if (!TryFadeEffect(i)) { - BuffFadeBySlot(i); - mlog(COMBAT__HITS, "Spell broke root! BreakChance percent chance"); - return true; - } + if (!TryFadeEffect(spellbonuses.Root[1])) { + BuffFadeBySlot(spellbonuses.Root[1]); + mlog(COMBAT__HITS, "Spell broke root! BreakChance percent chance"); + return true; } } } diff --git a/zone/bonuses.cpp b/zone/bonuses.cpp index 7cde92ae4..45fa20e8b 100644 --- a/zone/bonuses.cpp +++ b/zone/bonuses.cpp @@ -2533,6 +2533,16 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne newbon->FrenziedDevastation += spells[spell_id].base2[i]; break; + case SE_Root: + if (newbon->Root[0] && (newbon->Root[1] > buffslot)){ + newbon->Root[0] = 1; + newbon->Root[1] = buffslot; + } + else { + newbon->Root[0] = 1; + newbon->Root[1] = buffslot; + } + break; } } } diff --git a/zone/common.h b/zone/common.h index eac6b0940..bd744316f 100644 --- a/zone/common.h +++ b/zone/common.h @@ -162,7 +162,8 @@ struct Buffs_Struct { int32 caston_x; int32 caston_y; int32 caston_z; - int32 ExtraDIChance; + int32 ExtraDIChance; + int16 RootBreakChance; //Not saved to dbase bool persistant_buff; bool client; //True if the caster is a client bool UpdateClient; @@ -339,6 +340,7 @@ struct StatBonuses { bool DivineAura; // invulnerability bool DistanceRemoval; // Check if Cancle if Moved effect is present int16 ImprovedTaunt[3]; // 0 = Max Level 1 = Aggro modifier 2 = buffid + int8 Root[2]; // The lowest buff slot a root can be found. [0] = Bool if has root [1] = buff slot int16 FrenziedDevastation; // base1= AArank(used) base2= chance increase spell criticals + all DD spells 2x mana. //bool AbsorbMagicAtt; // Magic Rune *Need to be implemented for NegateEffect //bool MeleeRune; // Melee Rune *Need to be implemented for NegateEffect diff --git a/zone/mob.h b/zone/mob.h index 6fad15013..a98c125c4 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -1085,7 +1085,6 @@ protected: bool inWater; // Set to true or false by Water Detection code if enabled by rules bool has_virus; // whether this mob has a viral spell on them uint16 viral_spells[MAX_SPELL_TRIGGER*2]; // Stores the spell ids of the viruses on target and caster ids - int16 rooted_mod; //Modifier to root break chance, defined when root is cast on a target. bool offhand; bool has_shieldequiped; bool has_numhits; diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index f01476779..bdf60a390 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -1631,12 +1631,11 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) snprintf(effect_desc, _EDLEN, "Root: %+i", effect_value); #endif rooted = true; - rooted_mod = 0; if (caster){ - rooted_mod = caster->aabonuses.RootBreakChance + - caster->itembonuses.RootBreakChance + - caster->spellbonuses.RootBreakChance; + buffs[buffslot].RootBreakChance = caster->aabonuses.RootBreakChance + + caster->itembonuses.RootBreakChance + + caster->spellbonuses.RootBreakChance; } break; @@ -3709,7 +3708,6 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses) case SE_Root: { rooted = false; - rooted_mod = 0; break; } diff --git a/zone/spells.cpp b/zone/spells.cpp index 965f96427..cef63351c 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -2951,6 +2951,7 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid buffs[emptyslot].caston_z = 0; buffs[emptyslot].dot_rune = 0; buffs[emptyslot].ExtraDIChance = 0; + buffs[emptyslot].RootBreakChance = 0; if (level_override > 0) { buffs[emptyslot].UpdateClient = true; diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 278f87eaf..9457a5f8d 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2654,6 +2654,7 @@ void ZoneDatabase::LoadBuffs(Client *c) { buffs[slot_id].caston_y = caston_y; buffs[slot_id].caston_z = caston_z; buffs[slot_id].ExtraDIChance = ExtraDIChance; + buffs[slot_id].RootBreakChance = 0; buffs[slot_id].UpdateClient = false; if(IsRuneSpell(spell_id)) { c->SetHasRune(true);