Merge branch 'master' of github.com:EQEmu/Server

This commit is contained in:
KimLS 2015-03-24 16:37:25 -07:00
commit 9598ce45c9
5 changed files with 60 additions and 33 deletions

View File

@ -38,6 +38,7 @@
#define MAX_RESISTABLE_EFFECTS 12 // Number of effects that are typcially checked agianst resists.
#define MaxLimitInclude 16 //Number(x 0.5) of focus Limiters that have inclusive checks used when calcing focus effects
#define MAX_SKILL_PROCS 4 //Number of spells to check skill procs from. (This is arbitrary) [Single spell can have multiple proc checks]
#define MAX_SYMPATHETIC_PROCS 10 // Number of sympathetic procs a client can have (This is arbitrary)
const int Z_AGGRO=10;

View File

@ -1268,7 +1268,7 @@ protected:
bool client_data_loaded;
int16 GetFocusEffect(focusType type, uint16 spell_id);
int16 GetSympatheticFocusEffect(focusType type, uint16 spell_id);
uint16 GetSympatheticFocusEffect(focusType type, uint16 spell_id);
Mob* bind_sight_target;

View File

@ -3615,36 +3615,41 @@ bool Mob::TryFadeEffect(int slot)
void Mob::TrySympatheticProc(Mob *target, uint32 spell_id)
{
if(target == nullptr || !IsValidSpell(spell_id))
if(target == nullptr || !IsValidSpell(spell_id) || !IsClient())
return;
int focus_spell = CastToClient()->GetSympatheticFocusEffect(focusSympatheticProc,spell_id);
uint16 focus_spell = CastToClient()->GetSympatheticFocusEffect(focusSympatheticProc,spell_id);
if(IsValidSpell(focus_spell)){
int focus_trigger = spells[focus_spell].base2[0];
// For beneficial spells, if the triggered spell is also beneficial then proc it on the target
// if the triggered spell is detrimental, then it will trigger on the caster(ie cursed items)
if(IsBeneficialSpell(spell_id))
{
if(IsBeneficialSpell(focus_trigger))
SpellFinished(focus_trigger, target);
if(!IsValidSpell(focus_spell))
return;
else
SpellFinished(focus_trigger, this, 10, 0, -1, spells[focus_trigger].ResistDiff);
}
// For detrimental spells, if the triggered spell is beneficial, then it will land on the caster
// if the triggered spell is also detrimental, then it will land on the target
else
{
if(IsBeneficialSpell(focus_trigger))
SpellFinished(focus_trigger, this);
uint16 focus_trigger = GetSympatheticSpellProcID(focus_spell);
else
SpellFinished(focus_trigger, target, 10, 0, -1, spells[focus_trigger].ResistDiff);
}
if(!IsValidSpell(focus_trigger))
return;
CheckNumHitsRemaining(NumHit::MatchingSpells, -1, focus_spell);
}
// For beneficial spells, if the triggered spell is also beneficial then proc it on the target
// if the triggered spell is detrimental, then it will trigger on the caster(ie cursed items)
if(IsBeneficialSpell(spell_id))
{
if(IsBeneficialSpell(focus_trigger))
SpellFinished(focus_trigger, target);
else
SpellFinished(focus_trigger, this, 10, 0, -1, spells[focus_trigger].ResistDiff);
}
// For detrimental spells, if the triggered spell is beneficial, then it will land on the caster
// if the triggered spell is also detrimental, then it will land on the target
else
{
if(IsBeneficialSpell(focus_trigger))
SpellFinished(focus_trigger, this);
else
SpellFinished(focus_trigger, target, 10, 0, -1, spells[focus_trigger].ResistDiff);
}
CheckNumHitsRemaining(NumHit::MatchingSpells, -1, focus_spell);
}
int32 Mob::GetItemStat(uint32 itemid, const char *identifier)

View File

