mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-15 08:21:28 +00:00
Merge pull request #251 from KayenEQ/Development
Fix for calculation for SE_ManaAbsorbPercentDamage
This commit is contained in:
commit
e5a0cc9ef7
@ -4,6 +4,11 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50)
|
|||||||
Uleat: Re-ordered server opcodes and handlers to give them some predictability of location (I need this for the inventory re-enumeration.)
|
Uleat: Re-ordered server opcodes and handlers to give them some predictability of location (I need this for the inventory re-enumeration.)
|
||||||
demonstar55: Added helper function bool EQEmu::IsTradeskill(uint32 skill)
|
demonstar55: Added helper function bool EQEmu::IsTradeskill(uint32 skill)
|
||||||
|
|
||||||
|
== 09/23/2014 ==
|
||||||
|
Kayen: Spell recourse effects will now be applied AFTER the base spells effects have been applied (consistent with live).
|
||||||
|
Kayen: SE_ApplySpell and SE_TriggerSpell will now be applied based on which effect slot they are used in (instead of always before all spell effects are checked).
|
||||||
|
Note: If a spell has multiple SE_TriggerSpell effects within it. Only one will be able to trigger. (If you want multiple spells use SE_ApplySpell)
|
||||||
|
|
||||||
== 09/22/2014 ==
|
== 09/22/2014 ==
|
||||||
Akkadius: #resetaa now covers the function of #resetaa and #refundaa
|
Akkadius: #resetaa now covers the function of #resetaa and #refundaa
|
||||||
- #resetaa will wipe all AA data, refund the spent points into the available points and send character to character select properly
|
- #resetaa will wipe all AA data, refund the spent points into the available points and send character to character select properly
|
||||||
|
|||||||
@ -3331,10 +3331,13 @@ int32 Mob::ReduceAllDamage(int32 damage)
|
|||||||
if(damage <= 0)
|
if(damage <= 0)
|
||||||
return damage;
|
return damage;
|
||||||
|
|
||||||
if(spellbonuses.ManaAbsorbPercentDamage[0] && (GetMana() > damage * spellbonuses.ManaAbsorbPercentDamage[0] / 100)) {
|
if(spellbonuses.ManaAbsorbPercentDamage[0]) {
|
||||||
damage -= (damage * spellbonuses.ManaAbsorbPercentDamage[0] / 100);
|
int32 mana_reduced = damage * spellbonuses.ManaAbsorbPercentDamage[0] / 100;
|
||||||
SetMana(GetMana() - damage);
|
if (GetMana() >= mana_reduced){
|
||||||
TryTriggerOnValueAmount(false, true);
|
damage -= mana_reduced;
|
||||||
|
SetMana(GetMana() - mana_reduced);
|
||||||
|
TryTriggerOnValueAmount(false, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckNumHitsRemaining(NUMHIT_IncomingDamage);
|
CheckNumHitsRemaining(NUMHIT_IncomingDamage);
|
||||||
|
|||||||
47
zone/mob.cpp
47
zone/mob.cpp
@ -3031,12 +3031,11 @@ void Mob::TriggerOnCast(uint32 focus_spell, uint32 spell_id, bool aa_trigger)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mob::TrySpellTrigger(Mob *target, uint32 spell_id)
|
bool Mob::TrySpellTrigger(Mob *target, uint32 spell_id, int effect)
|
||||||
{
|
{
|
||||||
if(target == nullptr || !IsValidSpell(spell_id))
|
if(!target || !IsValidSpell(spell_id))
|
||||||
{
|
return false;
|
||||||
return;
|
|
||||||
}
|
|
||||||
int spell_trig = 0;
|
int spell_trig = 0;
|
||||||
// Count all the percentage chances to trigger for all effects
|
// Count all the percentage chances to trigger for all effects
|
||||||
for(int i = 0; i < EFFECT_COUNT; i++)
|
for(int i = 0; i < EFFECT_COUNT; i++)
|
||||||
@ -3055,8 +3054,10 @@ void Mob::TrySpellTrigger(Mob *target, uint32 spell_id)
|
|||||||
if(MakeRandomInt(0, trig_chance) <= spells[spell_id].base[i])
|
if(MakeRandomInt(0, trig_chance) <= spells[spell_id].base[i])
|
||||||
{
|
{
|
||||||
// If we trigger an effect then its over.
|
// If we trigger an effect then its over.
|
||||||
SpellFinished(spells[spell_id].base2[i], target, 10, 0, -1, spells[spell_id].ResistDiff);
|
if (IsValidSpell(spells[spell_id].base2[i])){
|
||||||
break;
|
SpellFinished(spells[spell_id].base2[i], target, 10, 0, -1, spells[spell_id].ResistDiff);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -3070,37 +3071,15 @@ void Mob::TrySpellTrigger(Mob *target, uint32 spell_id)
|
|||||||
// if the chances don't add to 100, then each effect gets a chance to fire, chance for no trigger as well.
|
// if the chances don't add to 100, then each effect gets a chance to fire, chance for no trigger as well.
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for(int i = 0; i < EFFECT_COUNT; i++)
|
if(MakeRandomInt(0, 100) <= spells[spell_id].base[effect])
|
||||||
{
|
{
|
||||||
if (spells[spell_id].effectid[i] == SE_SpellTrigger)
|
if (IsValidSpell(spells[spell_id].base2[effect])){
|
||||||
{
|
SpellFinished(spells[spell_id].base2[effect], target, 10, 0, -1, spells[spell_id].ResistDiff);
|
||||||
if(MakeRandomInt(0, 100) <= spells[spell_id].base[i])
|
return true; //Only trigger once of these per spell effect.
|
||||||
{
|
|
||||||
SpellFinished(spells[spell_id].base2[i], target, 10, 0, -1, spells[spell_id].ResistDiff);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Mob::TryApplyEffect(Mob *target, uint32 spell_id)
|
|
||||||
{
|
|
||||||
if(target == nullptr || !IsValidSpell(spell_id))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(int i = 0; i < EFFECT_COUNT; i++)
|
|
||||||
{
|
|
||||||
if (spells[spell_id].effectid[i] == SE_ApplyEffect)
|
|
||||||
{
|
|
||||||
if(MakeRandomInt(0, 100) <= spells[spell_id].base[i])
|
|
||||||
{
|
|
||||||
if(target)
|
|
||||||
SpellFinished(spells[spell_id].base2[i], target, 10, 0, -1, spells[spell_id].ResistDiff);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mob::TryTriggerOnValueAmount(bool IsHP, bool IsMana, bool IsEndur, bool IsPet)
|
void Mob::TryTriggerOnValueAmount(bool IsHP, bool IsMana, bool IsEndur, bool IsPet)
|
||||||
|
|||||||
@ -579,8 +579,7 @@ public:
|
|||||||
void DoBuffWearOffEffect(uint32 index);
|
void DoBuffWearOffEffect(uint32 index);
|
||||||
void TryTriggerOnCast(uint32 spell_id, bool aa_trigger);
|
void TryTriggerOnCast(uint32 spell_id, bool aa_trigger);
|
||||||
void TriggerOnCast(uint32 focus_spell, uint32 spell_id, bool aa_trigger);
|
void TriggerOnCast(uint32 focus_spell, uint32 spell_id, bool aa_trigger);
|
||||||
void TrySpellTrigger(Mob *target, uint32 spell_id);
|
bool TrySpellTrigger(Mob *target, uint32 spell_id, int effect);
|
||||||
void TryApplyEffect(Mob *target, uint32 spell_id);
|
|
||||||
void TryTriggerOnValueAmount(bool IsHP = false, bool IsMana = false, bool IsEndur = false, bool IsPet = false);
|
void TryTriggerOnValueAmount(bool IsHP = false, bool IsMana = false, bool IsEndur = false, bool IsPet = false);
|
||||||
void TryTwincast(Mob *caster, Mob *target, uint32 spell_id);
|
void TryTwincast(Mob *caster, Mob *target, uint32 spell_id);
|
||||||
void TrySympatheticProc(Mob *target, uint32 spell_id);
|
void TrySympatheticProc(Mob *target, uint32 spell_id);
|
||||||
|
|||||||
@ -188,6 +188,8 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial)
|
|||||||
|
|
||||||
if (!IsPowerDistModSpell(spell_id))
|
if (!IsPowerDistModSpell(spell_id))
|
||||||
SetSpellPowerDistanceMod(0);
|
SetSpellPowerDistanceMod(0);
|
||||||
|
|
||||||
|
bool SE_SpellTrigger_HasCast = false;
|
||||||
|
|
||||||
// iterate through the effects in the spell
|
// iterate through the effects in the spell
|
||||||
for (i = 0; i < EFFECT_COUNT; i++)
|
for (i = 0; i < EFFECT_COUNT; i++)
|
||||||
@ -2729,6 +2731,25 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial)
|
|||||||
Message(10, "The power of your next illusion spell will flow to your grouped target in your place.");
|
Message(10, "The power of your next illusion spell will flow to your grouped target in your place.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case SE_ApplyEffect: {
|
||||||
|
|
||||||
|
if (caster && IsValidSpell(spells[spell_id].base2[i])){
|
||||||
|
|
||||||
|
if(MakeRandomInt(0, 100) <= spells[spell_id].base[i])
|
||||||
|
caster->SpellFinished(spells[spell_id].base2[i], this, 10, 0, -1, spells[spell_id].ResistDiff);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case SE_SpellTrigger: {
|
||||||
|
|
||||||
|
if (!SE_SpellTrigger_HasCast) {
|
||||||
|
if (caster && caster->TrySpellTrigger(this, spell_id, i))
|
||||||
|
SE_SpellTrigger_HasCast = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// Handled Elsewhere
|
// Handled Elsewhere
|
||||||
case SE_ImmuneFleeing:
|
case SE_ImmuneFleeing:
|
||||||
@ -2839,8 +2860,6 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial)
|
|||||||
case SE_HealRate:
|
case SE_HealRate:
|
||||||
case SE_SkillDamageTaken:
|
case SE_SkillDamageTaken:
|
||||||
case SE_FcSpellVulnerability:
|
case SE_FcSpellVulnerability:
|
||||||
case SE_SpellTrigger:
|
|
||||||
case SE_ApplyEffect:
|
|
||||||
case SE_FcTwincast:
|
case SE_FcTwincast:
|
||||||
case SE_DelayDeath:
|
case SE_DelayDeath:
|
||||||
case SE_CastOnFadeEffect:
|
case SE_CastOnFadeEffect:
|
||||||
@ -6454,8 +6473,12 @@ void Mob::ResourceTap(int32 damage, uint16 spellid){
|
|||||||
if (spells[spellid].max[i] && (damage > spells[spellid].max[i]))
|
if (spells[spellid].max[i] && (damage > spells[spellid].max[i]))
|
||||||
damage = spells[spellid].max[i];
|
damage = spells[spellid].max[i];
|
||||||
|
|
||||||
if (spells[spellid].base2[i] == 0) //HP Tap
|
if (spells[spellid].base2[i] == 0){ //HP Tap
|
||||||
SetHP((GetHP()+ damage));
|
if (damage > 0)
|
||||||
|
HealDamage(damage);
|
||||||
|
else
|
||||||
|
Damage(this, -damage,0, SkillEvocation,false);
|
||||||
|
}
|
||||||
|
|
||||||
if (spells[spellid].base2[i] == 1) //Mana Tap
|
if (spells[spellid].base2[i] == 1) //Mana Tap
|
||||||
SetMana(GetMana() + damage);
|
SetMana(GetMana() + damage);
|
||||||
|
|||||||
103
zone/spells.cpp
103
zone/spells.cpp
@ -3606,108 +3606,9 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r
|
|||||||
spell_effectiveness = 100;
|
spell_effectiveness = 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recourse means there is a spell linked to that spell in that the recourse spell will
|
|
||||||
// be automatically casted on the casters group or the caster only depending on Targettype
|
|
||||||
// this is for things like dark empathy, shadow vortex
|
|
||||||
int recourse_spell=0;
|
|
||||||
recourse_spell = spells[spell_id].RecourseLink;
|
|
||||||
if(recourse_spell)
|
|
||||||
{
|
|
||||||
if(spells[recourse_spell].targettype == ST_Group || spells[recourse_spell].targettype == ST_GroupTeleport)
|
|
||||||
{
|
|
||||||
if(IsGrouped())
|
|
||||||
{
|
|
||||||
Group *g = entity_list.GetGroupByMob(this);
|
|
||||||
if(g)
|
|
||||||
g->CastGroupSpell(this, recourse_spell);
|
|
||||||
else{
|
|
||||||
SpellOnTarget(recourse_spell, this);
|
|
||||||
#ifdef GROUP_BUFF_PETS
|
|
||||||
if (GetPet())
|
|
||||||
SpellOnTarget(recourse_spell, GetPet());
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(IsRaidGrouped() && IsClient())
|
|
||||||
{
|
|
||||||
Raid *r = entity_list.GetRaidByClient(CastToClient());
|
|
||||||
uint32 gid = 0xFFFFFFFF;
|
|
||||||
if(r)
|
|
||||||
gid = r->GetGroup(GetName());
|
|
||||||
else
|
|
||||||
gid = 13; // Forces ungrouped spell casting
|
|
||||||
|
|
||||||
if(gid < 12)
|
|
||||||
{
|
|
||||||
r->CastGroupSpell(this, recourse_spell, gid);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
SpellOnTarget(recourse_spell, this);
|
|
||||||
#ifdef GROUP_BUFF_PETS
|
|
||||||
if (GetPet())
|
|
||||||
SpellOnTarget(recourse_spell, GetPet());
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(HasOwner())
|
|
||||||
{
|
|
||||||
if(GetOwner()->IsGrouped())
|
|
||||||
{
|
|
||||||
Group *g = entity_list.GetGroupByMob(GetOwner());
|
|
||||||
if(g)
|
|
||||||
g->CastGroupSpell(this, recourse_spell);
|
|
||||||
else{
|
|
||||||
SpellOnTarget(recourse_spell, GetOwner());
|
|
||||||
SpellOnTarget(recourse_spell, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(GetOwner()->IsRaidGrouped() && GetOwner()->IsClient())
|
|
||||||
{
|
|
||||||
Raid *r = entity_list.GetRaidByClient(GetOwner()->CastToClient());
|
|
||||||
uint32 gid = 0xFFFFFFFF;
|
|
||||||
if(r)
|
|
||||||
gid = r->GetGroup(GetOwner()->GetName());
|
|
||||||
else
|
|
||||||
gid = 13; // Forces ungrouped spell casting
|
|
||||||
|
|
||||||
if(gid < 12)
|
|
||||||
{
|
|
||||||
r->CastGroupSpell(this, recourse_spell, gid);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SpellOnTarget(recourse_spell, GetOwner());
|
|
||||||
SpellOnTarget(recourse_spell, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SpellOnTarget(recourse_spell, GetOwner());
|
|
||||||
SpellOnTarget(recourse_spell, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SpellOnTarget(recourse_spell, this);
|
|
||||||
#ifdef GROUP_BUFF_PETS
|
|
||||||
if (GetPet())
|
|
||||||
SpellOnTarget(recourse_spell, GetPet());
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SpellOnTarget(recourse_spell, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(spelltar->spellbonuses.SpellDamageShield && IsDetrimentalSpell(spell_id))
|
if(spelltar->spellbonuses.SpellDamageShield && IsDetrimentalSpell(spell_id))
|
||||||
spelltar->DamageShield(this, true);
|
spelltar->DamageShield(this, true);
|
||||||
|
|
||||||
TrySpellTrigger(spelltar, spell_id);
|
|
||||||
TryApplyEffect(spelltar, spell_id);
|
|
||||||
|
|
||||||
if (spelltar->IsAIControlled() && IsDetrimentalSpell(spell_id) && !IsHarmonySpell(spell_id)) {
|
if (spelltar->IsAIControlled() && IsDetrimentalSpell(spell_id) && !IsHarmonySpell(spell_id)) {
|
||||||
int32 aggro_amount = CheckAggroAmount(spell_id, isproc);
|
int32 aggro_amount = CheckAggroAmount(spell_id, isproc);
|
||||||
mlog(SPELLS__CASTING, "Spell %d cast on %s generated %d hate", spell_id, spelltar->GetName(), aggro_amount);
|
mlog(SPELLS__CASTING, "Spell %d cast on %s generated %d hate", spell_id, spelltar->GetName(), aggro_amount);
|
||||||
@ -3746,7 +3647,9 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IsValidSpell(spells[spell_id].RecourseLink))
|
||||||
|
SpellFinished(spells[spell_id].RecourseLink, this, 10, 0, -1, spells[spells[spell_id].RecourseLink].ResistDiff);
|
||||||
|
|
||||||
if (IsDetrimentalSpell(spell_id)) {
|
if (IsDetrimentalSpell(spell_id)) {
|
||||||
|
|
||||||
CheckNumHitsRemaining(NUMHIT_OutgoingSpells);
|
CheckNumHitsRemaining(NUMHIT_OutgoingSpells);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user