Changed hate counter to uint32 to prevent negative rollback, this most likely can will be an issue but more uncommon

Renamed and refactored most functions and variables in hate_list.h/cpp for readability
Refactored how hate works in some local functions mixing the use of hate variable and split it out into different status variables
hate_list.cpp/.h style cleanup
hate_list.h header function sort, comment erase
functions should clearly state their function
This commit is contained in:
Akkadius
2014-12-27 18:24:42 -06:00
parent b63dbd50a8
commit 3a488e3a61
19 changed files with 413 additions and 494 deletions
+8 -8
View File
@@ -2662,7 +2662,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial)
caster->Taunt(this->CastToNPC(), false, static_cast<float>(spell.base[i]));
if (spell.base2[i] > 0)
CastToNPC()->SetHate(caster, (CastToNPC()->GetHateAmount(caster) + spell.base2[i]));
CastToNPC()->SetHateAmountOnEnt(caster, (CastToNPC()->GetHateAmount(caster) + spell.base2[i]));
}
break;
}
@@ -2693,7 +2693,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial)
if (new_hate <= 0)
new_hate = 1;
CastToNPC()->SetHate(caster, new_hate);
CastToNPC()->SetHateAmountOnEnt(caster, new_hate);
}
break;
}
@@ -2714,9 +2714,9 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial)
}else{
int32 newhate = GetHateAmount(caster) + effect_value;
if (newhate < 1)
SetHate(caster,1);
SetHateAmountOnEnt(caster,1);
else
SetHate(caster,newhate);
SetHateAmountOnEnt(caster,newhate);
}
}
break;
@@ -3546,9 +3546,9 @@ void Mob::DoBuffTic(uint16 spell_id, int slot, uint32 ticsremaining, uint8 caste
}else{
int32 newhate = GetHateAmount(caster) + effect_value;
if (newhate < 1) {
SetHate(caster,1);
SetHateAmountOnEnt(caster,1);
} else {
SetHate(caster,newhate);
SetHateAmountOnEnt(caster,newhate);
}
}
}
@@ -3732,7 +3732,7 @@ void Mob::DoBuffTic(uint16 spell_id, int slot, uint32 ticsremaining, uint8 caste
if (new_hate <= 0)
new_hate = 1;
CastToNPC()->SetHate(caster, new_hate);
CastToNPC()->SetHateAmountOnEnt(caster, new_hate);
}
break;
}
@@ -6424,7 +6424,7 @@ bool Mob::PassCastRestriction(bool UseCastRestriction, int16 value, bool IsDama
//Limit to amount of pets
if (value >= 221 && value <= 249){
int count = hate_list.SummonedPetCount(this);
int count = hate_list.GetSummonedPetCountOnHateList(this);
for (int base2_value = 221; base2_value <= 249; ++base2_value){
if (value == base2_value){