Some clean ups due thanks to clang's warnings

This commit is contained in:
Michael Cook (mackal) 2014-12-09 23:41:19 -05:00
parent 362bfc79d6
commit 4c9befee22
6 changed files with 94 additions and 118 deletions

View File

@ -291,7 +291,7 @@ Timer DecayTimer(20);
//bullshit checking, to see if this is really happening, GDB seems to think so... //bullshit checking, to see if this is really happening, GDB seems to think so...
if(stream_itr->second == nullptr) { if(stream_itr->second == nullptr) {
fprintf(stderr, "ERROR: nullptr Stream encountered in EQStreamFactory::WriterLoop for: %i", stream_itr->first.first, stream_itr->first.second); fprintf(stderr, "ERROR: nullptr Stream encountered in EQStreamFactory::WriterLoop for: %i:%i", stream_itr->first.first, stream_itr->first.second);
continue; continue;
} }

View File

@ -896,7 +896,7 @@ bool IsHealOverTimeSpell(uint16 spell_id)
bool IsCompleteHealSpell(uint16 spell_id) bool IsCompleteHealSpell(uint16 spell_id)
{ {
if (spell_id == 13 || IsEffectInSpell(spell_id, SE_CompleteHeal) || if (spell_id == 13 || IsEffectInSpell(spell_id, SE_CompleteHeal) ||
IsPercentalHealSpell(spell_id) && !IsGroupSpell(spell_id)) (IsPercentalHealSpell(spell_id) && !IsGroupSpell(spell_id)))
return true; return true;
return false; return false;

View File

@ -547,7 +547,7 @@ void ClientList::SendWhoAll(uint32 fromid,const char* to, int16 admin, Who_All_S
if(totalusers<=20 || admin>=100) if(totalusers<=20 || admin>=100)
totallength=totallength+strlen(countcle->name())+strlen(countcle->AccountName())+strlen(guild_mgr.GetGuildName(countcle->GuildID()))+5; totallength=totallength+strlen(countcle->name())+strlen(countcle->AccountName())+strlen(guild_mgr.GetGuildName(countcle->GuildID()))+5;
} }
else if((countcle->Anon()>0 && admin<=countcle->Admin()) || countcle->Anon()==0 && !countcle->GetGM()){ else if((countcle->Anon()>0 && admin<=countcle->Admin()) || (countcle->Anon()==0 && !countcle->GetGM())) {
totalusers++; totalusers++;
if(totalusers<=20 || admin>=100) if(totalusers<=20 || admin>=100)
totallength=totallength+strlen(countcle->name())+strlen(guild_mgr.GetGuildName(countcle->GuildID()))+5; totallength=totallength+strlen(countcle->name())+strlen(guild_mgr.GetGuildName(countcle->GuildID()))+5;

View File

@ -893,7 +893,7 @@ void Mob::WakeTheDead(uint16 spell_id, Mob *target, uint32 duration)
//turn on an AA effect //turn on an AA effect
//duration == 0 means no time limit, used for one-shot deals, etc.. //duration == 0 means no time limit, used for one-shot deals, etc..
void Client::EnableAAEffect(aaEffectType type, uint32 duration) { void Client::EnableAAEffect(aaEffectType type, uint32 duration) {
if(type > 32) if(type > _maxaaEffectType)
return; //for now, special logic needed. return; //for now, special logic needed.
m_epp.aa_effects |= 1 << (type-1); m_epp.aa_effects |= 1 << (type-1);
@ -905,7 +905,7 @@ void Client::EnableAAEffect(aaEffectType type, uint32 duration) {
} }
void Client::DisableAAEffect(aaEffectType type) { void Client::DisableAAEffect(aaEffectType type) {
if(type > 32) if(type > _maxaaEffectType)
return; //for now, special logic needed. return; //for now, special logic needed.
uint32 bit = 1 << (type-1); uint32 bit = 1 << (type-1);
if(m_epp.aa_effects & bit) { if(m_epp.aa_effects & bit) {
@ -919,7 +919,7 @@ By default an AA effect is a one shot deal, unless
a duration timer is set. a duration timer is set.
*/ */
bool Client::CheckAAEffect(aaEffectType type) { bool Client::CheckAAEffect(aaEffectType type) {
if(type > 32) if(type > _maxaaEffectType)
return(false); //for now, special logic needed. return(false); //for now, special logic needed.
if(m_epp.aa_effects & (1 << (type-1))) { //is effect enabled? if(m_epp.aa_effects & (1 << (type-1))) { //is effect enabled?
//has our timer expired? //has our timer expired?

View File

@ -51,7 +51,8 @@ typedef enum { //AA Effect IDs
aaEffectFrostArrows, aaEffectFrostArrows,
aaEffectWarcry, aaEffectWarcry,
aaEffectLeechTouch, aaEffectLeechTouch,
aaEffectProjectIllusion // unused - Handled via spell effect aaEffectProjectIllusion, // unused - Handled via spell effect
_maxaaEffectType = 32
} aaEffectType; } aaEffectType;

View File

@ -197,7 +197,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c
pvpmode = true; pvpmode = true;
if (chance_mod >= 10000) if (chance_mod >= 10000)
return true; return true;
float avoidanceBonus = 0; float avoidanceBonus = 0;
float hitBonus = 0; float hitBonus = 0;
@ -268,21 +268,21 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c
} }
//Avoidance Bonuses on defender decreases baseline hit chance by percent. //Avoidance Bonuses on defender decreases baseline hit chance by percent.
avoidanceBonus = defender->spellbonuses.AvoidMeleeChanceEffect + avoidanceBonus = defender->spellbonuses.AvoidMeleeChanceEffect +
defender->itembonuses.AvoidMeleeChanceEffect + defender->itembonuses.AvoidMeleeChanceEffect +
defender->aabonuses.AvoidMeleeChanceEffect + defender->aabonuses.AvoidMeleeChanceEffect +
(defender->itembonuses.AvoidMeleeChance / 10.0f); //Item Mod 'Avoidence' (defender->itembonuses.AvoidMeleeChance / 10.0f); //Item Mod 'Avoidence'
Mob *owner = nullptr; Mob *owner = nullptr;
if (defender->IsPet()) if (defender->IsPet())
owner = defender->GetOwner(); owner = defender->GetOwner();
else if ((defender->IsNPC() && defender->CastToNPC()->GetSwarmOwner())) else if ((defender->IsNPC() && defender->CastToNPC()->GetSwarmOwner()))
owner = entity_list.GetMobID(defender->CastToNPC()->GetSwarmOwner()); owner = entity_list.GetMobID(defender->CastToNPC()->GetSwarmOwner());
if (owner) if (owner)
avoidanceBonus += owner->aabonuses.PetAvoidance + owner->spellbonuses.PetAvoidance + owner->itembonuses.PetAvoidance; avoidanceBonus += owner->aabonuses.PetAvoidance + owner->spellbonuses.PetAvoidance + owner->itembonuses.PetAvoidance;
if(defender->IsNPC()) if(defender->IsNPC())
avoidanceBonus += (defender->CastToNPC()->GetAvoidanceRating() / 10.0f); //Modifier from database avoidanceBonus += (defender->CastToNPC()->GetAvoidanceRating() / 10.0f); //Modifier from database
//Hit Chance Bonuses on attacker increases baseline hit chance by percent. //Hit Chance Bonuses on attacker increases baseline hit chance by percent.
@ -293,7 +293,6 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c
attacker->spellbonuses.HitChanceEffect[HIGHEST_SKILL+1] + attacker->spellbonuses.HitChanceEffect[HIGHEST_SKILL+1] +
attacker->aabonuses.HitChanceEffect[HIGHEST_SKILL+1]; attacker->aabonuses.HitChanceEffect[HIGHEST_SKILL+1];
//Accuracy = Spell Effect , HitChance = 'Accuracy' from Item Effect //Accuracy = Spell Effect , HitChance = 'Accuracy' from Item Effect
//Only AA derived accuracy can be skill limited. ie (Precision of the Pathfinder, Dead Aim) //Only AA derived accuracy can be skill limited. ie (Precision of the Pathfinder, Dead Aim)
hitBonus += (attacker->itembonuses.Accuracy[HIGHEST_SKILL+1] + hitBonus += (attacker->itembonuses.Accuracy[HIGHEST_SKILL+1] +
@ -306,7 +305,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c
if(attacker->IsNPC()) if(attacker->IsNPC())
hitBonus += (attacker->CastToNPC()->GetAccuracyRating() / 10.0f); //Modifier from database hitBonus += (attacker->CastToNPC()->GetAccuracyRating() / 10.0f); //Modifier from database
if(skillinuse == SkillArchery) if(skillinuse == SkillArchery)
hitBonus -= hitBonus*RuleR(Combat, ArcheryHitPenalty); hitBonus -= hitBonus*RuleR(Combat, ArcheryHitPenalty);
@ -326,11 +325,10 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c
else if(chancetohit < RuleR(Combat,MinChancetoHit)) { else if(chancetohit < RuleR(Combat,MinChancetoHit)) {
chancetohit = RuleR(Combat,MinChancetoHit); chancetohit = RuleR(Combat,MinChancetoHit);
} }
//I dont know the best way to handle a garunteed hit discipline being used //I dont know the best way to handle a garunteed hit discipline being used
//agains a garunteed riposte (for example) discipline... for now, garunteed hit wins //agains a garunteed riposte (for example) discipline... for now, garunteed hit wins
#if EQDEBUG>=11 #if EQDEBUG>=11
LogFile->write(EQEMuLog::Debug, "3 FINAL calculated chance to hit is: %5.2f", chancetohit); LogFile->write(EQEMuLog::Debug, "3 FINAL calculated chance to hit is: %5.2f", chancetohit);
#endif #endif
@ -346,7 +344,6 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c
return(tohit_roll <= chancetohit); return(tohit_roll <= chancetohit);
} }
bool Mob::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) bool Mob::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte)
{ {
/* solar: called when a mob is attacked, does the checks to see if it's a hit /* solar: called when a mob is attacked, does the checks to see if it's a hit
@ -562,7 +559,7 @@ void Mob::MeleeMitigation(Mob *attacker, int32 &damage, int32 minhit, ExtraAttac
armor = (armor / RuleR(Combat, NPCACFactor)); armor = (armor / RuleR(Combat, NPCACFactor));
Mob *owner = nullptr; Mob *owner = nullptr;
if (IsPet()) if (IsPet())
owner = GetOwner(); owner = GetOwner();
else if ((CastToNPC()->GetSwarmOwner())) else if ((CastToNPC()->GetSwarmOwner()))
owner = entity_list.GetMobID(CastToNPC()->GetSwarmOwner()); owner = entity_list.GetMobID(CastToNPC()->GetSwarmOwner());
@ -1164,7 +1161,6 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b
if (GetFeigned()) if (GetFeigned())
return false; // Rogean: How can you attack while feigned? Moved up from Aggro Code. return false; // Rogean: How can you attack while feigned? Moved up from Aggro Code.
ItemInst* weapon; ItemInst* weapon;
if (Hand == MainSecondary){ // Kaiyodo - Pick weapon from the attacking hand if (Hand == MainSecondary){ // Kaiyodo - Pick weapon from the attacking hand
weapon = GetInv().GetItem(MainSecondary); weapon = GetInv().GetItem(MainSecondary);
@ -1225,7 +1221,6 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b
CheckIncreaseSkill(skillinuse, other, -15); CheckIncreaseSkill(skillinuse, other, -15);
CheckIncreaseSkill(SkillOffense, other, -15); CheckIncreaseSkill(SkillOffense, other, -15);
// *************************************************************** // ***************************************************************
// *** Calculate the damage bonus, if applicable, for this hit *** // *** Calculate the damage bonus, if applicable, for this hit ***
// *************************************************************** // ***************************************************************
@ -1419,7 +1414,7 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes att
if(dead) if(dead)
return false; //cant die more than once... return false; //cant die more than once...
if(!spell) if(!spell)
spell = SPELL_UNKNOWN; spell = SPELL_UNKNOWN;
char buffer[48] = { 0 }; char buffer[48] = { 0 };
@ -1444,7 +1439,7 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes att
#1: Send death packet to everyone #1: Send death packet to everyone
*/ */
uint8 killed_level = GetLevel(); uint8 killed_level = GetLevel();
SendLogoutPackets(); SendLogoutPackets();
/* Make self become corpse packet */ /* Make self become corpse packet */
@ -1522,7 +1517,6 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes att
hate_list.RemoveEnt(this); hate_list.RemoveEnt(this);
RemoveAutoXTargets(); RemoveAutoXTargets();
//remove ourself from all proximities //remove ourself from all proximities
ClearAllProximities(); ClearAllProximities();
@ -1598,7 +1592,7 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes att
else else
UnmemSpellAll(false); UnmemSpellAll(false);
if(RuleB(Character, LeaveCorpses) && GetLevel() >= RuleI(Character, DeathItemLossLevel) || RuleB(Character, LeaveNakedCorpses)) if((RuleB(Character, LeaveCorpses) && GetLevel() >= RuleI(Character, DeathItemLossLevel)) || RuleB(Character, LeaveNakedCorpses))
{ {
// creating the corpse takes the cash/items off the player too // creating the corpse takes the cash/items off the player too
Corpse *new_corpse = new Corpse(this, exploss); Corpse *new_corpse = new Corpse(this, exploss);
@ -1657,8 +1651,8 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes att
if(LeftCorpse && (GetClientVersionBit() & BIT_SoFAndLater) && RuleB(Character, RespawnFromHover)) if(LeftCorpse && (GetClientVersionBit() & BIT_SoFAndLater) && RuleB(Character, RespawnFromHover))
{ {
ClearDraggedCorpses(); ClearDraggedCorpses();
RespawnFromHoverTimer.Start(RuleI(Character, RespawnFromHoverTimer) * 1000); RespawnFromHoverTimer.Start(RuleI(Character, RespawnFromHoverTimer) * 1000);
SendRespawnBinds(); SendRespawnBinds();
} }
else else
@ -1675,19 +1669,19 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes att
if(r) if(r)
r->MemberZoned(this); r->MemberZoned(this);
dead_timer.Start(5000, true); dead_timer.Start(5000, true);
m_pp.zone_id = m_pp.binds[0].zoneId; m_pp.zone_id = m_pp.binds[0].zoneId;
m_pp.zoneInstance = m_pp.binds[0].instance_id; m_pp.zoneInstance = m_pp.binds[0].instance_id;
database.MoveCharacterToZone(this->CharacterID(), database.GetZoneName(m_pp.zone_id)); database.MoveCharacterToZone(this->CharacterID(), database.GetZoneName(m_pp.zone_id));
Save(); Save();
GoToDeath(); GoToDeath();
} }
/* QS: PlayerLogDeaths */ /* QS: PlayerLogDeaths */
if (RuleB(QueryServ, PlayerLogDeaths)){ if (RuleB(QueryServ, PlayerLogDeaths)){
const char * killer_name = ""; const char * killer_name = "";
if (killerMob && killerMob->GetCleanName()){ killer_name = killerMob->GetCleanName(); } if (killerMob && killerMob->GetCleanName()){ killer_name = killerMob->GetCleanName(); }
std::string event_desc = StringFormat("Died in zoneid:%i instid:%i by '%s', spellid:%i, damage:%i", this->GetZoneID(), this->GetInstanceID(), killer_name, spell, damage); std::string event_desc = StringFormat("Died in zoneid:%i instid:%i by '%s', spellid:%i, damage:%i", this->GetZoneID(), this->GetInstanceID(), killer_name, spell, damage);
QServ->PlayerLogEvent(Player_Log_Deaths, this->CharacterID(), event_desc); QServ->PlayerLogEvent(Player_Log_Deaths, this->CharacterID(), event_desc);
} }
@ -1836,7 +1830,6 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool
else else
damage = zone->random.Int((min_dmg+eleBane),(max_dmg+eleBane)); damage = zone->random.Int((min_dmg+eleBane),(max_dmg+eleBane));
//check if we're hitting above our max or below it. //check if we're hitting above our max or below it.
if((min_dmg+eleBane) != 0 && damage < (min_dmg+eleBane)) { if((min_dmg+eleBane) != 0 && damage < (min_dmg+eleBane)) {
mlog(COMBAT__DAMAGE, "Damage (%d) is below min (%d). Setting to min.", damage, (min_dmg+eleBane)); mlog(COMBAT__DAMAGE, "Damage (%d) is below min (%d). Setting to min.", damage, (min_dmg+eleBane));
@ -1846,7 +1839,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool
mlog(COMBAT__DAMAGE, "Damage (%d) is above max (%d). Setting to max.", damage, (max_dmg+eleBane)); mlog(COMBAT__DAMAGE, "Damage (%d) is above max (%d). Setting to max.", damage, (max_dmg+eleBane));
damage = (max_dmg+eleBane); damage = (max_dmg+eleBane);
} }
damage = mod_npc_damage(damage, skillinuse, Hand, weapon, other); damage = mod_npc_damage(damage, skillinuse, Hand, weapon, other);
int32 hate = damage; int32 hate = damage;
@ -1925,7 +1918,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool
return false; return false;
MeleeLifeTap(damage); MeleeLifeTap(damage);
CommonBreakInvisible(); CommonBreakInvisible();
//I doubt this works... //I doubt this works...
@ -1934,15 +1927,15 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool
if(!bRiposte && !other->HasDied()) { if(!bRiposte && !other->HasDied()) {
TryWeaponProc(nullptr, weapon, other, Hand); //no weapon TryWeaponProc(nullptr, weapon, other, Hand); //no weapon
if (!other->HasDied()) if (!other->HasDied())
TrySpellProc(nullptr, weapon, other, Hand); TrySpellProc(nullptr, weapon, other, Hand);
if (damage > 0 && HasSkillProcSuccess() && !other->HasDied()) if (damage > 0 && HasSkillProcSuccess() && !other->HasDied())
TrySkillProc(other, skillinuse, 0, true, Hand); TrySkillProc(other, skillinuse, 0, true, Hand);
} }
if(GetHP() > 0 && !other->HasDied()) if(GetHP() > 0 && !other->HasDied())
TriggerDefensiveProcs(nullptr, other, Hand, damage); TriggerDefensiveProcs(nullptr, other, Hand, damage);
// now check ripostes // now check ripostes
@ -2002,7 +1995,7 @@ void NPC::Damage(Mob* other, int32 damage, uint16 spell_id, SkillUseTypes attack
bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack_skill) { bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack_skill) {
mlog(COMBAT__HITS, "Fatal blow dealt by %s with %d damage, spell %d, skill %d", killerMob->GetName(), damage, spell, attack_skill); mlog(COMBAT__HITS, "Fatal blow dealt by %s with %d damage, spell %d, skill %d", killerMob->GetName(), damage, spell, attack_skill);
Mob *oos = nullptr; Mob *oos = nullptr;
if(killerMob) { if(killerMob) {
oos = killerMob->GetOwnerOrSelf(); oos = killerMob->GetOwnerOrSelf();
@ -2057,7 +2050,7 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack
if(p_depop == true) if(p_depop == true)
return false; return false;
HasAISpellEffects = false; HasAISpellEffects = false;
BuffFadeAll(); BuffFadeAll();
uint8 killed_level = GetLevel(); uint8 killed_level = GetLevel();
@ -2118,8 +2111,8 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack
Group *kg = entity_list.GetGroupByClient(give_exp_client); Group *kg = entity_list.GetGroupByClient(give_exp_client);
Raid *kr = entity_list.GetRaidByClient(give_exp_client); Raid *kr = entity_list.GetRaidByClient(give_exp_client);
int32 finalxp = EXP_FORMULA; int32 finalxp = EXP_FORMULA;
finalxp = give_exp_client->mod_client_xp(finalxp, this); finalxp = give_exp_client->mod_client_xp(finalxp, this);
if(kr) if(kr)
{ {
@ -2230,7 +2223,7 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack
parse->EventNPC(EVENT_KILLED_MERIT, this, give_exp_client, "killed", 0); parse->EventNPC(EVENT_KILLED_MERIT, this, give_exp_client, "killed", 0);
if(RuleB(NPC, EnableMeritBasedFaction)) if(RuleB(NPC, EnableMeritBasedFaction))
give_exp_client->SetFactionLevel(give_exp_client->CharacterID(), GetNPCFactionID(), give_exp_client->GetBaseClass(), give_exp_client->SetFactionLevel(give_exp_client->CharacterID(), GetNPCFactionID(), give_exp_client->GetBaseClass(),
give_exp_client->GetBaseRace(), give_exp_client->GetDeity()); give_exp_client->GetBaseRace(), give_exp_client->GetDeity());
mod_npc_killed_merit(give_exp_client); mod_npc_killed_merit(give_exp_client);
@ -2392,9 +2385,9 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack
} }
void Mob::AddToHateList(Mob* other, int32 hate, int32 damage, bool iYellForHelp, bool bFrenzy, bool iBuffTic) { void Mob::AddToHateList(Mob* other, int32 hate, int32 damage, bool iYellForHelp, bool bFrenzy, bool iBuffTic) {
assert(other != nullptr); assert(other != nullptr);
if (other == this) if (other == this)
return; return;
@ -2411,12 +2404,12 @@ void Mob::AddToHateList(Mob* other, int32 hate, int32 damage, bool iYellForHelp,
if(other){ if(other){
AddRampage(other); AddRampage(other);
int hatemod = 100 + other->spellbonuses.hatemod + other->itembonuses.hatemod + other->aabonuses.hatemod; int hatemod = 100 + other->spellbonuses.hatemod + other->itembonuses.hatemod + other->aabonuses.hatemod;
int32 shieldhatemod = other->spellbonuses.ShieldEquipHateMod + other->itembonuses.ShieldEquipHateMod + other->aabonuses.ShieldEquipHateMod; int32 shieldhatemod = other->spellbonuses.ShieldEquipHateMod + other->itembonuses.ShieldEquipHateMod + other->aabonuses.ShieldEquipHateMod;
if (shieldhatemod && other->HasShieldEquiped()) if (shieldhatemod && other->HasShieldEquiped())
hatemod += shieldhatemod; hatemod += shieldhatemod;
if(hatemod < 1) if(hatemod < 1)
hatemod = 1; hatemod = 1;
hate = ((hate * (hatemod))/100); hate = ((hate * (hatemod))/100);
@ -2433,7 +2426,7 @@ void Mob::AddToHateList(Mob* other, int32 hate, int32 damage, bool iYellForHelp,
if (other->IsNPC() && (other->IsPet() || other->CastToNPC()->GetSwarmOwner() > 0)) if (other->IsNPC() && (other->IsPet() || other->CastToNPC()->GetSwarmOwner() > 0))
TryTriggerOnValueAmount(false, false, false, true); TryTriggerOnValueAmount(false, false, false, true);
if(IsClient() && !IsAIControlled()) if(IsClient() && !IsAIControlled())
return; return;
@ -2475,9 +2468,9 @@ void Mob::AddToHateList(Mob* other, int32 hate, int32 damage, bool iYellForHelp,
if(damage > GetHP()) if(damage > GetHP())
damage = GetHP(); damage = GetHP();
if (spellbonuses.ImprovedTaunt[1] && (GetLevel() < spellbonuses.ImprovedTaunt[0]) if (spellbonuses.ImprovedTaunt[1] && (GetLevel() < spellbonuses.ImprovedTaunt[0])
&& other && (buffs[spellbonuses.ImprovedTaunt[2]].casterid != other->GetID())) && other && (buffs[spellbonuses.ImprovedTaunt[2]].casterid != other->GetID()))
hate = (hate*spellbonuses.ImprovedTaunt[1])/100; hate = (hate*spellbonuses.ImprovedTaunt[1])/100;
hate_list.Add(other, hate, damage, bFrenzy, !iBuffTic); hate_list.Add(other, hate, damage, bFrenzy, !iBuffTic);
@ -2497,7 +2490,6 @@ void Mob::AddToHateList(Mob* other, int32 hate, int32 damage, bool iYellForHelp,
} }
#endif //BOTS #endif //BOTS
// if other is a merc, add the merc client to the hate list // if other is a merc, add the merc client to the hate list
if(other->IsMerc()) { if(other->IsMerc()) {
if(other->CastToMerc()->GetMercOwner() && other->CastToMerc()->GetMercOwner()->CastToClient()->GetFeigned()) { if(other->CastToMerc()->GetMercOwner() && other->CastToMerc()->GetMercOwner()->CastToClient()->GetFeigned()) {
@ -2636,7 +2628,6 @@ uint8 Mob::GetWeaponDamageBonus( const Item_Struct *Weapon )
// This function calculates and returns the damage bonus for the weapon identified by the parameter "Weapon". // This function calculates and returns the damage bonus for the weapon identified by the parameter "Weapon".
// Modified 9/21/2008 by Cantus // Modified 9/21/2008 by Cantus
// Assert: This function should only be called for hits by the mainhand, as damage bonuses apply only to the // Assert: This function should only be called for hits by the mainhand, as damage bonuses apply only to the
// weapon in the primary slot. Be sure to check that Hand == MainPrimary before calling. // weapon in the primary slot. Be sure to check that Hand == MainPrimary before calling.
@ -2648,7 +2639,6 @@ uint8 Mob::GetWeaponDamageBonus( const Item_Struct *Weapon )
// Assert: This function should not be called unless the player is a melee class, as casters do not receive a damage bonus. // Assert: This function should not be called unless the player is a melee class, as casters do not receive a damage bonus.
if( Weapon == nullptr || Weapon->ItemType == ItemType1HSlash || Weapon->ItemType == ItemType1HBlunt || Weapon->ItemType == ItemTypeMartial || Weapon->ItemType == ItemType1HPiercing ) if( Weapon == nullptr || Weapon->ItemType == ItemType1HSlash || Weapon->ItemType == ItemType1HBlunt || Weapon->ItemType == ItemTypeMartial || Weapon->ItemType == ItemType1HPiercing )
{ {
// The weapon in the player's main (primary) hand is a one-handed weapon, or there is no item equipped at all. // The weapon in the player's main (primary) hand is a one-handed weapon, or there is no item equipped at all.
@ -2676,7 +2666,6 @@ uint8 Mob::GetWeaponDamageBonus( const Item_Struct *Weapon )
// as I suspect, then please feel free to delete the following line, and replace all occurences of "ucPlayerLevel" with "GetLevel()". // as I suspect, then please feel free to delete the following line, and replace all occurences of "ucPlayerLevel" with "GetLevel()".
uint8 ucPlayerLevel = (uint8) GetLevel(); uint8 ucPlayerLevel = (uint8) GetLevel();
// The following may look cleaner, and would certainly be easier to understand, if it was // The following may look cleaner, and would certainly be easier to understand, if it was
// a simple 53x150 cell matrix. // a simple 53x150 cell matrix.
// //
@ -2694,7 +2683,6 @@ uint8 Mob::GetWeaponDamageBonus( const Item_Struct *Weapon )
// lookup table. In cases where a formula is the best bet, I use a formula. In other places // lookup table. In cases where a formula is the best bet, I use a formula. In other places
// where a formula would be ugly, I use a lookup table in the interests of speed. // where a formula would be ugly, I use a lookup table in the interests of speed.
if( Weapon->Delay <= 27 ) if( Weapon->Delay <= 27 )
{ {
// Damage Bonuses for all 2H weapons with delays of 27 or less are identical. // Damage Bonuses for all 2H weapons with delays of 27 or less are identical.
@ -2706,7 +2694,6 @@ uint8 Mob::GetWeaponDamageBonus( const Item_Struct *Weapon )
return (ucPlayerLevel - 22) / 3; return (ucPlayerLevel - 22) / 3;
} }
if( ucPlayerLevel == 65 && Weapon->Delay <= 59 ) if( ucPlayerLevel == 65 && Weapon->Delay <= 59 )
{ {
// Consider these two facts: // Consider these two facts:
@ -2725,7 +2712,6 @@ uint8 Mob::GetWeaponDamageBonus( const Item_Struct *Weapon )
return ucLevel65DamageBonusesForDelays28to59[Weapon->Delay-28]; return ucLevel65DamageBonusesForDelays28to59[Weapon->Delay-28];
} }
if( ucPlayerLevel > 65 ) if( ucPlayerLevel > 65 )
{ {
if( ucPlayerLevel > 80 ) if( ucPlayerLevel > 80 )
@ -2864,7 +2850,6 @@ uint8 Mob::GetWeaponDamageBonus( const Item_Struct *Weapon )
} }
} }
// If we've gotten to this point in the function without hitting a return statement, // If we've gotten to this point in the function without hitting a return statement,
// we know that the character's level is between 28 and 65, and that the 2H weapon's // we know that the character's level is between 28 and 65, and that the 2H weapon's
// delay is 28 or higher. // delay is 28 or higher.
@ -3110,7 +3095,6 @@ int Mob::GetMonkHandToHandDelay(void)
} }
} }
int32 Mob::ReduceDamage(int32 damage) int32 Mob::ReduceDamage(int32 damage)
{ {
if(damage <= 0) if(damage <= 0)
@ -3123,7 +3107,7 @@ int32 Mob::ReduceDamage(int32 damage)
slot = spellbonuses.NegateAttacks[1]; slot = spellbonuses.NegateAttacks[1];
if(slot >= 0) { if(slot >= 0) {
if(--buffs[slot].numhits == 0) { if(--buffs[slot].numhits == 0) {
if(!TryFadeEffect(slot)) if(!TryFadeEffect(slot))
BuffFadeBySlot(slot , true); BuffFadeBySlot(slot , true);
} }
@ -3138,8 +3122,8 @@ int32 Mob::ReduceDamage(int32 damage)
//Only mitigate if damage is above the minimium specified. //Only mitigate if damage is above the minimium specified.
if (spellbonuses.MeleeThresholdGuard[0]){ if (spellbonuses.MeleeThresholdGuard[0]){
slot = spellbonuses.MeleeThresholdGuard[1]; slot = spellbonuses.MeleeThresholdGuard[1];
if (slot >= 0 && (damage > spellbonuses.MeleeThresholdGuard[2])) if (slot >= 0 && (damage > spellbonuses.MeleeThresholdGuard[2]))
{ {
DisableMeleeRune = true; DisableMeleeRune = true;
int damage_to_reduce = damage * spellbonuses.MeleeThresholdGuard[0] / 100; int damage_to_reduce = damage * spellbonuses.MeleeThresholdGuard[0] / 100;
@ -3161,7 +3145,6 @@ int32 Mob::ReduceDamage(int32 damage)
} }
} }
if (spellbonuses.MitigateMeleeRune[0] && !DisableMeleeRune){ if (spellbonuses.MitigateMeleeRune[0] && !DisableMeleeRune){
slot = spellbonuses.MitigateMeleeRune[1]; slot = spellbonuses.MitigateMeleeRune[1];
if(slot >= 0) if(slot >= 0)
@ -3170,7 +3153,7 @@ int32 Mob::ReduceDamage(int32 damage)
if (spellbonuses.MitigateMeleeRune[2] && (damage_to_reduce > spellbonuses.MitigateMeleeRune[2])) if (spellbonuses.MitigateMeleeRune[2] && (damage_to_reduce > spellbonuses.MitigateMeleeRune[2]))
damage_to_reduce = spellbonuses.MitigateMeleeRune[2]; damage_to_reduce = spellbonuses.MitigateMeleeRune[2];
if(spellbonuses.MitigateMeleeRune[3] && (damage_to_reduce >= buffs[slot].melee_rune)) if(spellbonuses.MitigateMeleeRune[3] && (damage_to_reduce >= buffs[slot].melee_rune))
{ {
mlog(SPELLS__EFFECT_VALUES, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" mlog(SPELLS__EFFECT_VALUES, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d"
@ -3183,10 +3166,10 @@ int32 Mob::ReduceDamage(int32 damage)
{ {
mlog(SPELLS__EFFECT_VALUES, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" mlog(SPELLS__EFFECT_VALUES, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d"
" damage remaining.", damage_to_reduce, buffs[slot].melee_rune); " damage remaining.", damage_to_reduce, buffs[slot].melee_rune);
if (spellbonuses.MitigateMeleeRune[3]) if (spellbonuses.MitigateMeleeRune[3])
buffs[slot].melee_rune = (buffs[slot].melee_rune - damage_to_reduce); buffs[slot].melee_rune = (buffs[slot].melee_rune - damage_to_reduce);
damage -= damage_to_reduce; damage -= damage_to_reduce;
} }
} }
@ -3217,7 +3200,7 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi
slot = spellbonuses.NegateAttacks[1]; slot = spellbonuses.NegateAttacks[1];
if(slot >= 0) { if(slot >= 0) {
if(--buffs[slot].numhits == 0) { if(--buffs[slot].numhits == 0) {
if(!TryFadeEffect(slot)) if(!TryFadeEffect(slot))
BuffFadeBySlot(slot , true); BuffFadeBySlot(slot , true);
} }
@ -3231,8 +3214,8 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi
// If this is a DoT, use DoT Shielding... // If this is a DoT, use DoT Shielding...
if(iBuffTic) { if(iBuffTic) {
damage -= (damage * itembonuses.DoTShielding / 100); damage -= (damage * itembonuses.DoTShielding / 100);
if (spellbonuses.MitigateDotRune[0]){ if (spellbonuses.MitigateDotRune[0]){
slot = spellbonuses.MitigateDotRune[1]; slot = spellbonuses.MitigateDotRune[1];
if(slot >= 0) if(slot >= 0)
@ -3252,7 +3235,7 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi
{ {
if (spellbonuses.MitigateDotRune[3]) if (spellbonuses.MitigateDotRune[3])
buffs[slot].dot_rune = (buffs[slot].dot_rune - damage_to_reduce); buffs[slot].dot_rune = (buffs[slot].dot_rune - damage_to_reduce);
damage -= damage_to_reduce; damage -= damage_to_reduce;
} }
} }
@ -3265,12 +3248,11 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi
// Reduce damage by the Spell Shielding first so that the runes don't take the raw damage. // Reduce damage by the Spell Shielding first so that the runes don't take the raw damage.
damage -= (damage * itembonuses.SpellShield / 100); damage -= (damage * itembonuses.SpellShield / 100);
//Only mitigate if damage is above the minimium specified. //Only mitigate if damage is above the minimium specified.
if (spellbonuses.SpellThresholdGuard[0]){ if (spellbonuses.SpellThresholdGuard[0]){
slot = spellbonuses.SpellThresholdGuard[1]; slot = spellbonuses.SpellThresholdGuard[1];
if (slot >= 0 && (damage > spellbonuses.MeleeThresholdGuard[2])) if (slot >= 0 && (damage > spellbonuses.MeleeThresholdGuard[2]))
{ {
DisableSpellRune = true; DisableSpellRune = true;
int damage_to_reduce = damage * spellbonuses.SpellThresholdGuard[0] / 100; int damage_to_reduce = damage * spellbonuses.SpellThresholdGuard[0] / 100;
@ -3287,8 +3269,7 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi
} }
} }
} }
// Do runes now. // Do runes now.
if (spellbonuses.MitigateSpellRune[0] && !DisableSpellRune){ if (spellbonuses.MitigateSpellRune[0] && !DisableSpellRune){
slot = spellbonuses.MitigateSpellRune[1]; slot = spellbonuses.MitigateSpellRune[1];
@ -3311,10 +3292,10 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi
{ {
mlog(SPELLS__EFFECT_VALUES, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" mlog(SPELLS__EFFECT_VALUES, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d"
" damage remaining.", damage_to_reduce, buffs[slot].magic_rune); " damage remaining.", damage_to_reduce, buffs[slot].magic_rune);
if (spellbonuses.MitigateSpellRune[3]) if (spellbonuses.MitigateSpellRune[3])
buffs[slot].magic_rune = (buffs[slot].magic_rune - damage_to_reduce); buffs[slot].magic_rune = (buffs[slot].magic_rune - damage_to_reduce);
damage -= damage_to_reduce; damage -= damage_to_reduce;
} }
} }
@ -3322,14 +3303,14 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi
if(damage < 1) if(damage < 1)
return 0; return 0;
//Regular runes absorb spell damage (except dots) - Confirmed on live. //Regular runes absorb spell damage (except dots) - Confirmed on live.
if (spellbonuses.MeleeRune[0] && spellbonuses.MeleeRune[1] >= 0) if (spellbonuses.MeleeRune[0] && spellbonuses.MeleeRune[1] >= 0)
damage = RuneAbsorb(damage, SE_Rune); damage = RuneAbsorb(damage, SE_Rune);
if (spellbonuses.AbsorbMagicAtt[0] && spellbonuses.AbsorbMagicAtt[1] >= 0) if (spellbonuses.AbsorbMagicAtt[0] && spellbonuses.AbsorbMagicAtt[1] >= 0)
damage = RuneAbsorb(damage, SE_AbsorbMagicAtt); damage = RuneAbsorb(damage, SE_AbsorbMagicAtt);
if(damage < 1) if(damage < 1)
return 0; return 0;
} }
@ -3349,7 +3330,7 @@ int32 Mob::ReduceAllDamage(int32 damage)
TryTriggerOnValueAmount(false, true); TryTriggerOnValueAmount(false, true);
} }
} }
CheckNumHitsRemaining(NUMHIT_IncomingDamage); CheckNumHitsRemaining(NUMHIT_IncomingDamage);
return(damage); return(damage);
@ -3556,7 +3537,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons
attacker->CastToClient()->sneaking = false; attacker->CastToClient()->sneaking = false;
attacker->SendAppearancePacket(AT_Sneak, 0); attacker->SendAppearancePacket(AT_Sneak, 0);
} }
//final damage has been determined. //final damage has been determined.
SetHP(GetHP() - damage); SetHP(GetHP() - damage);
@ -3588,7 +3569,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons
entity_list.MessageClose_StringID(this, true, 100, MT_WornOff, entity_list.MessageClose_StringID(this, true, 100, MT_WornOff,
HAS_BEEN_AWAKENED, GetCleanName(), attacker->GetCleanName()); HAS_BEEN_AWAKENED, GetCleanName(), attacker->GetCleanName());
BuffFadeByEffect(SE_Mez); BuffFadeByEffect(SE_Mez);
} }
//check stun chances if bashing //check stun chances if bashing
if (damage > 0 && ((skill_used == SkillBash || skill_used == SkillKick) && attacker)) { if (damage > 0 && ((skill_used == SkillBash || skill_used == SkillKick) && attacker)) {
@ -3721,18 +3702,15 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons
//if the attacker is a client, try them with the correct filter //if the attacker is a client, try them with the correct filter
if(attacker && attacker->IsClient()) { if(attacker && attacker->IsClient()) {
if (((spell_id != SPELL_UNKNOWN)||(FromDamageShield)) && damage>0) { if ((spell_id != SPELL_UNKNOWN || FromDamageShield) && damage > 0) {
//special crap for spell damage, looks hackish to me //special crap for spell damage, looks hackish to me
char val1[20]={0}; char val1[20] = {0};
if (FromDamageShield) if (FromDamageShield) {
{ if (attacker->CastToClient()->GetFilter(FilterDamageShields) != FilterHide)
if(!attacker->CastToClient()->GetFilter(FilterDamageShields) == FilterHide) attacker->Message_StringID(MT_DS,OTHER_HIT_NONMELEE, GetCleanName(), ConvertArray(damage, val1));
{ } else {
attacker->Message_StringID(MT_DS,OTHER_HIT_NONMELEE,GetCleanName(),ConvertArray(damage,val1)); entity_list.MessageClose_StringID(this, true, 100, MT_NonMelee, HIT_NON_MELEE, attacker->GetCleanName(), GetCleanName(), ConvertArray(damage, val1));
} }
}
else
entity_list.MessageClose_StringID(this, true, 100, MT_NonMelee,HIT_NON_MELEE,attacker->GetCleanName(),GetCleanName(),ConvertArray(damage,val1));
} else { } else {
if(damage > 0) { if(damage > 0) {
if(spell_id != SPELL_UNKNOWN) if(spell_id != SPELL_UNKNOWN)
@ -3790,7 +3768,6 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons
} }
void Mob::HealDamage(uint32 amount, Mob *caster, uint16 spell_id) void Mob::HealDamage(uint32 amount, Mob *caster, uint16 spell_id)
{ {
int32 maxhp = GetMaxHP(); int32 maxhp = GetMaxHP();
@ -3879,7 +3856,7 @@ float Mob::GetProcChances(float ProcBonus, uint16 hand)
} }
float Mob::GetDefensiveProcChances(float &ProcBonus, float &ProcChance, uint16 hand, Mob* on) { float Mob::GetDefensiveProcChances(float &ProcBonus, float &ProcChance, uint16 hand, Mob* on) {
if (!on) if (!on)
return ProcChance; return ProcChance;
@ -3935,7 +3912,7 @@ void Mob::TryWeaponProc(const ItemInst* weapon_g, Mob *on, uint16 hand) {
LogFile->write(EQEMuLog::Error, "A null Mob object was passed to Mob::TryWeaponProc for evaluation!"); LogFile->write(EQEMuLog::Error, "A null Mob object was passed to Mob::TryWeaponProc for evaluation!");
return; return;
} }
if (!IsAttackAllowed(on)) { if (!IsAttackAllowed(on)) {
mlog(COMBAT__PROCS, "Preventing procing off of unattackable things."); mlog(COMBAT__PROCS, "Preventing procing off of unattackable things.");
return; return;
@ -3962,7 +3939,7 @@ void Mob::TryWeaponProc(const ItemInst* weapon_g, Mob *on, uint16 hand) {
void Mob::TryWeaponProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on, uint16 hand) void Mob::TryWeaponProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on, uint16 hand)
{ {
if (!weapon) if (!weapon)
return; return;
uint16 skillinuse = 28; uint16 skillinuse = 28;
@ -4123,7 +4100,7 @@ void Mob::TrySpellProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on,
uint16 skillinuse = 28; uint16 skillinuse = 28;
if (weapon) if (weapon)
skillinuse = GetSkillByItemType(weapon->ItemType); skillinuse = GetSkillByItemType(weapon->ItemType);
TrySkillProc(on, skillinuse, 0, false, hand); TrySkillProc(on, skillinuse, 0, false, hand);
} }
@ -4190,7 +4167,7 @@ void Mob::TryCriticalHit(Mob *defender, uint16 skill, int32 &damage, ExtraAttack
// decided to branch this into it's own function since it's going to be duplicating a lot of the // decided to branch this into it's own function since it's going to be duplicating a lot of the
// code in here, but could lead to some confusion otherwise // code in here, but could lead to some confusion otherwise
if (IsPet() && GetOwner()->IsClient() || (IsNPC() && CastToNPC()->GetSwarmOwner())) { if ((IsPet() && GetOwner()->IsClient()) || (IsNPC() && CastToNPC()->GetSwarmOwner())) {
TryPetCriticalHit(defender,skill,damage); TryPetCriticalHit(defender,skill,damage);
return; return;
} }
@ -4234,7 +4211,7 @@ void Mob::TryCriticalHit(Mob *defender, uint16 skill, int32 &damage, ExtraAttack
//are defined you will have an innate chance to hit at Level 1 regardless of bonuses. //are defined you will have an innate chance to hit at Level 1 regardless of bonuses.
//Warning: Do not define these rules if you want live like critical hits. //Warning: Do not define these rules if you want live like critical hits.
critChance += RuleI(Combat, MeleeBaseCritChance); critChance += RuleI(Combat, MeleeBaseCritChance);
if (IsClient()) { if (IsClient()) {
critChance += RuleI(Combat, ClientBaseCritChance); critChance += RuleI(Combat, ClientBaseCritChance);
@ -4335,7 +4312,6 @@ void Mob::TryCriticalHit(Mob *defender, uint16 skill, int32 &damage, ExtraAttack
} }
} }
bool Mob::TryFinishingBlow(Mob *defender, SkillUseTypes skillinuse) bool Mob::TryFinishingBlow(Mob *defender, SkillUseTypes skillinuse)
{ {
if (defender && !defender->IsClient() && defender->GetHPRatio() < 10){ if (defender && !defender->IsClient() && defender->GetHPRatio() < 10){
@ -4484,8 +4460,8 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui
if (!spellbonuses.LimitToSkill[skill] && !itembonuses.LimitToSkill[skill] && !aabonuses.LimitToSkill[skill]) if (!spellbonuses.LimitToSkill[skill] && !itembonuses.LimitToSkill[skill] && !aabonuses.LimitToSkill[skill])
return; return;
/*Allow one proc from each (Spell/Item/AA) /*Allow one proc from each (Spell/Item/AA)
Kayen: Due to limited avialability of effects on live it is too difficult Kayen: Due to limited avialability of effects on live it is too difficult
to confirm how they stack at this time, will adjust formula when more data is avialablle to test.*/ to confirm how they stack at this time, will adjust formula when more data is avialablle to test.*/
bool CanProc = true; bool CanProc = true;
@ -4503,9 +4479,9 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui
for(int e = 0; e < MAX_SKILL_PROCS; e++){ for(int e = 0; e < MAX_SKILL_PROCS; e++){
if (CanProc && if (CanProc &&
(!Success && spellbonuses.SkillProc[e] && IsValidSpell(spellbonuses.SkillProc[e])) ((!Success && spellbonuses.SkillProc[e] && IsValidSpell(spellbonuses.SkillProc[e]))
|| (Success && spellbonuses.SkillProcSuccess[e] && IsValidSpell(spellbonuses.SkillProcSuccess[e]))) { || (Success && spellbonuses.SkillProcSuccess[e] && IsValidSpell(spellbonuses.SkillProcSuccess[e])))) {
if (Success) if (Success)
base_spell_id = spellbonuses.SkillProcSuccess[e]; base_spell_id = spellbonuses.SkillProcSuccess[e];
else else
@ -4547,8 +4523,8 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui
CanProc = true; CanProc = true;
for(int e = 0; e < MAX_SKILL_PROCS; e++){ for(int e = 0; e < MAX_SKILL_PROCS; e++){
if (CanProc && if (CanProc &&
(!Success && itembonuses.SkillProc[e] && IsValidSpell(itembonuses.SkillProc[e])) ((!Success && itembonuses.SkillProc[e] && IsValidSpell(itembonuses.SkillProc[e]))
|| (Success && itembonuses.SkillProcSuccess[e] && IsValidSpell(itembonuses.SkillProcSuccess[e]))) { || (Success && itembonuses.SkillProcSuccess[e] && IsValidSpell(itembonuses.SkillProcSuccess[e])))) {
if (Success) if (Success)
base_spell_id = itembonuses.SkillProcSuccess[e]; base_spell_id = itembonuses.SkillProcSuccess[e];
@ -4589,15 +4565,15 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui
CanProc = true; CanProc = true;
uint32 effect = 0; uint32 effect = 0;
int32 base1 = 0; int32 base1 = 0;
int32 base2 = 0; int32 base2 = 0;
uint32 slot = 0; uint32 slot = 0;
for(int e = 0; e < MAX_SKILL_PROCS; e++){ for(int e = 0; e < MAX_SKILL_PROCS; e++){
if (CanProc && if (CanProc &&
(!Success && aabonuses.SkillProc[e]) ((!Success && aabonuses.SkillProc[e])
|| (Success && aabonuses.SkillProcSuccess[e])){ || (Success && aabonuses.SkillProcSuccess[e]))) {
int aaid = 0; int aaid = 0;
if (Success) if (Success)
base_spell_id = aabonuses.SkillProcSuccess[e]; base_spell_id = aabonuses.SkillProcSuccess[e];
else else
@ -4670,7 +4646,7 @@ bool Mob::TryRootFadeByDamage(int buffslot, Mob* attacker) {
General Mechanics General Mechanics
- Check buffslot to make sure damage from a root does not cancel the root - 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. - 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. - Only roots on determental spells can be broken by damage.
- Root break chance values obtained from live parses. - Root break chance values obtained from live parses.
*/ */
@ -4731,7 +4707,7 @@ int32 Mob::RuneAbsorb(int32 damage, uint16 type)
{ {
if(melee_rune_left > 0) if(melee_rune_left > 0)
damage -= melee_rune_left; damage -= melee_rune_left;
if(!TryFadeEffect(slot)) if(!TryFadeEffect(slot))
BuffFadeBySlot(slot); BuffFadeBySlot(slot);
} }
@ -4739,7 +4715,6 @@ int32 Mob::RuneAbsorb(int32 damage, uint16 type)
} }
} }
else{ else{
for(uint32 slot = 0; slot < buff_max; slot++) { for(uint32 slot = 0; slot < buff_max; slot++) {
if(slot == spellbonuses.AbsorbMagicAtt[1] && spellbonuses.AbsorbMagicAtt[0] && buffs[slot].magic_rune && IsValidSpell(buffs[slot].spellid)){ if(slot == spellbonuses.AbsorbMagicAtt[1] && spellbonuses.AbsorbMagicAtt[0] && buffs[slot].magic_rune && IsValidSpell(buffs[slot].spellid)){
@ -4755,7 +4730,7 @@ int32 Mob::RuneAbsorb(int32 damage, uint16 type)
{ {
if(magic_rune_left > 0) if(magic_rune_left > 0)
damage -= magic_rune_left; damage -= magic_rune_left;
if(!TryFadeEffect(slot)) if(!TryFadeEffect(slot))
BuffFadeBySlot(slot); BuffFadeBySlot(slot);
} }
@ -4768,7 +4743,7 @@ int32 Mob::RuneAbsorb(int32 damage, uint16 type)
void Mob::CommonOutgoingHitSuccess(Mob* defender, int32 &damage, SkillUseTypes skillInUse) void Mob::CommonOutgoingHitSuccess(Mob* defender, int32 &damage, SkillUseTypes skillInUse)
{ {
if (!defender) if (!defender)
return; return;
ApplyMeleeDamageBonus(skillInUse, damage); ApplyMeleeDamageBonus(skillInUse, damage);