Merge pull request #512 from KayenEQ/Development

Removed unneccessary entitylist check from ApplySpellBonuses
This commit is contained in:
KayenEQ 2016-03-27 11:19:47 -04:00
commit 9f0a0a6d9f
4 changed files with 18 additions and 15 deletions

View File

@ -1543,14 +1543,10 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses *ne
{ {
int i, effect_value, base2, max, effectid; int i, effect_value, base2, max, effectid;
bool AdditiveWornBonus = false; bool AdditiveWornBonus = false;
Mob *caster = nullptr;
if(!IsAISpellEffect && !IsValidSpell(spell_id)) if(!IsAISpellEffect && !IsValidSpell(spell_id))
return; return;
if(casterId > 0)
caster = entity_list.GetMob(casterId);
for (i = 0; i < EFFECT_COUNT; i++) for (i = 0; i < EFFECT_COUNT; i++)
{ {
//Buffs/Item effects //Buffs/Item effects
@ -1577,7 +1573,7 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses *ne
AdditiveWornBonus = true; AdditiveWornBonus = true;
effectid = spells[spell_id].effectid[i]; effectid = spells[spell_id].effectid[i];
effect_value = CalcSpellEffectValue(spell_id, i, casterlevel, instrument_mod, caster, ticsremaining); effect_value = CalcSpellEffectValue(spell_id, i, casterlevel, instrument_mod, nullptr, ticsremaining, casterId);
base2 = spells[spell_id].base2[i]; base2 = spells[spell_id].base2[i];
max = spells[spell_id].max[i]; max = spells[spell_id].max[i];
} }

View File

@ -662,7 +662,7 @@ public:
bool TryReflectSpell(uint32 spell_id); bool TryReflectSpell(uint32 spell_id);
bool CanBlockSpell() const { return(spellbonuses.BlockNextSpell); } bool CanBlockSpell() const { return(spellbonuses.BlockNextSpell); }
bool DoHPToManaCovert(uint16 mana_cost = 0); bool DoHPToManaCovert(uint16 mana_cost = 0);
int32 ApplySpellEffectiveness(Mob* caster, int16 spell_id, int32 value, bool IsBard = false); int32 ApplySpellEffectiveness(int16 spell_id, int32 value, bool IsBard = false, uint16 caster_id=0);
int8 GetDecayEffectValue(uint16 spell_id, uint16 spelleffect); int8 GetDecayEffectValue(uint16 spell_id, uint16 spelleffect);
int32 GetExtraSpellAmt(uint16 spell_id, int32 extra_spell_amt, int32 base_spell_dmg); int32 GetExtraSpellAmt(uint16 spell_id, int32 extra_spell_amt, int32 base_spell_dmg);
void MeleeLifeTap(int32 damage); void MeleeLifeTap(int32 damage);
@ -898,7 +898,7 @@ public:
virtual int32 CheckHealAggroAmount(uint16 spell_id, Mob *target, uint32 heal_possible = 0); virtual int32 CheckHealAggroAmount(uint16 spell_id, Mob *target, uint32 heal_possible = 0);
uint32 GetInstrumentMod(uint16 spell_id) const; uint32 GetInstrumentMod(uint16 spell_id) const;
int CalcSpellEffectValue(uint16 spell_id, int effect_id, int caster_level = 1, uint32 instrument_mod = 10, Mob *caster = nullptr, int ticsremaining = 0); int CalcSpellEffectValue(uint16 spell_id, int effect_id, int caster_level = 1, uint32 instrument_mod = 10, Mob *caster = nullptr, int ticsremaining = 0,uint16 casterid=0);
int CalcSpellEffectValue_formula(int formula, int base, int max, int caster_level, uint16 spell_id, int ticsremaining = 0); int CalcSpellEffectValue_formula(int formula, int base, int max, int caster_level, uint16 spell_id, int ticsremaining = 0);
virtual int CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, int caster_level2, Mob* caster1 = nullptr, Mob* caster2 = nullptr, int buffslot = -1); virtual int CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, int caster_level2, Mob* caster1 = nullptr, Mob* caster2 = nullptr, int buffslot = -1);
uint32 GetCastedSpellInvSlot() const { return casting_spell_inventory_slot; } uint32 GetCastedSpellInvSlot() const { return casting_spell_inventory_slot; }
@ -956,7 +956,7 @@ public:
inline uint16 GetEmoteID() { return emoteid; } inline uint16 GetEmoteID() { return emoteid; }
bool HasSpellEffect(int effectid); bool HasSpellEffect(int effectid);
int mod_effect_value(int effect_value, uint16 spell_id, int effect_type, Mob* caster); int mod_effect_value(int effect_value, uint16 spell_id, int effect_type, Mob* caster, uint16 caster_id);
float mod_hit_chance(float chancetohit, SkillUseTypes skillinuse, Mob* attacker); float mod_hit_chance(float chancetohit, SkillUseTypes skillinuse, Mob* attacker);
float mod_riposte_chance(float ripostchance, Mob* attacker); float mod_riposte_chance(float ripostchance, Mob* attacker);
float mod_block_chance(float blockchance, Mob* attacker); float mod_block_chance(float blockchance, Mob* attacker);

