AA bonus calc -> Mob from Client, Bots should now work with their aa stuff again (untested)

This commit is contained in:
KimLS 2015-06-16 11:34:43 -07:00
parent a984e9bd7c
commit 1b088b7157
5 changed files with 463 additions and 1094 deletions

View File

@ -42,6 +42,7 @@
void Mob::CalcBonuses()
{
CalcSpellBonuses(&spellbonuses);
CalcAABonuses(&aabonuses);
CalcMaxHP();
CalcMaxMana();
SetAttackTimer();
@ -51,9 +52,7 @@ void Mob::CalcBonuses()
void NPC::CalcBonuses()
{
Mob::CalcBonuses();
memset(&aabonuses, 0, sizeof(StatBonuses));
memset(&itembonuses, 0, sizeof(StatBonuses));
if(RuleB(NPC, UseItemBonusesForNonPets)){
memset(&itembonuses, 0, sizeof(StatBonuses));
CalcItemBonuses(&itembonuses);
@ -74,12 +73,8 @@ void Client::CalcBonuses()
memset(&itembonuses, 0, sizeof(StatBonuses));
CalcItemBonuses(&itembonuses);
CalcEdibleBonuses(&itembonuses);
CalcSpellBonuses(&spellbonuses);
Log.Out(Logs::Detail, Logs::AA, "Calculating AA Bonuses for %s.", this->GetCleanName());
CalcAABonuses(&aabonuses); //we're not quite ready for this
Log.Out(Logs::Detail, Logs::AA, "Finished calculating AA Bonuses for %s.", this->GetCleanName());
CalcAABonuses(&aabonuses);
ProcessItemCaps(); // caps that depend on spell/aa bonuses
@ -635,7 +630,7 @@ void Client::CalcEdibleBonuses(StatBonuses* newbon) {
}
}
void Client::CalcAABonuses(StatBonuses *newbon)
void Mob::CalcAABonuses(StatBonuses *newbon)
{
memset(newbon, 0, sizeof(StatBonuses)); // start fresh
@ -659,7 +654,7 @@ void Client::CalcAABonuses(StatBonuses *newbon)
//A lot of the normal spell functions (IsBlankSpellEffect, etc) are set for just spells (in common/spdat.h).
//For now, we'll just put them directly into the code and comment with the corresponding normal function
//Maybe we'll fix it later? :-D
void Client::ApplyAABonuses(const AA::Rank &rank, StatBonuses *newbon)
void Mob::ApplyAABonuses(const AA::Rank &rank, StatBonuses *newbon)
{
if (rank.effects.empty()) // sanity check. why bother if no slots to fill?
return;

File diff suppressed because it is too large Load Diff

View File

@ -449,7 +449,6 @@ public:
bool IsBotWISCaster() { return (GetClass() == CLERIC || GetClass() == DRUID || GetClass() == SHAMAN); }
bool CanHeal();
int GetRawACNoShield(int &shield_ac);
void ApplyAABonuses(uint32 aaid, uint32 slots, StatBonuses* newbon);
bool GetHasBeenSummoned() { return _hasBeenSummoned; }
const glm::vec3 GetPreSummonLocation() const { return m_PreSummonLocation; }
bool GetGroupMessagesOn() { return _groupMessagesOn; }
@ -561,7 +560,7 @@ protected:
virtual bool CheckBotDoubleAttack(bool Triple = false);
virtual int32 GetBotFocusEffect(BotfocusType bottype, uint16 spell_id);
virtual int32 CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spell_id, bool best_focus=false);
virtual int32 CalcBotAAFocus(BotfocusType type, uint32 aa_ID, uint16 spell_id);
virtual int32 CalcBotAAFocus(BotfocusType type, uint32 aa_ID, uint32 points, uint16 spell_id);
virtual void PerformTradeWithClient(int16 beginSlotID, int16 endSlotID, Client* client);
virtual bool AIDoSpellCast(uint8 i, Mob* tar, int32 mana_cost, uint32* oDontDoAgainBefore = 0);
virtual float GetMaxMeleeRangeToTarget(Mob* target);
@ -642,12 +641,12 @@ private:
uint8 _baseGender; // Bots gender. Necessary to preserve the original value otherwise it can be changed by illusions.
// Class Methods
void LoadAAs();
int32 acmod();
void GenerateBaseStats();
void GenerateAppearance();
void GenerateArmorClass();
int32 GenerateBaseHitPoints();
void GenerateAABonuses(StatBonuses* newbon);
int32 GenerateBaseManaPoints();
void GenerateSpecialAttacks();
void SetBotID(uint32 botID);

View File

@ -1260,8 +1260,6 @@ protected:
void AdditiveWornBonuses(const ItemInst *inst, StatBonuses* newbon, bool isAug = false);
int CalcRecommendedLevelBonus(uint8 level, uint8 reclevel, int basestat);
void CalcEdibleBonuses(StatBonuses* newbon);
void CalcAABonuses(StatBonuses* newbon);
void ApplyAABonuses(const AA::Rank &rank, StatBonuses* newbon);
void ProcessItemCaps();
void MakeBuffFadePacket(uint16 spell_id, int slot_id, bool send_message = true);
bool client_data_loaded;

View File

@ -967,6 +967,8 @@ public:
bool CanPurchaseAlternateAdvancementRank(AA::Rank *rank, bool check_price);
int GetAlternateAdvancementCooldownReduction(AA::Rank *rank_in);
void ExpendAlternateAdvancementCharge(uint32 aa_id);
void CalcAABonuses(StatBonuses* newbon);
void ApplyAABonuses(const AA::Rank &rank, StatBonuses* newbon);
protected:
void CommonDamage(Mob* other, int32 &damage, const uint16 spell_id, const SkillUseTypes attack_skill, bool &avoidable, const int8 buffslot, const bool iBuffTic);