mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-19 13:28:25 +00:00
Merge remote-tracking branch 'upstream/master' into spa395fix2
This commit is contained in:
+93
-61
@@ -63,6 +63,11 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
if (spell.disallow_sit && IsBuffSpell(spell_id) && IsClient() && (CastToClient()->IsSitting() || CastToClient()->GetHorseId() != 0))
|
||||
return false;
|
||||
|
||||
bool CanMemoryBlurFromMez = true;
|
||||
if (IsMezzed()) { //Check for special memory blur behavior when on mez, this needs to be before buff override.
|
||||
CanMemoryBlurFromMez = false;
|
||||
}
|
||||
|
||||
bool c_override = false;
|
||||
if (caster && caster->IsClient() && GetCastedSpellInvSlot() > 0) {
|
||||
const EQ::ItemInstance *inst = caster->CastToClient()->GetInv().GetItem(GetCastedSpellInvSlot());
|
||||
@@ -343,31 +348,13 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
#ifdef SPELL_EFFECT_SPAM
|
||||
snprintf(effect_desc, _EDLEN, "Complete Heal");
|
||||
#endif
|
||||
//make sure they are not allready affected by this...
|
||||
//I think that is the point of making this a buff.
|
||||
//this is in the wrong spot, it should be in the immune
|
||||
//section so the buff timer does not get refreshed!
|
||||
|
||||
int i;
|
||||
bool inuse = false;
|
||||
int buff_count = GetMaxTotalSlots();
|
||||
for(i = 0; i < buff_count; i++) {
|
||||
if(buffs[i].spellid == spell_id && i != buffslot) {
|
||||
Message(0, "You must wait before you can be affected by this spell again.");
|
||||
inuse = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(inuse)
|
||||
break;
|
||||
|
||||
int32 val = 0;
|
||||
val = 7500 * effect_value;
|
||||
if (caster)
|
||||
int val = 7500 * effect_value;
|
||||
if (caster) {
|
||||
val = caster->GetActSpellHealing(spell_id, val, this);
|
||||
|
||||
if (val > 0)
|
||||
}
|
||||
if (val > 0) {
|
||||
HealDamage(val, caster);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -387,7 +374,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
caster->SetMana(caster->GetMana() + std::abs(effect_value));
|
||||
|
||||
if (effect_value < 0)
|
||||
TryTriggerOnValueAmount(false, true);
|
||||
TryTriggerOnCastRequirement();
|
||||
#ifdef SPELL_EFFECT_SPAM
|
||||
if (caster)
|
||||
caster->Message(Chat::White, "You have gained %+i mana!", effect_value);
|
||||
@@ -403,7 +390,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
|
||||
SetMana(GetMana() + effect_value);
|
||||
if (effect_value < 0)
|
||||
TryTriggerOnValueAmount(false, true);
|
||||
TryTriggerOnCastRequirement();
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -600,7 +587,6 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
snprintf(effect_desc, _EDLEN, "Invisibility to Animals");
|
||||
#endif
|
||||
invisible_animals = true;
|
||||
SetInvisible(0);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -611,7 +597,6 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
snprintf(effect_desc, _EDLEN, "Invisibility to Undead");
|
||||
#endif
|
||||
invisible_undead = true;
|
||||
SetInvisible(0);
|
||||
break;
|
||||
}
|
||||
case SE_SeeInvis:
|
||||
@@ -1136,13 +1121,23 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
|
||||
case SE_Purify:
|
||||
{
|
||||
//Attempt to remove all Deterimental buffs.
|
||||
int buff_count = GetMaxTotalSlots();
|
||||
for(int slot = 0; slot < buff_count; slot++) {
|
||||
if (buffs[slot].spellid != SPELL_UNKNOWN &&
|
||||
IsDetrimentalSpell(buffs[slot].spellid) && spells[buffs[slot].spellid].dispel_flag == 0)
|
||||
{
|
||||
if (caster && TryDispel(caster->GetLevel(),buffs[slot].casterlevel, effect_value)){
|
||||
//Attempt to remove up to base amount of detrimental effects (excluding charm, fear, resurrection, and revival sickness).
|
||||
int purify_count = spells[spell_id].base[i];
|
||||
if (purify_count > GetMaxTotalSlots()) {
|
||||
purify_count = GetMaxTotalSlots();
|
||||
}
|
||||
|
||||
for(int slot = 0; slot < purify_count; slot++) {
|
||||
if (IsValidSpell(buffs[slot].spellid) && IsDetrimentalSpell(buffs[slot].spellid)){
|
||||
|
||||
if (!IsEffectInSpell(buffs[slot].spellid, SE_Charm) &&
|
||||
!IsEffectInSpell(buffs[slot].spellid, SE_Fear) &&
|
||||
buffs[slot].spellid != SPELL_RESURRECTION_SICKNESS &&
|
||||
buffs[slot].spellid != SPELL_RESURRECTION_SICKNESS2 &&
|
||||
buffs[slot].spellid != SPELL_RESURRECTION_SICKNESS3 &&
|
||||
buffs[slot].spellid != SPELL_RESURRECTION_SICKNESS4 &&
|
||||
buffs[slot].spellid != SPELL_REVIVAL_SICKNESS)
|
||||
{
|
||||
BuffFadeBySlot(slot);
|
||||
}
|
||||
}
|
||||
@@ -1531,16 +1526,16 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
#ifdef SPELL_EFFECT_SPAM
|
||||
snprintf(effect_desc, _EDLEN, "Memory Blur: %d", effect_value);
|
||||
#endif
|
||||
int wipechance = spells[spell_id].base[i];
|
||||
int bonus = 0;
|
||||
|
||||
if (caster){
|
||||
bonus = caster->spellbonuses.IncreaseChanceMemwipe +
|
||||
caster->itembonuses.IncreaseChanceMemwipe +
|
||||
caster->aabonuses.IncreaseChanceMemwipe;
|
||||
//Memory blur component of Mez spells is not checked again if Mez is recast on a target that is already mezed
|
||||
if (!CanMemoryBlurFromMez && IsEffectInSpell(spell_id, SE_Mez)) {
|
||||
break;
|
||||
}
|
||||
|
||||
int wipechance = 0;
|
||||
|
||||
if (caster) {
|
||||
wipechance = caster->GetMemoryBlurChance(effect_value);
|
||||
}
|
||||
|
||||
wipechance += wipechance*bonus/100;
|
||||
|
||||
if(zone->random.Roll(wipechance))
|
||||
{
|
||||
@@ -2458,8 +2453,9 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
#endif
|
||||
if(IsClient()) {
|
||||
CastToClient()->SetEndurance(CastToClient()->GetEndurance() + effect_value);
|
||||
if (effect_value < 0)
|
||||
TryTriggerOnValueAmount(false, false, true);
|
||||
if (effect_value < 0) {
|
||||
TryTriggerOnCastRequirement();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -2470,10 +2466,11 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
snprintf(effect_desc, _EDLEN, "Current Endurance Once: %+i", effect_value);
|
||||
#endif
|
||||
|
||||
if(IsClient()) {
|
||||
if (IsClient()) {
|
||||
CastToClient()->SetEndurance(CastToClient()->GetEndurance() + effect_value);
|
||||
if (effect_value < 0)
|
||||
TryTriggerOnValueAmount(false, false, true);
|
||||
if (effect_value < 0) {
|
||||
TryTriggerOnCastRequirement();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -2652,7 +2649,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
int32 mana_to_use = GetMana() - spell.base[i];
|
||||
if(mana_to_use > -1) {
|
||||
SetMana(GetMana() - spell.base[i]);
|
||||
TryTriggerOnValueAmount(false, true);
|
||||
TryTriggerOnCastRequirement();
|
||||
// we take full dmg(-10 to make the damage the right sign)
|
||||
mana_damage = spell.base[i] / -10 * spell.base2[i];
|
||||
Damage(caster, mana_damage, spell_id, spell.skill, false, i, true);
|
||||
@@ -2672,7 +2669,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
int32 end_to_use = CastToClient()->GetEndurance() - spell.base[i];
|
||||
if(end_to_use > -1) {
|
||||
CastToClient()->SetEndurance(CastToClient()->GetEndurance() - spell.base[i]);
|
||||
TryTriggerOnValueAmount(false, false, true);
|
||||
TryTriggerOnCastRequirement();
|
||||
// we take full dmg(-10 to make the damage the right sign)
|
||||
end_damage = spell.base[i] / -10 * spell.base2[i];
|
||||
Damage(caster, end_damage, spell_id, spell.skill, false, i, true);
|
||||
@@ -2754,7 +2751,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
else {
|
||||
dmg = ratio*max_mana/10;
|
||||
caster->SetMana(caster->GetMana() - max_mana);
|
||||
TryTriggerOnValueAmount(false, true);
|
||||
TryTriggerOnCastRequirement();
|
||||
}
|
||||
|
||||
if(IsDetrimentalSpell(spell_id)) {
|
||||
@@ -3858,19 +3855,15 @@ void Mob::DoBuffTic(const Buffs_Struct &buff, int slot, Mob *caster)
|
||||
}
|
||||
|
||||
case SE_WipeHateList: {
|
||||
if (IsMezSpell(buff.spellid))
|
||||
if (IsMezSpell(buff.spellid)) {
|
||||
break;
|
||||
|
||||
int wipechance = spells[buff.spellid].base[i];
|
||||
int bonus = 0;
|
||||
|
||||
if (caster) {
|
||||
bonus = caster->spellbonuses.IncreaseChanceMemwipe +
|
||||
caster->itembonuses.IncreaseChanceMemwipe +
|
||||
caster->aabonuses.IncreaseChanceMemwipe;
|
||||
}
|
||||
|
||||
wipechance += wipechance * bonus / 100;
|
||||
int wipechance = 0;
|
||||
|
||||
if (caster) {
|
||||
wipechance = caster->GetMemoryBlurChance(effect_value);
|
||||
}
|
||||
|
||||
if (zone->random.Roll(wipechance)) {
|
||||
if (IsAIControlled()) {
|
||||
@@ -8528,3 +8521,42 @@ int Mob::GetFocusRandomEffectivenessValue(int focus_base, int focus_base2, bool
|
||||
|
||||
return zone->random.Int(focus_base, focus_base2);
|
||||
}
|
||||
|
||||
int Mob::GetMemoryBlurChance(int base_chance)
|
||||
{
|
||||
/*
|
||||
Memory Blur mechanic for SPA 62
|
||||
Chance formula is effect chance + charisma modifer + caster level modifier
|
||||
Effect chance is base value of spell
|
||||
Charisma modifier is CHA/10 = %, with MAX of 15% (thus 150 cha gives you max bonus)
|
||||
Caster level modifier. +100% if caster < level 17 which scales down to 25% at > 53. **
|
||||
(Yes the above gets worse as you level. Behavior was confirmed on live.)
|
||||
Memory blur is applied to mez on initial cast using same formula. However, recasting on a target that
|
||||
is already mezed will not give a chance to memory blur. The blur is not checked on buff ticks.
|
||||
|
||||
SPA 242 SE_IncreaseChanceMemwipe modifies the final chance after all bonuses are applied.
|
||||
This is also applied to memory blur from mez spells.
|
||||
|
||||
this = caster
|
||||
*/
|
||||
int cha_mod = int(GetCHA() / 10);
|
||||
cha_mod = std::min(cha_mod, 15);
|
||||
|
||||
int lvl_mod = 0;
|
||||
if (GetLevel() < 17) {
|
||||
lvl_mod = 100;
|
||||
}
|
||||
else if (GetLevel() > 53) {
|
||||
lvl_mod = 25;
|
||||
}
|
||||
else {
|
||||
lvl_mod = 100 + ((GetLevel() - 16)*-2);//Derived from above range of values.**
|
||||
}
|
||||
|
||||
int chance = cha_mod + lvl_mod + base_chance;
|
||||
|
||||
int chance_mod = spellbonuses.IncreaseChanceMemwipe + itembonuses.IncreaseChanceMemwipe + aabonuses.IncreaseChanceMemwipe;
|
||||
|
||||
chance += chance * chance_mod / 100;
|
||||
return chance;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user