@ -1063,6 +1063,8 @@ protected:
void PrintRoute();
virtual float GetSympatheticProcChances(uint16 spell_id, int16 ProcRateMod, int32 ItemProcRate = 0);
int16 GetSympatheticSpellProcRate(uint16 spell_id);
uint16 GetSympatheticSpellProcID(uint16 spell_id);
enum {MAX_PROCS = 4};
tProc PermaProcs[MAX_PROCS];

View File

@ -5177,13 +5177,12 @@ int16 Mob::CalcFocusEffect(focusType type, uint16 focus_id, uint16 spell_id, boo
return(value*lvlModifier/100);
}
int16 Client::GetSympatheticFocusEffect(focusType type, uint16 spell_id) {
uint16 Client::GetSympatheticFocusEffect(focusType type, uint16 spell_id) {
if (IsBardSong(spell_id))
return 0;
uint16 proc_spellid = 0;
uint8 MAX_SYMPATHETIC = 10;
float ProcChance = 0.0f;
std::vector<int> SympatheticProcList;
@ -5195,7 +5194,7 @@ int16 Client::GetSympatheticFocusEffect(focusType type, uint16 spell_id) {
for(int x = EmuConstants::EQUIPMENT_BEGIN; x <= EmuConstants::EQUIPMENT_END; x++)
{
if (SympatheticProcList.size() > MAX_SYMPATHETIC)
if (SympatheticProcList.size() > MAX_SYMPATHETIC_PROCS)
continue;
TempItem = nullptr;
@ -5215,7 +5214,7 @@ int16 Client::GetSympatheticFocusEffect(focusType type, uint16 spell_id) {
for (int y = AUG_BEGIN; y < EmuConstants::ITEM_COMMON_SIZE; ++y)
{
if (SympatheticProcList.size() > MAX_SYMPATHETIC)
if (SympatheticProcList.size() > MAX_SYMPATHETIC_PROCS)
continue;
ItemInst *aug = nullptr;
@ -5243,18 +5242,18 @@ int16 Client::GetSympatheticFocusEffect(focusType type, uint16 spell_id) {
int buff_max = GetMaxTotalSlots();
for (buff_slot = 0; buff_slot < buff_max; buff_slot++) {
if (SympatheticProcList.size() > MAX_SYMPATHETIC)
if (SympatheticProcList.size() > MAX_SYMPATHETIC_PROCS)
continue;
focusspellid = buffs[buff_slot].spellid;
if (IsValidSpell(focusspellid))
if (!IsValidSpell(focusspellid))
continue;
proc_spellid = CalcFocusEffect(type, focusspellid, spell_id);
if (IsValidSpell(proc_spellid)){
ProcChance = GetSympatheticProcChances(spell_id, spells[focusspellid].base[0]);
ProcChance = GetSympatheticProcChances(spell_id, GetSympatheticSpellProcRate(spell_id));
if(zone->random.Roll(ProcChance))
SympatheticProcList.push_back(proc_spellid);
}
@ -5275,7 +5274,7 @@ int16 Client::GetSympatheticFocusEffect(focusType type, uint16 spell_id) {
if (aa_AA < 1 || aa_value < 1)
continue;
if (SympatheticProcList.size() > MAX_SYMPATHETIC)
if (SympatheticProcList.size() > MAX_SYMPATHETIC_PROCS)
continue;
proc_spellid = CalcAAFocus(type, aa_AA, spell_id);
@ -5930,6 +5929,26 @@ float Mob::GetSympatheticProcChances(uint16 spell_id, int16 ProcRateMod, int32 I
return ProcChance;
}
int16 Mob::GetSympatheticSpellProcRate(uint16 spell_id)
{
for (int i = 0; i < EFFECT_COUNT; i++){
if (spells[spell_id].effectid[i] == SE_SympatheticProc)
return spells[spell_id].base[i];
}
return 0;
}
uint16 Mob::GetSympatheticSpellProcID(uint16 spell_id)
{
for (int i = 0; i < EFFECT_COUNT; i++){
if (spells[spell_id].effectid[i] == SE_SympatheticProc)
return spells[spell_id].base2[i];
}
return 0;
}
bool Mob::DoHPToManaCovert(uint16 mana_cost)
{
if (spellbonuses.HPToManaConvert){