Skip to content

Commit

Permalink
[z2818] Spell: Also add AP columns and functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
killerwife committed Feb 22, 2024
1 parent 3fb169d commit 229842f
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 12 deletions.
22 changes: 13 additions & 9 deletions sql/base/dbc/original_data/Spell.sql

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion sql/base/mangos.sql
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ DROP TABLE IF EXISTS `db_version`;
CREATE TABLE `db_version` (
`version` varchar(120) DEFAULT NULL,
`creature_ai_version` varchar(120) DEFAULT NULL,
`required_z2817_01_mangos_spell_template` bit(1) DEFAULT NULL
`required_z2818_01_mangos_spell_template_ap` bit(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Used DB version notes';

--
Expand Down
8 changes: 8 additions & 0 deletions sql/updates/mangos/z2818_01_mangos_spell_template_ap.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ALTER TABLE db_version CHANGE COLUMN required_z2817_01_mangos_spell_template required_z2818_01_mangos_spell_template_ap bit;

ALTER TABLE `spell_template`
ADD COLUMN `EffectBonusCoefficientFromAP1` FLOAT NOT NULL DEFAULT '0' AFTER `EffectBonusCoefficient3`,
ADD COLUMN `EffectBonusCoefficientFromAP2` FLOAT NOT NULL DEFAULT '0' AFTER `EffectBonusCoefficientFromAP1`,
ADD COLUMN `EffectBonusCoefficientFromAP3` FLOAT NOT NULL DEFAULT '0' AFTER `EffectBonusCoefficientFromAP2`;


10 changes: 9 additions & 1 deletion src/game/Entities/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6896,8 +6896,16 @@ int32 Unit::SpellBonusWithCoeffs(SpellEntry const* spellProto, SpellEffectIndex
if (GetTypeId() == TYPEID_UNIT && !((Creature*)this)->IsPet())
coeff = 1.0f;
// Check for table values
if (spellProto->effectBonusCoefficient[effectIndex] > 0)
if (spellProto->effectBonusCoefficient[effectIndex] > 0 || spellProto->effectBonusCoefficientFromAP[effectIndex] > 0)
{
coeff = spellProto->effectBonusCoefficient[effectIndex];

if (donePart && spellProto->effectBonusCoefficientFromAP[effectIndex] > 0)
{
float ap_bonus = spellProto->effectBonusCoefficientFromAP[effectIndex];
total += int32(ap_bonus * (GetTotalAttackPowerValue(IsSpellRequiresRangedAP(spellProto) ? RANGED_ATTACK : BASE_ATTACK) + ap_benefit));
}
}
// Default calculation
else if (benefit)
coeff = CalculateDefaultCoefficient(spellProto, damagetype);
Expand Down
1 change: 1 addition & 0 deletions src/game/Server/DBCStructure.h
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,7 @@ struct SpellEntry
uint32 MinReputation; // 171 not used, and 0 in 2.4.2
uint32 RequiredAuraVision; // 172 not used
float effectBonusCoefficient[MAX_EFFECT_INDEX]; // 173-175 (filled from SpellEffects.db2)
float effectBonusCoefficientFromAP[MAX_EFFECT_INDEX]; // 232-234

// custom
uint32 IsServerSide; // 176
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_sql.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
#define REVISION_DB_REALMD "required_z2800_01_realmd_platform"
#define REVISION_DB_LOGS "required_z2778_01_logs_anticheat"
#define REVISION_DB_CHARACTERS "required_z2799_01_characters_account_data"
#define REVISION_DB_MANGOS "required_z2817_01_mangos_spell_template"
#define REVISION_DB_MANGOS "required_z2818_01_mangos_spell_template_ap"
#endif // __REVISION_SQL_H__

0 comments on commit 229842f

Please sign in to comment.