[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
+3 -3
View File
@@ -131,7 +131,7 @@ namespace EQ
Mounts?
Ornamentations?
GuildBanners?
Collectible?
Collectible?
Placeable?
(others?)
*/
@@ -449,8 +449,8 @@ namespace EQ
int8 Shielding; // PoP: Shielding %
int8 StunResist; // PoP: Stun Resist %
int8 StrikeThrough; // PoP: Strike Through %
uint32 ExtraDmgSkill;
uint32 ExtraDmgAmt;
int32 ExtraDmgSkill;
int32 ExtraDmgAmt;
int8 SpellShield; // PoP: Spell Shield %
int8 Avoidance; // PoP: Avoidance +
int8 Accuracy; // PoP: Accuracy +
+2 -2
View File
@@ -1107,8 +1107,8 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_
item.SkillModType = Strings::ToUnsignedInt(row[ItemField::skillmodtype]);
// Extra Damage Skill
item.ExtraDmgSkill = Strings::ToUnsignedInt(row[ItemField::extradmgskill]);
item.ExtraDmgAmt = Strings::ToUnsignedInt(row[ItemField::extradmgamt]);
item.ExtraDmgSkill = Strings::ToInt(row[ItemField::extradmgskill]);
item.ExtraDmgAmt = Strings::ToInt(row[ItemField::extradmgamt]);
// Bard
item.BardType = Strings::ToUnsignedInt(row[ItemField::bardtype]);
+20 -2
View File
@@ -1,5 +1,5 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
@@ -260,13 +260,31 @@ const std::map<EQ::skills::SkillType, std::string>& EQ::skills::GetSkillTypeMap(
return skill_type_map;
}
const std::vector<EQ::skills::SkillType>& EQ::skills::GetExtraDamageSkills()
{
static const std::vector<EQ::skills::SkillType> v = {
EQ::skills::SkillBackstab,
EQ::skills::SkillBash,
EQ::skills::SkillDragonPunch, // Same ID as Tail Rake
EQ::skills::SkillEagleStrike,
EQ::skills::SkillFlyingKick,
EQ::skills::SkillKick,
EQ::skills::SkillRoundKick,
EQ::skills::SkillRoundKick,
EQ::skills::SkillTigerClaw,
EQ::skills::SkillFrenzy
};
return v;
}
std::string EQ::skills::GetSkillName(SkillType skill)
{
if (skill >= Skill1HBlunt && skill <= Skill2HPiercing) {
auto skills = GetSkillTypeMap();
return skills[skill];
}
return std::string();
return {};
}
EQ::SkillProfile::SkillProfile()
+4 -2
View File
@@ -1,5 +1,5 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
This program is free software; you can redistribute it and/or modify
@@ -24,6 +24,7 @@
#include <string>
#include <map>
#include <vector>
namespace EQ
@@ -170,6 +171,7 @@ namespace EQ
bool IsMeleeDmg(SkillType skill);
extern const std::map<SkillType, std::string>& GetSkillTypeMap();
extern const std::vector<SkillType>& GetExtraDamageSkills();
std::string GetSkillName(SkillType skill);
} /*skills*/
@@ -305,7 +307,7 @@ namespace EQ
uint32 operator[](int skill_id) const { return const_cast<SkillProfile*>(this)->GetSkill(skill_id); }
};
} /*EQEmu*/
#endif /*COMMON_SKILLS_H*/