SE_Root and SE_RootBreakChance updates

This commit is contained in:
KayenEQ 2014-03-06 07:36:47 -05:00
parent d22c8832f7
commit 55f5d4affa
7 changed files with 38 additions and 28 deletions

View File

@ -4565,34 +4565,33 @@ bool Mob::TryRootFadeByDamage(int buffslot)
the time couldn't imagine DOT damage getting that high. 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.
*/
if (!spellbonuses.Root[0] || spellbonuses.Root[1] < 0)
return false;
if (IsDetrimentalSpell(spellbonuses.Root[1]) && spellbonuses.Root[1] != buffslot){
int BreakChance = RuleI(Spells, RootBreakFromSpells); int BreakChance = RuleI(Spells, RootBreakFromSpells);
BreakChance -= BreakChance*rooted_mod/100; BreakChance -= BreakChance*buffs[spellbonuses.Root[1]].RootBreakChance/100;
if (BreakChance < 1) if (BreakChance < 1)
BreakChance = 1; BreakChance = 1;
if (MakeRandomInt(0, 99) < BreakChance) { if (MakeRandomInt(0, 99) < BreakChance) {
/* if (!TryFadeEffect(spellbonuses.Root[1])) {
- Check buffslot to make sure damage from a root does not cancel the root BuffFadeBySlot(spellbonuses.Root[1]);
- 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"); mlog(COMBAT__HITS, "Spell broke root! BreakChance percent chance");
return true; return true;
} }
} }
} }
}
mlog(COMBAT__HITS, "Spell did not break root. BreakChance percent chance"); mlog(COMBAT__HITS, "Spell did not break root. BreakChance percent chance");
return false; return false;

View File

@ -2533,6 +2533,16 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne
newbon->FrenziedDevastation += spells[spell_id].base2[i]; newbon->FrenziedDevastation += spells[spell_id].base2[i];
break; 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;
} }
} }
} }

View File

@ -163,6 +163,7 @@ struct Buffs_Struct {
int32 caston_y; int32 caston_y;
int32 caston_z; int32 caston_z;
int32 ExtraDIChance; int32 ExtraDIChance;
int16 RootBreakChance; //Not saved to dbase
bool persistant_buff; bool persistant_buff;
bool client; //True if the caster is a client bool client; //True if the caster is a client
bool UpdateClient; bool UpdateClient;
@ -339,6 +340,7 @@ struct StatBonuses {
bool DivineAura; // invulnerability bool DivineAura; // invulnerability
bool DistanceRemoval; // Check if Cancle if Moved effect is present bool DistanceRemoval; // Check if Cancle if Moved effect is present
int16 ImprovedTaunt[3]; // 0 = Max Level 1 = Aggro modifier 2 = buffid 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. 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 AbsorbMagicAtt; // Magic Rune *Need to be implemented for NegateEffect
//bool MeleeRune; // Melee Rune *Need to be implemented for NegateEffect //bool MeleeRune; // Melee Rune *Need to be implemented for NegateEffect

View File

@ -1085,7 +1085,6 @@ protected:
bool inWater; // Set to true or false by Water Detection code if enabled by rules 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 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 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 offhand;
bool has_shieldequiped; bool has_shieldequiped;
bool has_numhits; bool has_numhits;

View File

@ -1631,10 +1631,9 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial)
snprintf(effect_desc, _EDLEN, "Root: %+i", effect_value); snprintf(effect_desc, _EDLEN, "Root: %+i", effect_value);
#endif #endif
rooted = true; rooted = true;
rooted_mod = 0;
if (caster){ if (caster){
rooted_mod = caster->aabonuses.RootBreakChance + buffs[buffslot].RootBreakChance = caster->aabonuses.RootBreakChance +
caster->itembonuses.RootBreakChance + caster->itembonuses.RootBreakChance +
caster->spellbonuses.RootBreakChance; caster->spellbonuses.RootBreakChance;
} }
@ -3709,7 +3708,6 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses)
case SE_Root: case SE_Root:
{ {
rooted = false; rooted = false;
rooted_mod = 0;
break; break;
} }

View File

@ -2951,6 +2951,7 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid
buffs[emptyslot].caston_z = 0; buffs[emptyslot].caston_z = 0;
buffs[emptyslot].dot_rune = 0; buffs[emptyslot].dot_rune = 0;
buffs[emptyslot].ExtraDIChance = 0; buffs[emptyslot].ExtraDIChance = 0;
buffs[emptyslot].RootBreakChance = 0;
if (level_override > 0) { if (level_override > 0) {
buffs[emptyslot].UpdateClient = true; buffs[emptyslot].UpdateClient = true;

View File

@ -2654,6 +2654,7 @@ void ZoneDatabase::LoadBuffs(Client *c) {
buffs[slot_id].caston_y = caston_y; buffs[slot_id].caston_y = caston_y;
buffs[slot_id].caston_z = caston_z; buffs[slot_id].caston_z = caston_z;
buffs[slot_id].ExtraDIChance = ExtraDIChance; buffs[slot_id].ExtraDIChance = ExtraDIChance;
buffs[slot_id].RootBreakChance = 0;
buffs[slot_id].UpdateClient = false; buffs[slot_id].UpdateClient = false;
if(IsRuneSpell(spell_id)) { if(IsRuneSpell(spell_id)) {
c->SetHasRune(true); c->SetHasRune(true);