mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 16:51:29 +00:00
[Bots] Cleanup various Bot Spell Focus methods (#2649)
* [Bots] Cleanup GetFocusEffect & GetActSpellDamage * Remove unused CalcBotFocusEffect * Cleanup unneeded derived class methods * compile error
This commit is contained in:
parent
f188c1394a
commit
f12090d109
967
zone/bot.cpp
967
zone/bot.cpp
File diff suppressed because it is too large
Load Diff
@ -364,7 +364,6 @@ public:
|
||||
|
||||
// Mob Spell Virtual Override Methods
|
||||
virtual void SpellProcess();
|
||||
virtual int64 GetActSpellDamage(uint16 spell_id, int64 value, Mob* target = nullptr);
|
||||
virtual int64 GetActSpellHealing(uint16 spell_id, int64 value, Mob* target = nullptr);
|
||||
virtual int32 GetActSpellCasttime(uint16 spell_id, int32 casttime);
|
||||
virtual int32 GetActSpellCost(uint16 spell_id, int32 cost);
|
||||
@ -389,7 +388,7 @@ public:
|
||||
void EquipBot(std::string* error_message);
|
||||
bool CheckLoreConflict(const EQ::ItemData* item);
|
||||
virtual void UpdateEquipmentLight() { m_Light.Type[EQ::lightsource::LightEquipment] = m_inv.FindBrightestLightType(); m_Light.Level[EQ::lightsource::LightEquipment] = EQ::lightsource::TypeToLevel(m_Light.Type[EQ::lightsource::LightEquipment]); }
|
||||
inline EQ::InventoryProfile& GetBotInv() { return m_inv; }
|
||||
inline EQ::InventoryProfile& GetInv() { return m_inv; }
|
||||
|
||||
// Static Class Methods
|
||||
//static void DestroyBotRaidObjects(Client* client); // Can be removed after bot raids are dumped
|
||||
@ -737,9 +736,6 @@ protected:
|
||||
virtual void PetAIProcess();
|
||||
virtual void BotMeditate(bool isSitting);
|
||||
virtual bool CheckBotDoubleAttack(bool Triple = false);
|
||||
virtual int32 GetBotFocusEffect(focusType bottype, uint16 spell_id, bool from_buff_tic = false);
|
||||
virtual int32 CalcBotFocusEffect(focusType bottype, uint16 focus_id, uint16 spell_id, bool best_focus=false);
|
||||
virtual int32 CalcBotAAFocus(focusType type, uint32 aa_ID, uint32 points, uint16 spell_id);
|
||||
virtual void PerformTradeWithClient(int16 begin_slot_id, int16 end_slot_id, Client* client);
|
||||
virtual bool AIDoSpellCast(uint8 i, Mob* tar, int32 mana_cost, uint32* oDontDoAgainBefore = 0);
|
||||
|
||||
|
||||
@ -3727,7 +3727,7 @@ void bot_command_item_use(Client* c, const Seperator* sep)
|
||||
continue;
|
||||
}
|
||||
|
||||
auto equipped_item = bot_iter->GetBotInv()[slot_iter];
|
||||
auto equipped_item = bot_iter->GetInv()[slot_iter];
|
||||
|
||||
if (equipped_item && !empty_only) {
|
||||
linker.SetItemInst(equipped_item);
|
||||
|
||||
@ -947,7 +947,6 @@ public:
|
||||
void SendClearPlayerAA();
|
||||
inline uint32 GetAAXP() const { return m_pp.expAA; }
|
||||
inline uint32 GetAAPercent() const { return m_epp.perAA; }
|
||||
int64 CalcAAFocus(focusType type, const AA::Rank &rank, uint16 spell_id);
|
||||
void SetAATitle(std::string title);
|
||||
void SetTitleSuffix(std::string suffix);
|
||||
void MemorizeSpell(uint32 slot, uint32 spellid, uint32 scribing, uint32 reduction = 0);
|
||||
@ -1683,7 +1682,6 @@ protected:
|
||||
void MakeBuffFadePacket(uint16 spell_id, int slot_id, bool send_message = true);
|
||||
bool client_data_loaded;
|
||||
|
||||
int64 GetFocusEffect(focusType type, uint16 spell_id, Mob *caster = nullptr, bool from_buff_tic = false);
|
||||
uint16 GetSympatheticFocusEffect(focusType type, uint16 spell_id);
|
||||
|
||||
void FinishAlternateAdvancementPurchase(AA::Rank *rank, bool ignore_cost);
|
||||
|
||||
@ -57,7 +57,7 @@ int64 Mob::GetActSpellDamage(uint16 spell_id, int64 value, Mob* target) {
|
||||
value -= (GetLevel() - 40) * 20;
|
||||
|
||||
//This adds the extra damage from the AA Unholy Touch, 450 per level to the AA Improved Harm TOuch.
|
||||
if (spell_id == SPELL_IMP_HARM_TOUCH && IsClient()) //Improved Harm Touch
|
||||
if (spell_id == SPELL_IMP_HARM_TOUCH && (IsClient() || IsBot())) //Improved Harm Touch
|
||||
value -= GetAA(aaUnholyTouch) * 450; //Unholy Touch
|
||||
|
||||
chance = RuleI(Spells, BaseCritChance); //Wizard base critical chance is 2% (Does not scale with level)
|
||||
@ -65,12 +65,12 @@ int64 Mob::GetActSpellDamage(uint16 spell_id, int64 value, Mob* target) {
|
||||
chance += itembonuses.FrenziedDevastation + spellbonuses.FrenziedDevastation + aabonuses.FrenziedDevastation;
|
||||
|
||||
//Crtical Hit Calculation pathway
|
||||
if (chance > 0 || (IsClient() && GetClass() == WIZARD && GetLevel() >= RuleI(Spells, WizCritLevel))) {
|
||||
if (chance > 0 || ((IsClient() || IsBot()) && GetClass() == WIZARD && GetLevel() >= RuleI(Spells, WizCritLevel))) {
|
||||
|
||||
int32 ratio = RuleI(Spells, BaseCritRatio); //Critical modifier is applied from spell effects only. Keep at 100 for live like criticals.
|
||||
|
||||
//Improved Harm Touch is a guaranteed crit if you have at least one level of SCF.
|
||||
if (spell_id == SPELL_IMP_HARM_TOUCH && IsClient() && (GetAA(aaSpellCastingFury) > 0) && (GetAA(aaUnholyTouch) > 0))
|
||||
if (spell_id == SPELL_IMP_HARM_TOUCH && (IsClient() || IsBot()) && (GetAA(aaSpellCastingFury) > 0) && (GetAA(aaUnholyTouch) > 0))
|
||||
chance = 100;
|
||||
|
||||
if (spells[spell_id].override_crit_chance > 0 && chance > spells[spell_id].override_crit_chance)
|
||||
@ -82,7 +82,7 @@ int64 Mob::GetActSpellDamage(uint16 spell_id, int64 value, Mob* target) {
|
||||
ratio += itembonuses.SpellCritDmgIncNoStack + spellbonuses.SpellCritDmgIncNoStack + aabonuses.SpellCritDmgIncNoStack;
|
||||
}
|
||||
|
||||
else if ((IsClient() && GetClass() == WIZARD) || (IsMerc() && GetClass() == CASTERDPS)) {
|
||||
else if (((IsClient() || IsBot()) && GetClass() == WIZARD) || (IsMerc() && GetClass() == CASTERDPS)) {
|
||||
if ((GetLevel() >= RuleI(Spells, WizCritLevel)) && zone->random.Roll(RuleI(Spells, WizCritChance))){
|
||||
//Wizard innate critical chance is calculated seperately from spell effect and is not a set ratio. (20-70 is parse confirmed)
|
||||
ratio += zone->random.Int(20,70);
|
||||
@ -90,7 +90,7 @@ int64 Mob::GetActSpellDamage(uint16 spell_id, int64 value, Mob* target) {
|
||||
}
|
||||
}
|
||||
|
||||
if (IsClient() && GetClass() == WIZARD)
|
||||
if ((IsClient() || IsBot()) && GetClass() == WIZARD)
|
||||
ratio += RuleI(Spells, WizCritRatio); //Default is zero
|
||||
|
||||
if (Critical){
|
||||
|
||||
@ -4213,23 +4213,27 @@ int EQ::InventoryProfile::GetItemStatValue(uint32 item_id, const char* identifie
|
||||
// Returns a slot's item ID (returns INVALID_ID if not found)
|
||||
int32 Bot::GetItemIDAt(int16 slot_id) {
|
||||
if (slot_id <= EQ::invslot::POSSESSIONS_END && slot_id >= EQ::invslot::POSSESSIONS_BEGIN) {
|
||||
if ((((uint64)1 << slot_id) & GetBotInv().GetLookup()->PossessionsBitmask) == 0)
|
||||
if ((((uint64)1 << slot_id) & GetInv().GetLookup()->PossessionsBitmask) == 0) {
|
||||
return INVALID_ID;
|
||||
}
|
||||
}
|
||||
else if (slot_id <= EQ::invbag::GENERAL_BAGS_END && slot_id >= EQ::invbag::GENERAL_BAGS_BEGIN) {
|
||||
auto temp_slot = EQ::invslot::GENERAL_BEGIN + ((slot_id - EQ::invbag::GENERAL_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT);
|
||||
if ((((uint64)1 << temp_slot) & GetBotInv().GetLookup()->PossessionsBitmask) == 0)
|
||||
if ((((uint64)1 << temp_slot) & GetInv().GetLookup()->PossessionsBitmask) == 0) {
|
||||
return INVALID_ID;
|
||||
}
|
||||
}
|
||||
else if (slot_id <= EQ::invslot::BANK_END && slot_id >= EQ::invslot::BANK_BEGIN) {
|
||||
if ((slot_id - EQ::invslot::BANK_BEGIN) >= GetBotInv().GetLookup()->InventoryTypeSize.Bank)
|
||||
if ((slot_id - EQ::invslot::BANK_BEGIN) >= GetInv().GetLookup()->InventoryTypeSize.Bank) {
|
||||
return INVALID_ID;
|
||||
}
|
||||
}
|
||||
else if (slot_id <= EQ::invbag::BANK_BAGS_END && slot_id >= EQ::invbag::BANK_BAGS_BEGIN) {
|
||||
auto temp_slot = (slot_id - EQ::invbag::BANK_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT;
|
||||
if (temp_slot >= GetBotInv().GetLookup()->InventoryTypeSize.Bank)
|
||||
if (temp_slot >= GetInv().GetLookup()->InventoryTypeSize.Bank) {
|
||||
return INVALID_ID;
|
||||
}
|
||||
}
|
||||
|
||||
const EQ::ItemInstance* inst = m_inv[slot_id];
|
||||
if (inst)
|
||||
@ -4243,23 +4247,27 @@ int32 Bot::GetItemIDAt(int16 slot_id) {
|
||||
// Pass in the slot ID of the item and which augslot you want to check (0-5)
|
||||
int32 Bot::GetAugmentIDAt(int16 slot_id, uint8 augslot) {
|
||||
if (slot_id <= EQ::invslot::POSSESSIONS_END && slot_id >= EQ::invslot::POSSESSIONS_BEGIN) {
|
||||
if ((((uint64)1 << slot_id) & GetBotInv().GetLookup()->PossessionsBitmask) == 0)
|
||||
if ((((uint64)1 << slot_id) & GetInv().GetLookup()->PossessionsBitmask) == 0) {
|
||||
return INVALID_ID;
|
||||
}
|
||||
}
|
||||
else if (slot_id <= EQ::invbag::GENERAL_BAGS_END && slot_id >= EQ::invbag::GENERAL_BAGS_BEGIN) {
|
||||
auto temp_slot = EQ::invslot::GENERAL_BEGIN + ((slot_id - EQ::invbag::GENERAL_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT);
|
||||
if ((((uint64)1 << temp_slot) & GetBotInv().GetLookup()->PossessionsBitmask) == 0)
|
||||
if ((((uint64)1 << temp_slot) & GetInv().GetLookup()->PossessionsBitmask) == 0) {
|
||||
return INVALID_ID;
|
||||
}
|
||||
}
|
||||
else if (slot_id <= EQ::invslot::BANK_END && slot_id >= EQ::invslot::BANK_BEGIN) {
|
||||
if ((slot_id - EQ::invslot::BANK_BEGIN) >= GetBotInv().GetLookup()->InventoryTypeSize.Bank)
|
||||
if ((slot_id - EQ::invslot::BANK_BEGIN) >= GetInv().GetLookup()->InventoryTypeSize.Bank) {
|
||||
return INVALID_ID;
|
||||
}
|
||||
}
|
||||
else if (slot_id <= EQ::invbag::BANK_BAGS_END && slot_id >= EQ::invbag::BANK_BAGS_BEGIN) {
|
||||
auto temp_slot = (slot_id - EQ::invbag::BANK_BAGS_BEGIN) / EQ::invbag::SLOT_COUNT;
|
||||
if (temp_slot >= GetBotInv().GetLookup()->InventoryTypeSize.Bank)
|
||||
if (temp_slot >= GetInv().GetLookup()->InventoryTypeSize.Bank) {
|
||||
return INVALID_ID;
|
||||
}
|
||||
}
|
||||
|
||||
const EQ::ItemInstance* inst = m_inv[slot_id];
|
||||
if (inst && inst->GetAugmentItemID(augslot)) {
|
||||
|
||||
@ -207,22 +207,22 @@ void Lua_Bot::SetSpellDurationGroup(int spell_id, int duration, bool allow_pets)
|
||||
|
||||
int Lua_Bot::CountAugmentEquippedByID(uint32 item_id) {
|
||||
Lua_Safe_Call_Int();
|
||||
return self->GetBotInv().CountAugmentEquippedByID(item_id);
|
||||
return self->GetInv().CountAugmentEquippedByID(item_id);
|
||||
}
|
||||
|
||||
bool Lua_Bot::HasAugmentEquippedByID(uint32 item_id) {
|
||||
Lua_Safe_Call_Bool();
|
||||
return self->GetBotInv().HasAugmentEquippedByID(item_id);
|
||||
return self->GetInv().HasAugmentEquippedByID(item_id);
|
||||
}
|
||||
|
||||
int Lua_Bot::CountItemEquippedByID(uint32 item_id) {
|
||||
Lua_Safe_Call_Int();
|
||||
return self->GetBotInv().CountItemEquippedByID(item_id);
|
||||
return self->GetInv().CountItemEquippedByID(item_id);
|
||||
}
|
||||
|
||||
bool Lua_Bot::HasItemEquippedByID(uint32 item_id) {
|
||||
Lua_Safe_Call_Bool();
|
||||
return self->GetBotInv().HasItemEquippedByID(item_id);
|
||||
return self->GetInv().HasItemEquippedByID(item_id);
|
||||
}
|
||||
|
||||
void Lua_Bot::Escape() {
|
||||
|
||||
@ -1402,6 +1402,7 @@ public:
|
||||
int GetAlternateAdvancementCooldownReduction(AA::Rank *rank_in);
|
||||
void ExpendAlternateAdvancementCharge(uint32 aa_id);
|
||||
void CalcAABonuses(StatBonuses* newbon);
|
||||
int64 CalcAAFocus(focusType type, const AA::Rank &rank, uint16 spell_id);
|
||||
void ApplyAABonuses(const AA::Rank &rank, StatBonuses* newbon);
|
||||
bool CheckAATimer(int timer);
|
||||
|
||||
@ -1592,7 +1593,8 @@ protected:
|
||||
virtual
|
||||
#endif
|
||||
int GetBaseSkillDamage(EQ::skills::SkillType skill, Mob *target = nullptr);
|
||||
virtual int64 GetFocusEffect(focusType type, uint16 spell_id, Mob *caster = nullptr, bool from_buff_tic = false) { return 0; }
|
||||
int64 GetFocusEffect(focusType type, uint16 spell_id, Mob *caster = nullptr, bool from_buff_tic = false);
|
||||
virtual const EQ::InventoryProfile& GetInv() { return EQ::InventoryProfile(); }
|
||||
void CalculateNewFearpoint();
|
||||
float FindGroundZ(float new_x, float new_y, float z_offset=0.0);
|
||||
float FindDestGroundZ(glm::vec3 dest, float z_offset=0.0);
|
||||
|
||||
@ -285,8 +285,6 @@ public:
|
||||
content_db.GetFactionIdsForNPC(npc_faction_id, &faction_list, &primary_faction);
|
||||
}
|
||||
|
||||
int64 GetFocusEffect(focusType type, uint16 spell_id, Mob* caster = nullptr);
|
||||
|
||||
glm::vec4 m_SpawnPoint;
|
||||
|
||||
uint32 GetMaxDMG() const {return max_dmg;}
|
||||
@ -585,7 +583,7 @@ protected:
|
||||
virtual bool AICastSpell(Mob* tar, uint8 iChance, uint32 iSpellTypes, bool bInnates = false);
|
||||
virtual bool AIDoSpellCast(uint8 i, Mob* tar, int32 mana_cost, uint32* oDontDoAgainBefore = 0);
|
||||
AISpellsVar_Struct AISpellVar;
|
||||
int64 GetFocusEffect(focusType type, uint16 spell_id, Mob* caster, bool from_buff_tic = false);
|
||||
int64 GetFocusEffect(focusType type, uint16 spell_id, Mob *caster = nullptr, bool from_buff_tic = false);
|
||||
uint16 innate_proc_spell_id;
|
||||
|
||||
uint32 npc_spells_effects_id;
|
||||
|
||||
@ -103,7 +103,7 @@ void Perl_Bot_RemoveBotItem(Bot* self, uint32 item_id)
|
||||
|
||||
EQ::ItemInstance* Perl_Bot_GetAugmentAt(Bot* self, uint32 slot, uint32 aug_slot)
|
||||
{
|
||||
EQ::ItemInstance* inst = self->GetBotInv().GetItem(slot);
|
||||
EQ::ItemInstance* inst = self->GetInv().GetItem(slot);
|
||||
if (inst)
|
||||
{
|
||||
return inst->GetAugment(aug_slot);
|
||||
@ -113,22 +113,22 @@ EQ::ItemInstance* Perl_Bot_GetAugmentAt(Bot* self, uint32 slot, uint32 aug_slot)
|
||||
|
||||
int Perl_Bot_CountAugmentEquippedByID(Bot* self, uint32 item_id)
|
||||
{
|
||||
return self->GetBotInv().CountAugmentEquippedByID(item_id);
|
||||
return self->GetInv().CountAugmentEquippedByID(item_id);
|
||||
}
|
||||
|
||||
bool Perl_Bot_HasAugmentEquippedByID(Bot* self, uint32 item_id)
|
||||
{
|
||||
return self->GetBotInv().HasAugmentEquippedByID(item_id);
|
||||
return self->GetInv().HasAugmentEquippedByID(item_id);
|
||||
}
|
||||
|
||||
int Perl_Bot_CountItemEquippedByID(Bot* self, uint32 item_id)
|
||||
{
|
||||
return self->GetBotInv().CountItemEquippedByID(item_id);
|
||||
return self->GetInv().CountItemEquippedByID(item_id);
|
||||
}
|
||||
|
||||
bool Perl_Bot_HasItemEquippedByID(Bot* self, uint32 item_id)
|
||||
{
|
||||
return self->GetBotInv().HasItemEquippedByID(item_id);
|
||||
return self->GetInv().HasItemEquippedByID(item_id);
|
||||
}
|
||||
|
||||
int Perl_Bot_GetRawItemAC(Bot* self) // @categories Inventory and Items
|
||||
@ -288,7 +288,7 @@ int Perl_Bot_GetInstrumentMod(Bot* self, uint16 spell_id) // @categories Spells
|
||||
|
||||
EQ::ItemInstance* Perl_Bot_GetItemAt(Bot* self, uint32 slot) // @categories Inventory and Items
|
||||
{
|
||||
return self->GetBotInv().GetItem(slot);
|
||||
return self->GetInv().GetItem(slot);
|
||||
}
|
||||
|
||||
bool Perl_Bot_IsGrouped(Bot* self) // @categories Account and Character, Group
|
||||
|
||||
@ -200,7 +200,7 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower,
|
||||
}
|
||||
#ifdef BOTS
|
||||
else if (IsBot())
|
||||
act_power = CastToBot()->GetBotFocusEffect(focusPetPower, spell_id);
|
||||
act_power = CastToBot()->GetFocusEffect(focusPetPower, spell_id);
|
||||
#endif
|
||||
}
|
||||
else if (petpower > 0)
|
||||
|
||||
@ -4564,7 +4564,7 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses)
|
||||
CalcBonuses();
|
||||
}
|
||||
|
||||
int64 Client::CalcAAFocus(focusType type, const AA::Rank &rank, uint16 spell_id)
|
||||
int64 Mob::CalcAAFocus(focusType type, const AA::Rank &rank, uint16 spell_id)
|
||||
{
|
||||
const SPDat_Spell_Struct &spell = spells[spell_id];
|
||||
|
||||
@ -6348,7 +6348,7 @@ uint16 Client::GetSympatheticFocusEffect(focusType type, uint16 spell_id) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int64 Client::GetFocusEffect(focusType type, uint16 spell_id, Mob *caster, bool from_buff_tic)
|
||||
int64 Mob::GetFocusEffect(focusType type, uint16 spell_id, Mob *caster, bool from_buff_tic)
|
||||
{
|
||||
if (IsBardSong(spell_id) && type != focusFcBaseEffects && type != focusSpellDuration && type != focusReduceRecastTime) {
|
||||
return 0;
|
||||
@ -6448,6 +6448,7 @@ int64 Client::GetFocusEffect(focusType type, uint16 spell_id, Mob *caster, bool
|
||||
}
|
||||
}
|
||||
|
||||
if (IsClient()) {
|
||||
//Tribute Focus
|
||||
for (int x = EQ::invslot::TRIBUTE_BEGIN; x <= EQ::invslot::TRIBUTE_END; ++x)
|
||||
{
|
||||
@ -6484,6 +6485,7 @@ int64 Client::GetFocusEffect(focusType type, uint16 spell_id, Mob *caster, bool
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(UsedItem && rand_effectiveness && focus_max_real != 0)
|
||||
realTotal = CalcFocusEffect(type, UsedFocusID, spell_id);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user