[Feature] Add support for -1 extradmgskill to allow all skills to be scaled. (#3136)

* [Feature] Add support for -1 extradmgskill to allow all skills to be scaled.

- `$mob->GetSkillDmgAmt(skill_id)` now uses `int` instead of `uint16`.

- `statbonuses:GetSkillDamageAmount(skill_id)` now uses `-1` properly.
- `mob:GetSkillDmgAmt(skill_id)` now uses `int` instead of `uint16`.

- A `-1` value in `extradmgskill` denotes the ability to scale all skills at once.
- Consolidated `AddItemBonuses()`, `AdditiveWornBonuses()`, `CalcItemBonuses()`, and `CalcRecommendedLevelBonus()` to mob-based methods to avoid code duplication.
- Bots, NPCs, and Mercs can now use additive worn effects if the rule is enabled, as well as all other proper stat bonuses that only clients had before.
- No SQL update required to change `extradmgskill` and `extradmgamt` to `int` as they already are this type in the database, just had to adjust `item_data.h` and `shareddb.cpp`.

* Update mob.cpp

* Cleanup.

* Cleanup.

* Move #include <vector> to header.

* Add method for GetExtraDamageSkills

* fix additembonuses

* Update bonuses.cpp

* Update mob.cpp

* Out of bounds.

* Update bonuses.cpp

---------

Co-authored-by: Aeadoin <109764533+Aeadoin@users.noreply.github.com>
This commit is contained in:
Alex King
2023-03-25 20:26:01 -04:00
committed by GitHub
parent ec3ef411a1
commit 9d1ace627c
17 changed files with 569 additions and 1167 deletions
+6 -3
View File
@@ -664,8 +664,6 @@ public:
virtual int32 CalcItemATKCap() { return 0; }
virtual bool IsSitting() const { return false; }
int CalcRecommendedLevelBonus(uint8 level, uint8 reclevel, int basestat);
void CopyHateList(Mob* to);
//Group
@@ -953,7 +951,7 @@ public:
int16 GetMeleeDmgPositionMod(Mob* defender);
int16 GetSkillReuseTime(uint16 skill);
int GetCriticalChanceBonus(uint16 skill);
int GetSkillDmgAmt(uint16 skill);
int GetSkillDmgAmt(int skill_id);
int16 GetPositionalDmgAmt(Mob* defender);
inline bool CanBlockSpell() const { return(spellbonuses.FocusEffects[focusBlockNextSpell]); }
bool DoHPToManaCovert(int32 mana_cost = 0);
@@ -1378,6 +1376,11 @@ public:
void ApplyAABonuses(const AA::Rank &rank, StatBonuses* newbon);
bool CheckAATimer(int timer);
void CalcItemBonuses(StatBonuses* b);
void AddItemBonuses(const EQ::ItemInstance* inst, StatBonuses* b, bool is_augment = false, bool is_tribute = false, int recommended_level_override = 0, bool is_ammo_item = false);
void AdditiveWornBonuses(const EQ::ItemInstance* inst, StatBonuses* b, bool is_augment = false);
int CalcRecommendedLevelBonus(uint8 current_level, uint8 recommended_level, int base_stat);
int NPCAssistCap() { return npc_assist_cap; }
void AddAssistCap() { ++npc_assist_cap; }
void DelAssistCap() { --npc_assist_cap; }