View File

@ -108,7 +108,7 @@ int Client::mod_food_value(const Item_Struct *item, int change) { return(change)
int Client::mod_drink_value(const Item_Struct *item, int change) { return(change); } int Client::mod_drink_value(const Item_Struct *item, int change) { return(change); }
//effect_vallue - Spell effect value as calculated by default formulas. You will want to ignore effects that don't lend themselves to scaling - pet ID's, gate coords, etc. //effect_vallue - Spell effect value as calculated by default formulas. You will want to ignore effects that don't lend themselves to scaling - pet ID's, gate coords, etc.
int Mob::mod_effect_value(int effect_value, uint16 spell_id, int effect_type, Mob* caster) { return(effect_value); } int Mob::mod_effect_value(int effect_value, uint16 spell_id, int effect_type, Mob* caster, uint16 caster_id) { return(effect_value); }
//chancetohit - 0 to 100 percent - set over 1000 for a guaranteed hit //chancetohit - 0 to 100 percent - set over 1000 for a guaranteed hit
float Mob::mod_hit_chance(float chancetohit, SkillUseTypes skillinuse, Mob* attacker) { return(chancetohit); } float Mob::mod_hit_chance(float chancetohit, SkillUseTypes skillinuse, Mob* attacker) { return(chancetohit); }

View File

@ -1270,7 +1270,9 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
#ifdef SPELL_EFFECT_SPAM #ifdef SPELL_EFFECT_SPAM
snprintf(effect_desc, _EDLEN, "Melee Absorb Rune: %+i", effect_value); snprintf(effect_desc, _EDLEN, "Melee Absorb Rune: %+i", effect_value);
#endif #endif
effect_value = ApplySpellEffectiveness(caster, spell_id, effect_value); if (caster)
effect_value = caster->ApplySpellEffectiveness(spell_id, effect_value);
buffs[buffslot].melee_rune = effect_value; buffs[buffslot].melee_rune = effect_value;
break; break;
} }
@ -3020,7 +3022,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
} }
int Mob::CalcSpellEffectValue(uint16 spell_id, int effect_id, int caster_level, uint32 instrument_mod, Mob *caster, int Mob::CalcSpellEffectValue(uint16 spell_id, int effect_id, int caster_level, uint32 instrument_mod, Mob *caster,
int ticsremaining) int ticsremaining, uint16 caster_id)
{ {
int formula, base, max, effect_value; int formula, base, max, effect_value;
@ -3048,13 +3050,13 @@ int Mob::CalcSpellEffectValue(uint16 spell_id, int effect_id, int caster_level,
spells[spell_id].effectid[effect_id] != SE_ManaRegen_v2) { spells[spell_id].effectid[effect_id] != SE_ManaRegen_v2) {
int oval = effect_value; int oval = effect_value;
int mod = ApplySpellEffectiveness(caster, spell_id, instrument_mod, true); int mod = ApplySpellEffectiveness(spell_id, instrument_mod, true, caster_id);
effect_value = effect_value * mod / 10; effect_value = effect_value * mod / 10;
Log.Out(Logs::Detail, Logs::Spells, "Effect value %d altered with bard modifier of %d to yeild %d", Log.Out(Logs::Detail, Logs::Spells, "Effect value %d altered with bard modifier of %d to yeild %d",
oval, mod, effect_value); oval, mod, effect_value);
} }
effect_value = mod_effect_value(effect_value, spell_id, spells[spell_id].effectid[effect_id], caster); effect_value = mod_effect_value(effect_value, spell_id, spells[spell_id].effectid[effect_id], caster, caster_id);
return effect_value; return effect_value;
} }
@ -6043,16 +6045,21 @@ int32 Mob::GetFocusIncoming(focusType type, int effect, Mob *caster, uint32 spel
return value; return value;
} }
int32 Mob::ApplySpellEffectiveness(Mob* caster, int16 spell_id, int32 value, bool IsBard) { int32 Mob::ApplySpellEffectiveness(int16 spell_id, int32 value, bool IsBard, uint16 caster_id) {
// 9-17-12: This is likely causing crashes, disabled till can resolve. // 9-17-12: This is likely causing crashes, disabled till can resolve.
if (IsBard) if (IsBard)
return value; return value;
Mob* caster = this;
if (caster_id && caster_id != GetID())//Make sure we are checking the casters focus
caster = entity_list.GetMob(caster_id);
if (!caster) if (!caster)
return value; return value;
int16 focus = GetFocusEffect(focusFcBaseEffects, spell_id); int16 focus = caster->GetFocusEffect(focusFcBaseEffects, spell_id);
if (IsBard) if (IsBard)
value += focus; value += focus;